From 2b88f76c533a2fa94cd029b8a88c2d4da437552c Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 29 三月 2024 08:55:22 +0800
Subject: [PATCH] git ch

---
 server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java |   67 +++++++++++++++++++++++++++++----
 1 files changed, 59 insertions(+), 8 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
index ade3466..fee92f3 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
@@ -14,10 +14,7 @@
 import com.doumee.dao.business.dto.SaveUnionApplyDTO;
 import com.doumee.dao.business.dto.SaveUnionChangeDTO;
 import com.doumee.dao.business.dto.UnionChangeBXDDTO;
-import com.doumee.dao.business.join.ApplyChagneDetailJoinMapper;
-import com.doumee.dao.business.join.ApplyChangeJoinMapper;
-import com.doumee.dao.business.join.ApplyDetailJoinMapper;
-import com.doumee.dao.business.join.MemberInsuranceJoinMapper;
+import com.doumee.dao.business.join.*;
 import com.doumee.dao.business.model.*;
 import com.doumee.dao.business.vo.CountCyclePriceVO;
 import com.doumee.service.business.UnionChangeService;
@@ -35,6 +32,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
@@ -50,6 +48,9 @@
 
     @Autowired
     private UnionChangeMapper unionChangeMapper;
+
+    @Autowired
+    private UnionChangeJoinMapper unionChangeJoinMapper;
 
     @Autowired
     private ApplyChangeJoinMapper applyChangeJoinMapper;
@@ -315,6 +316,57 @@
     }
 
 
+    public UnionChange unionChangeDetail(Integer unionChangeId){
+
+        UnionChange unionChange = unionChangeJoinMapper.selectJoinOne(UnionChange.class,
+                new MPJLambdaWrapper<UnionChange>()
+                        .selectAll(UnionChange.class)
+                        .selectAs(Company::getName,UnionChange::getShopName)
+                        .selectAs(Solutions::getName,UnionChange::getSolutionsName)
+                        .selectAs(UnionApply::getCode,UnionChange::getApplyCode)
+                        .selectAs(UnionApply::getStartTime,UnionChange::getStartTime)
+                        .selectAs(UnionApply::getEndTime,UnionChange::getEndTime)
+                        .leftJoin(UnionApply.class,UnionApply::getId,UnionChange::getUnionApplyId)
+                        .leftJoin(Company.class,Company::getId,UnionChange::getShopId)
+                        .leftJoin(Solutions.class,Solutions::getId,UnionApply::getSolutionId)
+                        .eq(UnionChange::getId,unionChangeId)
+                        .last(" limit 1 ")
+        );
+        //浼佷笟鍚嶇О
+        List<ApplyChange> applyChangeList = applyChangeJoinMapper.selectJoinList(ApplyChange.class,new MPJLambdaWrapper<ApplyChange>()
+                .selectAs(Company::getName,ApplyChange::getCompanyName)
+                .leftJoin(Company.class,Company::getId,ApplyChange::getCompanyId)
+                .eq(ApplyChange::getUnionChangeId,unionChangeId)
+        );
+
+        String companyNames = String.join(",",applyChangeList.stream().map(m->m.getCompanyName()).collect(Collectors.toList()));
+        
+        List<ApplyChagneDetail> applyChagneDetailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class,new MPJLambdaWrapper<ApplyChagneDetail>()
+                .selectAll(ApplyChagneDetail.class)
+                .selectAs(Member::getName,ApplyChagneDetail::getMemberName)
+                .selectAs(Member::getIdcardNo,ApplyChagneDetail::getIdcardNo)
+                .selectAs(Member::getSex,ApplyChagneDetail::getSex)
+                .selectAs(Company::getName,ApplyChagneDetail::getCompanyName)
+                .select("t2.name",ApplyChagneDetail::getWorkTypeName)
+                .select("t3.name",ApplyChagneDetail::getDuName)
+                .select("t4.name",ApplyChagneDetail::getOldWorkTypeName)
+                .select("t5.name",ApplyChagneDetail::getOldDuName)
+                .leftJoin(Member.class,Member::getId,ApplyChagneDetail::getMemberId)
+                .leftJoin(Worktype.class,Worktype::getId,ApplyChagneDetail::getWorktypeId)
+                 .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyChagneDetail::getDuId)
+                 .leftJoin(Worktype.class,Worktype::getId,ApplyChagneDetail::getOldWorktypeId)
+                 .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyChagneDetail::getOldDuId)
+                .leftJoin(Company.class,Company::getId,Member::getCompanyId)
+                .eq(ApplyChagneDetail::getUnionChangeId,unionChangeId)
+        );
+
+        unionChange.setCompanyNames(companyNames);
+        unionChange.setApplyChagneDetailList(applyChagneDetailList);
+        return unionChange;
+    }
+
+
+
     /**
      * 鍚堝苟鍗曪紙鍔犲噺淇�/鎹㈠巶锛� - 鎶曚繚鐢宠绛剧讲
      * @param id
@@ -327,7 +379,7 @@
             throw  new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
-        UnionChange unionChange = unionChangeMapper.selectById(id);
+        UnionChange unionChange = this.unionChangeDetail(id);
         if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
@@ -350,11 +402,10 @@
 
         String fileUrl = null;
         if(Constants.equalsObject(unionChange.getType(), Constants.ONE)){
-//            fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"鎹㈠巶鐢宠琛�","琚繚闄╀汉");
+            fileUrl = ExcelExporter.build(UnionChange.class).exportUnionChangeOtherUnitExcelToPdf(unionChange,"鎹㈠巶鐢宠琛�");
         }else{
-//            fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"鍔犲噺淇濈敵璇疯〃","琚繚闄╀汉");
+            fileUrl = ExcelExporter.build(UnionChange.class).exportUnionChangeExcelToPdf(unionChange,"鍔犲噺淇濈敵璇疯〃");
         }
-
         String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
         notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",unionChange.getId().toString());
         String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"鍚堝苟鍗曪紙鍔犲噺淇�/鎹㈠巶锛夌敵璇风缃�",company.getSignId(),notifyUrl);

--
Gitblit v1.9.3