diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapRFW.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapRFW.java index 9eb490e09..93b01ff2e 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapRFW.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapRFW.java @@ -9,10 +9,19 @@ public class SapRFW { private String aufnr; private String gamng; private String anzma; + private String budat; private String remark; private lt_gs lt_gs; private List lt_hwList; + public String getBudat() { + return budat; + } + + public void setBudat(String budat) { + this.budat = budat; + } + public String getRemark() { return remark; } diff --git a/op-common/op-common-core/src/main/java/com/op/common/core/utils/DateUtils.java b/op-common/op-common-core/src/main/java/com/op/common/core/utils/DateUtils.java index fd0b60f3a..93cf0c102 100644 --- a/op-common/op-common-core/src/main/java/com/op/common/core/utils/DateUtils.java +++ b/op-common/op-common-core/src/main/java/com/op/common/core/utils/DateUtils.java @@ -159,4 +159,5 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); return Date.from(zdt.toInstant()); } + } diff --git a/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelReportMapUtil.java b/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelReportMapUtil.java index 3c9423db2..5e00dc2b2 100644 --- a/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelReportMapUtil.java +++ b/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelReportMapUtil.java @@ -25,240 +25,240 @@ import java.util.Map; * @author OP */ public class ExcelReportMapUtil { - //下载 - public static SXSSFWorkbook initWorkbook(String sheetName , String title, List excelCol , List data, Map detailMap) throws IOException { - SXSSFWorkbook workbook = new SXSSFWorkbook(); - int colSize = excelCol.size(); + //下载 + public static SXSSFWorkbook initWorkbook(String sheetName , String title, List excelCol , List data, Map detailMap) throws IOException { + SXSSFWorkbook workbook = new SXSSFWorkbook(); + int colSize = excelCol.size(); - //创建Sheet(工作簿) - Sheet sheet = null; - if (!StringUtils.hasText(sheetName)){ - sheet = workbook.createSheet(); - }else{ - sheet = workbook.createSheet(sheetName); - } + //创建Sheet(工作簿) + Sheet sheet = null; + if (!StringUtils.hasText(sheetName)){ + sheet = workbook.createSheet(); + }else{ + sheet = workbook.createSheet(sheetName); + } - // 从resources目录获取图片字节数组 - byte[] imageBytes = getImageBytesFromResources("image/logo.png"); - /**logo**/ - int pictureIdx = workbook.addPicture(imageBytes, Workbook.PICTURE_TYPE_PNG); - CreationHelper helper = workbook.getCreationHelper(); - Drawing drawing = sheet.createDrawingPatriarch(); - ClientAnchor anchor = helper.createClientAnchor(); - anchor.setCol1(0); // B列 - anchor.setRow1(0); // 第2行(Excel的行和列都是从0开始计数的) - anchor.setCol2(1); // C列(图片宽度跨越的列数,这里设置为1列宽) - anchor.setRow2(2); // 第6行(图片高度跨越的行数,这里设置为4行高,可以根据图片大小调整) - Picture pict = drawing.createPicture(anchor, pictureIdx); - pict.resize(); // 根据图片的实际大小调整图片在Excel中的显示大小 - /**报告标题**/ - sheet.addMergedRegion(new CellRangeAddress(0, 1, 2, 11)); - // 获取合并后的单元格的第一个单元格(即C1),并设置值 - Row row1 = sheet.getRow(0); // 获取第1行(索引为0) - if (row1 == null) {row1 = sheet.createRow(0); // 如果第1行不存在,则创建它 - } - Cell cell = row1.getCell(2); // 获取C列(索引为2)的单元格 - if (cell == null) { - cell = row1.createCell(2); // 如果C列的单元格不存在,则创建它 - } - cell.setCellValue("中山榄菊日化实业有限公司"); // 设置单元格的值 - cell.setCellStyle(getTitelStyle(workbook)); // 应用样式到单元格 - /**报告二级标题、检验标准**/ - // 合并C3到I4的单元格,并设置样式 - mergeAndStyleCells(sheet, new CellRangeAddress(2, 3, 2, 8), detailMap.get("title")); - // 合并J3到L4的单元格,并设置样式 - mergeAndStyleCells(sheet, new CellRangeAddress(2, 3, 9, 12), "编码:"+detailMap.get("fileNo")); - /**左右表格1**/ - //画边框 - for(int r5=4;r5<13;r5++){ - Row row05 = sheet.getRow(r5); - if (row05 == null) {row05 = sheet.createRow(r5);} - for (int col = 0; col < 14; col++) { - Cell cell1 = row05.createCell(col); - cell1.setCellStyle(getRowStyle(sheet)); - } - } - for(int d5=13;d5<(13+data.size());d5++){ - Row row05 = sheet.getRow(d5); - if (row05 == null) {row05 = sheet.createRow(d5);} - for (int col = 0; col < 14; col++) { - Cell cell1 = row05.createCell(col); - cell1.setCellStyle(getDataStyle(sheet)); - } - } + // 从resources目录获取图片字节数组 + byte[] imageBytes = getImageBytesFromResources("image/logo.png"); + /**logo**/ + int pictureIdx = workbook.addPicture(imageBytes, Workbook.PICTURE_TYPE_PNG); + CreationHelper helper = workbook.getCreationHelper(); + Drawing drawing = sheet.createDrawingPatriarch(); + ClientAnchor anchor = helper.createClientAnchor(); + anchor.setCol1(0); // B列 + anchor.setRow1(0); // 第2行(Excel的行和列都是从0开始计数的) + anchor.setCol2(1); // C列(图片宽度跨越的列数,这里设置为1列宽) + anchor.setRow2(2); // 第6行(图片高度跨越的行数,这里设置为4行高,可以根据图片大小调整) + Picture pict = drawing.createPicture(anchor, pictureIdx); + pict.resize(); // 根据图片的实际大小调整图片在Excel中的显示大小 + /**报告标题**/ + sheet.addMergedRegion(new CellRangeAddress(0, 1, 2, 11)); + // 获取合并后的单元格的第一个单元格(即C1),并设置值 + Row row1 = sheet.getRow(0); // 获取第1行(索引为0) + if (row1 == null) {row1 = sheet.createRow(0); // 如果第1行不存在,则创建它 + } + Cell cell = row1.getCell(2); // 获取C列(索引为2)的单元格 + if (cell == null) { + cell = row1.createCell(2); // 如果C列的单元格不存在,则创建它 + } + cell.setCellValue("中山榄菊日化实业有限公司"); // 设置单元格的值 + cell.setCellStyle(getTitelStyle(workbook)); // 应用样式到单元格 + /**报告二级标题、检验标准**/ + // 合并C3到I4的单元格,并设置样式 + mergeAndStyleCells(sheet, new CellRangeAddress(2, 3, 2, 8), detailMap.get("title")); + // 合并J3到L4的单元格,并设置样式 + mergeAndStyleCells(sheet, new CellRangeAddress(2, 3, 9, 12), "编码:"+detailMap.get("fileNo")); + /**左右表格1**/ + //画边框 + for(int r5=4;r5<13;r5++){ + Row row05 = sheet.getRow(r5); + if (row05 == null) {row05 = sheet.createRow(r5);} + for (int col = 0; col < 14; col++) { + Cell cell1 = row05.createCell(col); + cell1.setCellStyle(getRowStyle(sheet)); + } + } + for(int d5=13;d5<(13+data.size());d5++){ + Row row05 = sheet.getRow(d5); + if (row05 == null) {row05 = sheet.createRow(d5);} + for (int col = 0; col < 14; col++) { + Cell cell1 = row05.createCell(col); + cell1.setCellStyle(getDataStyle(sheet)); + } + } - Row row5 = sheet.getRow(4); - // 合并A5到B6的单元格,并设置样式和内容 - mergeAndStyleCells2(sheet,row5, new CellRangeAddress(4, 5, 0, 1), "来料类别", true, true, IndexedColors.GREY_25_PERCENT); - // 合并C5到D6的单元格,并设置样式(无背景色,只有边框和内容居中) - mergeAndStyleCells2(sheet,row5, new CellRangeAddress(4, 5, 2, 3), detailMap.get("productGroupName"), true, false, null); - // 合并E5到F6的单元格,并设置样式和内容 - mergeAndStyleCells2(sheet,row5, new CellRangeAddress(4, 5, 4, 5), "生产批号", true, true, IndexedColors.GREY_25_PERCENT); - // 合并G5到I6的单元格,并设置样式(无背景色,只有边框和内容居中) - mergeAndStyleCells2(sheet,row5, new CellRangeAddress(4, 5, 6, 8), detailMap.get("incomeBatchNo"), true, false, null); - // 合并J5到K6的单元格,并设置样式和内容 - mergeAndStyleCells2(sheet,row5, new CellRangeAddress(4, 5, 9, 10), "报告编号", true, true, IndexedColors.GREY_25_PERCENT); - // 合并L5到N6的单元格,并设置样式(无背景色,只有边框和内容居中) - mergeAndStyleCells2(sheet,row5, new CellRangeAddress(4, 5, 11, 13), detailMap.get("checkNo"), true, false, null); - Row row7 = sheet.getRow(6); - // 合并A7到B8的单元格,并设置样式和内容 - mergeAndStyleCells2(sheet,row7, new CellRangeAddress(6, 7, 0, 1), "物料名称", true, true, IndexedColors.GREY_25_PERCENT); - // 合并C5到D6的单元格,并设置样式(无背景色,只有边框和内容居中) - mergeAndStyleCells2(sheet,row7, new CellRangeAddress(6, 7, 2, 3), detailMap.get("materialName"), true, false, null); - // 合并E5到F6的单元格,并设置样式和内容 - mergeAndStyleCells2(sheet,row7, new CellRangeAddress(6, 7, 4, 5), "物料编码", true, true, IndexedColors.GREY_25_PERCENT); - // 合并G5到I6的单元格,并设置样式(无背景色,只有边框和内容居中) - mergeAndStyleCells2(sheet,row7, new CellRangeAddress(6, 7, 6, 8), detailMap.get("materialCode"), true, false, null); - // 合并J5到K6的单元格,并设置样式和内容 - mergeAndStyleCells2(sheet,row7, new CellRangeAddress(6, 7, 9, 10), "供应单位", true, true, IndexedColors.GREY_25_PERCENT); - // 合并L5到N6的单元格,并设置样式(无背景色,只有边框和内容居中) - mergeAndStyleCells2(sheet,row7, new CellRangeAddress(6, 7, 11, 13), detailMap.get("supplierName"), true, false, null); - Row row9 = sheet.getRow(8); - // 合并A7到B8的单元格,并设置样式和内容 - mergeAndStyleCells2(sheet,row9, new CellRangeAddress(8, 9, 0, 1), "供应编码", true, true, IndexedColors.GREY_25_PERCENT); - // 合并C5到D6的单元格,并设置样式(无背景色,只有边框和内容居中) - mergeAndStyleCells2(sheet,row9, new CellRangeAddress(8, 9, 2, 3), detailMap.get("supplierCode"), true, false, null); - // 合并E5到F6的单元格,并设置样式和内容 - mergeAndStyleCells2(sheet,row9, new CellRangeAddress(8, 9, 4, 5), "来料数量", true, true, IndexedColors.GREY_25_PERCENT); - // 合并G5到I6的单元格,并设置样式(无背景色,只有边框和内容居中) - mergeAndStyleCells2(sheet,row9, new CellRangeAddress(8, 9,6, 8), detailMap.get("quality"), true, false, null); - // 合并J5到K6的单元格,并设置样式和内容 - mergeAndStyleCells2(sheet,row9, new CellRangeAddress(8, 9, 9, 10), "单位", true, true, IndexedColors.GREY_25_PERCENT); - // 合并L5到N6的单元格,并设置样式(无背景色,只有边框和内容居中) - mergeAndStyleCells2(sheet,row9, new CellRangeAddress(8, 9, 11, 13), detailMap.get("unit"), true, false, null); - Row row10 = sheet.getRow(10); - // 合并A7到B8的单元格,并设置样式和内容 - mergeAndStyleCells2(sheet,row10, new CellRangeAddress(10, 11, 0, 1), "物料来源", true, true, IndexedColors.GREY_25_PERCENT); - // 合并C5到D6的单元格,并设置样式(无背景色,只有边框和内容居中) - mergeAndStyleCells2(sheet,row10, new CellRangeAddress(10, 11, 2, 3), detailMap.get("checkType"), true, false, null); - // 合并E5到F6的单元格,并设置样式和内容 - mergeAndStyleCells2(sheet,row10, new CellRangeAddress(10, 11, 4, 5), "检验依据", true, true, IndexedColors.GREY_25_PERCENT); - // 合并G5到I6的单元格,并设置样式(无背景色,只有边框和内容居中) - mergeAndStyleCells2(sheet,row10, new CellRangeAddress(10, 11,6, 8), detailMap.get("standardNo"), true, false, null); - // 合并J5到K6的单元格,并设置样式和内容 - mergeAndStyleCells2(sheet,row10, new CellRangeAddress(10, 11, 9, 10), "报检日期", true, true, IndexedColors.GREY_25_PERCENT); - // 合并L5到N6的单元格,并设置样式(无背景色,只有边框和内容居中) - mergeAndStyleCells2(sheet,row10, new CellRangeAddress(10, 11, 11, 13), detailMap.get("incomeTime"), true, false, null); - /**上下表格2**/ - Row row12 = sheet.getRow(12); - if (row12 == null) {row12 = sheet.createRow(12);} - Cell cellA13 = row12.createCell(0); - cellA13.setCellValue("序号"); - cellA13.setCellStyle(getRowStyle(sheet)); - mergeAndStyleCells(sheet, new CellRangeAddress(12, 12, 1, 4), "检验项目"); - mergeAndStyleCells(sheet, new CellRangeAddress(12, 12, 5, 8), "标准要求"); - mergeAndStyleCells(sheet, new CellRangeAddress(12, 12, 9, 10), "实测结果"); - Cell cellL13 = row12.createCell(11); - cellL13.setCellValue("判定"); - cellL13.setCellStyle(getRowStyle(sheet)); - mergeAndStyleCells(sheet, new CellRangeAddress(12, 12, 12, 13), "附件"); - //将data中的值填充到excel - int rowNum = 13; - if(!CollectionUtils.isEmpty(data)){ - Iterator iterator = data.iterator(); - //遍历数据 - for (;iterator.hasNext();){ + Row row5 = sheet.getRow(4); + // 合并A5到B6的单元格,并设置样式和内容 + mergeAndStyleCells2(sheet,row5, new CellRangeAddress(4, 5, 0, 1), "来料类别", true, true, IndexedColors.GREY_25_PERCENT); + // 合并C5到D6的单元格,并设置样式(无背景色,只有边框和内容居中) + mergeAndStyleCells2(sheet,row5, new CellRangeAddress(4, 5, 2, 3), detailMap.get("productGroupName"), true, false, null); + // 合并E5到F6的单元格,并设置样式和内容 + mergeAndStyleCells2(sheet,row5, new CellRangeAddress(4, 5, 4, 5), "生产批号", true, true, IndexedColors.GREY_25_PERCENT); + // 合并G5到I6的单元格,并设置样式(无背景色,只有边框和内容居中) + mergeAndStyleCells2(sheet,row5, new CellRangeAddress(4, 5, 6, 8), detailMap.get("incomeBatchNo"), true, false, null); + // 合并J5到K6的单元格,并设置样式和内容 + mergeAndStyleCells2(sheet,row5, new CellRangeAddress(4, 5, 9, 10), "报告编号", true, true, IndexedColors.GREY_25_PERCENT); + // 合并L5到N6的单元格,并设置样式(无背景色,只有边框和内容居中) + mergeAndStyleCells2(sheet,row5, new CellRangeAddress(4, 5, 11, 13), detailMap.get("checkNo"), true, false, null); + Row row7 = sheet.getRow(6); + // 合并A7到B8的单元格,并设置样式和内容 + mergeAndStyleCells2(sheet,row7, new CellRangeAddress(6, 7, 0, 1), "物料名称", true, true, IndexedColors.GREY_25_PERCENT); + // 合并C5到D6的单元格,并设置样式(无背景色,只有边框和内容居中) + mergeAndStyleCells2(sheet,row7, new CellRangeAddress(6, 7, 2, 3), detailMap.get("materialName"), true, false, null); + // 合并E5到F6的单元格,并设置样式和内容 + mergeAndStyleCells2(sheet,row7, new CellRangeAddress(6, 7, 4, 5), "物料编码", true, true, IndexedColors.GREY_25_PERCENT); + // 合并G5到I6的单元格,并设置样式(无背景色,只有边框和内容居中) + mergeAndStyleCells2(sheet,row7, new CellRangeAddress(6, 7, 6, 8), detailMap.get("materialCode"), true, false, null); + // 合并J5到K6的单元格,并设置样式和内容 + mergeAndStyleCells2(sheet,row7, new CellRangeAddress(6, 7, 9, 10), "供应单位", true, true, IndexedColors.GREY_25_PERCENT); + // 合并L5到N6的单元格,并设置样式(无背景色,只有边框和内容居中) + mergeAndStyleCells2(sheet,row7, new CellRangeAddress(6, 7, 11, 13), detailMap.get("supplierName"), true, false, null); + Row row9 = sheet.getRow(8); + // 合并A7到B8的单元格,并设置样式和内容 + mergeAndStyleCells2(sheet,row9, new CellRangeAddress(8, 9, 0, 1), "供应编码", true, true, IndexedColors.GREY_25_PERCENT); + // 合并C5到D6的单元格,并设置样式(无背景色,只有边框和内容居中) + mergeAndStyleCells2(sheet,row9, new CellRangeAddress(8, 9, 2, 3), detailMap.get("supplierCode"), true, false, null); + // 合并E5到F6的单元格,并设置样式和内容 + mergeAndStyleCells2(sheet,row9, new CellRangeAddress(8, 9, 4, 5), "来料数量", true, true, IndexedColors.GREY_25_PERCENT); + // 合并G5到I6的单元格,并设置样式(无背景色,只有边框和内容居中) + mergeAndStyleCells2(sheet,row9, new CellRangeAddress(8, 9,6, 8), detailMap.get("quality"), true, false, null); + // 合并J5到K6的单元格,并设置样式和内容 + mergeAndStyleCells2(sheet,row9, new CellRangeAddress(8, 9, 9, 10), "单位", true, true, IndexedColors.GREY_25_PERCENT); + // 合并L5到N6的单元格,并设置样式(无背景色,只有边框和内容居中) + mergeAndStyleCells2(sheet,row9, new CellRangeAddress(8, 9, 11, 13), detailMap.get("unit"), true, false, null); + Row row10 = sheet.getRow(10); + // 合并A7到B8的单元格,并设置样式和内容 + mergeAndStyleCells2(sheet,row10, new CellRangeAddress(10, 11, 0, 1), "物料来源", true, true, IndexedColors.GREY_25_PERCENT); + // 合并C5到D6的单元格,并设置样式(无背景色,只有边框和内容居中) + mergeAndStyleCells2(sheet,row10, new CellRangeAddress(10, 11, 2, 3), detailMap.get("checkType"), true, false, null); + // 合并E5到F6的单元格,并设置样式和内容 + mergeAndStyleCells2(sheet,row10, new CellRangeAddress(10, 11, 4, 5), "检验依据", true, true, IndexedColors.GREY_25_PERCENT); + // 合并G5到I6的单元格,并设置样式(无背景色,只有边框和内容居中) + mergeAndStyleCells2(sheet,row10, new CellRangeAddress(10, 11,6, 8), detailMap.get("standardNo"), true, false, null); + // 合并J5到K6的单元格,并设置样式和内容 + mergeAndStyleCells2(sheet,row10, new CellRangeAddress(10, 11, 9, 10), "报检日期", true, true, IndexedColors.GREY_25_PERCENT); + // 合并L5到N6的单元格,并设置样式(无背景色,只有边框和内容居中) + mergeAndStyleCells2(sheet,row10, new CellRangeAddress(10, 11, 11, 13), detailMap.get("incomeTime"), true, false, null); + /**上下表格2**/ + Row row12 = sheet.getRow(12); + if (row12 == null) {row12 = sheet.createRow(12);} + Cell cellA13 = row12.createCell(0); + cellA13.setCellValue("序号"); + cellA13.setCellStyle(getRowStyle(sheet)); + mergeAndStyleCells(sheet, new CellRangeAddress(12, 12, 1, 4), "检验项目"); + mergeAndStyleCells(sheet, new CellRangeAddress(12, 12, 5, 8), "标准要求"); + mergeAndStyleCells(sheet, new CellRangeAddress(12, 12, 9, 10), "实测结果"); + Cell cellL13 = row12.createCell(11); + cellL13.setCellValue("判定"); + cellL13.setCellStyle(getRowStyle(sheet)); + mergeAndStyleCells(sheet, new CellRangeAddress(12, 12, 12, 13), "附件"); + //将data中的值填充到excel + int rowNum = 13; + if(!CollectionUtils.isEmpty(data)){ + Iterator iterator = data.iterator(); + //遍历数据 + for (;iterator.hasNext();){ - T obj = iterator.next();//获取当前行对应的数据 - JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(obj)); + T obj = iterator.next();//获取当前行对应的数据 + JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(obj)); - Row dataRow = sheet.getRow(rowNum);//创建行 - // 假设使用了默认字体和字符宽度来计算行高(这是一个简化的示例) - int cellHeight = (int) (cell.getStringCellValue().length() * 6); // 每个字符大约15个单位高度 - dataRow.setHeightInPoints(Math.max(dataRow.getHeightInPoints(), cellHeight)); + Row dataRow = sheet.getRow(rowNum);//创建行 + // 假设使用了默认字体和字符宽度来计算行高(这是一个简化的示例) + int cellHeight = (int) (cell.getStringCellValue().length() * 6); // 每个字符大约15个单位高度 + dataRow.setHeightInPoints(Math.max(dataRow.getHeightInPoints(), cellHeight)); - Cell cellData0 = dataRow.getCell(0); - cellData0.setCellValue(rowNum-12); - cellData0.setCellStyle(getDataStyle(sheet)); + Cell cellData0 = dataRow.getCell(0); + cellData0.setCellValue(rowNum-12); + cellData0.setCellStyle(getDataStyle(sheet)); - Cell cellData1 = dataRow.getCell(1); - cellData1.setCellValue(getValue(jsonObject.get(excelCol.get(0).getField()))); - cellData1.setCellStyle(getDataStyle(sheet)); + Cell cellData1 = dataRow.getCell(1); + cellData1.setCellValue(getValue(jsonObject.get(excelCol.get(0).getField()))); + cellData1.setCellStyle(getDataStyle(sheet)); - Cell cellData2 = dataRow.getCell(5); - cellData2.setCellValue(getValue(jsonObject.get(excelCol.get(1).getField()))); - cellData2.setCellStyle(getDataStyle(sheet)); - sheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, 5, 8)); + Cell cellData2 = dataRow.getCell(5); + cellData2.setCellValue(getValue(jsonObject.get(excelCol.get(1).getField()))); + cellData2.setCellStyle(getDataStyle(sheet)); + sheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, 5, 8)); - Cell cellData3 = dataRow.getCell(9); - cellData3.setCellValue(getValue(jsonObject.get(excelCol.get(2).getField()))); - cellData3.setCellStyle(getDataStyle(sheet)); - sheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, 9, 10)); + Cell cellData3 = dataRow.getCell(9); + cellData3.setCellValue(getValue(jsonObject.get(excelCol.get(3).getField()))); + cellData3.setCellStyle(getDataStyle(sheet)); + sheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, 9, 10)); - Cell cellData4 = dataRow.getCell(11); - cellData4.setCellValue(getValue(jsonObject.get(excelCol.get(3).getField()))); - cellData4.setCellStyle(getDataStyle(sheet)); + Cell cellData4 = dataRow.getCell(11); + cellData4.setCellValue(getValue(jsonObject.get(excelCol.get(4).getField()))); + cellData4.setCellStyle(getDataStyle(sheet)); - Cell cellData5 = dataRow.getCell(12); - cellData5.setCellValue(getValue(jsonObject.get(excelCol.get(4).getField()))); - cellData5.setCellStyle(getDataStyle(sheet)); - sheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, 12, 13)); - iterator.remove(); - rowNum++; - } - } + Cell cellData5 = dataRow.getCell(12); + cellData5.setCellValue(getValue(jsonObject.get(excelCol.get(2).getField()))); + cellData5.setCellStyle(getDataStyle(sheet)); + sheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, 12, 13)); + iterator.remove(); + rowNum++; + } + } - // 指定要检查的列索引(例如,B列的索引是1) - int columnIndex = 1; - // 遍历所有行,从第二行开始(索引1),因为第一行可能是标题行 - for (int rowIndex = 13; rowIndex <= sheet.getLastRowNum(); ) { - Row currentRow = sheet.getRow(rowIndex); - if (currentRow != null) { - Cell currentCell = currentRow.getCell(columnIndex); - if (currentCell != null && currentCell.getCellType() == CellType.STRING) { // 假设我们处理字符串类型的单元格 - String currentValue = currentCell.getStringCellValue(); + // 指定要检查的列索引(例如,B列的索引是1) + int columnIndex = 1; + // 遍历所有行,从第二行开始(索引1),因为第一行可能是标题行 + for (int rowIndex = 13; rowIndex <= sheet.getLastRowNum(); ) { + Row currentRow = sheet.getRow(rowIndex); + if (currentRow != null) { + Cell currentCell = currentRow.getCell(columnIndex); + if (currentCell != null && currentCell.getCellType() == CellType.STRING) { // 假设我们处理字符串类型的单元格 + String currentValue = currentCell.getStringCellValue(); - // 查找连续相同值的行 - int lastRowIndex = rowIndex; - while (lastRowIndex + 1 <= sheet.getLastRowNum()) { - Row nextRow = sheet.getRow(lastRowIndex + 1); - if (nextRow != null) { - Cell nextCell = nextRow.getCell(columnIndex); - if (nextCell != null && nextCell.getCellType() == CellType.STRING && - nextCell.getStringCellValue().equals(currentValue)) { - lastRowIndex++; // 继续向下查找 - } else { - break; // 找到不同值,停止查找 - } - } else { - break; // 没有更多行,停止查找 - } - } + // 查找连续相同值的行 + int lastRowIndex = rowIndex; + while (lastRowIndex + 1 <= sheet.getLastRowNum()) { + Row nextRow = sheet.getRow(lastRowIndex + 1); + if (nextRow != null) { + Cell nextCell = nextRow.getCell(columnIndex); + if (nextCell != null && nextCell.getCellType() == CellType.STRING && + nextCell.getStringCellValue().equals(currentValue)) { + lastRowIndex++; // 继续向下查找 + } else { + break; // 找到不同值,停止查找 + } + } else { + break; // 没有更多行,停止查找 + } + } - // 合并找到的行 - if (rowIndex != lastRowIndex) { // 只有在找到连续相同值的行时才进行合并 - sheet.addMergedRegion(new CellRangeAddress(rowIndex, lastRowIndex, 1, 4)); - }else{ - sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 1, 4)); - } + // 合并找到的行 + if (rowIndex != lastRowIndex) { // 只有在找到连续相同值的行时才进行合并 + sheet.addMergedRegion(new CellRangeAddress(rowIndex, lastRowIndex, 1, 4)); + }else{ + sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 1, 4)); + } - // 更新rowIndex以跳过已合并的行 - rowIndex = lastRowIndex + 1; // 从下一个未合并的行开始继续遍历 - } else { - // 如果当前单元格不是字符串类型,则直接跳到下一行 - rowIndex++; - } - } else { - // 如果当前行为空,则直接跳到下一行 - rowIndex++; - } - } + // 更新rowIndex以跳过已合并的行 + rowIndex = lastRowIndex + 1; // 从下一个未合并的行开始继续遍历 + } else { + // 如果当前单元格不是字符串类型,则直接跳到下一行 + rowIndex++; + } + } else { + // 如果当前行为空,则直接跳到下一行 + rowIndex++; + } + } - Row rowEnd1 = sheet.createRow(rowNum+2); - mergeAndStyleCellsNoBorder(sheet,rowEnd1, new CellRangeAddress(rowNum+2, rowNum+3, 0, 1), "综合检验结论", true, true, IndexedColors.GREY_25_PERCENT); - mergeAndStyleCellsNoBorder(sheet,rowEnd1, new CellRangeAddress(rowNum+2, rowNum+3, 2, 3), detailMap.get("checkResult"), true, false, null); - mergeAndStyleCellsNoBorder(sheet,rowEnd1, new CellRangeAddress(rowNum+2, rowNum+3, 5, 10), "备注:判定合格打“√”,不合格打“×”", true, true, null); - Row rowEnd2 = sheet.createRow(rowNum+5); - mergeAndStyleCellsNoBorder(sheet,rowEnd2, new CellRangeAddress(rowNum+5, rowNum+5, 0, 1), "品管经理/主任", true, true, IndexedColors.GREY_25_PERCENT); - mergeAndStyleCellsNoBorder(sheet,rowEnd2, new CellRangeAddress(rowNum+5, rowNum+5, 2, 3), "", true, false, null); - mergeAndStyleCellsNoBorder(sheet,rowEnd2, new CellRangeAddress(rowNum+5, rowNum+5, 5, 6), "品质主管", true, true, IndexedColors.GREY_25_PERCENT); - mergeAndStyleCellsNoBorder(sheet,rowEnd2, new CellRangeAddress(rowNum+5, rowNum+5, 7, 8), "", true, false, null); - mergeAndStyleCellsNoBorder(sheet,rowEnd2, new CellRangeAddress(rowNum+5, rowNum+5, 10, 11), "品管员", true, true, IndexedColors.GREY_25_PERCENT); - mergeAndStyleCellsNoBorder(sheet,rowEnd2, new CellRangeAddress(rowNum+5, rowNum+5, 12, 13), detailMap.get("checkManName"), true, false, null); + Row rowEnd1 = sheet.createRow(rowNum+2); + mergeAndStyleCellsNoBorder(sheet,rowEnd1, new CellRangeAddress(rowNum+2, rowNum+3, 0, 1), "综合检验结论", true, true, IndexedColors.GREY_25_PERCENT); + mergeAndStyleCellsNoBorder(sheet,rowEnd1, new CellRangeAddress(rowNum+2, rowNum+3, 2, 3), detailMap.get("checkResult"), true, false, null); + mergeAndStyleCellsNoBorder(sheet,rowEnd1, new CellRangeAddress(rowNum+2, rowNum+3, 5, 10), "备注:判定合格打“√”,不合格打“×”", true, true, null); + Row rowEnd2 = sheet.createRow(rowNum+5); + mergeAndStyleCellsNoBorder(sheet,rowEnd2, new CellRangeAddress(rowNum+5, rowNum+5, 0, 1), "品管经理/主任", true, true, IndexedColors.GREY_25_PERCENT); + mergeAndStyleCellsNoBorder(sheet,rowEnd2, new CellRangeAddress(rowNum+5, rowNum+5, 2, 3), "", true, false, null); + mergeAndStyleCellsNoBorder(sheet,rowEnd2, new CellRangeAddress(rowNum+5, rowNum+5, 5, 6), "品质主管", true, true, IndexedColors.GREY_25_PERCENT); + mergeAndStyleCellsNoBorder(sheet,rowEnd2, new CellRangeAddress(rowNum+5, rowNum+5, 7, 8), "", true, false, null); + mergeAndStyleCellsNoBorder(sheet,rowEnd2, new CellRangeAddress(rowNum+5, rowNum+5, 10, 11), "品管员", true, true, IndexedColors.GREY_25_PERCENT); + mergeAndStyleCellsNoBorder(sheet,rowEnd2, new CellRangeAddress(rowNum+5, rowNum+5, 12, 13), detailMap.get("checkManName"), true, false, null); - Row rowEnd3 = sheet.createRow(rowNum+4); - mergeAndStyleCellsNoBorder(sheet, rowEnd3, new CellRangeAddress(rowNum+4, rowNum+4, 0, 1), "备注", true, true, IndexedColors.GREY_25_PERCENT); - mergeAndStyleCellsNoBorder(sheet, rowEnd3, new CellRangeAddress(rowNum+4, rowNum+4, 2, 13), detailMap.get("remark"), true, false, null); + Row rowEnd3 = sheet.createRow(rowNum+4); + mergeAndStyleCellsNoBorder(sheet, rowEnd3, new CellRangeAddress(rowNum+4, rowNum+4, 0, 1), "备注", true, true, IndexedColors.GREY_25_PERCENT); + mergeAndStyleCellsNoBorder(sheet, rowEnd3, new CellRangeAddress(rowNum+4, rowNum+4, 2, 13), detailMap.get("remark"), true, false, null); // Row rowEnd3 = sheet.createRow(rowNum+8); // mergeAndStyleCellsNoBorder(sheet,rowEnd3, new CellRangeAddress(rowNum+5, rowNum+5, 0, 1), "品管经理/主任", true, true, IndexedColors.GREY_25_PERCENT); @@ -266,8 +266,8 @@ public class ExcelReportMapUtil { // mergeAndStyleCellsNoBorder(sheet,rowEnd2, new CellRangeAddress(rowNum+6, rowNum+6, 2, 13), detailMap.get("remark"), true, false, null); - return workbook; - } + return workbook; + } // //标题样式 // public static CellStyle getHeaderFont(Workbook workbook){ @@ -291,7 +291,7 @@ public class ExcelReportMapUtil { // return cellStyle; // } -// //内容样式 + // //内容样式 // public static CellStyle getDataFont(Workbook workbook){ // Font font = workbook.createFont(); // font.setFontHeightInPoints((short) 12);//字体大小 @@ -304,15 +304,15 @@ public class ExcelReportMapUtil { // return cellStyle; // } // - //处理数据 - public static String getValue(Object object){ - if (object==null){ - return ""; - }else { - return object.toString(); - } - } -// //处理数据 + //处理数据 + public static String getValue(Object object){ + if (object==null){ + return ""; + }else { + return object.toString(); + } + } + // //处理数据 // public static Integer getValueNum(Object object){ // if (object==null){ // return 0; @@ -320,163 +320,163 @@ public class ExcelReportMapUtil { // return Integer.parseInt(object.toString()); // } // } - // 从resources目录获取图片的字节数组 - private static byte[] getImageBytesFromResources(String resourceName) { - try (InputStream inputStream = ExcelReportMapUtil.class.getClassLoader().getResourceAsStream(resourceName); - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) { + // 从resources目录获取图片的字节数组 + private static byte[] getImageBytesFromResources(String resourceName) { + try (InputStream inputStream = ExcelReportMapUtil.class.getClassLoader().getResourceAsStream(resourceName); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) { - if (inputStream == null) { - throw new RuntimeException("找不到资源: " + resourceName); - } + if (inputStream == null) { + throw new RuntimeException("找不到资源: " + resourceName); + } - IOUtils.copy(inputStream, byteArrayOutputStream); - return byteArrayOutputStream.toByteArray(); + IOUtils.copy(inputStream, byteArrayOutputStream); + return byteArrayOutputStream.toByteArray(); - } catch (IOException e) { - throw new RuntimeException("读取资源时出错: " + resourceName, e); - } - } - //报告大标题样式-1 - public static CellStyle getTitelStyle(Workbook workbook){ - Font font = workbook.createFont(); - // 设置字体为加粗 - font.setBold(true); - // 设置字体大小(例如,设置为16) - font.setFontHeightInPoints((short) 24); - CellStyle cellStyle = workbook.createCellStyle(); - cellStyle.setFont(font); - cellStyle.setAlignment(HorizontalAlignment.CENTER_SELECTION);//设置水平居中 - cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//设置垂直居中 - cellStyle.setWrapText(true);//设置单元格内容自动换行 - return cellStyle; - } - public static CellStyle getRowStyle(Sheet sheet){ - CellStyle style = sheet.getWorkbook().createCellStyle(); - // 设置边框线 - style.setBorderBottom(BorderStyle.THIN); - style.setBorderLeft(BorderStyle.THIN); - style.setBorderRight(BorderStyle.THIN); - style.setBorderTop(BorderStyle.THIN); - // 设置水平居中 - style.setAlignment(HorizontalAlignment.CENTER); - style.setWrapText(true);//设置单元格内容自动换行 - // 设置垂直居中 - style.setVerticalAlignment(VerticalAlignment.CENTER); - Font font = sheet.getWorkbook().createFont(); - font.setBold(true); - // 设置字体大小(例如,设置为14) - font.setFontHeightInPoints((short) 14); - style.setFont(font); - return style; - } - public static CellStyle getDataStyle(Sheet sheet){ - CellStyle style = sheet.getWorkbook().createCellStyle(); - // 设置边框线 - style.setBorderBottom(BorderStyle.THIN); - style.setBorderLeft(BorderStyle.THIN); - style.setBorderRight(BorderStyle.THIN); - style.setBorderTop(BorderStyle.THIN); - Font font = sheet.getWorkbook().createFont(); + } catch (IOException e) { + throw new RuntimeException("读取资源时出错: " + resourceName, e); + } + } + //报告大标题样式-1 + public static CellStyle getTitelStyle(Workbook workbook){ + Font font = workbook.createFont(); + // 设置字体为加粗 + font.setBold(true); + // 设置字体大小(例如,设置为16) + font.setFontHeightInPoints((short) 24); + CellStyle cellStyle = workbook.createCellStyle(); + cellStyle.setFont(font); + cellStyle.setAlignment(HorizontalAlignment.CENTER_SELECTION);//设置水平居中 + cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//设置垂直居中 + cellStyle.setWrapText(true);//设置单元格内容自动换行 + return cellStyle; + } + public static CellStyle getRowStyle(Sheet sheet){ + CellStyle style = sheet.getWorkbook().createCellStyle(); + // 设置边框线 + style.setBorderBottom(BorderStyle.THIN); + style.setBorderLeft(BorderStyle.THIN); + style.setBorderRight(BorderStyle.THIN); + style.setBorderTop(BorderStyle.THIN); + // 设置水平居中 + style.setAlignment(HorizontalAlignment.CENTER); + style.setWrapText(true);//设置单元格内容自动换行 + // 设置垂直居中 + style.setVerticalAlignment(VerticalAlignment.CENTER); + Font font = sheet.getWorkbook().createFont(); + font.setBold(true); + // 设置字体大小(例如,设置为14) + font.setFontHeightInPoints((short) 14); + style.setFont(font); + return style; + } + public static CellStyle getDataStyle(Sheet sheet){ + CellStyle style = sheet.getWorkbook().createCellStyle(); + // 设置边框线 + style.setBorderBottom(BorderStyle.THIN); + style.setBorderLeft(BorderStyle.THIN); + style.setBorderRight(BorderStyle.THIN); + style.setBorderTop(BorderStyle.THIN); + Font font = sheet.getWorkbook().createFont(); - // 设置字体大小(例如,设置为14) - font.setFontHeightInPoints((short) 14); - style.setFont(font); - style.setWrapText(true);//设置单元格内容自动换行 - // 设置水平居中 - style.setAlignment(HorizontalAlignment.LEFT); - // 设置垂直居中 - style.setVerticalAlignment(VerticalAlignment.CENTER); - return style; - } - private static void mergeAndStyleCells(Sheet sheet, CellRangeAddress cellRangeAddress, String cellValue) { - // 合并单元格 - sheet.addMergedRegion(cellRangeAddress); + // 设置字体大小(例如,设置为14) + font.setFontHeightInPoints((short) 14); + style.setFont(font); + style.setWrapText(true);//设置单元格内容自动换行 + // 设置水平居中 + style.setAlignment(HorizontalAlignment.LEFT); + // 设置垂直居中 + style.setVerticalAlignment(VerticalAlignment.CENTER); + return style; + } + private static void mergeAndStyleCells(Sheet sheet, CellRangeAddress cellRangeAddress, String cellValue) { + // 合并单元格 + sheet.addMergedRegion(cellRangeAddress); - // 创建一个单元格样式 - CellStyle style = sheet.getWorkbook().createCellStyle(); + // 创建一个单元格样式 + CellStyle style = sheet.getWorkbook().createCellStyle(); - // 设置字体为加粗 - Font font = sheet.getWorkbook().createFont(); - font.setBold(true); - // 设置字体大小(例如,设置为14) - font.setFontHeightInPoints((short) 14); - style.setFont(font); + // 设置字体为加粗 + Font font = sheet.getWorkbook().createFont(); + font.setBold(true); + // 设置字体大小(例如,设置为14) + font.setFontHeightInPoints((short) 14); + style.setFont(font); - // 设置水平居中 - style.setAlignment(HorizontalAlignment.CENTER); - // 设置垂直居中 - style.setVerticalAlignment(VerticalAlignment.CENTER); - style.setWrapText(true);//设置单元格内容自动换行 - // 获取合并后的单元格的第一个单元格,并设置值 - Row row = sheet.getRow(cellRangeAddress.getFirstRow()); - if (row == null) { - row = sheet.createRow(cellRangeAddress.getFirstRow()); - } - Cell cell = row.getCell(cellRangeAddress.getFirstColumn()); - if (cell == null) { - cell = row.createCell(cellRangeAddress.getFirstColumn()); - } - cell.setCellValue(cellValue); // 设置单元格的值 - cell.setCellStyle(style); // 应用样式到单元格 - } - private static void mergeAndStyleCells2(Sheet sheet,Row row, CellRangeAddress cellRangeAddress, String cellValue, boolean centered, boolean hasBackground, IndexedColors backgroundColor) { - // 合并单元格 - sheet.addMergedRegion(cellRangeAddress); + // 设置水平居中 + style.setAlignment(HorizontalAlignment.CENTER); + // 设置垂直居中 + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setWrapText(true);//设置单元格内容自动换行 + // 获取合并后的单元格的第一个单元格,并设置值 + Row row = sheet.getRow(cellRangeAddress.getFirstRow()); + if (row == null) { + row = sheet.createRow(cellRangeAddress.getFirstRow()); + } + Cell cell = row.getCell(cellRangeAddress.getFirstColumn()); + if (cell == null) { + cell = row.createCell(cellRangeAddress.getFirstColumn()); + } + cell.setCellValue(cellValue); // 设置单元格的值 + cell.setCellStyle(style); // 应用样式到单元格 + } + private static void mergeAndStyleCells2(Sheet sheet,Row row, CellRangeAddress cellRangeAddress, String cellValue, boolean centered, boolean hasBackground, IndexedColors backgroundColor) { + // 合并单元格 + sheet.addMergedRegion(cellRangeAddress); - // 创建一个单元格样式 - CellStyle style = sheet.getWorkbook().createCellStyle(); + // 创建一个单元格样式 + CellStyle style = sheet.getWorkbook().createCellStyle(); - // 设置字体居中 - if (centered) { - style.setAlignment(HorizontalAlignment.CENTER); - style.setVerticalAlignment(VerticalAlignment.CENTER); - } + // 设置字体居中 + if (centered) { + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + } - // 设置背景颜色(如果有) - if (hasBackground && backgroundColor != null) { - style.setFillForegroundColor(backgroundColor.getIndex()); - style.setFillPattern(FillPatternType.SOLID_FOREGROUND); - } + // 设置背景颜色(如果有) + if (hasBackground && backgroundColor != null) { + style.setFillForegroundColor(backgroundColor.getIndex()); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); + } - // 设置边框线 - style.setBorderBottom(BorderStyle.THIN); - style.setBorderLeft(BorderStyle.THIN); - style.setBorderRight(BorderStyle.THIN); - style.setBorderTop(BorderStyle.THIN); + // 设置边框线 + style.setBorderBottom(BorderStyle.THIN); + style.setBorderLeft(BorderStyle.THIN); + style.setBorderRight(BorderStyle.THIN); + style.setBorderTop(BorderStyle.THIN); - // 获取合并后的单元格的第一个单元格,并设置值 - Cell cell = row.getCell(cellRangeAddress.getFirstColumn()); - if (cell == null) { - cell = row.createCell(cellRangeAddress.getFirstColumn()); - } - cell.setCellValue(cellValue); // 设置单元格的值 - cell.setCellStyle(style); // 应用样式到单元格 - } - private static void mergeAndStyleCellsNoBorder(Sheet sheet,Row row, CellRangeAddress cellRangeAddress, String cellValue, boolean centered, boolean hasBackground, IndexedColors backgroundColor) { - // 合并单元格 - sheet.addMergedRegion(cellRangeAddress); + // 获取合并后的单元格的第一个单元格,并设置值 + Cell cell = row.getCell(cellRangeAddress.getFirstColumn()); + if (cell == null) { + cell = row.createCell(cellRangeAddress.getFirstColumn()); + } + cell.setCellValue(cellValue); // 设置单元格的值 + cell.setCellStyle(style); // 应用样式到单元格 + } + private static void mergeAndStyleCellsNoBorder(Sheet sheet,Row row, CellRangeAddress cellRangeAddress, String cellValue, boolean centered, boolean hasBackground, IndexedColors backgroundColor) { + // 合并单元格 + sheet.addMergedRegion(cellRangeAddress); - // 创建一个单元格样式 - CellStyle style = sheet.getWorkbook().createCellStyle(); + // 创建一个单元格样式 + CellStyle style = sheet.getWorkbook().createCellStyle(); - // 设置字体居中 - if (centered) { - style.setAlignment(HorizontalAlignment.CENTER); - style.setVerticalAlignment(VerticalAlignment.CENTER); - } + // 设置字体居中 + if (centered) { + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + } - // 设置背景颜色(如果有) - if (hasBackground && backgroundColor != null) { - style.setFillForegroundColor(backgroundColor.getIndex()); - style.setFillPattern(FillPatternType.SOLID_FOREGROUND); - } + // 设置背景颜色(如果有) + if (hasBackground && backgroundColor != null) { + style.setFillForegroundColor(backgroundColor.getIndex()); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); + } - // 获取合并后的单元格的第一个单元格,并设置值 - Cell cell = row.getCell(cellRangeAddress.getFirstColumn()); - if (cell == null) { - cell = row.createCell(cellRangeAddress.getFirstColumn()); - } - cell.setCellValue(cellValue); // 设置单元格的值 - cell.setCellStyle(style); // 应用样式到单元格 - } + // 获取合并后的单元格的第一个单元格,并设置值 + Cell cell = row.getCell(cellRangeAddress.getFirstColumn()); + if (cell == null) { + cell = row.createCell(cellRangeAddress.getFirstColumn()); + } + cell.setCellValue(cellValue); // 设置单元格的值 + cell.setCellStyle(style); // 应用样式到单元格 + } } diff --git a/op-common/op-common-log/op-common-log.iml b/op-common/op-common-log/op-common-log.iml new file mode 100644 index 000000000..c77b938cd --- /dev/null +++ b/op-common/op-common-log/op-common-log.iml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/op-modules/op-device/push-device.bat b/op-modules/op-device/push-device.bat index e96795b15..b219b1858 100644 --- a/op-modules/op-device/push-device.bat +++ b/op-modules/op-device/push-device.bat @@ -27,7 +27,7 @@ if exist %df% ( ) echo --------------------------------Dockerfile-------------------------------- ::echo FROM 192.168.202.36:30002/library/openjdk:8u131-jdk-alpine >> Dockerfile -echo FROM 192.168.202.36:30002/library/openjdk:8-sw66>> Dockerfile +echo FROM openjdk:8u131-jdk >> Dockerfile echo COPY %jarName% /application.jar >> Dockerfile echo RUN echo "Asia/Shanghai" ^> /etc/timezone >> Dockerfile echo CMD ["java", "-jar", "-Dspring.profiles.active=%profile%", "application.jar"] >> Dockerfile diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquFaultDescriptionController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquFaultDescriptionController.java index d17a4db7c..027c82975 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquFaultDescriptionController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquFaultDescriptionController.java @@ -1,6 +1,9 @@ package com.op.device.controller; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; @@ -63,7 +66,14 @@ public class EquFaultDescriptionController extends BaseController { @RequiresPermissions("device:faultDescription:query") @GetMapping(value = "/{faultId}") public AjaxResult getInfo(@PathVariable("faultId") String faultId) { - return success(equFaultDescriptionService.selectEquFaultDescriptionByFaultId(faultId)); + AjaxResult ajaxResult = AjaxResult.success(); + EquFaultDescription EquFaultDescriptionInfo= equFaultDescriptionService.selectEquFaultDescriptionByFaultId(faultId); + ajaxResult.put("info",EquFaultDescriptionInfo); + // List arry = equFaultDescriptionService.selectFaultdesDictByfaultIds(faultId); + ajaxResult.put("dictValues", equFaultDescriptionService.selectFaultdesDictByfaultIds(faultId)); + +// return success(equFaultDescriptionService.selectEquFaultDescriptionByFaultId(faultId)); + return ajaxResult; } /** diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquFaultDescription.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquFaultDescription.java index e94a4ecba..4f1522a6d 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquFaultDescription.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquFaultDescription.java @@ -93,6 +93,17 @@ public class EquFaultDescription extends BaseEntity { // 创建日期结束 private String createTimeEnd; + /** 设备类型组 */ + private String[] dictValues; + + public String[] getDictValues() { + return dictValues; + } + + public void setDictValues(String[] dictValues) { + this.dictValues = dictValues; + } + public void setFaultId(String faultId) { this.faultId = faultId; } diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquFaultdesDict.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquFaultdesDict.java new file mode 100644 index 000000000..5e2563224 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquFaultdesDict.java @@ -0,0 +1,22 @@ +package com.op.device.domain; + +public class EquFaultdesDict { + private String faultId; + private String dictValue; + + public String getFaultId() { + return faultId; + } + + public void setFaultId(String faultId) { + this.faultId = faultId; + } + + public String getDictValue() { + return dictValue; + } + + public void setDictValue(String dictValue) { + this.dictValue = dictValue; + } +} diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquOperation.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquOperation.java index 9a9ab0622..ced230946 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquOperation.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquOperation.java @@ -23,6 +23,9 @@ public class EquOperation extends BaseEntity { */ private String id; + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date createTime; /** * 车间 */ @@ -125,6 +128,11 @@ public class EquOperation extends BaseEntity { @Excel(name = "工厂") private String factoryCode; + + + + + /** * 备用字段1 */ @@ -192,6 +200,16 @@ public class EquOperation extends BaseEntity { private String poolName; + @Override + public Date getCreateTime() { + return createTime; + } + + @Override + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + public String getCreateTimeStart() { return createTimeStart; } diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquTeamUser.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquTeamUser.java index 75267764e..0c6d311ea 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquTeamUser.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquTeamUser.java @@ -2,6 +2,7 @@ package com.op.device.domain; import com.op.common.core.annotation.Excel; import com.op.common.core.web.domain.BaseEntity; +import com.op.system.api.domain.SysDept; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -61,6 +62,30 @@ public class EquTeamUser extends BaseEntity { @Excel(name = "手机号") private String phonenumber; + private SysDept dept; + + + + private Long deptId; + + @Override + public Long getDeptId() { + return deptId; + } + + @Override + public void setDeptId(Long deptId) { + this.deptId = deptId; + } + + public SysDept getDept() { + return dept; + } + + public void setDept(SysDept dept) { + this.dept = dept; + } + public void setId(String id) { this.id = id; } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquFaultDescriptionMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquFaultDescriptionMapper.java index 2e90ab3e1..45e0a8dc5 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquFaultDescriptionMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquFaultDescriptionMapper.java @@ -4,6 +4,7 @@ import java.util.List; import com.op.device.domain.EquFaultDescription; import com.op.device.domain.EquFaultType; +import com.op.device.domain.EquFaultdesDict; /** * 故障描述Mapper接口 @@ -63,4 +64,12 @@ public interface EquFaultDescriptionMapper { int selectSerialNumber(); List selectFaultDescriptionList(EquFaultDescription equFaultDescription); + + void deleteFaultdesDictByfaultId(String faultId); + + void batchFaultdesDict(List list); + + void deleteFaultdesDictByfaultIds(String[] faultIds); + + List selectFaultdesDictByfaultId(String faultId); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOperationMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOperationMapper.java index dc12598ac..20a63bec6 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOperationMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOperationMapper.java @@ -1,6 +1,7 @@ package com.op.device.mapper; import java.util.List; +import java.util.Map; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.device.domain.EquOperation; @@ -93,4 +94,6 @@ public interface EquOperationMapper { * @return */ public EquOperation selectEquipmentIntegrityRate(@Param("time") String time, @Param("equipmentCode") String equipmentCode); + + String getInfoByUserName(String part); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquFaultDescriptionService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquFaultDescriptionService.java index 1e1f0b2c7..8fa5e94da 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquFaultDescriptionService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquFaultDescriptionService.java @@ -59,4 +59,6 @@ public interface IEquFaultDescriptionService { * @return 结果 */ public int deleteEquFaultDescriptionByFaultId(String faultId); + + List selectFaultdesDictByfaultIds(String faultId); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java index 32bd04428..4d95043a8 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java @@ -720,6 +720,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService { return success("新增报修记录成功!"); } catch (Exception e) { + logger.error(e.getMessage()); return error(); } } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java index cf9419ee2..36f686180 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java @@ -470,6 +470,7 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { EquOrder order = new EquOrder(); //源->目标 BeanUtils.copyProperties(plan, order); + order.setOrderId(IdUtils.fastSimpleUUID()); order.setCreateBy(createBy); order.setCreateTime(nowtime); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquFaultDescriptionServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquFaultDescriptionServiceImpl.java index b64e5ca16..b3f0412bd 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquFaultDescriptionServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquFaultDescriptionServiceImpl.java @@ -1,14 +1,17 @@ package com.op.device.service.impl; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.List; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.context.SecurityContextHolder; import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.web.domain.AjaxResult; import com.op.device.domain.EquFaultType; +import com.op.device.domain.EquFaultdesDict; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.device.mapper.EquFaultDescriptionMapper; @@ -112,6 +115,7 @@ public class EquFaultDescriptionServiceImpl implements IEquFaultDescriptionServi equFaultDescription.setUpdateBy(SecurityContextHolder.getUserName()); equFaultDescription.setUpdateTime(DateUtils.getNowDate()); equFaultDescriptionMapper.insertEquFaultDescription(equFaultDescription); + this.insertFaultdesDict(equFaultDescription); return success("新增故障描述成功!"); } @@ -140,9 +144,35 @@ public class EquFaultDescriptionServiceImpl implements IEquFaultDescriptionServi equFaultDescription.setUpdateTime(DateUtils.getNowDate()); // 插入数据库 equFaultDescriptionMapper.updateEquFaultDescription(equFaultDescription); + String faultId = equFaultDescription.getFaultId(); + // 删除关联 + equFaultDescriptionMapper.deleteFaultdesDictByfaultId(faultId); + // 新增关联 + insertFaultdesDict(equFaultDescription); return success("修改成功!"); } + public void insertFaultdesDict(EquFaultDescription equFaultDescription) { + this.insertFaultdesDict(equFaultDescription, equFaultDescription.getDictValues()); + } + /** + * 新增故障描述和设备类型关系 + * + * @param equFaultDescription + */ + public void insertFaultdesDict(EquFaultDescription equFaultDescription,String[] dictValues) { + if (StringUtils.isNotEmpty(dictValues)) { + // 新增用户与岗位管理 + List list = new ArrayList(); + for (String dictValue : dictValues) { + EquFaultdesDict up = new EquFaultdesDict(); + up.setFaultId(equFaultDescription.getFaultId()); + up.setDictValue(dictValue); + list.add(up); + } + equFaultDescriptionMapper.batchFaultdesDict(list); + } + } /** * 批量删除故障描述 * @@ -152,6 +182,8 @@ public class EquFaultDescriptionServiceImpl implements IEquFaultDescriptionServi @Override @DS("#header.poolName") public int deleteEquFaultDescriptionByFaultIds(String[] faultIds) { + // 删除用户与岗位关联 + equFaultDescriptionMapper.deleteFaultdesDictByfaultIds(faultIds); return equFaultDescriptionMapper.deleteEquFaultDescriptionByFaultIds(faultIds); } @@ -164,6 +196,13 @@ public class EquFaultDescriptionServiceImpl implements IEquFaultDescriptionServi @Override @DS("#header.poolName") public int deleteEquFaultDescriptionByFaultId(String faultId) { + equFaultDescriptionMapper.deleteFaultdesDictByfaultId(faultId); return equFaultDescriptionMapper.deleteEquFaultDescriptionByFaultId(faultId); } + + @Override + @DS("#header.poolName") + public List selectFaultdesDictByfaultIds(String faultId) { + return equFaultDescriptionMapper.selectFaultdesDictByfaultId(faultId); + } } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOperationServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOperationServiceImpl.java index bd35262dd..f931bf9f5 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOperationServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOperationServiceImpl.java @@ -5,6 +5,7 @@ import java.math.RoundingMode; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.List; +import java.util.Map; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.utils.DateUtils; @@ -56,7 +57,21 @@ public class EquOperationServiceImpl implements IEquOperationService { equOperation.setCreateTimeEnd(formatter.format(equOperation.getCreateTimeArray().get(1))); } } - return equOperationMapper.selectEquOperationList(equOperation); + List operationList = equOperationMapper.selectEquOperationList(equOperation); + if (operationList != null && operationList.size() > 0){ + for (EquOperation operation:operationList) { + if (operation.getRepairPerson() != null){ + String[] parts = operation.getRepairPerson().split(";"); + String names = ""; + for (String part : parts) { + String name=equOperationMapper.getInfoByUserName(part); + names = names+name+";"; + } + operation.setRepairPerson(names); + } + } + } + return operationList; } /** diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java index 5070ac324..2b75f000c 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java @@ -519,24 +519,24 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService String GZCS = equOperation.getHandlingMethod();//维修措施 String WXR = equOperation.getRepairPerson();//维修人 if (GZMS != null) { - equOperation.setFailureDescription(GZMS + formattedDate + ":" + equRepairWorkOrder.getWorkFaultDesc() + ";"); + equOperation.setFailureDescription(GZMS + equRepairWorkOrder.getWorkFaultDesc() + ";"); } else { - equOperation.setFailureDescription(formattedDate + ":" + equRepairWorkOrder.getWorkFaultDesc() + ";"); + equOperation.setFailureDescription(equRepairWorkOrder.getWorkFaultDesc() + ";"); } if (GZYY != null) { - equOperation.setReasonAnalyze(GZYY + formattedDate + ":" + equRepairWorkOrder.getWorkReason() + ";"); + equOperation.setReasonAnalyze(GZYY + equRepairWorkOrder.getWorkReason() + ";"); } else { - equOperation.setReasonAnalyze(formattedDate + ":" + equRepairWorkOrder.getWorkReason() + ";"); + equOperation.setReasonAnalyze(equRepairWorkOrder.getWorkReason() + ";"); } if (GZCS != null) { - equOperation.setHandlingMethod(GZCS + formattedDate + ":" + equRepairWorkOrder.getRepairMeasures() + ";"); + equOperation.setHandlingMethod(GZCS + equRepairWorkOrder.getRepairMeasures() + ";"); } else { - equOperation.setHandlingMethod(formattedDate + ":" + equRepairWorkOrder.getRepairMeasures() + ";"); + equOperation.setHandlingMethod(equRepairWorkOrder.getRepairMeasures() + ";"); } if (WXR != null) { - equOperation.setRepairPerson(WXR + formattedDate + ":" + equRepairWorkOrder.getWorkPerson() + ";"); + equOperation.setRepairPerson(WXR + equRepairWorkOrder.getWorkPerson() + ";"); } else { - equOperation.setRepairPerson(formattedDate + ":" + equRepairWorkOrder.getWorkPerson() + ";"); + equOperation.setRepairPerson(equRepairWorkOrder.getWorkPerson() + ";"); } } //当获取的设备运行记录为空的时候,代表没有生成,这块让上位机卡住 todo diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquTeamServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquTeamServiceImpl.java index bd2a1275f..cf68ff103 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquTeamServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquTeamServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.web.domain.AjaxResult; +import com.op.common.datascope.annotation.DataScope; import com.op.common.security.utils.SecurityUtils; import com.op.device.domain.EquTeamUser; import com.op.device.mapper.EquTeamUserMapper; @@ -188,6 +189,7 @@ public class EquTeamServiceImpl implements IEquTeamService { @Override @DS("#master") public List selectTeamMembers(EquTeamUser equTeamUser) { - return equTeamMapper.selectTeamMembers(equTeamUser); + List equTeamUserList =equTeamMapper.selectTeamMembers(equTeamUser); + return equTeamUserList; } } diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquFaultDescriptionMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquFaultDescriptionMapper.xml index 121889ea8..dfc2642b6 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquFaultDescriptionMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquFaultDescriptionMapper.xml @@ -91,6 +91,12 @@ #{updateTime}, + + insert into equ_faultdes_dict(fault_id, dict_value) values + + (#{item.faultId},#{item.dictValue}) + + update equ_fault_description @@ -122,10 +128,27 @@ #{faultId} + + delete from equ_faultdes_dict where fault_id=#{faultId} + + + + + delete from equ_faultdes_dict where fault_id in + + #{faultId} + + + diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml index cb968da28..b5380a081 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOperationMapper.xml @@ -85,7 +85,7 @@ and reason_analyze = #{reasonAnalyze} and handling_method = #{handlingMethod} - and repair_person concat('%', #{repairPerson}, + and repair_person like concat('%', #{repairPerson}, '%') and equ_status_des = #{equStatusDes} @@ -279,5 +279,7 @@ and equipment_code = #{equipmentCode} and del_flag = '0' - + diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml index 3b65845fe..fcfe21697 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml @@ -115,7 +115,7 @@ and order_code like concat('%', #{orderCode}, '%') - and equipment_code like concat('%',#{equipmentCode}, '%') + and ero.equipment_code like concat('%',#{equipmentCode}, '%') and order_desc like concat('%', #{orderDesc}, '%') and CONVERT(date,order_breakdown_time) >= #{orderBreakdownTimeStart} @@ -389,7 +389,7 @@ LEFT JOIN base_equipment B ON A.equipment_code = B.equipment_code WHERE A.auxiliary_equipment_code = #{equipmentCode} - + AND A.del_flag='0' + diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml index ca5207f43..eeca0642e 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml @@ -711,6 +711,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select ow.workorder_code workorderCode, ow.workorder_code_sap workorderCodeSap, + ow.product_date productDate, mrw.quantity_feedback quantityFeedback, mrw.product_code productCode, mrw.product_name productName, diff --git a/op-modules/op-open/push-open.bat b/op-modules/op-open/push-open.bat index 70672bb89..131941be6 100644 --- a/op-modules/op-open/push-open.bat +++ b/op-modules/op-open/push-open.bat @@ -26,8 +26,7 @@ if exist %df% ( del /f /s /q .\Dockerfile ) echo --------------------------------Dockerfile-------------------------------- -::echo FROM 192.168.202.36:30002/library/openjdk:8u131-jdk-alpine >> Dockerfile -echo FROM 192.168.202.36:30002/library/openjdk:8-sw66>> Dockerfile +echo FROM openjdk:8u131-jdk >> Dockerfile echo COPY %jarName% /application.jar >> Dockerfile echo RUN echo "Asia/Shanghai" ^> /etc/timezone >> Dockerfile echo CMD ["java", "-jar", "-Dspring.profiles.active=%profile%", "application.jar"] >> Dockerfile diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml index 1beb71a85..f80a8f33d 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml @@ -28,7 +28,6 @@ - @@ -107,10 +106,17 @@ pow.route_code, pow.prod_line_code, pow.product_date, pow.shift_id, pow.parent_order,pow.status, pow.prod_type,pow.factory_code, pow.end_flag,pow.car_num,pow.sort_no, - pow.workorder_code_sap,po.atrr2,be.sap_code,be.sap_name + pow.workorder_code_sap,po.atrr2,be.sap_code,be.sap_name, + REPLACE(FORMAT(bp.length, '0.########'), '.', '') + '×' + + REPLACE(FORMAT(bp.width, '0.########'), '.', '') + '×' + + REPLACE(FORMAT(bp.height, '0.########'), '.', '') AS attr4, + sda.dict_label AS attr3 from pro_order_workorder pow left join pro_order po on pow.order_id = po.id left join base_equipment be on pow.workorder_name=be.equipment_code + left join base_product bp on pow.product_code=bp.product_code + LEFT JOIN base_product_attached bpa ON RIGHT(bp.product_code, 11) = bpa.product_code + LEFT JOIN lanju_op_cloud.dbo.sys_dict_data sda ON bpa.pack_type = sda.dict_value and sda.dict_type = 'pack_type' and pow.workorder_code like concat('%', #{workorderCode}, '%') diff --git a/op-modules/op-printservice/pom.xml b/op-modules/op-printservice/pom.xml new file mode 100644 index 000000000..d60d0c7f8 --- /dev/null +++ b/op-modules/op-printservice/pom.xml @@ -0,0 +1,15 @@ + + + + op-modules + com.op + 0.0.1 + + 4.0.0 + + op-printservice + + + diff --git a/op-modules/op-quality/push-quality.bat b/op-modules/op-quality/push-quality.bat index d690a5411..2c82b3f7b 100644 --- a/op-modules/op-quality/push-quality.bat +++ b/op-modules/op-quality/push-quality.bat @@ -26,8 +26,7 @@ if exist %df% ( del /f /s /q .\Dockerfile ) echo --------------------------------Dockerfile-------------------------------- -::echo FROM 192.168.202.36:30002/library/openjdk:8u131-jdk-alpine >> Dockerfile -echo FROM 192.168.202.36:30002/library/openjdk:8-sw66>> Dockerfile +echo FROM openjdk:8u131-jdk >> Dockerfile echo COPY %jarName% /application.jar >> Dockerfile echo RUN echo "Asia/Shanghai" ^> /etc/timezone >> Dockerfile echo CMD ["java", "-jar", "-Dspring.profiles.active=%profile%", "application.jar"] >> Dockerfile diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java index a0f997063..898ae58c4 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java @@ -168,7 +168,7 @@ public class QcCheckTaskIncomeController extends BaseController { ArrayList excelCols = new ArrayList<>(); excelCols.add(new ExcelCol("检验项目", "ruleName", 30)); excelCols.add(new ExcelCol("标准要求", "checkStandard", 30)); - excelCols.add(new ExcelCol("抽检数", "samplePlan", 30)); + excelCols.add(new ExcelCol("抽检数", "sampleQuality", 30)); excelCols.add(new ExcelCol("实测结果", "actualValue", 30)); excelCols.add(new ExcelCol("判定", "status", 30)); excelCols.add(new ExcelCol("附件", "fileUrls", 30)); diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckWechartController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckWechartController.java new file mode 100644 index 000000000..73e94dbfc --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckWechartController.java @@ -0,0 +1,29 @@ +package com.op.quality.controller; + +import com.op.common.core.web.controller.BaseController; +import com.op.common.core.web.domain.AjaxResult; +import com.op.quality.service.QcCheckWechartService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Map; + +/** + * + * 质检信息企业微信推送 + * @author YangWANLI + * @date 2025-04-19 + */ +@RestController +@RequestMapping("/qualityWechart") +public class QcCheckWechartController extends BaseController { + @Autowired + private QcCheckWechartService qcCheckWechartService; + //查询前一天包材、成品质检信息 + @GetMapping("/qualityCheckInfoByday") + public AjaxResult qualityCheckInfoByday() { + return AjaxResult.success(qcCheckWechartService.qualityCheckInfoByday()); + } +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckWechartMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckWechartMapper.java new file mode 100644 index 000000000..b6214e638 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckWechartMapper.java @@ -0,0 +1,10 @@ +package com.op.quality.mapper; + +import org.apache.ibatis.annotations.Mapper; + +import java.util.Map; + +@Mapper +public interface QcCheckWechartMapper { + Map qualityCheckInfoByday(); +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/QcCheckWechartService.java b/op-modules/op-quality/src/main/java/com/op/quality/service/QcCheckWechartService.java new file mode 100644 index 000000000..d5c011d11 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/QcCheckWechartService.java @@ -0,0 +1,8 @@ +package com.op.quality.service; + +import java.util.Map; + +public interface QcCheckWechartService { + + Map qualityCheckInfoByday(); +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckSampleTaskServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckSampleTaskServiceImpl.java index 98fc5e3ad..1c1919853 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckSampleTaskServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckSampleTaskServiceImpl.java @@ -75,12 +75,16 @@ public class QcCheckSampleTaskServiceImpl implements IQcCheckSampleTaskService { public AjaxResult createCheckSampleTask() { // 这是数据源的key DynamicDataSourceContextHolder.push("ds_1000"); - List list = qcCheckSampleTaskMapper.selectScTaskListByDay(); - if (!CollectionUtils.isEmpty(list)) { - for (QcCheckSampleTask item : list) { - item.setId(IdUtils.fastSimpleUUID()); + try { + List list = qcCheckSampleTaskMapper.selectScTaskListByDay(); + if (!CollectionUtils.isEmpty(list)) { + for (QcCheckSampleTask item : list) { + item.setId(IdUtils.fastSimpleUUID()); + } + qcCheckSampleTaskMapper.batchInsertQcCheckSampleTask(list); } - qcCheckSampleTaskMapper.batchInsertQcCheckSampleTask(list); + }finally { + DynamicDataSourceContextHolder.poll(); } return success(); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java index c53d9b098..f45b2ec76 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java @@ -1447,6 +1447,7 @@ public class QcCheckTaskIncomeServiceImpl implements mapdto.put("ruleName",detail.getRuleName()); mapdto.put("checkStandard",detail.getCheckStandard()); mapdto.put("actualValue",detail.getActualValue()); + mapdto.put("sampleQuality",detail.getSampleQuality()); if("Y".equals(detail.getStatus())){ mapdto.put("status","合格"); }else if("N".equals(detail.getStatus())){ diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckWechartServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckWechartServiceImpl.java new file mode 100644 index 000000000..95c56b7be --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckWechartServiceImpl.java @@ -0,0 +1,77 @@ +package com.op.quality.service.impl; + +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.common.core.utils.StringUtils; +import com.op.common.core.web.domain.AjaxResult; +import com.op.quality.mapper.QcCheckTaskIncomeMapper; +import com.op.quality.mapper.QcCheckWechartMapper; +import com.op.quality.service.QcCheckWechartService; +import com.op.system.api.RemoteOpenService; +import com.op.system.api.domain.SysNoticeGroup; +import com.op.system.api.domain.dto.WechartDTO; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Service +public class QcCheckWechartServiceImpl implements QcCheckWechartService { + + protected Logger logger = LoggerFactory.getLogger(getClass()); + @Autowired + private QcCheckWechartMapper qcCheckWechartMapper; + @Autowired + private QcCheckTaskIncomeMapper qcCheckTaskIncomeMapper; + + @Autowired + private RemoteOpenService remoteOpenService; + @Override + @DS("#header.poolName") + public Map qualityCheckInfoByday() { + // Map map=qcCheckWechartMapper.qualityCheckInfoByday(); + Map map = qcCheckWechartMapper.qualityCheckInfoByday(); + map.replaceAll((key, value) -> { + if (value instanceof Number) { + return String.valueOf(value); + } + return value; // 非数字类型保留原值 + }); + SysNoticeGroup noticeQo = new SysNoticeGroup(); + if(map != null){ + noticeQo.setNoticeId(25L); + List notices = qcCheckTaskIncomeMapper.getNoticesGroup(noticeQo); + System.out.println(notices); + sendWeChartMessage(noticeQo,map); + } + return map; + } + + private void sendWeChartMessage(SysNoticeGroup noticeQo,Map map){ + + List notices = qcCheckTaskIncomeMapper.getNoticesGroup(noticeQo); + if(!CollectionUtils.isEmpty(notices) && notices.size() > 0) { + List wecharts = new ArrayList<>(); + for (SysNoticeGroup noticedto : notices) { + WechartDTO wechart0 = new WechartDTO(); + wechart0.setUserId(noticedto.getWxId()); + String contentInfo = notices.get(0).getNoticeContent(); + String message=StringUtils.format(contentInfo,map); + wechart0.setText(message); + wecharts.add(wechart0); + } + // logger.info("任务编号为:"+ checkNoList + "的"+ message + ",企业微信二次提醒请求:" + JSONObject.toJSONString(wecharts)); + if (!CollectionUtils.isEmpty(wecharts)) { + new Thread(() -> { + AjaxResult result = remoteOpenService.sendWeChartMessage(wecharts); + logger.info("企业微信发送质检情况:" + JSONObject.toJSONString(result)); + }).start(); + } + } + } +} diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckWechartMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckWechartMapper.xml new file mode 100644 index 000000000..945914a08 --- /dev/null +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckWechartMapper.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java index 694a65468..45c6078b9 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java @@ -294,6 +294,8 @@ public class SapOrderServiceImpl implements SapOrderService { jCoParameterList.setValue("P_ANZMA", sapRFW.getAnzma()); //备注 jCoParameterList.setValue("P_TEXT", sapRFW.getRemark()); + //记账日期格式为YYYYMMDD + jCoParameterList.setValue("P_BUDAT", sapRFW.getBudat()); if (sapRFW.getLt_gs() == null) { return R.fail("生产订单报工工时为空"); } diff --git a/op-modules/op-system/push-system.bat b/op-modules/op-system/push-system.bat index 9f041629f..d238b2f91 100644 --- a/op-modules/op-system/push-system.bat +++ b/op-modules/op-system/push-system.bat @@ -26,8 +26,7 @@ if exist %df% ( del /f /s /q .\Dockerfile ) echo --------------------------------Dockerfile-------------------------------- -::echo FROM 192.168.202.36:30002/library/openjdk:8u131-jdk-alpine >> Dockerfile -echo FROM 192.168.202.36:30002/library/openjdk:8-sw66>> Dockerfile +echo FROM openjdk:8u131-jdk >> Dockerfile echo COPY %jarName% /application.jar >> Dockerfile echo RUN echo "Asia/Shanghai" ^> /etc/timezone >> Dockerfile echo CMD ["java", "-jar", "-Dspring.profiles.active=%profile%", "application.jar"] >> Dockerfile diff --git a/op-modules/op-wms/push-wms.bat b/op-modules/op-wms/push-wms.bat index 8e87e6d48..3b996fcd4 100644 --- a/op-modules/op-wms/push-wms.bat +++ b/op-modules/op-wms/push-wms.bat @@ -27,7 +27,7 @@ if exist %df% ( ) echo --------------------------------Dockerfile-------------------------------- ::echo FROM 192.168.202.36:30002/library/openjdk:8u131-jdk-alpine >> Dockerfile -echo FROM 192.168.202.36:30002/library/openjdk:8-sw66>> Dockerfile +echo FROM openjdk:8u131-jdk >> Dockerfile echo COPY %jarName% /application.jar >> Dockerfile echo RUN echo "Asia/Shanghai" ^> /etc/timezone >> Dockerfile echo CMD ["java", "-jar", "-Dspring.profiles.active=%profile%", "application.jar"] >> Dockerfile