|  |  | 
 |  |  |         noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,model.getId())); | 
 |  |  |         Notices notices = new Notices(noticeObjectType,Constants.ONE,model.getId(),solutions.getName(), | 
 |  |  |                 insuranceApply.getCompanyId(), Constants.NoticeType.FOUR); | 
 |  |  | //        notices.setParam1(insuranceApply.getId().toString()); | 
 |  |  |         noticesMapper.insert(notices); | 
 |  |  |  | 
 |  |  |         Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_PLATFORM_CHECK_PASS_NO; | 
 |  |  |         String info =applyLogType.getInfo(); | 
 |  |  |         info = info.replace("${param}", update.getCheckInfo()); | 
 |  |  |         ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update)); | 
 |  |  |         ApplyLog log = new ApplyLog(update,applyLogType.getName(), | 
 |  |  |                 info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update)); | 
 |  |  |         applyLogMapper.insert(log); | 
 |  |  |         return  1; | 
 |  |  |  | 
 |  |  | 
 |  |  | //        if(1==1){ | 
 |  |  | //            throw new BusinessException(ResponseStatus.DATA_EMPTY); | 
 |  |  | //        } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.APPLY_CHANGE; | 
 |  |  |         if(model.getType().equals(Constants.ONE)){ | 
 |  |  |             noticeObjectType = Constants.NoticeObjectType.CHANGE_FACTORY; | 
 |  |  |         } | 
 |  |  |         //删除其他待办 | 
 |  |  |         noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,model.getId())); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_PLATFORM_APPROVE; | 
 |  |  |         String info = ""; | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 处理加减保明细数据 | 
 |  |  |      * 处理换厂明细数据 | 
 |  |  |      * @param update | 
 |  |  |      */ | 
 |  |  |     private void dealDetailsDUdata(ApplyChange update,InsuranceApply insuranceApply) { | 
 |  |  | 
 |  |  |         //实际批单生效日期 | 
 |  |  |         Date applyStartTime = DateUtil.getMontageDate(update.getApplyStartTime(),1); | 
 |  |  |         for(ApplyChagneDetail detail : detailList){ | 
 |  |  |             //查询减保人员是否存在 冲突的 保单明细数据 | 
 |  |  |             if(applyDetailJoinMapper.selectCount(new QueryWrapper<ApplyDetail>() | 
 |  |  |                     .lambda() | 
 |  |  |                     .eq(ApplyDetail::getApplyId,update.getApplyId()) | 
 |  |  | 
 |  |  |         if (Objects.isNull(insuranceApply)) { | 
 |  |  |             throw new BusinessException(ResponseStatus.DATA_EMPTY); | 
 |  |  |         } | 
 |  |  |         if (!Constants.equalsInteger(insuranceApply.getStatus(),Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())) { | 
 |  |  |         if (!(Constants.equalsInteger(insuranceApply.getStatus(),Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()) | 
 |  |  |         ||Constants.equalsInteger(insuranceApply.getStatus(),Constants.InsuranceApplyStatus.WTB_DONE.getKey()) | 
 |  |  |         )) { | 
 |  |  |             throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(), "保单状态错误"); | 
 |  |  |         } | 
 |  |  |         if (DateUtil.compareDate(insuranceApply.getEndTime(),new Date()) >= Constants.ZERO | 
 |  |  | 
 |  |  |         ApplyLog log = new ApplyLog(applyChange,applyLogType.getName(),info,applyChange.getId(),applyLogType.getKey(), null, null); | 
 |  |  |         applyLogMapper.insert(log); | 
 |  |  |  | 
 |  |  |         Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.APPLY_CHANGE; | 
 |  |  |         if(applyChange.getType().equals(Constants.ONE)){ | 
 |  |  |             noticeObjectType = Constants.NoticeObjectType.CHANGE_FACTORY; | 
 |  |  |         } | 
 |  |  |         noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,applyChange.getId())); | 
 |  |  |  | 
 |  |  |         return applyChange.getId(); | 
 |  |  |     } | 
 |  |  | 
 |  |  |                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "该企业分配保险方案无法进行减保"); | 
 |  |  |             } | 
 |  |  |             //减保明细数据 计算金额  根据批单时间 前一天 计算 | 
 |  |  |             applyChangeCyclePriceDTO.setValidTime(DateUtil.getMontageDate(applyChange.getValidTime(),2)); | 
 |  |  |             applyChangeCyclePriceDTO.setValidTime(DateUtil.getMontageDate(applyChange.getValidTime(),3)); | 
 |  |  |  | 
 |  |  |             CountCyclePriceVO countCyclePriceVO =  this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO); | 
 |  |  |             BigDecimal detailFee = countCyclePriceVO.getCyclePrice(); | 
 |  |  |             this.delChangeDetail(applyChange,delDetailList,insuranceApply,solutions,loginUserInfo,detailFee,applyChangeCyclePriceDTO.getValidTime()); | 
 |  |  | 
 |  |  |         //换厂业务 | 
 |  |  |         List<ApplyChagneDetail> changeDetailList = applyChange.getChangeDetailList(); | 
 |  |  |         if (CollectionUtils.isNotEmpty(changeDetailList)) { | 
 |  |  |             //验证是否存在重复数据 | 
 |  |  |             List<String> idcarNo = changeDetailList.stream().map(m->m.getIdcardNo()).collect(Collectors.toList()); | 
 |  |  |             Set<String> set = new HashSet<>(idcarNo); | 
 |  |  |             if(idcarNo.size() != set.size()){ | 
 |  |  |                 throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"对不起,人员录入数据存在相同数据!"); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             this.changeDetail(applyChange,changeDetailList,duWorktypeList,duSolutionList,loginUserInfo); | 
 |  |  |         } | 
 |  |  |         return fee; | 
 |  |  | 
 |  |  |                 throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "减保人员【" + applyChagneDetail.getMemberName() + "】保单保障日期至:【" + applyDetail.getEndTime() + "】无法通过本次申请"); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             applyChagneDetail.setPrice(applyDetail.getPrice()); | 
 |  |  |             applyChagneDetail.setCreateDate(new Date()); | 
 |  |  |             applyChagneDetail.setCreator(loginUserInfo.getId()); | 
 |  |  | 
 |  |  |             member.setEndTime(applyChagneDetail.getEndTime()); | 
 |  |  |             memberMapper.updateById(member); | 
 |  |  |  | 
 |  |  |             applyChagneDetail.setFee( detailFee.multiply(new BigDecimal(-1))); | 
 |  |  |             //查询减保日期 | 
 |  |  |             Integer delDays = DateUtil.daysBetweenDates(applyDetail.getEndTime(),endTime); | 
 |  |  |  | 
 |  |  |             applyChagneDetail.setFee( new BigDecimal(delDays).multiply(applyDetail.getPrice()).multiply(new BigDecimal(-1))); | 
 |  |  |             applyChagneDetailJoinMapper.insert(applyChagneDetail); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | 
 |  |  |                 .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 0  )",ApplyChange::getAddNum) | 
 |  |  |                 .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 1  )",ApplyChange::getDelNum) | 
 |  |  |                 .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 2  )",ApplyChange::getChangeNum) | 
 |  |  |                 .select(" ( select max(ac.APPLY_START_TIME) from apply_change ac  where ac.apply_id = t.apply_id and ac.status = 2 ) as lastChangeDate") | 
 |  |  |                 .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId) | 
 |  |  |                 .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) | 
 |  |  |                 .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) | 
 |  |  | 
 |  |  |         CountCyclePriceVO returnCountCyclePriceVO = new CountCyclePriceVO(); | 
 |  |  |         //加减保金额 | 
 |  |  | //        returnCountCyclePriceVO.setCyclePrice(sumPrice.multiply(new BigDecimal(optDays)).divide(new BigDecimal(sumDays),2, RoundingMode.HALF_UP)); | 
 |  |  |         returnCountCyclePriceVO.setCyclePrice(applyDetail.getPrice().multiply(new BigDecimal(optDays))); | 
 |  |  |         returnCountCyclePriceVO.setCyclePrice(applyDetail.getPrice().multiply(new BigDecimal(optDays)).setScale(2, RoundingMode.HALF_UP)); | 
 |  |  |         return returnCountCyclePriceVO; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |         } | 
 |  |  |         if(applyChange.getId() == null){ | 
 |  |  |             throw  new BusinessException(ResponseStatus.BAD_REQUEST); | 
 |  |  |         }  | 
 |  |  |         if(Objects.isNull(applyChange)){ | 
 |  |  |             throw  new BusinessException(ResponseStatus.DATA_EMPTY); | 
 |  |  |         } | 
 |  |  |         ApplyChange model = applyChangeJoinMapper.selectJoinOne(ApplyChange.class, | 
 |  |  |                 new MPJLambdaWrapper<ApplyChange>() | 
 |  |  | 
 |  |  |             update.setStatus(Constants.ApplyChangeStatus.CHECHED_PASSED.getKey()); | 
 |  |  |         } | 
 |  |  |         applyChangeJoinMapper.updateById(update); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_HBD_AUDIT; | 
 |  |  |         String info = applyChange.getCheckInfo(); | 
 |  |  |         if(StringUtils.isNotBlank(applyChange.getCheckInfo())){ | 
 |  |  |             info = info.replace("${param}", applyChange.getCheckInfo()); | 
 |  |  |         }else{ | 
 |  |  |             info = info.replace("${param}", ""); | 
 |  |  |         } | 
 |  |  |         ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(), null, null); | 
 |  |  |         applyLogMapper.insert(log); | 
 |  |  |  | 
 |  |  |         Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.APPLY_CHANGE; | 
 |  |  |         if(Constants.equalsInteger(applyChange.getType(),Constants.ONE)){ | 
 |  |  |         if(Constants.equalsInteger(model.getType(),Constants.ONE)){ | 
 |  |  |             noticeObjectType = Constants.NoticeObjectType.CHANGE_FACTORY; | 
 |  |  |         } | 
 |  |  |         //删除全部待办 |