Browse Source

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

GouGengquan 7 months ago
parent
commit
8be7cfb530

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

@@ -99,4 +99,14 @@ public class HouseGuarantyDocController {
         return Result.build(houseGuarantyService.genConditionLetter(id));
     }
 
+    /**
+     * 生成《房地产抵押估价结果报告》
+     * @param id
+     * @return
+     */
+    @GetMapping("/result/{id}")
+    public Result<String> genResultLetter(@PathVariable("id") Long id){
+        return Result.build(houseGuarantyService.genResultLetter(id));
+    }
+
 }

+ 66 - 0
biz-base/src/main/java/com/dayou/controller/HouseTargetEntityController.java

@@ -0,0 +1,66 @@
+package com.dayou.controller;
+
+import com.dayou.entity.HouseTargetEntity;
+import com.dayou.result.Result;
+import com.dayou.service.HouseTargetEntityService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * 房地产实物状况控制器
+ */
+@RestController
+@RequestMapping("houseTargetEntity")
+@Slf4j
+public class HouseTargetEntityController {
+
+    @Autowired
+    private HouseTargetEntityService houseTargetEntityService;
+
+    /**
+     * 保存实物状况信息
+     * @param houseTargetEntity
+     * @return
+     */
+    @PostMapping("")
+    public Result<Boolean> addHouseTargetEntity(@RequestBody HouseTargetEntity houseTargetEntity) {
+        Boolean ret = houseTargetEntityService.addHouseTargetEntity(houseTargetEntity);
+        return Result.build(ret);
+    }
+
+    /**
+     * 查询单个标的物实物状况
+     * @param businessId
+     * @param tid
+     * @param tno
+     * @return
+     */
+    @GetMapping("")
+    public Result<HouseTargetEntity> getHouseTargetEntityById(Long businessId,String tid,String tno) {
+        HouseTargetEntity ret = houseTargetEntityService.getHouseTargetEntityById(businessId,tid,tno);
+        return Result.build(ret);
+    }
+
+    /**
+     * 删除实物状况信息
+     * @param id
+     * @return
+     */
+    @DeleteMapping("/{id}")
+    public Result<Boolean> removeHouseTargetEntityById(@PathVariable("id") Long id) {
+        return Result.build(houseTargetEntityService.removeById(id));
+    }
+
+    /**
+     * 复制到其他实物状况
+     * @param id
+     * @return
+     */
+    @GetMapping("/copy/{id}")
+    public Result<Boolean> copyHouseTargetEntity(@PathVariable("id") Long id){
+        Boolean ret = houseTargetEntityService.copyHouseTargetEntity(id);
+        return Result.build(ret);
+    }
+}

File diff suppressed because it is too large
+ 88 - 0
biz-base/src/test/java/com/dayou/DynamicGenTableWordTest.java


+ 18 - 0
biz-base/src/test/java/com/dayou/GuarantyResultTest.java

@@ -0,0 +1,18 @@
+package com.dayou;
+
+import com.dayou.service.HouseGuarantyService;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+public class GuarantyResultTest {
+
+    @Autowired
+    private HouseGuarantyService houseGuarantyService;
+
+    @Test
+    public void test() {
+        houseGuarantyService.genResultLetter(57L);
+    }
+}

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

@@ -51,6 +51,11 @@ public class HouseGuarantyDoc {
     public static final String CONDITION_LETTER_TEMPLATE = "condition_letter.docx";
 
     /**
+     * 房地产抵押估价结果报告
+     */
+    public static final String GUARANTY_RESULT_TEMPLATE = "guarantyResult.docx";
+
+    /**
      * 是
      */
     public static final String YES = "是";

+ 12 - 3
common/src/main/java/com/dayou/utils/AsposeWordUtil.java

@@ -392,12 +392,17 @@ public class AsposeWordUtil {
                 // 检查isCreate属性是否为true
                 if (annotation.isCreate()) {
                     builder.insertCell();
+                    builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER);
+                    ParagraphFormat paragraphFormat = builder.getParagraphFormat();
+                    paragraphFormat.setAlignment(ParagraphAlignment.CENTER);
+                    paragraphFormat.setLineSpacing(0);
                     // 字体宋体
-                    builder.getFont().setName("华文细黑");
+                    builder.getFont().setName("宋体");
                     // 是否加粗
-                    builder.getFont().setBold(true);
+                    //builder.getFont().setBold(true);
                     // 字号(9是小五字号)
                     builder.getFont().setSize(9);
+
                     builder.write(annotation.name());
                 }
             }
@@ -416,8 +421,12 @@ public class AsposeWordUtil {
                     if (annotation.isCreate()) {
                         field.setAccessible(true);
                         builder.insertCell();
+                        builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER);
+                        ParagraphFormat paragraphFormat = builder.getParagraphFormat();
+                        paragraphFormat.setAlignment(ParagraphAlignment.CENTER);
+                        paragraphFormat.setLineSpacing(0);
                         // 字体宋体
-                        builder.getFont().setName("华文细黑");
+                        builder.getFont().setName("宋体");
                         // 是否加粗
                         builder.getFont().setBold(false);
                         // 字号(9是小五字号)

+ 32 - 23
common/src/main/java/com/dayou/utils/HouseDocumentUtil.java

@@ -295,40 +295,49 @@ public class HouseDocumentUtil {
         //有地类用途和分摊面积
         if (cn.hutool.core.collection.CollectionUtil.isNotEmpty(outerAcreage)
                 && cn.hutool.core.collection.CollectionUtil.isNotEmpty(landType)){
-            if (landType.contains("商业")){
-                BigDecimal sum = sumList(outerAcreage);
-                return "估价对象分摊出让商业用地使用权面积合计为:"+sum.toString()+"㎡;详见估价结果一览表";
-            }
-            if (landType.contains("零售")){
-                BigDecimal sum = sumList(outerAcreage);
-                return "估价对象分摊出让批发零售用地使用权面积合计为:"+sum.toString()+"㎡;详见估价结果一览表";
+            for (Object l : landType){
+                if (((String)l).contains("商业")){
+                    BigDecimal sum = sumList(outerAcreage);
+                    return "估价对象分摊出让商业用地使用权面积合计为:"+sum.toString()+"㎡;详见估价结果一览表";
+                }
+                if (((String)l).contains("零售")){
+                    BigDecimal sum = sumList(outerAcreage);
+                    return "估价对象分摊出让批发零售用地使用权面积合计为:"+sum.toString()+"㎡;详见估价结果一览表";
+                }
             }
+
         }
         //有用途和分摊面积
         if (cn.hutool.core.collection.CollectionUtil.isNotEmpty(outerAcreage)
                 && cn.hutool.core.collection.CollectionUtil.isNotEmpty(useTo)){
-            if (useTo.contains("工厂")){
-                BigDecimal sum = sumList(outerAcreage);
-                return "估价对象分摊出让工业用地使用权面积:"+sum.toString()+"㎡。详见估价结果一览表";
-            }
-            if (useTo.contains("车位")){
-                BigDecimal sum = sumList(outerAcreage);
-                return "估价对象分摊出让住宅(地下车库)用地使用权面积合计:"+sum.toString()+"㎡。详见估价结果一览表";
-            }
-            if (useTo.contains("住宅")){
-                BigDecimal sum = sumList(outerAcreage);
-                return "估价对象分摊出让城镇住宅用地使用权面积:"+sum.toString()+"㎡。详见估价结果一览表";
+            for (Object u : useTo){
+                if (((String)u).contains("工厂")){
+                    BigDecimal sum = sumList(outerAcreage);
+                    return "估价对象分摊出让工业用地使用权面积:"+sum.toString()+"㎡。详见估价结果一览表";
+                }
+                if (((String)u).contains("车位")){
+                    BigDecimal sum = sumList(outerAcreage);
+                    return "估价对象分摊出让住宅(地下车库)用地使用权面积合计:"+sum.toString()+"㎡。详见估价结果一览表";
+                }
+                if (((String)u).contains("住宅")){
+                    BigDecimal sum = sumList(outerAcreage);
+                    return "估价对象分摊出让城镇住宅用地使用权面积:"+sum.toString()+"㎡。详见估价结果一览表";
+                }
             }
+
         }
         //有用途和无分摊面积
         if (!CollectionUtil.isNotEmpty(outerAcreage)
                 && cn.hutool.core.collection.CollectionUtil.isNotEmpty(useTo)){
-            if (useTo.contains("商业")){
-                return "估价对象占用(分摊)的国有建设用地使用权系商业用地。详见估价结果一览表";
-            }
-            if (useTo.contains("住宅")){
-                return "估价对象分摊的土地使用权系出让城镇住宅用地。详见估价结果一览表";
+            for (Object u : useTo){
+                if (((String)u).contains("商业")){
+                    return "估价对象占用(分摊)的国有建设用地使用权系商业用地。详见估价结果一览表";
+                }
+                if (((String)u).contains("住宅")){
+                    return "估价对象分摊的土地使用权系出让城镇住宅用地。详见估价结果一览表";
+                }
             }
+
         }
          return "!分摊面积描述待补充!";
 

+ 0 - 8
common/src/main/java/com/dayou/utils/table/WordTableHelper.java

@@ -1,15 +1,12 @@
 package com.dayou.utils.table;
 
 import cn.hutool.core.util.StrUtil;
-import com.dayou.exception.ErrorCode;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
-import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -39,11 +36,6 @@ public class WordTableHelper {
                 Map<String,String> data = new HashMap<>();
                 data.put("table", richHtmlHandler.getHandledDocBodyBlock());
                 String tablePath = path + TARGETS_DOCX;
-//                URL resource = getClass().getClassLoader().getResource(FTL_TEMPLATE_DIR);
-//                System.out.println("resource====================>"+resource);
-//                String templatePath = resource.getPath();
-//                System.out.println("templatePaht====>"+templatePath);
-                //templatePath = java.net.URLDecoder.decode(templatePath,"utf-8");
                 WordGeneratorWithFreemarker.createDoc("/",FTL_TEMPLATE,data,tablePath);
                 return tablePath;
             }

+ 7 - 0
dao/src/main/java/com/dayou/mapper/HouseTargetEntityMapper.java

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

+ 6 - 0
dao/src/main/resources/mapper/HouseTargetEntityMapper.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.HouseTargetEntityMapper">
+
+
+</mapper>

common/src/main/java/com/dayou/annotation/WordTableColumn.java → domain/src/main/java/com/dayou/annotation/WordTableColumn.java


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

@@ -6,6 +6,11 @@ import lombok.Data;
 public class GuarantyResultDO {
 
     /**
+     * 报告号
+     */
+    private String docNo;
+
+    /**
      * 委托人
      */
     private String consignor;

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

@@ -0,0 +1,44 @@
+package com.dayou.entity;
+
+import com.dayou.common.BaseEntity;
+import lombok.Data;
+
+@Data
+public class HouseTargetEntity extends BaseEntity {
+
+    private Long businessId;
+    private String tid;
+    private String tno;
+    private String houseAge;
+    private String useInfo;
+    private String useTo;
+    private String buildingOut;
+    private String atFloor;
+    private String floor;
+    private String elevator;
+    private Boolean centerAirConditioning;
+    private Boolean autoSpray;
+    private Boolean smogEmergency;
+    private Boolean fireHydrant;
+    private Boolean netLine;
+    private Boolean visualSys;
+    private String buildingStructure;
+    private Boolean officeSmartSys;
+    private String baseFacility;
+    private String roomType;
+    private String roomHigh;
+    private String newPercentage;
+    private String livingroomGround;
+    private String livingroomTop;
+    private String livingroomWall;
+    private String livingroomOther;
+    private String bedroomGround;
+    private String bedroomTop;
+    private String bedroomWall;
+    private String bedroomOther;
+    private String bathroomGround;
+    private String bathroomTop;
+    private String bathroomWall;
+    private String bathroomOther;
+    private String landDeep;
+}

+ 32 - 0
domain/src/main/java/com/dayou/table/HouseEntityTable.java

@@ -0,0 +1,32 @@
+package com.dayou.table;
+
+
+import com.dayou.annotation.WordTableColumn;
+import lombok.Builder;
+import lombok.Data;
+
+@Builder
+public class HouseEntityTable {
+
+
+    @WordTableColumn(name = "估价对象")
+    private String tid;
+
+    @WordTableColumn(name = "序号")
+    private String tno;
+
+    @WordTableColumn(name = "坐落")
+    private String location;
+
+    @WordTableColumn(name = "结构")
+    private String structure;
+
+    @WordTableColumn(name = "用途")
+    private String useTo;
+
+    @WordTableColumn(name = "建筑面积")
+    private String acreage;
+
+    @WordTableColumn(name = "实物状况")
+    private String desc;
+}

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

@@ -52,4 +52,11 @@ public interface HouseGuarantyService {
      * @return
      */
     Map<String, String> getBaseInfoFromFile(Long id) throws IOException;
+
+    /**
+     * 生成《房地产抵押估价结果报告》
+     * @param id
+     * @return
+     */
+    String genResultLetter(Long id);
 }

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

@@ -0,0 +1,13 @@
+package com.dayou.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.dayou.entity.HouseTargetEntity;
+
+public interface HouseTargetEntityService extends IService<HouseTargetEntity> {
+
+    Boolean addHouseTargetEntity(HouseTargetEntity houseTargetEntity);
+
+    HouseTargetEntity getHouseTargetEntityById(Long businessId, String tid, String tno);
+
+    Boolean copyHouseTargetEntity(Long id);
+}

+ 55 - 2
service/src/main/java/com/dayou/service/impl/HouseGuarantyServiceImpl.java

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

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

@@ -0,0 +1,68 @@
+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.dto.HouseGuarantyTargetDTO;
+import com.dayou.entity.HouseGuarantyTarget;
+import com.dayou.entity.HouseTargetEntity;
+import com.dayou.mapper.HouseTargetEntityMapper;
+import com.dayou.service.HouseGuarantyTargetService;
+import com.dayou.service.HouseTargetEntityService;
+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.List;
+
+@Service
+public class HouseTargetEntityServiceImpl extends ServiceImpl<HouseTargetEntityMapper, HouseTargetEntity> implements HouseTargetEntityService {
+
+    @Autowired
+    private HouseGuarantyTargetService houseGuarantyTargetService;
+
+    @Override
+    public Boolean addHouseTargetEntity(HouseTargetEntity houseTargetEntity) {
+        return this.saveOrUpdate(houseTargetEntity);
+    }
+
+    @Override
+    public HouseTargetEntity getHouseTargetEntityById(Long businessId, String tid, String tno) {
+        HouseTargetEntity entity = this.getOne(new LambdaQueryWrapper<HouseTargetEntity>()
+                .eq(HouseTargetEntity::getBusinessId, businessId)
+                .eq(HouseTargetEntity::getTid, tid).eq(HouseTargetEntity::getTno, tno));
+        return entity;
+    }
+
+    @Override
+    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<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())){
+                }else {
+                    HouseTargetEntity targetEntity = new HouseTargetEntity();
+                    BeanUtils.copyProperties(originEntity,targetEntity);
+                    targetEntity.setTid(target.getTId());
+                    targetEntity.setTno(targetDTO.getNo());
+                    targetEntities.add(targetEntity);
+                }
+            }
+
+        }
+        return this.saveBatch(targetEntities);
+    }
+}