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/PlacementBatchServiceImpl.java | 140 +++++++++++++++++++++++++++++++++------------- 1 files changed, 101 insertions(+), 39 deletions(-) diff --git a/cz-bussiness/src/main/java/com/ruoyi/bussiness/service/impl/PlacementBatchServiceImpl.java b/cz-bussiness/src/main/java/com/ruoyi/bussiness/service/impl/PlacementBatchServiceImpl.java index 756b09e..becbeab 100644 --- a/cz-bussiness/src/main/java/com/ruoyi/bussiness/service/impl/PlacementBatchServiceImpl.java +++ b/cz-bussiness/src/main/java/com/ruoyi/bussiness/service/impl/PlacementBatchServiceImpl.java @@ -3,6 +3,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjUtil; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.excel.EasyExcelFactory; import com.alibaba.excel.write.builder.ExcelWriterBuilder; @@ -22,6 +23,7 @@ import com.ruoyi.bussiness.service.*; import com.ruoyi.bussiness.utils.BatchNumberUtils; import com.ruoyi.bussiness.utils.PaymentCycleHelper; +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; @@ -378,26 +380,29 @@ (existing, replacement) -> existing )); for (PlacementBatchAsset record : assetRecords) { - if(record.getChecks() == 1){ + if (record.getChecks() == 1) { continue; } //未通过安置申请 if (placementApplyRecordService.countPassIdCard(record.getIdCard()) == 0) { record.setHouseholdHeadWarn(1); - }else{ + } else { record.setHouseholdHeadWarn(0); } - //赔偿金额(判断新购房还是二手房,这两个只能存在一个) - if (record.getPriceNewAmount().compareTo(BigDecimal.ZERO) == 0 && - record.getPriceOldAmount().compareTo(BigDecimal.ZERO) == 0) { - record.setPriceAmountWarn(1); + //身份证重复 + if(placementBatchAssetService.existsIdCard(record.getIdCard())){ + record.setIdCardRepeatWarn(1); }else{ - record.setPriceAmountWarn(0); + record.setIdCardRepeatWarn(0); } - if (record.getPriceNewAmount().compareTo(BigDecimal.ZERO) > 0 && - record.getPriceOldAmount().compareTo(BigDecimal.ZERO) > 0) { + //赔偿金额(判断新购房还是二手房,这两个只能存在一个) + if (ObjUtil.isNotEmpty(record.getPriceNewAmount()) + && ObjUtil.isNotEmpty(record.getPriceOldAmount())) { record.setPriceAmountWarn(1); - }else{ + } else if (ObjUtil.isEmpty(record.getPriceNewAmount()) + && ObjUtil.isEmpty(record.getPriceOldAmount())) { + record.setPriceAmountWarn(1); + } else { record.setPriceAmountWarn(0); } //拆迁时间 @@ -406,7 +411,7 @@ continue; } //自主购房补贴、过渡补贴(如果购房情况异常则不判定自主购房补贴是否异常,自主购房补贴、过渡补贴 依赖赔偿金额信息) - if (record.getPriceAmountWarn() == 0) { + if (record.getPriceAmountWarn() == 0 && record.getPriceAmountWarn() == 0) { boolean warnFlag = compensateService.compensateBuyCalculateV2(applyRecord.getDemolitionTime(), record.getStreet(), applyRecord.getOrgArea(), applyRecord.getNoOrgArea(), @@ -417,14 +422,14 @@ //过渡补贴 if (compensateService.compensateSubsidyCalculate(applyRecord.getCurrentCount(), record.getSubsidyAmount())) { record.setSubsidyAmountWarn(0); - }else{ + } else { record.setSubsidyAmountWarn(1); } //首付款警告 boolean downPaymentAmountWarn = true; BigDecimal cateAmount = record.getCompensationAmount().multiply(new BigDecimal("0.25")); - if(cateAmount.compareTo(record.getDownPaymentAmount()) == 0){ + if (cateAmount.compareTo(record.getDownPaymentAmount()) == 0) { downPaymentAmountWarn = false; } record.setDownPaymentAmountWarn(downPaymentAmountWarn ? 1 : 0); @@ -492,19 +497,18 @@ } record.setWaitFamilyAreaWarn(warn ? 0 : 1); - //赔偿金额(判断新购房还是二手房,这两个只能存在一个) - if (record.getCompensationNewAmount().compareTo(BigDecimal.ZERO) == 0 && - record.getCompensationOldAmount().compareTo(BigDecimal.ZERO) == 0) { + //判断是否两个都填写了 + if (ObjUtil.isNotEmpty(record.getCompensationOldAmount()) + && ObjUtil.isNotEmpty(record.getCompensationNewAmount())) { record.setCompensationAmountWarn(1); - }else{ + }else 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) { - record.setCompensationAmountWarn(1); - }else{ - record.setCompensationAmountWarn(0); - } + + BigDecimal orgArea = placementApplyRecord == null ? BigDecimal.ZERO : placementApplyRecord.getOrgArea(); BigDecimal noOrgArea = placementApplyRecord == null ? BigDecimal.ZERO : placementApplyRecord.getNoOrgArea(); //自主购房补贴、过渡补贴(如果购房情况异常则不判定自主购房补贴是否异常,自主购房补贴、过渡补贴 依赖赔偿金额信息) @@ -519,7 +523,7 @@ //过渡补贴 if (compensateService.compensateSubsidyCalculate(record.getCurrentCount(), record.getSubsidyAmount())) { record.setSubsidyAmountWarn(0); - }else{ + } else { record.setSubsidyAmountWarn(1); } } @@ -684,24 +688,32 @@ placementApplyRecordLambdaQueryWrapper.eq(PlacementBatchHousehold::getPlacementBatchId, placementBatch.getId()); //家庭成员 List<PlacementBatchHousehold> households = placementBatchHouseholdService.list(placementApplyRecordLambdaQueryWrapper); - //户主 - List<String> houseHead = households.stream().map(PlacementBatchHousehold::getHouseholdHead).collect(Collectors.toList()); - if (ObjUtil.isNotEmpty(households)) { - List<String> familyNames = households.stream().map(PlacementBatchHousehold::getWaitFamilyNames).collect(Collectors.toList()); - List<String> allFamilyNames = new ArrayList<>(); - for(String familyName : familyNames) { - List<String> names = Arrays.asList(familyName.split("、")); - allFamilyNames.addAll(names); - } - LambdaUpdateWrapper<Placement> placementLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); - placementLambdaUpdateWrapper.set(Placement::getStatus, 1); - placementLambdaUpdateWrapper.and(query -> query.in(Placement::getFamilyName, allFamilyNames)); - placementService.update(placementLambdaUpdateWrapper); + if(ObjectUtil.isEmpty(households)){ + return; + } + //修改户主安置状态 + List<String> houseHead = households.stream().map(PlacementBatchHousehold::getHouseholdHead).collect(Collectors.toList()); + if (ObjUtil.isNotEmpty(houseHead)) { LambdaUpdateWrapper<Placement> placementHouseHeadUpdateWrapper = new LambdaUpdateWrapper<>(); placementHouseHeadUpdateWrapper.set(Placement::getStatus, 1); placementHouseHeadUpdateWrapper.and(query -> query.in(Placement::getHouseholdHead, houseHead)); placementService.update(placementHouseHeadUpdateWrapper); + } + //修改家庭成员安置状态 + for(PlacementBatchHousehold household : households){ + if(ObjUtil.isEmpty(household.getWaitFamilyNames())){ + continue; + } + //购房表家庭成员姓名 + List<String> names = Arrays.asList(household.getWaitFamilyNames().split("、")); + //购房表户主身份证 + String headIdCard = household.getIdCard(); + LambdaUpdateWrapper<Placement> placementLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + placementLambdaUpdateWrapper.set(Placement::getStatus, 1); + placementLambdaUpdateWrapper.eq(Placement::getIdCard,headIdCard); + placementLambdaUpdateWrapper.and(query -> query.in(Placement::getFamilyName, names)); + placementService.update(placementLambdaUpdateWrapper); } } @@ -741,16 +753,66 @@ FileUtils.setExcelResponseHeader(response, "问题数据.xlsx"); //资金表 if (request.getType() == 1) { - ExcelWriterBuilder write = EasyExcelFactory.write(response.getOutputStream(), AssetExportResponse.class); + Map<String, String> warnFieldToTarget = new HashMap<>(); + warnFieldToTarget.put("householdHeadWarn","householdHead"); + warnFieldToTarget.put("idCardWarn","idCard"); + warnFieldToTarget.put("twoPriceWarn","priceNewAmount"); + warnFieldToTarget.put("priceAmountWarn","priceNewAmount"); + warnFieldToTarget.put("compensationSumWarn","compensationAmount"); + warnFieldToTarget.put("downPaymentAmountWarn","downPaymentAmount"); + warnFieldToTarget.put("quarterPayAmountWarn","quarterPayAmount"); + warnFieldToTarget.put("subsidyAmountWarn","subsidyAmount"); + + Map<String, String> warnMessages = new HashMap<>(); + warnMessages.put("householdHeadWarn","户主未通过安置申请提示"); + warnMessages.put("idCardWarn","身份证不存在安置库"); + warnMessages.put("twoPriceWarn","多个购房情况警告"); + warnMessages.put("priceAmountWarn","补偿标准数据异常"); + warnMessages.put("compensationSumWarn","补偿总价异常"); + warnMessages.put("downPaymentAmountWarn","首付款警告"); + warnMessages.put("quarterPayAmountWarn","每季度需支付款项警告"); + warnMessages.put("subsidyAmountWarn","过渡补贴异常"); + List<PlacementBatchAsset> assets = placementBatchAssetService.problemList(request); List<AssetExportResponse> data = BeanUtil.copyToList(assets, AssetExportResponse.class); + + ExcelWriterBuilder write = EasyExcelFactory. + write(response.getOutputStream(), AssetExportResponse.class) + .registerWriteHandler(new CommentWriteHandler<>(data,warnFieldToTarget,warnMessages)); write.sheet("sheet").doWrite(data); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); } else { - ExcelWriterBuilder write = EasyExcelFactory.write(response.getOutputStream(), HouseholdExportResponse.class); + Map<String, String> warnFieldToTarget = new HashMap<>(); + warnFieldToTarget.put("householdHeadWarn","householdHead"); + warnFieldToTarget.put("idCardWarn","idCard"); + warnFieldToTarget.put("waitFamilyNamesWarn","waitFamilyNames"); + warnFieldToTarget.put("waitFamilyNamesNoWarn","waitFamilyNames"); + warnFieldToTarget.put("waitFamilyAreaWarn","waitFamilyArea"); + warnFieldToTarget.put("compensationAmountWarn","compensationNewAmount"); + warnFieldToTarget.put("compensationSumWarn","compensationSum"); + warnFieldToTarget.put("downPaymentAmountWarn","downPaymentAmount"); + warnFieldToTarget.put("quarterPayAmountWarn","quarterPayAmount"); + warnFieldToTarget.put("subsidyAmountWarn","subsidyAmount"); + + Map<String, String> warnMessages = new HashMap<>(); + warnMessages.put("householdHeadWarn","未通过安置申请警告"); + warnMessages.put("idCardWarn","身份证不存在安置库警告"); + warnMessages.put("waitFamilyNamesWarn","家庭成员重复"); + warnMessages.put("waitFamilyNamesNoWarn","待安置家庭成员不在安置库"); + warnMessages.put("waitFamilyAreaWarn","待安置人员应安置面积警告"); + warnMessages.put("compensationAmountWarn","多个购房情况警告"); + warnMessages.put("compensationSumWarn","补偿金额异常"); + warnMessages.put("downPaymentAmountWarn","首付款警告"); + warnMessages.put("quarterPayAmountWarn","每季度需支付款项"); + warnMessages.put("subsidyAmountWarn","过渡补贴异常"); + //购房表 List<PlacementBatchHousehold> households = placementBatchHouseholdService.problemList(request); List<HouseholdExportResponse> data = BeanUtil.copyToList(households, HouseholdExportResponse.class); + + ExcelWriterBuilder write = EasyExcelFactory + .write(response.getOutputStream(), HouseholdExportResponse.class) + .registerWriteHandler(new CommentWriteHandler<>(data,warnFieldToTarget,warnMessages)); write.sheet("sheet").doWrite(data); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); } -- Gitblit v1.7.1