|
@@ -1,6 +1,8 @@
|
|
|
package com.xjrsoft.module.evaluate.controller;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
+import com.alibaba.excel.support.ExcelTypeEnum;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
@@ -10,18 +12,20 @@ import com.xjrsoft.module.evaluate.dto.EvaluateResultDetailPageDto;
|
|
|
import com.xjrsoft.module.evaluate.dto.EvaluateResultIndexPageDto;
|
|
|
import com.xjrsoft.module.evaluate.dto.ResultViewingPageDto;
|
|
|
import com.xjrsoft.module.evaluate.service.IEvaluateResultService;
|
|
|
-import com.xjrsoft.module.evaluate.vo.EvaluateResultDetailPageDetailVo;
|
|
|
-import com.xjrsoft.module.evaluate.vo.EvaluateResultDetailPageVo;
|
|
|
-import com.xjrsoft.module.evaluate.vo.EvaluateResultIndexPageVo;
|
|
|
-import com.xjrsoft.module.evaluate.vo.ResultViewingPageVo;
|
|
|
+import com.xjrsoft.module.evaluate.vo.*;
|
|
|
+import com.xjrsoft.module.textbook.vo.TextbookIssueRecordExcelVo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* @title: 评价结果
|
|
@@ -72,4 +76,23 @@ public class EvaluateResultController {
|
|
|
PageOutput<ResultViewingPageVo> pageOutput = ConventPage.getPageOutput(page, ResultViewingPageVo.class);
|
|
|
return RT.ok(pageOutput);
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("/export")
|
|
|
+ @ApiOperation(value = "导出")
|
|
|
+ public ResponseEntity<byte[]> exportData() {
|
|
|
+ List<ResultViewingExportVo> customerList = evaluateResultService.getList();
|
|
|
+ List<TextbookIssueRecordExcelVo> dataList = new ArrayList<>();
|
|
|
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
|
|
|
+// for (TextbookIssueRecordPageVo textbookIssueRecordPageVo : customerList) {
|
|
|
+// if(textbookIssueRecordPageVo.getCreateDate() == null){
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// textbookIssueRecordPageVo.setCreateDateStr(sdf.format(textbookIssueRecordPageVo.getCreateDate()));
|
|
|
+// dataList.add(BeanUtil.toBean(textbookIssueRecordPageVo, TextbookIssueRecordExcelVo.class));
|
|
|
+// }
|
|
|
+ ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
|
|
+ EasyExcel.write(bot, TextbookIssueRecordExcelVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(dataList);
|
|
|
+
|
|
|
+ return RT.fileStream(bot.toByteArray(), "TextbookIssueRecord" + ExcelTypeEnum.XLSX.getValue());
|
|
|
+ }
|
|
|
}
|