| | |
| | | import com.doumee.dao.business.dto.CountCyclePriceDTO; |
| | | import com.doumee.dao.business.dto.InsuranceApplyOptDTO; |
| | | import com.doumee.dao.business.dto.InsuranceApplyQueryDTO; |
| | | import com.doumee.dao.business.join.ApplyDetailJoinMapper; |
| | | import com.doumee.dao.business.join.ApplyLogJoinMapper; |
| | | import com.doumee.dao.business.join.DuSolutionJoinMapper; |
| | | import com.doumee.dao.business.join.InsuranceApplyJoinMapper; |
| | | import com.doumee.dao.business.join.*; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.business.vo.CountCyclePriceVO; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | |
| | | private InsuranceApplyJoinMapper insuranceApplyJoinMapper; |
| | | @Autowired |
| | | private CompanyMapper companyMapper; |
| | | @Autowired |
| | | private MemberInsuranceJoinMapper memberInsuranceJoinMapper; |
| | | |
| | | @Autowired |
| | | private ApplyDetailMapper applyDetailMapper; |
| | |
| | | } |
| | | ApplyLog log = new ApplyLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update)); |
| | | applyLogMapper.insert(log); |
| | | |
| | | |
| | | //存储员工信息投保记录 |
| | | //查询单据明细记录 |
| | | MPJLambdaWrapper<ApplyDetail> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper.selectAll(ApplyDetail.class); |
| | | queryWrapper.selectAs(DispatchUnit::getName,ApplyDetail::getDuName); |
| | | queryWrapper.selectAs(InsuranceApply::getCode,ApplyDetail::getApplyCode); |
| | | queryWrapper.selectAs(Solutions::getId,ApplyDetail::getSolutionId); |
| | | queryWrapper.selectAs(Solutions::getName,ApplyDetail::getSolutionName); |
| | | queryWrapper.selectAs(Worktype::getName,ApplyDetail::getWorkTypeName); |
| | | queryWrapper.selectAs(Member::getIdcardNo,ApplyDetail::getIdcardNo); |
| | | queryWrapper.selectAs(Member::getName,ApplyDetail::getMemberName); |
| | | queryWrapper.leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId); |
| | | queryWrapper.leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId); |
| | | queryWrapper.leftJoin(Member.class,Member::getId,ApplyDetail::getMemberId); |
| | | queryWrapper.leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId); |
| | | queryWrapper.leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId); |
| | | queryWrapper.eq(ApplyDetail::getApplyId,insuranceApply.getId()); |
| | | List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectJoinList(ApplyDetail.class,queryWrapper); |
| | | |
| | | if(CollectionUtils.isNotEmpty(applyDetailList)){ |
| | | List<MemberInsurance> memberInsuranceList = new ArrayList<>(); |
| | | for (ApplyDetail applyDetail:applyDetailList) { |
| | | MemberInsurance memberInsurance = new MemberInsurance(applyDetail,user.getId()); |
| | | memberInsuranceList.add(memberInsurance); |
| | | } |
| | | memberInsuranceJoinMapper.insertBatchSomeColumn(memberInsuranceList); |
| | | } |
| | | |
| | | return 1; |
| | | |
| | | } |
| | |
| | | info = info.replace("${param}", update.getCheckInfo()); |
| | | ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update)); |
| | | applyLogMapper.insert(log); |
| | | |
| | | return 1; |
| | | |
| | | } |
| | |
| | | insuranceApply.setCompanyId(loginUserInfo.getCompanyId()); |
| | | insuranceApply.setCheckInfo(insuranceApplyStatus.getName()); |
| | | insuranceApply.setStartTime(insuranceApply.getApplyStartTime()); |
| | | insuranceApply.setEndTime(insuranceApply.getApplyEndTime()); |
| | | insuranceApply.setCheckDate(new Date()); |
| | | insuranceApply.setCurrentFee(BigDecimal.ZERO); |
| | | insuranceApply.setCheckUserId(loginUserInfo.getId()); |
| | | insuranceApply.setStatus(insuranceApplyStatus.getKey()); |
| | | |
| | | 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()); |
| | | insuranceApplyMapper.insert(insuranceApply); |
| | | |
| | | |
| | | //处理下级数据 |
| | | this.dealApplyDetailData(insuranceApply,applyDetailList,loginUserInfo); |
| | | this.dealApplyDetailData(insuranceApply,applyDetailList,loginUserInfo,countCyclePriceVO); |
| | | InsuranceApply updBean = new InsuranceApply(); |
| | | updBean.setId(insuranceApply.getId()); |
| | | updBean.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | |
| | | insuranceApply.setCompanyId(loginUserInfo.getCompanyId()); |
| | | insuranceApply.setCheckInfo(insuranceApplyStatus.getName()); |
| | | insuranceApply.setStartTime(insuranceApply.getApplyStartTime()); |
| | | insuranceApply.setEndTime(insuranceApply.getApplyEndTime()); |
| | | insuranceApply.setCheckDate(new Date()); |
| | | insuranceApply.setCurrentFee(BigDecimal.ZERO); |
| | | insuranceApply.setCheckUserId(loginUserInfo.getId()); |
| | | insuranceApply.setStatus(insuranceApplyStatus.getKey()); |
| | | |
| | | 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()); |
| | | |
| | | applyDetailMapper.delete(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getApplyId,insuranceApply.getId())); |
| | | //处理下级数据 |
| | | this.dealApplyDetailData(insuranceApply,applyDetailList,loginUserInfo); |
| | | this.dealApplyDetailData(insuranceApply,applyDetailList,loginUserInfo,countCyclePriceVO); |
| | | insuranceApply.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | | insuranceApplyMapper.updateById(insuranceApply); |
| | | //存储日志数据 |
| | |
| | | |
| | | |
| | | |
| | | public void dealApplyDetailData(InsuranceApply insuranceApply,List<ApplyDetail> applyDetailList,LoginUserInfo loginUserInfo){ |
| | | public void dealApplyDetailData(InsuranceApply insuranceApply,List<ApplyDetail> applyDetailList,LoginUserInfo loginUserInfo,CountCyclePriceVO countCyclePriceVO){ |
| | | Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"未查询到方案信息"); |
| | |
| | | applyDetail.setMemberId(member.getId()); |
| | | applyDetail.setIdcardNo(member.getIdcardNo()); |
| | | applyDetail.setSex(member.getSex()); |
| | | applyDetail.setFee(Constants.countDetailFee(solutions,insuranceApply.getApplyEndTime(),insuranceApply.getApplyStartTime())); |
| | | applyDetail.setFee(countCyclePriceVO.getCyclePrice()); |
| | | //验证派遣单位信息是否存在 |
| | | if(duSolutionList.stream().filter(d->d.getDispatchUnitId().equals(applyDetail.getDuId())).collect(Collectors.toList()).size()<=Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+"】员工派遣单位未查询到!"); |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public CountCyclePriceVO getCountCyclePriceVO(CountCyclePriceDTO countCyclePriceDTO){ |
| | | if(Objects.isNull(countCyclePriceDTO) |
| | |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询方案信息"); |
| | | } |
| | | CountCyclePriceVO countCyclePriceVO = new CountCyclePriceVO(); |
| | | if(solutions.getInsureCycleUnit().equals(Constants.ZERO)){ |
| | | countCyclePriceVO.setEndDate(DateUtil.afterDateByType(countCyclePriceDTO.getStartDate(),0,solutions.getInsureCycle())); |
| | | }else if(solutions.getInsureCycleUnit().equals(Constants.TWO)){ |
| | | Integer monthDays = DateUtil.monthDays(countCyclePriceDTO.getStartDate()); |
| | | Date afterDate = DateUtil.afterDateByType(countCyclePriceDTO.getStartDate(),0,monthDays); |
| | | countCyclePriceVO.setEndDate(DateUtil.afterDateByType(afterDate,0,-1)); |
| | | }else if(solutions.getInsureCycleUnit().equals(Constants.THREE)){ |
| | | Date afterDate = DateUtil.afterDateByType(countCyclePriceDTO.getStartDate(),2,solutions.getInsureCycle()); |
| | | countCyclePriceVO.setEndDate(DateUtil.afterDateByType(afterDate,0,-1)); |
| | | } |
| | | countCyclePriceVO.setCyclePrice(Constants.countDetailFee(solutions,countCyclePriceVO.getEndDate(),countCyclePriceDTO.getStartDate())); |
| | | return countCyclePriceVO; |
| | | return Constants.countPriceVO(countCyclePriceDTO.getStartDate(),solutions); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |