| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | (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); |
| | | } |
| | | //拆迁时间 |
| | |
| | | continue; |
| | | } |
| | | //自主购房补贴、过渡补贴(如果购房情况异常则不判定自主购房补贴是否异常,自主购房补贴、过渡补贴 依赖赔偿金额信息) |
| | | if (record.getPriceAmountWarn() == 0) { |
| | | if (record.getPriceAmountWarn() == 0 && record.getPriceAmountWarn() == 0) { |
| | | boolean warnFlag = compensateService.compensateBuyCalculateV2(applyRecord.getDemolitionTime(), |
| | | record.getStreet(), |
| | | applyRecord.getOrgArea(), applyRecord.getNoOrgArea(), |
| | |
| | | //过渡补贴 |
| | | 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); |
| | |
| | | } |
| | | 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(); |
| | | //自主购房补贴、过渡补贴(如果购房情况异常则不判定自主购房补贴是否异常,自主购房补贴、过渡补贴 依赖赔偿金额信息) |
| | |
| | | //过渡补贴 |
| | | if (compensateService.compensateSubsidyCalculate(record.getCurrentCount(), record.getSubsidyAmount())) { |
| | | record.setSubsidyAmountWarn(0); |
| | | }else{ |
| | | } else { |
| | | record.setSubsidyAmountWarn(1); |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void fixSettle() { |
| | | //修改安置状态为0 |
| | | LambdaUpdateWrapper<Placement> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.set(Placement::getStatus, 0); |
| | | placementService.update(updateWrapper); |
| | | |
| | | LambdaQueryWrapper<PlacementBatch> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(PlacementBatch::getStatus, 1); |
| | | List<PlacementBatch> list = this.baseMapper.selectList(queryWrapper); |
| | | List<Long> batchIds = list.stream().map(PlacementBatch::getId).collect(Collectors.toList()); |
| | | //查询房产表 |
| | | LambdaQueryWrapper<PlacementBatchHousehold> householdWrapper = new LambdaQueryWrapper<>(); |
| | | householdWrapper.in(PlacementBatchHousehold::getPlacementBatchId, batchIds); |
| | | List<PlacementBatchHousehold> households = this.placementBatchHouseholdService.list(householdWrapper); |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取最近批次号 |
| | | * |