From ea3092eec19e10072aeed5569a464e0ea45fe52f Mon Sep 17 00:00:00 2001
From: yanghb <yangbhwork@163.com>
Date: 星期五, 04 七月 2025 15:34:01 +0800
Subject: [PATCH] feat: 购房表房主身份证 + 带安置家庭成员名称,这两个条件 满足 购房表 则修改为安置状态

---
 cz-bussiness/src/main/java/com/ruoyi/bussiness/service/impl/PlacementApplyServiceImpl.java |   56 ++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/cz-bussiness/src/main/java/com/ruoyi/bussiness/service/impl/PlacementApplyServiceImpl.java b/cz-bussiness/src/main/java/com/ruoyi/bussiness/service/impl/PlacementApplyServiceImpl.java
index 107c329..f47775e 100644
--- a/cz-bussiness/src/main/java/com/ruoyi/bussiness/service/impl/PlacementApplyServiceImpl.java
+++ b/cz-bussiness/src/main/java/com/ruoyi/bussiness/service/impl/PlacementApplyServiceImpl.java
@@ -19,6 +19,7 @@
 import com.ruoyi.bussiness.object.response.placementApply.*;
 import com.ruoyi.bussiness.service.*;
 import com.ruoyi.bussiness.utils.BatchNumberUtils;
+import com.ruoyi.common.easyExcel.CommentWriteHandler;
 import com.ruoyi.common.exception.GlobalException;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.file.FileUtils;
@@ -26,7 +27,6 @@
 import com.ruoyi.system.service.ISysNoticeService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
-import org.springframework.security.core.parameters.P;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -142,7 +142,7 @@
             return;
         }
         for (PlacementApplyRecord record : records) {
-            if(record.getChecks() == 1){
+            if (record.getChecks() == 1) {
                 //已核对直接跳过
                 continue;
             }
@@ -151,7 +151,7 @@
             if (count == 0) {
                 //安置表户主信息不存在
                 record.setIdCardExistsWarn(1);
-            }else{
+            } else {
                 record.setIdCardExistsWarn(0);
             }
             //判断户主是否重名
@@ -194,22 +194,19 @@
             BigDecimal waitFamilyArea = record.getWaitFamilyArea();
 //            Integer currentCollectiveNum = record.getCurrentCollectiveNum();
 //            Integer currentNoCollectiveNum = record.getCurrentNoCollectiveNum();
-            boolean warn = compensateService.compensateSettleAreaCalculate(record.getOrgArea(),record.getNoOrgArea(), waitFamilyArea);
+            boolean warn = compensateService.compensateSettleAreaCalculate(record.getOrgArea(), record.getNoOrgArea(), waitFamilyArea);
             if (warn) {
                 record.setWaitFamilyAreaWarn(0);
-            }else{
+            } else {
                 record.setWaitFamilyAreaWarn(1);
             }
 
             //赔偿金额(判断新购房还是二手房,这两个只能存在一个)
-            if (record.getCompensationNewAmount().compareTo(BigDecimal.ZERO) == 0 &&
-                    record.getCompensationOldAmount().compareTo(BigDecimal.ZERO) == 0) {
+            if (ObjUtil.isEmpty(record.getCompensationNewAmount()) &&
+                    ObjUtil.isEmpty(record.getCompensationOldAmount())) {
                 record.setCompensationAmountWarn(1);
-            }else{
-                record.setCompensationAmountWarn(0);
-            }
-            if (record.getCompensationNewAmount().compareTo(BigDecimal.ZERO) > 0 &&
-                    record.getCompensationOldAmount().compareTo(BigDecimal.ZERO) > 0) {
+            } else if (ObjUtil.isNotEmpty(record.getCompensationNewAmount()) &&
+                    ObjUtil.isNotEmpty(record.getCompensationOldAmount())) {
                 record.setCompensationAmountWarn(1);
             }else{
                 record.setCompensationAmountWarn(0);
@@ -227,7 +224,7 @@
                 //过渡补贴
                 if (compensateService.compensateSubsidyCalculate(record.getCurrentCount(), record.getSubsidyAmount())) {
                     record.setSubsidyAmountWarn(0);
-                }else{
+                } else {
                     record.setSubsidyAmountWarn(1);
                 }
             }
@@ -237,14 +234,14 @@
             BigDecimal quarterPayAmount = (record.getCompensationSum().subtract(pay)).divide(new BigDecimal("20"), 10, RoundingMode.DOWN);
             if (quarterPayAmount.compareTo(record.getQuarterPayAmount()) != 0) {
                 record.setQuarterPayAmountWarn(1);
-            }else{
+            } else {
                 record.setQuarterPayAmountWarn(0);
             }
 
             //首付款警告
             boolean downPaymentAmountWarn = true;
             BigDecimal cateAmount = record.getCompensationSum().multiply(new BigDecimal("0.25"));
-            if(cateAmount.compareTo(record.getDownPaymentAmount()) == 0){
+            if (cateAmount.compareTo(record.getDownPaymentAmount()) == 0) {
                 downPaymentAmountWarn = false;
             }
             record.setDownPaymentAmountWarn(downPaymentAmountWarn ? 1 : 0);
@@ -534,8 +531,35 @@
             List<PlacementApplyRecord> applyRecords = placementApplyRecordService.problemList(request);
             List<ProblemExportResponse> data = BeanUtil.copyToList(applyRecords, ProblemExportResponse.class);
 
+            Map<String, String> warnFieldToTarget = new HashMap<>();
+            warnFieldToTarget.put("idCardExistsWarn","idCard");
+            warnFieldToTarget.put("idCardNoWarn","idCard");
+            warnFieldToTarget.put("waitFamilyNamesWarn","waitFamilyNames");
+            warnFieldToTarget.put("waitFamilyNamesNoWarn","waitFamilyNames");
+            warnFieldToTarget.put("waitFamilyAreaWarn","waitFamilyArea");
+            warnFieldToTarget.put("compensationAmountWarn","compensationNewAmount");
+            warnFieldToTarget.put("compensationSumWarn","compensationSum");
+            warnFieldToTarget.put("quarterPayAmountWarn","quarterPayAmount");
+            warnFieldToTarget.put("subsidyAmountWarn","subsidyAmount");
+
+
+
+            Map<String, String> warnMessages = new HashMap<>();
+            warnMessages.put("idCardExistsWarn","身份证不在安置库警告");
+            warnMessages.put("idCardNoWarn","身份证重复提醒警告");
+            warnMessages.put("waitFamilyNamesWarn","待安置家庭成员重复");
+            warnMessages.put("waitFamilyNamesNoWarn","待安置家庭成员不在安置库");
+            warnMessages.put("waitFamilyAreaWarn","应补偿面积数据异常警告");
+            warnMessages.put("compensationAmountWarn","多个购房活动警告");
+            warnMessages.put("compensationSumWarn","补偿金额异常");
+            warnMessages.put("downPaymentAmountWarn","首付款警告");
+            warnMessages.put("quarterPayAmountWarn","每季度需支付款项");
+            warnMessages.put("subsidyAmountWarn","过渡补贴异常");
+
             FileUtils.setExcelResponseHeader(response, "问题数据.xlsx");
-            ExcelWriterBuilder write = EasyExcelFactory.write(response.getOutputStream(), ProblemExportResponse.class);
+            ExcelWriterBuilder write = EasyExcelFactory.write(response.getOutputStream(),
+                    ProblemExportResponse.class)
+                    .registerWriteHandler(new CommentWriteHandler<>(data,warnFieldToTarget,warnMessages));
             write.sheet("sheet").doWrite(data);
             response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
         } catch (Exception e) {

--
Gitblit v1.7.1