|
@@ -36,6 +36,7 @@ import com.xjrsoft.module.material.service.IMaterialTaskAssignService;
|
|
import com.xjrsoft.module.material.service.IMaterialTaskService;
|
|
import com.xjrsoft.module.material.service.IMaterialTaskService;
|
|
import com.xjrsoft.module.material.vo.MaterialTaskAssignListVo;
|
|
import com.xjrsoft.module.material.vo.MaterialTaskAssignListVo;
|
|
import com.xjrsoft.module.material.vo.MaterialTaskAssignVo;
|
|
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.MaterialTaskPageVo;
|
|
import com.xjrsoft.module.material.vo.MaterialTaskVo;
|
|
import com.xjrsoft.module.material.vo.MaterialTaskVo;
|
|
import com.xjrsoft.module.material.vo.MaterialTaskWaitPageVo;
|
|
import com.xjrsoft.module.material.vo.MaterialTaskWaitPageVo;
|
|
@@ -59,6 +60,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -194,8 +196,39 @@ public class MaterialTaskController {
|
|
@ApiOperation(value = "导出")
|
|
@ApiOperation(value = "导出")
|
|
public ResponseEntity<byte[]> exportData(@Valid @RequestBody MaterialTaskAssignListDto dto) {
|
|
public ResponseEntity<byte[]> exportData(@Valid @RequestBody MaterialTaskAssignListDto dto) {
|
|
List<MaterialTaskAssignListVo> customerList = materialTaskService.assignList(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();
|
|
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());
|
|
return RT.fileStream(bot.toByteArray(), "MaterialTask" + ExcelTypeEnum.XLSX.getValue());
|
|
}
|
|
}
|