瀏覽代碼

优化数据存储方式,获取估价对象地址对应的经纬度

wucl 7 月之前
父節點
當前提交
874e600703
共有 29 個文件被更改,包括 721 次插入283 次删除
  1. 6 5
      biz-base/src/main/java/com/dayou/controller/HouseGuarantyDocController.java
  2. 11 0
      biz-base/src/main/java/com/dayou/controller/HouseGuarantyTargetController.java
  3. 29 17
      biz-base/src/test/java/com/dayou/FreeMarkTest.java
  4. 2 2
      common/src/main/java/com/dayou/utils/AddressUtil.java
  5. 87 85
      common/src/main/java/com/dayou/utils/HouseDocumentUtil.java
  6. 10 0
      dao/src/main/java/com/dayou/mapper/HouseGuarantyAimMapper.java
  7. 8 0
      dao/src/main/java/com/dayou/mapper/HouseGuarantyBaseMapper.java
  8. 5 0
      dao/src/main/java/com/dayou/mapper/HouseGuarantyTargetMapper.java
  9. 6 0
      dao/src/main/resources/mapper/HouseGuarantyAim.xml
  10. 6 0
      dao/src/main/resources/mapper/HouseGuarantyBase.xml
  11. 120 0
      dao/src/main/resources/mapper/HouseGuarantyTargetMapper.xml
  12. 9 5
      domain/src/main/java/com/dayou/dto/HouseGuarantyTargetDTO.java
  13. 34 33
      domain/src/main/java/com/dayou/doc/house/ConsignorLetterDO.java
  14. 6 3
      domain/src/main/java/com/dayou/entity/HouseGuarantyTarget.java
  15. 8 3
      domain/src/main/java/com/dayou/enums/HouseTargetTableColumn.java
  16. 2 2
      domain/src/main/java/com/dayou/vo/HouseTargetVO.java
  17. 7 0
      service/src/main/java/com/dayou/service/HouseGuarantyAimService.java
  18. 7 0
      service/src/main/java/com/dayou/service/HouseGuarantyBaseService.java
  19. 10 0
      service/src/main/java/com/dayou/service/HouseGuarantyBaseServiceImpl.java
  20. 0 1
      service/src/main/java/com/dayou/service/HouseGuarantyProcessService.java
  21. 4 3
      service/src/main/java/com/dayou/service/HouseGuarantyService.java
  22. 2 1
      service/src/main/java/com/dayou/service/TmplHouseParagraphService.java
  23. 11 0
      service/src/main/java/com/dayou/service/impl/HouseGuarantyAimServiceImpl.java
  24. 0 3
      service/src/main/java/com/dayou/service/impl/HouseGuarantyProcessServiceImpl.java
  25. 78 86
      service/src/main/java/com/dayou/service/impl/HouseGuarantyServiceImpl.java
  26. 1 1
      service/src/main/java/com/dayou/service/impl/HouseGuarantyTargetServiceImpl.java
  27. 13 23
      service/src/main/java/com/dayou/service/impl/HouseTargetEntityServiceImpl.java
  28. 17 10
      service/src/main/java/com/dayou/service/impl/TmplHouseParagraphServiceImpl.java
  29. 222 0
      sql/update_sql.sql

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

@@ -44,18 +44,19 @@ public class HouseGuarantyDocController {
      * @return
      */
     @GetMapping("/collect1/{id}")
-    public Result<Boolean> analysisCollect1(@PathVariable("id") Long id) throws Exception {
+    public Result<Long> analysisCollect1(@PathVariable("id") Long id) throws Exception {
         return Result.build(houseGuarantyService.analysisCollect1(id));
     }
 
     /**
      * 生成致委托人函word
-     * @param id
+     * @param pId
+     * @param docId
      * @return
      */
-    @GetMapping("/consignor/{id}")
-    public Result<Long> genConsignorLetter(@PathVariable("id") Long id){
-        return Result.build(houseGuarantyService.genConsignorLetter(id));
+    @GetMapping("/consignor")
+    public Result<Boolean> genConsignorLetter(Long pId,Long docId){
+        return Result.build(houseGuarantyService.genConsignorLetter(pId,docId));
     }
 
     /**

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

@@ -1,12 +1,17 @@
 package com.dayou.controller;
 
+import com.dayou.entity.HouseGuarantyAim;
 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.*;
 
+import java.util.List;
+
 /**
  * 房地产抵押类估价对象信息
  */
@@ -18,8 +23,13 @@ public class HouseGuarantyTargetController {
     @Autowired
     private HouseGuarantyTargetService houseGuarantyTargetService;
 
+    @Autowired
+    private HouseGuarantyAimService houseGuarantyAimService;
+
     @PostMapping()
     public Result<Long> save(@RequestBody HouseGuarantyTarget houseGuarantyTarget) {
+        List<HouseGuarantyAim> aims = houseGuarantyTarget.getAims();
+        houseGuarantyAimService.saveOrUpdateBatch(aims);
         houseGuarantyTargetService.saveOrUpdate(houseGuarantyTarget);
         return Result.build(houseGuarantyTarget.getId());
     }
@@ -29,4 +39,5 @@ public class HouseGuarantyTargetController {
         HouseGuarantyTarget target = houseGuarantyTargetService.getTarget(docId,tId);
         return Result.build(target);
     }
+
 }

文件差異過大導致無法顯示
+ 29 - 17
biz-base/src/test/java/com/dayou/FreeMarkTest.java


+ 2 - 2
common/src/main/java/com/dayou/utils/AddressUtil.java

@@ -75,9 +75,9 @@ public class AddressUtil {
         return result;
     }
 
-    public static List<Address> parseAddress(List<Object> addresses) {
+    public static List<Address> parseAddress(List<String> addresses) {
         return addresses.stream().map(addr -> {
-            return parseAddress((String) addr);
+            return parseAddress(addr);
         }).collect(Collectors.toList());
     }
 

+ 87 - 85
common/src/main/java/com/dayou/utils/HouseDocumentUtil.java

@@ -8,7 +8,7 @@ import com.aspose.words.DocumentBuilder;
 import com.aspose.words.Font;
 import com.dayou.dto.Address;
 import com.dayou.dto.HouseRightsDTO;
-import com.dayou.dto.HouseGuarantyTargetDTO;
+import com.dayou.entity.HouseGuarantyAim;
 import com.dayou.entity.*;
 import com.dayou.enums.HouseTargetTableColumn;
 import com.dayou.exception.ErrorCode;
@@ -89,19 +89,22 @@ public class HouseDocumentUtil {
     }
 
 
-    public static List<HouseGuarantyTargetDTO> houseTargetsFormatDTO(JSONArray jsonArray) throws IllegalAccessException {
-        List<HouseGuarantyTargetDTO> dtoList = new ArrayList<>();
+    public static List<HouseGuarantyAim> houseTargetsFormatDTO(JSONArray jsonArray) throws IllegalAccessException {
+        List<HouseGuarantyAim> dtoList = new ArrayList<>();
                 for (int i = 0 ; i < jsonArray.size(); i++){
                     JSONObject item = (JSONObject) jsonArray.get(i);
                     if (!item.isNull(LOCATION.getZhName()) &&
                             item.get(LOCATION.getZhName())!=null &&
                             !item.isNull(CERTIFICATE_NO.getZhName())
                             && item.get(CERTIFICATE_NO.getZhName())!=null){
-                        HouseGuarantyTargetDTO guarantyTargetDTO = new HouseGuarantyTargetDTO();
+                        HouseGuarantyAim guarantyTargetDTO = new HouseGuarantyAim();
                         Field[] declaredFields = guarantyTargetDTO.getClass().getDeclaredFields();
                         for (Field field : declaredFields) {
                             field.setAccessible(true);
                             String zhNameByCode = HouseTargetTableColumn.getZhNameByCode(field.getName());
+                            if (StrUtil.isBlank(zhNameByCode)){
+                                continue;
+                            }
                             String value = String.valueOf(item.get(zhNameByCode)==null?"":item.get(zhNameByCode));
                             field.set(guarantyTargetDTO, value);
 
@@ -116,11 +119,11 @@ public class HouseDocumentUtil {
 
     /**
      * 格式化项目名称
-     * @param array
+     * @param aims
      * @return
      */
-    public static String getProjectName(JSONArray array){
-        List<Object> addresses = JsonUtil.collectByKeyToList(array, LOCATION.getZhName());
+    public static String getProjectName(List<HouseGuarantyAim> aims){
+        List<String> addresses = aims.stream().map(HouseGuarantyAim::getLocation).collect(Collectors.toList());
         List<Address> addressList = AddressUtil.parseAddress(addresses);
 
         Map<List<Object>, List<Address>> collect = addressList.stream().collect(Collectors.groupingBy(compositeKey, Collectors.toList()));
@@ -135,7 +138,7 @@ public class HouseDocumentUtil {
         }else {
             result =  CollectionUtil.formatSplitAndRemoveMiddle(mergeAddress(addressList)) + "共计"+ addressList.size();
         }
-        return result +"处估价对象" + getUseTo(array) +"用房地产抵押价值评估";
+        return result +"处估价对象" + getUseTo(aims) +"用房地产抵押价值评估";
     }
 
     static Function<Address, List<Object>> compositeKey = address ->
@@ -144,65 +147,65 @@ public class HouseDocumentUtil {
 
     /**
      * 格式化地址
-     * @param array
+     * @param aims
      * @return
      */
-    public static String getAddress(JSONArray array){
-        List<Object> addresses = JsonUtil.collectByKeyToList(array, LOCATION.getZhName());
+    public static String getAddress(List<HouseGuarantyAim> aims){
+        List<String> addresses = aims.stream().map(HouseGuarantyAim::getLocation).collect(Collectors.toList());
         List<Address> addressList = AddressUtil.parseAddress(addresses);
         return CollectionUtil.formatSplitAndRemoveMiddle(mergeAddress(addressList));
     }
 
     /**
      * 格式化权利人
-     * @param array
+     * @param list
      * @return
      */
-    public static String getOwnShipUser(JSONArray array){
-        Set<Object> ownShipUsers = array.stream().map(obj -> ((JSONObject) obj).get(OWE_SHIP_USER.getZhName()))
+    public static String getOwnShipUser(List<HouseGuarantyAim> list){
+        Set<Object> ownShipUsers = list.stream().map(obj -> obj.getOwnShipUser())
                 .filter(x->x!=null).collect(Collectors.toSet());
         return CollectionUtil.formatDotAndRemoveMiddle(ownShipUsers);
     }
 
     /**
      * 格式化用途
-     * @param array
+     * @param aims
      * @return
      */
-    public static String getUseTo(JSONArray array){
-        Set<Object> useTo = array.stream().map(obj -> ((JSONObject) obj).get(USE_TO.getZhName()))
+    public static String getUseTo(List<HouseGuarantyAim> aims){
+        Set<Object> useTo = aims.stream().map(obj -> obj.getUseTo())
                 .filter(x->x!=null).collect(Collectors.toSet());
         return CollectionUtil.formatDotAndRemoveMiddle(useTo);
     }
 
     /**
      * 格式化实勘地址
-     * @param targets
+     * @param aims
      * @return
      */
-    public static String getActAddress(JSONArray targets){
+    public static String getActAddress(List<HouseGuarantyAim> aims){
         StringBuilder sb = new StringBuilder("【");
-        String actAddress = (String) ((JSONObject) targets.get(0)).get(ACT_ADDRESS.getZhName());
+        String actAddress = aims.get(0).getActAddress();
         if (StrUtil.isNotBlank(actAddress)){
             sb.append("实勘地址为").append(actAddress).append("(未见其余门牌号);");
         }
 
-        List<Object> acreage = JsonUtil.collectByKeyToList(targets, ACREAGE.getZhName());
+        List<Object> acreage = aims.stream().map(HouseGuarantyAim::getAcreage).collect(Collectors.toList());
         //建筑面积
         BigDecimal totalAcreage = sumList(acreage);
 
-        Set<Object> landType = JsonUtil.collectByKeyToSet(targets, LAND_TYPE.getZhName());
+        Set<String> landType = aims.stream().map(HouseGuarantyAim::getLandType).collect(Collectors.toSet());
 
-        List<Object> outerAcreage = JsonUtil.collectByKeyToList(targets, OUTER_ACREAGE.getZhName());
+        List<Object> outerAcreage = aims.stream().map(HouseGuarantyAim::getOuterAcreage).collect(Collectors.toList());
 
-        Set<Object> useTo = JsonUtil.collectByKeyToSet(targets, USE_TO.getZhName());
+        Set<String> useTo = aims.stream().map(HouseGuarantyAim::getUseTo).collect(Collectors.toSet());
 
         String outDesc = outAcreageTemplate(useTo, landType, outerAcreage);
-        sb.append("建筑面积"+(targets.size()>1?"合计:":":")).append(totalAcreage).append("㎡;");
+        sb.append("建筑面积"+(aims.size()>1?"合计:":":")).append(totalAcreage).append("㎡;");
 
 
         sb.append("房屋所有权证号:");
-        List<Object> certificateNos = JsonUtil.collectByKeyToList(targets, CERTIFICATE_NO.getZhName());
+        List<Object> certificateNos = aims.stream().map(HouseGuarantyAim::getCertificateNo).collect(Collectors.toList());
 
         String certificates = CollectionUtil.formatDotAndRemoveMiddle(certificateNos);
 
@@ -214,21 +217,21 @@ public class HouseDocumentUtil {
     }
     /**
      * 格式化估价对象描述
-     * @param targets    估价对象
+     * @param aims    估价对象
      * @return
      */
-    public static String getTargetDescription(JSONArray targets){
+    public static String getTargetDescription(List<HouseGuarantyAim> aims){
         //单个估价对象里面可能有多个子对象
-        String address = getAddress(targets);
+        String address = getAddress(aims);
         //实勘地址
         //权利人
-        String ownShipUser = getOwnShipUser(targets);
+        String ownShipUser = getOwnShipUser(aims);
         //用途
-        String useTo = getUseTo(targets);
+        String useTo = getUseTo(aims);
         //编号
-        String id = (String) ((JSONObject) targets.get(0)).get(ID.getZhName());
+        String id = aims.get(0).getTid();
         //实勘描述
-        String actDesc = getActAddress(targets);
+        String actDesc = getActAddress(aims);
         //格式化 todo 段落模版从DB中获取
         String template ;
         if (StrUtil.isNotBlank(ownShipUser)){
@@ -245,14 +248,13 @@ public class HouseDocumentUtil {
      * @param collect
      * @return
      */
-    public static String combinationTargetDescription(Map<Object, List<Object>> collect){
+    public static String combinationTargetDescription(Map<String, List<HouseGuarantyAim>> collect){
         String actDesc = "";
         int index = 1;
         int mapSize = collect.size();
-        for (Map.Entry<Object, List<Object>> entry : collect.entrySet()) {
-            List<Object> value = entry.getValue();
-            JSONArray xArray = new JSONArray(value);
-            String actAddress = HouseDocumentUtil.getTargetDescription(xArray);
+        for (Map.Entry<String, List<HouseGuarantyAim>> entry : collect.entrySet()) {
+            List<HouseGuarantyAim> value = entry.getValue();
+            String actAddress = HouseDocumentUtil.getTargetDescription(value);
             //添加换行符
             if (index != mapSize){
                 actAddress +=  "\n";
@@ -289,16 +291,16 @@ public class HouseDocumentUtil {
      * @param outerAcreage
      * @return
      */
-    public static String outAcreageTemplate(Set<Object> useTo,Set<Object> landType,List<Object> outerAcreage){
+    public static String outAcreageTemplate(Set<String> useTo,Set<String> landType,List<Object> outerAcreage){
         //有地类用途和分摊面积
         if (cn.hutool.core.collection.CollectionUtil.isNotEmpty(outerAcreage)
                 && cn.hutool.core.collection.CollectionUtil.isNotEmpty(landType)){
-            for (Object l : landType){
-                if (((String)l).contains("商业")){
+            for (String l : landType){
+                if (l.contains("商业")){
                     BigDecimal sum = sumList(outerAcreage);
                     return "估价对象分摊出让商业用地使用权面积合计为:"+sum.toString()+"㎡;详见估价结果一览表";
                 }
-                if (((String)l).contains("零售")){
+                if (l.contains("零售")){
                     BigDecimal sum = sumList(outerAcreage);
                     return "估价对象分摊出让批发零售用地使用权面积合计为:"+sum.toString()+"㎡;详见估价结果一览表";
                 }
@@ -510,7 +512,7 @@ public class HouseDocumentUtil {
     public static String getIsBuildingPart(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplHouseParagraph) {
         String paragraph = tmplHouseParagraph.getParagraph();
         if (CollectionUtil.isNotEmpty(targets)){
-            Set<String> tIds = targets.stream().filter(x -> (StrUtil.isNotBlank(x.getIsPart()) && x.getIsPart().equals(YES))).map(HouseGuarantyTarget::getTId).collect(Collectors.toSet());
+            Set<String> tIds = targets.stream().filter(x -> (StrUtil.isNotBlank(x.getIsPart()) && x.getIsPart().equals(YES))).map(HouseGuarantyTarget::getTid).collect(Collectors.toSet());
             if (CollectionUtil.isNotEmpty(tIds)){
                 if (tIds.size() == targets.size()){
                     return paragraph.replace("{tIds}", "");
@@ -532,7 +534,7 @@ public class HouseDocumentUtil {
     public static String getIsHotelPart(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplHouseParagraph) {
         String paragraph = tmplHouseParagraph.getParagraph();
         if (CollectionUtil.isNotEmpty(targets)){
-            Set<String> tIds = targets.stream().filter(x -> (StrUtil.isNotBlank(x.getIsPart()) && x.getIsPart().equals(HOTEL_PART))).map(HouseGuarantyTarget::getTId).collect(Collectors.toSet());
+            Set<String> tIds = targets.stream().filter(x -> (StrUtil.isNotBlank(x.getIsPart()) && x.getIsPart().equals(HOTEL_PART))).map(HouseGuarantyTarget::getTid).collect(Collectors.toSet());
             if (CollectionUtil.isNotEmpty(tIds)){
                 if (tIds.size() == targets.size()){
                     return paragraph.replace("{tIds}", "");
@@ -555,7 +557,7 @@ public class HouseDocumentUtil {
         if (CollectionUtil.isNotEmpty(targets)){
             List<HouseGuarantyTarget> collect = targets.stream().filter(x -> (x.getHasBuildingYear()!=null && !x.getHasBuildingYear() && StrUtil.isNotBlank(x.getBuildingYear()))).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect)){
-                List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTId).collect(Collectors.toList());
+                List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTid).collect(Collectors.toList());
                 List<String> buildingYears = collect.stream().map(HouseGuarantyTarget::getBuildingYear).collect(Collectors.toList());
                 result = paragraph.replace("{tIds}", CollectionUtil.formatDotAndRemoveMiddle(tIds))
                         .replace("{years}", CollectionUtil.formatDotAndRemoveMiddle(buildingYears));
@@ -574,14 +576,14 @@ public class HouseDocumentUtil {
         StringBuilder result = new StringBuilder();
         if (CollectionUtil.isNotEmpty(targets)){
                 for (HouseGuarantyTarget target : targets) {
-                    List<HouseGuarantyTargetDTO> targetDTOS = JSON.parseArray(target.getBaseInfo(), HouseGuarantyTargetDTO.class);
-                    for (HouseGuarantyTargetDTO targetDTO : targetDTOS) {
+                    List<HouseGuarantyAim> targetDTOS = target.getAims();
+                    for (HouseGuarantyAim targetDTO : targetDTOS) {
                         if (!targetDTO.getLandType().contains(targetDTO.getUseTo())){
                             result.append(tmplHouseParagraph.getParagraph())
-                                    .append("估价对象").append(targetDTO.getId()).append("序号").append(targetDTO.getNo())
+                                    .append("估价对象").append(targetDTO.getTid()).append("序号").append(targetDTO.getTno())
                                     .append("所在宗地《国有土地使用证》记载土地用途为")
                                     .append(targetDTO.getLandType()).append(",估价对象")
-                                    .append(targetDTO.getId()).append("序号").append(targetDTO.getNo()).append("《房屋所有权证》记载规划用途为")
+                                    .append(targetDTO.getTid()).append("序号").append(targetDTO.getTno()).append("《房屋所有权证》记载规划用途为")
                                     .append(targetDTO.getUseTo())
                                     .append(",本次估价以估价对象合法保持房屋实际用途继续使用为假设前提。\n");
                         }
@@ -606,7 +608,7 @@ public class HouseDocumentUtil {
                     && x.getLandCertificateType().equals("大证")&& !x.getIsCostingShareMethod()).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect) && certificateLandUse!=null){
                 for (HouseGuarantyTarget target : collect) {
-                    String tId = target.getTId();
+                    String tId = target.getTid();
                     String landUseTo = target.getLandUseTo();
                     String content = paragraph.replace("{tId}", tId).replace("{landUseTo}", certificateLandUse.getUseType()).replace("{landExpireDate}", certificateLandUse.getExpireDate());
                     result.append(content).append("\n");
@@ -630,9 +632,9 @@ public class HouseDocumentUtil {
                     x.getLandCertificateType().equals("大证") )).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect) && CollectionUtil.isNotEmpty(landCerts)){
                 for (HouseGuarantyTarget target : collect) {
-                    List<CertificateLandUse> certs = landCerts.stream().filter(x -> x.getTid().equals(target.getTId())).collect(Collectors.toList());
+                    List<CertificateLandUse> certs = landCerts.stream().filter(x -> x.getTid().equals(target.getTid())).collect(Collectors.toList());
                     if (CollectionUtil.isNotEmpty(certs)){
-                        String tId = target.getTId();
+                        String tId = target.getTid();
                         String content = paragraph.replace("{tId}", tId).replace("{landExpireDate}",certs.get(0).getExpireDate()).replace("{shareAcreage1}", certs.get(0).getOutterAcreage());
                         result.append(content).append("\n");
                     }
@@ -658,9 +660,9 @@ public class HouseDocumentUtil {
                     && x.getHasLayerImage()!=null && x.getHasLayerImage())).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect)){
                 for (HouseGuarantyTarget target : collect) {
-                    String tId = target.getTId();
-                    List<HouseGuarantyTargetDTO> targetDTOS = JSON.parseArray(target.getBaseInfo(), HouseGuarantyTargetDTO.class);
-                    List<String> acreageStr = targetDTOS.stream().filter(x -> StrUtil.isNotBlank(x.getAcreage())).map(HouseGuarantyTargetDTO::getAcreage).collect(Collectors.toList());
+                    String tId = target.getTid();
+                    List<HouseGuarantyAim> targetDTOS = target.getAims();
+                    List<String> acreageStr = targetDTOS.stream().filter(x -> StrUtil.isNotBlank(x.getAcreage())).map(HouseGuarantyAim::getAcreage).collect(Collectors.toList());
                     BigDecimal acreage = BigDecimal.ZERO;
                     for (String acreageStr1 : acreageStr) {
                         acreage = acreage.add(new BigDecimal(acreageStr1));
@@ -707,9 +709,9 @@ public class HouseDocumentUtil {
                     && x.getHasLayerImage()!=null && !x.getHasLayerImage())).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect)){
                 for (HouseGuarantyTarget target : collect) {
-                    String tId = target.getTId();
-                    List<HouseGuarantyTargetDTO> targetDTOS = JSON.parseArray(target.getBaseInfo(), HouseGuarantyTargetDTO.class);
-                    List<String> acreageStr = targetDTOS.stream().filter(x -> StrUtil.isNotBlank(x.getAcreage())).map(HouseGuarantyTargetDTO::getAcreage).collect(Collectors.toList());
+                    String tId = target.getTid();
+                    List<HouseGuarantyAim> targetDTOS = target.getAims();
+                    List<String> acreageStr = targetDTOS.stream().filter(x -> StrUtil.isNotBlank(x.getAcreage())).map(HouseGuarantyAim::getAcreage).collect(Collectors.toList());
                     BigDecimal acreage = BigDecimal.ZERO;
                     for (String acreageStr1 : acreageStr) {
                         acreage = acreage.add(new BigDecimal(acreageStr1));
@@ -757,8 +759,8 @@ public class HouseDocumentUtil {
                     && x.getIsAddressCertificate()!=null && x.getIsAddressCertificate()).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect)){
                 for (HouseGuarantyTarget target : collect) {
-                    String tId = target.getTId();
-                    List<HouseGuarantyTargetDTO> targetDTOS = JSON.parseArray(target.getBaseInfo(), HouseGuarantyTargetDTO.class);
+                    String tId = target.getTid();
+                    List<HouseGuarantyAim> targetDTOS = target.getAims();
                     String location = targetDTOS.get(0).getLocation();
                     String actAddress = targetDTOS.get(0).getActAddress();
                     String replace = paragraph.replace("{tId}", tId).replace("{address}", location).replace("{actAddress}", actAddress).replace("{certificates}", CollectionUtil.formatDotAndRemoveMiddle(certificates));
@@ -784,8 +786,8 @@ public class HouseDocumentUtil {
                     && x.getIsAddressCertificate()!=null && !x.getIsAddressCertificate()).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect)){
                 for (HouseGuarantyTarget target : collect) {
-                    String tId = target.getTId();
-                    List<HouseGuarantyTargetDTO> targetDTOS = JSON.parseArray(target.getBaseInfo(), HouseGuarantyTargetDTO.class);
+                    String tId = target.getTid();
+                    List<HouseGuarantyAim> targetDTOS = target.getAims();
                     String actAddress = targetDTOS.get(0).getActAddress();
                     String replace = paragraph.replace("{tId}", tId)
                             .replace("{actAddress}", actAddress).replace("{certificates}", CollectionUtil.formatDotAndRemoveMiddle(certificates));
@@ -809,7 +811,7 @@ public class HouseDocumentUtil {
             List<HouseGuarantyTarget> collect = targets.stream().filter(x -> x.getIsDateTimeSame()!=null && !x.getIsDateTimeSame()).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect)){
                 for (HouseGuarantyTarget target : collect) {
-                    String tId = target.getTId();
+                    String tId = target.getTid();
                     String exploreDate = target.getExploreDate();
                     String replace = paragraph.replace("{tId}", tId).replace("{exploreDate}", exploreDate==null?"<缺失实勘日期>":exploreDate).replace("{valueTiming}", valueTiming);
                     result.append(replace).append("\n");
@@ -831,7 +833,7 @@ public class HouseDocumentUtil {
                     x.getLandCertificateType().equals("大证") && !x.getHouseGetLandInfo()).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect)){
                 String paragraph = tmplParagraph.getParagraph();
-                List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTId).collect(Collectors.toList());
+                List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTid).collect(Collectors.toList());
                 return paragraph.replace("{tIds}",CollectionUtil.formatDotAndRemoveMiddle(tIds));
             }
         }
@@ -847,7 +849,7 @@ public class HouseDocumentUtil {
     public static String isNotOriginCertificateOnlyHouse(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph,String isCheckOriginCertificate,List<String> certificates) {
         if (CollectionUtil.isNotEmpty(targets)){
             if (!checkBoolean(isCheckOriginCertificate)){
-                List<String> tIds = targets.stream().map(HouseGuarantyTarget::getTId).collect(Collectors.toList());
+                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));
             }
@@ -865,12 +867,12 @@ public class HouseDocumentUtil {
         if (CollectionUtil.isNotEmpty(targets) && !checkBoolean(isCheckOriginCertificate)){
             List<String> tIds = new ArrayList<>();
             for (HouseGuarantyTarget target : targets) {
-                List<HouseGuarantyTargetDTO> targetDTOS = JSON.parseArray(target.getBaseInfo(), HouseGuarantyTargetDTO.class);
-                List<String> addresses = targetDTOS.stream().map(HouseGuarantyTargetDTO::getLocation).collect(Collectors.toList());
+                List<HouseGuarantyAim> targetDTOS = target.getAims();
+                List<String> addresses = targetDTOS.stream().map(HouseGuarantyAim::getLocation).collect(Collectors.toList());
                 for (String address : addresses) {
                     Boolean inBigChengdu = AddressUtil.isInBigChengdu(address);
                     if (inBigChengdu){
-                        tIds.add(target.getTId());
+                        tIds.add(target.getTid());
                     }
                 }
 
@@ -893,12 +895,12 @@ public class HouseDocumentUtil {
         if (CollectionUtil.isNotEmpty(targets) && !checkBoolean(isCheckOriginCertificate)){
             List<String> tIds = new ArrayList<>();
             for (HouseGuarantyTarget target : targets) {
-                List<HouseGuarantyTargetDTO> targetDTOS = JSON.parseArray(target.getBaseInfo(), HouseGuarantyTargetDTO.class);
-                List<String> addresses = targetDTOS.stream().map(HouseGuarantyTargetDTO::getLocation).collect(Collectors.toList());
+                List<HouseGuarantyAim> targetDTOS = target.getAims();
+                List<String> addresses = targetDTOS.stream().map(HouseGuarantyAim::getLocation).collect(Collectors.toList());
                 for (String address : addresses) {
                     Boolean inBigChengdu = AddressUtil.isInBigChengdu(address);
                     if (!inBigChengdu){
-                        tIds.add(target.getTId());
+                        tIds.add(target.getTid());
                     }
                 }
 
@@ -923,7 +925,7 @@ public class HouseDocumentUtil {
                     && x.getHasRentOutContract() !=null && !x.getHasRentOutContract() && x.getIsRentLimit()!=null && !x.getIsRentLimit()).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect)){
                 String paragraph = tmplParagraph.getParagraph();
-                List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTId).collect(Collectors.toList());
+                List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTid).collect(Collectors.toList());
                 return paragraph.replace("{tIds}", CollectionUtil.formatDotAndRemoveMiddle(tIds));
             }
         }
@@ -941,7 +943,7 @@ public class HouseDocumentUtil {
             if (CollectionUtil.isNotEmpty(targets)){
                 List<HouseGuarantyTarget> collect = targets.stream().filter(x ->   x.getIsBuildingReduceValue()!=null && x.getIsBuildingReduceValue()).collect(Collectors.toList());
                 if (CollectionUtil.isNotEmpty(collect)){
-                    List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTId).collect(Collectors.toList());
+                    List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTid).collect(Collectors.toList());
                     String paragraph = tmplParagraph.getParagraph();
                     return paragraph.replace("{tIds}", CollectionUtil.formatDotAndRemoveMiddle(tIds));
                 }
@@ -961,7 +963,7 @@ public class HouseDocumentUtil {
             if (CollectionUtil.isNotEmpty(targets)){
                 List<HouseGuarantyTarget> collect = targets.stream().filter(x ->  x.getIsBuildingReduceValue()!=null && x.getIsBuildingReduceValue()).collect(Collectors.toList());
                 if (CollectionUtil.isNotEmpty(collect)){
-                    List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTId).collect(Collectors.toList());
+                    List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTid).collect(Collectors.toList());
                     String paragraph = tmplParagraph.getParagraph();
                     return paragraph.replace("{tIds}", CollectionUtil.formatDotAndRemoveMiddle(tIds));
                 }
@@ -1015,7 +1017,7 @@ public class HouseDocumentUtil {
         String pledgeUser = target.getPledgeUser();
         String pledgeValue = target.getPledgeValue();
         String newPledgeUser = target.getNewPledgeUser();
-        String tId = target.getTId();
+        String tId = target.getTid();
         return paragraph.replace("{tId}", tId)
                 .replace("{tId}", tId).replace("{pledgeType}", pledgeType).replace("{pledgeType}", pledgeType)
                 .replace("{pledgeUser}", pledgeUser).replace("{pledgeValue}",
@@ -1062,7 +1064,7 @@ public class HouseDocumentUtil {
                     && 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 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){
@@ -1137,7 +1139,7 @@ public class HouseDocumentUtil {
         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());
+                List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTid).collect(Collectors.toList());
                 String paragraph = tmplParagraph.getParagraph();
                 return paragraph.replace("{tIds}", CollectionUtil.formatDotAndRemoveMiddle(tIds));
             }
@@ -1156,7 +1158,7 @@ public class HouseDocumentUtil {
             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());
+                List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTid).collect(Collectors.toList());
                 Set<String> pledgeTypes = collect.stream().map(HouseGuarantyTarget::getPledgeType).collect(Collectors.toSet());
                 String paragraph = tmplParagraph.getParagraph();
                 return paragraph.replace("{tIds}", CollectionUtil.formatDotAndRemoveMiddle(tIds))
@@ -1180,7 +1182,7 @@ public class HouseDocumentUtil {
                     && 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 tId = collect.get(i).getTid();
                     String pledgeType = collect.get(i).getPledgeType();
                     String newPledgeUser = collect.get(i).getNewPledgeUser();
                     result.append(paragraph.replace("{tId}", tId)
@@ -1210,7 +1212,7 @@ public class HouseDocumentUtil {
                     x.getSamePledgeHigh()).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect)){
                 for (int i = 0; i < collect.size(); i++){
-                    String tId = collect.get(i).getTId();
+                    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){
@@ -1237,7 +1239,7 @@ public class HouseDocumentUtil {
                     &&  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 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){
@@ -1260,7 +1262,7 @@ public class HouseDocumentUtil {
         if (CollectionUtil.isNotEmpty(targets)){
             List<HouseGuarantyTarget> collect = targets.stream().filter(x -> x.getIsRentOut()!=null && !x.getIsRentOut()).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect)){
-                List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTId).collect(Collectors.toList());
+                List<String> tIds = collect.stream().map(HouseGuarantyTarget::getTid).collect(Collectors.toList());
                 String paragraph = tmplParagraph.getParagraph();
                 return paragraph.replace("{tIds}", CollectionUtil.formatDotAndRemoveMiddle(tIds));
             }
@@ -1283,7 +1285,7 @@ public class HouseDocumentUtil {
                     && StrUtil.isNotBlank(x.getNotRentLimitReason()) && StrUtil.equals(x.getRentLimitReason(), "高于市场租金")).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect)){
                 for (int i = 0; i < collect.size(); i++){
-                    String tId = collect.get(i).getTId();
+                    String tId = collect.get(i).getTid();
                     result.append(paragraph.replace("{tId}", tId));
                     if (i != collect.size()-1){
                         result.append("\n");
@@ -1310,7 +1312,7 @@ public class HouseDocumentUtil {
                     && StrUtil.isNotBlank(x.getNotRentLimitReason()) && StrUtil.equals(x.getRentLimitReason(), "与市场租金相当")).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect)){
                 for (int i = 0; i < collect.size(); i++){
-                    String tId = collect.get(i).getTId();
+                    String tId = collect.get(i).getTid();
                     result.append(paragraph.replace("{tId}", tId));
                     if (i != collect.size()-1){
                         result.append("\n");
@@ -1337,7 +1339,7 @@ public class HouseDocumentUtil {
                     && StrUtil.isNotBlank(x.getNotRentLimitReason()) && StrUtil.equals(x.getRentLimitReason(), "低于市场租金")).collect(Collectors.toList());
             if (CollectionUtil.isNotEmpty(collect)){
                 for (int i = 0; i < collect.size(); i++){
-                    String tId = collect.get(i).getTId();
+                    String tId = collect.get(i).getTid();
                     result.append(paragraph.replace("{tId}", tId));
                     if (i != collect.size()-1){
                         result.append("\n");

+ 10 - 0
dao/src/main/java/com/dayou/mapper/HouseGuarantyAimMapper.java

@@ -0,0 +1,10 @@
+package com.dayou.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.dayou.entity.HouseGuarantyAim;
+
+import java.util.List;
+
+public interface HouseGuarantyAimMapper extends BaseMapper<HouseGuarantyAim> {
+
+}

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

@@ -0,0 +1,8 @@
+package com.dayou.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.dayou.entity.HouseGuarantyBase;
+
+public interface HouseGuarantyBaseMapper extends BaseMapper<HouseGuarantyBase> {
+
+}

+ 5 - 0
dao/src/main/java/com/dayou/mapper/HouseGuarantyTargetMapper.java

@@ -2,6 +2,11 @@ package com.dayou.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.dayou.entity.HouseGuarantyTarget;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface HouseGuarantyTargetMapper extends BaseMapper<HouseGuarantyTarget> {
+
+    List<HouseGuarantyTarget> getList(@Param("docId") Long docId);
 }

+ 6 - 0
dao/src/main/resources/mapper/HouseGuarantyAim.xml

@@ -0,0 +1,6 @@
+<?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.HouseGuarantyAimMapper">
+
+
+</mapper>

+ 6 - 0
dao/src/main/resources/mapper/HouseGuarantyBase.xml

@@ -0,0 +1,6 @@
+<?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.HouseGuarantyBaseMapper">
+
+
+</mapper>

+ 120 - 0
dao/src/main/resources/mapper/HouseGuarantyTargetMapper.xml

@@ -2,5 +2,125 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.dayou.mapper.HouseGuarantyTargetMapper">
 
+    <resultMap id="targetMap" type="com.dayou.entity.HouseGuarantyTarget">
+        <result column="id" property="id" />
+        <result column="dId" property="docId" />
+        <result column="tid" property="tid" />
+        <result column="is_part" property="isPart" />
+        <result column="has_building_year" property="hasBuildingYear" />
+        <result column="building_year" property="buildingYear" />
+        <result column="land_certificate_type" property="landCertificateType" />
+        <result column="land_use_to" property="landUseTo" />
+        <result column="land_expire_date" property="landExpireDate" />
+        <result column="share_acreage1" property="shareAcreage1" />
+        <result column="is_layer" property="isLayer" />
+        <result column="has_layer_image" property="hasLayerImage" />
+        <result column="floor1_acreage" property="floor1Acreage" />
+        <result column="floor2_acreage" property="floor2Acreage" />
+        <result column="floor3_acreage" property="floor3Acreage" />
+        <result column="is_address_same" property="isAddressSame" />
+        <result column="is_date_time_same" property="isDateTimeSame" />
+        <result column="is_address_certificate" property="isAddressCertificate" />
+        <result column="is_building_reduce_value" property="isBuildingReduceValue" />
+        <result column="has_origin_certificate" property="hasOriginCertificate" />
+        <result column="is_promise" property="isPromise" />
+        <result column="has_land_use_right_contract" property="hasLandUseRightContract" />
+        <result column="is_rent_out" property="isRentOut" />
+        <result column="has_rent_out_contract" property="hasRentOutContract" />
+        <result column="is_rent_limit" property="isRentLimit" />
+        <result column="not_rent_limit_reason" property="notRentLimitReason" />
+        <result column="rent_limit_reason" property="rentLimitReason" />
+        <result column="rent_end_date" property="rentEndDate" />
+        <result column="rent_start_date" property="rentStartDate" />
+        <result column="rent_money" property="rentMoney" />
+        <result column="rent_user" property="rentUser" />
+        <result column="has_pledge" property="hasPledge" />
+        <result column="pledge_type" property="pledgeType" />
+        <result column="pledge_user" property="pledgeUser" />
+        <result column="pledge_value" property="pledgeValue" />
+        <result column="same_pledge_continue" property="samePledgeContinue" />
+        <result column="new_pledge_user" property="newPledgeUser" />
+        <result column="high_pledge_not_expire" property="highPledgeNotExpire" />
+        <result column="same_pledge_high" property="samePledgeHigh" />
+        <result column="first_money" property="firstMoney" />
+        <result column="debt_money" property="debtMoney" />
+        <result column="is_take_out_first_money" property="isTakeOutFirstMoney" />
+        <result column="is_costing_share_method" property="isCostingShareMethod" />
+        <result column="no_building_house_nos" property="noBuildingHouseNos" />
+        <result column="explore_date" property="exploreDate" />
+        <result column="land_year_lower_house_year" property="landYearLowerHouseYear" />
+        <result column="is_promise_file" property="isPromiseFile" />
+        <result column="is_in_cheng_du" property="isInChengDu" />
+        <result column="house_get_land_info" property="houseGetLandInfo" />
+        <result column="land_use_type" property="landUseType" />
+        <result column="has_land_use_right" property="hasLandUseRight" />
+        <result column="has_living_right" property="hasLivingRight" />
+        <result column="land_use_right_from" property="landUseRightFrom" />
+        <result column="land_use_right_to" property="landUseRightTo" />
+        <collection property="aims" select="getAims" ofType="com.dayou.entity.HouseGuarantyAim"
+            column="{dId=dId,tid=tid}" />
+    </resultMap>
+
+    <select id="getList" parameterType="java.lang.Long" resultMap="targetMap">
+        select id,
+               #{docId} as dId,
+               tid,
+             is_part,
+               has_building_year,
+               building_year,
+               land_certificate_type,
+               land_use_to,
+                   land_expire_date,
+            share_acreage1,
+            is_layer,
+            has_layer_image,
+            floor1_acreage,
+            floor2_acreage,
+            floor3_acreage,
+            is_address_same,
+            is_date_time_same,
+            is_address_certificate,
+            is_building_reduce_value,
+            has_origin_certificate,
+            is_promise,
+            has_land_use_right_contract,
+            is_rent_out,
+            has_rent_out_contract,
+            is_rent_limit,
+            not_rent_limit_reason,
+            rent_limit_reason,
+            rent_end_date,
+            rent_start_date,
+            rent_money,
+            rent_user,
+            has_pledge,
+            pledge_user,
+            pledge_type,
+            pledge_value,
+            same_pledge_continue,
+            new_pledge_user,
+            high_pledge_not_expire,
+            same_pledge_high,
+            first_money,
+            debt_money,
+            is_take_out_first_money,
+            is_costing_share_method,
+            no_building_house_nos,
+            explore_date,
+            land_year_lower_house_year,
+            is_promise_file,
+            is_in_cheng_du,
+            house_get_land_info,
+            land_use_type,
+            has_land_use_right,
+                    has_living_right,
+                    land_use_right_from,
+                    land_use_right_to
+        from house_guaranty_target where doc_id = #{docId} and delete_status = 0
+    </select>
+
+    <select id="getAims" resultType="com.dayou.entity.HouseGuarantyAim">
+        select * from house_guaranty_aim where doc_id = #{dId} and tid = #{tid} and delete_status = 0
+    </select>
 
 </mapper>

+ 9 - 5
domain/src/main/java/com/dayou/dto/HouseGuarantyTargetDTO.java

@@ -1,15 +1,17 @@
-package com.dayou.dto;
+package com.dayou.entity;
 
+import com.dayou.common.BaseEntity;
 import lombok.Data;
 
-import java.math.BigDecimal;
 
 @Data
-public class HouseGuarantyTargetDTO {
+public class HouseGuarantyAim extends BaseEntity {
 
-    private String id;
+    private Long docId;
 
-    private String no;
+    private String tid;
+
+    private String tno;
 
     private String certificateNo;
 
@@ -37,4 +39,6 @@ public class HouseGuarantyTargetDTO {
 
     private String actAddress;
 
+    private String lngLat;
+
 }

+ 34 - 33
domain/src/main/java/com/dayou/doc/house/ConsignorLetterDO.java

@@ -1,14 +1,17 @@
-package com.dayou.doc.house;
+package com.dayou.entity;
 
-import lombok.Builder;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.dayou.common.BaseEntity;
 import lombok.Data;
 
 /**
  * 致委托人函 文档对象
  */
-@Builder
 @Data
-public class ConsignorLetterDO {
+public class HouseGuarantyBase extends BaseEntity {
+
+    private Long docId;
+
 
     /**
      * 估价项目名称
@@ -20,15 +23,7 @@ public class ConsignorLetterDO {
      */
     private String consignor;
 
-    /**
-     * 权利
-     */
-    private String ownship;
 
-    /**
-     * 权利人
-     */
-    private String ownshipUser;
 
     /**
      * 估价师1
@@ -61,16 +56,6 @@ public class ConsignorLetterDO {
     private String docNo;
 
     /**
-     * 实勘日期
-     */
-    private String actDesc;
-
-    /**
-     * 权利人是否为空
-     */
-    private String ownshipBlank;
-
-    /**
      * 价值时点
      */
     private String valueTiming;
@@ -97,17 +82,7 @@ public class ConsignorLetterDO {
 
 
     /**
-     * 土地使用权类型
-     */
-    private String landUseRightType;
-
-    /**
-     * 划拨用地是否扣除出让金
-     */
-    private String isDeductSellAmount;
-
-    /**
-     * 划拨用地是否扣除出让金
+     * 委托人类型
      */
     private String consignorType;
 
@@ -131,4 +106,30 @@ public class ConsignorLetterDO {
      */
     private String creditCode;
 
+
+    /**
+     * 权利
+     */
+    @TableField(exist = false)
+    private String ownship;
+
+
+    /**
+     * 权利人是否为空
+     */
+    @TableField(exist = false)
+    private String ownshipBlank;
+
+    /**
+     * 地址描述
+     */
+    @TableField(exist = false)
+    private String actDesc;
+
+    /**
+     * 权利人
+     */
+    @TableField(exist = false)
+    private String ownshipUser;
+
 }

+ 6 - 3
domain/src/main/java/com/dayou/entity/HouseGuarantyTarget.java

@@ -1,9 +1,11 @@
 package com.dayou.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.dayou.common.BaseEntity;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.List;
 
 @Data
 public class HouseGuarantyTarget extends BaseEntity implements Serializable {
@@ -12,9 +14,7 @@ public class HouseGuarantyTarget extends BaseEntity implements Serializable {
 
     private Long docId;
 
-    private String tId;
-
-    private String baseInfo;
+    private String tid;
 
     private String isPart;
 
@@ -118,4 +118,7 @@ public class HouseGuarantyTarget extends BaseEntity implements Serializable {
 
     private String landUseRightTo;
 
+    @TableField(exist = false)
+    private List<HouseGuarantyAim> aims;
+
 }

+ 8 - 3
domain/src/main/java/com/dayou/enums/HouseTargetTableColumn.java

@@ -11,8 +11,8 @@ import java.util.Arrays;
 @Getter
 public enum HouseTargetTableColumn {
 
-    ID("id","估价对象"),
-    NO("no","序号"),
+    TID("tid","估价对象"),
+    TNO("tno","序号"),
     CERTIFICATE_NO("certificateNo","权属证书号"),
     OWE_SHIP_USER("ownShipUser","权利人"),
     LOCATION("location","坐落"),
@@ -39,7 +39,12 @@ public enum HouseTargetTableColumn {
     private String zhName;
 
     public static String getZhNameByCode(String name) {
-        return Arrays.stream(HouseTargetTableColumn.values()).filter(x -> x.getCode().equals(name)).findFirst().get().getZhName();
+        HouseTargetTableColumn houseTargetTableColumn = Arrays.stream(HouseTargetTableColumn.values())
+                .filter(x -> x.getCode().equals(name)).findFirst().orElse(null);
+        if (houseTargetTableColumn != null) {
+            return houseTargetTableColumn.getZhName();
+        }
+        return null;
     }
 
 

+ 2 - 2
domain/src/main/java/com/dayou/vo/HouseTargetVO.java

@@ -1,6 +1,6 @@
 package com.dayou.vo;
 
-import com.dayou.dto.HouseGuarantyTargetDTO;
+import com.dayou.entity.HouseGuarantyAim;
 import lombok.Data;
 
 import java.util.List;
@@ -10,5 +10,5 @@ public class HouseTargetVO {
 
     private String tId;
 
-    private List<HouseGuarantyTargetDTO> list;
+    private List<HouseGuarantyAim> aims;
 }

+ 7 - 0
service/src/main/java/com/dayou/service/HouseGuarantyAimService.java

@@ -0,0 +1,7 @@
+package com.dayou.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.dayou.entity.HouseGuarantyAim;
+
+public interface HouseGuarantyAimService extends IService<HouseGuarantyAim> {
+}

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

@@ -0,0 +1,7 @@
+package com.dayou.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.dayou.entity.HouseGuarantyBase;
+
+public interface HouseGuarantyBaseService extends IService<HouseGuarantyBase> {
+}

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

@@ -0,0 +1,10 @@
+package com.dayou.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dayou.entity.HouseGuarantyBase;
+import com.dayou.mapper.HouseGuarantyBaseMapper;
+import org.springframework.stereotype.Service;
+
+@Service
+public class HouseGuarantyBaseServiceImpl extends ServiceImpl<HouseGuarantyBaseMapper, HouseGuarantyBase> implements HouseGuarantyBaseService {
+}

+ 0 - 1
service/src/main/java/com/dayou/service/HouseGuarantyProcessService.java

@@ -1,7 +1,6 @@
 package com.dayou.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.dayou.dto.HouseGuarantyTargetDTO;
 import com.dayou.entity.HouseGuarantyProcess;
 import com.dayou.vo.ProcessVO;
 

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

@@ -23,14 +23,15 @@ public interface HouseGuarantyService {
      * @param id
      * @return
      */
-    Boolean analysisCollect1(Long id) throws Exception;
+    Long analysisCollect1(Long id) throws Exception;
 
     /**
      * 生成致委托人函
-     * @param id
+     * @param pId
+     * @param docId
      * @return
      */
-    Long genConsignorLetter(Long id);
+    Boolean genConsignorLetter(Long pId,Long docId);
 
     /**
      * 获取估价对象

+ 2 - 1
service/src/main/java/com/dayou/service/TmplHouseParagraphService.java

@@ -3,6 +3,7 @@ package com.dayou.service;
 import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.dayou.entity.CertificateLandUse;
+import com.dayou.entity.HouseGuarantyBase;
 import com.dayou.entity.HouseGuarantyTarget;
 import com.dayou.entity.TmplHouseParagraph;
 
@@ -44,7 +45,7 @@ public interface TmplHouseParagraphService extends IService<TmplHouseParagraph>
      * @param targets
      * @return
      */
-    String findLimitConditionResult(List<HouseGuarantyTarget> targets, JSONObject jsonObject, List<String> certificates);
+    String findLimitConditionResult(List<HouseGuarantyTarget> targets, HouseGuarantyBase base, List<String> certificates);
 
     /**
      * 生成使用报告说明

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

@@ -0,0 +1,11 @@
+package com.dayou.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dayou.entity.HouseGuarantyAim;
+import com.dayou.mapper.HouseGuarantyAimMapper;
+import com.dayou.service.HouseGuarantyAimService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class HouseGuarantyAimServiceImpl extends ServiceImpl<HouseGuarantyAimMapper, HouseGuarantyAim> implements HouseGuarantyAimService {
+}

+ 0 - 3
service/src/main/java/com/dayou/service/impl/HouseGuarantyProcessServiceImpl.java

@@ -4,20 +4,17 @@ import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.dayou.common.BaseEntity;
-import com.dayou.dto.HouseGuarantyTargetDTO;
 import com.dayou.entity.DocumentProduction;
 import com.dayou.entity.HouseGuarantyProcess;
 import com.dayou.enums.BusinessEnum;
 import com.dayou.mapper.HouseGuarantyProcessMapper;
 import com.dayou.service.DocumentProductionService;
 import com.dayou.service.HouseGuarantyProcessService;
-import com.dayou.service.HouseGuarantyService;
 import com.dayou.vo.ProcessVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;

+ 78 - 86
service/src/main/java/com/dayou/service/impl/HouseGuarantyServiceImpl.java

@@ -1,5 +1,6 @@
 package com.dayou.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
@@ -12,16 +13,16 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 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.entity.HouseGuarantyBase;
 import com.dayou.doc.house.GuarantyResultDO;
 import com.dayou.dto.HouseGuarantyTableDTO;
-import com.dayou.dto.HouseGuarantyTargetDTO;
-import com.dayou.dto.HousePledgeDTO;
+import com.dayou.entity.HouseGuarantyAim;
 import com.dayou.dto.HouseRightsDTO;
 import com.dayou.entity.*;
 import com.dayou.enums.DocumentType;
 import com.dayou.enums.BusinessEnum;
 import com.dayou.exception.ErrorCode;
+import com.dayou.mapper.HouseGuarantyTargetMapper;
 import com.dayou.mapper.HouseTargetEntityMapper;
 import com.dayou.service.*;
 import com.dayou.table.HouseEntityTable;
@@ -45,7 +46,6 @@ import static com.dayou.constants.HouseGuarantyDoc.*;
 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;
 import static java.lang.Thread.sleep;
 
 @Service
@@ -65,9 +65,6 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
     private DocumentProductionService documentProductionService;
 
     @Autowired
-    private HouseGuarantyTargetService houseGuarantyTargetService;
-
-    @Autowired
     private TmplHouseParagraphService tmplHouseParagraphService;
 
     @Autowired
@@ -85,6 +82,14 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
     @Autowired
     private HouseTargetEntityMapper houseTargetEntityMapper;
 
+    @Autowired
+    private HouseGuarantyAimService houseGuarantyAimService;
+
+    @Autowired
+    private HouseGuarantyBaseService houseGuarantyBaseService;
+    @Autowired
+    private HouseGuarantyTargetMapper houseGuarantyTargetMapper;
+
     @Override
     public Long createTableWord(HouseGuarantyTableDTO houseGuarantyTableDTO) {
         try {
@@ -105,75 +110,76 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
     }
 
     @Override
-    public Boolean analysisCollect1(Long id) throws Exception {
-        try {
-            sleep(1000);
-        } catch (InterruptedException e) {
-            throw new RuntimeException(e);
-        }
+    public Long analysisCollect1(Long id) throws Exception {
         HouseGuarantyProcess process = houseGuarantyProcessService.getById(id);
         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 xArray = HouseDocumentUtil.houseTargetsFormat(array);
-        JsonUtil.jsonArray2File(xArray,home + TARGETS_JSON);
+        List<HouseGuarantyAim> houseGuarantyAims = HouseDocumentUtil.houseTargetsFormatDTO(xArray);
+        //获取项目名称
+        String projectName = HouseDocumentUtil.getProjectName(houseGuarantyAims);
+
 
         //解析估价对象json(基本信息)
-        JSONArray baseInfoArray = JsonUtil.file2JsonArray(home + COLLECT1_JSON, BASE_INFO_ZH);
-        JSONObject baseInfo = HouseDocumentUtil.baseInfoFormat(baseInfoArray);
+        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());
+        documentProductionService.save(dp);
+
+        Long docId = dp.getId();
+        houseGuarantyBase.setDocId(docId);
+        houseGuarantyBaseService.save(houseGuarantyBase);
 
-        //从估价对象一览表中获取抵押权信息
-        JSONObject jsonObject = JSONUtil.parseObj(array.get(array.size() - 1));
-        String pledgeInfo = (String) jsonObject.get("估价对象");
-        ParsingPledgeUtil.parsingPledgeInfo(pledgeInfo, baseInfo);
+        houseGuarantyAims.stream().forEach(x->{
+            x.setDocId(docId);
+        });
+        houseGuarantyAimService.saveBatch(houseGuarantyAims);
 
-        JsonUtil.jsonObject2File(baseInfo,home + BASE_INFO_JSON);
-        return Boolean.TRUE;
+        return docId;
 
     }
 
     @Override
-    public Long genConsignorLetter(Long id) {
+    public Boolean genConsignorLetter(Long pId,Long docId) {
         try {
             sleep(1000);
         } catch (InterruptedException e) {
             throw new RuntimeException(e);
         }
-        HouseGuarantyProcess process = houseGuarantyProcessService.getById(id);
+        HouseGuarantyProcess process = houseGuarantyProcessService.getById(pId);
         String baseDir = fileNetConfig.getBaseDir();
         String home = baseDir + process.getHome();
 
         try {
             // 读取估价对象地址
-            JSONArray array = JsonUtil.file2JsonArray(home + TARGETS_JSON);
+            List<HouseGuarantyAim> aims = houseGuarantyAimService.list(new LambdaQueryWrapper<HouseGuarantyAim>()
+                    .eq(HouseGuarantyAim::getDocId, docId));
 
             //读取基本信息
-            XSSFWorkbook workbook = new XSSFWorkbook(home + COLLECT1_XLSX);
-            Map<String, String> valueMap = EasyExcelUtil.getExcelCellValue(workbook, BASE_INFO_ZH);
-            String projectName = HouseDocumentUtil.getProjectName(array);
-            String docNo =  valueMap.get("docNo");
-            String consignor =  valueMap.get("consignor");
-
-            ConsignorLetterDO clDO = JSON.parseObject(JSON.toJSONString(valueMap), ConsignorLetterDO.class);
+            HouseGuarantyBase base = houseGuarantyBaseService.getOne(new LambdaQueryWrapper<HouseGuarantyBase>().eq(HouseGuarantyBase::getDocId, docId));
 
-            clDO.setProjectName(projectName);
-            Map<Object, List<Object>> collect = array.stream().collect(Collectors.groupingBy(x -> ((JSONObject) x).get(ID.getZhName())));
+            Map<String, List<HouseGuarantyAim>> collect = aims.stream().collect(Collectors.groupingBy(HouseGuarantyAim::getTid));
             String actDesc = HouseDocumentUtil.combinationTargetDescription(collect);
-            clDO.setActDesc(actDesc);
-            String ownShipUser = HouseDocumentUtil.getOwnShipUser(array);
+            base.setActDesc(actDesc);
+            String ownShipUser = HouseDocumentUtil.getOwnShipUser(aims);
 
             Boolean removeBlank = true;
-            if (!"".equals(ownShipUser) && !ownShipUser.contains(clDO.getConsignor())){
-                clDO.setOwnshipBlank("");
-                clDO.setOwnship("不动产权利人:");
-                clDO.setOwnshipUser(ownShipUser);
+            if (!"".equals(ownShipUser) && !ownShipUser.contains(base.getConsignor())){
+                base.setOwnshipBlank("");
+                base.setOwnship("不动产权利人:");
+                base.setOwnshipUser(ownShipUser);
                 removeBlank = false;
             }
             byte[] tmplWordByte = Files.readAllBytes(Paths.get(baseDir
                     + fileNetConfig.getHouseGuarantyTemplatePath() + CONSIGNOR_LETTER_TEMPLATE));
-            byte[] resultWordByte = AsposeWordUtil.fillWordDataByDomain(tmplWordByte, clDO);
+            byte[] resultWordByte = AsposeWordUtil.fillWordDataByDomain(tmplWordByte, base);
             String consignorLetterName = process.getHome() +"CONSIGNOR_LETTER_TEMPLATE"+ System.currentTimeMillis() + ".docx";
             File resultFile = new File(baseDir + consignorLetterName);
             FileOutputStream fos = new FileOutputStream(resultFile);
@@ -181,11 +187,9 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
             fos.close();
             insetTargetTableWord(baseDir + consignorLetterName,home + TARGETS_DOCX,removeBlank);
             //更新过程文档url
-            houseGuarantyProcessService.update(new LambdaUpdateWrapper<HouseGuarantyProcess>().set(HouseGuarantyProcess::getDocUrl, consignorLetterName)
-                    .eq(BaseEntity::getId,id));
-            DocumentProduction dp = buildDocumentProduction(id, projectName, docNo, consignor);
-            documentProductionService.save(dp);
-            return dp.getId();
+            return houseGuarantyProcessService.update(new LambdaUpdateWrapper<HouseGuarantyProcess>().set(HouseGuarantyProcess::getDocUrl, consignorLetterName)
+                    .eq(BaseEntity::getId, pId));
+
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
@@ -193,20 +197,15 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
 
     @Override
     public List<HouseTargetVO> getTargetsById(Long id) {
-        DocumentProduction dp = documentProductionService.getOne(new LambdaQueryWrapper<DocumentProduction>()
-                .select(DocumentProduction::getBusinessId).eq(BaseEntity::getId, id));
-        HouseGuarantyProcess process = houseGuarantyProcessService.getById(dp.getBusinessId());
-        String home = fileNetConfig.getBaseDir() + process.getHome();
         try {
-            JSONArray array = JsonUtil.file2JsonArray(home + TARGETS_JSON);
             //解析估价对象json
             List<HouseTargetVO> houseTargetVOList = new ArrayList<>();
-            List<HouseGuarantyTargetDTO> houseGuarantyTargetDTOS = HouseDocumentUtil.houseTargetsFormatDTO(array);
-            Map<String, List<HouseGuarantyTargetDTO>> collect = houseGuarantyTargetDTOS.stream().collect(Collectors.groupingBy(HouseGuarantyTargetDTO::getId));
-            for (Map.Entry<String, List<HouseGuarantyTargetDTO>> entry : collect.entrySet()) {
+            List<HouseGuarantyAim> aims = houseGuarantyAimService.list(new LambdaQueryWrapper<HouseGuarantyAim>().eq(HouseGuarantyAim::getDocId,id));
+            Map<String, List<HouseGuarantyAim>> collect = aims.stream().collect(Collectors.groupingBy(HouseGuarantyAim::getTid));
+            for (Map.Entry<String, List<HouseGuarantyAim>> entry : collect.entrySet()) {
                 HouseTargetVO houseTargetVO = new HouseTargetVO();
                 houseTargetVO.setTId(entry.getKey());
-                houseTargetVO.setList(entry.getValue());
+                houseTargetVO.setAims(entry.getValue());
                 houseTargetVOList.add(houseTargetVO);
             }
             return houseTargetVOList;
@@ -218,24 +217,18 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
 
     @Override
     public String genConditionLetter(Long id) {
-
         DocumentProduction dp = documentProductionService.getById(id);
         HouseGuarantyProcess process = houseGuarantyProcessService.getById(dp.getBusinessId());
         String baseDir = fileNetConfig.getBaseDir();
-        String home = baseDir + process.getHome();
 
         try {
-//            //获取文件数据
-//            XSSFWorkbook workbook = new XSSFWorkbook(home + COLLECT1_XLSX);
-//            Map<String, String> valueMap = EasyExcelUtil.getExcelCellValue(workbook, BASE_INFO_ZH);
-
-            JSONObject jsonObject = JsonUtil.file2JsonObject(home + BASE_INFO_JSON);
+            HouseGuarantyBase base = houseGuarantyBaseService.getOne(new LambdaQueryWrapper<HouseGuarantyBase>().eq(HouseGuarantyBase::getDocId, id));
             ConditionDO conditionDO = new ConditionDO();
-            conditionDO.setAppraiser1((String) jsonObject.get("估价师1"));
-            conditionDO.setAppraiser2((String) jsonObject.get("估价师2"));
-            conditionDO.setAppraNo1((String) jsonObject.get("估价师1注册号"));
-            conditionDO.setAppraNo2((String) jsonObject.get("估价师2注册号"));
-            conditionDO.setDocDate((String) jsonObject.get("估价报告出具日期"));
+            conditionDO.setAppraiser1(base.getAppraiser1());
+            conditionDO.setAppraiser2(base.getAppraiser2());
+            conditionDO.setAppraNo1(base.getAppraNo1());
+            conditionDO.setAppraNo2(base.getAppraNo2());
+            conditionDO.setDocDate(base.getDocDate());
 
             //获取估价对象所提供的权属证书类型
             List<String> certificates = getCertificateTypes(id);
@@ -245,14 +238,12 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
             }
 
             //获取估价对象补充信息
-            List<HouseGuarantyTarget> targets = houseGuarantyTargetService
-                    .list(new LambdaQueryWrapper<HouseGuarantyTarget>().eq(HouseGuarantyTarget::getDocId, id)
-                            .eq(BaseEntity::getDeleteStatus, Boolean.FALSE));
+            List<HouseGuarantyTarget> targets = houseGuarantyTargetMapper.getList(id);
 
 
             //获取土地证信息
             List<CertificateLandUse> landCerts = certificateLandUseService.list(new LambdaQueryWrapper<CertificateLandUse>().eq(CertificateLandUse::getBusinessId, id));
-            String isCheckOriginCertificate = (String) jsonObject.get("是否审核权属原件");
+            String isCheckOriginCertificate = base.getIsCheckOriginCertificate();
 
 
             //组合一般假设内容
@@ -265,15 +256,15 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
             conditionDO.setWDSXJS(wdsxjsResult);
 
             //组合不相一致假设内容
-            String bxyzjsResult = tmplHouseParagraphService.findBXYZJSResult(targets,certificates,(String) jsonObject.get("价值时点"));
+            String bxyzjsResult = tmplHouseParagraphService.findBXYZJSResult(targets,certificates,base.getValueTiming());
             conditionDO.setBXYZJS(bxyzjsResult);
 
             //组合依据不足假设内容
-            String yjbujsResult = tmplHouseParagraphService.findYJBUJSResult(targets,certificates,isCheckOriginCertificate,(String) jsonObject.get("估价方法"));
+            String yjbujsResult = tmplHouseParagraphService.findYJBUJSResult(targets,certificates,isCheckOriginCertificate,base.getMethods());
             conditionDO.setYJBZJS(yjbujsResult);
 
             //组合限制条件内容
-            String limitCondition = tmplHouseParagraphService.findLimitConditionResult(targets,jsonObject,certificates);
+            String limitCondition = tmplHouseParagraphService.findLimitConditionResult(targets,base,certificates);
 
             conditionDO.setXZTJ(limitCondition);
 
@@ -324,24 +315,25 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
         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);
+            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((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("统一社会信用代码"));
+            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());
 
-            Map<Object, List<Object>> collect = array.stream().collect(Collectors.groupingBy(x -> ((JSONObject) x).get(ID.getZhName())));
+            Map<String, List<HouseGuarantyAim>> collect = aims.stream().collect(Collectors.groupingBy(HouseGuarantyAim::getTid));
 
             guarantyResultDO.setTargetScope(HouseDocumentUtil.combinationTargetDescription(collect));
 
@@ -368,7 +360,7 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
             //获取权属信息数据源
             List<HouseRightsDTO> houseRightsDTOList = houseTargetEntityService.getHouseRightsDTOList(id);
             HouseDocumentUtil.getRightsDesc(doc,houseRightsDTOList,
-                    HouseDocumentUtil.checkBoolean((String) jsonObject.get("是否审核权属原件")));
+                    HouseDocumentUtil.checkBoolean(base.getIsCheckOriginCertificate()));
 
 
             //生成文档中的表格

+ 1 - 1
service/src/main/java/com/dayou/service/impl/HouseGuarantyTargetServiceImpl.java

@@ -13,6 +13,6 @@ public class HouseGuarantyTargetServiceImpl extends ServiceImpl<HouseGuarantyTar
     @Override
     public HouseGuarantyTarget getTarget(Long docId, String tId) {
         return this.getOne(new LambdaQueryWrapper<HouseGuarantyTarget>().eq(HouseGuarantyTarget::getDocId, docId)
-                .eq(HouseGuarantyTarget::getTId, tId));
+                .eq(HouseGuarantyTarget::getTid, tId));
     }
 }

+ 13 - 23
service/src/main/java/com/dayou/service/impl/HouseTargetEntityServiceImpl.java

@@ -3,20 +3,16 @@ package com.dayou.service.impl;
 import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.dayou.common.BaseEntity;
-import com.dayou.dto.HouseGuarantyTargetDTO;
+import com.dayou.entity.HouseGuarantyAim;
 import com.dayou.dto.HouseRightsDTO;
 import com.dayou.entity.*;
 import com.dayou.mapper.HouseTargetEntityMapper;
 import com.dayou.service.*;
-import com.dayou.utils.JsonUtil;
-import com.fasterxml.jackson.databind.util.BeanUtil;
 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 static com.dayou.enums.BusinessEnum.HouseSubBusiness.GUARANTY;
@@ -25,9 +21,6 @@ import static com.dayou.enums.BusinessEnum.HouseSubBusiness.GUARANTY;
 public class HouseTargetEntityServiceImpl extends ServiceImpl<HouseTargetEntityMapper, HouseTargetEntity> implements HouseTargetEntityService {
 
     @Autowired
-    private HouseGuarantyTargetService houseGuarantyTargetService;
-
-    @Autowired
     private HouseGuarantyService houseGuarantyService;
 
     @Autowired
@@ -41,6 +34,9 @@ public class HouseTargetEntityServiceImpl extends ServiceImpl<HouseTargetEntityM
 
     @Autowired
     private CertificateLandUseService landUseService;
+    @Autowired
+
+    private HouseGuarantyAimService houseGuarantyAimService;
 
     @Override
     public Long addHouseTargetEntity(HouseTargetEntity houseTargetEntity) {
@@ -61,36 +57,30 @@ public class HouseTargetEntityServiceImpl extends ServiceImpl<HouseTargetEntityM
     public Boolean copyHouseTargetEntity(Long id) {
         HouseTargetEntity originEntity = this.getById(id);
 
-        List<HouseGuarantyTarget> targets = houseGuarantyTargetService
-                .list(new LambdaQueryWrapper<HouseGuarantyTarget>()
-                        .eq(HouseGuarantyTarget::getDocId, originEntity.getBusinessId())
-                        .select(HouseGuarantyTarget::getBaseInfo,HouseGuarantyTarget::getTId));
+        List<HouseGuarantyAim> aims = houseGuarantyAimService.list(new LambdaQueryWrapper<HouseGuarantyAim>().eq(HouseGuarantyAim::getDocId, id));
 
         List<HouseTargetEntity> targetEntities = new ArrayList<>();
-        for (HouseGuarantyTarget target : targets) {
-            List<HouseGuarantyTargetDTO> targetDTOS = JSON.parseArray(target.getBaseInfo(), HouseGuarantyTargetDTO.class);
 
-            for (HouseGuarantyTargetDTO targetDTO : targetDTOS) {
-                if (targetDTO.getNo().equals(originEntity.getTno())
-                        && target.getTId().equals(originEntity.getTid())){
+        for (HouseGuarantyAim aim : aims) {
+                if (aim.getTno().equals(originEntity.getTno())
+                        && aim.getTid().equals(originEntity.getTid())){
                 }else {
                     HouseTargetEntity targetEntity = this.getOne(new LambdaQueryWrapper<HouseTargetEntity>()
                             .eq(HouseTargetEntity::getBusinessId, originEntity.getBusinessId())
-                            .eq(HouseTargetEntity::getTid, targetDTO.getId())
-                            .eq(HouseTargetEntity::getTno, targetDTO.getNo()));
+                            .eq(HouseTargetEntity::getTid, aim.getTid())
+                            .eq(HouseTargetEntity::getTno, aim.getTno()));
                     if (targetEntity == null){
                         targetEntity = new HouseTargetEntity();
                     }
                     BeanUtils.copyProperties(originEntity,targetEntity);
                     targetEntity.setId(null);
-                    targetEntity.setTid(target.getTId());
-                    targetEntity.setTno(targetDTO.getNo());
-                    targetEntity.setCertCombination(houseGuarantyService.getCertificateCombination(originEntity.getBusinessId(), targetDTO.getId(), targetDTO.getNo()));
+                    targetEntity.setTid(aim.getTid());
+                    targetEntity.setTno(aim.getTno());
+                    targetEntity.setCertCombination(houseGuarantyService.getCertificateCombination(originEntity.getBusinessId(), aim.getTid(), aim.getTno()));
                     targetEntities.add(targetEntity);
                 }
             }
 
-        }
         return this.saveOrUpdateBatch(targetEntities);
     }
 

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

@@ -5,6 +5,7 @@ import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.dayou.entity.CertificateLandUse;
+import com.dayou.entity.HouseGuarantyBase;
 import com.dayou.entity.HouseGuarantyTarget;
 import com.dayou.entity.TmplHouseParagraph;
 import com.dayou.mapper.TmplHouseParagraphMapper;
@@ -266,7 +267,7 @@ public class TmplHouseParagraphServiceImpl extends ServiceImpl<TmplHouseParagrap
     }
 
     @Override
-    public String findLimitConditionResult(List<HouseGuarantyTarget> targets, JSONObject jsonObject, List<String> certificates) {
+    public String findLimitConditionResult(List<HouseGuarantyTarget> targets, HouseGuarantyBase base, List<String> certificates) {
         List<TmplHouseParagraph> paragraphTemps = this.list(new LambdaQueryWrapper<TmplHouseParagraph>()
                 .eq(TmplHouseParagraph::getDocMold, GUARANTY).eq(TmplHouseParagraph::getChapter, LIMIT_CONDITION).orderByAsc(TmplHouseParagraph::getSort));
         StringBuilder result = new StringBuilder();
@@ -275,11 +276,15 @@ public class TmplHouseParagraphServiceImpl extends ServiceImpl<TmplHouseParagrap
             String rule = paragraph.getRule();
             if (StrUtil.isNotBlank(rule)){
                 if (IS_NOT_PLEDGE.getCode().equals(rule)){
-                    String notPledge = HouseDocumentUtil.isNotPledge(paragraph, (Boolean) jsonObject.get("是否设置抵押权"));
-                    if (StrUtil.isNotBlank(notPledge)){
-                        result.append(i).append(". ").append(notPledge);
-                        i++;
+                    //todo
+                    for (HouseGuarantyTarget target : targets){
+                        String notPledge = HouseDocumentUtil.isNotPledge(paragraph,target.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);
@@ -296,35 +301,37 @@ public class TmplHouseParagraphServiceImpl extends ServiceImpl<TmplHouseParagrap
                     }
                 }
                 if (IS_TRANSFER_NOT_DEDUCT_SELL_MONEY.getCode().equals(rule)){
-                    String transferOutDeductSellMoney = HouseDocumentUtil.isTransferNotDeductSellMoney(targets,paragraph, (String) jsonObject.get("划拨用地是否扣除出让金"));
+                    //todo
+                    String transferOutDeductSellMoney = HouseDocumentUtil.isTransferNotDeductSellMoney(targets,paragraph, "是");
                     if (StrUtil.isNotBlank(transferOutDeductSellMoney)){
                         result.append(i).append(". ").append(transferOutDeductSellMoney);
                         i++;
                     }
                 }
                 if (IS_TRANSFER_DEDUCT_SELL_MONEY.getCode().equals(rule)){
-                    String transferDeductSellMoney = HouseDocumentUtil.isTransferDeductSellMoney(targets,paragraph,(String) jsonObject.get("划拨用地是否扣除出让金"));
+                    //todo
+                    String transferDeductSellMoney = HouseDocumentUtil.isTransferDeductSellMoney(targets,paragraph,"是");
                     if (StrUtil.isNotBlank(transferDeductSellMoney)){
                         result.append(i).append(". ").append(transferDeductSellMoney);
                         i++;
                     }
                 }
                 if (IS_PROVIDE_TECH_REPORT.getCode().equals(rule)){
-                    String provideTechReport = HouseDocumentUtil.isProvideTechReport(targets,paragraph,(String) jsonObject.get("是否提供技术报告"));
+                    String provideTechReport = HouseDocumentUtil.isProvideTechReport(targets,paragraph,base.getHasTechReport());
                     if (StrUtil.isNotBlank(provideTechReport)){
                         result.append(i).append(". ").append(provideTechReport);
                         i++;
                     }
                 }
                 if (IS_NS_BANK.getCode().equals(rule)){
-                    String nsBank = HouseDocumentUtil.isNSBank(paragraph,(String) jsonObject.get("是否是农商银行"));
+                    String nsBank = HouseDocumentUtil.isNSBank(paragraph,base.getIsNsBank());
                     if (StrUtil.isNotBlank(nsBank)){
                         result.append(i).append(". ").append(nsBank);
                         i++;
                     }
                 }
                 if (IS_NORMAL_BANK.getCode().equals(rule)){
-                    String normalBank = HouseDocumentUtil.isNormalBank(paragraph,(String) jsonObject.get("是否是农商银行"));
+                    String normalBank = HouseDocumentUtil.isNormalBank(paragraph,base.getIsNsBank());
                     if (StrUtil.isNotBlank(normalBank)){
                         result.append(i).append(". ").append(normalBank);
                         i++;

+ 222 - 0
sql/update_sql.sql

@@ -703,3 +703,225 @@ ALTER TABLE assets_calculate_eqpt_nons_data ADD COLUMN material_1_price DECIMAL(
 ALTER TABLE assets_calculate_eqpt_nons_data ADD COLUMN material_2_price DECIMAL(11,2) NULL COMMENT '主材2单价(元/吨)';
 
 ALTER TABLE assets_calculate_eqpt_data ADD COLUMN usage_situation VARCHAR(100) NULL COMMENT '使用情况';
+
+
+/**
+  房地产抵押SQL汇总  完整表结构
+ */
+/*
+Navicat Premium Data Transfer
+
+Source Server         : mac-local
+Source Server Type    : MySQL
+Source Server Version : 80100 (8.1.0)
+Source Host           : localhost:3306
+Source Schema         : productivity-platform
+
+Target Server Type    : MySQL
+Target Server Version : 80100 (8.1.0)
+File Encoding         : 65001
+
+Date: 19/12/2024 17:46:07
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for house_guaranty_aim
+-- ----------------------------
+DROP TABLE IF EXISTS `house_guaranty_aim`;
+CREATE TABLE `house_guaranty_aim` (
+                                      `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id',
+                                      `doc_id` bigint DEFAULT NULL COMMENT '文档id',
+                                      `tid` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '估价对象番号',
+                                      `tno` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '估价标的物序号',
+                                      `certificate_no` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '权属证书号',
+                                      `own_ship_user` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '权利人',
+                                      `location` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '坐落',
+                                      `at_floor` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '所在楼层',
+                                      `structure` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '结构',
+                                      `use_to` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用途',
+                                      `outer_acreage` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '分摊或占用土地使用权面积(㎡)',
+                                      `acreage` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '建筑面积',
+                                      `price` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '单价',
+                                      `amount` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '总价',
+                                      `land_certificate_no` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '国有土地使用证号',
+                                      `land_type` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '地类(用途)',
+                                      `act_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '实勘地址',
+                                      `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+                                      `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+                                      `delete_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '删除状态',
+                                      `lng_lat` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '经纬度',
+                                      PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='房地产估价对象标的物';
+
+-- ----------------------------
+-- Table structure for house_guaranty_base
+-- ----------------------------
+DROP TABLE IF EXISTS `house_guaranty_base`;
+CREATE TABLE `house_guaranty_base` (
+                                       `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id',
+                                       `doc_id` bigint NOT NULL COMMENT '文档id',
+                                       `project_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '项目名称',
+                                       `consignor` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '委托人',
+                                       `doc_no` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '报告号',
+                                       `appraiser1` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '估价师1',
+                                       `appraiser2` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '估价师2',
+                                       `appra_no1` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '估价师1注册号',
+                                       `appra_no2` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '估价师2注册号',
+                                       `doc_date` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '出具报告日期',
+                                       `value_timing` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '价值时点',
+                                       `methods` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '评估方法',
+                                       `has_tech_report` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '是否提供技术报告',
+                                       `is_ns_bank` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '是否是农商银行项目',
+                                       `is_check_origin_certificate` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '是否审核权属原件',
+                                       `consignor_type` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '委托人类型',
+                                       `consignor_address` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '委托人住所',
+                                       `consignor_person` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '法定代表人',
+                                       `consignor_money` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '注册资本',
+                                       `credit_code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '统一社会信用代码',
+                                       `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+                                       `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+                                       `delete_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '删除状态',
+                                       PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='房地产抵押项目基本信息';
+
+-- ----------------------------
+-- Table structure for house_guaranty_process
+-- ----------------------------
+DROP TABLE IF EXISTS `house_guaranty_process`;
+CREATE TABLE `house_guaranty_process` (
+                                          `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id',
+                                          `parent_id` bigint DEFAULT NULL COMMENT '父级id',
+                                          `home` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'docHome',
+                                          `targets_html` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '估价结果一览表代码',
+                                          `process_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '过程节点',
+                                          `doc_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '过程文档路径',
+                                          `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+                                          `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+                                          `delete_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '删除状态',
+                                          PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=205 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='房地产抵押过程表';
+
+-- ----------------------------
+-- Table structure for house_guaranty_target
+-- ----------------------------
+DROP TABLE IF EXISTS `house_guaranty_target`;
+CREATE TABLE `house_guaranty_target` (
+                                         `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id',
+                                         `doc_id` bigint NOT NULL COMMENT '文档id',
+                                         `tid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '估价对象id',
+                                         `is_part` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '是否建筑物部分',
+                                         `has_building_year` bit(1) DEFAULT NULL COMMENT '是否登记建成年份',
+                                         `building_year` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '调查的建成年份',
+                                         `land_certificate_type` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '国有土地证类型',
+                                         `land_use_to` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '土地用途',
+                                         `land_expire_date` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '土地使用权终止日期',
+                                         `share_acreage1` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '土地无分户产权时分摊面积(㎡)',
+                                         `is_layer` bit(1) DEFAULT NULL COMMENT '是否采用分层面积处理方式',
+                                         `has_layer_image` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '分层面积处理方式是否有图',
+                                         `floor1_acreage` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '一层面积(㎡)',
+                                         `floor2_acreage` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '二层面积(㎡)',
+                                         `floor3_acreage` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '三层面积(㎡)',
+                                         `is_address_same` bit(1) DEFAULT NULL COMMENT '查勘地址与登记地址是否一致',
+                                         `is_date_time_same` bit(1) DEFAULT NULL COMMENT '查勘之日与价值时点是否一致',
+                                         `is_address_certificate` bit(1) DEFAULT NULL COMMENT '地址不一致时是否开具地址证明',
+                                         `is_building_reduce_value` bit(1) DEFAULT NULL COMMENT '是否考虑建筑物残值',
+                                         `has_origin_certificate` bit(1) DEFAULT NULL COMMENT '是否提供权属证件原件',
+                                         `is_promise` bit(1) DEFAULT NULL COMMENT '《权利状况说明及承诺书》承诺证件一致',
+                                         `has_land_use_right_contract` bit(1) DEFAULT NULL COMMENT '提供《国有建设用地使用权出让合同》',
+                                         `is_rent_out` bit(1) DEFAULT NULL COMMENT '估价对象是否已出租',
+                                         `has_rent_out_contract` bit(1) DEFAULT NULL COMMENT '是否提供租赁合同',
+                                         `is_rent_limit` bit(1) DEFAULT NULL COMMENT '是否考虑租约限制',
+                                         `not_rent_limit_reason` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '未考虑租约限制原因',
+                                         `rent_limit_reason` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '考虑租约限制原因',
+                                         `rent_end_date` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '租约结束日期',
+                                         `rent_start_date` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '租约起始日期',
+                                         `rent_money` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '价值时点租金',
+                                         `rent_user` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '承租人',
+                                         `has_pledge` bit(1) DEFAULT NULL COMMENT '是否设置抵押权',
+                                         `pledge_user` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '抵押权人',
+                                         `pledge_type` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '抵押权类型',
+                                         `pledge_value` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '抵押权利价值',
+                                         `same_pledge_continue` bit(1) DEFAULT NULL COMMENT '同一抵押权人续贷',
+                                         `new_pledge_user` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '新抵押权利人',
+                                         `high_pledge_not_expire` bit(1) DEFAULT NULL COMMENT '已设立最高额抵押权且抵押未到期',
+                                         `same_pledge_high` bit(1) DEFAULT NULL COMMENT '现拟设立最高额抵押权同一抵押权人',
+                                         `first_money` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '其他法定优先受偿款(万元)',
+                                         `debt_money` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '拖欠工程款(万元)',
+                                         `is_take_out_first_money` bit(1) DEFAULT NULL COMMENT '是否扣除法定优先受偿款',
+                                         `is_costing_share_method` bit(1) DEFAULT NULL COMMENT '采用成本法且分摊土地面积处理',
+                                         `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+                                         `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+                                         `delete_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '删除状态',
+                                         `no_building_house_nos` bit(1) DEFAULT NULL COMMENT '未见栋号房号',
+                                         `explore_date` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '查勘日期',
+                                         `land_year_lower_house_year` bit(1) DEFAULT NULL COMMENT '土地剩余使用年限短于建筑物剩余经济寿命',
+                                         `is_promise_file` bit(1) DEFAULT NULL COMMENT '《承诺书》承诺相关的法律文件复印件与原件一致',
+                                         `is_in_cheng_du` bit(1) DEFAULT NULL COMMENT '估价对象是否属于大成都范围内',
+                                         `house_get_land_info` bit(1) DEFAULT NULL COMMENT '住宅获取土地信息',
+                                         `land_use_type` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '土地使用权类型',
+                                         `has_land_use_right` bit(1) DEFAULT NULL COMMENT '地役权',
+                                         `has_living_right` bit(1) DEFAULT NULL COMMENT '居住权',
+                                         `land_use_right_from` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '供地役权人',
+                                         `land_use_right_to` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '需地役权人',
+                                         PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='解析后的估价对象和补充信息';
+
+-- ----------------------------
+-- Table structure for house_target_entity
+-- ----------------------------
+DROP TABLE IF EXISTS `house_target_entity`;
+CREATE TABLE `house_target_entity` (
+                                       `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id',
+                                       `business_id` bigint NOT NULL COMMENT '业务id',
+                                       `tid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '估价对象id',
+                                       `tno` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '估价对象序号',
+                                       `house_age` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '建成年代',
+                                       `use_info` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '使用状况',
+                                       `use_to` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用途',
+                                       `building_out` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '外墙装饰',
+                                       `at_floor` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '所在楼层',
+                                       `floor` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '总楼层',
+                                       `elevator` int DEFAULT NULL COMMENT '载人电梯数',
+                                       `center_air_conditioning` bit(1) DEFAULT NULL COMMENT '中央空调',
+                                       `auto_spray` bit(1) DEFAULT NULL COMMENT '自动喷淋',
+                                       `smog_emergency` bit(1) DEFAULT NULL COMMENT '烟雾报警',
+                                       `fire_hydrant` bit(1) DEFAULT NULL COMMENT '消防栓',
+                                       `net_line` bit(1) DEFAULT NULL COMMENT '网络光纤',
+                                       `visual_sys` bit(1) DEFAULT NULL COMMENT '可视化对讲系统',
+                                       `building_structure` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '建筑结构',
+                                       `office_smart_sys` bit(1) DEFAULT NULL COMMENT '智慧办公系统',
+                                       `base_facility` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '基本设施',
+                                       `room_type` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '户型',
+                                       `room_high` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '层高',
+                                       `new_percentage` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '成新率',
+                                       `livingroom_ground` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '客厅地面',
+                                       `livingroom_top` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '客厅吊顶',
+                                       `livingroom_wall` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '客厅内墙',
+                                       `livingroom_other` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '客厅其他部分',
+                                       `bedroom_ground` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '卧室地面',
+                                       `bedroom_top` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '卧室吊顶',
+                                       `bedroom_wall` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '卧室内墙',
+                                       `bedroom_other` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '卧室其他部分',
+                                       `bathroom_ground` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '厨卫地面',
+                                       `bathroom_top` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '厨卫吊顶',
+                                       `bathroom_wall` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '厨卫内墙',
+                                       `bathroom_other` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '厨卫其他部分',
+                                       `land_deep` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '土地开发程度',
+                                       `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+                                       `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+                                       `delete_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '删除状态',
+                                       `community_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '小区名称',
+                                       `building_no` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '栋号',
+                                       `cert_combination` int DEFAULT NULL COMMENT '证件组合类型',
+                                       `east_way` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '东至',
+                                       `west_way` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '西至',
+                                       `south_way` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '南至',
+                                       `north_way` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '北至',
+                                       PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='房地产估价对象实物信息';
+
+SET FOREIGN_KEY_CHECKS = 1;
+