| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | .ne(ApplyChagneDetail::getType,Constants.TWO) |
| | | .eq(ApplyChagneDetail::getUnionChangeId,unionChange.getId())); |
| | | BigDecimal fee = applyChangeList.stream().map(m->m.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add); |
| | | // fee = fee.add(applyChangeList.stream().map(m->Objects.nonNull(m.getReduceMoney())?m.getReduceMoney():BigDecimal.ZERO).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | | // for (ApplyChagneDetail applyChagneDetail:applyChangeList) { |
| | | // Integer maxDays = DateUtil.calculateBetween(unionChange.getApplyStartTime(),applyChagneDetail.getEndTime(),0); |
| | | // if(applyChagneDetail.getType().equals(Constants.ONE)){ |
| | | // maxDays = DateUtil.daysBetweenDates(applyChagneDetail.getEndTime(),DateUtil.getMontageDate(unionChange.getApplyStartTime(),3)); |
| | | // } |
| | | // if(applyChagneDetail.getType().equals(Constants.ZERO)){ |
| | | // fee = fee.add(new BigDecimal(maxDays).multiply(applyChagneDetail.getPrice())); |
| | | // }else{ |
| | | // fee = fee.subtract(new BigDecimal(maxDays).multiply(applyChagneDetail.getPrice())).add(applyChagneDetail.getFee()); |
| | | // } |
| | | // } |
| | | unionChange.setFee(fee.setScale(2, RoundingMode.HALF_UP)); |
| | | unionChange.setFee(fee.setScale(6, RoundingMode.HALF_UP)); |
| | | //查询操作记录 |
| | | List<ApplyLog> applyLogList = applyLogJoinMapper.selectJoinList(ApplyLog.class, |
| | | new MPJLambdaWrapper<ApplyLog>() |
| | |
| | | .orderByAsc(ApplyLog::getCreateDate) |
| | | ); |
| | | unionChange.setApplyLogList(applyLogList); |
| | | if(StringUtils.isBlank(unionChange.getShopName())){ |
| | | unionChange.setShopName( |
| | | systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PLAT_COMPANY_NAME).getCode() |
| | | ); |
| | | |
| | | } |
| | | } |
| | | initFiles(unionChange); |
| | | unionChange.setFee(Constants.getTwoPoint(unionChange.getFee())); |
| | | return unionChange; |
| | | } |
| | | |
| | |
| | | if(multifiles!=null){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode() |
| | | +systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode(); |
| | | List<Multifile> pidanFileList = new ArrayList<>(); |
| | | for(Multifile f : multifiles){ |
| | | if(StringUtils.isBlank(f.getFileurl())){ |
| | | continue; |
| | |
| | | unionChange.setApplyFile(f); |
| | | } |
| | | if(Constants.equalsInteger(f.getObjType(),Constants.MultiFile.WTB_CA_DONE_PDF.getKey())){ |
| | | //签署后申请单 |
| | | unionChange.setPidanFile(f); |
| | | pidanFileList.add(f);; |
| | | } |
| | | } |
| | | unionChange.setPidanFileList(pidanFileList); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | PageData<UnionChange> pageData = PageData.from(unionChangeJoinMapper.selectJoinPage(page,UnionChange.class, queryWrapper)); |
| | | for (UnionChange unionChange:pageData.getRecords()) { |
| | | unionChange.setFee(Constants.getTwoPoint(unionChange.getFee())); |
| | | } |
| | | return pageData; |
| | | } |
| | | |
| | |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |
| | | public Integer merge(SaveUnionChangeDTO saveUnionChangeDTO){ |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(!user.getType().equals(Constants.TWO)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非商户用户,无法进行该操作"); |
| | | if(!(Constants.equalsInteger(user.getType(),Constants.ZERO) || Constants.equalsInteger(user.getType(),Constants.TWO))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非商户平台用户,无法进行该操作"); |
| | | } |
| | | if(saveUnionChangeDTO.getBusinessType().equals(Constants.ZERO)){ |
| | | if(saveUnionChangeDTO.getBusinessType().equals(Constants.ZERO)||Objects.isNull(saveUnionChangeDTO.getApplyDate())){ |
| | | //2024年5月9日14:59:24 修改 默认入当前天 |
| | | saveUnionChangeDTO.setApplyDate(DateUtil.getMontageDate(new Date(),1)); |
| | | } |
| | |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到保险方案"); |
| | | } |
| | | if(saveUnionChangeDTO.getBusinessType().equals(Constants.ZERO)){ |
| | | //根据申请日期 处理加减保的 实际生效日期 |
| | | if(Objects.nonNull(solutions.getAddValidDays())){ |
| | | saveUnionChangeDTO.setAddValidDate( |
| | | DateUtil.afterDateByType(saveUnionChangeDTO.getApplyDate(),0,solutions.getAddValidDays()) |
| | | ); |
| | | }else{ |
| | | saveUnionChangeDTO.setApplyDate(unionApply.getStartTime()); |
| | | |
| | | saveUnionChangeDTO.setAddValidDate(saveUnionChangeDTO.getApplyDate()); |
| | | } |
| | | if(Objects.nonNull(solutions.getDelValidDays())){ |
| | | saveUnionChangeDTO.setDelValidDate( |
| | | DateUtil.afterDateByType(saveUnionChangeDTO.getApplyDate(),0,solutions.getDelValidDays()) |
| | | ); |
| | | }else{ |
| | | saveUnionChangeDTO.setDelValidDate(saveUnionChangeDTO.getApplyDate()); |
| | | } |
| | | //根据申请日期 处理加减保的 实际生效日期 |
| | | // if(Objects.nonNull(solutions.getAddValidDays())){ |
| | | // saveUnionChangeDTO.setAddValidDate( |
| | | // DateUtil.afterDateByType(saveUnionChangeDTO.getApplyDate(),0,solutions.getAddValidDays()) |
| | | // ); |
| | | // }else{ |
| | | // saveUnionChangeDTO.setAddValidDate(saveUnionChangeDTO.getApplyDate()); |
| | | // } |
| | | // if(Objects.nonNull(solutions.getDelValidDays())){ |
| | | // saveUnionChangeDTO.setDelValidDate( |
| | | // DateUtil.afterDateByType(saveUnionChangeDTO.getApplyDate(),0,solutions.getDelValidDays()) |
| | | // ); |
| | | // }else{ |
| | | // saveUnionChangeDTO.setDelValidDate(saveUnionChangeDTO.getApplyDate()); |
| | | // } |
| | | //判断批单日期 合并单的批单生效期在为 保单起期的次日 到保单止期 |
| | | //获取开始日期次日 |
| | | if(saveUnionChangeDTO.getAddValidDate().getTime()<unionApply.getStartTime().getTime() |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"合并单的批单减保生效期错误"); |
| | | } |
| | | }else{ |
| | | if(saveUnionChangeDTO.getApplyDate().getTime()<DateUtil.afterDateByType(unionApply.getStartTime(),0,1).getTime() |
| | | || saveUnionChangeDTO.getApplyDate().getTime()> unionApply.getEndTime().getTime()){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"合并单的换厂生效期错误"); |
| | | } |
| | | // if(saveUnionChangeDTO.getApplyDate().getTime()<DateUtil.afterDateByType(unionApply.getStartTime(),0,1).getTime() |
| | | // || saveUnionChangeDTO.getApplyDate().getTime()> unionApply.getEndTime().getTime()){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"合并单的换厂生效期错误"); |
| | | // } |
| | | saveUnionChangeDTO.setApplyDate(unionApply.getStartTime()); |
| | | saveUnionChangeDTO.setAddValidDate(saveUnionChangeDTO.getApplyDate()); |
| | | } |
| | | |
| | |
| | | unionChange.setCreator(user.getId()); |
| | | unionChange.setEditDate(new Date()); |
| | | unionChange.setEditor(user.getId()); |
| | | if(Constants.equalsInteger(user.getType(),Constants.TWO)){ |
| | | unionChange.setShopId(user.getCompanyId()); |
| | | }else{ |
| | | unionChange.setShopId(saveUnionChangeDTO.getShopId()); |
| | | } |
| | | |
| | | unionChange.setIsdeleted(Constants.ZERO); |
| | | unionChange.setUnionApplyId(saveUnionChangeDTO.getUnionApplyId()); |
| | | unionChange.setApplyStartTime(DateUtil.getMontageDate(saveUnionChangeDTO.getAddValidDate(),1)); |
| | | unionChange.setDelValidTime(DateUtil.getMontageDate(saveUnionChangeDTO.getDelValidDate(),1)); |
| | | unionChange.setType(saveUnionChangeDTO.getBusinessType()); |
| | | // if(Constants.equalsInteger(solutions.getSignType(),Constants.ZERO)){ |
| | | // |
| | | // }else if(Constants.equalsInteger(solutions.getSignType(),Constants.ONE)){ |
| | | // unionChange.setStatus(Constants.UnionChangeStatus.MERGE.getKey()); |
| | | // }else{ |
| | | // unionChange.setStatus(Constants.UnionChangeStatus.UPLOAD_INSURANCE_POLICY.getKey()); |
| | | // } |
| | | unionChange.setStatus(Constants.UnionChangeStatus.MERGE.getKey()); |
| | | unionChangeMapper.insert(unionChange); |
| | | |
| | |
| | | } |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | user.setType(Constants.formatIntegerNum(user.getType())); |
| | | if(!user.getType().equals(Constants.TWO)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非商户用户,无法进行该操作!"); |
| | | if(!(Constants.equalsInteger(user.getType(),Constants.ZERO) || Constants.equalsInteger(user.getType(),Constants.TWO))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非商户平台用户,无法进行该操作!"); |
| | | } |
| | | UnionChange unionChange = unionChangeMapper.selectById(closeDTO.getId()); |
| | | if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){ |
| | |
| | | } |
| | | unionChange.setStatus(Constants.formatIntegerNum(unionChange.getStatus())); |
| | | unionChange.setShopId(Constants.formatIntegerNum(unionChange.getShopId())); |
| | | if(!unionChange.getShopId().equals(user.getCompanyId())){ |
| | | if(!(Constants.equalsInteger(user.getType(),Constants.ZERO)||unionChange.getShopId().equals(user.getCompanyId()))){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"对不起非您的合并单,您无法进行操作!"); |
| | | } |
| | | if(unionChange.getStatus().equals(Constants.UnionChangeStatus.FINISH.getKey())){ |
| | |
| | | .set(ApplyChange::getUnionChangeId,null) |
| | | .set(ApplyChange::getCheckDate,new Date()) |
| | | .set(ApplyChange::getCheckUserId,user.getId()) |
| | | .set(ApplyChange::getStatus,Constants.ApplyChangeStatus.CHECHED_PASSED.getKey()) |
| | | .set(ApplyChange::getStatus,Constants.ApplyChangeStatus.CLOSE.getKey()) |
| | | .in(ApplyChange::getUnionChangeId,unionChange.getId()) |
| | | ); |
| | | |
| | |
| | | if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | String companyName = ""; |
| | | String creditCode = ""; |
| | | String email = ""; |
| | | if(Constants.equalsInteger(user.getType(),Constants.TWO)){ |
| | | if(!unionChange.getShopId().equals(user.getCompanyId())){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"对不起非您的合并单,您无法进行操作!"); |
| | | } |
| | | Company company = companyMapper.selectById(user.getCompanyId()); |
| | | if(company== null || StringUtils.isBlank( company.getEmail()) || !Constants.equalsInteger(company.getSignStatus(),Constants.THREE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,企业尚未具备在线签章条件,请联系平台管理员确认~"); |
| | | } |
| | | companyName = company.getName(); |
| | | creditCode = company.getCode(); |
| | | email = company.getEmail(); |
| | | }else{ |
| | | companyName = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PLAT_COMPANY_NAME).getCode(); |
| | | creditCode = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PLAT_CREDIT_CODE).getCode(); |
| | | email = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PLAT_EMAIL).getCode(); |
| | | } |
| | | |
| | | if(unionChange.getStatus().equals(Constants.UnionChangeStatus.FINISH.getKey())){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"对不起,合并单业务已完结,您无法进行该操作!"); |
| | | } |
| | |
| | | if(!unionChange.getStatus().equals(Constants.UnionChangeStatus.MERGE.getKey())){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"对不起,合并单状态已流转"); |
| | | } |
| | | Company company = companyMapper.selectById(user.getCompanyId()); |
| | | if(company== null || StringUtils.isBlank( company.getEmail()) || !Constants.equalsInteger(company.getSignStatus(),Constants.THREE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,企业尚未具备在线签章条件,请联系平台管理员确认~"); |
| | | } |
| | | |
| | | |
| | | String fileUrl = null; |
| | | if(Constants.equalsObject(unionChange.getType(), Constants.ONE)){ |
| | | fileUrl = ExcelExporter.build(UnionChange.class).exportUnionChangeOtherUnitExcelToPdf(unionChange,"换厂申请表"); |
| | | }else{ |
| | | fileUrl = ExcelExporter.build(UnionChange.class).exportUnionChangeExcelToPdf(unionChange,"加减保申请表"); |
| | | } |
| | | // if(Constants.equalsObject(unionChange.getType(), Constants.ONE)){ |
| | | // fileUrl = ExcelExporter.build(UnionChange.class).exportUnionChangeOtherUnitExcelToPdf(unionChange,"换厂申请表"); |
| | | // }else{ |
| | | // fileUrl = ExcelExporter.build(UnionChange.class).exportUnionChangeExcelToPdf(unionChange,"加减保申请表"); |
| | | // } |
| | | String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode(); |
| | | notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",unionChange.getId().toString()); |
| | | String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"合并单(加减保/换厂)申请签署",company.getSignId(),notifyUrl); |
| | | // String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"合并单(加减保/换厂)申请签署",company.getSignId(),notifyUrl); |
| | | //临时使用 |
| | | fileUrl = "https://yybred.oss-cn-hangzhou.aliyuncs.com/apply/20241120/1c80f0d7-ab35-4355-b9fe-944464643115.pdf"; |
| | | String applyNo = signService.applySign(companyName,fileUrl,companyName,creditCode,email,"人员名单签章",null,notifyUrl); |
| | | if(StringUtils.isBlank(applyNo) ){ |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,获取在线签章地址失败,请稍后重试!"); |
| | | } |
| | | String link = signService.signLink(applyNo,company.getName(),company.getCode()); |
| | | String link = signService.signLink(applyNo,companyName,creditCode); |
| | | if(StringUtils.isBlank(link) ){ |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,获取在线签章地址失败,请稍后重试!"); |
| | | } |
| | |
| | | if(Objects.isNull(unionChangeBXDDTO) |
| | | || Objects.isNull(unionChangeBXDDTO.getId()) |
| | | || Objects.isNull(unionChangeBXDDTO.getApplyDate()) |
| | | || StringUtils.isBlank(unionChangeBXDDTO.getName()) |
| | | || StringUtils.isBlank(unionChangeBXDDTO.getFileurl()) |
| | | // || StringUtils.isBlank(unionChangeBXDDTO.getName()) |
| | | // || StringUtils.isBlank(unionChangeBXDDTO.getFileurl()) |
| | | || StringUtils.isBlank(unionChangeBXDDTO.getCode()) |
| | | || CollectionUtils.isEmpty(unionChangeBXDDTO.getPidanFileList()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | |
| | | unionChangeBXDDTO.setApplyId(unionChange.getUnionApplyId()); |
| | | unionChange.setStatus(Constants.formatIntegerNum(unionChange.getStatus())); |
| | | unionChange.setShopId(Constants.formatIntegerNum(unionChange.getShopId())); |
| | | if(!unionChange.getShopId().equals(user.getCompanyId())){ |
| | | if(Constants.equalsInteger(user.getType(),Constants.TWO) && !unionChange.getShopId().equals(user.getCompanyId())){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"对不起非您的合并单,您无法进行操作!"); |
| | | } |
| | | if(unionChange.getStatus().equals(Constants.UnionChangeStatus.FINISH.getKey())){ |
| | |
| | | .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId) |
| | | .eq(ApplyChange::getUnionChangeId,unionChange.getId())); |
| | | |
| | | List<Multifile> pidanFileList = unionChangeBXDDTO.getPidanFileList(); |
| | | for (Multifile pidanFile:pidanFileList) { |
| | | if(StringUtils.isBlank( pidanFile.getFileurl()) |
| | | ||StringUtils.isBlank( pidanFile .getName())) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"批单文件参数错误"); |
| | | } |
| | | pidanFile.setIsdeleted(Constants.ZERO); |
| | | pidanFile.setCreator(user.getId()); |
| | | pidanFile.setObjId(unionChange.getId()); |
| | | pidanFile.setCreateDate(new Date()); |
| | | pidanFile.setObjType(Constants.MultiFile.WTB_CA_DONE_PDF.getKey()); |
| | | pidanFile.setType(Constants.TWO); |
| | | } |
| | | multifileMapper.insertBatchSomeColumn(pidanFileList); |
| | | |
| | | for (ApplyChange applyChange:applyChangeList) { |
| | | for (Multifile pidanFile:pidanFileList) { |
| | | Multifile m = new Multifile(); |
| | | m.setId(null); |
| | | m.setIsdeleted(Constants.ZERO); |
| | | m.setCreator(user.getId()); |
| | | m.setCreateDate(new Date()); |
| | | m.setObjId(applyChange.getId()); |
| | | m.setFileurl(pidanFile.getFileurl()); |
| | | m.setName(pidanFile.getName()); |
| | | m.setObjType(Constants.MultiFile.CA_PD_PDF.getKey()); |
| | | m.setType(Constants.TWO); |
| | | multifileMapper.insert(m); |
| | | } |
| | | |
| | | } |
| | | |
| | | //存储合并单保险单 |
| | | Multifile multifile = new Multifile(); |
| | | /* Multifile multifile = new Multifile(); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setCreator(user.getId()); |
| | | multifile.setCreateDate(new Date()); |
| | |
| | | multifile.setType(Constants.TWO); |
| | | multifile.setFileurl(unionChangeBXDDTO.getFileurl()); |
| | | multifile.setName(unionChangeBXDDTO.getName()); |
| | | multifileMapper.insert(multifile); |
| | | multifileMapper.insert(multifile);*/ |
| | | |
| | | if(CollectionUtils.isNotEmpty(unionChangeBXDDTO.getApplyChangeBXDList())){ |
| | | //查询是否不存在当前合并单的数据 |
| | | if(applyChangeJoinMapper.selectCount(new QueryWrapper<ApplyChange>() |
| | | .lambda().ne(ApplyChange::getUnionChangeId,unionChangeBXDDTO.getId()) |
| | | .in(ApplyChange::getId, |
| | | unionChangeBXDDTO.getApplyChangeBXDList().stream().map(m->m.getObjId()).collect(Collectors.toList()) |
| | | ) |
| | | )>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"批单明细记录存在非本合并单数据"); |
| | | }; |
| | | for (Multifile m:unionChangeBXDDTO.getApplyChangeBXDList()) { |
| | | if(StringUtils.isBlank(m.getName()) |
| | | || StringUtils.isBlank(m.getFileurl()) ){ |
| | | continue; |
| | | } |
| | | if(Objects.isNull(m.getObjId()) |
| | | ||StringUtils.isBlank(m.getFileurl()) |
| | | ||StringUtils.isBlank(m.getName()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"批单文件信息缺失"); |
| | | } |
| | | m.setId(null); |
| | | m.setIsdeleted(Constants.ZERO); |
| | | m.setCreator(user.getId()); |
| | | m.setCreateDate(new Date()); |
| | | m.setObjType(Constants.MultiFile.CA_PD_PDF.getKey()); |
| | | m.setType(Constants.TWO); |
| | | multifileMapper.insert(m); |
| | | } |
| | | } |
| | | // if(CollectionUtils.isNotEmpty(unionChangeBXDDTO.getApplyChangeBXDList())){ |
| | | // //查询是否不存在当前合并单的数据 |
| | | // if(applyChangeJoinMapper.selectCount(new QueryWrapper<ApplyChange>() |
| | | // .lambda().ne(ApplyChange::getUnionChangeId,unionChangeBXDDTO.getId()) |
| | | // .in(ApplyChange::getId, |
| | | // unionChangeBXDDTO.getApplyChangeBXDList().stream().map(m->m.getObjId()).collect(Collectors.toList()) |
| | | // ) |
| | | // )>Constants.ZERO){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"批单明细记录存在非本合并单数据"); |
| | | // }; |
| | | // for (Multifile m:unionChangeBXDDTO.getApplyChangeBXDList()) { |
| | | // if(StringUtils.isBlank(m.getName()) |
| | | // || StringUtils.isBlank(m.getFileurl()) ){ |
| | | // continue; |
| | | // } |
| | | // if(Objects.isNull(m.getObjId()) |
| | | // ||StringUtils.isBlank(m.getFileurl()) |
| | | // ||StringUtils.isBlank(m.getName()) |
| | | // ){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"批单文件信息缺失"); |
| | | // } |
| | | // m.setId(null); |
| | | // m.setIsdeleted(Constants.ZERO); |
| | | // m.setCreator(user.getId()); |
| | | // m.setCreateDate(new Date()); |
| | | // m.setObjType(Constants.MultiFile.CA_PD_PDF.getKey()); |
| | | // m.setType(Constants.TWO); |
| | | // multifileMapper.insert(m); |
| | | // } |
| | | // } |
| | | if(CollectionUtils.isNotEmpty(applyChangeList)){ |
| | | for (ApplyChange applyChange:applyChangeList) { |
| | | ApplyChange oldModel = applyChange; |
| | |
| | | .eq(ApplyDetail::getMemberId, detail.getMemberId()) |
| | | .orderByDesc(ApplyDetail::getCreateDate) |
| | | .last("limit 1")); |
| | | if (oldModel == null || oldModel.getStartTime() == null || oldModel.getStartTime().getTime() > applyChange.getDelValidTime().getTime()) { |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,用户【" + detail.getMemberName() + "】当前批减日期不支持减保操作!"); |
| | | } |
| | | if(oldModel.getStartTime().getTime()>applyChange.getDelValidTime().getTime()||oldModel.getEndTime().getTime()<applyChange.getDelValidTime().getTime()){ |
| | | |
| | | // if (oldModel == null || oldModel.getStartTime() == null || oldModel.getStartTime().getTime() > applyChange.getDelValidTime().getTime()) { |
| | | // throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,用户【" + detail.getMemberName() + "】当前批减日期不支持减保操作!"); |
| | | // } |
| | | // if(oldModel.getStartTime().getTime()>applyChange.getDelValidTime().getTime()||oldModel.getEndTime().getTime()<applyChange.getDelValidTime().getTime()){ |
| | | // throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,批减日期未在用户【" + detail.getMemberName() + "】的保单日期内!"); |
| | | // } |
| | | |
| | | if(oldModel.getEndTime().getTime()<applyChange.getDelValidTime().getTime()){ |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,批减日期未在用户【" + detail.getMemberName() + "】的保单日期内!"); |
| | | } |
| | | |
| | | |
| | | BigDecimal fee = Objects.isNull(insuranceApply.getServerCost())? |
| | | solutions.getPrice(): |
| | |
| | | |
| | | // 减保后 批单日期 默认为 批单减保日期 00:00:00 |
| | | Date reduceDate = applyChange.getDelValidTime(); |
| | | |
| | | // 减保后 总费用 默认为减保后为 0 |
| | | BigDecimal reduceFee = BigDecimal.ZERO; |
| | | |
| | | //如果批单日期 大于 员工保单的开始日期 |
| | | if(applyChange.getDelValidTime().getTime() > oldModel.getStartTime().getTime()){ |
| | | if(reduceDate.getTime()>oldModel.getStartTime().getTime()){ |
| | | reduceDate = DateUtil.getMontageDate(oldModel.getStartTime(), 3); |
| | | }else{ |
| | | reduceDate = DateUtil.getMontageDate(applyChange.getDelValidTime(), 3); |
| | | } |
| | | //减保记录操作后的总费用 |
| | | reduceFee = Constants.reduceFee( |
| | | solutions,fee,insuranceApply.getStartTime(),insuranceApply.getFinalEndTime(),oldModel.getStartTime(),reduceDate) ; |
| | | } |
| | | |
| | | |
| | | BigDecimal pullFee = BigDecimal.ZERO; |
| | | if (oldModel.getStartTime().getTime() < System.currentTimeMillis()) { |
| | | //计算产生费用 |