浏览代码

纠错报表添加,包括模板提交

guozx 3 年之前
父节点
当前提交
101c80196b

+ 57 - 222
application-facade/src/main/java/com/factory/controller/web/FileBlobController.java

@@ -9,6 +9,7 @@ import com.factory.web.entity.fa.FirstArticleTitle;
 import com.factory.web.entity.fa.FirstArticleTitleBlob;
 import com.factory.web.entity.pm.OnsiteTitle;
 import com.factory.web.entity.pm.OnsiteTitleBlob;
+import com.factory.web.entity.pm.req.SearchPmCheckRecordListReq;
 import com.factory.web.service.FileService;
 import com.factory.web.service.fa.FirstArticleService;
 import com.factory.web.service.fa.FirstArticleTitleBlobService;
@@ -147,245 +148,79 @@ public class FileBlobController {
         }
     }
 
-    /**
-     * demo 测试
-     * @param args
-     * @throws IOException
-     */
-    public static void main(String[] args) throws IOException {
-//        System.out.println(LocalDate.now().getDayOfMonth());
 
-        Workbook wb = new SXSSFWorkbook(500);
-        Sheet sheet = Utility.createSheet(wb, "纠错检查");
-        XSSFCellStyle cellStyle = Utility.getTitleCellStyle(wb);
-        XSSFCellStyle cellStyleLeft = Utility.getTitleCellLeftStyle(wb,(short)10);
-
-        FileInputStream in = new FileInputStream(new File("/Users/hisoka/Downloads/ben.png"));
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        byte[] b = new byte[1024];
-        int len = -1;
-        while ((len = in.read(b)) != -1) {
-            bos.write(b, 0, len);
-        }
-        ByteArrayInputStream inb = new ByteArrayInputStream(bos.toByteArray());    //将b作为输入流;
-        BufferedImage bufferImg = ImageIO.read(inb);
-        String[] data = new String[]{"Benteler Automotive (shenyang) Co. , Ltd",
-                "Pokayoke Checking Sheet for Production",
-                "模板编号: T.0702.Eng.022.An.02\n" +
-                        "发布日期: 2020-10-26\n" +
-                        "模板版本: 11\n" +
-                        "部门:工程部\n" +
-                        "上一版本: 2019-11-01"
-        };
-        createTitle1(wb, sheet, cellStyle, 0, data, bufferImg);
-        data = new String[]{"{companyName}",
-                "{name}"
-        };
-        createTitle2(sheet, cellStyle, 1, data);
-        data = new String[]{"Production line: {productionLine}",
-                "Shift:{shift}",
-                "Setter/Jumper:{setter}",
-                "Year:{year}",
-                "Month:{month}"
-        };
-        createTitle3(sheet, cellStyle, 2, data);
-        createItemInfoTitle(sheet, cellStyle, 3);
-        data = new String[]{"点检负责人", "", ""};
-        createOperaterTitle(sheet, cellStyle, 5, data);
-
-        data=new String[]{"防错点检在每班开班后按规定频次进行,防错点检不合格,不允许进行批量生产。防错系统维修后,需重新进行防错点检;若防错短时间内无法修复,需填写特殊放行申请《0702,QM,201-2》及按照不合格品管理流程进行追溯。\n" +
-                "检查结果记录方法The Method of filling form: 符合: 打√            不符合打×, 立即通知倒班主任及维修人员,在点检表背面记录异常。"};
-        createTitle4(sheet, cellStyleLeft, 6, data);
-        data = new String[]{"Edited By: {editedBy}", "Checked By:{checkedBy}", "Approved By:{approvedBy}"};
-        createTitle5(sheet, cellStyle, 7, data);
-        FileOutputStream out = new FileOutputStream("/Users/hisoka/Downloads/1.xlsx");
-        wb.write(out);
-        out.close();
-    }
-
-    /**
-     * @param sheet
-     * @param cellStyle
-     * @param rowIndex
-     * @param data
-     */
-    private static void createTitle1(Workbook wb, Sheet sheet, XSSFCellStyle cellStyle, int rowIndex, String[] data, BufferedImage bufferImg) throws IOException {
-        Row row = sheet.createRow(rowIndex);
-        row.setHeight((short) (34 * 20));
-        CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 0, 2);
-        sheet.addMergedRegion(cra);
-        cra = new CellRangeAddress(rowIndex, rowIndex, 3, 20);
-        sheet.addMergedRegion(cra);
-        cra = new CellRangeAddress(rowIndex, rowIndex + 1, 21, 27);
-        sheet.addMergedRegion(cra);
-        cra = new CellRangeAddress(rowIndex, rowIndex + 1, 28, 36);
-        sheet.addMergedRegion(cra);
-        for (int i = 0; i < 37; i++) {
-            row.createCell(i).setCellStyle(cellStyle);
-        }
-
-        Utility.addCellValForStr(row.getCell(0), data[0], cellStyle);
-        Utility.addCellValForStr(row.getCell(3), data[1], Utility.getTitleCellStyle(wb, (short) 15));
-        Utility.addCellValForStr(row.getCell(21), data[2], cellStyle);
-
-        ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
-        // 将图片写入流中
-        ImageIO.write(bufferImg, "png", byteArrayOut);
-        // 利用HSSFPatriarch将图片写入EXCEL
-        XSSFDrawing patriarch = (XSSFDrawing) sheet.createDrawingPatriarch();
-        //图片一导出到单元格B2中
-        XSSFClientAnchor anchor = new XSSFClientAnchor(10, 10, 255, 255,
-                (short) 28, 0, (short) 36, 2);
-        // 插入图片
-        patriarch.createPicture(anchor, wb.addPicture(byteArrayOut
-                .toByteArray(), HSSFWorkbook.PICTURE_TYPE_PNG));
-        byteArrayOut.close();
-    }
-
-    private static void createTitle2(Sheet sheet, XSSFCellStyle cellStyle, int rowIndex, String[] data) {
-        Row row = sheet.createRow(rowIndex);
-        row.setHeight((short) (39.5 * 20));
-        CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 0, 2);
-        sheet.addMergedRegion(cra);
-        cra = new CellRangeAddress(rowIndex, rowIndex, 3, 20);
-        sheet.addMergedRegion(cra);
-        for (int i = 0; i < 37; i++) {
-            row.createCell(i).setCellStyle(cellStyle);
-        }
-    }
-
-
-    private static void createTitle3(Sheet sheet, XSSFCellStyle cellStyle, int rowIndex, String[] data) {
-        Row row = sheet.createRow(rowIndex);
-        row.setHeight((short) (25.5 * 20));
-        CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 0, 2);
-        sheet.addMergedRegion(cra);
-        cra = new CellRangeAddress(rowIndex, rowIndex, 3, 6);
-        sheet.addMergedRegion(cra);
-        cra = new CellRangeAddress(rowIndex, rowIndex, 7, 20);
-        sheet.addMergedRegion(cra);
-        cra = new CellRangeAddress(rowIndex, rowIndex, 21, 27);
-        sheet.addMergedRegion(cra);
-        cra = new CellRangeAddress(rowIndex, rowIndex, 28, 36);
-        sheet.addMergedRegion(cra);
-        for (int i = 0; i < 37; i++) {
-            row.createCell(i).setCellStyle(cellStyle);
-        }
-        Utility.addCellValForStr(row.getCell(0), data[0], cellStyle);
-        Utility.addCellValForStr(row.getCell(3), data[1], cellStyle);
-        Utility.addCellValForStr(row.getCell(7), data[2], cellStyle);
-        Utility.addCellValForStr(row.getCell(21), data[3], cellStyle);
-        Utility.addCellValForStr(row.getCell(28), data[4], cellStyle);
-    }
-
-    private static void createTitle4(Sheet sheet, XSSFCellStyle cellStyle, int rowIndex, String[] data) {
-        Row row = sheet.createRow(rowIndex);
-        row.setHeight((short) (33.25 * 20));
-        CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 0, 36);
-        sheet.addMergedRegion(cra);
-        for (int i = 0; i < 37; i++) {
-            row.createCell(i).setCellStyle(cellStyle);
-        }
-        Utility.addCellValForStr(row.getCell(0), data[0], cellStyle);
-    }
-
-    private static void createTitle5(Sheet sheet, XSSFCellStyle cellStyle, int rowIndex, String[] data) {
-        Row row = sheet.createRow(rowIndex);
-        row.setHeight((short) (25 * 20));
-        CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 0, 5);
-        sheet.addMergedRegion(cra);
-        cra = new CellRangeAddress(rowIndex, rowIndex, 6, 21);
-        sheet.addMergedRegion(cra);
-        cra = new CellRangeAddress(rowIndex, rowIndex, 22, 36);
-        sheet.addMergedRegion(cra);
-        for (int i = 0; i < 37; i++) {
-            row.createCell(i).setCellStyle(cellStyle);
-        }
-        Utility.addCellValForStr(row.getCell(0), data[0], cellStyle);
-        Utility.addCellValForStr(row.getCell(6), data[1], cellStyle);
-        Utility.addCellValForStr(row.getCell(22), data[2], cellStyle);
-    }
-
-
-    private static void createOperaterTitle(Sheet sheet, XSSFCellStyle cellStyle, int rowIndex, String[] data) {
-        Row row = sheet.createRow(rowIndex);
-        row.setHeight((short) (25 * 20));
-        CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 0, 2);
-        sheet.addMergedRegion(cra);
-        cra = new CellRangeAddress(rowIndex, rowIndex, 3, 18);
-        sheet.addMergedRegion(cra);
-        cra = new CellRangeAddress(rowIndex, rowIndex, 19, 33);
-        sheet.addMergedRegion(cra);
-        cra = new CellRangeAddress(rowIndex, rowIndex, 34, 36);
-        sheet.addMergedRegion(cra);
-
-        for (int i = 0; i < 37; i++) {
-            row.createCell(i).setCellStyle(cellStyle);
+    @GetMapping("/controlled/onsite")
+    @ApiOperation(value = "纠错受控文件下载")
+    public void downloadControlledOnsite(SearchPmCheckRecordListReq param, HttpServletResponse response,HttpServletRequest request) throws IOException {
+        response.setContentType("application/octet-stream");
+        String fileName = System.currentTimeMillis() + "." + "xlsx";
+        response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
+       // SearchPmCheckRecordListReq pp=SearchPmCheckRecordListReq.builder().bentelerPlanId(27L).typeFlag(0).yearMonth("2021-07").build();
+        Workbook wb =fileService.onsiteControlledExcel( param,request,true);
+        OutputStream outputStream = null;
+        try {
+            outputStream = response.getOutputStream();
+            wb.write(outputStream);
+            outputStream.flush();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            if (outputStream != null) {
+                try {
+                    outputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
         }
-        Utility.addCellValForStr(row.getCell(0), data[0], cellStyle);
-        Utility.addCellValForStr(row.getCell(3), data[1], cellStyle);
-        Utility.addCellValForStr(row.getCell(19), data[2], cellStyle);
     }
 
-    private static void createItemInfoTitle(Sheet sheet, XSSFCellStyle cellStyle, int rowIndex) {
-        List<String> head = new ArrayList<>();
-        HashMap<Integer, Integer> cwMap = new HashMap<>();
-        head.addAll(Arrays.asList("频次", "OP", "点检内容"));
-        cwMap.put(0, (short) 6.6 * 256);
-        cwMap.put(1, (short) 6.6 * 256);
-        cwMap.put(2, (short) 38.7 * 256);
-        for (int i = 1; i <= 31; i++) {
-            head.add(i + "");
-            cwMap.put(i + 2, (short) 4 * 256);
-        }
-        head.add("防错维修后点检");
-        cwMap.put(34, (short) 8 * 256);
-        cwMap.put(35, (short) 8 * 256);
-        cwMap.put(36, (short) 3.5 * 256);
-        CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 34, 36);
-        sheet.addMergedRegion(cra);
-        Row row = sheet.createRow(rowIndex);
-        row.setHeight((short) (23.75 * 20));
-        for (int i = 0; i < head.size() + 2; i++) {
-            sheet.setColumnWidth((short) i, (short) cwMap.get(i).intValue());
-            row.createCell(i).setCellStyle(cellStyle);
-        }
-        for (int i = 0; i < head.size(); i++) {
-            Utility.addCellValForStr(row.getCell(i), head.get(i), cellStyle);
+    @GetMapping("/onsite/work/report")
+    @ApiOperation(value = "纠错报表下载")
+    public void downloadOnsiteReport(SearchPmCheckRecordListReq param, HttpServletResponse response,HttpServletRequest request) throws IOException {
+        response.setContentType("application/octet-stream");
+        String fileName = System.currentTimeMillis() + "." + "xlsx";
+        response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
+        Workbook wb =fileService.onsiteControlledExcel( param,request,false);
+        OutputStream outputStream = null;
+        try {
+            outputStream = response.getOutputStream();
+            wb.write(outputStream);
+            outputStream.flush();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            if (outputStream != null) {
+                try {
+                    outputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
         }
     }
 
     @GetMapping("/addIniPlan")
-    public void addIniPlan(HttpServletRequest request) {
-//        @ApiModelProperty(value = "issueDate")
-//        private String issueDate;
-//
-//        @ApiModelProperty(value = "issureLevel")
-//        private String issureLevel;
-//
-//        @ApiModelProperty(value = "department")
-//        private String department;
-//
-//        @ApiModelProperty(value = "replace")
-//        private String replace;
-//
-//        @ApiModelProperty(value = "productionLine")
-//        private String productionLine;
-//
-//        @ApiModelProperty(value = "附件id")
-//        private String uploadAttachmentId;
-       // FirstArticleTitle ;
+    public void addIniPlan(HttpServletRequest request) throws IOException {
+
         OnsiteTitle title= OnsiteTitle.builder().department("1111").issueDate("2020-01-01").issureLevel("hjgsajhasd")
                 .productionLine("12r3y12t3").replace("jsadhgas").uploadAttachmentId("17").build();
+
+        ByteArrayOutputStream baos =new ByteArrayOutputStream();
+        ObjectOutputStream oos =new ObjectOutputStream(baos);
+        oos.writeObject(title);
         OnsiteTitleBlob testEntry = OnsiteTitleBlob.builder().bentelerPlanId(Long.parseLong("27"))//设置机会id
-                .titleContent(JSON.toJSONString(title).getBytes(StandardCharsets.UTF_8)).build();
+                .titleContent(baos.toByteArray()).build();
         blobService.save(testEntry);
 
         FirstArticleTitle ftitle= FirstArticleTitle.builder().project("1").partname("1").partNoOem("2").productgroup("1")
                 .gpin("asdasd").language("asd").oem("asdas").statusDoc("asdasd").version("asdas")
                 .batMaterial("asdasd").lastChange("asdasd").dmbA("asbdjasd").uploadAttachmentId("17").build();
+        baos =new ByteArrayOutputStream();
+        oos =new ObjectOutputStream(baos);
+        oos.writeObject(ftitle);
         FirstArticleTitleBlob testEntry2 = FirstArticleTitleBlob.builder().bentelerPlanId(Long.parseLong("38"))//设置机会id
-                .titleContent(JSON.toJSONString(title).getBytes(StandardCharsets.UTF_8)).build();
+                .titleContent(baos.toByteArray()).build();
         blobService2.save(testEntry2);
         System.out.println("11111111111111111111111111111111111111111");
     }

+ 3 - 41
application-facade/src/main/java/com/factory/web/entity/excel/Utility.java

@@ -20,10 +20,10 @@ public class Utility {
      * @param isTitle
      * @return
      */
-    public static XSSFCellStyle getTitleCellStyle(Workbook wb) {
+    public static XSSFCellStyle getTitleCellStyle(Workbook wb, short fontSize,short align) {
         XSSFCellStyle cellStyle = (XSSFCellStyle) wb.createCellStyle();
         XSSFFont font = (XSSFFont) wb.createFont();
-        font.setFontHeightInPoints((short) 10);
+        font.setFontHeightInPoints(fontSize);
         cellStyle.setFont(font);//选择需要用到的字体格式
         cellStyle.setWrapText(true);
         //设置边框:
@@ -32,51 +32,13 @@ public class Utility {
         cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);//上边框
         cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);//右边框
         //设置居中:
-        cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 居中
+        cellStyle.setAlignment(align); // 居中对齐
         cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
 
         return cellStyle;
     }
 
-    public static XSSFCellStyle getTitleCellStyle(Workbook wb, short fontSize) {
-        XSSFCellStyle cellStyle = (XSSFCellStyle) wb.createCellStyle();
-
-        XSSFFont font = (XSSFFont) wb.createFont();
-        font.setFontHeightInPoints((short) fontSize);
-        cellStyle.setFont(font);//选择需要用到的字体格式
-
-        cellStyle.setWrapText(true);
-        //设置边框:
-        cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框
-        cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);//左边框
-        cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);//上边框
-        cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);//右边框
-        //设置居中:
-        cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 居中
-        cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
-
-        return cellStyle;
-    }
 
-    public static XSSFCellStyle getTitleCellLeftStyle(Workbook wb, short fontSize) {
-        XSSFCellStyle cellStyle = (XSSFCellStyle) wb.createCellStyle();
-
-        XSSFFont font = (XSSFFont) wb.createFont();
-        font.setFontHeightInPoints((short) fontSize);
-        cellStyle.setFont(font);//选择需要用到的字体格式
-
-        cellStyle.setWrapText(true);
-        //设置边框:
-        cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框
-        cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);//左边框
-        cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);//上边框
-        cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);//右边框
-        //设置居中:
-        cellStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT); // 左边
-        cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
-
-        return cellStyle;
-    }
 
 
     public static Sheet createSheet(Workbook wb, String name) {

+ 4 - 1
application-facade/src/main/java/com/factory/web/entity/pm/res/PmPlanRes.java

@@ -35,7 +35,7 @@ public class PmPlanRes implements Serializable {
 
 	@ApiModelProperty(value = "计划名称")
 	private String bentelerPlanName;
-	
+
 	@ApiModelProperty(value = "计划类型 1首件 2防错")
 	private Integer planType;
 
@@ -45,6 +45,9 @@ public class PmPlanRes implements Serializable {
 	@ApiModelProperty(value = "日周月点检规则")
 	private List<OnsiteCalendar> onsiteCalendarList;
 
+	@ApiModelProperty(value = "创建人")
+	private Long createdUserId;
+
 	@ApiModelProperty(value = "表头信息")
 	private OnsiteTitle onsiteTitle;
 

+ 7 - 0
application-facade/src/main/java/com/factory/web/service/FileService.java

@@ -1,7 +1,14 @@
 package com.factory.web.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.factory.web.entity.pm.req.SearchPmCheckRecordListReq;
 import com.factory.web.service.impl.FileEntry;
+import org.apache.poi.ss.usermodel.Workbook;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
 
 public interface FileService extends IService<FileEntry> {
+
+    public Workbook onsiteControlledExcel(SearchPmCheckRecordListReq param, HttpServletRequest request,boolean iscontroller) throws IOException;
 }

+ 378 - 1
application-facade/src/main/java/com/factory/web/service/impl/FileServiceImpl.java

@@ -1,12 +1,389 @@
 package com.factory.web.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.factory.base.entity.aggregates.ResponseBean;
+import com.factory.base.entity.constant.CacheConstant;
+import com.factory.base.entity.constant.SystemConstant;
+import com.factory.user.service.UserInfoService;
+import com.factory.web.entity.excel.Utility;
+import com.factory.web.entity.pm.OnsiteApprovalPlan;
+import com.factory.web.entity.pm.OnsiteCalendar;
+import com.factory.web.entity.pm.req.SearchPmCheckRecordListReq;
+import com.factory.web.entity.pm.req.SearchPmPlanReq;
+import com.factory.web.entity.pm.res.PmCheckRecordItemListRes;
+import com.factory.web.entity.pm.res.PmCheckRecordListRes;
+import com.factory.web.entity.pm.res.PmCheckRecordRes;
+import com.factory.web.entity.pm.res.PmPlanRes;
 import com.factory.web.mapper.FileMapper;
 import com.factory.web.service.FileService;
+import com.factory.web.service.pm.PreventMistakeService;
+import org.apache.poi.hssf.usermodel.HSSFCellStyle;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.formula.functions.Index;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.streaming.SXSSFWorkbook;
+import org.apache.poi.xssf.usermodel.XSSFCellStyle;
+import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
+import org.apache.poi.xssf.usermodel.XSSFDrawing;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletRequest;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.*;
+
 @Service
 @Transactional(rollbackFor = Exception.class)
-public class FileServiceImpl extends ServiceImpl<FileMapper, FileEntry>  implements FileService {
+public class FileServiceImpl extends ServiceImpl<FileMapper, FileEntry> implements FileService {
+
+    @Value("${download.excel.imgid}")
+    private String imgId;
+    @Value("${download.excel.companyname}")
+    private String companyName;
+
+    @Autowired
+    PreventMistakeService preventMistakeService;
+    @Autowired
+    UserInfoService userInfoService;
+
+    public Workbook onsiteControlledExcel(SearchPmCheckRecordListReq param, HttpServletRequest request, boolean iscontroll) throws IOException {
+        HashMap<Integer, String> nmMap = new HashMap<>();
+        SearchPmPlanReq req = SearchPmPlanReq.builder().bentelerPlanId(param.getBentelerPlanId()).build();
+        PmPlanRes plan = preventMistakeService.getPmPlan(req);
+        ResponseBean<List<PmCheckRecordListRes>> checks = preventMistakeService.getPmCheckRecordList(param);
+        ResponseBean<List<OnsiteApprovalPlan>> approve = preventMistakeService.getPmPlanApprovalList(req);
+        Workbook wb = new SXSSFWorkbook(500);
+        Sheet sheet = Utility.createSheet(wb, "防错检查");
+        XSSFCellStyle cellStyle = Utility.getTitleCellStyle(wb, (short) 10, HSSFCellStyle.ALIGN_CENTER);
+        XSSFCellStyle cellStyleLeft = Utility.getTitleCellStyle(wb, (short) 10, HSSFCellStyle.ALIGN_LEFT);
+        FileEntry file = this.getById(Long.parseLong(imgId));
+        ByteArrayInputStream inb = new ByteArrayInputStream(file.getFile());
+        BufferedImage bufferImg = ImageIO.read(inb);
+        String[] data = getOnsiteTitle1Data();
+        createOnsiteTitle1(wb, sheet, cellStyle, 0, data, bufferImg);
+        inb.close();
+        data = getOnsiteTitle2Data(plan);
+        createOnsiteTitle2(sheet, cellStyle, 1, data);
+        data = getOnsiteTitle3Data(plan, param, iscontroll);
+        createOnsiteTitle3(sheet, cellStyle, 2, data);
+        createItemInfoTitle(sheet, cellStyle, 3);
+        List<String[]> dsl = getItemInfoDate(plan, checks.getData(), param, iscontroll, nmMap);
+        int rowindex = createItemInfo(sheet, cellStyle, 4, dsl);
+        data = getOperaterTitleData(nmMap);
+        createOperaterTitle(sheet, cellStyle, rowindex + 1, data);
+        data = getOnsiteTitle4Data();
+        createOnsiteTitle4(sheet, cellStyleLeft, rowindex + 2, data);
+        data = getOnsiteTitle5Data(plan, approve.getData());
+        createOnsiteTitle5(sheet, cellStyle, rowindex + 3, data);
+        return wb;
+    }
+
+
+    private List<String[]> getItemInfoDate(PmPlanRes plan, List<PmCheckRecordListRes> check, SearchPmCheckRecordListReq param, boolean iscontroll, HashMap<Integer, String> nmMap) {
+        List<String[]> rs = new ArrayList<>();
+        if (iscontroll) {
+            String[] datas = inidata();
+            rs.add(datas);
+        } else {
+            Optional<OnsiteCalendar> cal = plan.getOnsiteCalendarList().stream().filter(s -> s.getTypeFlag() == param.getTypeFlag()).findFirst();
+            String userNm = getUserName(cal.get() == null ? null : cal.get().getUserId());
+            String[] datas = null;
+            for (PmCheckRecordListRes res : check) {
+                for (PmCheckRecordItemListRes item : res.getItemList()) {
+                    datas = inidata();
+                    datas[0] = param.getTypeFlag() == 0 ? "日" : param.getTypeFlag() == 1 ? "周" : "月";
+                    datas[1] = res.getWsName();
+                    datas[2] = item.getItemContent();
+                    for (PmCheckRecordRes r : item.getCheckRecordList()) {
+                        int day = r.getTaskTime().getDayOfMonth();
+                        if (r.getResult().equals("0") || r.getResult().equals("1")) {
+                            datas[2 + day] = "√";
+                            nmMap.put(day, userNm);
+                        }
+                    }
+                    rs.add(datas);
+                }
+
+            }
+        }
+        return rs;
+    }
+
+    private String[] inidata() {
+        String[] datas = new String[34];
+        for (int i = 0; i < datas.length; i++) {
+            datas[i] = "";
+        }
+
+        return datas;
+    }
+
+    private String getUserName(Long userid) {
+        String userNm = SystemConstant.EMPTY_STRING;
+        if (userid != null) {
+            String name = userInfoService.getNameById(userid);
+            if (name != null) {
+                userNm = name;
+            }
+        }
+        return userNm;
+    }
+
+    private String[] getOnsiteTitle5Data(PmPlanRes plan, List<OnsiteApprovalPlan> approvals) {
+        Optional<OnsiteApprovalPlan> u1 = null;
+        Optional<OnsiteApprovalPlan> u2 = null;
+        u1 = approvals.stream().filter(s -> s.getApprovalLevel() == 1).findFirst();
+        u2 = approvals.stream().filter(s -> s.getApprovalLevel() == 2).findFirst();
+        return new String[]{
+                String.format("Edited By:%s", getUserName(plan.getCreatedUserId())),
+                String.format("Checked By:%s", getUserName(u1 != null ? u1.get().getApprovalUserId() : null)),
+                String.format("Approved By:%s", getUserName(u2 != null ? u2.get().getApprovalUserId() : null)),
+        };
+    }
+
+    private String[] getOnsiteTitle4Data() {
+        return new String[]{"防错点检在每班开班后按规定频次进行,防错点检不合格,不允许进行批量生产。防错系统维修后,需重新进行防错点检;若防错短时间内无法修复,需填写特殊放行申请《0702,QM,201-2》及按照不合格品管理流程进行追溯。\n" +
+                "检查结果记录方法The Method of filling form: 符合: 打√            不符合打×, 立即通知倒班主任及维修人员,在点检表背面记录异常。"};
+    }
+
+    private String[] getOperaterTitleData(HashMap<Integer, String> nmMap) {
+        String[] data = inidata();
+        data[0] = "点检人";
+        for (int i = 3; i < data.length; i++) {
+            int index=i-2;
+            if(nmMap.containsKey(index)){
+                data[i]=nmMap.get(index);
+            }
+        }
+        return data;
+    }
+
+    private String[] getOnsiteTitle3Data(PmPlanRes plan, SearchPmCheckRecordListReq param, boolean iscontroll) {
+        Optional<OnsiteCalendar> cal = plan.getOnsiteCalendarList().stream().filter(s -> s.getTypeFlag() == param.getTypeFlag()).findFirst();
+        String[] dates = param.getYearMonth().split("\\-");
+        String setter = String.format("Setter/Jumper:%s", "");
+        if (!iscontroll) {
+            setter = String.format("Setter/Jumper:%s", getUserName(cal.get() == null ? null : cal.get().getUserId()));
+        }
+        return new String[]{
+                String.format("Production line:%s", plan.getOnsiteTitle() != null ? plan.getOnsiteTitle().getProductionLine() : ""),
+                String.format("Shift:%s", cal.get().getShift()),
+                setter,
+                String.format("Year:%s", dates[0]),
+                String.format("Month:%s", dates[1])
+        };
+    }
+
+    private String[] getOnsiteTitle2Data(PmPlanRes plan) {
+        String[] data;
+        data = new String[]{companyName,
+                plan.getBentelerPlanName()
+        };
+        return data;
+    }
+
+    private static void createOnsiteTitle3(Sheet sheet, XSSFCellStyle cellStyle, int rowIndex, String[] data) {
+        Row row = sheet.createRow(rowIndex);
+        row.setHeight((short) (25.5 * 20));
+        CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 0, 2);
+        sheet.addMergedRegion(cra);
+        cra = new CellRangeAddress(rowIndex, rowIndex, 3, 6);
+        sheet.addMergedRegion(cra);
+        cra = new CellRangeAddress(rowIndex, rowIndex, 7, 20);
+        sheet.addMergedRegion(cra);
+        cra = new CellRangeAddress(rowIndex, rowIndex, 21, 27);
+        sheet.addMergedRegion(cra);
+        cra = new CellRangeAddress(rowIndex, rowIndex, 28, 36);
+        sheet.addMergedRegion(cra);
+        for (int i = 0; i < 37; i++) {
+            row.createCell(i).setCellStyle(cellStyle);
+        }
+        Utility.addCellValForStr(row.getCell(0), data[0], cellStyle);
+        Utility.addCellValForStr(row.getCell(3), data[1], cellStyle);
+        Utility.addCellValForStr(row.getCell(7), data[2], cellStyle);
+        Utility.addCellValForStr(row.getCell(21), data[3], cellStyle);
+        Utility.addCellValForStr(row.getCell(28), data[4], cellStyle);
+    }
+
+    private static void createOnsiteTitle4(Sheet sheet, XSSFCellStyle cellStyle, int rowIndex, String[] data) {
+        Row row = sheet.createRow(rowIndex);
+        row.setHeight((short) (33.25 * 20));
+        CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 0, 36);
+        sheet.addMergedRegion(cra);
+        for (int i = 0; i < 37; i++) {
+            row.createCell(i).setCellStyle(cellStyle);
+        }
+        Utility.addCellValForStr(row.getCell(0), data[0], cellStyle);
+    }
+
+    private static void createOnsiteTitle5(Sheet sheet, XSSFCellStyle cellStyle, int rowIndex, String[] data) {
+        Row row = sheet.createRow(rowIndex);
+        row.setHeight((short) (25 * 20));
+        CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 0, 5);
+        sheet.addMergedRegion(cra);
+        cra = new CellRangeAddress(rowIndex, rowIndex, 6, 21);
+        sheet.addMergedRegion(cra);
+        cra = new CellRangeAddress(rowIndex, rowIndex, 22, 36);
+        sheet.addMergedRegion(cra);
+        for (int i = 0; i < 37; i++) {
+            row.createCell(i).setCellStyle(cellStyle);
+        }
+        Utility.addCellValForStr(row.getCell(0), data[0], cellStyle);
+        Utility.addCellValForStr(row.getCell(6), data[1], cellStyle);
+        Utility.addCellValForStr(row.getCell(22), data[2], cellStyle);
+    }
+
+
+    private static void createOperaterTitle(Sheet sheet, XSSFCellStyle cellStyle, int rowIndex, String[] data) {
+        Row row = sheet.createRow(rowIndex);
+        row.setHeight((short) (25 * 20));
+        CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 0, 2);
+        sheet.addMergedRegion(cra);
+        cra = new CellRangeAddress(rowIndex, rowIndex, 34, 36);
+        sheet.addMergedRegion(cra);
+
+        for (int i = 0; i < 37; i++) {
+            row.createCell(i).setCellStyle(cellStyle);
+        }
+
+        for (int i = 3; i < data.length; i++) {
+            Utility.addCellValForStr(row.getCell(i), data[i], cellStyle);
+        }
+        Utility.addCellValForStr(row.getCell(0), data[0], cellStyle);
+    }
+
+    private static void createItemInfoTitle(Sheet sheet, XSSFCellStyle cellStyle, int rowIndex) {
+        List<String> head = new ArrayList<>();
+        HashMap<Integer, Integer> cwMap = new HashMap<>();
+        head.addAll(Arrays.asList("频次", "OP", "点检内容"));
+        cwMap.put(0, (short) 6.6 * 256);
+        cwMap.put(1, (short) 6.6 * 256);
+        cwMap.put(2, (short) 38.7 * 256);
+        for (int i = 1; i <= 31; i++) {
+            head.add(i + "");
+            cwMap.put(i + 2, (short) 4 * 256);
+        }
+        head.add("防错维修后点检");
+        cwMap.put(34, (short) 8 * 256);
+        cwMap.put(35, (short) 8 * 256);
+        cwMap.put(36, (short) 3.5 * 256);
+        CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 34, 36);
+        sheet.addMergedRegion(cra);
+        Row row = sheet.createRow(rowIndex);
+        row.setHeight((short) (23.75 * 20));
+        for (int i = 0; i < head.size() + 2; i++) {
+            sheet.setColumnWidth((short) i, (short) cwMap.get(i).intValue());
+            row.createCell(i).setCellStyle(cellStyle);
+        }
+        for (int i = 0; i < head.size(); i++) {
+            Utility.addCellValForStr(row.getCell(i), head.get(i), cellStyle);
+        }
+    }
+
+    private static int createItemInfo(Sheet sheet, XSSFCellStyle cellStyle, int rowIndex, List<String[]> datas) {
+        int index = 0;
+        Row row = null;
+        for (String[] data : datas) {
+            if (index != 0) {
+                rowIndex++;
+            }
+            CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 34, 36);
+            sheet.addMergedRegion(cra);
+            row = sheet.createRow(rowIndex);
+            row.setHeight((short) (23.75 * 20));
+            for (int i = 0; i < 37; i++) {
+                row.createCell(i).setCellStyle(cellStyle);
+            }
+            for (int i = 0; i < data.length; i++) {
+                Utility.addCellValForStr(row.getCell(i), data[i], cellStyle);
+            }
+            index++;
+        }
+
+
+        return rowIndex;
+    }
+
+
+    private static void createOnsiteTitle2(Sheet sheet, XSSFCellStyle cellStyle, int rowIndex, String[] data) {
+        Row row = sheet.createRow(rowIndex);
+        row.setHeight((short) (39.5 * 20));
+        CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 0, 2);
+        sheet.addMergedRegion(cra);
+        cra = new CellRangeAddress(rowIndex, rowIndex, 3, 20);
+        sheet.addMergedRegion(cra);
+        for (int i = 0; i < 37; i++) {
+            row.createCell(i).setCellStyle(cellStyle);
+        }
+
+        Utility.addCellValForStr(row.getCell(0), data[0], cellStyle);
+        Utility.addCellValForStr(row.getCell(3), data[1], cellStyle);
+    }
+
+    /**
+     * 获取头数据1
+     *
+     * @return
+     */
+    private String[] getOnsiteTitle1Data() {
+        String[] data = new String[]{
+                "Benteler Automotive (shenyang) Co. , Ltd",
+                "Pokayoke Checking Sheet for Production",
+                "模板编号: T.0702.Eng.022.An.02\n" +
+                        "发布日期: 2020-10-26\n" +
+                        "模板版本: 11\n" +
+                        "部门:工程部\n" +
+                        "上一版本: 2019-11-01"
+        };
+        return data;
+    }
+
+
+    /**
+     * 生成最上面的头信心
+     *
+     * @param wb
+     * @param sheet
+     * @param cellStyle
+     * @param rowIndex
+     * @param data
+     * @param bufferImg
+     * @throws IOException
+     */
+    private void createOnsiteTitle1(Workbook wb, Sheet sheet, XSSFCellStyle cellStyle, int rowIndex, String[] data, BufferedImage bufferImg) throws IOException {
+        Row row = sheet.createRow(rowIndex);
+        row.setHeight((short) (34 * 20));
+        CellRangeAddress cra = new CellRangeAddress(rowIndex, rowIndex, 0, 2);
+        sheet.addMergedRegion(cra);
+        cra = new CellRangeAddress(rowIndex, rowIndex, 3, 20);
+        sheet.addMergedRegion(cra);
+        cra = new CellRangeAddress(rowIndex, rowIndex + 1, 21, 27);
+        sheet.addMergedRegion(cra);
+        cra = new CellRangeAddress(rowIndex, rowIndex + 1, 28, 36);
+        sheet.addMergedRegion(cra);
+        for (int i = 0; i < 37; i++) {
+            row.createCell(i).setCellStyle(cellStyle);
+        }
+        Utility.addCellValForStr(row.getCell(0), data[0], cellStyle);
+        Utility.addCellValForStr(row.getCell(3), data[1], Utility.getTitleCellStyle(wb, (short) 15, HSSFCellStyle.ALIGN_CENTER));
+        Utility.addCellValForStr(row.getCell(21), data[2], Utility.getTitleCellStyle(wb, (short) 10, HSSFCellStyle.ALIGN_LEFT));
+        ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
+        ImageIO.write(bufferImg, "png", byteArrayOut);
+        XSSFDrawing patriarch = (XSSFDrawing) sheet.createDrawingPatriarch();
+        XSSFClientAnchor anchor = new XSSFClientAnchor(10, 10, 255, 255,
+                (short) 28, 0, (short) 36, 2);
+        patriarch.createPicture(anchor, wb.addPicture(byteArrayOut
+                .toByteArray(), HSSFWorkbook.PICTURE_TYPE_PNG));  // 插入图片
+        byteArrayOut.close();
+    }
 }

+ 36 - 36
application-facade/src/main/java/com/factory/web/service/impl/pm/PreventMistakeServiceImpl.java

@@ -143,7 +143,7 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 
 	@Autowired
 	private OnsiteTaskHisBlobService onsiteTaskHisBlobService;
-	
+
 	@Autowired
 	private FirstArticleWorkshopService firstArticleWorkshopService;
 
@@ -298,13 +298,13 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 	public ResponseBean<PageBean<PmPlanListRes>> getPmPlanList(SearchPmPlanListReq req) {
 		Page<PmPlanListRes> page = new Page<>(req.getPage(), req.getSize());
 		Page<PmPlanListRes> listResPage = preventMistakeMapper.getPmPlanList(page, req);
-		
+
 		SearchPmPlanReq searchPmPlanReq = null;
 		for (PmPlanListRes pmPlan : listResPage.getRecords()) {
 			searchPmPlanReq = new SearchPmPlanReq();
 			searchPmPlanReq.setBentelerPlanId(pmPlan.getBentelerPlanId());
 			OnsiteApprovalPlan latestApprovalInfo = this.getLatestApprovalInfo(searchPmPlanReq);
-			
+
 			pmPlan.setApprovalLevel(latestApprovalInfo.getApprovalLevel());
 			pmPlan.setApprovalUserId(latestApprovalInfo.getApprovalUserId());
 			pmPlan.setStatus(latestApprovalInfo.getStatus());
@@ -372,7 +372,7 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 		pmPlanRes.setBentelerPlanName(plan.getName());
 		pmPlanRes.setPlanType(plan.getPlanType());
 		pmPlanRes.setEffectiveDate(plan.getEffectiveDate());;
-
+		pmPlanRes.setCreatedUserId(plan.getCreatedUserId());
 		List<OnsiteCalendar> onsiteCalendarList = onsiteCalendarService.list(Wrappers.<OnsiteCalendar>lambdaQuery()
                 .eq(OnsiteCalendar::getBentelerPlanId, plan.getId()));
 		pmPlanRes.setOnsiteCalendarList(onsiteCalendarList);
@@ -599,42 +599,42 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
     public ResponseBean<List<PmCheckRecordListRes>> getPmCheckRecordList(SearchPmCheckRecordListReq req) {
     	List<OnsiteWorkshop> onsiteWorkshopList = onsiteWorkshopService.list(Wrappers.<OnsiteWorkshop>lambdaQuery()
                 .eq(OnsiteWorkshop::getBentelerPlanId, req.getBentelerPlanId()));
-		
+
     	List<PmCheckRecordListRes> workshopList = new ArrayList<PmCheckRecordListRes>();
     	PmCheckRecordListRes workshop = null;
     	for (OnsiteWorkshop onsiteWorkshop : onsiteWorkshopList) {
     		workshop = new PmCheckRecordListRes();
     		workshop.setWorkshopId(onsiteWorkshop.getId());
-    		workshop.setWsName(onsiteWorkshop.getWsName());    		
+    		workshop.setWsName(onsiteWorkshop.getWsName());
 
 			List<OnsiteItem> onsiteItemList = onsiteItemService.list(Wrappers.<OnsiteItem>lambdaQuery()
 	                .eq(OnsiteItem::getWorkshopId, workshop.getWorkshopId()));
-			
+
 			List<PmCheckRecordItemListRes> itemList = new ArrayList<PmCheckRecordItemListRes>();
 			PmCheckRecordItemListRes item = null;
 			for (OnsiteItem onsiteItem : onsiteItemList) {
 				item = new PmCheckRecordItemListRes();
-				
+
 				item.setOnsiteItemId(onsiteItem.getId());
 				item.setItemContent(onsiteItem.getItemContent());
-				
+
 				SearchCheckRecordReq itemResultReq = new SearchCheckRecordReq();
 	    		itemResultReq.setOnsiteItemId(item.getOnsiteItemId());
 	    		itemResultReq.setYearMonth(req.getYearMonth());
 	    		itemResultReq.setTypeFlag(req.getTypeFlag());
 	    		List<PmCheckRecordRes> itemResultList = preventMistakeMapper.getPmItemResultList(itemResultReq);
-	    		
+
 	    		item.setCheckRecordList(itemResultList);
 
 				itemList.add(item);
 			}
-			
-			workshop.setItemList(itemList);			
+
+			workshop.setItemList(itemList);
 
 			workshopList.add(workshop);
 		}
     	return ResponseBeanBuilder.ok(workshopList, Function.identity());
-    	
+
 //    	SearchPmPlanReq workshopItemReq = new SearchPmPlanReq();
 //    	workshopItemReq.setBentelerPlanId(req.getBentelerPlanId());
 //    	List<PmCheckRecordListRes> workshopItemList = preventMistakeMapper.getPmWorkshopItemList(workshopItemReq);
@@ -695,9 +695,9 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
     	for (OnsiteWorkshop onsiteWorkshop : onsiteWorkshopList) {
     		/* 判断工作站下项目是否都检查完 */
     		searchPmWsAllCheckFlagReq = new SearchPmWsAllCheckFlagReq();
-    		searchPmWsAllCheckFlagReq.setOnsiteTaskId(req.getOnsiteTaskId());    		
+    		searchPmWsAllCheckFlagReq.setOnsiteTaskId(req.getOnsiteTaskId());
     		searchPmWsAllCheckFlagReq.setWorkshopId(onsiteWorkshop.getId());
-    		
+
     		int itemCount = preventMistakeMapper.getPmWsItemCount(searchPmWsAllCheckFlagReq);
     		int itemResultCount = preventMistakeMapper.getPmWsItemResultCount(searchPmWsAllCheckFlagReq);
     		if (itemCount == itemResultCount) {
@@ -719,7 +719,7 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
     public ResponseBean<List<OnsiteItem>> getItemList(SearchItemListReq req) {
     	List<OnsiteItem> onsiteItemList = onsiteItemService.list(Wrappers.<OnsiteItem>lambdaQuery()
                 .eq(OnsiteItem::getWorkshopId, req.getWorkshopId()));
-    	
+
     	for (OnsiteItem onsiteItem : onsiteItemList) {
     		OnsiteItemResult onsiteItemResult = onsiteItemResultService.getOne(new LambdaQueryWrapper<OnsiteItemResult>()
         			.eq(OnsiteItemResult::getOnsiteTaskId, req.getOnsiteTaskId())
@@ -742,7 +742,7 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
     	/* 删除上一次保存结果 */
     	onsiteItemResultService.remove(Wrappers.<OnsiteItemResult>lambdaQuery()
                 .eq(OnsiteItemResult::getOnsiteTaskId, req.getOnsiteTaskId()));
-    	
+
     	/* 添加新的检查结果 */
     	List<AddItemResultReq> addItemResultList = req.getAddItemResultList();
     	for (AddItemResultReq addItemResult : addItemResultList) {
@@ -1016,7 +1016,7 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 		}
 		return ResponseBeanBuilder.ok(pmAllWorkshopList, Function.identity());
 	}
-	
+
 	/**
      * 取得计划的最新审批信息
      * @param req
@@ -1027,7 +1027,7 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 		OnsiteApprovalPlan onsiteApprovalPlan = preventMistakeMapper.getLatestApprovalInfo(req);
         return onsiteApprovalPlan;
     }
-    
+
     /**
      * 判断检验结果是否填写完成
      * @param req
@@ -1042,19 +1042,19 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 		int itemResultCount = preventMistakeMapper.getPmItemResultCount(req);
 
 		PmAllCheckFlagRes pmAllCheckFlagRes = new PmAllCheckFlagRes();
-		
+
 		if (itemCount == itemResultCount) {
 			pmAllCheckFlagRes.setAllCheckFlag(1); // 全部完成
 		} else {
 			pmAllCheckFlagRes.setAllCheckFlag(0); // 没完成
 		}
-		
+
 		return pmAllCheckFlagRes;
 	}
-	
+
 	/**
 	 * 取得异常列表
-	 * 
+	 *
 	 * @param req
 	 * @return 异常列表
 	 */
@@ -1075,7 +1075,7 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 		for (AbnormalTaskInfoRes pmInfo : pmList) {
 			List<OnsiteWorkshop> onsiteWorkshopList = onsiteWorkshopService.list(Wrappers.<OnsiteWorkshop>lambdaQuery()
 	                .eq(OnsiteWorkshop::getBentelerPlanId, pmInfo.getBentelerPlanId()));
-			
+
 			List<AbnormalWorkshopRes> abnormalWorkshopList = new ArrayList<AbnormalWorkshopRes>();
 			AbnormalWorkshopRes abnormalWorkshop = null;
 			for (OnsiteWorkshop workshop : onsiteWorkshopList) {
@@ -1084,7 +1084,7 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 				abnormalWorkshop.setWsName(workshop.getWsName());
 				abnormalWorkshopList.add(abnormalWorkshop);
 			}
-			
+
 			for (AbnormalWorkshopRes abnormalWorkshopInfo : abnormalWorkshopList) {
 				searchReq = new SearchAbnormalReq();
 				searchReq.setWorkshopId(abnormalWorkshopInfo.getWorkshopId());
@@ -1092,16 +1092,16 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 				List<AbnormalItemRes> abnormalItemList = preventMistakeMapper.getPmAbnormalItemList(searchReq);
 				abnormalWorkshopInfo.setAbnormalItemList(abnormalItemList);
 			}
-			
+
 			pmInfo.setAbnormalWorkshopList(abnormalWorkshopList);
 		}
-		
+
 		/* 首件 */
 		searchReq = new SearchAbnormalReq();
 		searchReq.setCheckDate(req.getCheckDate());
 		List<AbnormalTaskInfoRes> faReleaseList = preventMistakeMapper.getFaReleaseList(searchReq);
 		List<AbnormalTaskInfoRes> faRepeatList = preventMistakeMapper.getFaRepeatList(searchReq);
-		
+
 		List<AbnormalTaskInfoRes> faList = new ArrayList<AbnormalTaskInfoRes>();
 		for (AbnormalTaskInfoRes faRelease : faReleaseList) {
 			faList.add(faRelease);
@@ -1109,7 +1109,7 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 		for (AbnormalTaskInfoRes faRepeat : faRepeatList) {
 			faList.add(faRepeat);
 		}
-		
+
 		for (AbnormalTaskInfoRes faInfo : faList) {
 			List<FirstArticleWorkshop> firstArticleWorkshopList = firstArticleWorkshopService.list(Wrappers.<FirstArticleWorkshop>lambdaQuery()
 	                .eq(FirstArticleWorkshop::getBentelerPlanId, faInfo.getBentelerPlanId()));
@@ -1122,16 +1122,16 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 				abnormalWorkshop.setWsName(workshop.getWsName());
 				abnormalWorkshopList.add(abnormalWorkshop);
 			}
-			
+
 			for (AbnormalWorkshopRes abnormalWorkshopInfo : abnormalWorkshopList) {
 				searchReq = new SearchAbnormalReq();
 				searchReq.setWorkshopId(abnormalWorkshopInfo.getWorkshopId());
 				List<AbnormalItemRes> abnormalItemList = preventMistakeMapper.getFaAbnormalItemList(searchReq);
-				
+
 				for (AbnormalItemRes abnormalItemInfo : abnormalItemList) {
 					List<AbnormalItemResultRes> firstItemResultList = this.getAbnormalItemResultList(faInfo.getTaskId(), abnormalItemInfo.getItemId(), 0);
 					abnormalItemInfo.setFirstItemResultList(firstItemResultList);
-					
+
 					List<AbnormalItemResultRes> twoHundredItemResultList = this.getAbnormalItemResultList(faInfo.getTaskId(), abnormalItemInfo.getItemId(), 1);
 					abnormalItemInfo.setTwoHundredItemResultList(twoHundredItemResultList);
 
@@ -1144,7 +1144,7 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 
 			faInfo.setAbnormalWorkshopList(abnormalWorkshopList);
 		}
-		
+
 		List<AbnormalTaskInfoRes> abnormalList = new ArrayList<AbnormalTaskInfoRes>();
 		for (AbnormalTaskInfoRes pm : pmList) {
 			abnormalList.add(pm);
@@ -1155,12 +1155,12 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 
 		return ResponseBeanBuilder.ok(abnormalList, Function.identity());
 	}
-	
-	
+
+
 
 	/**
 	 * 取得检查结果
-	 * 
+	 *
 	 * @param taskId
 	 * @param itemId
 	 * @param typeFlag 0表示首件 1表示200件 2表示中断

+ 5 - 0
application-facade/src/main/resources/application.yml

@@ -48,6 +48,7 @@ cn:
         # 登录
         - /login/passwordLogin**
         - /login
+        - /benteler/fileupload/**
 #        - /**
       client: WEB
 logging:
@@ -77,3 +78,7 @@ wx:
   minprogram:
      appid: wxeb29362c7f2e9e48
      appsecret: f637286fcda117a3e5598df9338ad82
+download:
+   excel:
+      imgid: 23
+      companyname: 本特勒汽车系统(沈阳)有限公司