|
@@ -691,6 +691,40 @@ public class MaterialInfoController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping("/excelByIds")
|
|
|
+ public void getExcelReport(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject requestJson) {
|
|
|
+ JSONArray ids = requestJson.getJSONArray("ids");
|
|
|
+ if (Check.isNull(ids)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<JSONObject> list = materialInfoService.excelByIds(ids);
|
|
|
+ if (!Check.isNull(list)) {
|
|
|
+ try {
|
|
|
+ List<List<Object>> excelList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ JSONObject jsonObject = list.get(i);
|
|
|
+ List<Object> temp = new ArrayList<>();
|
|
|
+ temp.add(jsonObject.getString("name"));
|
|
|
+ temp.add(jsonObject.getString("url"));
|
|
|
+
|
|
|
+ excelList.add(temp);
|
|
|
+
|
|
|
+ }
|
|
|
+ OutputStream os = response.getOutputStream();
|
|
|
+ ExportExcelUtils eeu = new ExportExcelUtils();
|
|
|
+ XSSFWorkbook workbook = new XSSFWorkbook();
|
|
|
+ String[] titles = {"素材名称", "素材链接"};
|
|
|
+ eeu.exportExcelForAttendance(workbook, 0, "素材信息", titles, excelList);
|
|
|
+ HttpUtils.setResponseHeader(response, "clockIn.xlsx");
|
|
|
+ workbook.write(os);
|
|
|
+ os.flush();
|
|
|
+ os.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ log.error(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
|
|
|
@GetMapping(value = "/supplierList")
|