Forráskód Böngészése

Merge branch 'master' of http://47.108.172.52:3000/dayou/productivity-platform

GouGengquan 7 hónapja
szülő
commit
771d5c9c94
31 módosított fájl, 431 hozzáadás és 262 törlés
  1. 27 0
      biz-base/src/main/java/com/dayou/controller/GlobalConfigController.java
  2. 0 1
      biz-base/src/main/java/com/dayou/controller/HouseGuarantyAreaController.java
  3. 40 0
      biz-base/src/main/java/com/dayou/controller/HouseGuarantyBaseController.java
  4. 7 6
      biz-base/src/main/java/com/dayou/controller/HouseGuarantyDocController.java
  5. 0 1
      biz-base/src/main/java/com/dayou/controller/HouseGuarantyTargetController.java
  6. 1 1
      biz-base/src/test/java/com/dayou/ConditionDocumentTest.java
  7. 1 1
      biz-base/src/test/java/com/dayou/FreeMarkTest.java
  8. 63 124
      common/src/main/java/com/dayou/utils/HouseDocumentUtil.java
  9. 11 0
      dao/src/main/java/com/dayou/mapper/GlobalConfigMapper.java
  10. 2 0
      dao/src/main/java/com/dayou/mapper/HouseGuarantyBaseMapper.java
  11. 22 0
      dao/src/main/resources/mapper/GlobalConfigMapper.xml
  12. 9 0
      dao/src/main/resources/mapper/HouseGuarantyBaseMapper.xml
  13. 10 5
      dao/src/main/resources/mapper/HouseTargetEntityMapper.xml
  14. 5 0
      domain/src/main/java/com/dayou/doc/house/GuarantyResultDO.java
  15. 2 0
      domain/src/main/java/com/dayou/dto/HouseGuarantyTableDTO.java
  16. 0 2
      domain/src/main/java/com/dayou/entity/DocumentProduction.java
  17. 15 0
      domain/src/main/java/com/dayou/entity/GlobalConfig.java
  18. 39 6
      domain/src/main/java/com/dayou/entity/HouseGuarantyBase.java
  19. 5 0
      domain/src/main/java/com/dayou/entity/HouseGuarantyProcess.java
  20. 2 22
      domain/src/main/java/com/dayou/entity/HouseGuarantyTarget.java
  21. 6 0
      domain/src/main/java/com/dayou/entity/HouseTargetEntity.java
  22. 11 0
      service/src/main/java/com/dayou/service/GlobalConfigService.java
  23. 4 0
      service/src/main/java/com/dayou/service/HouseGuarantyBaseService.java
  24. 4 3
      service/src/main/java/com/dayou/service/HouseGuarantyService.java
  25. 2 0
      service/src/main/java/com/dayou/service/HouseTargetEntityService.java
  26. 3 3
      service/src/main/java/com/dayou/service/TmplHouseParagraphService.java
  27. 24 0
      service/src/main/java/com/dayou/service/impl/GlobalConfigServiceImpl.java
  28. 26 0
      service/src/main/java/com/dayou/service/impl/HouseGuarantyBaseServiceImpl.java
  29. 60 70
      service/src/main/java/com/dayou/service/impl/HouseGuarantyServiceImpl.java
  30. 15 0
      service/src/main/java/com/dayou/service/impl/HouseTargetEntityServiceImpl.java
  31. 15 17
      service/src/main/java/com/dayou/service/impl/TmplHouseParagraphServiceImpl.java

+ 27 - 0
biz-base/src/main/java/com/dayou/controller/GlobalConfigController.java

@@ -0,0 +1,27 @@
+package com.dayou.controller;
+
+import com.dayou.entity.GlobalConfig;
+import com.dayou.result.Result;
+import com.dayou.service.GlobalConfigService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("globalConfig")
+@Slf4j
+public class GlobalConfigController {
+
+    @Autowired
+    private GlobalConfigService globalConfigService;
+
+    @GetMapping("/type")
+    public Result<List<GlobalConfig>> byType(String type){
+        List<GlobalConfig> ret = globalConfigService.getByType(type);
+        return Result.build(ret);
+    }
+}

+ 0 - 1
biz-base/src/main/java/com/dayou/controller/HouseGuarantyAreaController.java

@@ -1,6 +1,5 @@
 package com.dayou.controller;
 
-import com.dayou.entity.HouseGuarantyAim;
 import com.dayou.entity.HouseGuarantyArea;
 import com.dayou.result.Result;
 import com.dayou.service.HouseGuarantyAreaService;

+ 40 - 0
biz-base/src/main/java/com/dayou/controller/HouseGuarantyBaseController.java

@@ -0,0 +1,40 @@
+package com.dayou.controller;
+
+import com.dayou.entity.HouseGuarantyBase;
+import com.dayou.result.Result;
+import com.dayou.service.HouseGuarantyBaseService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 房地产抵押基本信息
+ */
+@RestController
+@RequestMapping("houseGuarantyBase")
+@Slf4j
+public class HouseGuarantyBaseController {
+
+    @Autowired
+    private HouseGuarantyBaseService houseGuarantyBaseService;
+
+    /**
+     * 基本信息保存
+     * @param base
+     * @return
+     */
+    @PostMapping("")
+    public Result<Long> add(@RequestBody  HouseGuarantyBase base){
+        return Result.build(houseGuarantyBaseService.add(base));
+    }
+
+    /**
+     * 根据id查询
+     * @param docId
+     * @return
+     */
+    @GetMapping("/{docId}")
+    public Result<HouseGuarantyBase> getByDocId(@PathVariable("docId") Long docId){
+        return Result.build(houseGuarantyBaseService.getByDocId(docId));
+    }
+}

+ 7 - 6
biz-base/src/main/java/com/dayou/controller/HouseGuarantyDocController.java

@@ -2,6 +2,7 @@ package com.dayou.controller;
 
 
 import com.dayou.dto.HouseGuarantyTableDTO;
+import com.dayou.entity.HouseGuarantyBase;
 import com.dayou.entity.HouseGuarantyProcess;
 import com.dayou.result.Result;
 import com.dayou.service.HouseGuarantyProcessService;
@@ -39,13 +40,13 @@ public class HouseGuarantyDocController {
     }
 
     /**
-     * 解析表单1
-     * @param id
+     * 解析表单中的估价对象
+     * @param processId
      * @return
      */
-    @GetMapping("/collect1/{id}")
-    public Result<Long> analysisCollect1(@PathVariable("id") Long id) throws Exception {
-        return Result.build(houseGuarantyService.analysisCollect1(id));
+    @GetMapping("/collect1/{processId}")
+    public Result<Long> analysisCollect1(@PathVariable("processId") Long processId) throws Exception {
+        return Result.build(houseGuarantyService.analysisCollect1(processId));
     }
 
     /**
@@ -106,7 +107,7 @@ public class HouseGuarantyDocController {
      * @return
      */
     @GetMapping("/result/{id}")
-    public Result<String> genResultLetter(@PathVariable("id") Long id){
+    public Result<Boolean> genResultLetter(@PathVariable("id") Long id){
         return Result.build(houseGuarantyService.genResultLetter(id));
     }
 

+ 0 - 1
biz-base/src/main/java/com/dayou/controller/HouseGuarantyTargetController.java

@@ -5,7 +5,6 @@ import com.dayou.entity.HouseGuarantyTarget;
 import com.dayou.result.Result;
 import com.dayou.service.HouseGuarantyAimService;
 import com.dayou.service.HouseGuarantyTargetService;
-import com.dayou.vo.HouseTargetVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;

+ 1 - 1
biz-base/src/test/java/com/dayou/ConditionDocumentTest.java

@@ -41,7 +41,7 @@ public class ConditionDocumentTest {
 
         //String wdsxjsResult = tmplHouseParagraphService.findWDSXJSResult(targets, landCerts);
        //String bxyzjsResult = tmplHouseParagraphService.findBXYZJSResult(targets, cersList, "2024年2月23日");
-        String yjbujsResult = tmplHouseParagraphService.findYJBUJSResult(targets, cersList, NO,"收益法");
+        String yjbujsResult = tmplHouseParagraphService.findYJBUJSResult(targets, cersList, false,"收益法");
         System.out.println(yjbujsResult);
 
     }

+ 1 - 1
biz-base/src/test/java/com/dayou/FreeMarkTest.java

@@ -97,7 +97,7 @@ public class FreeMarkTest {
         XSSFWorkbook workbook = new XSSFWorkbook("/Users/wuwei/opt/temp/collect1.xlsx");
         //读取估价对象数组
         List<HouseGuarantyAim> aims = houseGuarantyAimService.list(new LambdaQueryWrapper<HouseGuarantyAim>().eq(HouseGuarantyAim::getDocId, 58));
-        HouseGuarantyBase base = houseGuarantyBaseService.getOne(new LambdaQueryWrapper<HouseGuarantyBase>().eq(HouseGuarantyBase::getDocId, 58));
+        HouseGuarantyBase base = houseGuarantyBaseService.getById(59L);
         base.setProjectName(HouseDocumentUtil.getProjectName(aims));
         Map<Object, List<Object>> collect = array.stream().collect(Collectors.groupingBy(x -> ((JSONObject) x).get(TID.getZhName())));
         String actDesc = "";

+ 63 - 124
common/src/main/java/com/dayou/utils/HouseDocumentUtil.java

@@ -11,6 +11,7 @@ import com.dayou.dto.HouseRightsDTO;
 import com.dayou.entity.HouseGuarantyAim;
 import com.dayou.entity.*;
 import com.dayou.enums.HouseTargetTableColumn;
+import com.dayou.exception.BusinessException;
 import com.dayou.exception.ErrorCode;
 import com.dayou.table.HouseAreaTable;
 
@@ -197,7 +198,7 @@ public class HouseDocumentUtil {
 
         Set<String> landType = aims.stream().map(HouseGuarantyAim::getLandType).collect(Collectors.toSet());
 
-        List<Object> outerAcreage = aims.stream().map(HouseGuarantyAim::getOuterAcreage).collect(Collectors.toList());
+        List<Object> outerAcreage = aims.stream().filter(x->!"/".equals(x.getOuterAcreage())).map(HouseGuarantyAim::getOuterAcreage).collect(Collectors.toList());
 
         Set<String> useTo = aims.stream().map(HouseGuarantyAim::getUseTo).collect(Collectors.toSet());
 
@@ -271,7 +272,7 @@ public class HouseDocumentUtil {
      * @param list
      * @return
      */
-    public static BigDecimal sumList(List<Object> list){
+    public static BigDecimal sumList(List<Object> list) {
         BigDecimal sum = null;
         try {
             sum = (BigDecimal) list.stream().reduce(BigDecimal.ZERO, (a, b) -> {
@@ -492,8 +493,8 @@ public class HouseDocumentUtil {
      * @param tmplHouseParagraph 段落模版
      * @return
      */
-    public static String getCheckOriginCertificate(String isCheckOriginCertificate,List<String> certificates, TmplHouseParagraph tmplHouseParagraph){
-        if (checkBoolean(isCheckOriginCertificate)){
+    public static String getCheckOriginCertificate(Boolean isCheckOriginCertificate,List<String> certificates, TmplHouseParagraph tmplHouseParagraph){
+        if (isCheckOriginCertificate){
             String paragraph = tmplHouseParagraph.getParagraph();
             return paragraph.replace("{certificates}",CollectionUtil.formatDotAndRemoveMiddle(certificates));
         }
@@ -828,8 +829,8 @@ public class HouseDocumentUtil {
      * @param tmplParagraph
      * @return
      */
-    public static String isBigCertificateOnlyHouse(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph,String isCheckOriginCertificate) {
-        if (CollectionUtil.isNotEmpty(targets) && !checkBoolean(isCheckOriginCertificate)){
+    public static String isBigCertificateOnlyHouse(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph,Boolean isCheckOriginCertificate) {
+        if (CollectionUtil.isNotEmpty(targets) && !isCheckOriginCertificate){
             List<HouseGuarantyTarget> collect = targets.stream().filter(x -> StrUtil.isNotBlank(x.getLandCertificateType()) &&
                     x.getLandCertificateType().equals("大证") && !x.getHouseGetLandInfo()).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect)){
@@ -847,9 +848,9 @@ public class HouseDocumentUtil {
      * @param tmplParagraph
      * @return
      */
-    public static String isNotOriginCertificateOnlyHouse(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph,String isCheckOriginCertificate,List<String> certificates) {
+    public static String isNotOriginCertificateOnlyHouse(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph,Boolean isCheckOriginCertificate,List<String> certificates) {
         if (CollectionUtil.isNotEmpty(targets)){
-            if (!checkBoolean(isCheckOriginCertificate)){
+            if (!isCheckOriginCertificate){
                 List<String> tIds = targets.stream().map(HouseGuarantyTarget::getTid).collect(Collectors.toList());
                 String paragraph = tmplParagraph.getParagraph();
                 return paragraph.replace("{tIds}", CollectionUtil.formatDotAndRemoveMiddle(tIds)).replace("{certificates}", CollectionUtil.formatDotAndRemoveMiddle(certificates));
@@ -864,8 +865,8 @@ public class HouseDocumentUtil {
      * @param tmplParagraph
      * @return
      */
-    public static String isNotOriginFileInChengDu(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph ,String isCheckOriginCertificate,List<String> certificates) {
-        if (CollectionUtil.isNotEmpty(targets) && !checkBoolean(isCheckOriginCertificate)){
+    public static String isNotOriginFileInChengDu(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph ,Boolean isCheckOriginCertificate,List<String> certificates) {
+        if (CollectionUtil.isNotEmpty(targets) && !isCheckOriginCertificate){
             List<String> tIds = new ArrayList<>();
             for (HouseGuarantyTarget target : targets) {
                 List<HouseGuarantyAim> targetDTOS = target.getAims();
@@ -892,8 +893,8 @@ public class HouseDocumentUtil {
      * @param tmplParagraph
      * @return
      */
-    public static String isNotOriginFileOutChengDu(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph,String isCheckOriginCertificate,List<String> certificates) {
-        if (CollectionUtil.isNotEmpty(targets) && !checkBoolean(isCheckOriginCertificate)){
+    public static String isNotOriginFileOutChengDu(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph,Boolean isCheckOriginCertificate,List<String> certificates) {
+        if (CollectionUtil.isNotEmpty(targets) && !isCheckOriginCertificate){
             List<String> tIds = new ArrayList<>();
             for (HouseGuarantyTarget target : targets) {
                 List<HouseGuarantyAim> targetDTOS = target.getAims();
@@ -991,36 +992,28 @@ public class HouseDocumentUtil {
      * @param tmplParagraph
      * @return
      */
-    public static String isOldPledgeToNewPledge(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph) {
+    public static String isOldPledgeToNewPledge(TmplHouseParagraph tmplParagraph,HouseGuarantyBase base) {
         StringBuilder result = new StringBuilder();
         String paragraph = tmplParagraph.getParagraph();
-        if (CollectionUtil.isNotEmpty(targets)){
-            List<HouseGuarantyTarget> collect = targets.stream().filter(x -> (x.getHasPledge()!=null &&
-                    x.getHasPledge() && StrUtil.isNotBlank(x.getPledgeType())
-                    && StrUtil.isNotBlank(x.getPledgeUser()) && StrUtil.isNotBlank(x.getPledgeValue())
-                    && StrUtil.isNotBlank(x.getNewPledgeUser()))).collect(Collectors.toList());
-            if (CollectionUtil.isNotEmpty(collect)){
-                for (int i = 0; i < collect.size(); i++){
-                    String replace = getString(collect.get(i), paragraph);
-                    result.append(replace);
-                    if (i != collect.size()-1){
-                        result.append("\n");
-                    }
-                }
-            }
+        if (base.getHasPledge()){
+//            List<HouseGuarantyTarget> collect = targets.stream().filter(x -> (x.getHasPledge()!=null &&
+//                    x.getHasPledge() && StrUtil.isNotBlank(x.getPledgeType())
+//                    && StrUtil.isNotBlank(x.getPledgeUser()) && StrUtil.isNotBlank(x.getPledgeValue())
+//                    && StrUtil.isNotBlank(x.getNewPledgeUser()))).collect(Collectors.toList());
+
+            String replace = getString(paragraph,base);
+            result.append(replace);
             return result.toString();
         }
         return null;
     }
 
-    private static String getString(HouseGuarantyTarget target, String paragraph) {
-        String pledgeType = target.getPledgeType();
-        String pledgeUser = target.getPledgeUser();
-        String pledgeValue = target.getPledgeValue();
-        String newPledgeUser = target.getNewPledgeUser();
-        String tId = target.getTid();
-        return paragraph.replace("{tId}", tId)
-                .replace("{tId}", tId).replace("{pledgeType}", pledgeType).replace("{pledgeType}", pledgeType)
+    private static String getString(String paragraph,HouseGuarantyBase base) {
+        String pledgeType = base.getPledgeType();
+        String pledgeUser = base.getPledgeUser();
+        String pledgeValue = base.getPledgeValue();
+        String newPledgeUser = base.getNewPledgeUser();
+        return paragraph.replace("{pledgeType}", pledgeType).replace("{pledgeType}", pledgeType)
                 .replace("{pledgeUser}", pledgeUser).replace("{pledgeValue}",
                         pledgeValue).replace("{newPledgeUser}", newPledgeUser);
     }
@@ -1052,27 +1045,18 @@ public class HouseDocumentUtil {
 
     /**
      * 限制条件 适用于原抵押权未注销,现拟设立最高额抵押权,同一抵押权人
-     * @param targets
      * @param tmplParagraph
      * @return
      */
-    public static String isOldPledgeToOldPledge(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph) {
+    public static String isOldPledgeToOldPledge( TmplHouseParagraph tmplParagraph,HouseGuarantyBase base) {
         StringBuilder result = new StringBuilder();
         String paragraph = tmplParagraph.getParagraph();
-        if (CollectionUtil.isNotEmpty(targets)){
-            List<HouseGuarantyTarget> collect = targets.stream().filter(x -> x.getHasPledge()!=null &&
-                    x.getHasPledge() && StrUtil.isNotBlank(x.getPledgeType())
-                    && x.getSamePledgeHigh()!=null &&x.getSamePledgeHigh()).collect(Collectors.toList());
-            if (CollectionUtil.isNotEmpty(collect)){
-                for (int i = 0; i < collect.size(); i++){
-                    String tId = collect.get(i).getTid();
-                    String pledgeUser = collect.get(i).getPledgeUser();
-                    result.append(paragraph.replace("{tId}", tId).replace("{tId}",tId).replace("{pledgeUser}",pledgeUser));
-                    if (i != collect.size()-1){
-                        result.append("\n");
-                    }
-                }
-            }
+        if (base.getHasPledge()){
+//            List<HouseGuarantyTarget> collect = targets.stream().filter(x -> x.getHasPledge()!=null &&
+//                    x.getHasPledge() && StrUtil.isNotBlank(x.getPledgeType())
+//                    && x.getSamePledgeHigh()!=null &&x.getSamePledgeHigh()).collect(Collectors.toList());
+            String pledgeUser = base.getPledgeUser();
+            result.append(paragraph.replace("{pledgeUser}",pledgeUser));
             return result.toString();
         }
         return null;
@@ -1100,13 +1084,12 @@ public class HouseDocumentUtil {
 
     /**
      * 限制条件 是否提供技术报告
-     * @param targets
      * @param tmplParagraph
      * @return
      */
-    public static String isProvideTechReport(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph,String hasTechReport) {
+    public static String isProvideTechReport(TmplHouseParagraph tmplParagraph,Boolean hasTechReport) {
         String paragraph = tmplParagraph.getParagraph();
-        if (checkBoolean(hasTechReport)){
+        if (hasTechReport){
             return paragraph.replace("{hasTechReport}","、“估价技术报告”");
         }
         return paragraph.replace("{hasTechReport}","");
@@ -1117,8 +1100,8 @@ public class HouseDocumentUtil {
      * @param tmplParagraph
      * @return
      */
-    public static String isNSBank(TmplHouseParagraph tmplParagraph,String isNsBank) {
-        return checkBoolean(isNsBank)?tmplParagraph.getParagraph():null;
+    public static String isNSBank(TmplHouseParagraph tmplParagraph,Boolean isNsBank) {
+        return isNsBank?tmplParagraph.getParagraph():null;
     }
 
     /**
@@ -1126,24 +1109,18 @@ public class HouseDocumentUtil {
      * @param tmplParagraph
      * @return
      */
-    public static String isNormalBank( TmplHouseParagraph tmplParagraph,String isNsBank) {
-        return !checkBoolean(isNsBank)?tmplParagraph.getParagraph():null;
+    public static String isNormalBank( TmplHouseParagraph tmplParagraph,Boolean isNsBank) {
+        return !isNsBank?tmplParagraph.getParagraph():null;
     }
 
     /**
      * 估价中的特殊处理事项 无法定优先受偿款
-     * @param targets
      * @param tmplParagraph
      * @return
      */
-    public static String isNoFirstMoney(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph) {
-        if (CollectionUtil.isNotEmpty(targets)){
-            List<HouseGuarantyTarget> collect = targets.stream().filter(x -> StrUtil.isBlank(x.getFirstMoney())).collect(Collectors.toList());
-            if (CollectionUtil.isNotEmpty(collect)){
-                List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTid).collect(Collectors.toList());
-                String paragraph = tmplParagraph.getParagraph();
-                return paragraph.replace("{tIds}", CollectionUtil.formatDotAndRemoveMiddle(tIds));
-            }
+    public static String isNoFirstMoney(TmplHouseParagraph tmplParagraph,HouseGuarantyBase base) {
+        if (StrUtil.isNotBlank(base.getFirstMoney())){
+            return tmplParagraph.getParagraph();
         }
         return null;
     }
@@ -1154,17 +1131,10 @@ public class HouseDocumentUtil {
      * @param tmplParagraph
      * @return
      */
-    public static String isSamePledgeUserContinue(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph) {
-        if (CollectionUtil.isNotEmpty(targets)){
-            List<HouseGuarantyTarget> collect = targets.stream().filter(x -> x.getSamePledgeContinue()!=null &&
-                    x.getSamePledgeContinue() && StrUtil.isNotBlank(x.getPledgeType())).collect(Collectors.toList());
-            if (CollectionUtil.isNotEmpty(collect)){
-                List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTid).collect(Collectors.toList());
-                Set<String> pledgeTypes = collect.stream().map(HouseGuarantyTarget::getPledgeType).collect(Collectors.toSet());
+    public static String isSamePledgeUserContinue(TmplHouseParagraph tmplParagraph,HouseGuarantyBase base) {
+        if (base.getSamePledgeContinue()!=null && base.getSamePledgeContinue() && StrUtil.isNotBlank(base.getPledgeType())){
                 String paragraph = tmplParagraph.getParagraph();
-                return paragraph.replace("{tIds}", CollectionUtil.formatDotAndRemoveMiddle(tIds))
-                        .replace("{pledgeTypes}",CollectionUtil.formatDotAndRemoveMiddle(pledgeTypes));
-            }
+                return paragraph.replace("{pledgeTypes}",base.getPledgeType());
         }
         return null;
     }
@@ -1175,24 +1145,13 @@ public class HouseDocumentUtil {
      * @param tmplParagraph
      * @return
      */
-    public static String isOldPledgeToNewPledgeSpecial(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph) {
+    public static String isOldPledgeToNewPledgeSpecial(TmplHouseParagraph tmplParagraph,HouseGuarantyBase base) {
         StringBuilder result = new StringBuilder();
         String paragraph = tmplParagraph.getParagraph();
-        if (CollectionUtil.isNotEmpty(targets)){
-            List<HouseGuarantyTarget> collect = targets.stream().filter(x -> StrUtil.isNotBlank(x.getPledgeType())
-                    && StrUtil.isNotBlank(x.getNewPledgeUser())).collect(Collectors.toList());
-            if (CollectionUtil.isNotEmpty(collect)){
-                for (int i = 0; i < collect.size(); i++){
-                    String tId = collect.get(i).getTid();
-                    String pledgeType = collect.get(i).getPledgeType();
-                    String newPledgeUser = collect.get(i).getNewPledgeUser();
-                    result.append(paragraph.replace("{tId}", tId)
-                            .replace("{pledgeType}", pledgeType).replace("{newPledgeUser}",newPledgeUser));
-                    if (i != collect.size()-1){
-                        result.append("\n");
-                    }
-                }
-            }
+        if (StrUtil.isNotBlank(base.getPledgeType()) && StrUtil.isNotBlank(base.getNewPledgeUser())){
+            String pledgeType = base.getPledgeType();
+            String newPledgeUser = base.getNewPledgeUser();
+            result.append(paragraph.replace("{pledgeType}", pledgeType).replace("{newPledgeUser}",newPledgeUser));
             return result.toString();
         }
         return null;
@@ -1200,27 +1159,17 @@ public class HouseDocumentUtil {
 
     /**
      * 估价中的特殊处理事项 适用于原已设立抵押权,现拟设立最高额抵押权,同一抵押权人
-     * @param targets
      * @param tmplParagraph
      * @return
      */
-    public static String isNormalPledgeToHighPledge(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph) {
+    public static String isNormalPledgeToHighPledge(TmplHouseParagraph tmplParagraph,HouseGuarantyBase base) {
         StringBuilder result = new StringBuilder();
         String paragraph = tmplParagraph.getParagraph();
-        if (CollectionUtil.isNotEmpty(targets)){
-            List<HouseGuarantyTarget> collect = targets.stream().filter(x -> x.getHasPledge()!=null &&
-                    x.getHasPledge() && StrUtil.isNotBlank(x.getPledgeType()) && x.getSamePledgeHigh()!=null &&
-                    x.getSamePledgeHigh()).collect(Collectors.toList());
-            if (CollectionUtil.isNotEmpty(collect)){
-                for (int i = 0; i < collect.size(); i++){
-                    String tId = collect.get(i).getTid();
-                    String pledgeUser = collect.get(i).getPledgeUser();
-                    result.append(paragraph.replace("{tId}", tId).replace("{tId}",tId).replace("{pledgeUser}",pledgeUser));
-                    if (i != collect.size()-1){
-                        result.append("\n");
-                    }
-                }
-            }
+        if (base.getHasPledge()!=null &&
+            base.getHasPledge() && StrUtil.isNotBlank(base.getPledgeType()) && base.getSamePledgeHigh()!=null &&
+            base.getSamePledgeHigh()){
+            String pledgeUser = base.getPledgeUser();
+            result.append(paragraph.replace("{pledgeUser}",pledgeUser));
             return result.toString();
         }
         return null;
@@ -1228,26 +1177,16 @@ public class HouseDocumentUtil {
 
     /**
      * 估价中的特殊处理事项 适用于已设立最高额抵押权,抵押未到期
-     * @param targets
      * @param tmplParagraph
      * @return
      */
-    public static String isHighPledgeNotExpire(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph) {
+    public static String isHighPledgeNotExpire( TmplHouseParagraph tmplParagraph,HouseGuarantyBase base) {
         StringBuilder result = new StringBuilder();
         String paragraph = tmplParagraph.getParagraph();
-        if (CollectionUtil.isNotEmpty(targets)){
-            List<HouseGuarantyTarget> collect = targets.stream().filter(x -> x.getHasPledge()!=null && x.getHasPledge()
-                    &&  x.getHighPledgeNotExpire()!=null && x.getHighPledgeNotExpire()).collect(Collectors.toList());
-            if (CollectionUtil.isNotEmpty(collect)){
-                for (int i = 0; i < collect.size(); i++){
-                    String tId = collect.get(i).getTid();
-                    String pledgeUser = collect.get(i).getPledgeUser();
-                    result.append(paragraph.replace("{tId}", tId).replace("{tId}",tId).replace("{pledgeUser}",pledgeUser));
-                    if (i != collect.size()-1){
-                        result.append("\n");
-                    }
-                }
-            }
+        if (base.getHasPledge()!=null && base.getHasPledge()
+                &&  base.getHighPledgeNotExpire()!=null && base.getHighPledgeNotExpire()){
+            String pledgeUser = base.getPledgeUser();
+            result.append(paragraph.replace("{pledgeUser}",pledgeUser));
             return result.toString();
         }
         return null;

+ 11 - 0
dao/src/main/java/com/dayou/mapper/GlobalConfigMapper.java

@@ -0,0 +1,11 @@
+package com.dayou.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.dayou.entity.GlobalConfig;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface GlobalConfigMapper extends BaseMapper<GlobalConfig> {
+    List<GlobalConfig> getByType(@Param("type") String type);
+}

+ 2 - 0
dao/src/main/java/com/dayou/mapper/HouseGuarantyBaseMapper.java

@@ -2,7 +2,9 @@ package com.dayou.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.dayou.entity.HouseGuarantyBase;
+import org.apache.ibatis.annotations.Param;
 
 public interface HouseGuarantyBaseMapper extends BaseMapper<HouseGuarantyBase> {
 
+    HouseGuarantyBase getByDocId(@Param("docId") Long docId);
 }

+ 22 - 0
dao/src/main/resources/mapper/GlobalConfigMapper.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dayou.mapper.GlobalConfigMapper">
+
+
+    <select id="getByType" parameterType="java.lang.String" resultType="com.dayou.entity.GlobalConfig">
+        SELECT
+            id,
+            type,
+            `key`,
+            `value`
+        FROM
+            global_config
+        WHERE
+            delete_status = 0
+          AND (
+            type = #{type})
+        ORDER BY
+            id DESC
+    </select>
+
+</mapper>

+ 9 - 0
dao/src/main/resources/mapper/HouseGuarantyBaseMapper.xml

@@ -2,5 +2,14 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.dayou.mapper.HouseGuarantyBaseMapper">
 
+    <select id="getByDocId" parameterType="java.lang.Long" resultType="com.dayou.entity.HouseGuarantyBase">
+        SELECT
+            *
+        FROM
+            house_guaranty_base
+        WHERE
+            id = ( SELECT base_id FROM house_guaranty_process WHERE id = ( SELECT business_id FROM document_production WHERE id = #{docId} AND delete_status = 0 ) AND delete_status = 0 )
+          AND delete_status = 0
+    </select>
 
 </mapper>

+ 10 - 5
dao/src/main/resources/mapper/HouseTargetEntityMapper.xml

@@ -4,6 +4,10 @@
 
     <select id="getListById" parameterType="java.lang.Long" resultType="com.dayou.entity.HouseTargetEntity">
         SELECT
+            hga.id as xId,
+            hga.doc_id as xDodId,
+            hga.tid as xTid,
+            hga.tno as xTno,
             hte.*,
             clu.location as landLocation,
             clu.acreage as landAcreage,
@@ -20,18 +24,19 @@
             hgt.land_use_to as targetLandUseTo,
             hgt.land_use_type as targetLandUseType
         FROM
-            house_target_entity hte
-                LEFT JOIN (select business_id,tid,tno,certificate_no,location,acreage,use_to,use_type,expire_date from certificate_land_use where delete_status = 0) clu ON (
+            house_guaranty_aim hga left join
+                (select * from house_target_entity where delete_status = 0 ) hte on (hga.doc_id = hte.doc_id and hga.tid = hte.tid and hga.tno = hte.tno)
+                                   LEFT JOIN (select business_id,tid,tno,certificate_no,location,acreage,use_to,use_type,expire_date from certificate_land_use where delete_status = 0) clu ON (
                 hte.doc_id = clu.business_id
                     AND hte.tid = clu.tid
                     AND hte.tno = clu.tno)
-                left join  (select business_id,tid,tno,certificate_no,location,acreage_desc,use_to,own_ship_nature,expire_date_desc from certificate_fixed_assets where delete_status = 0) cfa on (
+                                   left join  (select business_id,tid,tno,certificate_no,location,acreage_desc,use_to,own_ship_nature,expire_date_desc from certificate_fixed_assets where delete_status = 0) cfa on (
                 hte.doc_id = cfa.business_id
                     AND hte.tid = cfa.tid
                     AND hte.tno = cfa.tno
                 )
-                left join (select tid,doc_id,land_use_to ,land_use_type from house_guaranty_target where delete_status = 0) hgt on (hgt.doc_id = hte.doc_id and hgt.tid = hte.tid)
-        where hte.delete_status=0 and hte.doc_id = #{docId}
+                                   left join (select tid,doc_id,land_use_to ,land_use_type from house_guaranty_target where delete_status = 0) hgt on (hgt.doc_id = hte.doc_id and hgt.tid = hte.tid)
+        where hga.delete_status=0 and hga.doc_id = #{docId}
         order by hte.tid asc ,hte.tno asc
     </select>
 

+ 5 - 0
domain/src/main/java/com/dayou/doc/house/GuarantyResultDO.java

@@ -55,4 +55,9 @@ public class GuarantyResultDO {
      */
     private String landInfo;
 
+    /**
+     * 价值时点
+     */
+    private String valueTiming;
+
 }

+ 2 - 0
domain/src/main/java/com/dayou/dto/HouseGuarantyTableDTO.java

@@ -8,4 +8,6 @@ public class HouseGuarantyTableDTO {
     private String html;
 
     private String homePath;
+
+    private Long baseId;
 }

+ 0 - 2
domain/src/main/java/com/dayou/entity/DocumentProduction.java

@@ -74,6 +74,4 @@ public class DocumentProduction extends BaseEntity implements Serializable {
      */
     private Long businessSubId;
 
-
-
 }

+ 15 - 0
domain/src/main/java/com/dayou/entity/GlobalConfig.java

@@ -0,0 +1,15 @@
+package com.dayou.entity;
+
+import com.dayou.common.BaseEntity;
+import lombok.Data;
+
+@Data
+public class GlobalConfig extends BaseEntity {
+
+    private String type;
+
+    private String key;
+
+    private String value;
+
+}

+ 39 - 6
domain/src/main/java/com/dayou/entity/HouseGuarantyBase.java

@@ -4,15 +4,14 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.dayou.common.BaseEntity;
 import lombok.Data;
 
+import java.util.List;
+
 /**
  * 致委托人函 文档对象
  */
 @Data
 public class HouseGuarantyBase extends BaseEntity {
 
-    private Long docId;
-
-
     /**
      * 估价项目名称
      */
@@ -65,20 +64,23 @@ public class HouseGuarantyBase extends BaseEntity {
      */
     private String methods;
 
+
+
+
     /**
      * 是否提供技术报告
      */
-    private String hasTechReport;
+    private Boolean hasTechReport;
 
     /**
      * 是否是农商银行
      */
-    private String isNsBank;
+    private Boolean isNsBank;
 
     /**
      * 是否审核权属原件
      */
-    private String isCheckOriginCertificate;
+    private Boolean isCheckOriginCertificate;
 
 
     /**
@@ -106,6 +108,30 @@ public class HouseGuarantyBase extends BaseEntity {
      */
     private String creditCode;
 
+    private Boolean hasPledge;
+
+    private String pledgeUser;
+
+    private String pledgeType;
+
+    private String pledgeValue;
+
+    private Boolean samePledgeContinue;
+
+    private String newPledgeUser;
+
+    private Boolean highPledgeNotExpire;
+
+    private Boolean samePledgeHigh;
+
+    private String firstMoney;
+
+    private String debtMoney;
+
+    private Boolean isTakeOutFirstMoney;
+
+
+
 
     /**
      * 权利
@@ -132,4 +158,11 @@ public class HouseGuarantyBase extends BaseEntity {
     @TableField(exist = false)
     private String ownshipUser;
 
+
+    @TableField(exist = false)
+    private List<String> methodList;
+
+    @TableField(exist = false)
+    private Long processId;
+
 }

+ 5 - 0
domain/src/main/java/com/dayou/entity/HouseGuarantyProcess.java

@@ -15,6 +15,11 @@ public class HouseGuarantyProcess extends BaseEntity implements Serializable {
     private Long parentId;
 
     /**
+     * 基本信息id
+     */
+    private Long baseId;
+
+    /**
      * docHome
      */
     private String home;

+ 2 - 22
domain/src/main/java/com/dayou/entity/HouseGuarantyTarget.java

@@ -72,29 +72,7 @@ public class HouseGuarantyTarget extends BaseEntity implements Serializable {
 
     private String rentUser;
 
-    private Boolean hasPledge;
 
-    private String pledgeUser;
-
-    private String pledgeType;
-
-    private String pledgeValue;
-
-    private Boolean samePledgeContinue;
-
-    private String newPledgeUser;
-
-    private Boolean highPledgeNotExpire;
-
-    private Boolean samePledgeHigh;
-
-    private String firstMoney;
-
-    private String debtMoney;
-
-    private Boolean isTakeOutFirstMoney;
-
-    private Boolean isCostingShareMethod;
 
     private Boolean noBuildingHouseNos;
 
@@ -118,6 +96,8 @@ public class HouseGuarantyTarget extends BaseEntity implements Serializable {
 
     private String landUseRightTo;
 
+    private Boolean isCostingShareMethod;
+
     @TableField(exist = false)
     private List<HouseGuarantyAim> aims;
 

+ 6 - 0
domain/src/main/java/com/dayou/entity/HouseTargetEntity.java

@@ -87,4 +87,10 @@ public class HouseTargetEntity extends BaseEntity {
     private String targetLandUseTo;
     @TableField(exist = false)
     private String targetLandUseType;
+    @TableField(exist = false)
+    private Long xId;
+    @TableField(exist = false)
+    private String xTid;
+    @TableField(exist = false)
+    private String xTno;
 }

+ 11 - 0
service/src/main/java/com/dayou/service/GlobalConfigService.java

@@ -0,0 +1,11 @@
+package com.dayou.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.dayou.entity.GlobalConfig;
+
+import java.util.List;
+
+public interface GlobalConfigService extends IService<GlobalConfig> {
+
+    List<GlobalConfig> getByType(String type);
+}

+ 4 - 0
service/src/main/java/com/dayou/service/HouseGuarantyBaseService.java

@@ -4,4 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.dayou.entity.HouseGuarantyBase;
 
 public interface HouseGuarantyBaseService extends IService<HouseGuarantyBase> {
+
+    Long add(HouseGuarantyBase base);
+
+    HouseGuarantyBase getByDocId(Long docId);
 }

+ 4 - 3
service/src/main/java/com/dayou/service/HouseGuarantyService.java

@@ -2,6 +2,7 @@ package com.dayou.service;
 
 
 import com.dayou.dto.HouseGuarantyTableDTO;
+import com.dayou.entity.HouseGuarantyBase;
 import com.dayou.vo.HouseTargetVO;
 
 import java.io.IOException;
@@ -20,10 +21,10 @@ public interface HouseGuarantyService {
 
     /**
      * 解析表单1
-     * @param id
+     * @param processId
      * @return
      */
-    Long analysisCollect1(Long id) throws Exception;
+    Long analysisCollect1(Long processId) throws Exception;
 
     /**
      * 生成致委托人函
@@ -58,7 +59,7 @@ public interface HouseGuarantyService {
      * @param id
      * @return
      */
-    String genResultLetter(Long id);
+    Boolean genResultLetter(Long id);
 
     /**
      * 获取权属证书组合类型

+ 2 - 0
service/src/main/java/com/dayou/service/HouseTargetEntityService.java

@@ -15,4 +15,6 @@ public interface HouseTargetEntityService extends IService<HouseTargetEntity> {
     Boolean copyHouseTargetEntity(Long id);
 
     List<HouseRightsDTO> getHouseRightsDTOList(Long businessId);
+
+    List<HouseTargetEntity> getListById(Long id);
 }

+ 3 - 3
service/src/main/java/com/dayou/service/TmplHouseParagraphService.java

@@ -16,7 +16,7 @@ public interface TmplHouseParagraphService extends IService<TmplHouseParagraph>
     /**
      * 生成一般假设最终结果
      */
-    String findYBJSResult(List<HouseGuarantyTarget> targets,String isCheckOriginCertificate, List<String> certificates);
+    String findYBJSResult(List<HouseGuarantyTarget> targets,Boolean isCheckOriginCertificate, List<String> certificates);
 
     /**
      * 生成未定事项假设最终结果
@@ -38,7 +38,7 @@ public interface TmplHouseParagraphService extends IService<TmplHouseParagraph>
      * @param targets
      * @return
      */
-    String findYJBUJSResult(List<HouseGuarantyTarget> targets,List<String> certificates,String isCheckOriginCertificate,String methods);
+    String findYJBUJSResult(List<HouseGuarantyTarget> targets,List<String> certificates,Boolean isCheckOriginCertificate,String methods);
 
     /**
      * 生成限制条件结果
@@ -59,5 +59,5 @@ public interface TmplHouseParagraphService extends IService<TmplHouseParagraph>
      * @param targets
      * @return
      */
-    String findSpecialHandle(List<HouseGuarantyTarget> targets);
+    String findSpecialHandle(List<HouseGuarantyTarget> targets,HouseGuarantyBase base);
 }

+ 24 - 0
service/src/main/java/com/dayou/service/impl/GlobalConfigServiceImpl.java

@@ -0,0 +1,24 @@
+package com.dayou.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dayou.common.BaseEntity;
+import com.dayou.entity.GlobalConfig;
+import com.dayou.mapper.GlobalConfigMapper;
+import com.dayou.service.GlobalConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class GlobalConfigServiceImpl extends ServiceImpl<GlobalConfigMapper, GlobalConfig> implements GlobalConfigService {
+
+    @Autowired
+    private GlobalConfigMapper globalConfigMapper;
+
+    @Override
+    public List<GlobalConfig> getByType(String type) {
+        return globalConfigMapper.getByType(type);
+    }
+}

+ 26 - 0
service/src/main/java/com/dayou/service/impl/HouseGuarantyBaseServiceImpl.java

@@ -1,11 +1,37 @@
 package com.dayou.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dayou.common.BaseEntity;
 import com.dayou.entity.HouseGuarantyBase;
+import com.dayou.entity.HouseGuarantyProcess;
 import com.dayou.mapper.HouseGuarantyBaseMapper;
 import com.dayou.service.HouseGuarantyBaseService;
+import com.dayou.service.HouseGuarantyProcessService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 @Service
 public class HouseGuarantyBaseServiceImpl extends ServiceImpl<HouseGuarantyBaseMapper, HouseGuarantyBase> implements HouseGuarantyBaseService {
+
+    @Autowired
+    private HouseGuarantyProcessService houseGuarantyProcessService;
+
+    @Autowired
+    private HouseGuarantyBaseMapper houseGuarantyBaseMapper;
+
+    @Override
+    public Long add(HouseGuarantyBase base) {
+        this.saveOrUpdate(base);
+        if (base.getProcessId() != null) {
+            houseGuarantyProcessService.update(new LambdaUpdateWrapper<HouseGuarantyProcess>()
+                    .eq(BaseEntity::getId,base.getProcessId()).set(HouseGuarantyProcess::getBaseId,base.getId()));
+        }
+        return base.getId();
+    }
+
+    @Override
+    public HouseGuarantyBase getByDocId(Long docId) {
+        return houseGuarantyBaseMapper.getByDocId(docId);
+    }
 }

+ 60 - 70
service/src/main/java/com/dayou/service/impl/HouseGuarantyServiceImpl.java

@@ -1,10 +1,7 @@
 package com.dayou.service.impl;
 
-import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONArray;
-import cn.hutool.json.JSONObject;
-import cn.hutool.json.JSONUtil;
-import com.alibaba.fastjson2.JSON;
 import com.aspose.cells.SaveFormat;
 import com.aspose.cells.Workbook;
 import com.aspose.words.*;
@@ -34,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.nio.file.Files;
@@ -96,15 +94,12 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
 
     @Override
     public Long createTableWord(HouseGuarantyTableDTO houseGuarantyTableDTO) {
-        try {
-            sleep(500);
-        } catch (InterruptedException e) {
-            throw new RuntimeException(e);
-        }
         String html = houseGuarantyTableDTO.getHtml();
         String homePath = houseGuarantyTableDTO.getHomePath();
+        Long baseId = houseGuarantyTableDTO.getBaseId();
         String xHtml = wordTableHelper.htmlTableFormat(html);
         HouseGuarantyProcess hgp = new HouseGuarantyProcess();
+        hgp.setBaseId(baseId);
         hgp.setHome(homePath);
         hgp.setTargetsHtml(html);
         hgp.setProcessName(BusinessEnum.HouseGuarantyProcess.CONSIGNOR_LETTER.getMsg());
@@ -114,32 +109,28 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
     }
 
     @Override
-    public Long analysisCollect1(Long id) throws Exception {
-        HouseGuarantyProcess process = houseGuarantyProcessService.getById(id);
+    public Long analysisCollect1(Long processId) throws Exception {
+        HouseGuarantyProcess process = houseGuarantyProcessService.getById(processId);
         String home = fileNetConfig.getBaseDir() + process.getHome();
         Workbook workbook = new Workbook( home + COLLECT1_XLSX);
         workbook.save(home+ COLLECT1_JSON, SaveFormat.JSON);
 
 
         //解析估价对象json(估价对象一览表)
-        JSONArray array = JsonUtil.file2JsonArray(home + COLLECT1_JSON, TARGETS_TABLE_ZH);
+        JSONArray array = JsonUtil.file2JsonArray(home + COLLECT1_JSON);
         JSONArray xArray = HouseDocumentUtil.houseTargetsFormat(array);
         List<HouseGuarantyAim> houseGuarantyAims = HouseDocumentUtil.houseTargetsFormatDTO(xArray);
         //获取项目名称
         String projectName = HouseDocumentUtil.getProjectName(houseGuarantyAims);
 
-
-        //解析估价对象json(基本信息)
-        XSSFWorkbook book = new XSSFWorkbook(home + COLLECT1_XLSX);
-        Map<String, String> valueMap = EasyExcelUtil.getExcelCellValue(book, BASE_INFO_ZH);
-        HouseGuarantyBase houseGuarantyBase = BeanUtil.mapToBean(valueMap, HouseGuarantyBase.class, true);
-
-        DocumentProduction dp = buildDocumentProduction(id, projectName, houseGuarantyBase.getDocNo(), houseGuarantyBase.getConsignor());
+        HouseGuarantyBase base = houseGuarantyBaseService.getById(process.getBaseId());
+        if (base==null || StrUtil.isBlank(base.getConsignor())){
+            ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"请先完善基本信息");
+        }
+        DocumentProduction dp = buildDocumentProduction(processId, projectName, base.getDocNo(), base.getConsignor());
         documentProductionService.save(dp);
 
         Long docId = dp.getId();
-        houseGuarantyBase.setDocId(docId);
-        houseGuarantyBaseService.save(houseGuarantyBase);
 
         houseGuarantyAims.stream().forEach(x->{
             x.setDocId(docId);
@@ -152,11 +143,6 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
 
     @Override
     public Boolean genConsignorLetter(Long pId,Long docId) {
-        try {
-            sleep(1000);
-        } catch (InterruptedException e) {
-            throw new RuntimeException(e);
-        }
         HouseGuarantyProcess process = houseGuarantyProcessService.getById(pId);
         String baseDir = fileNetConfig.getBaseDir();
         String home = baseDir + process.getHome();
@@ -167,8 +153,9 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
                     .eq(HouseGuarantyAim::getDocId, docId));
 
             //读取基本信息
-            HouseGuarantyBase base = houseGuarantyBaseService.getOne(new LambdaQueryWrapper<HouseGuarantyBase>().eq(HouseGuarantyBase::getDocId, docId));
-
+            HouseGuarantyBase base = houseGuarantyBaseService.getById(process.getBaseId());
+            String projectName = HouseDocumentUtil.getProjectName(aims);
+            base.setProjectName(projectName);
             Map<String, List<HouseGuarantyAim>> collect = aims.stream().collect(Collectors.groupingBy(HouseGuarantyAim::getTid));
             String actDesc = HouseDocumentUtil.combinationTargetDescription(collect);
             base.setActDesc(actDesc);
@@ -194,6 +181,11 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
             return houseGuarantyProcessService.update(new LambdaUpdateWrapper<HouseGuarantyProcess>().set(HouseGuarantyProcess::getDocUrl, consignorLetterName)
                     .eq(BaseEntity::getId, pId));
 
+        }
+        catch (FileNotFoundException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
@@ -226,7 +218,7 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
         String baseDir = fileNetConfig.getBaseDir();
 
         try {
-            HouseGuarantyBase base = houseGuarantyBaseService.getOne(new LambdaQueryWrapper<HouseGuarantyBase>().eq(HouseGuarantyBase::getDocId, id));
+            HouseGuarantyBase base = houseGuarantyBaseService.getById(process.getBaseId());
             ConditionDO conditionDO = new ConditionDO();
             conditionDO.setAppraiser1(base.getAppraiser1());
             conditionDO.setAppraiser2(base.getAppraiser2());
@@ -247,7 +239,7 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
 
             //获取土地证信息
             List<CertificateLandUse> landCerts = certificateLandUseService.list(new LambdaQueryWrapper<CertificateLandUse>().eq(CertificateLandUse::getBusinessId, id));
-            String isCheckOriginCertificate = base.getIsCheckOriginCertificate();
+            Boolean isCheckOriginCertificate = base.getIsCheckOriginCertificate();
 
 
             //组合一般假设内容
@@ -278,7 +270,7 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
             conditionDO.setSYBGSM(useReportExplain);
 
             //组合估价中的特殊处理事项内容
-            String specialHandles = tmplHouseParagraphService.findSpecialHandle(targets);
+            String specialHandles = tmplHouseParagraphService.findSpecialHandle(targets,base);
             conditionDO.setTSSXCL(specialHandles);
 
             byte[] tmplWordByte = Files.readAllBytes(Paths.get(baseDir
@@ -315,37 +307,41 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
     }
 
     @Override
-    public String genResultLetter(Long id) {
+    public Boolean genResultLetter(Long id) {
         DocumentProduction dp = documentProductionService.getById(id);
         HouseGuarantyProcess process = houseGuarantyProcessService.getById(dp.getBusinessId());
         String baseDir = fileNetConfig.getBaseDir();
 
-        try {
-            //读取估价对象数组
-            List<HouseGuarantyAim> aims = houseGuarantyAimService.list(new LambdaQueryWrapper<HouseGuarantyAim>().eq(HouseGuarantyAim::getDocId, id));
-            HouseGuarantyBase base = houseGuarantyBaseService.getOne(new LambdaQueryWrapper<HouseGuarantyBase>().eq(HouseGuarantyBase::getDocId, id));
-//            JSONArray array = JsonUtil.file2JsonArray(home + TARGETS_JSON);
-//            JSONObject jsonObject = JsonUtil.file2JsonObject(home + BASE_INFO_JSON);
-
-            //替换字段
-            GuarantyResultDO guarantyResultDO = new GuarantyResultDO();
-            guarantyResultDO.setDocNo(base.getDocNo());
-            guarantyResultDO.setConsignor(base.getConsignor());
-            guarantyResultDO.setConsignorType(base.getConsignorType());
-            guarantyResultDO.setConsignorAddress(base.getConsignorAddress());
-            guarantyResultDO.setConsignorPerson(base.getConsignorPerson());
-            guarantyResultDO.setConsignorMoney(base.getConsignorMoney());
-            guarantyResultDO.setCreditCode(base.getCreditCode());
+        //读取估价对象数组
+        List<HouseGuarantyAim> aims = houseGuarantyAimService.list(new LambdaQueryWrapper<HouseGuarantyAim>().eq(HouseGuarantyAim::getDocId, id));
 
-            Map<String, List<HouseGuarantyAim>> collect = aims.stream().collect(Collectors.groupingBy(HouseGuarantyAim::getTid));
+        //获取基本信息
+        HouseGuarantyBase base = houseGuarantyBaseService.getById(process.getBaseId());
 
-            guarantyResultDO.setTargetScope(HouseDocumentUtil.combinationTargetDescription(collect));
+        //实物状况描述
+        List<HouseTargetEntity> entities = houseTargetEntityService.getListById(id);
 
-            List<HouseTargetEntity> entities = houseTargetEntityMapper.getListById(id);
+        //获取权属信息数据源
+        List<HouseRightsDTO> houseRightsDTOList = houseTargetEntityService.getHouseRightsDTOList(id);
 
-            //土地实物状况描述
-            guarantyResultDO.setLandInfo(HouseDocumentUtil.getLandInfoDesc(entities));
+        //获取区位状况数据源
+        List<HouseGuarantyArea> areas = houseGuarantyAreaService.getAreasList(id);
 
+        Map<String, List<HouseGuarantyAim>> collect = aims.stream().collect(Collectors.groupingBy(HouseGuarantyAim::getTid));
+
+        //替换字段
+        GuarantyResultDO guarantyResultDO = new GuarantyResultDO();
+        guarantyResultDO.setValueTiming(base.getValueTiming());
+        guarantyResultDO.setDocNo(base.getDocNo());
+        guarantyResultDO.setConsignor(base.getConsignor());
+        guarantyResultDO.setConsignorType(base.getConsignorType());
+        guarantyResultDO.setConsignorAddress(base.getConsignorAddress());
+        guarantyResultDO.setConsignorPerson(base.getConsignorPerson());
+        guarantyResultDO.setConsignorMoney(base.getConsignorMoney());
+        guarantyResultDO.setCreditCode(base.getCreditCode());
+        guarantyResultDO.setTargetScope(HouseDocumentUtil.combinationTargetDescription(collect));
+        guarantyResultDO.setLandInfo(HouseDocumentUtil.getLandInfoDesc(entities));
+        try {
             byte[] tmplWordByte = Files.readAllBytes(Paths.get(baseDir
                     + fileNetConfig.getHouseGuarantyTemplatePath() + GUARANTY_RESULT_TEMPLATE));
 
@@ -360,18 +356,12 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
             //替换完成,此处开始动态创建内容
             //获取替换后的文档
             Document doc = new Document(baseDir + guarantyResultName);
-
-            //获取权属信息数据源
-            List<HouseRightsDTO> houseRightsDTOList = houseTargetEntityService.getHouseRightsDTOList(id);
+            //创作权属信息段落
             HouseDocumentUtil.getRightsDesc(doc,houseRightsDTOList,
-                    HouseDocumentUtil.checkBoolean(base.getIsCheckOriginCertificate()));
-
-            //获取区位状况数据源
-            List<HouseGuarantyArea> areas = houseGuarantyAreaService.getAreasList(id);
+                    base.getIsCheckOriginCertificate());
+            //创作区位信息段落
             HouseDocumentUtil.getAreaDesc(doc,areas);
-            //生成文档中的表格
             //建筑物实物状况表格
-
             List<HouseEntityTable> entityTables = entities.stream().map(x -> {
                 String location = UNKNOWN;
                 String acreage = UNKNOWN;
@@ -406,12 +396,9 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
                         .location(location).desc(HouseDocumentUtil.targetEntityDesc(location, useTo, acreage, x)).build();
                 return entityTable;
             }).collect(Collectors.toList());
-
+            //生成文档中的表格
             AsposeWordUtil.createTable(doc, HouseEntityTable.class, entityTables, "buildingInfo");
             doc.save(baseDir + guarantyResultName);
-
-
-
             //更新过程文档url
             HouseGuarantyProcess houseGuarantyProcess = new HouseGuarantyProcess();
             houseGuarantyProcess.setProcessName(GUARANTY_RESULT_REPORT.getMsg());
@@ -419,11 +406,14 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
             houseGuarantyProcess.setHome(process.getHome());
             houseGuarantyProcess.setParentId(process.getId());
             houseGuarantyProcessService.save(houseGuarantyProcess);
-            return guarantyResultName;
-        }catch (Exception e){
-            e.printStackTrace();
+            return true;
+        } catch (FileNotFoundException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
         }
-        return "";
     }
 
     /**

+ 15 - 0
service/src/main/java/com/dayou/service/impl/HouseTargetEntityServiceImpl.java

@@ -5,14 +5,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.dayou.entity.HouseGuarantyAim;
 import com.dayou.dto.HouseRightsDTO;
 import com.dayou.entity.*;
+import com.dayou.exception.ErrorCode;
 import com.dayou.mapper.HouseTargetEntityMapper;
 import com.dayou.service.*;
+import com.dayou.utils.CollectionUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import static com.dayou.enums.BusinessEnum.HouseSubBusiness.GUARANTY;
 
@@ -123,4 +127,15 @@ public class HouseTargetEntityServiceImpl extends ServiceImpl<HouseTargetEntityM
         }
         return rights;
     }
+
+    @Override
+    public List<HouseTargetEntity> getListById(Long id) {
+        List<HouseTargetEntity> entities = houseTargetEntityMapper.getListById(id);
+        List<HouseTargetEntity> collect = entities.stream().filter(x -> x.getId() == null).collect(Collectors.toList());
+        if (CollectionUtil.isNotEmpty(collect)){
+            ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,
+                    "估价对象"+collect.get(0).getXTid()+"序号"+collect.get(0).getXTno()+"实物状况信息缺失。");
+        }
+        return entities;
+    }
 }

+ 15 - 17
service/src/main/java/com/dayou/service/impl/TmplHouseParagraphServiceImpl.java

@@ -38,7 +38,7 @@ public class TmplHouseParagraphServiceImpl extends ServiceImpl<TmplHouseParagrap
     }
 
     @Override
-    public String findYBJSResult(List<HouseGuarantyTarget> targets, String isCheckOriginCertificate, List<String> certificates) {
+    public String findYBJSResult(List<HouseGuarantyTarget> targets, Boolean isCheckOriginCertificate, List<String> certificates) {
         List<TmplHouseParagraph> paragraphTemps = this.list(new LambdaQueryWrapper<TmplHouseParagraph>()
                 .eq(TmplHouseParagraph::getDocMold, GUARANTY).eq(TmplHouseParagraph::getChapter, ORDINARY_ASSUMPTION).orderByAsc(TmplHouseParagraph::getSort));
         Map<Integer, List<TmplHouseParagraph>> collect = paragraphTemps.stream().collect(Collectors.groupingBy(TmplHouseParagraph::getSort));
@@ -199,7 +199,7 @@ public class TmplHouseParagraphServiceImpl extends ServiceImpl<TmplHouseParagrap
     }
 
     @Override
-    public String findYJBUJSResult(List<HouseGuarantyTarget> targets,List<String> certificates,String isCheckOriginCertificate,String methods) {
+    public String findYJBUJSResult(List<HouseGuarantyTarget> targets,List<String> certificates,Boolean isCheckOriginCertificate,String methods) {
         List<TmplHouseParagraph> paragraphTemps = this.list(new LambdaQueryWrapper<TmplHouseParagraph>()
                 .eq(TmplHouseParagraph::getDocMold, GUARANTY).eq(TmplHouseParagraph::getChapter, DEFICIENCY_ASSUMPTION).orderByAsc(TmplHouseParagraph::getSort));
         StringBuilder result = new StringBuilder();
@@ -277,24 +277,22 @@ public class TmplHouseParagraphServiceImpl extends ServiceImpl<TmplHouseParagrap
             if (StrUtil.isNotBlank(rule)){
                 if (IS_NOT_PLEDGE.getCode().equals(rule)){
                     //todo
-                    for (HouseGuarantyTarget target : targets){
-                        String notPledge = HouseDocumentUtil.isNotPledge(paragraph,target.getHasPledge());
-                        if (StrUtil.isNotBlank(notPledge)){
-                            result.append(i).append(". ").append(notPledge);
-                            i++;
-                        }
+                    String notPledge = HouseDocumentUtil.isNotPledge(paragraph,base.getHasPledge());
+                    if (StrUtil.isNotBlank(notPledge)){
+                        result.append(i).append(". ").append(notPledge);
+                        i++;
                     }
 
                 }
                 if (IS_OLD_PLEDGE_TO_NEW_PLEDGE.getCode().equals(rule)){
-                    String oldPledgeToNewPledge = HouseDocumentUtil.isOldPledgeToNewPledge(targets,paragraph);
+                    String oldPledgeToNewPledge = HouseDocumentUtil.isOldPledgeToNewPledge(paragraph,base);
                     if (StrUtil.isNotBlank(oldPledgeToNewPledge)){
                         result.append(i).append(". ").append(oldPledgeToNewPledge);
                         i++;
                     }
                 }
                 if (IS_OLD_PLEDGE_TO_OLD_PLEDGE.getCode().equals(rule)){
-                    String oldPledgeToOldPledge = HouseDocumentUtil.isOldPledgeToOldPledge(targets,paragraph);
+                    String oldPledgeToOldPledge = HouseDocumentUtil.isOldPledgeToOldPledge(paragraph,base);
                     if (StrUtil.isNotBlank(oldPledgeToOldPledge)){
                         result.append(i).append(". ").append(oldPledgeToOldPledge);
                         i++;
@@ -317,7 +315,7 @@ public class TmplHouseParagraphServiceImpl extends ServiceImpl<TmplHouseParagrap
                     }
                 }
                 if (IS_PROVIDE_TECH_REPORT.getCode().equals(rule)){
-                    String provideTechReport = HouseDocumentUtil.isProvideTechReport(targets,paragraph,base.getHasTechReport());
+                    String provideTechReport = HouseDocumentUtil.isProvideTechReport(paragraph,base.getHasTechReport());
                     if (StrUtil.isNotBlank(provideTechReport)){
                         result.append(i).append(". ").append(provideTechReport);
                         i++;
@@ -373,7 +371,7 @@ public class TmplHouseParagraphServiceImpl extends ServiceImpl<TmplHouseParagrap
     }
 
     @Override
-    public String findSpecialHandle(List<HouseGuarantyTarget> targets) {
+    public String findSpecialHandle(List<HouseGuarantyTarget> targets,HouseGuarantyBase base) {
         List<TmplHouseParagraph> paragraphTemps = this.list(new LambdaQueryWrapper<TmplHouseParagraph>()
                 .eq(TmplHouseParagraph::getDocMold, GUARANTY).eq(TmplHouseParagraph::getChapter, SPECIAL_HANDLE).orderByAsc(TmplHouseParagraph::getSort));
         StringBuilder result = new StringBuilder();
@@ -382,35 +380,35 @@ public class TmplHouseParagraphServiceImpl extends ServiceImpl<TmplHouseParagrap
             String rule = paragraph.getRule();
             if (StrUtil.isNotBlank(rule)){
                 if (IS_NO_FIRST_MONEY.getCode().equals(rule)){
-                    String noFirstMoney = HouseDocumentUtil.isNoFirstMoney(targets,paragraph);
+                    String noFirstMoney = HouseDocumentUtil.isNoFirstMoney(paragraph,base);
                     if (StrUtil.isNotBlank(noFirstMoney)){
                         result.append(i).append(". ").append(noFirstMoney);
                         i++;
                     }
                 }
                 if (IS_SAME_PLEDGE_USER_CONTINUE.getCode().equals(rule)){
-                    String samePledgeUserContinue = HouseDocumentUtil.isSamePledgeUserContinue(targets,paragraph);
+                    String samePledgeUserContinue = HouseDocumentUtil.isSamePledgeUserContinue(paragraph,base);
                     if (StrUtil.isNotBlank(samePledgeUserContinue)){
                         result.append(i).append(". ").append(samePledgeUserContinue);
                         i++;
                     }
                 }
                 if (IS_OLD_PLEDGE_TO_NEW_PLEDGE_SPECIAL.getCode().equals(rule)){
-                    String oldPledgeToNewPledgeSpecial = HouseDocumentUtil.isOldPledgeToNewPledgeSpecial(targets,paragraph);
+                    String oldPledgeToNewPledgeSpecial = HouseDocumentUtil.isOldPledgeToNewPledgeSpecial(paragraph,base);
                     if (StrUtil.isNotBlank(oldPledgeToNewPledgeSpecial)){
                         result.append(i).append(". ").append(oldPledgeToNewPledgeSpecial);
                         i++;
                     }
                 }
                 if (IS_NORMAL_PLEDGE_TO_HIGH_PLEDGE.getCode().equals(rule)){
-                    String normalPledgeToHighPledge = HouseDocumentUtil.isNormalPledgeToHighPledge(targets,paragraph);
+                    String normalPledgeToHighPledge = HouseDocumentUtil.isNormalPledgeToHighPledge(paragraph,base);
                     if (StrUtil.isNotBlank(normalPledgeToHighPledge)){
                         result.append(i).append(". ").append(normalPledgeToHighPledge);
                         i++;
                     }
                 }
                 if (IS_HIGH_PLEDGE_NOT_EXPIRE.getCode().equals(rule)){
-                    String highPledgeNotExpire = HouseDocumentUtil.isHighPledgeNotExpire(targets,paragraph);
+                    String highPledgeNotExpire = HouseDocumentUtil.isHighPledgeNotExpire(paragraph,base);
                     if (StrUtil.isNotBlank(highPledgeNotExpire)){
                         result.append(i).append(". ").append(highPledgeNotExpire);
                         i++;