From 15ef66d5eb25490cb4684c32598ca25f54cd9c4b Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期四, 20 六月 2024 14:07:54 +0800 Subject: [PATCH] git ch --- server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java | 40 ++++++++++++++++++++++++++++++++++------ 1 files changed, 34 insertions(+), 6 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java index d702a41..ce57608 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java @@ -157,11 +157,13 @@ .selectAs(Solutions::getSpecialAgreement,UnionApply::getSpecialAgreement) .selectAs(Solutions::getSpecialInfo,UnionApply::getSpecialInfo); queryWrapper.select("(select count(distinct(b.MEMBER_ID)) from apply_detail b where b.isdeleted=0 and b.union_apply_id=t.id) as insureNum "); - queryWrapper.select("(select count(distinct(b.MEMBER_ID)) from apply_detail b where b.isdeleted=0 and b.END_TIME > now() and b.union_apply_id=t.id) as guaranteeNum "); + queryWrapper.select(" ( select count(DISTINCT(b.MEMBER_ID)) from apply_detail b inner join insurance_apply a on b.apply_id = a.id and a.status in ( 5 , 27 ) where b.union_apply_id=t.id and b.END_TIME > now() ) as guaranteeNum"); if(pageWrap.getModel().getQueryFlag() == 1){ queryWrapper.select("(select count(1) from apply_change a inner join insurance_apply b on a.apply_id = b.id where b.union_apply_id=t.id " + "and a.status = "+Constants.ApplyChangeStatus.CHECHED_PASSED.getKey()+" and a.type = 0 ) as addApplyNum "); + + }else if(pageWrap.getModel().getQueryFlag() ==2){ queryWrapper.select("(select count(1) from apply_change a inner join insurance_apply b on a.apply_id = b.id where b.union_apply_id=t.id " + "and a.status = "+Constants.ApplyChangeStatus.CHECHED_PASSED.getKey()+" and a.type = 1 ) as changeApplyNum "); @@ -177,11 +179,26 @@ if(Constants.equalsInteger(user.getType(),Constants.TWO)){ queryWrapper.eq(UnionApply::getCompanyId, user.getCompanyId()); } + if (pageWrap.getModel().getId() != null) { queryWrapper.eq(UnionApply::getId, pageWrap.getModel().getId()); } if (pageWrap.getModel().getSolutionId() != null) { queryWrapper.eq(UnionApply::getSolutionId, pageWrap.getModel().getSolutionId()); + } + if (pageWrap.getModel().getHasApplying() != null) { + if(Constants.equalsInteger(pageWrap.getModel().getHasApplying() ,Constants.ONE)){ + queryWrapper.exists( + " ( select 1 from apply_change a inner join insurance_apply b on a.apply_id = b.id where b.union_apply_id= t.id " + + " and a.status = "+Constants.ApplyChangeStatus.CHECHED_PASSED.getKey()+" and a.type = 0 ) " + ); + }else if(Constants.equalsInteger(pageWrap.getModel().getHasApplying() ,Constants.TWO)){ + queryWrapper.exists( + " ( select 1 from apply_change a inner join insurance_apply b on a.apply_id = b.id where b.union_apply_id= t.id " + + " and a.status = "+Constants.ApplyChangeStatus.CHECHED_PASSED.getKey()+" and a.type = 1 ) " + ); + } + } if (pageWrap.getModel().getCreator() != null) { queryWrapper.eq(UnionApply::getCreator, pageWrap.getModel().getCreator()); @@ -318,7 +335,7 @@ .selectAs(Solutions::getName,UnionApply::getSolutionName) .selectAs(Company::getName,UnionApply::getCompanyName) .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad where ad.UNION_APPLY_ID = t.id ) as insureNum") - .select("(select count(distinct(b.MEMBER_ID)) from apply_detail b where b.isdeleted=0 and b.END_TIME > now() and b.union_apply_id=t.id) as guaranteeNum ") + .select(" ( select count(DISTINCT(b.MEMBER_ID)) from apply_detail b inner join insurance_apply a on b.apply_id = a.id and a.status in ( 5 , 27 ) where b.union_apply_id=t.id and b.END_TIME > now() ) as guaranteeNum") .select(" ( select group_concat(DISTINCT(cd.name)) from insurance_apply ad left join company cd on ad.company_id = cd.id where ad.UNION_APPLY_ID = t.id ) as companyNames") .leftJoin(Solutions.class,Solutions::getId,UnionApply::getSolutionId) .leftJoin(Company.class,Company::getId,UnionApply::getCompanyId) @@ -460,8 +477,11 @@ Integer maxDays = DateUtil.calculateBetween(saveUnionApplyDTO.getStartDate(),saveUnionApplyDTO.getEndDate(),0); - List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda() + List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectJoinList(ApplyDetail.class,new MPJLambdaWrapper<ApplyDetail>() .select(ApplyDetail::getId,ApplyDetail::getPrice,ApplyDetail::getStartTime,ApplyDetail::getEndTime,ApplyDetail::getFee) + .selectAs(Member::getIdcardNo,ApplyDetail::getIdcardNo) + .selectAs(Member::getName,ApplyDetail::getMemberName) + .leftJoin(Member.class,Member::getId,ApplyDetail::getMemberId) .in(ApplyDetail::getApplyId,saveUnionApplyDTO.getApplyIds()) .eq(ApplyDetail::getIsdeleted,Constants.ZERO)); if(applyDetailList.size()==0){ @@ -469,14 +489,16 @@ } BigDecimal fee = BigDecimal.ZERO; for (ApplyDetail applyDetail:applyDetailList) { + //鏌ヨ浜哄憳淇℃伅鏄惁瀛樺湪鐩稿悓鐨勬柟妗堜笅鏄惁瀛樺湪 鍐茬獊鏁版嵁 + InsuranceApplyServiceImpl.checkStaticMemberSolution(solutions.getId(), + applyDetail.getIdcardNo(),applyDetail.getMemberName(),unionApply.getStartTime(),unionApply.getEndTime(), + applyDetailJoinMapper); + fee =fee.add( Constants.reduceFee(solutions,solutions.getPrice(),applyDetail.getStartTime(),applyDetail.getEndTime(),saveUnionApplyDTO.getStartDate(),saveUnionApplyDTO.getEndDate()) ); } 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); @@ -856,6 +878,12 @@ List<MemberInsurance> memberInsuranceList = new ArrayList<>(); for (ApplyDetail applyDetail:applyDetailList.stream() .filter(m->Constants.equalsInteger(m.getApplyId(),(insuranceApply.getId()))).collect(Collectors.toList())) { + + //鏌ヨ浜哄憳淇℃伅鏄惁瀛樺湪鐩稿悓鐨勬柟妗堜笅鏄惁瀛樺湪 鍐茬獊鏁版嵁 + InsuranceApplyServiceImpl.checkStaticMemberSolution(solutions.getId(), + applyDetail.getIdcardNo(),applyDetail.getMemberName(),unionApply.getStartTime(),unionApply.getEndTime(), + applyDetailJoinMapper); + applyDetail.setPrice(price); applyDetail.setFee(price.multiply(new BigDecimal(maxDays)).add(serverCost)); applyDetail.setStartTime(unionApplyBXDDTO.getStartTime()); -- Gitblit v1.9.3