From ac1c48e5ae523ec6f62366542478bc5d451326a0 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 22 一月 2024 18:18:21 +0800
Subject: [PATCH] 开发业务接口

---
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java |   61 ++++++++++++++++++++++++++++--
 1 files changed, 56 insertions(+), 5 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 a01003d..dc2857e 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
@@ -1,6 +1,7 @@
 package com.doumee.service.business.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
 import com.doumee.core.model.LoginUserInfo;
@@ -12,6 +13,7 @@
 import com.doumee.dao.business.*;
 import com.doumee.dao.business.dto.InsuranceApplyOptDTO;
 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.InsuranceApplyJoinMapper;
 import com.doumee.dao.business.model.*;
@@ -46,10 +48,14 @@
     private InsuranceApplyMapper insuranceApplyMapper;
 
     @Autowired
+    private SystemDictDataBiz systemDictDataBiz;
+    @Autowired
     private InsuranceApplyJoinMapper insuranceApplyJoinMapper;
 
     @Autowired
     private ApplyDetailMapper applyDetailMapper;
+    @Autowired
+    private ApplyDetailJoinMapper applyDetailJoinMapper;
 
     @Autowired
     private ApplyLogMapper applyLogMapper;
@@ -536,7 +542,17 @@
 
     @Override
     public InsuranceApply findDetail(Integer id) {
-        InsuranceApply insuranceApply = insuranceApplyMapper.selectById(id);
+
+        MPJLambdaWrapper wrapper=  new MPJLambdaWrapper<InsuranceApply>()
+                .selectAll(InsuranceApply.class)
+                .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
+                .selectAs(Company::getName,ApplyLog::getCompanyName)
+                .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
+                .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
+                .eq(InsuranceApply::getId,id)
+                .last("limit 1");
+
+        InsuranceApply insuranceApply = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class,wrapper);
         if(Objects.isNull(insuranceApply)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
@@ -556,7 +572,8 @@
             }
         }
 
-
+        //鏌ヨ闄勪欢鏁版嵁
+        initImgData(insuranceApply);
 
         //鏌ヨ鎿嶄綔璁板綍
         List<ApplyLog> applyLogList = applyLogJoinMapper.selectJoinList(ApplyLog.class,
@@ -571,6 +588,34 @@
         );
         insuranceApply.setApplyLogList(applyLogList);
         return insuranceApply;
+    }
+    private void initImgData(InsuranceApply model) {
+        List<Multifile> multifiles = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda()
+                .eq(Multifile::getObjId,model.getId())
+                .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()}))
+                .eq(Multifile::getIsdeleted,Constants.ZERO));
+        if(multifiles!=null){
+            String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()
+                    +systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode();
+            for(Multifile f : multifiles){
+                if(StringUtils.isBlank(f.getFileurl())){
+                    continue;
+                }
+                f.setFileurlFull(path+f.getFileurl());
+                if(Constants.equalsInteger(f.getObjType(),Constants.MultiFile.BD_APPLY_PDF.getKey())){
+                    //绛剧讲鍓嶇殑鎶曚繚鍗�
+                    model.setBaoxiandanFile(f);
+                }else if(Constants.equalsInteger(f.getObjType(),Constants.MultiFile.BD_SIGNED_PDF.getKey())){
+                    //绛剧讲鍚庣殑鎶曚繚鍗�
+                    model.setToubaodanSignedFile(f);
+                }else if(Constants.equalsInteger(f.getObjType(),Constants.MultiFile.BD_DONE_PDF.getKey())){
+                    //鏈�绲備繚闄╁崟
+                    model.setBaoxiandanFile(f);
+                }
+            }
+        }
     }
     @Override
     public  InsuranceApply  findDetailForExport(InsuranceApply model){
@@ -587,10 +632,16 @@
         if(Objects.isNull(insuranceApply)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
-        //鏌ヨ鏄庣粏
-        List<ApplyDetail> detailList =applyDetailMapper.selectList(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getApplyId,insuranceApply.getId())
-                .eq(ApplyDetail::getIsdeleted,Constants.ZERO));
 
+        MPJLambdaWrapper wrapper1=  new MPJLambdaWrapper<ApplyDetail>()
+                .selectAll(ApplyDetail.class)
+                .selectAs(Worktype::getName,ApplyDetail::getWorkTypeName)
+                .selectAs(DispatchUnit::getName,ApplyDetail::getDuName)
+                .leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId)
+                .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId)
+                .eq(InsuranceApply::getId,model.getId());
+        //鏌ヨ鏄庣粏
+        List<ApplyDetail> detailList =applyDetailJoinMapper.selectJoinList(ApplyDetail.class,wrapper1);
         if(detailList!=null){
             insuranceApply.setInsureNum(detailList.size());
             insuranceApply.setApplyDetailList(detailList);

--
Gitblit v1.9.3