From 32929606943fedfca286b052bcb280193a3e0222 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期六, 18 一月 2025 10:23:58 +0800
Subject: [PATCH] git ch

---
 server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java |   88 +++++++++++++++++++++++++++++---------------
 1 files changed, 58 insertions(+), 30 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 0d224e2..a7ca3b0 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
@@ -3,6 +3,7 @@
 import cn.hutool.core.util.IdcardUtil;
 import com.alibaba.fastjson.JSONObject;
 
+import com.baomidou.mybatisplus.extension.api.R;
 import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.core.annotation.excel.ExcelExporter;
 import com.doumee.core.constants.ResponseStatus;
@@ -991,6 +992,9 @@
         Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_COMPANY_COMMIT;
         ApplyLog log = new ApplyLog(applyChange,applyLogType.getName(),"",applyChange.getId(),applyLogType.getKey(), null, null);
         applyLogMapper.insert(log);
+//        if(1==1){
+//            throw new BusinessException(ResponseStatus.DATA_EMPTY );
+//        }
         return applyChange.getId();
     }
 
@@ -1292,18 +1296,35 @@
                 throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鍑忎繚浜哄憳銆�" + applyChagneDetail.getMemberName() + "銆戝凡鍑洪櫓鏃犳硶杩涜鍑忎繚");
             };
             //2024-10-29 15:17:54 鏌ヨ浜哄憳鏄惁宸插噺淇� 宸插噺淇濆悗鏃犳硶鍐嶆鍑忎繚
-            if(applyChangeDetailJoinMapper.selectJoinCount(new MPJLambdaWrapper<ApplyChagneDetail>()
+//            if(applyChangeDetailJoinMapper.selectJoinCount(new MPJLambdaWrapper<ApplyChagneDetail>()
+//                    .leftJoin(ApplyChange.class,ApplyChange::getId,ApplyChagneDetail::getApplyChangeId)
+//                    .eq(ApplyChagneDetail::getType,Constants.ONE)
+//                    .eq(ApplyChange::getApplyId,applyChange.getApplyId())
+//                            .eq(ApplyChagneDetail::getMemberId,applyChagneDetail.getMemberId())
+//                    .notIn(ApplyChange::getStatus,Constants.ApplyChangeStatus.CLOSE.getKey()
+//                            ,Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey()
+//                    )
+//            )>Constants.ZERO){
+//                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鍑忎繚浜哄憳銆�" + applyChagneDetail.getMemberName() + "銆戝凡鍑忎繚鏃犳硶鍐嶆杩涜鍑忎繚");
+//            };
+            //2025-1-16 09:11:14 鏍规嵁鏌ヨ褰撳墠浜哄憳鏈�鍚庝竴娆$殑鍔犲噺淇濊褰� 濡傛灉鏈�鍚庝竴鏉¤褰曟槸鍔犱繚杩涘叆 鍒欏彲浠ュ噺淇� 濡傛灉鏈�鍚庝竴鏉¤褰曟槸鍑忎繚璁板綍 鍒欎笉鍙互鍑忎繚 濡傛灉涓虹┖ 杩欏彲浠ヨ繘琛屾搷浣�
+            ApplyChagneDetail lastApplyChagneDetail = applyChangeDetailJoinMapper.selectJoinOne(ApplyChagneDetail.class,
+                    new MPJLambdaWrapper<ApplyChagneDetail>()
                     .leftJoin(ApplyChange.class,ApplyChange::getId,ApplyChagneDetail::getApplyChangeId)
-                    .eq(ApplyChagneDetail::getType,Constants.ONE)
+                    .ne(ApplyChagneDetail::getType,Constants.TWO)
                     .eq(ApplyChange::getApplyId,applyChange.getApplyId())
-                            .eq(ApplyChagneDetail::getMemberId,applyChagneDetail.getMemberId())
+                    .eq(ApplyChagneDetail::getMemberId,applyChagneDetail.getMemberId())
                     .notIn(ApplyChange::getStatus,Constants.ApplyChangeStatus.CLOSE.getKey()
-                            ,Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey() 
+                            ,Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey()
                     )
-            )>Constants.ZERO){
-                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鍑忎繚浜哄憳銆�" + applyChagneDetail.getMemberName() + "銆戝凡鍑忎繚鏃犳硶鍐嶆杩涜鍑忎繚");
-            };
-
+                    .orderByDesc(ApplyChagneDetail::getId)
+                    .last(" limit 1 ")
+            );
+            if(Objects.nonNull(lastApplyChagneDetail)){
+                if(Constants.equalsInteger(lastApplyChagneDetail.getType(),Constants.ONE)){
+                    throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鍑忎繚浜哄憳銆�" + applyChagneDetail.getMemberName() + "銆戝凡鍑忎繚鏃犳硶鍐嶆杩涜鍑忎繚");
+                }
+            }
             //鏌ヨ鍑忎繚浜哄憳鏄惁瀛樺湪 鍐茬獊鐨� 淇濆崟鏄庣粏鏁版嵁
             if(applyDetailJoinMapper.selectCount(new QueryWrapper<ApplyDetail>()
                     .lambda()
@@ -2280,18 +2301,18 @@
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈡柟妗堜俊鎭�");
         }
         String fileUrl = null;
-//        if(Constants.equalsObject(model.getType(), Constants.ONE)){
-//              fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"鎹㈠巶鐢宠琛�","鎶曚繚浼佷笟");
-//        }else{
-//            fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"鍔犲噺淇濈敵璇疯〃","鎶曚繚浼佷笟");
-//        }
+        if(Constants.equalsObject(model.getType(), Constants.ONE)){
+              fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"鎹㈠巶鐢宠琛�","鎶曚繚浼佷笟");
+        }else{
+            fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"鍔犲噺淇濈敵璇疯〃","鎶曚繚浼佷笟");
+        }
         String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
-//        notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString());
-//        String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"鎶曚繚浼佷笟绛剧珷",company.getSignId(),notifyUrl);
+        notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString());
+        String applyNo = signService.applySignLocalFileByParam(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"鎶曚繚浼佷笟绛剧珷",company.getSignId(),notifyUrl,new Float(0.7));
         //涓存椂浣跨敤
-        fileUrl =  
-                "https://yybred.oss-cn-hangzhou.aliyuncs.com/apply/20241120/1c80f0d7-ab35-4355-b9fe-944464643115.pdf";
-        String applyNo = signService.applySign(companyName,fileUrl,companyName,creditCode,email,"浜哄憳鍚嶅崟绛剧珷",null,notifyUrl);
+//        fileUrl =
+//                "https://yybred.oss-cn-hangzhou.aliyuncs.com/apply/20241120/1c80f0d7-ab35-4355-b9fe-944464643115.pdf";
+//        String applyNo = signService.applySign(companyName,fileUrl,companyName,creditCode,email,"浜哄憳鍚嶅崟绛剧珷",null,notifyUrl);
         if(StringUtils.isBlank(applyNo) ){
             throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
         }
@@ -2538,19 +2559,19 @@
             if(!Constants.equalsInteger(Constants.ZERO,model.getStatus())){
                 throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔绛剧珷鎿嶄綔锛�");
             }
-//            if(Constants.equalsObject(model.getType(), Constants.ONE)){
-//                fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"鎹㈠巶鐢宠琛�","琚繚闄╀汉");
-//            }else{
-//                fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"鍔犲噺淇濈敵璇疯〃","琚繚闄╀汉");
-//            }
+            if(Constants.equalsObject(model.getType(), Constants.ONE)){
+                fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"鎹㈠巶鐢宠琛�","琚繚闄╀汉");
+            }else{
+                fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"鍔犲噺淇濈敵璇疯〃","琚繚闄╀汉");
+            }
             String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
             notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString());
 
             //涓存椂浣跨敤
-            fileUrl =  "https://yybred.oss-cn-hangzhou.aliyuncs.com/apply/20241230/a0d128f2-ba6c-4ad4-b86b-b2610a513d41.pdf";
-            String applyNo = signService.applySignDoByParam(company.getName(),fileUrl,company.getName(),company.getCode(),company.getEmail(),"浜哄憳鍚嶅崟绛剧珷",company.getSignId(),notifyUrl,new Float(0.7));
+//            fileUrl =  "https://yybred.oss-cn-hangzhou.aliyuncs.com/apply/20241230/a0d128f2-ba6c-4ad4-b86b-b2610a513d41.pdf";
+//            String applyNo = signService.applySignDoByParam(company.getName(),fileUrl,company.getName(),company.getCode(),company.getEmail(),"浜哄憳鍚嶅崟绛剧珷",company.getSignId(),notifyUrl,new Float(0.7));
 
-//            String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"浜哄憳鍚嶅崟绛剧珷",company.getSignId(),notifyUrl);
+            String applyNo = signService.applySignLocalFileByParam(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"浜哄憳鍚嶅崟绛剧珷",company.getSignId(),notifyUrl,new Float(0.7));
             if(StringUtils.isBlank(applyNo) ){
                 throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
             }
@@ -2656,16 +2677,16 @@
                 throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌淇濆崟鏁版嵁");
             }
             SaveUnionChangeDTO saveUnionChangeDTO = new SaveUnionChangeDTO();
-            saveUnionChangeDTO.setApplyDate(update.getApplyStartTime());
+//            saveUnionChangeDTO.setApplyDate(update.getApplyStartTime());
+            saveUnionChangeDTO.setApplyDate(model.getValidTime());
             List<Integer> applyIds = new ArrayList<>();
             applyIds.add(model.getId());
             saveUnionChangeDTO.setApplyIds(applyIds);
             saveUnionChangeDTO.setApplyChange(model);
             saveUnionChangeDTO.setUnionApplyId(insuranceApply.getUnionApplyId());
             saveUnionChangeDTO.setBusinessType(model.getType());
-            if(Constants.equalsInteger(model.getType(),Constants.ONE)){
-                saveUnionChangeDTO.setApplyDate(model.getApplyStartTime());
-            }
+//            if(Constants.equalsInteger(model.getType(),Constants.ONE)){
+//            }
             if(Constants.equalsInteger(user.getType(),Constants.TWO)){
                 saveUnionChangeDTO.setShopId(user.getCompanyId());
             }else{
@@ -2676,8 +2697,15 @@
                 saveUnionChangeDTO.setShopId(companySolution.getShopId());
 
             }
+//            if(1==1){
+//                throw new BusinessException(ResponseStatus.DATA_EMPTY);
+//            }
+
             unionChangeService.merge(saveUnionChangeDTO);
         }
+//        if(1==1){
+//            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+//        }
         return  1;
 
     }

--
Gitblit v1.9.3