| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import cn.hutool.core.util.IdcardUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | |
| | | private DuSolutionJoinMapper duSolutionJoinMapper; |
| | | @Autowired |
| | | private DuWorktypeMapper duWorktypeMapper; |
| | | @Autowired |
| | | private DuWorkTypeJoinMapper duWorkTypeJoinMapper; |
| | | |
| | | @Autowired |
| | | private NoticesMapper noticesMapper; |
| | |
| | | update.setCode(insuranceApply.getCode()); |
| | | update.setEndTime(actEndTime); |
| | | update.setStartTime(insuranceApply.getStartTime()); |
| | | CountCyclePriceDTO countCyclePriceDTO = new CountCyclePriceDTO(); |
| | | countCyclePriceDTO.setSolutionsId(model.getSolutionId()); |
| | | countCyclePriceDTO.setStartDate(insuranceApply.getStartTime()); |
| | | update.setFinalEndTime(this.getCountCyclePriceVO(countCyclePriceDTO).getEndDate()); |
| | | insuranceApplyMapper.updateById(update); |
| | | |
| | | //修改明细行的开始结束日期 |
| | | applyDetailMapper.update(null,new UpdateWrapper<ApplyDetail>().lambda().set(ApplyDetail::getStartTime,insuranceApply.getStartTime()) |
| | | .set(ApplyDetail::getEndTime,actEndTime).eq(ApplyDetail::getApplyId,model.getId())); |
| | | applyDetailMapper.update(null,new UpdateWrapper<ApplyDetail>().lambda() |
| | | .set(ApplyDetail::getStartTime,insuranceApply.getStartTime()) |
| | | .set(ApplyDetail::getEndTime,actEndTime) |
| | | .eq(ApplyDetail::getApplyId,model.getId())); |
| | | |
| | | multifileMapper.update(null,new UpdateWrapper<Multifile>().lambda() |
| | | .eq(Multifile::getIsdeleted,Constants.ZERO) |
| | |
| | | insuranceApply.getBaoxiandanFile().setType(Constants.TWO); |
| | | multifileMapper.insert(insuranceApply.getBaoxiandanFile()); |
| | | update.setBaoxiandanFile(insuranceApply.getBaoxiandanFile()); |
| | | |
| | | noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,Constants.NoticeObjectType.INSURANCE_APPLY.getKey()) |
| | | .ne(Notices::getType,Constants.NoticeType.SIX.getStatus()) |
| | | .eq(Notices::getObjId,insuranceApply.getId())); |
| | | |
| | | Constants.ApplyLogType applyLogType = Constants.ApplyLogType.UPLOAD_INSURANCE; |
| | | String info = ""; |
| | |
| | | memberInsuranceJoinMapper.insertBatchSomeColumn(memberInsuranceList); |
| | | } |
| | | |
| | | this.updateApplyCurrentFee(insuranceApply.getId(),null); |
| | | return 1; |
| | | } |
| | | |
| | |
| | | insuranceApply.setCheckUserId(loginUserInfo.getId()); |
| | | insuranceApply.setStatus(insuranceApplyStatus.getKey()); |
| | | insuranceApply.setUnionApplyTbdStatus(Constants.ZERO); |
| | | |
| | | CountCyclePriceDTO countCyclePriceDTO = new CountCyclePriceDTO(); |
| | | countCyclePriceDTO.setSolutionsId(insuranceApply.getSolutionId()); |
| | | countCyclePriceDTO.setStartDate(insuranceApply.getStartTime()); |
| | | CountCyclePriceVO countCyclePriceVO = this.getCountCyclePriceVO(countCyclePriceDTO); |
| | | insuranceApply.setApplyEndTime(countCyclePriceVO.getEndDate()); |
| | | insuranceApply.setEndTime(countCyclePriceVO.getEndDate()); |
| | | insuranceApply.setFinalEndTime(countCyclePriceVO.getEndDate()); |
| | | insuranceApplyMapper.insert(insuranceApply); |
| | | |
| | | |
| | | //处理下级数据 |
| | | this.dealApplyDetailData(insuranceApply,solutions,applyDetailList,loginUserInfo,countCyclePriceVO); |
| | | this.dealApplyDetailData(insuranceApply,solutions,applyDetailList,loginUserInfo,countCyclePriceVO,true); |
| | | InsuranceApply updBean = new InsuranceApply(); |
| | | updBean.setId(insuranceApply.getId()); |
| | | updBean.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | |
| | | noticesMapper.insert(shopNotices); |
| | | } |
| | | } |
| | | |
| | | return insuranceApply.getId(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | //处理下级数据 |
| | | this.dealApplyDetailData(insuranceApply,solutions,applyDetailList,loginUserInfo,countCyclePriceVO); |
| | | this.dealApplyDetailData(insuranceApply,solutions,applyDetailList,loginUserInfo,countCyclePriceVO,false); |
| | | insuranceApply.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | | insuranceApplyMapper.updateById(insuranceApply); |
| | | //存储日志数据 |
| | |
| | | |
| | | |
| | | |
| | | public void dealApplyDetailData(InsuranceApply insuranceApply,Solutions solutions,List<ApplyDetail> applyDetailList,LoginUserInfo loginUserInfo,CountCyclePriceVO countCyclePriceVO){ |
| | | public void dealApplyDetailData(InsuranceApply insuranceApply,Solutions solutions,List<ApplyDetail> applyDetailList, |
| | | LoginUserInfo loginUserInfo,CountCyclePriceVO countCyclePriceVO,Boolean checkNewData){ |
| | | //查询保险方案下的所有派遣单位 |
| | | List<DuSolution> duSolutionList = duSolutionJoinMapper.selectJoinList(DuSolution.class,new MPJLambdaWrapper<DuSolution>() |
| | | .selectAll(DuSolution.class) |
| | |
| | | .eq(DispatchUnit::getIsdeleted,Constants.ZERO) |
| | | .eq(DispatchUnit::getUnitStatus,Constants.ONE) |
| | | .eq(DuSolution::getIsdeleted,Constants.ZERO) |
| | | .eq(checkNewData,DispatchUnit::getDataType,Constants.TWO) |
| | | .eq(DuSolution::getStatus,Constants.ONE) |
| | | .eq(DuSolution::getSolutionId,insuranceApply.getSolutionId())); |
| | | .eq(DuSolution::getSolutionId,insuranceApply.getSolutionId()) |
| | | .apply(" t1.BASE_ID in ( select du.id from dispatch_unit du where du.STATUS = 0 and du.ISDELETED = 0 ) ") |
| | | ); |
| | | if(!CollectionUtils.isNotEmpty(duSolutionList)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"数据异常:保险方案下未查询到派遣单位"); |
| | | } |
| | | //查询所有派遣单位下的工种 |
| | | List<Integer> duSolutionIdList = duSolutionList.stream().map(i->i.getId()).collect(Collectors.toList()); |
| | | List<DuWorktype> duWorktypeList = duWorktypeMapper.selectList(new QueryWrapper<DuWorktype>().lambda() |
| | | List<DuWorktype> duWorktypeList = duWorkTypeJoinMapper.selectJoinList(DuWorktype.class,new MPJLambdaWrapper<DuWorktype>() |
| | | .selectAll(DuWorktype.class) |
| | | .innerJoin(Worktype.class,Worktype::getId,DuWorktype::getWorkTypeId) |
| | | .eq(DuWorktype::getIsdeleted,Constants.ZERO) |
| | | .eq(DuWorktype::getStatus,Constants.ONE) |
| | | .eq(checkNewData,Worktype::getDataType,Constants.TWO) |
| | | .in(DuWorktype::getDuSolutionId,duSolutionIdList)); |
| | | if(!CollectionUtils.isNotEmpty(duWorktypeList)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"数据异常:保险方案下未查询到工种信息"); |
| | |
| | | member.setName(applyDetail.getMemberName()); |
| | | member.setCompanyId(insuranceApply.getCompanyId()); |
| | | member.setSex(Constants.getSexByIdCard(applyDetail.getIdcardNo())); |
| | | if(!IdcardUtil.isValidCard(applyDetail.getIdcardNo())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"投保员工信息身份证信息错误["+member.getName()+"]"); |
| | | } |
| | | member.setIdcardNo(applyDetail.getIdcardNo()); |
| | | member.setApplyId(insuranceApply.getId()); |
| | | member.setStartTime(applyDetail.getStartTime()); |
| | | member.setEndTime(applyDetail.getEndTime()); |
| | | member.setDuId(applyDetail.getDuId()); |
| | | member.setWorktypeId(applyDetail.getWorktypeId()); |
| | | |
| | | memberMapper.insert(member); |
| | | }else{ |
| | | member.setApplyId(insuranceApply.getId()); |
| | |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | public void updateApplyCurrentFee(Integer id){ |
| | | public void updateApplyCurrentFee(Integer id,Integer unionId){ |
| | | List<InsuranceApply> insuranceApplyList = insuranceApplyJoinMapper.selectJoinList(InsuranceApply.class,new MPJLambdaWrapper<InsuranceApply>() |
| | | .selectAll(InsuranceApply.class) |
| | | .eq(InsuranceApply::getIsdeleted,Constants.ZERO) |
| | | .in(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey(),Constants.InsuranceApplyStatus.WTB_TOUBAOING.getKey()) |
| | | .in(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey(),Constants.InsuranceApplyStatus.WTB_DONE.getKey()) |
| | | .eq(!Objects.isNull(id),InsuranceApply::getId,id) |
| | | .eq(!Objects.isNull(unionId),InsuranceApply::getUnionApplyId,unionId) |
| | | .le(InsuranceApply::getStartTime,DateUtil.getDate(new Date(),"yyyy-MM-dd") + " 00:00:00") |
| | | .ge(InsuranceApply::getEndTime,DateUtil.getDate(new Date(),"yyyy-MM-dd") + " 23:59:59") |
| | | ); |
| | | |
| | | if(CollectionUtils.isNotEmpty(insuranceApplyList)){ |
| | | for (InsuranceApply insuranceApply:insuranceApplyList) { |
| | | // Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); |
| | | // if(Objects.isNull(solutions)){ |
| | | // continue; |
| | | // } |
| | | Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); |
| | | if(Objects.isNull(solutions)){ |
| | | continue; |
| | | } |
| | | BigDecimal sumAmount = BigDecimal.ZERO; |
| | | List<ApplyDetail> applyDetailList = applyDetailMapper |
| | | .selectList(new QueryWrapper<ApplyDetail>().lambda() |
| | | .eq(ApplyDetail::getApplyId,insuranceApply.getId())); |
| | | if(CollectionUtils.isNotEmpty(applyDetailList)){ |
| | | for (ApplyDetail applyDetail: applyDetailList) { |
| | | //2024-1-30 10:04:24 修改 根据实际天数进行计算 当前费用 总金额/总天数*实际天数 |
| | | // Integer maxDays = DateUtil.calculateBetween(applyDetail.getStartTime(),applyDetail.getEndTime(),0); |
| | | BigDecimal fee = applyDetail.getFee(); |
| | | BigDecimal fee = Objects.isNull(insuranceApply.getServerCost())? |
| | | solutions.getPrice(): |
| | | solutions.getPrice().add(insuranceApply.getServerCost()); |
| | | //在开始结束日期之间 |
| | | if(applyDetail.getStartTime().compareTo(new Date()) <= 0 && applyDetail.getEndTime().compareTo(new Date()) >= 0 ){ |
| | | Integer days = DateUtil.calculateBetween(applyDetail.getStartTime(),new Date(),0); |
| | | applyDetail.setCurrentFee(new BigDecimal(days).multiply(applyDetail.getPrice())); |
| | | //applyDetail.setCurrentFee(fee.divide(BigDecimal.valueOf(maxDays),2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(days))); |
| | | applyDetail.setCurrentFee(Constants.produceFee(solutions,fee,insuranceApply.getStartTime(),insuranceApply.getFinalEndTime(),applyDetail.getStartTime())); |
| | | applyDetailMapper.updateById(applyDetail); |
| | | }else if(applyDetail.getStartTime().compareTo(new Date()) <= 0&&applyDetail.getEndTime().compareTo(new Date()) <= 0){ |
| | | applyDetail.setCurrentFee(fee); |
| | | }else if(applyDetail.getStartTime().compareTo(new Date()) <= 0&&applyDetail.getEndTime().compareTo(new Date()) <= 0){ |
| | | //在结束日期之后 |
| | | applyDetail.setCurrentFee(applyDetail.getFee()); |
| | | applyDetailMapper.updateById(applyDetail); |
| | | } |
| | | sumAmount = sumAmount.add(applyDetail.getCurrentFee()); |
| | |
| | | insuranceApplyMapper.updateById(insuranceApply); |
| | | } |
| | | } |
| | | // if(1==1){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED); |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | public String getSignTBQRSLink(SmsCheckDTO smsCheckDTO) { |
| | | if(Objects.isNull(smsCheckDTO) |
| | | || Objects.isNull(smsCheckDTO.getBusinessId()) |
| | | || StringUtils.isBlank(smsCheckDTO.getCode()) |
| | | // || StringUtils.isBlank(smsCheckDTO.getCode()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(!debugModel){ |
| | | smsEmailService.validateCode(smsCheckDTO.getCode()); |
| | | } |
| | | // if(!debugModel){ |
| | | // smsEmailService.validateCode(smsCheckDTO.getCode()); |
| | | // } |
| | | MPJLambdaWrapper wrapper= new MPJLambdaWrapper<InsuranceApply>() |
| | | .selectAll(InsuranceApply.class) |
| | | .selectAs(Solutions::getSignKeyword,InsuranceApply::getSignKeyword) |
| | |
| | | public String getMemberListOnlineSignLink(SmsCheckDTO smsCheckDTO) { |
| | | if(Objects.isNull(smsCheckDTO) |
| | | || Objects.isNull(smsCheckDTO.getBusinessId()) |
| | | || StringUtils.isBlank(smsCheckDTO.getCode()) |
| | | // || StringUtils.isBlank(smsCheckDTO.getCode()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | //验证 验证码 |
| | | if(!debugModel){ |
| | | smsEmailService.validateCode(smsCheckDTO.getCode()); |
| | | } |
| | | // if(!debugModel){ |
| | | // smsEmailService.validateCode(smsCheckDTO.getCode()); |
| | | // } |
| | | InsuranceApply model = this.queryApplyDetail(smsCheckDTO.getBusinessId()); |
| | | if(Objects.isNull(model)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询保单信息"); |
| | |
| | | public String getSignWTBTBDLink(SmsCheckDTO smsCheckDTO) { |
| | | if(Objects.isNull(smsCheckDTO) |
| | | || Objects.isNull(smsCheckDTO.getBusinessId()) |
| | | || StringUtils.isBlank(smsCheckDTO.getCode()) |
| | | // || StringUtils.isBlank(smsCheckDTO.getCode()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | //验证 验证码 |
| | | if(!debugModel){ |
| | | smsEmailService.validateCode(smsCheckDTO.getCode()); |
| | | } |
| | | // if(!debugModel){ |
| | | // smsEmailService.validateCode(smsCheckDTO.getCode()); |
| | | // } |
| | | MPJLambdaWrapper wrapper= new MPJLambdaWrapper<InsuranceApply>() |
| | | .selectAll(InsuranceApply.class) |
| | | .selectAs(Solutions::getSignKeyword,InsuranceApply::getSignKeyword) |