Przeglądaj źródła

材料缴交bug修复

dzx 2 miesięcy temu
rodzic
commit
ca78f486d7

+ 34 - 1
src/main/java/com/xjrsoft/module/material/controller/MaterialTaskController.java

@@ -36,6 +36,7 @@ import com.xjrsoft.module.material.service.IMaterialTaskAssignService;
 import com.xjrsoft.module.material.service.IMaterialTaskService;
 import com.xjrsoft.module.material.vo.MaterialTaskAssignListVo;
 import com.xjrsoft.module.material.vo.MaterialTaskAssignVo;
+import com.xjrsoft.module.material.vo.MaterialTaskExcelVo;
 import com.xjrsoft.module.material.vo.MaterialTaskPageVo;
 import com.xjrsoft.module.material.vo.MaterialTaskVo;
 import com.xjrsoft.module.material.vo.MaterialTaskWaitPageVo;
@@ -59,6 +60,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.validation.Valid;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -194,8 +196,39 @@ public class MaterialTaskController {
     @ApiOperation(value = "导出")
     public ResponseEntity<byte[]> exportData(@Valid @RequestBody MaterialTaskAssignListDto dto) {
         List<MaterialTaskAssignListVo> customerList = materialTaskService.assignList(dto);
+        List<MaterialTaskExcelVo> dataList = new ArrayList<>();
+        for (int i = 0; i < customerList.size(); i ++){
+            int finalI = i;
+            MaterialTaskAssignListVo listVo = customerList.get(i);
+            MaterialTaskExcelVo excelVo = new MaterialTaskExcelVo();
+            excelVo.setSortCode(finalI + 1);
+            excelVo.setName(listVo.getName());
+            excelVo.setUserNumber(listVo.getUserNumber());
+            String userType = "";
+            if(listVo.getUserType() != null && listVo.getUserType() == 1){
+                userType = "教职工";
+            }else if(listVo.getUserType() != null && listVo.getUserType() == 2){
+                userType = "学生";
+            }
+            excelVo.setUserType(userType);
+            excelVo.setDeptName(listVo.getDeptName());
+            //状态 1=未提交 2=待审核 3=通过 4=重做
+            String state = "";
+            if(listVo.getStatus() != null && listVo.getUserType() == 1){
+                state = "未提交";
+            }else if(listVo.getStatus() != null && listVo.getUserType() == 2){
+                state = "待审核";
+            }else if(listVo.getStatus() != null && listVo.getUserType() == 3){
+                state = "通过";
+            }else if(listVo.getStatus() != null && listVo.getUserType() == 4){
+                state = "重做";
+            }
+            excelVo.setStatus(state);
+            dataList.add(excelVo);
+        }
+
         ByteArrayOutputStream bot = new ByteArrayOutputStream();
-        EasyExcel.write(bot, MaterialTaskAssignListVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(customerList);
+        EasyExcel.write(bot, MaterialTaskExcelVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(dataList);
 
         return RT.fileStream(bot.toByteArray(), "MaterialTask" + ExcelTypeEnum.XLSX.getValue());
     }

+ 22 - 56
src/main/java/com/xjrsoft/module/material/vo/MaterialTaskExcelVo.java

@@ -3,10 +3,12 @@ package com.xjrsoft.module.material.vo;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.write.style.ContentStyle;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.xjrsoft.module.system.entity.File;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.time.LocalDate;
+import java.util.List;
 
 /**
 * @title: 材料提交任务分页列表出参
@@ -17,62 +19,26 @@ import java.time.LocalDate;
 @Data
 public class MaterialTaskExcelVo {
 
-    /**
-     * 材料提交任务类型(material_type)
-     */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("材料提交任务类型(material_type)")
-    @ApiModelProperty("材料提交任务类型(material_type)")
-    private String materialTypeIdCn;
-    /**
-    * 任务名称
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("任务名称")
-    @ApiModelProperty("任务名称")
-    private String name;
-    /**
-    * 要求完成日期
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("要求完成日期")
-    @ApiModelProperty("要求完成日期")
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    private LocalDate requiredCompleteTime;
-    /**
-    * 要求
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("要求")
-    @ApiModelProperty("要求")
-    private String requirement;
-    /**
-    * 指派给几人
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("指派给几人")
-    @ApiModelProperty("指派给几人")
-    private Integer assignPerson;
-    /**
-    * 已提交人数
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("已提交人数")
-    @ApiModelProperty("已提交人数")
-    private Integer submitedPerson;
-    /**
-    * 按时提交
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("按时提交")
-    @ApiModelProperty("按时提交")
-    private Integer onTimePerson;
-    /**
-    * 延迟提交
-    */
-    @ContentStyle(dataFormat = 49)
+
+    @ExcelProperty("序号")
+    private Integer sortCode;
+
     @ExcelProperty("延迟提交")
-    @ApiModelProperty("延迟提交")
-    private Integer timeDelay;
+    private String name;
+
+    @ExcelProperty("学号/工号")
+    @ApiModelProperty("学号/工号")
+    private String userNumber;
+
+    @ExcelProperty("身份")
+    @ApiModelProperty("用户类型 1=孝职工 2=学生")
+    private String userType;
+
+    @ExcelProperty("部门")
+    private String deptName;
+
+    @ExcelProperty("状态")
+    @ApiModelProperty("状态 1=未提交 2=待审核 3=通过 4=重做")
+    private String status;
 
 }