From 5ed3700013b2c653bbab897c970182c1af39ce15 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 02 二月 2024 14:38:21 +0800
Subject: [PATCH] 111

---
 server/service/src/main/java/com/doumee/dao/business/model/Member.java                        |   36 ++++++++---------
 server/company/src/main/java/com/doumee/api/business/MemberInsuranceController.java           |   10 ++++
 server/company/src/main/java/com/doumee/api/business/MemberController.java                    |   12 +++++-
 server/service/src/main/java/com/doumee/service/business/impl/MemberInsuranceServiceImpl.java |   12 ++++++
 server/service/src/main/java/com/doumee/dao/business/model/MemberInsurance.java               |   12 ++++++
 server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java          |    2 
 6 files changed, 61 insertions(+), 23 deletions(-)

diff --git a/server/company/src/main/java/com/doumee/api/business/MemberController.java b/server/company/src/main/java/com/doumee/api/business/MemberController.java
index b49c83e..0efc59a 100644
--- a/server/company/src/main/java/com/doumee/api/business/MemberController.java
+++ b/server/company/src/main/java/com/doumee/api/business/MemberController.java
@@ -11,6 +11,7 @@
 import com.doumee.dao.business.dto.MemberImport;
 import com.doumee.dao.business.dto.MemberQueryDTO;
 import com.doumee.dao.business.model.Member;
+import com.doumee.dao.business.model.MemberInsurance;
 import com.doumee.service.business.MemberService;
 import io.swagger.annotations.*;
 import org.apache.shiro.SecurityUtils;
@@ -84,16 +85,23 @@
         return ApiResponse.success(memberService.findPageForCompany(pageWrap));
     }
 
-
     @ApiOperation("瀵煎嚭Excel")
     @PostMapping("/exportExcel")
     @RequiresPermissions("business:member:exportExcel")
     public void exportExcel (@RequestBody PageWrap<MemberQueryDTO> pageWrap, HttpServletResponse response) {
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         pageWrap.getModel().setCompanyId(user.getCompanyId());
-        ExcelExporter.build(Member.class).export(memberService.findPageForCompany(pageWrap).getRecords(), "鐢ㄥ伐淇℃伅琛�", response);
+        List<Member> list = memberService.findPageForCompany(pageWrap).getRecords();
+        for (int i = 0; i < list.size(); i++) {
+            Member member = list.get(i);
+            member.setSn(i+1);
+            member.setAge(Constants.getAgeByIdCard(member.getIdcardNo()));
+        }
+        ExcelExporter.build(Member.class).exportWithFirstAndEnd(list, "鍛樺伐鍒楄〃璇﹀崟","鍛樺伐鍒楄〃璇﹀崟",null, response);
     }
 
+
+
     @ApiOperation("鏍规嵁ID鏌ヨ")
     @GetMapping("/{id}")
     @RequiresPermissions("business:member:query")
diff --git a/server/company/src/main/java/com/doumee/api/business/MemberInsuranceController.java b/server/company/src/main/java/com/doumee/api/business/MemberInsuranceController.java
index e2679df..9dfea83 100644
--- a/server/company/src/main/java/com/doumee/api/business/MemberInsuranceController.java
+++ b/server/company/src/main/java/com/doumee/api/business/MemberInsuranceController.java
@@ -6,6 +6,7 @@
 import com.doumee.core.model.ApiResponse;
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.model.PageData;
+import com.doumee.core.utils.DateUtil;
 import com.doumee.dao.business.model.MemberInsurance;
 import com.doumee.service.business.MemberInsuranceService;
 import io.swagger.annotations.Api;
@@ -85,7 +86,14 @@
     @PostMapping("/exportExcel")
     @RequiresPermissions("business:memberinsurance:exportExcel")
     public void exportExcel (@RequestBody PageWrap<MemberInsurance> pageWrap, HttpServletResponse response) {
-        ExcelExporter.build(MemberInsurance.class).export(memberInsuranceService.findPage(pageWrap).getRecords(), "鍛樺伐鎶曚繚鏄庣粏璁板綍", response);
+        List<MemberInsurance> list = memberInsuranceService.findPage(pageWrap).getRecords();
+        for (int i = 0; i < list.size(); i++) {
+            MemberInsurance memberInsurance  = list.get(i);
+            memberInsurance.setSn(i+1);
+        }
+        ExcelExporter.build(MemberInsurance.class).exportWithFirstAndEnd(list,
+            "浜哄憳鎶曚繚璇﹀崟_濮撳悕锛�"+pageWrap.getModel().getMemberName() +"_韬唤璇佸彿锛�"+pageWrap.getModel().getIdcardNo(),
+                "浜哄憳鎶曚繚璇﹀崟_濮撳悕锛�"+pageWrap.getModel().getMemberName() +"_韬唤璇佸彿锛�"+pageWrap.getModel().getIdcardNo(),null, response);
     }
 
     @ApiOperation("鏍规嵁ID鏌ヨ")
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/Member.java b/server/service/src/main/java/com/doumee/dao/business/model/Member.java
index 3952cdc..adf73cb 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/Member.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/Member.java
@@ -23,84 +23,72 @@
 
     @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "涓婚敭", example = "1")
-    @ExcelColumn(name="涓婚敭")
     private Integer id;
 
     @ApiModelProperty(value = "鍒涘缓浜虹紪鐮�", example = "1")
-    @ExcelColumn(name="鍒涘缓浜虹紪鐮�")
     private Integer creator;
 
     @ApiModelProperty(value = "鍒涘缓鏃堕棿")
-    @ExcelColumn(name="鍒涘缓鏃堕棿")
-
     private Date createDate;
 
     @ApiModelProperty(value = "鏇存柊浜虹紪鐮�", example = "1")
-    @ExcelColumn(name="鏇存柊浜虹紪鐮�")
     private Integer editor;
 
     @ApiModelProperty(value = "鏇存柊鏃堕棿")
-    @ExcelColumn(name="鏇存柊鏃堕棿")
-
     private Date editDate;
 
     @ApiModelProperty(value = "鏄惁鍒犻櫎0鍚� 1鏄�", example = "1")
-    @ExcelColumn(name="鏄惁鍒犻櫎0鍚� 1鏄�")
     private Integer isdeleted;
 
     @ApiModelProperty(value = "澶囨敞")
-    @ExcelColumn(name="澶囨敞")
     private String remark;
 
     @ApiModelProperty(value = "鎺掑簭鐮�", example = "1")
-    @ExcelColumn(name="鎺掑簭鐮�")
     private Integer sortnum;
 
     @ApiModelProperty(value = "濮撳悕")
-    @ExcelColumn(name="濮撳悕")
+    @ExcelColumn(name="鍛樺伐鍚嶇О",index = 2)
     private String name;
 
     @ApiModelProperty(value = "鎶曚繚鐢宠缂栫爜锛堝叧鑱攊nsurance_apply", example = "1")
-    @ExcelColumn(name="鎶曚繚鐢宠缂栫爜锛堝叧鑱攊nsurance_apply")
     private Integer applyId;
 
     @ApiModelProperty(value = "瀹為檯淇濋櫓鐢熸晥姝㈡湡")
-    @ExcelColumn(name="瀹為檯淇濋櫓鐢熸晥姝㈡湡")
+    @ExcelColumn(name="淇濋櫓鐢熸晥姝㈡湡",index = 9)
     private String endTime;
 
     @ApiModelProperty(value = "瀹為檯淇濋櫓鐢熸晥璧锋湡")
-    @ExcelColumn(name="瀹為檯淇濋櫓鐢熸晥璧锋湡")
+    @ExcelColumn(name="淇濋櫓鐢熸晥璧锋湡",index = 8)
     private String startTime;
 
     @ApiModelProperty(value = "韬唤璇佸彿鐮�")
-    @ExcelColumn(name="韬唤璇佸彿鐮�")
+    @ExcelColumn(name="韬唤璇佸彿",index = 3)
     private String idcardNo;
 
     @ApiModelProperty(value = "浼佷笟缂栫爜锛堝叧鑱攃ompany锛�", example = "1")
-    @ExcelColumn(name="浼佷笟缂栫爜锛堝叧鑱攃ompany锛�")
     private Integer companyId;
 
     @ApiModelProperty(value = "娲鹃仯鍗曚綅缂栫爜锛堝叧鑱攄ispatch_unit)", example = "1")
-    @ExcelColumn(name="娲鹃仯鍗曚綅缂栫爜锛堝叧鑱攄ispatch_unit)")
     private Integer duId;
 
     @ApiModelProperty(value = "宸ョ缂栫爜", example = "1")
-    @ExcelColumn(name="宸ョ缂栫爜")
     private Integer worktypeId;
 
     @ApiModelProperty(value = "鎬у埆 0鐢� 1濂�", example = "1")
-    @ExcelColumn(name="鎬у埆 0鐢� 1濂�")
     private Integer sex;
 
     @ApiModelProperty(value = "淇濋櫓鏂规鍚嶇О")
+    @ExcelColumn(name="淇濋櫓鏂规",index = 5)
     @TableField(exist = false)
     private String solutionName;
 
     @ApiModelProperty(value = "娲鹃仯鍗曚綅鍚嶇О")
+    @ExcelColumn(name="娲鹃仯鍗曚綅",index = 6)
     @TableField(exist = false)
     private String duName;
 
     @ApiModelProperty(value = "鎵�灞炲伐绉嶅悕绉�")
+    @ExcelColumn(name="鎵�灞炲伐绉�",index = 7)
     @TableField(exist = false)
     private String workTypeName;
 
@@ -109,8 +97,18 @@
     private String companyName;
 
     @ApiModelProperty(value = "淇濋櫓鐘舵��:1=淇濋殰涓�;2=涓嶅湪淇�")
+    @ExcelColumn(name="淇濋櫓鐘舵��",index = 1,valueMapping = "1=淇濋殰涓�;2=涓嶅湪淇�;")
     @TableField(exist = false)
     private Integer solutionsStatus;
 
+    @ApiModelProperty(value = "骞撮緞")
+    @ExcelColumn(name="骞撮緞",index = 4)
+    @TableField(exist = false)
+    private Long age;
+
+    @ApiModelProperty(value = "搴忓彿", example = "1")
+    @ExcelColumn(name="搴忓彿",index = 0)
+    @TableField(exist = false)
+    private Integer sn;
 
 }
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/MemberInsurance.java b/server/service/src/main/java/com/doumee/dao/business/model/MemberInsurance.java
index 6ff0df0..b1071d8 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/MemberInsurance.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/MemberInsurance.java
@@ -1,5 +1,6 @@
 package com.doumee.dao.business.model;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.doumee.core.annotation.excel.ExcelColumn;
 import com.doumee.core.model.LoginUserInfo;
 import com.doumee.core.utils.Constants;
@@ -162,9 +163,20 @@
     @ExcelColumn(name="娲鹃仯鍗曚綅",index = 4)
     private String duName;
 
+
+    @ApiModelProperty(value = "搴忓彿", example = "1")
+    @ExcelColumn(name="搴忓彿",index = 0)
+    @TableField(exist = false)
+    private Integer sn;
+
+
     @ApiModelProperty(value = "鍏宠仈鏄庣粏涓婚敭", example = "1")
     private Integer relationId;
 
+    @ApiModelProperty(value = "鍛樺伐鍚嶇О", example = "1")
+    @TableField(exist = false)
+    private String memberName;
+
 //    @ApiModelProperty(value = "鍏宠仈鏄庣粏绫诲瀷锛�0=鎶曚繚鐢宠锛�1=鍔犲噺淇�/鎹㈠巶", example = "1")
 //    @ExcelColumn(name="鍏宠仈鏄庣粏绫诲瀷锛�0=鎶曚繚鐢宠锛�1=鍔犲噺淇�/鎹㈠巶")
 //    private Integer relationType;
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/MemberInsuranceServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/MemberInsuranceServiceImpl.java
index 5887e9c..dc8b93d 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/MemberInsuranceServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/MemberInsuranceServiceImpl.java
@@ -5,6 +5,8 @@
 import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.Utils;
 import com.doumee.dao.business.MemberInsuranceMapper;
+import com.doumee.dao.business.MemberMapper;
+import com.doumee.dao.business.model.Member;
 import com.doumee.dao.business.model.MemberInsurance;
 import com.doumee.service.business.MemberInsuranceService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -16,6 +18,7 @@
 import org.springframework.util.CollectionUtils;
 
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 鍛樺伐鎶曚繚鏄庣粏璁板綍Service瀹炵幇
@@ -27,6 +30,9 @@
 
     @Autowired
     private MemberInsuranceMapper memberInsuranceMapper;
+
+    @Autowired
+    private MemberMapper memberMapper;
 
     @Override
     public Integer create(MemberInsurance memberInsurance) {
@@ -122,6 +128,12 @@
             queryWrapper.lambda().eq(MemberInsurance::getApplyId, pageWrap.getModel().getApplyId());
         }
         if (pageWrap.getModel().getMemberId() != null) {
+
+            Member member = memberMapper.selectById(pageWrap.getModel().getMemberId());
+            if(!Objects.isNull(member)){
+                pageWrap.getModel().setMemberName(member.getName());
+                pageWrap.getModel().setIdcardNo(member.getIdcardNo());
+            }
             queryWrapper.lambda().eq(MemberInsurance::getMemberId, pageWrap.getModel().getMemberId());
         }
         if (pageWrap.getModel().getEndTime() != null) {
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
index 5f1c94c..58f6c24 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
@@ -181,7 +181,7 @@
                 .selectAs(DispatchUnit::getName,Member::getDuName)
                 .selectAs(Worktype::getName,Member::getWorkTypeName)
                 .selectAs(Solutions::getName,Member::getSolutionName)
-                .select(" case when  now() between t.start_time and t.end_time then 1  else 0 end solutionsStatus ")
+                .select(" case when  now() between t.start_time and t.end_time then 1  else 2 end solutionsStatus ")
                 .leftJoin(InsuranceApply.class,InsuranceApply::getId,Member::getApplyId)
                 .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
                 .leftJoin(DispatchUnit.class,DispatchUnit::getId,Member::getDuId)

--
Gitblit v1.9.3