From 48eb5dc61ac07d232632b13d040006128ed5cceb Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 31 一月 2024 20:59:23 +0800
Subject: [PATCH] 开发业务接口

---
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java |   41 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 37 insertions(+), 4 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 b3c53e3..cf56469 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
@@ -17,6 +17,7 @@
 import com.doumee.dao.business.dto.InsuranceApplyQueryDTO;
 import com.doumee.dao.business.join.ApplyDetailJoinMapper;
 import com.doumee.dao.business.join.ApplyLogJoinMapper;
+import com.doumee.dao.business.join.DuSolutionJoinMapper;
 import com.doumee.dao.business.join.InsuranceApplyJoinMapper;
 import com.doumee.dao.business.model.*;
 import com.doumee.dao.business.vo.CountCyclePriceVO;
@@ -86,6 +87,8 @@
     private MemberMapper memberMapper;
     @Autowired
     private DuSolutionMapper duSolutionMapper;
+    @Autowired
+    private DuSolutionJoinMapper duSolutionJoinMapper;
     @Autowired
     private DuWorktypeMapper duWorktypeMapper;
 
@@ -428,10 +431,14 @@
     @Override
     public   void dealWaitSignedData(){
         List<InsuranceApply> applyList = insuranceApplyMapper.selectList(new QueryWrapper<InsuranceApply>().lambda()
-                .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WAIT_SIGNATURE)
+                .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey())
                 .isNotNull(InsuranceApply::getSignApplyNo));
         if(applyList !=null && applyList.size()>0 ){
             for(InsuranceApply model : applyList){
+                String status = signService.linkFileStatus(model.getSignApplyNo());
+                if(!StringUtils.equals(status,"3")){
+                    continue;
+                }
                 String link = signService.linkFile(model.getSignApplyNo());
                 String fileUrl = uploadSignFile(link);
                 if(StringUtils.isBlank(fileUrl)){
@@ -443,10 +450,14 @@
             }
         }
         List<ApplyChange> chagneList = applyChangeMapper.selectList(new QueryWrapper<ApplyChange>().lambda()
-                .eq(ApplyChange::getStatus,Constants.ApplyChangeStatus.UPLOAD)
+                .eq(ApplyChange::getStatus,Constants.ApplyChangeStatus.UPLOAD.getKey())
                 .isNotNull(ApplyChange::getSignApplyNo));
         if(chagneList !=null && chagneList.size()>0 ){
             for(ApplyChange model : chagneList){
+                String status = signService.linkFileStatus(model.getSignApplyNo());
+                if(!StringUtils.equals(status,"3")){
+                    continue;
+                }
                 String link = signService.linkFile(model.getSignApplyNo());
                 String fileUrl = uploadSignFile(link);
                 if(StringUtils.isBlank(fileUrl)){
@@ -704,7 +715,12 @@
             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏈煡璇㈠埌鏂规淇℃伅");
         }
         //鏌ヨ淇濋櫓鏂规涓嬬殑鎵�鏈夋淳閬e崟浣�
-        List<DuSolution> duSolutionList = duSolutionMapper.selectList(new QueryWrapper<DuSolution>().lambda()
+        List<DuSolution>  duSolutionList = duSolutionJoinMapper.selectJoinList(DuSolution.class,new MPJLambdaWrapper<DuSolution>()
+                .selectAll(DuSolution.class)
+                .innerJoin(DispatchUnit.class,DispatchUnit::getId,DuSolution::getDispatchUnitId)
+                .eq(DispatchUnit::getCompanyId,insuranceApply.getCompanyId())
+                .eq(DispatchUnit::getIsdeleted,Constants.ZERO)
+                .eq(DispatchUnit::getUnitStatus,Constants.ONE)
                 .eq(DuSolution::getIsdeleted,Constants.ZERO)
                 .eq(DuSolution::getStatus,Constants.ONE)
                 .eq(DuSolution::getSolutionId,insuranceApply.getSolutionId()));
@@ -911,6 +927,12 @@
         //浼佷笟浜哄憳鏌ョ湅鏈紒涓氭暟鎹�
         if(loginUserInfo.getType().equals(Constants.ONE)){
             queryWrapper.eq(InsuranceApply::getCompanyId, loginUserInfo.getCompanyId());
+        }else{
+            if(loginUserInfo.getCompanyIdList()!=null && loginUserInfo.getCompanyIdList().size()>0){
+                queryWrapper.in(InsuranceApply::getCompanyId, loginUserInfo.getCompanyIdList());
+            }else{
+                queryWrapper.eq(InsuranceApply::getCompanyId, -1);
+            }
         }
         if (pageWrap.getModel().getSolutionId() != null) {
             queryWrapper.eq(InsuranceApply::getSolutionId, pageWrap.getModel().getSolutionId());
@@ -991,6 +1013,12 @@
         //浼佷笟浜哄憳鏌ョ湅鏈紒涓氭暟鎹�
         if(loginUserInfo.getType().equals(Constants.ONE)){
             queryWrapper.eq(InsuranceApply::getCompanyId, loginUserInfo.getCompanyId());
+        }else{
+            if(loginUserInfo.getCompanyIdList()!=null && loginUserInfo.getCompanyIdList().size()>0){
+                queryWrapper.in(InsuranceApply::getCompanyId, loginUserInfo.getCompanyIdList());
+            }else{
+                queryWrapper.eq(InsuranceApply::getCompanyId, -1);
+            }
         }
         if (model.getSolutionId() != null) {
             queryWrapper.eq(InsuranceApply::getSolutionId, model.getSolutionId());
@@ -1044,7 +1072,7 @@
         MPJLambdaWrapper wrapper=  new MPJLambdaWrapper<InsuranceApply>()
                 .selectAll(InsuranceApply.class)
                 .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
-                .selectAs(Company::getName,ApplyLog::getCompanyName)
+                .selectAs(Company::getName,InsuranceApply::getCompanyName)
                 .select(" ( select count(1) from apply_detail ad  where ad.apply_id = t.id ) as insureNum")
                 .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
                 .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
@@ -1056,6 +1084,11 @@
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
 
+        if(insuranceApply.getStartTime().compareTo(new Date())<0  && insuranceApply.getEndTime().compareTo(new Date()) > 0 ){
+            insuranceApply.setLoseEfficacyDays(DateUtil.daysBetweenDates(insuranceApply.getEndTime(),new Date()));
+        }
+
+
         initApplyStatus(insuranceApply);
 
         //鏌ヨ闄勪欢鏁版嵁

--
Gitblit v1.9.3