Просмотр исходного кода

Merge branch 'master' of D:\code_all\intelligentfactory with conflicts.

daili 3 лет назад
Родитель
Сommit
bc5fb650c0

+ 11 - 12
application-facade/pom.xml

@@ -20,23 +20,22 @@
 
     <dependencies>
 
-        <dependency>
-            <groupId>org.apache.poi</groupId>
-            <artifactId>poi</artifactId>
-            <version>3.9</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.poi</groupId>
-            <artifactId>poi-ooxml</artifactId>
-            <version>3.9</version>
-        </dependency>
+        <!--<dependency>-->
+        <!--    <groupId>org.apache.poi</groupId>-->
+        <!--    <artifactId>poi</artifactId>-->
+        <!--    <version>3.9</version>-->
+        <!--</dependency>-->
+
+        <!--<dependency>-->
+        <!--    <groupId>org.apache.poi</groupId>-->
+        <!--    <artifactId>poi-ooxml</artifactId>-->
+        <!--    <version>3.9</version>-->
+        <!--</dependency>-->
 
         <!--poi 调用版本 3.9  为了支持两个版本的后缀名升级到3.9  -->
         <dependency>
             <groupId>cn.hutool</groupId>
             <artifactId>hutool-all</artifactId>
-            <version>4.5.15</version>
         </dependency>
 
 <!--        <dependency>-->

+ 47 - 0
application-facade/src/main/java/com/factory/config/MyHandler.java

@@ -0,0 +1,47 @@
+package com.factory.config;
+
+import com.alibaba.excel.metadata.Head;
+import com.alibaba.excel.write.merge.AbstractMergeStrategy;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.ss.util.RegionUtil;
+
+import java.util.List;
+
+public class MyHandler extends AbstractMergeStrategy {
+	
+
+	@Override
+	protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) {
+		if(relativeRowIndex==null ||relativeRowIndex==0){			
+			return;
+		}		
+		int rowIndex = cell.getRowIndex(); 
+		int colIndex = cell.getColumnIndex();
+		sheet=cell.getSheet();
+		Row preRow = sheet.getRow(rowIndex - 1);
+		Cell preCell = preRow.getCell(colIndex);//获取上一行的该格
+		List<CellRangeAddress> list = sheet.getMergedRegions();
+		CellStyle cs = cell.getCellStyle();
+		cell.setCellStyle(cs);
+		for (int i = 0; i < list.size(); i++) {
+            CellRangeAddress cellRangeAddress = list.get(i);
+            if (cellRangeAddress.containsRow(preCell.getRowIndex()) && cellRangeAddress.containsColumn(preCell.getColumnIndex())) {
+            	int lastColIndex = cellRangeAddress.getLastColumn();
+            	int firstColIndex = cellRangeAddress.getFirstColumn();
+            	if(lastColIndex == firstColIndex){
+            		return;
+				}
+            	CellRangeAddress cra = new CellRangeAddress(cell.getRowIndex(), cell.getRowIndex(), firstColIndex, lastColIndex);
+                sheet.addMergedRegion(cra);
+                RegionUtil.setBorderBottom(BorderStyle.THIN, cra, sheet);
+                RegionUtil.setBorderLeft(BorderStyle.THIN, cra, sheet);  
+                RegionUtil.setBorderRight(BorderStyle.THIN, cra, sheet); 
+                RegionUtil.setBorderTop(BorderStyle.THIN, cra, sheet);
+                return;
+            }
+        }
+
+	}
+
+}

+ 7 - 0
application-facade/src/main/java/com/factory/controller/web/FirstArticleController.java

@@ -2,6 +2,7 @@ package com.factory.controller.web;
 
 import java.util.List;
 
+import com.factory.user.entity.vo.res.FileRes;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -195,6 +196,12 @@ public class FirstArticleController {
 	public ResponseBean<FaCheckRecordListRes> getFaCheckRecordList(@RequestBody SearchFaCheckRecordListReq req) {
 		return firstArticleService.getFaCheckRecordList(req);
 	}
+	@ApiOperation(value = "导出检查记录列表")
+	@ApiOperationSupport(order = 18)
+	@PostMapping("/exportFaCheckRecordList")
+	public ResponseBean<FileRes> exportFaCheckRecordList(@RequestBody SearchFaCheckRecordListReq req) {
+		return firstArticleService.exportFaCheckRecordList(req);
+	}
 	
 //	@ApiOperation(value = "判断检验结果是否填写完成")
 //	@PostMapping("/getFaAllCheckFlag")

+ 8 - 10
application-facade/src/main/java/com/factory/web/entity/excel/Utility.java

@@ -2,9 +2,7 @@ package com.factory.web.entity.excel;
 
 import org.apache.poi.hssf.usermodel.HSSFCellStyle;
 import org.apache.poi.hssf.usermodel.HSSFFont;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.XSSFCellStyle;
 import org.apache.poi.xssf.usermodel.XSSFColor;
 import org.apache.poi.xssf.usermodel.XSSFFont;
@@ -17,23 +15,23 @@ public class Utility {
      * 设置单元格样式
      *
      * @param wb
-     * @param isTitle
+     * @param @isTitle
      * @return
      */
-    public static XSSFCellStyle getTitleCellStyle(Workbook wb, short fontSize,short align) {
+    public static XSSFCellStyle getTitleCellStyle(Workbook wb, short fontSize,HorizontalAlignment align) {
         XSSFCellStyle cellStyle = (XSSFCellStyle) wb.createCellStyle();
         XSSFFont font = (XSSFFont) wb.createFont();
         font.setFontHeightInPoints(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.setBorderBottom(BorderStyle.THIN); //下边框
+        cellStyle.setBorderLeft(BorderStyle.THIN);//左边框
+        cellStyle.setBorderTop(BorderStyle.THIN);//上边框
+        cellStyle.setBorderRight(BorderStyle.THIN);//右边框
         //设置居中:
         cellStyle.setAlignment(align); // 居中对齐
-        cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
 
         return cellStyle;
     }

+ 4 - 0
application-facade/src/main/java/com/factory/web/service/fa/FirstArticleService.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.factory.base.entity.aggregates.PageBean;
 import com.factory.base.entity.aggregates.ResponseBean;
 import com.factory.base.entity.po.benteler.BentelerPlan;
+import com.factory.user.entity.vo.res.FileRes;
 import com.factory.web.entity.fa.FirstArticleItemResult;
 import com.factory.web.entity.fa.FirstArticleTask;
 import com.factory.web.entity.fa.FirstArticleTitle;
@@ -38,6 +39,7 @@ import com.factory.web.entity.fa.res.FaPlanListRes;
 import com.factory.web.entity.fa.res.FaPlanRes;
 import com.factory.web.entity.fa.res.FaWorkshopNoGoListRes;
 import com.factory.web.entity.fa.res.UserListRes;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * 首件计划
@@ -231,4 +233,6 @@ public interface FirstArticleService extends IService<BentelerPlan> {
      * @return 取得用户列表
      */
     public List<UserListRes> getUserList();
+
+	ResponseBean<FileRes> exportFaCheckRecordList(SearchFaCheckRecordListReq req);
 }

+ 7 - 6
application-facade/src/main/java/com/factory/web/service/impl/FileServiceImpl.java

@@ -21,6 +21,7 @@ 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.HorizontalAlignment;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
@@ -64,8 +65,8 @@ public class FileServiceImpl extends ServiceImpl<FileMapper, FileEntry> implemen
         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);
+        XSSFCellStyle cellStyle = Utility.getTitleCellStyle(wb, (short) 10, HorizontalAlignment.CENTER);
+        XSSFCellStyle cellStyleLeft = Utility.getTitleCellStyle(wb, (short) 10, HorizontalAlignment.LEFT);
         FileEntry file = this.getById(Long.parseLong(imgId));
         ByteArrayInputStream inb = new ByteArrayInputStream(file.getFile());
         BufferedImage bufferImg = ImageIO.read(inb);
@@ -95,7 +96,7 @@ public class FileServiceImpl extends ServiceImpl<FileMapper, FileEntry> implemen
             String[] datas = inidata();
             rs.add(datas);
         } else {
-            Optional<OnsiteCalendar> cal = plan.getOnsiteCalendarList().stream().filter(s -> s.getTypeFlag() == param.getTypeFlag()).findFirst();
+            Optional<OnsiteCalendar> cal = plan.getOnsiteCalendarList().stream().filter(s -> s.getTypeFlag() .equals(param.getTypeFlag()) ).findFirst();
             String userNm = getUserName(cal.get() == null ? null : cal.get().getUserId());
             String[] datas = null;
             for (PmCheckRecordListRes res : check) {
@@ -169,7 +170,7 @@ public class FileServiceImpl extends ServiceImpl<FileMapper, FileEntry> implemen
     }
 
     private String[] getOnsiteTitle3Data(PmPlanRes plan, SearchPmCheckRecordListReq param, boolean iscontroll) {
-        Optional<OnsiteCalendar> cal = plan.getOnsiteCalendarList().stream().filter(s -> s.getTypeFlag() == param.getTypeFlag()).findFirst();
+        Optional<OnsiteCalendar> cal = plan.getOnsiteCalendarList().stream().filter(s -> s.getTypeFlag() .equals(param.getTypeFlag()) ).findFirst();
         String[] dates = param.getYearMonth().split("\\-");
         String setter = String.format("Setter/Jumper:%s", "");
         if (!iscontroll) {
@@ -375,8 +376,8 @@ public class FileServiceImpl extends ServiceImpl<FileMapper, FileEntry> implemen
             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));
+        Utility.addCellValForStr(row.getCell(3), data[1], Utility.getTitleCellStyle(wb, (short) 15, HorizontalAlignment.CENTER));
+        Utility.addCellValForStr(row.getCell(21), data[2], Utility.getTitleCellStyle(wb, (short) 10, HorizontalAlignment.LEFT));
         ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
         ImageIO.write(bufferImg, "png", byteArrayOut);
         XSSFDrawing patriarch = (XSSFDrawing) sheet.createDrawingPatriarch();

Разница между файлами не показана из-за своего большого размера
+ 833 - 868
application-facade/src/main/java/com/factory/web/service/impl/fa/FirstArticleServiceImpl.java


+ 3 - 38
application-facade/src/main/java/com/factory/web/service/impl/ini/BentelerIniVersionServiceImpl.java

@@ -760,8 +760,8 @@ public class BentelerIniVersionServiceImpl extends ServiceImpl<BentelerIniVersio
         BentelerIniVersion version = versionService.getById(versionId);
 
 
-      //  Map<String, String> baseMap = Convert.toMap(String.class, String.class,
-          //      JSONUtil.parseObj(version.getBaseMap()));
+        //Map<String, String> baseMap = Convert.toMap(String.class, String.class,
+        //        JSONUtil.parseObj(version.getBaseMap()));
 
         Map<String,String> baseMap = JSON.parseObject(version.getBaseMap(), new TypeReference<HashMap<String,String>>() {});
         // 模板注意 用{} 来表示你要用的变量 如果本来就有"{","}" 特殊字符 用"\{","\}"代替
@@ -780,42 +780,7 @@ public class BentelerIniVersionServiceImpl extends ServiceImpl<BentelerIniVersio
         //新一行
         FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
 
-        //Map<String, String> map = new HashMap<String, String>();
-        //map.put("title", plan.getName());
-        //map.put("Project", version.getProject());
-        //map.put("GPIN", version.getGpin());
-        //
-        //List<FillData> arrayList = new ArrayList<>();
-        //
-        //
-        //for (int i = 0; i < versionSubList.size(); i++) {
-        //
-        //
-        //    arrayList.add(FillData.builder()
-        //            .no(Convert.toStr(i + 1))
-        //            .characteristics(versionSub.getInspectionItem())
-        //            .measuringRange(scope)
-        //            .method(method)
-        //            .frequency(frequency)
-        //            .clazz(versionSub.getLevel())
-        //            .tool(versionSub.getTool())
-        //            .releaseRecord(releaseRecord)
-        //            .workstation(versionSub.getWorkstation())
-        //            .inistation(work)
-        //            .inigread(firgreadStr)
-        //            .twoStation(work)
-        //            .twoGread(twogreadStr)
-        //            .breakOffstation(work)
-        //            .breakOffgread(bregreadStr)
-        //            .firOrder(firOrder)
-        //            .towOrder(twoOrder)
-        //            .breOrder(briOrder)
-        //            .build());
-        //
-        //}
-        //excelWriter.fill(arrayList, fillConfig, writeSheet);
-        //excelWriter.fill(map, writeSheet);
-        //excelWriter.finish();
+
         return commonService.exportExcel(FileUtils.createTempPdf(".xlsx"));
     }
 

Некоторые файлы не были показаны из-за большого количества измененных файлов