From 38e2bdb95c2593b883369911868fe8b671b5d119 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 26 一月 2024 17:45:30 +0800
Subject: [PATCH] 开发业务接口

---
 server/service/src/main/java/com/doumee/service/business/impl/ApplyDetailServiceImpl.java |   28 ++++++
 server/platform/src/main/java/com/doumee/api/business/ApplyDetailController.java          |    6 +
 company/src/api/business/insuranceApply.js                                                |   12 +++
 company/src/components/business/OperaInsuranceApplyWindow.vue                             |    4 
 company/src/components/business/InsuranceDetails.vue                                      |   98 ++++++++++++++++-------
 server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java          |   62 +++++++++++++--
 server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java               |    1 
 7 files changed, 164 insertions(+), 47 deletions(-)

diff --git a/company/src/api/business/insuranceApply.js b/company/src/api/business/insuranceApply.js
index 79aa1ba..35ee368 100644
--- a/company/src/api/business/insuranceApply.js
+++ b/company/src/api/business/insuranceApply.js
@@ -11,6 +11,18 @@
 export function updateById (data) {
     return request.post('/business/insuranceApply/updateById', data)
 }
+
+export function exportDetailExcel (data) {
+    return request.post('/business/insuranceApply/exportDetailExcel', data, {
+        trim: true,
+        download: true
+    })
+}
 export function getDetail (id) {
     return request.get(`business/insuranceApply/${id}`)
 }
+export function getDetailList (data) {
+    return request.post('/business/applyDetail/list', data, {
+        trim: true
+    })
+}
diff --git a/company/src/components/business/InsuranceDetails.vue b/company/src/components/business/InsuranceDetails.vue
index d615444..ff1859a 100644
--- a/company/src/components/business/InsuranceDetails.vue
+++ b/company/src/components/business/InsuranceDetails.vue
@@ -1,36 +1,40 @@
 <template>
     <GlobalWindow
         :title="title"
-        width="50%"
+        width="100%"
         :visible.sync="visible"
         :confirm-working="isWorking"
         @confirm="confirm"
     >
         <div class="box">
+          <div class="top">
+            {{title}}
+          </div>
             <div class="box_header">
+
                 <div class="box_header_item">
                     <div class="box_header_item_label">鎶曚繚浼佷笟</div>
-                    <div class="box_header_item_val">瀹夊窘鏍煎姏鏈烘鍒堕�犲巶</div>
+                    <div class="box_header_item_val">{{ model.companyName }}</div>
                 </div>
                 <div class="box_header_item">
                     <div class="box_header_item_label">淇濋櫓鏂规</div>
-                    <div class="box_header_item_val">骞冲畨淇濋櫓闆囦富璐d换闄〢鐗�</div>
+                    <div class="box_header_item_val">{{ model.solutionsName }}</div>
                 </div>
                 <div class="box_header_item">
                     <div class="box_header_item_label">淇濋櫓鐢熸晥璧锋湡</div>
-                    <div class="box_header_item_val">2023-09-11 00:00:00</div>
+                    <div class="box_header_item_val">{{ model.startTime }}</div>
                 </div>
                 <div class="box_header_item">
                     <div class="box_header_item_label">淇濋櫓鐢熸晥姝㈡湡</div>
-                    <div class="box_header_item_val">2023-10-11 23:59:59</div>
+                    <div class="box_header_item_val">{{model.endTime}}</div>
                 </div>
                 <div class="box_header_item">
                     <div class="box_header_item_label">鎶曚繚浜烘暟</div>
-                    <div class="box_header_item_val">50</div>
+                    <div class="box_header_item_val">{{ model.insureNum }}</div>
                 </div>
                 <div class="box_header_item">
-                    <div class="box_header_item_label">鎬昏垂鐢�</div>
-                    <div class="box_header_item_val">15000</div>
+                    <div class="box_header_item_label">鎬昏垂鐢�(鍏�)</div>
+                    <div class="box_header_item_val">{{model.fee}}</div>
                 </div>
             </div>
             <div class="box_table">
@@ -41,18 +45,18 @@
                     <div class="box_table_head_item">娲鹃仯鍗曚綅</div>
                     <div class="box_table_head_item">鎵�灞炲伐绉�</div>
                 </div>
-                <div class="box_table_content" v-for="(item, index) in 6" :key="index">
+                <div class="box_table_content" v-for="(item, index) in detailList" :key="index">
                     <div class="box_table_content_item">{{index + 1}}</div>
-                    <div class="box_table_content_item">鐜嬫煇鏌�</div>
-                    <div class="box_table_content_item">340411190001010011</div>
-                    <div class="box_table_content_item">瀹夊窘鏍煎姏鏈烘鍒堕�犲巶</div>
-                    <div class="box_table_content_item">4绫� 鏈烘鍔犲伐/鍒堕��</div>
+                    <div class="box_table_content_item">{{ item.memberName }}</div>
+                    <div class="box_table_content_item">{{ item.idcardNo }}</div>
+                    <div class="box_table_content_item">{{ item.duName }}</div>
+                    <div class="box_table_content_item">{{item.workTypeName}}</div>
                 </div>
             </div>
         </div>
         <template v-slot:footer>
             <el-button type="primary">浼佷笟璇佷欢</el-button>
-            <el-button type="primary">瀵煎嚭璇﹀崟</el-button>
+            <el-button type="primary"  :loading="isWorking.export" @click="exportDetail">瀵煎嚭璇﹀崟</el-button>
             <el-button>鍙栨秷</el-button>
         </template>
     </GlobalWindow>
@@ -61,12 +65,16 @@
 <script>
     import BaseOpera from '@/components/base/BaseOpera'
     import GlobalWindow from '@/components/common/GlobalWindow'
+    import {exportDetailExcel, getDetailList} from "@/api/business/insuranceApply";
+    import {all as solutionAll} from "@/api/business/solutions";
     export default {
         name: 'InsuranceDetails',
         extends: BaseOpera,
         components: { GlobalWindow },
         data () {
             return {
+                model:{},
+               detailList:[],
                 // 琛ㄥ崟鏁版嵁
                 form: {
                     id: null,
@@ -75,24 +83,8 @@
                 // 楠岃瘉瑙勫垯
                 rules: {
                 },
-                formInline: {
-                    user: '',
-                    region: ''
-                },
                 reverse: true,
-                activities: [{
-                    content: '娲诲姩鎸夋湡寮�濮�',
-                    timestamp: '2018-04-15'
-                }, {
-                    content: '閫氳繃瀹℃牳',
-                    timestamp: '2018-04-13'
-                }, {
-                    content: '鍒涘缓鎴愬姛',
-                    timestamp: '2018-04-11'
-                }],
-                tableData: [],
-                activeName: 'first',
-                currentPage: 1
+                tableData: []
             }
         },
         created () {
@@ -102,6 +94,39 @@
             })
         },
         methods: {
+            open(title,target){
+              this.title=title
+              this.visible=true
+              this.model = target
+              this.getDetailListDo()
+            },
+           getDetailListDo(){
+              getDetailList({applyId: this.model.id}).then(res => {
+                this.detailList = res
+              }).catch(err => {
+              })
+            },
+          exportDetail(){
+
+            this.$dialog.exportConfirm('纭瀵煎嚭鍚楋紵')
+                .then(() => {
+                  this.isWorking = true
+                  exportDetailExcel({ id: this.model.id })
+                      .then(response => {
+                        this.download(response)
+                      })
+                      .catch(e => {
+                        console.log(e)
+                        this.$message.error('鏁版嵁涓嬭浇澶辫触锛�')
+                      })
+                      .finally(() => {
+                        this.isWorking = false
+                      })
+                })
+                .catch(() => {
+                })
+
+          },
             handleSizeChange(val) {
                 console.log(`姣忛〉 ${val} 鏉);
             },
@@ -121,6 +146,17 @@
 <style lang="scss" scoped>
     .box {
         width: 100%;
+       .top{
+           width: 100%;
+           align-items: center;
+           flex-wrap: wrap;
+           border-top: 1px solid #b4bbc5;
+           border-left: 1px solid #b4bbc5;
+            font-size: 24px;
+            font-weight: bold;
+            text-align: center;
+          padding: 15px;
+         }
         .box_header {
             width: 100%;
             display: flex;
diff --git a/company/src/components/business/OperaInsuranceApplyWindow.vue b/company/src/components/business/OperaInsuranceApplyWindow.vue
index 540fa80..1d526b0 100644
--- a/company/src/components/business/OperaInsuranceApplyWindow.vue
+++ b/company/src/components/business/OperaInsuranceApplyWindow.vue
@@ -1,7 +1,7 @@
 <template>
     <GlobalWindow
         :title="title"
-        width="80%"
+        width="100%"
         :visible.sync="visible"
         :confirm-working="isWorking"
         @confirm="confirm"
@@ -15,7 +15,7 @@
                         <span>鎻愪氦鏃堕棿锛歿{ model.createDate }}</span>
                     </div>
                     <div class="desc_item_label_right">
-                        <el-button type="primary" @click="$refs.InsuranceDetails.open('鎶曚繚璇︽儏鍗�')">瀵煎嚭璇﹀崟</el-button>
+                        <el-button type="primary" @click="$refs.InsuranceDetails.open('鎶曚繚璇︽儏鍗�',model)">瀵煎嚭璇﹀崟</el-button>
                         <el-button v-if="model.status == 0 " type="primary" @click="visible2 = true">涓婁紶鎶曚繚鍗�</el-button>
                         <el-button v-if="model.status == 3 "  type="primary" @click="visible3 = true">涓婁紶淇濋櫓鍗�</el-button>
                         <el-button  v-if="model.status == 6 || model.status == 7|| model.status == 8" type="primary" @click="visible5 = true">澶勭悊閫�鍥炵敵璇�</el-button>
diff --git a/server/platform/src/main/java/com/doumee/api/business/ApplyDetailController.java b/server/platform/src/main/java/com/doumee/api/business/ApplyDetailController.java
index 2571c0c..f1f6296 100644
--- a/server/platform/src/main/java/com/doumee/api/business/ApplyDetailController.java
+++ b/server/platform/src/main/java/com/doumee/api/business/ApplyDetailController.java
@@ -73,6 +73,12 @@
     public ApiResponse<PageData<ApplyDetail>> findPage (@RequestBody PageWrap<ApplyDetailPageDTO> pageWrap) {
         return ApiResponse.success(applyDetailService.findPageForCompany(pageWrap));
     }
+    @ApiOperation("鏌ヨ鍏ㄩ儴")
+    @PostMapping("/list")
+    @RequiresPermissions("business:applydetail:query")
+    public ApiResponse<List<ApplyDetail>> findList (@RequestBody  ApplyDetail pageWrap) {
+        return ApiResponse.success(applyDetailService.findList(pageWrap));
+    }
     @ApiOperation("瀵煎嚭鍦ㄤ繚浜哄憳璇﹀崟Excel")
     @PostMapping("/exportExcel")
     @RequiresPermissions("business:applydetail:exportExcel")
diff --git a/server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java b/server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java
index 83268e3..6473db7 100644
--- a/server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java
+++ b/server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java
@@ -17,6 +17,7 @@
 import org.springframework.core.annotation.AnnotationConfigurationException;
 
 import javax.servlet.http.HttpServletResponse;
+import javax.swing.*;
 import java.io.*;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
@@ -251,7 +252,24 @@
         }
         return new ArrayList<>(sortedFields.values());
     }
-
+    /**
+     * 閰嶇疆鏁版嵁鍗曞厓鏍�
+     */
+    private void configDataCell (SXSSFWorkbook workbook, Cell cell ) {
+        CellStyle style = workbook.createCellStyle();
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);
+        // 璁剧疆鑳屾櫙
+        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+//        style.setFillForegroundColor(columnConfig.dataBackgroundColor().getIndex());
+        // 瀛椾綋
+        Font font = workbook.createFont();
+        style.setFont(font);
+        // 杈规
+        configCellBorder(style);
+        style.setWrapText(true);
+        cell.setCellStyle(style);
+    }
     /**
      * 閰嶇疆鏁版嵁鍗曞厓鏍�
      */
@@ -309,7 +327,22 @@
         style.setVerticalAlignment(VerticalAlignment.CENTER);
         // 璁剧疆鑳屾櫙
         style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
-//        style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
+        style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
+        // 瀛椾綋
+        Font font = workbook.createFont();
+        font.setFontHeightInPoints((short)12);
+        font.setBold(true);
+        style.setFont(font);
+        // 璁剧疆杈规
+        configCellBorder(style);
+        cell.setCellStyle(style);
+    }
+    private void configTitleCell (SXSSFWorkbook workbook, Cell cell ) {
+        CellStyle style = workbook.createCellStyle();
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);
+        // 璁剧疆鑳屾櫙
+        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
         // 瀛椾綋
         Font font = workbook.createFont();
         font.setFontHeightInPoints((short)12);
@@ -444,14 +477,18 @@
         try {
             sxssfWorkbook = new SXSSFWorkbook();
             Sheet sheet = sxssfWorkbook.createSheet(sheetName);
+            for (int i = 0; i < 6; i++) {
+                sheet.setColumnWidth(i, 20 * 2 * 256);
+            }
             sheet.createFreezePane(0, 1);
-            sheet.addMergedRegion(new CellRangeAddress(0   ,0,0,6));
+            sheet.addMergedRegion(new CellRangeAddress(0   ,0,0,5));
             Row title = sheet.createRow(0);
-            title.setHeight((short) 1000);
+            title.setHeight((short) 800);
             Cell c = title.createCell(0);
             c.setCellValue(sheetName);
-            configFirstCell(sxssfWorkbook,c);
+            configTitleCell(sxssfWorkbook,c);
             Row header1 = sheet.createRow(1);
+            header1.setHeight((short) 400);
             header1.createCell(0).setCellValue("鎶曚繚浼佷笟");
             header1.createCell(1).setCellValue("淇濋櫓鏂规");
             header1.createCell(2).setCellValue("淇濋櫓鐢熸晥璧锋湡");
@@ -468,17 +505,17 @@
             header2.createCell(3).setCellValue(com.doumee.core.utils.DateUtil.getPlusTime2(data.getEndTime()));
             header2.createCell(4).setCellValue(data.getInsureNum());
             header2.createCell(5).setCellValue(Constants.formatBigdecimal2Float(data.getFee()).toString());
-            //绌虹櫧琛�
-            Row header3 = sheet.createRow(3);
-            sheet.addMergedRegion(new CellRangeAddress(3  ,3,0,6));
-
-            Row header4 = sheet.createRow(4);
+            for (int i = 0; i < 6; i++) {
+                configDataCell(sxssfWorkbook,   header2.getCell(i));
+            }
+            Row header4 = sheet.createRow(3);
             header4.createCell(0).setCellValue("搴忓彿");
             header4.createCell(1).setCellValue("鍛樺伐濮撳悕");
             header4.createCell(2).setCellValue("鎬у埆");
             header4.createCell(3).setCellValue("韬唤璇佸彿");
             header4.createCell(4).setCellValue("娲鹃仯鍗曚綅");
             header4.createCell(5).setCellValue("鎵�灞炲伐绉�");
+            header4.setHeight((short) 400);
             for (int i = 0; i < 6; i++) {
                 configFirstCell(sxssfWorkbook,header4.getCell(i));
             }
@@ -487,12 +524,17 @@
                 for (int rowIndex = 0; rowIndex < data.getApplyDetailList().size(); rowIndex++) {
                     ApplyDetail d = data.getApplyDetailList().get(rowIndex);
                     Row header5 = sheet.createRow(rowIndex + 4);
+                    header5.setHeight((short) 300);
                     header5.createCell(0).setCellValue(rowIndex+1);
                     header5.createCell(1).setCellValue(StringUtils.defaultString(d.getMemberName(),""));
                     header5.createCell(2).setCellValue(Constants.equalsInteger(d.getSex(),0)?"鐢�":(Constants.equalsInteger(d.getSex(),1)?"濂�":"-"));
                     header5.createCell(3).setCellValue(StringUtils.defaultString(d.getIdcardNo(),""));
                     header5.createCell(4).setCellValue(StringUtils.defaultString(d.getDuName(),""));
                     header5.createCell(5).setCellValue(StringUtils.defaultString(d.getWorkTypeName(),""));
+                    // 璁剧疆鏁版嵁鍗曞厓鏍�
+                    for (int i = 0; i < 6; i++) {
+                        configDataCell(sxssfWorkbook,   header5.getCell(i));
+                    }
                 }
             }
             sxssfWorkbook.write(os);
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java b/server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java
index b8a13d7..0167ba5 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java
@@ -120,7 +120,6 @@
     private String duName;
 
     @ApiModelProperty(value = "鍛樺伐鍚嶇О")
-    @TableField(exist = false)
     @ExcelColumn(name="鍛樺伐濮撳悕",index =3)
     private String memberName;
 
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/ApplyDetailServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/ApplyDetailServiceImpl.java
index 1263bce..ce6f73d 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/ApplyDetailServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/ApplyDetailServiceImpl.java
@@ -22,6 +22,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
@@ -92,9 +93,29 @@
     }
 
     @Override
-    public List<ApplyDetail> findList(ApplyDetail applyDetail) {
-        QueryWrapper<ApplyDetail> wrapper = new QueryWrapper<>(applyDetail);
-        return applyDetailMapper.selectList(wrapper);
+    public List<ApplyDetail> findList(ApplyDetail applyDetailPageDTO) {
+        if(applyDetailPageDTO.getApplyId() == null){
+            return  new ArrayList<>();
+        }
+        MPJLambdaWrapper<ApplyDetail> queryWrapper = new MPJLambdaWrapper<>();
+        Utils.MP.blankToNull(applyDetailPageDTO);
+        queryWrapper.selectAll(ApplyDetail.class);
+        queryWrapper.selectAs(DispatchUnit::getName,ApplyDetail::getDuName);
+        queryWrapper.selectAs(Worktype::getName,ApplyDetail::getWorkTypeName);
+        queryWrapper.selectAs(Member::getIdcardNo,ApplyDetail::getIdcardNo);
+        queryWrapper.selectAs(Member::getName,ApplyDetail::getMemberName);
+        queryWrapper.leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId);
+        queryWrapper.leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId);
+        queryWrapper.leftJoin(Member.class,Member::getId,ApplyDetail::getMemberId);
+        queryWrapper.eq( ApplyDetail::getApplyId,applyDetailPageDTO.getApplyId());
+        List<ApplyDetail> pageData=  applyDetailJoinMapper.selectJoinList( ApplyDetail.class, queryWrapper);
+        if(pageData!=null){
+            int num = 1;
+            for (ApplyDetail d : pageData){
+                d.setSortnum(num++);
+            }
+        }
+        return pageData;
     }
 
 
@@ -177,6 +198,7 @@
         queryWrapper.selectAll(ApplyDetail.class);
         queryWrapper.selectAs(DispatchUnit::getName,ApplyDetail::getDuName);
         queryWrapper.selectAs(Worktype::getName,ApplyDetail::getWorkTypeName);
+        queryWrapper.selectAs(Member::getIdcardNo,ApplyDetail::getIdcardNo);
         queryWrapper.selectAs(Member::getName,ApplyDetail::getMemberName);
         queryWrapper.leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId);
         queryWrapper.leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId);

--
Gitblit v1.9.3