Browse Source

页面优化

wucl 8 months ago
parent
commit
7e29660da7

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

@@ -44,7 +44,7 @@ public class HouseGuarantyDocController {
      * @return
      */
     @GetMapping("/collect1/{id}")
-    public Result<Boolean> analysisCollect1(@PathVariable("id") Long id){
+    public Result<Boolean> analysisCollect1(@PathVariable("id") Long id) throws Exception {
         return Result.build(houseGuarantyService.analysisCollect1(id));
     }
 
@@ -54,7 +54,7 @@ public class HouseGuarantyDocController {
      * @return
      */
     @GetMapping("/consignor/{id}")
-    public Result<String> genConsignorLetter(@PathVariable("id") Long id){
+    public Result<Long> genConsignorLetter(@PathVariable("id") Long id){
         return Result.build(houseGuarantyService.genConsignorLetter(id));
     }
 

+ 10 - 0
common/src/main/java/com/dayou/constants/HouseGuarantyDoc.java

@@ -21,6 +21,11 @@ public class HouseGuarantyDoc {
     public static final String TARGETS_JSON = "target.json";
 
     /**
+     * 基本信息json文件
+     */
+    public static final String BASE_INFO_JSON = "baseInfo.json";
+
+    /**
      * 估价结果一览表sheet中文名
      */
     public static final String TARGETS_TABLE_ZH = "估价结果一览表";
@@ -56,6 +61,11 @@ public class HouseGuarantyDoc {
     public static final String NO = "否";
 
     /**
+     * NULL
+     */
+    public static final String NULL = "null";
+
+    /**
      * 酒店部分
      */
     public static final String HOTEL_PART = "酒店部分";

+ 49 - 4
common/src/main/java/com/dayou/utils/HouseDocumentUtil.java

@@ -1,16 +1,14 @@
 package com.dayou.utils;
 
 import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONArray;
-import cn.hutool.json.JSONNull;
-import cn.hutool.json.JSONObject;
-import cn.hutool.json.JSONUtil;
+import cn.hutool.json.*;
 import com.alibaba.fastjson2.JSON;
 import com.dayou.dto.Address;
 import com.dayou.dto.HouseGuarantyTargetDTO;
 import com.dayou.entity.HouseGuarantyTarget;
 import com.dayou.entity.TmplHouseParagraph;
 import com.dayou.enums.HouseTargetTableColumn;
+import com.dayou.exception.BusinessException;
 import com.dayou.exception.ErrorCode;
 
 import java.lang.reflect.Field;
@@ -58,6 +56,36 @@ public class HouseDocumentUtil {
         return targets;
     }
 
+    /**
+     * 格式化原始基本信息json数据
+     * @param baseInfoArray
+     * @return
+     */
+    public static JSONObject baseInfoFormat(JSONArray baseInfoArray) {
+        JSONObject baseInfo = new JSONObject();
+        if (baseInfoArray.size()>1){
+            baseInfo  = (JSONObject) baseInfoArray.get(0);
+            try {
+                for (int i = 1; i < baseInfoArray.size(); i+=2){
+                    JSONObject keys  = (JSONObject) baseInfoArray.get(i);
+                    JSONObject values  = (JSONObject) baseInfoArray.get(i+1);
+                    Set<String> cols = keys.keySet();
+                    for (String key : cols){
+                        Object k = keys.get(key);
+                        if (k!=null && !(k instanceof JSONNull) ){
+                            Object v = values.get(key);
+                            baseInfo.put((String) k, v);
+                        }
+                    }
+                }
+            } catch (IndexOutOfBoundsException e) {
+               ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"Excel表单中基本信息缺失");
+            }
+
+        }
+        return baseInfo;
+    }
+
 
     public static List<HouseGuarantyTargetDTO> houseTargetsFormatDTO(JSONArray jsonArray) throws IllegalAccessException {
         List<HouseGuarantyTargetDTO> dtoList = new ArrayList<>();
@@ -963,6 +991,21 @@ public class HouseDocumentUtil {
     }
 
     /**
+     * 限制条件 是否提供不动产权证
+     * @param targets
+     * @param tmplParagraph
+     * @return
+     */
+    public static String isHasImmovableCertificate(List<HouseGuarantyTarget> targets, TmplHouseParagraph tmplParagraph, String hasImmovableCertificate) {
+        String paragraph = tmplParagraph.getParagraph();
+        if (StrUtil.isNotBlank(hasImmovableCertificate)){
+            paragraph = paragraph.replace("{immovable1}","、“不动产登记薄”");
+        }
+        return paragraph.replace("{immovable}", hasImmovableCertificate);
+
+    }
+
+    /**
      * 限制条件 适用于原抵押权未注销,现拟设立最高额抵押权,同一抵押权人
      * @param targets
      * @param tmplParagraph
@@ -1265,4 +1308,6 @@ public class HouseDocumentUtil {
         }
         return null;
     }
+
+
 }

+ 12 - 0
common/src/main/java/com/dayou/utils/JsonUtil.java

@@ -58,6 +58,18 @@ public class JsonUtil {
     }
 
     /**
+     * 将JSONOBJECT数据输出到文件
+     * @param jsonObject
+     * @param filePath
+     * @throws IOException
+     */
+    public static void jsonObject2File(JSONObject jsonObject, String filePath) throws IOException {
+        FileOutputStream fos = new FileOutputStream(filePath);
+        fos.write(jsonObject.toString().getBytes());
+        fos.close();
+    }
+
+    /**
      * JSONArray 根据key聚合value
      * @param array
      * @param key

+ 4 - 3
domain/src/main/java/com/dayou/enums/BusinessEnum.java

@@ -62,9 +62,9 @@ public enum BusinessEnum implements CodeMsgEnumInterface<String,String>{
 
     public enum HouseGuarantyProcess implements CodeMsgEnumInterface<String,String>{
 
-        CONSIGNOR_LETTER("CONSIGNOR_LETTER","致委托人函","consignor"),
+        CONSIGNOR_LETTER("CONSIGNOR_LETTER","致委托人函","consignor"),
 
-        STATEMENT_CONDITIONS_EXPLAIN("STATEMENT_CONDITIONS_EXPLAIN","假设限制条件及使用说明","conditions"),
+        STATEMENT_CONDITIONS_EXPLAIN("STATEMENT_CONDITIONS_EXPLAIN","假设限制条件及使用报告说明","conditions"),
 
 
 
@@ -174,7 +174,8 @@ public enum BusinessEnum implements CodeMsgEnumInterface<String,String>{
         IS_NOT_RENT_OUT("IS_NOT_RENT_OUT","估价对象未出租"),
         IS_RENT_OUT_NOT_AFFECT_HIGH("IS_RENT_OUT_NOT_AFFECT_HIGH","已出租,未考虑租约影响:高于市场租金"),
         IS_RENT_OUT_NOT_AFFECT_NORMAL("IS_RENT_OUT_NOT_AFFECT_NORMAL","已出租,未考虑租约影响:与市场租金相当"),
-        IS_RENT_OUT_AFFECT_LOW("IS_RENT_OUT_AFFECT_LOW","已出租,考虑租约影响:低于市场租金")
+        IS_RENT_OUT_AFFECT_LOW("IS_RENT_OUT_AFFECT_LOW","已出租,考虑租约影响:低于市场租金"),
+        IS_HAS_IMMOVABLE_CERTIFICATE("IS_HAS_IMMOVABLE_CERTIFICATE","是否提供不动产权证")
 
 
 

+ 2 - 2
service/src/main/java/com/dayou/service/HouseGuarantyService.java

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

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

@@ -42,7 +42,7 @@ public interface TmplHouseParagraphService extends IService<TmplHouseParagraph>
      * @param targets
      * @return
      */
-    String findLimitConditionResult(List<HouseGuarantyTarget> targets,Boolean isDeductSellAmount,Boolean hasTechReport,Boolean isNsBank);
+    String findLimitConditionResult(List<HouseGuarantyTarget> targets,Boolean isDeductSellAmount,Boolean hasTechReport,Boolean isNsBank,String hasImmovableCertificate);
 
     /**
      * 生成使用报告说明

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

@@ -43,7 +43,7 @@ public class HouseGuarantyProcessServiceImpl extends ServiceImpl<HouseGuarantyPr
             HouseGuarantyProcess parent = this.getOne(new LambdaQueryWrapper<HouseGuarantyProcess>().eq(BaseEntity::getId, id).select(HouseGuarantyProcess::getHome));
             Map<String, List<HouseGuarantyProcess>> collect = this.list(new LambdaQueryWrapper<HouseGuarantyProcess>().select(BaseEntity::getId, HouseGuarantyProcess::getHome,
                             BaseEntity::getUpdateTime, HouseGuarantyProcess::getProcessName,HouseGuarantyProcess::getDocUrl)
-                    .eq(HouseGuarantyProcess::getHome, parent.getHome())).stream().collect(Collectors.groupingBy(HouseGuarantyProcess::getProcessName));
+                    .eq(HouseGuarantyProcess::getHome, parent.getHome()).orderByDesc(BaseEntity::getCreateTime)).stream().collect(Collectors.groupingBy(HouseGuarantyProcess::getProcessName));
             List<ProcessVO> list = aProcesses.stream().map(x -> {
                 ProcessVO processVO = new ProcessVO();
                 processVO.setName(x.getMsg());

+ 18 - 15
service/src/main/java/com/dayou/service/impl/HouseGuarantyServiceImpl.java

@@ -47,6 +47,7 @@ import java.util.stream.Collectors;
 
 import static com.dayou.constants.HouseGuarantyDoc.*;
 import static com.dayou.enums.BusinessEnum.HouseGuarantyChapter.ORDINARY_ASSUMPTION;
+import static com.dayou.enums.BusinessEnum.HouseGuarantyProcess.STATEMENT_CONDITIONS_EXPLAIN;
 import static com.dayou.enums.BusinessEnum.HouseSubBusiness.GUARANTY;
 import static com.dayou.enums.HouseTargetTableColumn.ID;
 import static java.lang.Thread.sleep;
@@ -93,7 +94,7 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
     }
 
     @Override
-    public Boolean analysisCollect1(Long id) {
+    public Boolean analysisCollect1(Long id) throws Exception {
         try {
             sleep(1000);
         } catch (InterruptedException e) {
@@ -101,23 +102,23 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
         }
         HouseGuarantyProcess process = houseGuarantyProcessService.getById(id);
         String home = fileNetConfig.getBaseDir() + process.getHome();
-        try {
             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);
-            //解析估价对象json
             JSONArray xArray = HouseDocumentUtil.houseTargetsFormat(array);
-            //纯估价对象
             JsonUtil.jsonArray2File(xArray,home + TARGETS_JSON);
-            return Boolean.TRUE;
-        } catch (Exception e) {
-            ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"Json文件读取错误");
-            return Boolean.FALSE;
-        }
+
+            //解析估价对象json(基本信息)
+            JSONArray baseInfoArray = JsonUtil.file2JsonArray(home + COLLECT1_JSON, BASE_INFO_ZH);
+            JSONObject baseInfo = HouseDocumentUtil.baseInfoFormat(baseInfoArray);
+            JsonUtil.jsonObject2File(baseInfo,home + BASE_INFO_JSON);
+        return Boolean.TRUE;
+
     }
 
     @Override
-    public String genConsignorLetter(Long id) {
+    public Long genConsignorLetter(Long id) {
         try {
             sleep(1000);
         } catch (InterruptedException e) {
@@ -178,8 +179,9 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
             //更新过程文档url
             houseGuarantyProcessService.update(new LambdaUpdateWrapper<HouseGuarantyProcess>().set(HouseGuarantyProcess::getDocUrl, consignorLetterName)
                     .eq(BaseEntity::getId,id));
-            documentProductionService.save(buildDocumentProduction(id,projectName,docNo,consignor));
-            return consignorLetterName;
+            DocumentProduction dp = buildDocumentProduction(id, projectName, docNo, consignor);
+            documentProductionService.save(dp);
+            return dp.getId();
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
@@ -205,7 +207,7 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
             }
             return houseTargetVOList;
         } catch (Exception e) {
-            ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"Json文件读取错误");
+            ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"文件读取错误");
         }
         return Collections.emptyList();
     }
@@ -256,7 +258,8 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
             String limitCondition = tmplHouseParagraphService.findLimitConditionResult(targets
                         ,HouseDocumentUtil.checkBoolean(valueMap.get("isDeductSellAmount"))
                     ,HouseDocumentUtil.checkBoolean(valueMap.get("hasTechReport"))
-                    ,HouseDocumentUtil.checkBoolean(valueMap.get("isNsBank")));
+                    ,HouseDocumentUtil.checkBoolean(valueMap.get("isNsBank"))
+                            ,hasImmovableCertificate);
 
             conditionDO.setXZTJ(limitCondition);
 
@@ -281,7 +284,7 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
             fos.close();
             //更新过程文档url
             HouseGuarantyProcess houseGuarantyProcess = new HouseGuarantyProcess();
-            houseGuarantyProcess.setProcessName("《估价的假设和限制条件及使用报告说明》");
+            houseGuarantyProcess.setProcessName(STATEMENT_CONDITIONS_EXPLAIN.getMsg());
             houseGuarantyProcess.setDocUrl(conditionLetterName);
             houseGuarantyProcess.setHome(process.getHome());
             houseGuarantyProcess.setParentId(process.getId());

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

@@ -251,7 +251,7 @@ public class TmplHouseParagraphServiceImpl extends ServiceImpl<TmplHouseParagrap
     }
 
     @Override
-    public String findLimitConditionResult(List<HouseGuarantyTarget> targets,Boolean isDeductSellAmount,Boolean hasTechReport,Boolean isNsBank) {
+    public String findLimitConditionResult(List<HouseGuarantyTarget> targets,Boolean isDeductSellAmount,Boolean hasTechReport,Boolean isNsBank,String hasImmovableCertificate) {
         List<TmplHouseParagraph> paragraphTemps = this.list(new LambdaQueryWrapper<TmplHouseParagraph>()
                 .eq(TmplHouseParagraph::getDocMold, GUARANTY).eq(TmplHouseParagraph::getChapter, LIMIT_CONDITION).orderByAsc(TmplHouseParagraph::getSort));
         StringBuilder result = new StringBuilder();
@@ -315,6 +315,13 @@ public class TmplHouseParagraphServiceImpl extends ServiceImpl<TmplHouseParagrap
                         i++;
                     }
                 }
+                if (IS_HAS_IMMOVABLE_CERTIFICATE.getCode().equals(rule)){
+                    String hasImmovableCertificate1 = HouseDocumentUtil.isHasImmovableCertificate(targets,paragraph,hasImmovableCertificate);
+                    if (StrUtil.isNotBlank(hasImmovableCertificate1)){
+                        result.append(i).append(". ").append(hasImmovableCertificate1);
+                        i++;
+                    }
+                }
             }else{
                 result.append(i).append(". ");
                 result.append(paragraph.getParagraph());