Commit 5c23d87f7fbe2cedc85c63b7352cc14aa41cc1bc

Authored by 房远帅
1 parent de999aee

试样订单:跟踪单-导出

... ... @@ -7,6 +7,7 @@ import com.lframework.xingyun.sc.entity.SampleFeedbackTrackingDetail;
7 7 import com.lframework.xingyun.sc.service.sample.SampleFeedbackTrackingDetailService;
8 8 import com.lframework.xingyun.sc.utils.ExcelUtil;
9 9 import com.lframework.xingyun.sc.utils.LatexFormulaExcelExporterUtil;
  10 +import com.lframework.xingyun.sc.vo.sample.tracking.CreateSampleResultTrackingVo;
10 11 import com.lframework.xingyun.sc.vo.sample.tracking.QuerySampleFeedbackTrackingDetailVo;
11 12 import com.lframework.xingyun.sc.vo.sample.tracking.QuerySampleResultTrackingVo;
12 13 import com.lframework.xingyun.sc.service.sample.SampleResultTrackingService;
... ... @@ -15,7 +16,9 @@ import com.lframework.starter.web.core.utils.PageResultUtil;
15 16 import com.lframework.starter.web.core.components.resp.PageResult;
16 17 import com.lframework.starter.web.core.components.resp.InvokeResult;
17 18 import javax.annotation.Resource;
  19 +import javax.imageio.ImageIO;
18 20 import javax.servlet.http.HttpServletResponse;
  21 +import javax.swing.*;
19 22 import javax.validation.constraints.NotBlank;
20 23 import com.lframework.xingyun.sc.vo.sample.tracking.UpdateSampleResultTrackingVo;
21 24 import io.swagger.annotations.ApiImplicitParam;
... ... @@ -27,21 +30,25 @@ import io.swagger.annotations.Api;
27 30 import lombok.extern.slf4j.Slf4j;
28 31 import org.apache.commons.collections.CollectionUtils;
29 32 import org.apache.commons.lang3.StringUtils;
30   -import org.apache.poi.ss.usermodel.Sheet;
31   -import org.apache.poi.ss.usermodel.Workbook;
  33 +import org.apache.poi.ss.usermodel.*;
32 34 import org.apache.poi.util.IOUtils;
33 35 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  36 +import org.scilab.forge.jlatexmath.TeXConstants;
  37 +import org.scilab.forge.jlatexmath.TeXFormula;
  38 +import org.scilab.forge.jlatexmath.TeXIcon;
34 39 import org.springframework.web.bind.annotation.DeleteMapping;
35 40 import com.lframework.starter.web.core.controller.DefaultBaseController;
36 41 import com.lframework.starter.web.core.annotations.security.HasPermission;
37 42 import org.springframework.validation.annotation.Validated;
38 43 import org.springframework.web.bind.annotation.*;
39 44 import javax.validation.Valid;
40   -import java.io.FileNotFoundException;
41   -import java.io.IOException;
42   -import java.io.InputStream;
  45 +import java.awt.*;
  46 +import java.awt.Color;
  47 +import java.awt.image.BufferedImage;
  48 +import java.io.*;
43 49 import java.net.URLEncoder;
44 50 import java.util.*;
  51 +import java.util.List;
45 52 import java.util.stream.Collectors;
46 53
47 54 /**
... ... @@ -99,6 +106,19 @@ public class SampleResultTrackingController extends DefaultBaseController {
99 106 }
100 107
101 108 /**
  109 + * 新增
  110 + */
  111 + @ApiOperation("新增")
  112 + @HasPermission({"sample:tracking:add"})
  113 + @PostMapping
  114 + public InvokeResult<Void> create(@Valid @RequestBody CreateSampleResultTrackingVo vo) {
  115 +
  116 + sampleResultTrackingService.create(vo);
  117 +
  118 + return InvokeResultBuilder.success();
  119 + }
  120 +
  121 + /**
102 122 * 修改
103 123 */
104 124 @ApiOperation("修改")
... ... @@ -139,7 +159,7 @@ public class SampleResultTrackingController extends DefaultBaseController {
139 159
140 160 try {
141 161 // 加载模板文件
142   - ClassPathResource templateResource = new ClassPathResource("templates/confirmationSlipTemplate.xlsx");
  162 + ClassPathResource templateResource = new ClassPathResource("templates/resultTrackingTemplate.xlsx");
143 163 try (InputStream inputStream = templateResource.getStream();
144 164 Workbook workbook = new XSSFWorkbook(inputStream)) {
145 165 try {
... ... @@ -179,7 +199,7 @@ public class SampleResultTrackingController extends DefaultBaseController {
179 199
180 200 String latex = LatexFormulaExcelExporterUtil.convertToLatex(formulaComponentList);
181 201 if (StringUtils.isNotBlank(latex)) {
182   - LatexFormulaExcelExporterUtil.insertLatexImageToCell(workbook, sheet, latex, startRow, 4, 2, 3);
  202 + LatexFormulaExcelExporterUtil.insertLatexImageToCell(workbook, sheet, latex, startRow, 2, 1, 2);
183 203 }
184 204
185 205 ExcelUtil.setCellValue(sheet, startRow, 4, detail.getStatus());
... ... @@ -194,7 +214,7 @@ public class SampleResultTrackingController extends DefaultBaseController {
194 214 dataMap.put("customerName", data.getCustomerName() == null ? "" : data.getCustomerName());
195 215 dataMap.put("workshopName", data.getWorkshopName() == null ? "" : data.getWorkshopName());
196 216 dataMap.put("orderCode", data.getOrderCode() == null ? "" : data.getOrderCode());
197   - dataMap.put("surface", data.getWorkshopName() == null ? "" : data.getWorkshopName());
  217 + dataMap.put("surface", data.getSurface() == null ? "" : data.getSurface());
198 218 dataMap.put("performance", data.getPerformance() == null ? "" : data.getPerformance());
199 219 dataMap.put("tolerance", data.getTolerance() == null ? "" : data.getTolerance());
200 220 dataMap.put("bandingPattern", data.getBandingPattern() == null ? "" : data.getBandingPattern());
... ... @@ -222,9 +242,9 @@ public class SampleResultTrackingController extends DefaultBaseController {
222 242 }
223 243
224 244 } catch (FileNotFoundException e) {
225   - throw new RuntimeException("模板文件不存在: templates/confirmationSlipTemplate.xlsx", e);
  245 + throw new RuntimeException("模板文件不存在: templates/resultTrackingTemplate.xlsx", e);
226 246 } catch (IOException e) {
227   - throw new RuntimeException("无法读取模板文件: templates/confirmationSlipTemplate.xlsx", e);
  247 + throw new RuntimeException("无法读取模板文件: templates/resultTrackingTemplate.xlsx", e);
228 248 }
229 249 } catch (Exception e) {
230 250 log.error("产品试样结果跟踪单打印: {}", e.getMessage(), e);
... ...
... ... @@ -53,7 +53,7 @@ public class CreateSampleResultTrackingVo implements BaseVo, Serializable {
53 53 /**
54 54 * 明细数据
55 55 */
56   - @ApiModelProperty("客户ID")
  56 + @ApiModelProperty("明细数据")
57 57 private List<SampleFeedbackTrackingDetail> sampleFeedbackTrackingDetailList;
58 58
59 59 }
... ...
... ... @@ -70,7 +70,7 @@
70 70 tb.create_by_id,
71 71 tb.update_by_id,
72 72 tb.create_time,
73   - tb.update_time,
  73 + tb.update_time
74 74 FROM sample_result_tracking AS tb
75 75 left join base_data_customer as cu on cu.id = tb.customer_id
76 76 left join base_data_workshop as ws on ws.id = tb.workshop_id
... ...