From 78effa37740723159f1ff6cb1fd8363f577d9562 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 20 六月 2024 16:01:28 +0800
Subject: [PATCH] 提交一把
---
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java | 84 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 81 insertions(+), 3 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
index d72bf05..ddcd07f 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -308,6 +308,10 @@
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);
@@ -1944,6 +1948,8 @@
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);
@@ -1959,6 +1965,7 @@
){
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝鎶曚繚鍛樺伐淇℃伅鏁版嵁缂哄け锛岃鎸夌収瑕佹眰濉啓鍛樺伐鐨勬湁鏁堜俊鎭紒");
}
+ applyDetail.setChangeStatus(Constants.ZERO);
applyDetail.setCreateDate(new Date());
applyDetail.setCreator(loginUserInfo.getId());
applyDetail.setIsdeleted(Constants.ZERO);
@@ -2029,6 +2036,75 @@
}
}
+
+ /**
+ * 鏌ヨ 浼氬憳淇℃伅鍦ㄦ柟妗堜笅鏄惁瀛樺湪鍐茬獊鏁版嵁
+ * @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) {
@@ -2124,7 +2200,7 @@
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 ");
@@ -2251,6 +2327,7 @@
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 ");
@@ -2396,7 +2473,7 @@
.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)
@@ -2520,7 +2597,7 @@
.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())
@@ -2713,6 +2790,7 @@
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) {
--
Gitblit v1.9.3