From ddbb93dae803ea73b06bad25fb12eaa322768d18 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期二, 09 七月 2024 19:14:19 +0800 Subject: [PATCH] 提交一把 --- server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java | 43 +++++++++++++++++++++++++++++++++++++++---- 1 files changed, 39 insertions(+), 4 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 041d2e8..0a9df2c 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,10 +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 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 "); @@ -176,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()); @@ -315,8 +333,10 @@ new MPJLambdaWrapper<UnionApply>() .selectAll(UnionApply.class) .selectAs(Solutions::getName,UnionApply::getSolutionName) + .selectAs(Solutions::getDelOnlyReplace,UnionApply::getDelOnlyReplace) .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 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) @@ -458,8 +478,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){ @@ -467,14 +490,16 @@ } BigDecimal fee = BigDecimal.ZERO; for (ApplyDetail applyDetail:applyDetailList) { + //鏌ヨ浜哄憳淇℃伅鏄惁瀛樺湪鐩稿悓鐨勬柟妗堜笅鏄惁瀛樺湪 鍐茬獊鏁版嵁 + InsuranceApplyServiceImpl.checkStaticMemberSolution(solutions.getBaseId(), + 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); @@ -854,10 +879,20 @@ List<MemberInsurance> memberInsuranceList = new ArrayList<>(); for (ApplyDetail applyDetail:applyDetailList.stream() .filter(m->Constants.equalsInteger(m.getApplyId(),(insuranceApply.getId()))).collect(Collectors.toList())) { + + //鏌ヨ浜哄憳淇℃伅鏄惁瀛樺湪鐩稿悓鐨勬柟妗堜笅鏄惁瀛樺湪 鍐茬獊鏁版嵁 + InsuranceApplyServiceImpl.checkStaticMemberSolution(solutions.getBaseId(), + 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()); applyDetail.setEndTime(unionApplyBXDDTO.getEndTime()); + + + + MemberInsurance memberInsurance = new MemberInsurance(applyDetail,user.getId()); memberInsurance.setBdCode(unionApplyBXDDTO.getCode()); memberInsurance.setRelationType(Constants.ZERO); -- Gitblit v1.9.3