Browse Source

房地产报告生成优化

wucl 3 days ago
parent
commit
362c71faf8

+ 3 - 3
biz-base/src/main/resources/application-local.yaml

@@ -66,9 +66,9 @@ oa-api-url: localhost:8088/api/
 
 file-net:
   # 基础配置
-  base-dir: E:\productivity-platform-files\
+  base-dir: /Users/wuwei/opt/temp/
   max-file-size: 102400
-  domain: http://doc.scdayou.com/dfs/productivity-platform
+  domain: http://127.0.0.1:8080/pp/dfs
   # 图片
   image: /images/
   # 资产业务配置
@@ -79,7 +79,7 @@ file-net:
   house-guaranty-path: house/guaranty
   house-guaranty-template-path: house/guaranty/temp/
 
-posyspath:  D:\pageoffice
+posyspath:  /Users/wuwei/pageoffice
 
 
 map:

+ 5 - 1
biz-base/src/main/resources/application-prod.yaml

@@ -79,4 +79,8 @@ file-net:
   house-guaranty-path: house/guaranty
   house-guaranty-template-path: house/guaranty/temp/
 
-posyspath:  /root/pageoffice
+posyspath:  /root/pageoffice
+
+map:
+  url:  https://restapi.amap.com/v3/geocode/geo
+  key:  19c4734ab21efe7e377bf9065c47d9b2

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

@@ -2,8 +2,8 @@ package com.dayou;
 
 
 import cn.hutool.json.JSONArray;
-import cn.hutool.json.JSONObject;
 import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
 import com.aspose.cells.*;
 import com.aspose.words.CompositeNode;
 import com.aspose.words.Document;
@@ -28,6 +28,15 @@ import static com.dayou.enums.HouseTargetTableColumn.TID;
 @SpringBootTest
 public class FreeMarkTest {
 
+    public static void main(String[] args) {
+        Map<String,String> params = new HashMap<>();
+        params.put("address","南充市相如镇蓬洲路三段39号(枫丹白露小区)2幢1单元1楼4号");
+        params.put("key","19c4734ab21efe7e377bf9065c47d9b2");
+        String ret = HttpKit.sendGet("https://restapi.amap.com/v3/geocode/geo", params);
+        JSONObject jsonObject = JSON.parseObject(ret);
+        System.out.println(jsonObject.toString());
+    }
+
 
 
 

+ 5 - 4
common/src/main/java/com/dayou/utils/EasyExcelUtil.java

@@ -118,6 +118,7 @@ public class EasyExcelUtil {
         nameMap.put("四、用益物权状况","remInfo");
         nameMap.put("四、租赁或占用状况","rentInfo");
         nameMap.put("五、价值时点2","valueTimingInfo");
+        nameMap.put("六、(一)价值类型","valueCategory");
         nameMap.put("六、(二)价值内涵1","valueMeaning1");
         nameMap.put("六、(二)价值内涵2","valueMeaning2");
         nameMap.put("六、(二)价值内涵3","valueMeaning3");
@@ -561,23 +562,23 @@ public class EasyExcelUtil {
             cellKey = rowKey.getCell(colNum);
             cellValue = rowValue.getCell(colNum);
             if (cellKey != null && StrUtil.isNotBlank(cellKey.toString())) {
-                String attr = nameMap.get(cellKey.getStringCellValue());
+                String attr = nameMap.get(cellKey.getStringCellValue().trim());
                 String value = "";
                 if (cellValue == null) {
                     valueMap.put(attr, value);
                 }else {
                     switch (cellValue.getCellType()) {
                         case STRING:
-                            value = cellValue.getStringCellValue();
+                            value = cellValue.getStringCellValue().trim();
                             break;
                         case FORMULA: // 处理公式计算后的值,而非公式本身
                             cellValue.setCellFormula(null);
                             evaluator.evaluateFormulaCell(cellValue);
                             if (cellValue.getCellType().equals(NUMERIC)){
                                 DecimalFormat df = new DecimalFormat("0");
-                                value = df.format(cellValue.getNumericCellValue());
+                                value = df.format(cellValue.getNumericCellValue()).trim();
                             }else{
-                                value = cellValue.getStringCellValue();
+                                value = cellValue.getStringCellValue().trim();
                             }
 
                             break;

+ 4 - 2
dao/src/main/resources/mapper/HouseExcelDataMapper.xml

@@ -73,7 +73,7 @@
             work_purpose,
             target_scope,
             building_info,
-            trim(land_info),
+            trim(land_info) as landInfo,
             guaranty_info,
             rem_info,
             rent_info,
@@ -103,7 +103,9 @@
             pledge_value,
             debt_money,
             first_money,
-            total_money
+            total_money,
+            value_category,
+            doc_date
         FROM
             house_excel_data
         WHERE

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

@@ -65,4 +65,9 @@ public class BaseInfoDO {
 
     private String excelUri;
 
+    /**
+     * 附件列表
+     */
+    private String affixs;
+
 }

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

@@ -183,4 +183,8 @@ public class GuarantyResultDO {
 
     private String excelUri;
 
+    private String valueCategory;
+
+    private String docDate;
+
 }

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

@@ -372,6 +372,11 @@ public class HouseExcelData extends BaseEntity {
      *价值时点描述
      */
     private String valueTimingInfo;
+
+    /**
+     * 价值类型描述
+     */
+    private String valueCategory;
     /**
      *价值内涵1
      */

+ 119 - 52
service/src/main/java/com/dayou/service/impl/HouseExcelDataServiceImpl.java

@@ -2,6 +2,7 @@ package com.dayou.service.impl;
 
 import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.dayou.common.BaseEntity;
@@ -13,6 +14,7 @@ import com.dayou.entity.CertificateFixedAssets;
 import com.dayou.entity.HouseExcelData;
 import com.dayou.entity.HouseGuarantyArea;
 import com.dayou.enums.BusinessEnum;
+import com.dayou.exception.ErrorCode;
 import com.dayou.mapper.HouseExcelDataMapper;
 import com.dayou.mapper.HouseGuarantyAreaMapper;
 import com.dayou.service.CertificateFixedAssetsService;
@@ -69,7 +71,45 @@ public class HouseExcelDataServiceImpl extends ServiceImpl<HouseExcelDataMapper,
     @Override
     public BaseInfoDO getBaseDO(Long excelId) {
         HouseExcelData base = getBase(excelId);
-        return BeanUtil.copyProperties(base, BaseInfoDO.class);
+        //动态附件列表
+        StringBuffer affixs = new StringBuffer();
+        int index = 1;
+        if (StrUtil.isNotBlank(base.getAffix1())){
+            affixs.append(index+". "+base.getAffix1()).append("\n");
+            index++;
+        }
+        if (StrUtil.isNotBlank(base.getAffix2())){
+            affixs.append(index+". "+base.getAffix2()).append("\n");
+            index++;
+        }
+        if (StrUtil.isNotBlank(base.getAffix3())){
+            affixs.append(index+". "+base.getAffix3()).append("\n");
+            index++;
+        }
+        if (StrUtil.isNotBlank(base.getAffix4())){
+            affixs.append(index+". "+base.getAffix4()).append("\n");
+            index++;
+        }
+        if (StrUtil.isNotBlank(base.getAffix5())){
+            affixs.append(index+". "+base.getAffix5()).append("\n");
+            index++;
+        }
+        if (StrUtil.isNotBlank(base.getAffix6())){
+            affixs.append(index+". "+base.getAffix6()).append("\n");
+            index++;
+        }
+        if (StrUtil.isNotBlank(base.getAffix7())){
+            affixs.append(index+". "+base.getAffix7()).append("\n");
+            index++;
+        }
+        if (StrUtil.isNotBlank(base.getAffix8())){
+            affixs.append(index+". "+base.getAffix8()).append("\n");
+            index++;
+        }
+        BaseInfoDO baseInfoDO = BeanUtil.copyProperties(base, BaseInfoDO.class);
+        baseInfoDO.setAffixs(affixs.toString());
+        return baseInfoDO;
+
     }
 
     @Override
@@ -78,68 +118,75 @@ public class HouseExcelDataServiceImpl extends ServiceImpl<HouseExcelDataMapper,
         ConditionDO condition = BeanUtil.copyProperties(hed, ConditionDO.class);
         //一般假设
         StringBuffer normalAssumptions = new StringBuffer();
-        normalAssumptions.append(hed.getNormalAssumption1()).append("\n")
-                .append(hed.getNormalAssumption2()).append("\n")
-                .append(hed.getNormalAssumption3()).append("\n")
-                .append(hed.getNormalAssumption4()).append("\n")
-                .append(hed.getNormalAssumption5()).append("\n")
-                .append(hed.getNormalAssumption6()).append("\n")
-                .append(hed.getNormalAssumption7()).append("\n")
-                .append(hed.getNormalAssumption8()).append("\n")
-                .append(hed.getNormalAssumption9()).append("\n")
-                .append(hed.getNormalAssumption10());
+        normalAssumptions
+                .append(strNull(hed.getNormalAssumption1(),false))
+                .append(strNull(hed.getNormalAssumption2(),false))
+                .append(strNull(hed.getNormalAssumption3(),false))
+                .append(strNull(hed.getNormalAssumption4(),false))
+                .append(strNull(hed.getNormalAssumption5(),false))
+                .append(strNull(hed.getNormalAssumption6(),false))
+                .append(strNull(hed.getNormalAssumption7(),false))
+                .append(strNull(hed.getNormalAssumption8(),false))
+                .append(strNull(hed.getNormalAssumption9(),false))
+                .append(strNull(hed.getNormalAssumption10(),true));
         condition.setYBJS(normalAssumptions.toString());
         //未定事项假设
         StringBuffer undefinedAssumptions = new StringBuffer();
-        undefinedAssumptions.append(hed.getUndefinedAssumption1()).append("\n")
-                .append(hed.getUndefinedAssumption2()).append("\n")
-                .append(hed.getUndefinedAssumption3()).append("\n")
-                .append(hed.getUndefinedAssumption4()).append("\n")
-                .append(hed.getUndefinedAssumption5()).append("\n")
-                .append(hed.getUndefinedAssumption6());
+        undefinedAssumptions
+                .append(strNull(hed.getUndefinedAssumption1(),false))
+                .append(strNull(hed.getUndefinedAssumption2(),false))
+                .append(strNull(hed.getUndefinedAssumption3(),false))
+                .append(strNull(hed.getUndefinedAssumption4(),false))
+                .append(strNull(hed.getUndefinedAssumption5(),false))
+                .append(strNull(hed.getUndefinedAssumption6(),true));
         condition.setWDSXJS(undefinedAssumptions.toString());
         //不相一致假设
         StringBuffer differentAssumptions = new StringBuffer();
-        differentAssumptions.append(hed.getDifferentAssumption1()).append("\n")
-                .append(hed.getDifferentAssumption2());
+        differentAssumptions
+                .append(strNull(hed.getDifferentAssumption1(),false))
+                .append(strNull(hed.getDifferentAssumption2(),true));
         condition.setBXYZJS(differentAssumptions.toString());
         //依据不足假设
         StringBuffer deficiencyAssumptions = new StringBuffer();
-        deficiencyAssumptions.append(hed.getDeficiencyAssumption1()).append("\n")
-                .append(hed.getDeficiencyAssumption2()).append("\n")
-                .append(hed.getDeficiencyAssumption3()).append("\n")
-                .append(hed.getDeficiencyAssumption4()).append("\n")
-                .append(hed.getDeficiencyAssumption5());
+        deficiencyAssumptions
+                .append(strNull(hed.getDeficiencyAssumption1(),false))
+                .append(strNull(hed.getDeficiencyAssumption2(),false))
+                .append(strNull(hed.getDeficiencyAssumption3(),false))
+                .append(strNull(hed.getDeficiencyAssumption4(),false))
+                .append(strNull(hed.getDeficiencyAssumption5(),true));
         condition.setYJBZJS(deficiencyAssumptions.toString());
         //限制条件
         StringBuffer limitConditions = new StringBuffer();
-        limitConditions.append(hed.getLimitCondition1()).append("\n")
-                .append(hed.getLimitCondition2()).append("\n")
-                .append(hed.getLimitCondition3()).append("\n")
-                .append(hed.getLimitCondition4()).append("\n")
-                .append(hed.getLimitCondition5()).append("\n")
-                .append(hed.getLimitCondition6()).append("\n")
-                .append(hed.getLimitCondition7()).append("\n")
-                .append(hed.getLimitCondition8());
+        limitConditions
+                .append(strNull(hed.getLimitCondition1(),false))
+                .append(strNull(hed.getLimitCondition2(),false))
+                .append(strNull(hed.getLimitCondition3(),false))
+                .append(strNull(hed.getLimitCondition4(),false))
+                .append(strNull(hed.getLimitCondition5(),false))
+                .append(strNull(hed.getLimitCondition6(),false))
+                .append(strNull(hed.getLimitCondition7(),false))
+                .append(strNull(hed.getLimitCondition8(),true));
         condition.setXZTJ(limitConditions.toString());
         //使用本报告的一般说明
         StringBuffer normalExplain = new StringBuffer();
-        normalExplain.append(hed.getNormalExplain1()).append("\n")
-                .append(hed.getNormalExplain2()).append("\n")
-                .append(hed.getNormalExplain3()).append("\n")
-                .append(hed.getNormalExplain4()).append("\n")
-                .append(hed.getNormalExplain5()).append("\n")
-                .append(hed.getNormalExplain6()).append("\n")
-                .append(hed.getNormalExplain7()).append("\n")
-                .append(hed.getNormalExplain8()).append("\n")
-                .append(hed.getNormalExplain9());
+        normalExplain
+                .append(strNull(hed.getNormalExplain1(),false))
+                .append(strNull(hed.getNormalExplain2(),false))
+                .append(strNull(hed.getNormalExplain3(),false))
+                .append(strNull(hed.getNormalExplain4(),false))
+                .append(strNull(hed.getNormalExplain5(),false))
+                .append(strNull(hed.getNormalExplain6(),false))
+                .append(strNull(hed.getNormalExplain7(),false))
+                .append(strNull(hed.getNormalExplain8(),false))
+                .append(strNull(hed.getNormalExplain9(),true));
         condition.setSYBGSM(normalExplain.toString());
         //估价中的特殊处理事项
         StringBuffer expeHandle = new StringBuffer();
-        expeHandle.append(hed.getExpeHandle1()).append("\n")
-                .append(hed.getExpeHandle2()).append("\n")
-                .append(hed.getExpeHandle3()).append("\n")
-                .append(hed.getExpeHandle4());
+        expeHandle
+                .append(strNull(hed.getExpeHandle1(),false))
+                .append(strNull(hed.getExpeHandle2(),false))
+                .append(strNull(hed.getExpeHandle3(),false))
+                .append(strNull(hed.getExpeHandle4(),true));
         condition.setTSSXCL(expeHandle.toString());
         return condition;
     }
@@ -149,10 +196,11 @@ public class HouseExcelDataServiceImpl extends ServiceImpl<HouseExcelDataMapper,
         HouseExcelData hed = houseExcelDataMapper.getResultReport(businessId);
         GuarantyResultDO guarantyResultDO = BeanUtil.copyProperties(hed, GuarantyResultDO.class);
         StringBuffer valueMeanings = new StringBuffer();
-        valueMeanings.append(hed.getValueMeaning1()).append("\n")
-                .append(hed.getValueMeaning2()).append("\n")
-                .append(hed.getValueMeaning3()).append("\n")
-                .append(hed.getValueMeaning4());
+        valueMeanings
+                .append(strNull(hed.getValueMeaning1(),false))
+                .append(strNull(hed.getValueMeaning2(),false))
+                .append(strNull(hed.getValueMeaning3(),false))
+                .append(strNull(hed.getValueMeaning4(),true));
         guarantyResultDO.setValueMeaning(valueMeanings.toString());
 
         //获取估价对象区位状况描述
@@ -160,10 +208,14 @@ public class HouseExcelDataServiceImpl extends ServiceImpl<HouseExcelDataMapper,
                 .select(HouseGuarantyArea::getDocContent).eq(BaseEntity::getDeleteStatus, false).orderByAsc(HouseGuarantyArea::getId));
         StringBuffer docContent = new StringBuffer();
         for (int i = 0; i < areas.size(); i++) {
+            String docContent1 = areas.get(i).getDocContent();
+            if (StrUtil.isBlank(docContent1)){
+                ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"区位描述未保存,请保存后再生成。");
+            }
             if (i!= areas.size()-1){
-                docContent.append("\t").append(areas.get(i).getDocContent()).append("\n");
+                docContent.append("\t").append(docContent1).append("\n");
             }else {
-                docContent.append("\t").append(areas.get(i).getDocContent());
+                docContent.append("\t").append(docContent1);
             }
 
         }
@@ -191,6 +243,14 @@ public class HouseExcelDataServiceImpl extends ServiceImpl<HouseExcelDataMapper,
                         HouseExcelData::getSummary1,
                         HouseExcelData::getSummary2,
                         HouseExcelData::getWorkPurpose,
+                        HouseExcelData::getAffix1,
+                        HouseExcelData::getAffix2,
+                        HouseExcelData::getAffix3,
+                        HouseExcelData::getAffix4,
+                        HouseExcelData::getAffix5,
+                        HouseExcelData::getAffix6,
+                        HouseExcelData::getAffix7,
+                        HouseExcelData::getAffix8,
                         HouseExcelData::getExcelUri);
         return this.getOne(queryWrapper);
     }
@@ -313,11 +373,14 @@ public class HouseExcelDataServiceImpl extends ServiceImpl<HouseExcelDataMapper,
             Row rowValue = sheet.getRow(row);
             //估价对象
             Cell cell0 = rowValue.getCell(0);
-            houseGuarantyArea.setTid(cell0.getStringCellValue());
             //坐落
             Cell cell1 = rowValue.getCell(1);
+            houseGuarantyArea.setTid(cell0.getStringCellValue());
             houseGuarantyArea.setLocation(cell1.getStringCellValue());
             houseGuarantyArea.setExcelId(excelId);
+            if (StrUtil.isBlank(houseGuarantyArea.getTid()) || StrUtil.isBlank(houseGuarantyArea.getLocation())){
+                continue;
+            }
             //获取经纬度 高德接口QPS太高会限制请求。估此处休眠半秒。
             Thread.sleep(500);
             LngLatDTO lngLatDTO = houseGuarantyAreaService.queryLngLat(houseGuarantyArea.getLocation());
@@ -327,4 +390,8 @@ public class HouseExcelDataServiceImpl extends ServiceImpl<HouseExcelDataMapper,
         }
         houseGuarantyAreaService.saveBatch(houseGuarantyAreas);
     }
+
+    private String strNull(String str,boolean last){
+        return StrUtil.isNotBlank(str)&&!last?str+"\n":"";
+    }
 }

+ 28 - 1
sql/update_sql.sql

@@ -1163,4 +1163,31 @@ CREATE TABLE `productivity-platform`.`house_excel_data`  (
                                                    `delete_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '删除状态',
                                                    `excel_uri` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '原始excel保存路径',
                                                    PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 110 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '房地产EXCEL原始数据' ROW_FORMAT = Dynamic;
+) ENGINE = InnoDB AUTO_INCREMENT = 110 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '房地产EXCEL原始数据' ROW_FORMAT = Dynamic;
+
+DROP TABLE IF EXISTS `house_guaranty_area`;
+CREATE TABLE `productivity-platform`.`house_guaranty_area`  (
+                                                   `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id',
+                                                   `excel_id` bigint NOT NULL COMMENT '文档id',
+                                                   `tid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '估价对象id',
+                                                   `lng` decimal(16, 6) NULL DEFAULT NULL COMMENT '经度',
+                                                   `lat` decimal(16, 6) NULL DEFAULT NULL COMMENT '纬度',
+                                                   `location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '地址',
+                                                   `road` json NULL COMMENT '路网信息',
+                                                   `public_transport` json NULL COMMENT '公共交通',
+                                                   `park` json NULL COMMENT '停车场信息',
+                                                   `business` json NULL COMMENT '商场信息',
+                                                   `community` json NULL COMMENT '周边小区',
+                                                   `education` json NULL COMMENT '周边学校',
+                                                   `hospital` json NULL COMMENT '周边医院',
+                                                   `bank` json NULL COMMENT '周边银行',
+                                                   `hotel` json NULL COMMENT '周边酒店',
+                                                   `spot` json NULL COMMENT '周边景区',
+                                                   `doc_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci 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 = 50 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '房地产标的物周边区位信息' ROW_FORMAT = Dynamic;
+
+ALTER TABLE house_excel_data ADD COLUMN value_category text NULL COMMENT '价值类型';