From bb64d5e37ba396998f75793476e381782ca6cefa Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期四, 20 六月 2024 18:46:50 +0800
Subject: [PATCH] git ch

---
 server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java |   40 +++++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
index 3759e76..edc9ea4 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
@@ -681,7 +681,7 @@
                 throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "鏈煡璇㈠埌鍛樺伐鏁版嵁");
             }
             //鏌ヨ浜哄憳淇℃伅鏄惁瀛樺湪鐩稿悓鐨勬柟妗堜笅鏄惁瀛樺湪 鍐茬獊鏁版嵁
-            InsuranceApplyServiceImpl.checkStaticMemberSolution(solutions.getId(),
+            InsuranceApplyServiceImpl.checkStaticMemberSolution(solutions.getBaseId(),
                     member.getIdcardNo(),member.getName(),detail.getStartTime(),detail.getEndTime(),
                     applyDetailJoinMapper);
 
@@ -690,6 +690,13 @@
                     .lambda()
                     .eq(ApplyDetail::getApplyId,update.getApplyId())
                     .eq(ApplyDetail::getIdcardNo,detail.getIdcardNo())
+//                    .apply(" ( " +
+//                            " '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(update.getApplyStartTime(),1))+"'  <= t.start_time AND t.start_time < '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(detail.getEndTime(),2))+"' " +
+//                            " or " +
+//                            "  ( '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(update.getApplyStartTime(),1))+"' < t.end_time AND t.end_time < '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(detail.getEndTime(),2))+"' )  " +
+//                            " or " +
+//                            " ( '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(update.getApplyStartTime(),1))+"' > t.start_time AND '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(detail.getEndTime(),2))+"' < t.end_time )" +
+//                            " ) " )
                     .le(ApplyDetail::getStartTime,DateUtil.getMontageDate(update.getApplyStartTime(),1))
                     .ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(detail.getEndTime(),2))
             )>Constants.ZERO){
@@ -717,7 +724,7 @@
             add.setFee(Constants.addFee(solutions,solutions.getPrice(),insuranceApply.getStartTime(),insuranceApply.getFinalEndTime(),update.getApplyStartTime(),insuranceApply.getEndTime()));
             add.setChangeStatus(Constants.ZERO);
             if(Constants.equalsInteger(solutions.getDelOnlyReplace(),Constants.ONE)
-                    && Constants.equalsInteger(solutions.getTimeUnit(),solutions.getInsureCycleUnit())){
+                    && Constants.equalsInteger(solutions.getTimeUnit(),solutions.getInsureCycleUnit()) && i < reduceList.size()){
                 add.setReduceId(reduceList.get(i).getId());
             }
             if(new Date().compareTo(DateUtil.getMontageDate(detail.getStartTime(), 2))>=0){
@@ -1044,10 +1051,10 @@
         if (DateUtil.compareDate(insuranceApply.getEndTime(),new Date()) >= Constants.ZERO ) {
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "淇濆崟宸茶繃淇濓紝鏃犳硶杩涜璇ユ搷浣�");
         }
-        if (DateUtil.compareDate(applyChange.getValidTime(),insuranceApply.getStartTime()) >= Constants.ZERO) {
-            //濡傛灉淇濆崟灏氭湭鐢熸晥锛岃缃湡鏈涚敓鏁堟棩鏈熶负淇濆崟鐢熸晥寮�濮嬫椂闂�
-            applyChange.setValidTime(insuranceApply.getStartTime());
-        }
+//        if (DateUtil.compareDate(applyChange.getValidTime(),insuranceApply.getStartTime()) >= Constants.ZERO) {
+//            //濡傛灉淇濆崟灏氭湭鐢熸晥锛岃缃湡鏈涚敓鏁堟棩鏈熶负淇濆崟鐢熸晥寮�濮嬫椂闂�
+//            applyChange.setValidTime(insuranceApply.getStartTime());
+//        }
         Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId());
         if(Objects.isNull(solutions)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌淇濋櫓鏂规");
@@ -1159,9 +1166,9 @@
         ) {
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "淇濆崟宸茶繃淇濓紝鏃犳硶杩涜璇ユ搷浣�");
         }
-        if (DateUtil.compareDate(applyChange.getValidTime(),insuranceApply.getStartTime()) > Constants.ZERO) {
-            applyChange.setValidTime(insuranceApply.getStartTime());
-        }
+//        if (DateUtil.compareDate(applyChange.getValidTime(),insuranceApply.getStartTime()) > Constants.ZERO) {
+//            applyChange.setValidTime(insuranceApply.getStartTime());
+//        }
         Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId());
         if(Objects.isNull(solutions)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌淇濋櫓鏂规");
@@ -1236,7 +1243,7 @@
             );
         }else{
             //濡傛灉淇濆崟鏈敓鎴栬�呮病鏈夐厤缃敓鏁堝ぉ鏁帮紝璁剧疆鏈熸湜鐢熸晥鏃ユ湡涓轰繚鍗曠敓鏁堝紑濮嬫椂闂�
-            applyChange.setApplyStartTime(applyChange.getValidTime());
+            applyChange.setApplyStartTime(applyChange.getValidTime().getTime()>=insuranceApply.getStartTime().getTime()?applyChange.getValidTime():insuranceApply.getStartTime());
         }
         if(applyChange.getValidTime().getTime()>=insuranceApply.getStartTime().getTime()
                 &&Objects.nonNull(solutions.getDelValidDays())){
@@ -1244,7 +1251,7 @@
                     DateUtil.afterDateByType(applyChange.getValidTime(),0,solutions.getDelValidDays())
             );
         }else{
-            applyChange.setDelValidTime(applyChange.getValidTime());
+            applyChange.setDelValidTime(applyChange.getValidTime().getTime()>=insuranceApply.getStartTime().getTime()?applyChange.getValidTime():insuranceApply.getStartTime());
         }
         //浠呮敮鎸佹浛鎹�  淇濊瘉鍔犲噺淇濇棩鏈熶负鍚屼竴澶�
         if(Constants.equalsInteger(solutions.getDelOnlyReplace(),Constants.ONE)){
@@ -1490,7 +1497,7 @@
                 throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鍔犱繚浜哄憳銆�" + applyChagneDetail.getMemberName() + "銆戝繀濉」缂哄け");
             }
             //鏌ヨ浜哄憳淇℃伅鏄惁瀛樺湪鐩稿悓鐨勬柟妗堜笅鏄惁瀛樺湪 鍐茬獊鏁版嵁
-            InsuranceApplyServiceImpl.checkStaticMemberSolution(solutions.getId(),
+            InsuranceApplyServiceImpl.checkStaticMemberSolution(solutions.getBaseId(),
                     applyChagneDetail.getMemberIdcardNo(),applyChagneDetail.getMemberName(),insuranceApply.getStartTime(),insuranceApply.getEndTime(),
                     applyDetailJoinMapper);
 
@@ -1499,9 +1506,15 @@
                     .lambda()
                     .eq(ApplyDetail::getApplyId,applyChange.getApplyId())
                     .eq(ApplyDetail::getIdcardNo,applyChagneDetail.getIdcardNo())
+//                    .apply(" ( " +
+//                            " '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(applyChange.getApplyStartTime(),1))+"'  <= t.start_time AND t.start_time < '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(insuranceApply.getEndTime(),2))+"' " +
+//                            " or " +
+//                            "  ( '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(applyChange.getApplyStartTime(),1))+"' < t.end_time AND t.end_time < '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(insuranceApply.getEndTime(),2))+"' )  " +
+//                            " or " +
+//                            " ( '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(applyChange.getApplyStartTime(),1))+"' > t.start_time AND '"+DateUtil.getLongDateTime(DateUtil.getMontageDate(insuranceApply.getEndTime(),2))+"' < t.end_time )" +
+//                            " ) " )
                     .le(ApplyDetail::getStartTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),1))
                             .ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(insuranceApply.getEndTime(),2))
-                    //.ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),3))
             )>Constants.ZERO){
                 throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "褰撳墠淇濆崟涓嬶紝鍔犱繚浜哄憳銆�" + applyChagneDetail.getMemberName() + "銆戝瓨鍦ㄦ棩鏈熷啿绐佺殑鏁版嵁");
             }
@@ -2118,6 +2131,7 @@
                 .selectAs(Solutions::getName,ApplyChange::getSolutionsName)
                 .selectAs(Solutions::getType,ApplyChange::getSolutionType)
                 .selectAs(Solutions::getId,ApplyChange::getSolutionsId)
+                .selectAs(Solutions::getDelOnlyReplace,ApplyChange::getDelOnlyReplace)
                 .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 0  )",ApplyChange::getAddNum)
                 .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 1  )",ApplyChange::getDelNum)
                 .select("( select count(1) from apply_chagne_detail ad where t.id = ad.APPLY_CHANGE_ID and ad.TYPE = 2  )",ApplyChange::getChangeNum)

--
Gitblit v1.9.3