|
@@ -6,13 +6,15 @@ import com.alibaba.fastjson2.JSON;
|
|
|
import com.aspose.cells.SaveFormat;
|
|
|
import com.aspose.cells.Workbook;
|
|
|
import com.aspose.words.*;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.dayou.common.BaseEntity;
|
|
|
import com.dayou.config.FileNetConfig;
|
|
|
import com.dayou.doc.house.ConsignorLetterDO;
|
|
|
import com.dayou.dto.HouseGuarantyTableDTO;
|
|
|
import com.dayou.entity.DocumentProduction;
|
|
|
import com.dayou.entity.HouseGuarantyProcess;
|
|
|
import com.dayou.enums.DocumentType;
|
|
|
-import com.dayou.enums.MainBusiness;
|
|
|
+import com.dayou.enums.BusinessEnum;
|
|
|
import com.dayou.exception.ErrorCode;
|
|
|
import com.dayou.service.DocumentProductionService;
|
|
|
import com.dayou.service.HouseGuarantyProcessService;
|
|
@@ -67,6 +69,7 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
|
|
|
HouseGuarantyProcess hgp = new HouseGuarantyProcess();
|
|
|
hgp.setHome(homePath);
|
|
|
hgp.setTargetsHtml(html);
|
|
|
+ hgp.setProcessName(BusinessEnum.HouseGuarantyProcess.CONSIGNOR_LETTER.getMsg());
|
|
|
houseGuarantyProcessService.save(hgp);
|
|
|
wordTableHelper.createTableWord(xHtml, fileNetConfig.getBaseDir() + homePath);
|
|
|
return hgp.getId();
|
|
@@ -104,7 +107,9 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
HouseGuarantyProcess process = houseGuarantyProcessService.getById(id);
|
|
|
- String home = fileNetConfig.getBaseDir() + process.getHome();
|
|
|
+ String baseDir = fileNetConfig.getBaseDir();
|
|
|
+ String home = baseDir + process.getHome();
|
|
|
+
|
|
|
try {
|
|
|
// 读取估价对象地址
|
|
|
JSONArray array = JsonUtil.file2JsonArray(home + TARGETS_JSON);
|
|
@@ -144,17 +149,19 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
|
|
|
clDO.setOwnshipUser(ownShipUser);
|
|
|
removeBlank = false;
|
|
|
}
|
|
|
- byte[] tmplWordByte = Files.readAllBytes(Paths.get(fileNetConfig.getBaseDir()
|
|
|
+ byte[] tmplWordByte = Files.readAllBytes(Paths.get(baseDir
|
|
|
+ fileNetConfig.getHouseGuarantyTemplatePath() + CONSIGNOR_LETTER_TEMPLATE));
|
|
|
byte[] resultWordByte = AsposeWordUtil.fillWordDataByDomain(tmplWordByte, clDO);
|
|
|
- String consignorLetterName = home + System.currentTimeMillis() + ".docx";
|
|
|
- File resultFile = new File(consignorLetterName);
|
|
|
+ String consignorLetterName = process.getHome() + System.currentTimeMillis() + ".docx";
|
|
|
+ File resultFile = new File(baseDir + consignorLetterName);
|
|
|
FileOutputStream fos = new FileOutputStream(resultFile);
|
|
|
fos.write(resultWordByte);
|
|
|
fos.close();
|
|
|
- insetTargetTableWord(consignorLetterName,home + TARGETS_DOCX,removeBlank);
|
|
|
-
|
|
|
- documentProductionService.save(buildDocumentProduction(id,projectName,docNo,consignorLetterName,consignor));
|
|
|
+ insetTargetTableWord(baseDir + consignorLetterName,home + TARGETS_DOCX,removeBlank);
|
|
|
+ //更新过程文档url
|
|
|
+ houseGuarantyProcessService.update(new LambdaUpdateWrapper<HouseGuarantyProcess>().set(HouseGuarantyProcess::getDocUrl, consignorLetterName)
|
|
|
+ .eq(BaseEntity::getId,id));
|
|
|
+ documentProductionService.save(buildDocumentProduction(id,projectName,docNo,consignor));
|
|
|
return consignorLetterName;
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException(e);
|
|
@@ -207,14 +214,13 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private DocumentProduction buildDocumentProduction(Long id,String docName,String docNo,String docUrl,String consignor){
|
|
|
+ private DocumentProduction buildDocumentProduction(Long id,String docName,String docNo,String consignor){
|
|
|
DocumentProduction dp = new DocumentProduction();
|
|
|
- dp.setBusinessType(MainBusiness.HOUSE.getMsg());
|
|
|
- dp.setBusinessCate(MainBusiness.HouseSubBusiness.GUARANTY.getMsg());
|
|
|
+ dp.setBusinessType(BusinessEnum.HOUSE_BUSINESS.getMsg());
|
|
|
+ dp.setBusinessCate(BusinessEnum.HouseSubBusiness.GUARANTY.getMsg());
|
|
|
dp.setBusinessId(id);
|
|
|
dp.setDocName(docName);
|
|
|
dp.setDocType(DocumentType.REPORT.getName());
|
|
|
- dp.setDocUrl(docUrl);
|
|
|
dp.setDocNo(docNo);
|
|
|
dp.setConsignor(consignor);
|
|
|
return dp;
|