From b2c0bd357cde6af5e40799b500a1fe40f271a422 Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Mon, 17 Nov 2025 09:09:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sgzb/material/config/PoiOutPage.java | 39 ++++ .../PurchaseCheckInfoController.java | 140 ++++++++++++ .../sgzb/material/domain/RepairPart.java | 8 + .../material/domain/RepairPartAndType.java | 112 ++++++++++ .../mapper/PurchaseCheckDetailsMapper.java | 3 + .../mapper/PurchaseCheckInfoMapper.java | 9 +- .../service/IPurchaseCheckInfoService.java | 18 ++ .../impl/PurchaseCheckInfoServiceImpl.java | 204 ++++++++++++++++++ .../material/PurchaseCheckDetailsMapper.xml | 28 +++ .../material/PurchaseCheckInfoMapper.xml | 29 +++ 10 files changed, 587 insertions(+), 3 deletions(-) create mode 100644 sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/RepairPartAndType.java diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/config/PoiOutPage.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/config/PoiOutPage.java index c4f48cb..df7174d 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/config/PoiOutPage.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/config/PoiOutPage.java @@ -517,6 +517,28 @@ public class PoiOutPage { } + public static void excelForcheckRepairModel(HSSFWorkbook workbook,HSSFSheet sheet,List> resultLease,List listLease) { + + sheet.setDefaultColumnWidth(15); // 设置列宽 + + // 创建样式 + HSSFCellStyle titleStyle = createTitleStyle(workbook); + HSSFCellStyle headerStyle = createHeaderStyle(workbook); + HSSFCellStyle contentStyle = createCellStyleCost(workbook); + + // 填充标题行 + int rowNum = 0; + + // 填充表头 + rowNum = createHeaderRowTwo(sheet, rowNum, listLease, headerStyle); + + // 填充数据行 + if (resultLease != null && !resultLease.isEmpty()) { + rowNum = createDataRowsRepairModel(sheet, rowNum, resultLease, contentStyle, listLease.size()); + } + + } + /** * 结算记录查询--导出全部明细 @@ -1306,6 +1328,23 @@ public class PoiOutPage { return rowNum; } + private static int createDataRowsRepairModel(HSSFSheet sheet, int rowNum, List> result, + HSSFCellStyle contentStyle, int nColumn) { + for (Map resultRow : result) { + HSSFRow row = sheet.createRow(rowNum++); + row.setHeightInPoints(15); + List rowData = map2List(resultRow); + + for (int j = 0; j < nColumn; j++) { + HSSFCell cell = row.createCell(j); + Object data = rowData.get(j); + cell.setCellStyle(contentStyle); + setCellData(cell, data, contentStyle); + } + } + return rowNum; + } + private static int createDataRowsMonth(HSSFSheet sheet, int rowNum, List> result, HSSFCellStyle contentStyle, int nColumn) { for (Map resultRow : result) { diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseCheckInfoController.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseCheckInfoController.java index 300eb1b..0379a95 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseCheckInfoController.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseCheckInfoController.java @@ -1,5 +1,6 @@ package com.bonus.sgzb.material.controller; +import java.io.IOException; import java.io.OutputStream; import java.math.BigDecimal; import java.math.RoundingMode; @@ -18,6 +19,8 @@ import com.bonus.sgzb.common.security.annotation.PreventRepeatSubmit; import com.bonus.sgzb.common.security.annotation.RequiresPermissions; import com.bonus.sgzb.material.config.PoiOutPage; import com.bonus.sgzb.material.domain.PurchaseInput; +import com.bonus.sgzb.material.domain.RepairPart; +import com.bonus.sgzb.material.domain.RepairPartAndType; import com.bonus.sgzb.material.service.IPurchaseCheckInfoService; import com.bonus.sgzb.material.domain.PurchaseCheckInfo; import com.bonus.sgzb.material.service.PurchaseCheckServiceCenterService; @@ -251,4 +254,141 @@ public class PurchaseCheckInfoController extends BaseController { { return purchaseCheckInfoService.importTbPeople(file); } + + /** + * 机具模板下载--all + */ + @ApiOperation(value = "维修导入模板下载") + @PostMapping("/downLoadRepairModel") + public void downLoadRepairModel(HttpServletResponse response, @RequestParam("params") String params) { + try { + + // 创建工作簿 + HSSFWorkbook workbook = new HSSFWorkbook(); + int sheetIndex = 1; + + // 创建工作表 + HSSFSheet sheet = workbook.createSheet("维修导入模板"); + //创建表头 + ArrayList list = new ArrayList(); + list.add("机具名称"); + list.add("规格型号"); + list.add("计量单位"); + list.add("维修配件名称"); + list.add("维修配件型号"); + list.add("使用数量"); + list.add("配件单价"); + //数据转换 + Map map = new LinkedHashMap(); + map.put("typeName",null ); + map.put("modelName",null ); + map.put("nuitName", null); + map.put("partName",null ); + map.put("partModelName",null ); + map.put("partNum", null); + map.put("partPrice", null); + List> maps = new ArrayList>(); + maps.add(map); + // 创建工作簿和工作表 + PoiOutPage.excelForcheckRepairModel(workbook, sheet,maps,list); + + + sheetIndex++; + HSSFSheet sheetTwo = workbook.createSheet("维修配件类型规格"); + //创建表头 + ArrayList listTwo = new ArrayList(); + listTwo.add("维修配件名称"); + listTwo.add("维修配件规格"); + listTwo.add("配件单价"); + + List listType = purchaseCheckInfoService.selectPartList(); + List type = Convert.toList(RepairPart.class, listType); + List> mapsType = new ArrayList>(); + //数据转换 + if (type!= null) { + int sizeLease = type.size(); + for (int i = 0; i < sizeLease; i++) { + RepairPart bean = type.get(i); + Map mapTwo = new LinkedHashMap(); + mapTwo.put("partName",bean.getPartName()); + mapTwo.put("partModelName",bean.getPartModelName() ); + mapTwo.put("partPrice", bean.getPartPrice()); + mapsType.add(mapTwo); + } + }else{ + map.put("partName",null ); + map.put("partModelName",null ); + map.put("partPrice", null); + mapsType.add(map); + } + // 创建工作簿和工作表 + PoiOutPage.excelForcheckEach(workbook, sheetTwo,mapsType,listTwo); + sheetIndex++; + + HSSFSheet sheetThree = workbook.createSheet("机具类型规格"); + //创建表头 + ArrayList listThree = new ArrayList(); + listThree.add("类型名称"); + listThree.add("规格型号"); + listThree.add("单位"); + + List listTypeThree = purchaseCheckInfoService.selectMaTypeList(); + List typeThree = Convert.toList(MaType.class, listTypeThree); + List> mapsTypeThree = new ArrayList>(); + //数据转换 + if (typeThree!= null) { + int sizeLease = typeThree.size(); + for (int i = 0; i < sizeLease; i++) { + MaType bean = typeThree.get(i); + Map mapThree = new LinkedHashMap(); + mapThree.put("typeName",bean.getTypeName()); + mapThree.put("modelName",bean.getModelName() ); + mapThree.put("nuitName", bean.getUnitName()); + mapsTypeThree.add(mapThree); + } + }else{ + map.put("typeName",null ); + map.put("modelName",null ); + map.put("nuitName", null); + mapsTypeThree.add(map); + } + // 创建工作簿和工作表 + PoiOutPage.excelForcheckEach(workbook, sheetThree,mapsTypeThree,listThree); + sheetIndex++; + + OutputStream out = null; + response.setContentType("application/vnd.ms-excel;charset=UTF-8"); + response.addHeader("Content-Disposition", + "attachment;filename=" + URLEncoder.encode("模板下载", "UTF-8") + ".xls"); + response.setHeader("Pragma", "No-cache"); + out = response.getOutputStream(); + workbook.write(out); + out.flush(); + out.close(); + + } catch (Exception e) { + logger.error("模板下载失败", e); + } + } + + /** + * 维修信息导入 + * @param file + * @return + */ + @ApiOperation(value = "维修信息导入") + @PostMapping("/importRepairData") + public AjaxResult importRepairData(MultipartFile file) throws IOException { + return purchaseCheckInfoService.importRepairData(file); + } + + + /** + * 新增维修导入信息 + */ + @ApiOperation("新增维修导入信息") + @PostMapping("/addRepairInputInfo") + public AjaxResult addRepairInputInfo(@RequestBody List infos) { + return toAjax(purchaseCheckInfoService.insertRepairInfo(infos)); + } } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/RepairPart.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/RepairPart.java index 0efc4ca..3715d57 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/RepairPart.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/RepairPart.java @@ -38,6 +38,12 @@ public class RepairPart { */ @ApiModelProperty(value = "配件名称") private String partName; + + /** + * 配件规格 + */ + @ApiModelProperty(value = "配件规格") + private String partModelName; /** * 返厂id */ @@ -97,4 +103,6 @@ public class RepairPart { private Long repairer; @ApiModelProperty(value = "维修数量") private int repairNum; + + private Long parentId; } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/RepairPartAndType.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/RepairPartAndType.java new file mode 100644 index 0000000..b87b292 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/RepairPartAndType.java @@ -0,0 +1,112 @@ +package com.bonus.sgzb.material.domain; + +import com.bonus.sgzb.common.core.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author c liu + * @date 2023/12/11 + */ +@Data +@ApiModel(value="维修配件") +public class RepairPartAndType { + /** + * 任务ID + */ + @ApiModelProperty(value = "任务ID") + private String taskId; + /** + * 机具ID + */ + @ApiModelProperty(value = "机具ID") + private String maId; + /** + * 规格ID + */ + @ApiModelProperty(value = "规格ID") + private Integer typeId; + /** + * 配件ID + */ + @ApiModelProperty(value = "配件ID") + private Long partId; + /** + * 配件名称 + */ + @ApiModelProperty(value = "配件名称") + @Excel(name = "维修配件名称") + private String partName; + + /** + * 配件规格 + */ + @ApiModelProperty(value = "配件规格") + @Excel(name = "维修配件型号") + private String partModelName; + + /** + * 配件数量 + */ + @ApiModelProperty(value = "配件数量") + @Excel(name = "使用数量") + private int partNum; + /** + * 配件费用 + */ + @ApiModelProperty(value = "配件费用") + private BigDecimal partAllCosts; + /** + * 配件单价 + */ + @ApiModelProperty(value = "配件单价") + @Excel(name = "配件单价") + private BigDecimal partPrice; + /** + * 类型(0不收费,1收费) + */ + @ApiModelProperty(value = "类型(0不收费,1收费)") + private String partType; + /** + * 创建者 + */ + @ApiModelProperty(value = "创建者") + private String createBy; + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private String createTime; + /** + * 更新者 + */ + @ApiModelProperty(value = "更新者") + private String updateBy; + /** + * 更新时间 + */ + @ApiModelProperty(value = "更新时间") + private String updateTime; + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + + private Long parentId; + + @Excel(name = "机具名称") + private String typeName; + + @Excel(name = "规格型号") + private String modelName; + + @Excel(name = "计量单位") + private String unitName; + + private Integer agreementId; +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseCheckDetailsMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseCheckDetailsMapper.java index 9467217..46e0801 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseCheckDetailsMapper.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseCheckDetailsMapper.java @@ -1,6 +1,7 @@ package com.bonus.sgzb.material.mapper; import com.bonus.sgzb.material.domain.PurchaseCheckDetails; +import com.bonus.sgzb.material.domain.RepairPartAndType; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -153,4 +154,6 @@ public interface PurchaseCheckDetailsMapper { int updateByTaskId(@Param("taskId") Long taskId,@Param("typeId") Long typeId); int uploadPic(PurchaseCheckDetails purchaseCheckDetails); + + int insertRepairDetailsList(@Param("repairPartAndTypeList") List repairPartAndTypeList); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseCheckInfoMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseCheckInfoMapper.java index 2f119bf..b2822aa 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseCheckInfoMapper.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseCheckInfoMapper.java @@ -1,10 +1,8 @@ package com.bonus.sgzb.material.mapper; import com.bonus.sgzb.base.api.domain.MaType; -import com.bonus.sgzb.material.domain.BmNoticeInfo; +import com.bonus.sgzb.material.domain.*; import com.bonus.sgzb.base.api.domain.MachinePart; -import com.bonus.sgzb.material.domain.PurchaseCheckInfo; -import com.bonus.sgzb.material.domain.PurchaseInput; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -133,4 +131,9 @@ public interface PurchaseCheckInfoMapper { List selectMaTypeList(); List selectTypeDetail(MaType type); + + List selectPartList(); + + + List selectPartDetail(RepairPart type); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/IPurchaseCheckInfoService.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/IPurchaseCheckInfoService.java index c496c86..8432ec5 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/IPurchaseCheckInfoService.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/IPurchaseCheckInfoService.java @@ -5,9 +5,12 @@ import com.bonus.sgzb.base.api.domain.MachinePart; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.material.domain.PurchaseCheckInfo; import com.bonus.sgzb.material.domain.PurchaseInput; +import com.bonus.sgzb.material.domain.RepairPart; +import com.bonus.sgzb.material.domain.RepairPartAndType; import com.bonus.sgzb.material.vo.NoticeInfoVO; import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; import java.util.List; /** @@ -130,4 +133,19 @@ public interface IPurchaseCheckInfoService * @return */ AjaxResult importTbPeople(MultipartFile file); + + /** + * 查询维修配件类型规格 + * @return + */ + List selectPartList(); + + /** + * 维修信息导入 + * @param file + * @return + */ + AjaxResult importRepairData(MultipartFile file) throws IOException; + + public int insertRepairInfo(List infos); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseCheckInfoServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseCheckInfoServiceImpl.java index 331001f..13d0fcd 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseCheckInfoServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseCheckInfoServiceImpl.java @@ -500,4 +500,208 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { String.format("第 %d 行,第 %d 列数据为空,请检查后重新导入", rowIndex + 1, colIndex + 1)); } } + + @Override + public List selectPartList() { + List listType = purchaseCheckInfoMapper.selectPartList(); + return listType; + } + + /** + * 维修信息导入 + * @param file + * @return + */ + @Override + public AjaxResult importRepairData(MultipartFile file) throws IOException { + String fileName = file.getOriginalFilename(); + if (fileName != null) { + String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1); + if (!MaterialConstants.XLSX.equalsIgnoreCase(fileExtension)) { + // 文件后缀名不符合要求 + return AjaxResult.error("导入失败:文件后缀名不符合要求,必须为xlsx结尾"); + } + } + InputStream inputStream = null; + try { + inputStream = file.getInputStream(); + Workbook workbook = new XSSFWorkbook(inputStream); // 处理.xlsx文件 + + Sheet sheet = workbook.getSheetAt(0); + // 得到Excel的行数 + int totalRows = sheet.getPhysicalNumberOfRows(); + // 检查是否有行数 + if (totalRows <= 1) { + throw new IllegalArgumentException("导入失败:Excel文件中没有数据,请检查后重新导入"); + } + // 读取第一行表头 + Row headerRow = sheet.getRow(0); + if (headerRow == null) { + throw new IllegalArgumentException("导入失败:文件中没有表头"); + } + // 获取表头的列数 + int totalCells = headerRow.getPhysicalNumberOfCells(); + // 预期的表头列数为11列,可以根据实际需求修改这个条件 + if (totalCells != 7) { + throw new IllegalArgumentException("导入失败:表头列数与预期不符,请检查导入模板"); + } + // 读取表头内容并验证每一列 + extractedTextRepair(headerRow, totalCells); + //读取Excel表格数据,做非空及格式判断 + extractedCellRepair(sheet, totalRows, totalCells); + ExcelUtil util = new ExcelUtil<>(RepairPartAndType.class); + List maDevList = util.importExcel(file.getInputStream()); + List templateVos = new ArrayList<>(); + // 判断装备类目是否为空,查询装备id及价格 + if (!CollectionUtils.isEmpty(maDevList)) { + int i = 1; + for (RepairPartAndType devTemplateVo : maDevList) { + i++; + if (StringUtils.isNotBlank(devTemplateVo.getTypeName()) && StringUtils.isNotBlank(devTemplateVo.getModelName()) && StringUtils.isNotBlank(devTemplateVo.getUnitName())) { + // 根据物资类型详情 + MaType type = new MaType(); + type.setTypeName(devTemplateVo.getTypeName()); + type.setModelName(devTemplateVo.getModelName()); + type.setUnitName(devTemplateVo.getUnitName()); + List list = purchaseCheckInfoMapper.selectTypeDetail(type); + if (!CollectionUtils.isEmpty(list)) { + if (list.size() != 1) { + return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "第" + i + "行数据有误,请检查"); + } + MaType devType = list.get(0); + devTemplateVo.setTypeId(Math.toIntExact(devType.getTypeId())); + } else { + return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "第" + i + "行数据有误,请检查"); + } + + // 根据维修配件名称查询维修配件id + RepairPart part = new RepairPart(); + part.setPartName(devTemplateVo.getPartName()); + part.setPartModelName(devTemplateVo.getPartModelName()); + List listPart = purchaseCheckInfoMapper.selectPartDetail(part); + if (!CollectionUtils.isEmpty(listPart)) { + if (listPart.size() != 1) { + return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "第" + i + "行数据有误,请检查"); + } + RepairPart devPart = listPart.get(0); + devTemplateVo.setPartId(devPart.getPartId()); + } else { + return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "第" + i + "行数据有误,请检查"); + } + templateVos.add(devTemplateVo); + + } + } + } + inputStream.close(); + return AjaxResult.success(templateVos); + } catch (IOException e) { + e.printStackTrace(); + } finally { + inputStream.close(); + } + return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg()); + } + + /** + * 读取Excel表格数据,做非空及格式判断 + * @param headerRow + * @param totalCells + */ + private void extractedTextRepair(Row headerRow, int totalCells) { + for (int cellNum = 0; cellNum < totalCells; cellNum++) { + Cell cell = headerRow.getCell(cellNum); + // 获取单元格内容并去除首尾空格 + String headerValue = cell.getStringCellValue().trim(); + // 根据列索引进行验证 + switch (cellNum) { + case 0: + if (!"机具名称".equals(headerValue)) { + throw new IllegalArgumentException("第 " + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板"); + } + break; + case 1: + if (!"规格型号".equals(headerValue)) { + throw new IllegalArgumentException("第 " + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板"); + } + break; + case 2: + if (!"计量单位".equals(headerValue)) { + throw new IllegalArgumentException("第 " + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板"); + } + break; + case 3: + if (!"维修配件名称".equals(headerValue)) { + throw new IllegalArgumentException("第 " + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板"); + } + break; + case 4: + if (!"维修配件型号".equals(headerValue)) { + throw new IllegalArgumentException("第 " + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板"); + } + break; + case 5: + if (!"使用数量".equals(headerValue)) { + throw new IllegalArgumentException("第 " + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板"); + } + break; + case 6: + if (!"配件单价".equals(headerValue)) { + throw new IllegalArgumentException("第 " + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板"); + } + break; + + default: + break; + } + } + } + + /** + * 读取Excel表格数据,做非空判断 + * @param sheet + * @param totalRows + * @param totalCells + */ + private void extractedCellRepair(Sheet sheet, int totalRows, int totalCells) { + //读取Excel表格数据,做非空判断 + // 循环Excel行数 + DataFormatter dataFormatter = new DataFormatter(); + for (int r = 1; r < totalRows; r++) { + Row row = sheet.getRow(r); + // 循环Excel列数 + for (int c = 0; c < totalCells; c++) { + Cell cell = row.getCell(c); + String cellValue = ""; + if (cell != null && cell.getCellType() == CellType.STRING) { + cellValue = cell.getStringCellValue(); + } + if (c == 5 || c == 6) { + cellValue = dataFormatter.formatCellValue(row.getCell(c)); + } + checkBlank(cellValue, r, c); + + } + } + } + + /** + * 新增维修导入信息 + * + * @param details 新增维修导入信息 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int insertRepairInfo(List details) { + long userId = SecurityUtils.getLoginUser().getUserid(); + if (details != null) { + for (RepairPartAndType repairPartAndType : details) { + repairPartAndType.setCreateBy(String.valueOf(userId)); + } + return purchaseCheckDetailsMapper.insertRepairDetailsList(details); + }else { + throw new IllegalArgumentException("维修导入信息不能为空"); + } + } } diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckDetailsMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckDetailsMapper.xml index 1fcac7a..461dc42 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckDetailsMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckDetailsMapper.xml @@ -280,4 +280,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + + + + insert into repair_input_part + + agreementId, + type_id, + part_name, + part_model_name, + part_num, + part_price, + part_cost, + create_by, + create_time, + + + #{checkDetails.agreementId}, + #{checkDetails.typeId}, + #{checkDetails.partName}, + #{checkDetails.partModelName}, + #{checkDetails.partNum}, + #{checkDetails.partPrice}, + #{checkDetails.partAllCosts}, + #{checkDetails.createBy}, + now(), + + + diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckInfoMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckInfoMapper.xml index 09fbc3c..dadad00 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckInfoMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckInfoMapper.xml @@ -376,4 +376,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and mt1.status = '0' and mt1.del_flag = '0' + + + \ No newline at end of file