From c9f07c1f79e7ea9eb00925975d3ae2c9e8dcbd25 Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期三, 20 三月 2024 11:37:34 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/1.0.1' into 1.0.1

---
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java |   39 +++++++++++++++++++++++++++++++++------
 1 files changed, 33 insertions(+), 6 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 7d4d91d..e12b11b 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
@@ -334,7 +334,8 @@
             //濡傛灉鏄┏鍥�,鍙兘鍙┏鍥炲凡绛剧珷鐘舵�佷笅鐨勯��鍥炵敵璇风姸鎬佽繘琛屾搷浣�
             if(!(Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_SIGNATURE.getKey())||
                 Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_WAIT_SIGNATURE.getKey())||
-                Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_UPLOAD.getKey()))
+                Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_UPLOAD.getKey())||
+                    Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_PASS.getKey()))
             ){
                 throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
             }
@@ -347,6 +348,8 @@
                 update.setStatus(Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey());
             }else if(  Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_UPLOAD.getKey())){
                 update.setStatus(Constants.InsuranceApplyStatus.UPLOAD.getKey());
+            }else if(  Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_PASS.getKey())){
+                update.setStatus(Constants.InsuranceApplyStatus.PLATFORM_CHECK_PASS.getKey());
             }
         }else{
             //濡傛灉鏄悓鎰�,涓ょ鐢宠閫�鍥炵姸鎬侀兘鍙搷浣�
@@ -697,6 +700,7 @@
             throw  new BusinessException(ResponseStatus.DATA_EMPTY);
         }
         if(!(Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.UPLOAD.getKey())
+                || Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey())
                 || Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.PLATFORM_CHECK_PASS.getKey()))){
             throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
         }
@@ -807,8 +811,8 @@
         noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey())
                 .ne(Notices::getType,Constants.NoticeType.SIX.getStatus())
                 .eq(Notices::getObjId,model.getId()));
-        Notices notices = new Notices(noticeObjectType,Constants.ONE,model.getId(),solutions.getName(),model.getCompanyId(),noticeType);
-        noticesMapper.insert(notices);
+//        Notices notices = new Notices(noticeObjectType,Constants.ONE,model.getId(),solutions.getName(),model.getCompanyId(),noticeType);
+//        noticesMapper.insert(notices);
 
         String info =applyLogType.getInfo();
         if(StringUtils.isNotBlank(update.getCheckInfo())){
@@ -1165,6 +1169,7 @@
         queryWrapper.selectAll(InsuranceApply.class);
         queryWrapper.selectAs(Company::getName,InsuranceApply::getCompanyName);
         queryWrapper.selectAs(Solutions::getName,InsuranceApply::getSolutionsName);
+        queryWrapper.selectAs(Solutions::getType,InsuranceApply::getSolutionType);
         queryWrapper.selectAs(Solutions::getMaxAge,InsuranceApply::getMaxAge);
         queryWrapper.selectAs(Solutions::getMinAge,InsuranceApply::getMinAge);
         queryWrapper.selectAs(Solutions::getPrice,InsuranceApply::getPrice);
@@ -1189,6 +1194,16 @@
         //浼佷笟浜哄憳鏌ョ湅鏈紒涓氭暟鎹�
         if(loginUserInfo.getType().equals(Constants.ONE)){
             queryWrapper.eq(InsuranceApply::getCompanyId, loginUserInfo.getCompanyId());
+        }else if(loginUserInfo.getType().equals(Constants.TWO)){
+            //濡傛灉鏄晢鎴锋煡鐪�
+            if(pageWrap.getModel().getSolutionType()!=null && pageWrap.getModel().getSolutionType() ==0){
+                queryWrapper.exists("select cs.id from company_solution cs where cs.isdeleted=0 and cs.company_id=t.company_id and cs.shop_id="+loginUserInfo.getCompanyId());
+            }else if(pageWrap.getModel().getSolutionType()!=null && pageWrap.getModel().getSolutionType() ==1){
+                queryWrapper.eq(Solutions::getShopId,loginUserInfo.getCompanyId());
+            }else{
+                queryWrapper.apply("((t1.type=0 and exists(select cs.id from company_solution cs where cs.isdeleted=0 and cs.company_id=t.company_id and cs.shop_id="+loginUserInfo.getCompanyId()+")) or (" +
+                        "t1.type=1 and t1.shop_id="+loginUserInfo.getCompanyId()+"))") ;
+            }
         }else{
             if(loginUserInfo.getCompanyIdList()!=null && loginUserInfo.getCompanyIdList().size()>0){
                 queryWrapper.in(InsuranceApply::getCompanyId, loginUserInfo.getCompanyIdList());
@@ -1199,6 +1214,9 @@
         }
         if (pageWrap.getModel().getSolutionId() != null) {
             queryWrapper.eq(InsuranceApply::getSolutionId, pageWrap.getModel().getSolutionId());
+        }
+        if (pageWrap.getModel().getSolutionType() != null) {
+            queryWrapper.eq(Solutions::getType, pageWrap.getModel().getSolutionType());
         }
         if (pageWrap.getModel().getEndTimeS() != null) {
             queryWrapper.ge(InsuranceApply::getEndTime, Utils.Date.getStart(pageWrap.getModel().getEndTimeS()));
@@ -1228,7 +1246,7 @@
             queryWrapper.in(InsuranceApply::getStatus, pageWrap.getModel().getStatus().split(","));
         }
         if (pageWrap.getModel().getLoseEfficacy() != null && pageWrap.getModel().getLoseEfficacy() ==1) {
-            queryWrapper.apply("  DATEDIFF(t.END_TIME,CURRENT_DATE() ) <= 5 ");
+            queryWrapper.apply("  DATEDIFF(t.END_TIME,CURRENT_DATE() ) <= 5  and t.END_TIME >= now() ");
         }
         if(CollectionUtils.isNotEmpty(pageWrap.getSorts())){
             for(PageWrap.SortData sortData: pageWrap.getSorts()) {
@@ -1271,6 +1289,7 @@
         queryWrapper.selectAll(InsuranceApply.class);
         queryWrapper.selectAs(Company::getName,InsuranceApply::getCompanyName);
         queryWrapper.selectAs(Solutions::getName,InsuranceApply::getSolutionsName);
+        queryWrapper.selectAs(Solutions::getType,InsuranceApply::getSolutionType);
         queryWrapper.select(" ( select sum(td.fee) from taxes ts inner join tax_detial td on ts.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 ts.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 ");
         queryWrapper.leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId);
@@ -1288,6 +1307,9 @@
         }
         if (model.getSolutionId() != null) {
             queryWrapper.eq(InsuranceApply::getSolutionId, model.getSolutionId());
+        }
+        if (model.getSolutionType() != null) {
+            queryWrapper.eq(Solutions::getType,model.getSolutionType() );
         }
         if (model.getEndTimeS() != null) {
             queryWrapper.ge(InsuranceApply::getEndTime, Utils.Date.getStart(model.getEndTimeS()));
@@ -1341,6 +1363,7 @@
                  .selectAs(Solutions::getMinAge,InsuranceApply::getMinAge)
                 .selectAs(Solutions::getPrice,InsuranceApply::getPrice)
                 .selectAs(Solutions::getTimeUnit,InsuranceApply::getTimeUnit)
+                .selectAs(Solutions::getType,InsuranceApply::getSolutionType)
                 .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
                 .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")
@@ -1411,7 +1434,7 @@
 
     private void initImgData(InsuranceApply model) {
         List<Multifile> multifiles = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda()
-                .eq(Multifile::getObjId,model.getId())
+                .eq(Multifile::getObjId,Constants.equalsInteger(model.getSolutionType(),Constants.ZERO)? model.getId():model.getUnionApplyId())
                 .in(Multifile::getObjType,Arrays.asList(new Integer[]{Constants.MultiFile.BD_APPLY_PDF.getKey()
                         ,Constants.MultiFile.BD_SIGNED_PDF.getKey()
                         ,Constants.MultiFile.BD_DONE_PDF.getKey()}))
@@ -1512,6 +1535,7 @@
         if(insuranceApplyOptDTO.getOptType().equals(Constants.ONE)){
             if(!(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.UPLOAD.getKey())
                     ||insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey())
+                    ||insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.PLATFORM_CHECK_PASS.getKey())
                     ||insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.SIGNATURE.getKey()))){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏁版嵁鐘舵�侀潪鍙敵璇烽��鍥�!");
             }
@@ -1521,6 +1545,8 @@
                 insuranceApplyStatus =  Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_WAIT_SIGNATURE;
             }else  if(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.SIGNATURE.getKey())){
                 insuranceApplyStatus =  Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_SIGNATURE;
+            }else  if(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.PLATFORM_CHECK_PASS.getKey())){
+                insuranceApplyStatus =  Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_PASS;
             }
 
             //瀛樺偍寰呭姙淇℃伅
@@ -1540,8 +1566,9 @@
             }
             if(!(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey())
                     ||insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.SIGNATURE.getKey())
+                    ||insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.FAIL_RETURN.getKey())
                     ||insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.PLATFORM_CHECK_PASS.getKey()))){
-                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏁版嵁鐘舵�侀潪鍙敵璇烽��鍥�!");
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏁版嵁鐘舵�佹棤娉曡繘琛屽叧闂�!");
             }
             //鍒犻櫎鍏朵粬寰呭姙
             noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,insuranceApply.getId()));

--
Gitblit v1.9.3