From f43258c4e2394cb6182db9c94f5c5a6d033fd5d4 Mon Sep 17 00:00:00 2001 From: mrzhssss <pro6@qq.com> Date: 星期一, 12 九月 2022 13:53:41 +0800 Subject: [PATCH] ## --- src/main/java/zy/cloud/wms/manager/controller/ItemReportController.java | 87 ++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 84 insertions(+), 3 deletions(-) diff --git a/src/main/java/zy/cloud/wms/manager/controller/ItemReportController.java b/src/main/java/zy/cloud/wms/manager/controller/ItemReportController.java index a6e0717..5ceea8a 100644 --- a/src/main/java/zy/cloud/wms/manager/controller/ItemReportController.java +++ b/src/main/java/zy/cloud/wms/manager/controller/ItemReportController.java @@ -7,6 +7,10 @@ import com.baomidou.mybatisplus.plugins.Page; import com.core.common.DateUtils; import com.core.exception.CoolException; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.util.CellAddress; +import org.apache.poi.xssf.usermodel.*; import zy.cloud.wms.manager.entity.Cstmr; import zy.cloud.wms.manager.entity.Item; import zy.cloud.wms.manager.entity.ItemReport; @@ -20,6 +24,11 @@ import org.springframework.web.bind.annotation.*; import zy.cloud.wms.manager.service.ItemService; +import javax.servlet.http.HttpServletResponse; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; import java.util.*; @RestController @@ -76,11 +85,35 @@ @RequestMapping(value = "/itemReport/update/auth") @ManagerAuth - public R update(ItemReport itemReport){ - if (Cools.isEmpty(itemReport) || null==itemReport.getId()){ + public R update(ItemReport report){ + if (Cools.isEmpty(report) || null==report.getId()){ return R.error(); } - itemReportService.updateById(itemReport); + if (report.getDeliverReason() == null || report.getDeliverReason().equals("")) { + report.setDeliverIssue(false); + }else { + report.setDeliverIssue(true); + } + + if (report.getQualityReason() == null || report.getQualityReason().equals("")) { + report.setQualityIssue(false); + }else { + report.setQualityIssue(true); + } + + if (report.getDesignReason() == null || report.getDesignReason().equals("")) { + report.setDesignIssue(false); + }else { + report.setDesignIssue(true); + } + + if (report.getInstallReason() == null || report.getInstallReason().equals("")) { + report.setInstallIssue(false); + }else { + report.setInstallIssue(true); + } + itemReportService.update(report,new EntityWrapper<ItemReport>() + .eq("id",report.getId())); return R.ok(); } @@ -144,4 +177,52 @@ } return R.ok(result); } + + @RequestMapping("/itemReport/makeReport/auth") + public HttpServletResponse makeReport(@RequestParam("id") String id, HttpServletResponse response){ + /** + * 鎺х涓庡垵濮嬪寲 + * + */ + if (Cools.isEmpty(id)) { + throw new CoolException("闇�瑕佺敓鎴愭姤鍛婄殑椤圭洰涓虹┖,鏃犳硶鐢熸垚"); + } + Item item = itemService.selectOne(new EntityWrapper<Item>() + .eq("id", id)); + ItemReport itemReport = itemReportService.selectOne(new EntityWrapper<ItemReport>() + .eq("item_id", id)); + if (Cools.isEmpty(item) || Cools.isEmpty(itemReport)) { + throw new CoolException("鎵句笉鍒拌椤圭洰鎴栨槸椤圭洰鐨勬�荤粨"); + } + return itemReportService.makeReport(item,itemReport, response); + } + + public static void main(String[] args) { + FileOutputStream out = null; + FileInputStream in = null; + try { + in = new FileInputStream("src/main/resources/excel/analysis_report.xlsx"); + out = new FileOutputStream("C:\\Users\\Zhs\\Desktop\\report.xlsx"); + XSSFWorkbook wb = new XSSFWorkbook(in); + XSSFSheet mainSheet = wb.getSheet("鎶ュ憡"); + + XSSFRow row10 = mainSheet.getRow(11); + XSSFCell cell = row10.getCell(1); + cell.setCellValue("涓哄暐浣犲氨鍙互鍛�?"); + wb.write(out); + out.flush(); + } catch (IOException e) { + e.printStackTrace(); + }finally { + try { + out.close(); + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + + + } + + } } -- Gitblit v1.9.1