| | |
| | | if(CollectionUtils.isNotEmpty(applyDetailList)){ |
| | | List<MemberInsurance> memberInsuranceList = new ArrayList<>(); |
| | | for (ApplyDetail applyDetail:applyDetailList) { |
| | | |
| | | //查询人员信息是否存在相同的方案下是否存在 冲突数据 |
| | | this.checkMemberSolution(applyDetail.getSolutionId(),applyDetail.getIdcardNo(),applyDetail.getMemberName(),update.getStartTime(),update.getEndTime()); |
| | | |
| | | MemberInsurance memberInsurance = new MemberInsurance(applyDetail,user.getId()); |
| | | memberInsurance.setRelationType(Constants.ZERO); |
| | | memberInsuranceList.add(memberInsurance); |
| | |
| | | member.setWorktypeId(applyDetail.getWorktypeId()); |
| | | addMemberList.add(member); |
| | | } |
| | | //查询人员信息是否存在相同的方案下是否存在 冲突数据 |
| | | this.checkMemberSolution(solutions.getId(),member.getIdcardNo(),member.getName(),insuranceApply.getStartTime(),insuranceApply.getEndTime()); |
| | | } |
| | | if(CollectionUtils.isNotEmpty(addMemberList)){ |
| | | memberJoinMapper.insertBatchSomeColumn(addMemberList); |
| | |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,投保员工信息数据缺失,请按照要求填写员工的有效信息!"); |
| | | } |
| | | applyDetail.setChangeStatus(Constants.ZERO); |
| | | applyDetail.setCreateDate(new Date()); |
| | | applyDetail.setCreator(loginUserInfo.getId()); |
| | | applyDetail.setIsdeleted(Constants.ZERO); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询 会员信息在方案下是否存在冲突数据 |
| | | * @param solutionId |
| | | * @param startTime |
| | | * @param endTime |
| | | */ |
| | | @Override |
| | | public void checkMemberSolution(Integer solutionId,String idCode,String memberName,Date startTime,Date endTime){ |
| | | try { |
| | | List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectJoinList(ApplyDetail.class, |
| | | new MPJLambdaWrapper<ApplyDetail>() |
| | | .selectAll(ApplyDetail.class) |
| | | .selectAs(InsuranceApply::getCode,ApplyDetail::getApplyCode) |
| | | .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId) |
| | | .eq(ApplyDetail::getIdcardNo,idCode) |
| | | .eq(InsuranceApply::getSolutionId,solutionId) |
| | | .notIn(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD |
| | | ,Constants.InsuranceApplyStatus.PLATFORM_RETURN |
| | | ,Constants.InsuranceApplyStatus.FAIL_RETURN |
| | | ,Constants.InsuranceApplyStatus.CLOSE |
| | | ,Constants.InsuranceApplyStatus.WTB_RETURN |
| | | ,Constants.InsuranceApplyStatus.WTB_CLOSED ) |
| | | .apply(" ( " + |
| | | " '"+DateUtil.getPlusTime(startTime)+"' <= t.start_time AND t.start_time < '"+DateUtil.getPlusTime(endTime)+"' " + |
| | | " or " + |
| | | " ( '"+DateUtil.getPlusTime(startTime)+"' < t.end_time AND t.end_time < '"+DateUtil.getPlusTime(endTime)+"' ) " + |
| | | " or " + |
| | | " ( '"+DateUtil.getPlusTime(startTime)+"' > t.start_time AND '"+DateUtil.getPlusTime(endTime)+"' < t.end_time )" + |
| | | " ) " )); |
| | | if(applyDetailList.size() >Constants.ZERO){ |
| | | ApplyDetail applyDetail = applyDetailList.get(Constants.ZERO); |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"该用户【"+memberName+" "+idCode+"】在保单【"+applyDetail.getApplyCode()+"】下已存在与本次提报冲突的日期"); |
| | | }; |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | } |
| | | |
| | | public static void checkStaticMemberSolution(Integer solutionId,String idCode,String memberName,Date startTime,Date endTime,ApplyDetailJoinMapper applyDetailJoinMapper){ |
| | | try { |
| | | List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectJoinList(ApplyDetail.class, |
| | | new MPJLambdaWrapper<ApplyDetail>() |
| | | .selectAll(ApplyDetail.class) |
| | | .selectAs(InsuranceApply::getCode,ApplyDetail::getApplyCode) |
| | | .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId) |
| | | .eq(ApplyDetail::getIdcardNo,idCode) |
| | | .eq(InsuranceApply::getSolutionId,solutionId) |
| | | .notIn(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD |
| | | ,Constants.InsuranceApplyStatus.PLATFORM_RETURN |
| | | ,Constants.InsuranceApplyStatus.FAIL_RETURN |
| | | ,Constants.InsuranceApplyStatus.CLOSE |
| | | ,Constants.InsuranceApplyStatus.WTB_RETURN |
| | | ,Constants.InsuranceApplyStatus.WTB_CLOSED ) |
| | | .apply(" ( " + |
| | | " '"+DateUtil.getPlusTime(startTime)+"' <= t.start_time AND t.start_time < '"+DateUtil.getPlusTime(endTime)+"' " + |
| | | " or " + |
| | | " ( '"+DateUtil.getPlusTime(startTime)+"' < t.end_time AND t.end_time < '"+DateUtil.getPlusTime(endTime)+"' ) " + |
| | | " or " + |
| | | " ( '"+DateUtil.getPlusTime(startTime)+"' > t.start_time AND '"+DateUtil.getPlusTime(endTime)+"' < t.end_time )" + |
| | | " ) " )); |
| | | if(applyDetailList.size() >Constants.ZERO){ |
| | | ApplyDetail applyDetail = applyDetailList.get(Constants.ZERO); |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"该用户【"+memberName+" "+idCode+"】在保单【"+applyDetail.getApplyCode()+"】下已存在与本次提报冲突的日期"); |
| | | }; |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id) { |
| | |
| | | queryWrapper.selectAs(Solutions::getTimeUnit,InsuranceApply::getTimeUnit); |
| | | queryWrapper.select(" DATEDIFF( t.END_TIME ,now() ) AS loseEfficacyDays "); |
| | | queryWrapper.select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad where ad.apply_id = t.id ) as insureNum"); |
| | | queryWrapper.select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad where ad.apply_id = t.id and ad.END_TIME > now() ) as guaranteeNum"); |
| | | queryWrapper.select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad inner join insurance_apply a on ad.apply_id = a.id and a.status in ( 5 , 27 ) where ad.apply_id = t.id and ad.END_TIME > now() ) as guaranteeNum"); |
| | | if(!Objects.isNull(pageWrap.getModel())&&!Objects.isNull(pageWrap.getModel().getType())){ |
| | | queryWrapper.select(" ifnull(( select sum(td.fee) from taxes ts inner join tax_detial td on td.TAX_ID = ts.id where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id ),0) as taxesMoney"); |
| | | queryWrapper.select(" ( select td.CREATE_DATE from taxes ts inner join tax_detial td on td.TAX_ID = ts.id where ts.status = 1 and td.INSURANCE_APPLY_ID = t.id order by td.CREATE_DATE desc limit 1 ) as taxesLast "); |
| | |
| | | queryWrapper.selectAs(Solutions::getName,InsuranceApply::getSolutionsName); |
| | | queryWrapper.selectAs(Solutions::getType,InsuranceApply::getSolutionType); |
| | | queryWrapper.select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad where ad.apply_id = t.id ) as insureNum"); |
| | | queryWrapper.select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad inner join insurance_apply a on ad.apply_id = a.id and a.status in ( 5 , 27 ) where ad.apply_id = t.id and ad.END_TIME > now() ) as guaranteeNum"); |
| | | queryWrapper.select(" ( select max(ac.APPLY_START_TIME) from apply_change ac where ac.apply_id = t.id and ac.status = 2 ) as lastChangeDate"); |
| | | queryWrapper.select(" ( select sum(td.fee) from taxes ts inner join tax_detial td on td.TAX_ID = ts.id where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id ) as taxesMoney "); |
| | | queryWrapper.select(" ( select td.CREATE_DATE from taxes ts inner join tax_detial td on td.TAX_ID = ts.id where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id order by td.CREATE_DATE desc limit 1 ) as taxesLast "); |
| | |
| | | .selectAs(Company::getName,InsuranceApply::getCompanyName) |
| | | .select(" ( select max(ac.APPLY_START_TIME) from apply_change ac where ac.apply_id = t.id and ac.status = 2 ) as lastChangeDate") |
| | | .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad where ad.apply_id = t.id ) as insureNum") |
| | | .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad where ad.apply_id = t.id and ad.END_TIME > now() ) as guaranteeNum") |
| | | .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad inner join insurance_apply a on ad.apply_id = a.id and a.status in ( 5 , 27 ) where ad.apply_id = t.id and ad.END_TIME > now() ) as guaranteeNum") |
| | | .select(" t3.name as shopName") |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | |
| | | .selectAs(Solutions::getName,InsuranceApply::getSolutionsName) |
| | | .selectAs(Solutions::getType,InsuranceApply::getSolutionType) |
| | | .selectAs(Company::getName,InsuranceApply::getCompanyName) |
| | | .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad where ad.apply_id = t.id and ad.END_TIME > now() ) as guaranteeNum") |
| | | .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad inner join insurance_apply a on ad.apply_id = a.id and a.status in ( 5 , 27 ) where ad.apply_id = t.id and ad.END_TIME > now() ) as guaranteeNum") |
| | | .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) |
| | | .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) |
| | | .eq(InsuranceApply::getId,model.getId()) |
| | |
| | | BigDecimal sumAmount = BigDecimal.ZERO; |
| | | List<ApplyDetail> applyDetailList = applyDetailMapper |
| | | .selectList(new QueryWrapper<ApplyDetail>().lambda() |
| | | .eq(ApplyDetail::getChangeStatus,Constants.ZERO) |
| | | .eq(ApplyDetail::getApplyId,insuranceApply.getId())); |
| | | if(CollectionUtils.isNotEmpty(applyDetailList)){ |
| | | for (ApplyDetail applyDetail: applyDetailList) { |