From 520ca5a284314c2b8236db0de0f922212a6151b0 Mon Sep 17 00:00:00 2001 From: Yangwl <1726150332@qq.com> Date: Fri, 4 Jul 2025 16:41:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=A8=A1=E5=9D=97=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=95=85=E9=9A=9C=E6=8F=8F=E8=BF=B0=E5=92=8C=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=B1=BB=E5=9E=8B=E7=BB=91=E5=AE=9A=EF=BC=8C=E8=B4=A8?= =?UTF-8?q?=E9=87=8F=E6=A8=A1=E5=9D=97=E6=9D=A5=E6=96=99=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=B0=83=E6=95=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/utils/poi/ExcelReportMapUtil.java | 744 +++++++++--------- .../com/op/device/domain/EquTeamUser.java | 25 + .../service/impl/DevicePDAServiceImpl.java | 1 + .../service/impl/DeviceTaskServiceImpl.java | 1 + .../service/impl/EquTeamServiceImpl.java | 4 +- .../mapper/device/EquRepairOrderMapper.xml | 2 +- .../resources/mapper/device/EquTeamMapper.xml | 14 +- .../mapper/plan/ProOrderWorkorderMapper.xml | 10 +- .../QcCheckTaskIncomeController.java | 2 +- .../impl/QcCheckTaskIncomeServiceImpl.java | 1 + 10 files changed, 420 insertions(+), 384 deletions(-) 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-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/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/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/EquRepairOrderMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml index 32d436ecb..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 @@ -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'