| | |
| | | |
| | | @Autowired |
| | | private MemberInsuranceJoinMapper memberInsuranceJoinMapper; |
| | | @Autowired |
| | | private MemberMapper memberMapper; |
| | | @Value("${debug_model}") |
| | | private boolean debugModel; |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | Integer maxDays = DateUtil.calculateBetween(saveUnionApplyDTO.getStartDate(),saveUnionApplyDTO.getEndDate(),0); |
| | | |
| | | List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda().select(ApplyDetail::getId,ApplyDetail::getPrice) |
| | | List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda() |
| | | .select(ApplyDetail::getId,ApplyDetail::getPrice,ApplyDetail::getStartTime,ApplyDetail::getEndTime,ApplyDetail::getFee) |
| | | .in(ApplyDetail::getApplyId,saveUnionApplyDTO.getApplyIds()) |
| | | .eq(ApplyDetail::getIsdeleted,Constants.ZERO)); |
| | | if(applyDetailList.size()==0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,存在委托投保申请记录信息有误,请返回查看申请人员是否为空!"); |
| | | } |
| | | unionApply.setFee(applyDetailList.stream().map(i->Constants.formatBigdecimal(i.getPrice()).multiply(new BigDecimal(maxDays))).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | | BigDecimal fee = BigDecimal.ZERO; |
| | | for (ApplyDetail applyDetail:applyDetailList) { |
| | | Integer oldDays = DateUtil.calculateBetween(applyDetail.getStartTime(),applyDetail.getEndTime(),0); |
| | | fee =fee.add(new BigDecimal(maxDays).multiply( applyDetail.getFee()).divide(new BigDecimal(oldDays),2,RoundingMode.HALF_UP)); |
| | | } |
| | | unionApply.setFee(fee); |
| | | |
| | | // unionApply.setFee(applyDetailList.stream() |
| | | // .map(i->Constants.formatBigdecimal(i.getPrice()).multiply(new BigDecimal(maxDays))).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | | |
| | | unionApplyMapper.insert(unionApply); |
| | | |
| | |
| | | if(CollectionUtils.isNotEmpty(uploadMultifileDTO.getMultifileList())){ |
| | | List<Multifile> multifileList = uploadMultifileDTO.getMultifileList(); |
| | | for (Multifile multifile:multifileList) { |
| | | if(StringUtils.isBlank(multifile.getName()) |
| | | || StringUtils.isBlank(multifile.getFileurl()) ){ |
| | | continue; |
| | | } |
| | | if(Objects.isNull(multifile.getObjId()) |
| | | ||Objects.isNull(multifile.getName()) |
| | | ||Objects.isNull(multifile.getFileurl())){ |
| | |
| | | List<UnionApplyBXDDetailDTO> unionApplyBXDDetailDTOList = unionApplyBXDDTO.getUnionApplyBXDDDetailDTOList(); |
| | | |
| | | //所有投保申请保单明细行 |
| | | List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda() |
| | | .select(ApplyDetail::getId,ApplyDetail::getApplyId,ApplyDetail::getPrice) |
| | | List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectJoinList(ApplyDetail.class,new MPJLambdaWrapper<ApplyDetail>() |
| | | .selectAll(ApplyDetail.class) |
| | | .selectAs(DispatchUnit::getName,ApplyDetail::getDuName) |
| | | .selectAs(InsuranceApply::getCode,ApplyDetail::getApplyCode) |
| | | .selectAs(Solutions::getId,ApplyDetail::getSolutionId) |
| | | .selectAs(Solutions::getName,ApplyDetail::getSolutionName) |
| | | .selectAs(Worktype::getName,ApplyDetail::getWorkTypeName) |
| | | .selectAs(Member::getIdcardNo,ApplyDetail::getIdcardNo) |
| | | .selectAs(Member::getName,ApplyDetail::getMemberName) |
| | | .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId) |
| | | .leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId) |
| | | .leftJoin(Member.class,Member::getId,ApplyDetail::getMemberId) |
| | | .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId) |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .in(ApplyDetail::getUnionApplyId,unionApply.getId())); |
| | | unionApplyBXDDTO.setEndTime(DateUtil.getMontageDate(unionApplyBXDDTO.getEndTime(),2)); |
| | | //总天数 |
| | |
| | | |
| | | Optional<UnionApplyBXDDetailDTO> unionApplyBXDDDetailTO= unionApplyBXDDetailDTOList.stream().filter( |
| | | m->m.getApplyId().equals(insuranceApply.getId())).findFirst(); |
| | | BigDecimal serverCost = BigDecimal.ZERO; |
| | | if(unionApplyBXDDDetailTO.isPresent()){ |
| | | UnionApplyBXDDetailDTO unionApplyBXDDetailDTO = unionApplyBXDDDetailTO.get(); |
| | | |
| | | serverCost = unionApplyBXDDetailDTO.getServerMoney(); |
| | | BigDecimal dayServerMoney = unionApplyBXDDetailDTO.getServerMoney().divide(new BigDecimal(maxDays),2, RoundingMode.HALF_UP); |
| | | |
| | | price = Constants.formatBigdecimal(price).add(Constants.formatBigdecimal(dayServerMoney)); |
| | |
| | | .filter(m->Constants.equalsInteger(m.getApplyId(),(insuranceApply.getId()))).collect(Collectors.toList())) { |
| | | applyDetail.setPrice(price); |
| | | applyDetail.setFee(price.multiply(new BigDecimal(maxDays))); |
| | | applyDetail.setStartTime(unionApplyBXDDTO.getStartTime()); |
| | | applyDetail.setEndTime(unionApplyBXDDTO.getEndTime()); |
| | | MemberInsurance memberInsurance = new MemberInsurance(applyDetail,user.getId()); |
| | | memberInsurance.setBdCode(unionApplyBXDDTO.getCode()); |
| | | memberInsurance.setRelationType(Constants.ZERO); |
| | | memberInsuranceList.add(memberInsurance); |
| | | //更新员工投保时间 |
| | | memberMapper.update(null,new UpdateWrapper<Member>() |
| | | .lambda() |
| | | .set(Member::getStartTime,memberInsurance.getStartTime()) |
| | | .set(Member::getEndTime,memberInsurance.getEndTime()) |
| | | .set(Member::getDuId,memberInsurance.getDuId()) |
| | | .set(Member::getWorktypeId,memberInsurance.getWorktypeId()) |
| | | .eq(Member::getId, memberInsurance.getMemberId()) |
| | | ); |
| | | |
| | | } |
| | | memberInsuranceJoinMapper.insertBatchSomeColumn(memberInsuranceList); |
| | | } |
| | |
| | | .set(InsuranceApply::getEndTime,unionApplyBXDDTO.getEndTime()) |
| | | .set(InsuranceApply::getEditDate,new Date()) |
| | | .set(InsuranceApply::getEditor,user.getId()) |
| | | .set(InsuranceApply::getServerCost,serverCost) |
| | | .set(InsuranceApply::getCode,unionApplyBXDDTO.getCode()) |
| | | .eq(InsuranceApply::getId,insuranceApply.getId())); |
| | | //更新投保单明细金额 |