|
@@ -1,6 +1,5 @@
|
|
|
package com.dayou.service.impl;
|
|
|
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
@@ -14,6 +13,7 @@ import com.dayou.common.BaseEntity;
|
|
|
import com.dayou.config.FileNetConfig;
|
|
|
import com.dayou.doc.house.ConditionDO;
|
|
|
import com.dayou.doc.house.ConsignorLetterDO;
|
|
|
+import com.dayou.doc.house.GuarantyResultDO;
|
|
|
import com.dayou.dto.HouseGuarantyTableDTO;
|
|
|
import com.dayou.dto.HouseGuarantyTargetDTO;
|
|
|
import com.dayou.dto.HousePledgeDTO;
|
|
@@ -41,7 +41,7 @@ import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.dayou.constants.HouseGuarantyDoc.*;
|
|
|
-import static com.dayou.enums.BusinessEnum.HouseGuarantyChapter.ORDINARY_ASSUMPTION;
|
|
|
+import static com.dayou.enums.BusinessEnum.HouseGuarantyProcess.GUARANTY_RESULT_REPORT;
|
|
|
import static com.dayou.enums.BusinessEnum.HouseGuarantyProcess.STATEMENT_CONDITIONS_EXPLAIN;
|
|
|
import static com.dayou.enums.BusinessEnum.HouseSubBusiness.GUARANTY;
|
|
|
import static com.dayou.enums.HouseTargetTableColumn.ID;
|
|
@@ -312,6 +312,59 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
|
|
|
return EasyExcelUtil.getExcelCellValue(workbook, BASE_INFO_ZH);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String genResultLetter(Long id) {
|
|
|
+ DocumentProduction dp = documentProductionService.getById(id);
|
|
|
+ HouseGuarantyProcess process = houseGuarantyProcessService.getById(dp.getBusinessId());
|
|
|
+ String baseDir = fileNetConfig.getBaseDir();
|
|
|
+ String home = baseDir + process.getHome();
|
|
|
+
|
|
|
+ try {
|
|
|
+ //读取估价对象数组
|
|
|
+ JSONArray array = JsonUtil.file2JsonArray(home + TARGETS_JSON);
|
|
|
+
|
|
|
+ JSONObject jsonObject = JsonUtil.file2JsonObject(home + BASE_INFO_JSON);
|
|
|
+
|
|
|
+ GuarantyResultDO guarantyResultDO = new GuarantyResultDO();
|
|
|
+ guarantyResultDO.setDocNo((String) jsonObject.get("报告号"));
|
|
|
+ guarantyResultDO.setConsignor((String) jsonObject.get("委托人"));
|
|
|
+ guarantyResultDO.setConsignorType((String) jsonObject.get("委托人类型"));
|
|
|
+ guarantyResultDO.setConsignorAddress((String) jsonObject.get("委托人住所"));
|
|
|
+ guarantyResultDO.setConsignorPerson((String) jsonObject.get("委托法定代表人"));
|
|
|
+ guarantyResultDO.setConsignorMoney((String) jsonObject.get("委托人注册资本"));
|
|
|
+ guarantyResultDO.setCreditCode((String) jsonObject.get("统一社会信用代码"));
|
|
|
+
|
|
|
+ Map<Object, List<Object>> collect = array.stream().collect(Collectors.groupingBy(x -> ((JSONObject) x).get(ID.getZhName())));
|
|
|
+ String targetScope = HouseDocumentUtil.combinationTargetDescription(collect);
|
|
|
+
|
|
|
+ guarantyResultDO.setTargetScope(targetScope);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ byte[] tmplWordByte = Files.readAllBytes(Paths.get(baseDir
|
|
|
+ + fileNetConfig.getHouseGuarantyTemplatePath() + GUARANTY_RESULT_TEMPLATE));
|
|
|
+
|
|
|
+ byte[] resultWordByte = AsposeWordUtil.fillWordDataByDomain(tmplWordByte, guarantyResultDO);
|
|
|
+
|
|
|
+ String guarantyResultName = process.getHome() +"GUARANTY_RESULT_TEMPLATE"+System.currentTimeMillis() + ".docx";
|
|
|
+ File resultFile = new File(baseDir + guarantyResultName);
|
|
|
+ FileOutputStream fos = new FileOutputStream(resultFile);
|
|
|
+ fos.write(resultWordByte);
|
|
|
+ fos.close();
|
|
|
+ //更新过程文档url
|
|
|
+ HouseGuarantyProcess houseGuarantyProcess = new HouseGuarantyProcess();
|
|
|
+ houseGuarantyProcess.setProcessName(GUARANTY_RESULT_REPORT.getMsg());
|
|
|
+ houseGuarantyProcess.setDocUrl(guarantyResultName);
|
|
|
+ houseGuarantyProcess.setHome(process.getHome());
|
|
|
+ houseGuarantyProcess.setParentId(process.getId());
|
|
|
+ houseGuarantyProcessService.save(houseGuarantyProcess);
|
|
|
+ return guarantyResultName;
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 插入估价结果一览表word文件
|
|
|
* @param mainWordPath
|