From e7c2dfaa3a7d42c30c421f9d7311835859acf8c0 Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期二, 08 七月 2025 09:31:58 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardDetailServiceImpl.java | 19 db/template/设备点检标准导入模板.xlsx | 0 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationStandardService.java | 53 + lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamTechnicalStatusEvaluationStandardMapper.java | 24 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationStandardDetailController.java | 129 +++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamTechnicalStatusEvaluationStandard.java | 78 ++ lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/request/ImportException.java | 7 db/430设备管理数据库设计.pdma.json | 22 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java | 4 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java | 226 ++++++ lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/TechnicalStatusEvaluationStandardEnum.java | 8 lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EamMaintenanceStandardDetailCategory.java | 8 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamTechnicalStatusEvaluationStandardDetailMapper.xml | 5 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamTechnicalStatusEvaluationStandardDetailMapper.java | 17 db/template/生产设备二级保养规范.docx | 0 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamMaintenanceStandardController.java | 490 ++++---------- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationStandardController.java | 176 +++++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamMaintenanceStandardServiceImpl.java | 521 +++++++++++++++ db/template/生产设备三级保养规范.docx | 0 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamTechnicalStatusEvaluationStandardRequest.java | 41 + db/template/设备台账导入模板.xls | 0 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationStandardDetailService.java | 14 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamMaintenanceStandardService.java | 4 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamTechnicalStatusEvaluationStandardDetail.java | 73 ++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamTechnicalStatusEvaluationStandardMapper.xml | 11 25 files changed, 1,567 insertions(+), 363 deletions(-) diff --git "a/db/430\350\256\276\345\244\207\347\256\241\347\220\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" "b/db/430\350\256\276\345\244\207\347\256\241\347\220\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" index 010a965..b34a96b 100644 --- "a/db/430\350\256\276\345\244\207\347\256\241\347\220\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" +++ "b/db/430\350\256\276\345\244\207\347\256\241\347\220\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" @@ -4,7 +4,7 @@ "avatar": "", "version": "4.9.2", "createdTime": "2025-3-10 16:38:19", - "updatedTime": "2025-7-7 15:35:51", + "updatedTime": "2025-7-7 21:00:24", "dbConns": [], "profile": { "default": { @@ -632,7 +632,7 @@ "#DDE5FF" ], "DDLToggleCase": "L", - "menuWidth": "472px" + "menuWidth": "371px" }, "entities": [ { @@ -23721,6 +23721,24 @@ "id": "2C88A464-AC97-4512-94EE-CCD08ED27A64" }, { + "defKey": "standard_version", + "defName": "鐗堟湰", + "comment": "V1,V2+", + "type": "", + "len": "", + "scale": "", + "primaryKey": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "", + "hideInGraph": false, + "refDict": "", + "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", + "extProps": {}, + "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6", + "id": "1ACB9237-2E42-44F0-AC09-BBB51D55A83D" + }, + { "defKey": "remark", "defName": "澶囨敞", "comment": "", diff --git "a/db/template/\347\224\237\344\272\247\350\256\276\345\244\207\344\270\211\347\272\247\344\277\235\345\205\273\350\247\204\350\214\203.docx" "b/db/template/\347\224\237\344\272\247\350\256\276\345\244\207\344\270\211\347\272\247\344\277\235\345\205\273\350\247\204\350\214\203.docx" new file mode 100644 index 0000000..ada5153 --- /dev/null +++ "b/db/template/\347\224\237\344\272\247\350\256\276\345\244\207\344\270\211\347\272\247\344\277\235\345\205\273\350\247\204\350\214\203.docx" Binary files differ diff --git "a/db/template/\347\224\237\344\272\247\350\256\276\345\244\207\344\272\214\347\272\247\344\277\235\345\205\273\350\247\204\350\214\203.docx" "b/db/template/\347\224\237\344\272\247\350\256\276\345\244\207\344\272\214\347\272\247\344\277\235\345\205\273\350\247\204\350\214\203.docx" new file mode 100644 index 0000000..615547c --- /dev/null +++ "b/db/template/\347\224\237\344\272\247\350\256\276\345\244\207\344\272\214\347\272\247\344\277\235\345\205\273\350\247\204\350\214\203.docx" Binary files differ diff --git "a/db/template/\350\256\276\345\244\207\345\217\260\350\264\246\345\257\274\345\205\245\346\250\241\346\235\277.xls" "b/db/template/\350\256\276\345\244\207\345\217\260\350\264\246\345\257\274\345\205\245\346\250\241\346\235\277.xls" new file mode 100644 index 0000000..723c430 --- /dev/null +++ "b/db/template/\350\256\276\345\244\207\345\217\260\350\264\246\345\257\274\345\205\245\346\250\241\346\235\277.xls" Binary files differ diff --git "a/db/template/\350\256\276\345\244\207\347\202\271\346\243\200\346\240\207\345\207\206\345\257\274\345\205\245\346\250\241\346\235\277.xlsx" "b/db/template/\350\256\276\345\244\207\347\202\271\346\243\200\346\240\207\345\207\206\345\257\274\345\205\245\346\250\241\346\235\277.xlsx" new file mode 100644 index 0000000..165d444 --- /dev/null +++ "b/db/template/\350\256\276\345\244\207\347\202\271\346\243\200\346\240\207\345\207\206\345\257\274\345\205\245\346\250\241\346\235\277.xlsx" Binary files differ diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java index d615687..a45204b 100644 --- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java @@ -26,7 +26,9 @@ //璁惧璋冩嫧缂栫爜瑙勫垯 String TRANSFER_CODE_RULE = "EquipmentTransferCodeRule"; //璁惧璋冩嫧缂栫爜瑙勫垯 - String SCRAP_CODE_RULE = "EquipmentScrapCodeRule"; + String SCRAP_CODE_RULE = "EquipmentScrapCodeRule"; + //鎶�鏈姸鎬侀壌瀹氳鑼冪紪鐮佽鍒� + String TECHNICAL_STATUS_EVALUATION_STANDARD_CODE_RULE = "TechnicalStatusStandardCodeRule"; /** * 澶囦欢璇疯喘鍗曠姸鎬� 1:宸插垱寤� 2:宸叉彁浜� 3:宸查�氳繃 4:宸查┏鍥� 5:宸插畬鎴� */ diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EamMaintenanceStandardDetailCategory.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EamMaintenanceStandardDetailCategory.java new file mode 100644 index 0000000..8d58bff --- /dev/null +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EamMaintenanceStandardDetailCategory.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.eam.constant; + +public enum EamMaintenanceStandardDetailCategory { + DAY_INSPECTION, //鏃ョ偣妫� + WEEK_INSPECTION, //鍛ㄧ偣妫� + OPERATOR_MAINTENANCE, //鎿嶄綔宸� + REPAIRER_MAINTENANCE //缁翠慨宸� +} diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/TechnicalStatusEvaluationStandardEnum.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/TechnicalStatusEvaluationStandardEnum.java new file mode 100644 index 0000000..be0c917 --- /dev/null +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/TechnicalStatusEvaluationStandardEnum.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.eam.constant; + +public enum TechnicalStatusEvaluationStandardEnum { + WAIT_SUBMIT, //寰呮彁浜� + ENABLE, //鍚敤 + DISABLE, //绂佺敤 + ; +} diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/request/ImportException.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/request/ImportException.java new file mode 100644 index 0000000..a8aa74b --- /dev/null +++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/request/ImportException.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.eam.request; + +public class ImportException extends RuntimeException { + public ImportException(String message) { + super(message); + } +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamMaintenanceStandardController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamMaintenanceStandardController.java index e8d2bc8..754130c 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamMaintenanceStandardController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamMaintenanceStandardController.java @@ -6,31 +6,22 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.apache.poi.ss.usermodel.*; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; + import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.constant.CommonConstant; -import org.jeecg.common.exception.JeecgBootException; + import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.modules.eam.constant.BusinessCodeConst; -import org.jeecg.modules.eam.constant.MaintenanceCategoryEnum; + import org.jeecg.modules.eam.constant.MaintenanceStandardStatusEnum; -import org.jeecg.modules.eam.dto.MaintenanceStandardImport; -import org.jeecg.modules.eam.dto.SecondMaintenanceStandardImport; -import org.jeecg.modules.eam.dto.ThirdMaintenanceStandardImport; -import org.jeecg.modules.eam.dto.WeekMaintenanceStandardImport; -import org.jeecg.modules.eam.entity.EamEquipment; import org.jeecg.modules.eam.entity.EamMaintenanceStandard; -import org.jeecg.modules.eam.entity.EamMaintenanceStandardDetail; + import org.jeecg.modules.eam.request.EamMaintenanceStandardRequest; import org.jeecg.modules.eam.service.IEamEquipmentService; import org.jeecg.modules.eam.service.IEamMaintenanceStandardService; import org.jeecg.modules.eam.vo.EamMaintenanceStandardVo; import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; -import org.jeecgframework.poi.excel.ExcelImportUtil; -import org.jeecgframework.poi.excel.entity.ImportParams; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -38,10 +29,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; import java.util.*; -import java.util.stream.Collectors; /** * @Description: 淇濆吇鏍囧噯 @@ -63,23 +51,25 @@ /** * 娴佺▼鍚姩,淇濆瓨瀵瑰簲鐨勬暟鎹� + * * @param id * @return */ @ApiOperation(value = "淇濆吇鏍囧噯-娴佺▼鍚姩淇濆瓨瀵瑰簲鐨勬暟鎹�", notes = "淇濆吇鏍囧噯-娴佺▼鍚姩淇濆瓨瀵瑰簲鐨勬暟鎹�") @GetMapping(value = "/saveEamMaintenanceStandardProcess") - public Result<?> saveEamMaintenanceStandardProcess(String id){ + public Result<?> saveEamMaintenanceStandardProcess(String id) { return eamMaintenanceStandardService.saveEamMaintenanceStandardProcess(id); } /** * 娴佺▼瀹℃牳 + * * @param eamMaintenanceStandardVo * @return */ @ApiOperation(value = "淇濆吇鏍囧噯-娴佺▼瀹℃牳", notes = "淇濆吇鏍囧噯-娴佺▼瀹℃牳") @PostMapping(value = "/audit") - public Result<?> auditEamMaintenanceStandard(@RequestBody EamMaintenanceStandardVo eamMaintenanceStandardVo){ + public Result<?> auditEamMaintenanceStandard(@RequestBody EamMaintenanceStandardVo eamMaintenanceStandardVo) { return eamMaintenanceStandardService.auditEamMaintenanceStandard(eamMaintenanceStandardVo); } @@ -179,7 +169,8 @@ /** * 鏌ヨ鏍囧噯鍒楄〃-鍓嶇灞曠ず璇ョ敤鎴锋嫢鏈夌殑鏍囧噯 - * @param keyword 璁惧缂栧彿 + * + * @param keyword 璁惧缂栧彿 * @param maintenanceCategory 淇濆吇绫诲瀷 * @return */ @@ -243,7 +234,8 @@ List<String> list = Arrays.asList(ids.split(",")); list.forEach(id -> { EamMaintenanceStandard entity = eamMaintenanceStandardService.getById(id); - if (entity != null) { + if (entity != null&&entity.getStandardStatus().equals(MaintenanceStandardStatusEnum.WAIT_SUBMIT.name())) { + //鍙垹闄ょ姸鎬佷负寰呮彁浜ょ殑 entity.setDelFlag(CommonConstant.DEL_FLAG_1); eamMaintenanceStandardService.updateById(entity); } @@ -275,358 +267,150 @@ return super.exportXls(request, eamMaintenanceStandard, EamMaintenanceStandard.class, "淇濆吇鏍囧噯"); } - @PostMapping("/import") - public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { - MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; - Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); - for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { - // 鑾峰彇涓婁紶鏂囦欢瀵硅薄 - MultipartFile file = entity.getValue(); - eamMaintenanceStandardService.importPointInspectionExcel(file); - } - return Result.ok("瀵煎叆鎴愬姛"); - } - /** - * 閫氳繃excel瀵煎叆鏁版嵁 - * - * @param request - * @param response - * @return - */ - @RequestMapping(value = "/inspectionImportExcel", method = RequestMethod.POST) - public Result<?> inspectionImportExcel(HttpServletRequest request, HttpServletResponse response) { - MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; - Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); - for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { - // 鑾峰彇涓婁紶鏂囦欢瀵硅薄 - MultipartFile file = entity.getValue(); - ImportParams params = new ImportParams(); - params.setTitleRows(2); - params.setHeadRows(1); - params.setSheetNum(1); - params.setNeedSave(true); - EamMaintenanceStandardRequest standardRequest = new EamMaintenanceStandardRequest(); - try { - //璇诲彇璁惧缂栧彿锛屽浘鐗囩瓑 - readExcel(file, standardRequest); - EamEquipment equipment = eamEquipmentService.selectByEquipmentCode(standardRequest.getEquipmentCode()); - if(equipment == null) { - log.error("璁惧涓嶅瓨鍦細{}", standardRequest.getEquipmentCode()); - continue; - } - standardRequest.setStandardName(standardRequest.getEquipmentName() + "鐐规鏍囧噯"); - standardRequest.setMaintenanceCategory(MaintenanceCategoryEnum.POINT_INSPECTION.name()); - standardRequest.setEquipmentId(equipment.getId()); - //璇诲彇淇濆吇鏄庣粏鍐呭 - List<MaintenanceStandardImport> list = ExcelImportUtil.importExcel(file.getInputStream(), MaintenanceStandardImport.class, params); - //鏄庣粏椤� - List<EamMaintenanceStandardDetail> tableList = list.stream().map(EamMaintenanceStandardDetail::new).collect(Collectors.toList()); - standardRequest.setTableDetailList(tableList); - String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.MAINTENANCE_STANDARD_CODE_RULE); - standardRequest.setStandardCode(codeSeq); - boolean b = eamMaintenanceStandardService.addMaintenanceStandard(standardRequest); - if (!b) { - log.error("淇濆瓨澶辫触锛� {}", standardRequest.getEquipmentCode()); - } - } catch (Exception e) { - //update-begin-author:taoyan date:20211124 for: 瀵煎叆鏁版嵁閲嶅澧炲姞鎻愮ず - String msg = e.getMessage(); - log.error("鏂囦欢 {} 澶勭悊寮傚父锛� {}", file.getOriginalFilename(), msg, e); - //update-end-author:taoyan date:20211124 for: 瀵煎叆鏁版嵁閲嶅澧炲姞鎻愮ず - } finally { - try { - file.getInputStream().close(); - } catch (IOException e) { - log.error(e.getMessage(), e); - } - } - } - return Result.ok("鏂囦欢瀵煎叆瀹屾垚锛�"); - } - - /** - * 閫氳繃excel瀵煎叆鏁版嵁 - * - * @param request - * @param response - * @return - */ - @RequestMapping(value = "/weekMaintenanceImportExcel", method = RequestMethod.POST) - public Result<?> weekMaintenanceImportExcel(HttpServletRequest request, HttpServletResponse response) { - MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; - Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); - for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { - // 鑾峰彇涓婁紶鏂囦欢瀵硅薄 - MultipartFile file = entity.getValue(); - ImportParams params = new ImportParams(); - params.setTitleRows(2); - params.setHeadRows(1); - params.setSheetNum(1); - params.setNeedSave(true); - EamMaintenanceStandardRequest standardRequest = new EamMaintenanceStandardRequest(); - try { - //璇诲彇璁惧缂栧彿锛屽浘鐗囩瓑 - readWeekExcel(file, standardRequest); - EamEquipment equipment = eamEquipmentService.selectByEquipmentCode(standardRequest.getEquipmentCode()); - if(equipment == null) { - log.error("璁惧涓嶅瓨鍦細{}", standardRequest.getEquipmentCode()); - continue; - } - standardRequest.setStandardName(standardRequest.getEquipmentName() + "鍛ㄤ繚鏍囧噯"); - standardRequest.setMaintenanceCategory(MaintenanceCategoryEnum.WEEK_MAINTENANCE.name()); - standardRequest.setEquipmentId(equipment.getId()); - //璇诲彇淇濆吇鏄庣粏鍐呭 - List<WeekMaintenanceStandardImport> list = ExcelImportUtil.importExcel(file.getInputStream(), WeekMaintenanceStandardImport.class, params); - //鏄庣粏椤� - List<EamMaintenanceStandardDetail> tableList = list.stream().map(EamMaintenanceStandardDetail::new).collect(Collectors.toList()); - standardRequest.setTableDetailList(tableList); - String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.MAINTENANCE_STANDARD_CODE_RULE); - standardRequest.setStandardCode(codeSeq); - boolean b = eamMaintenanceStandardService.addMaintenanceStandard(standardRequest); - if (!b) { - log.error("淇濆瓨澶辫触锛� {}", standardRequest.getEquipmentCode()); - } - } catch (Exception e) { - //update-begin-author:taoyan date:20211124 for: 瀵煎叆鏁版嵁閲嶅澧炲姞鎻愮ず - String msg = e.getMessage(); - log.error("鏂囦欢 {} 澶勭悊寮傚父锛� {}", file.getOriginalFilename(), msg, e); - //update-end-author:taoyan date:20211124 for: 瀵煎叆鏁版嵁閲嶅澧炲姞鎻愮ず - } finally { - try { - file.getInputStream().close(); - } catch (IOException e) { - log.error(e.getMessage(), e); - } - } - } - return Result.ok("鏂囦欢瀵煎叆瀹屾垚锛�"); - } - - /** - * 閫氳繃excel瀵煎叆鏁版嵁 - * - * @param request - * @param response - * @return - */ - @RequestMapping(value = "/secondMaintenanceImportExcel", method = RequestMethod.POST) - public Result<?> secondMaintenanceImportExcel(HttpServletRequest request, HttpServletResponse response) { - MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; - Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); - for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { - // 鑾峰彇涓婁紶鏂囦欢瀵硅薄 - MultipartFile file = entity.getValue(); - ImportParams params = new ImportParams(); - params.setTitleRows(2); - params.setHeadRows(1); - params.setSheetNum(1); - params.setNeedSave(true); - EamMaintenanceStandardRequest standardRequest = new EamMaintenanceStandardRequest(); - try { - //璇诲彇璁惧缂栧彿锛屽浘鐗囩瓑 - readWeekExcel(file, standardRequest); - EamEquipment equipment = eamEquipmentService.selectByEquipmentCode(standardRequest.getEquipmentCode()); - if(equipment == null) { - log.error("璁惧涓嶅瓨鍦細{}", standardRequest.getEquipmentCode()); - continue; - } - standardRequest.setStandardName(standardRequest.getEquipmentName() + "浜屼繚鏍囧噯"); - standardRequest.setMaintenanceCategory(MaintenanceCategoryEnum.SECOND_MAINTENANCE.name()); - standardRequest.setEquipmentId(equipment.getId()); - //璇诲彇淇濆吇鏄庣粏鍐呭 - List<SecondMaintenanceStandardImport> list = ExcelImportUtil.importExcel(file.getInputStream(), SecondMaintenanceStandardImport.class, params); - //鏄庣粏椤� - List<EamMaintenanceStandardDetail> tableList = list.stream().map(EamMaintenanceStandardDetail::new).collect(Collectors.toList()); - standardRequest.setTableDetailList(tableList); - String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.MAINTENANCE_STANDARD_CODE_RULE); - standardRequest.setStandardCode(codeSeq); - boolean b = eamMaintenanceStandardService.addMaintenanceStandard(standardRequest); - if (!b) { - log.error("淇濆瓨澶辫触锛� {}", standardRequest.getEquipmentCode()); - } - } catch (Exception e) { - //update-begin-author:taoyan date:20211124 for: 瀵煎叆鏁版嵁閲嶅澧炲姞鎻愮ず - String msg = e.getMessage(); - log.error("鏂囦欢 {} 澶勭悊寮傚父锛� {}", file.getOriginalFilename(), msg, e); - //update-end-author:taoyan date:20211124 for: 瀵煎叆鏁版嵁閲嶅澧炲姞鎻愮ず - } finally { - try { - file.getInputStream().close(); - } catch (IOException e) { - log.error(e.getMessage(), e); - } - } - } - return Result.ok("鏂囦欢瀵煎叆瀹屾垚锛�"); - } - - /** - * 閫氳繃excel瀵煎叆鏁版嵁 - * - * @param request - * @param response - * @return - */ - @RequestMapping(value = "/thirdMaintenanceImportExcel", method = RequestMethod.POST) - public Result<?> thirdMaintenanceImportExcel(HttpServletRequest request, HttpServletResponse response) { - MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; - Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); - for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { - // 鑾峰彇涓婁紶鏂囦欢瀵硅薄 - MultipartFile file = entity.getValue(); - ImportParams params = new ImportParams(); - params.setTitleRows(2); - params.setHeadRows(1); - params.setSheetNum(1); - params.setNeedSave(true); - EamMaintenanceStandardRequest standardRequest = new EamMaintenanceStandardRequest(); - try { - //璇诲彇璁惧缂栧彿锛屽浘鐗囩瓑 - readWeekExcel(file, standardRequest); - EamEquipment equipment = eamEquipmentService.selectByEquipmentCode(standardRequest.getEquipmentCode()); - if(equipment == null) { - log.error("璁惧涓嶅瓨鍦細{}", standardRequest.getEquipmentCode()); - continue; - } - standardRequest.setStandardName(standardRequest.getEquipmentName() + "涓変繚鏍囧噯"); - standardRequest.setMaintenanceCategory(MaintenanceCategoryEnum.THIRD_MAINTENANCE.name()); - standardRequest.setEquipmentId(equipment.getId()); - //璇诲彇淇濆吇鏄庣粏鍐呭 - List<ThirdMaintenanceStandardImport> list = ExcelImportUtil.importExcel(file.getInputStream(), ThirdMaintenanceStandardImport.class, params); - //鏄庣粏椤� - List<EamMaintenanceStandardDetail> tableList = list.stream().map(EamMaintenanceStandardDetail::new).collect(Collectors.toList()); - standardRequest.setTableDetailList(tableList); - String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.MAINTENANCE_STANDARD_CODE_RULE); - standardRequest.setStandardCode(codeSeq); - boolean b = eamMaintenanceStandardService.addMaintenanceStandard(standardRequest); - if (!b) { - log.error("淇濆瓨澶辫触锛� {}", standardRequest.getEquipmentCode()); - } - } catch (Exception e) { - //update-begin-author:taoyan date:20211124 for: 瀵煎叆鏁版嵁閲嶅澧炲姞鎻愮ず - String msg = e.getMessage(); - log.error("鏂囦欢 {} 澶勭悊寮傚父锛� {}", file.getOriginalFilename(), msg, e); - //update-end-author:taoyan date:20211124 for: 瀵煎叆鏁版嵁閲嶅澧炲姞鎻愮ず - } finally { - try { - file.getInputStream().close(); - } catch (IOException e) { - log.error(e.getMessage(), e); - } - } - } - return Result.ok("鏂囦欢瀵煎叆瀹屾垚锛�"); - } - - /** - * 璇诲彇Excel 绗竴琛岋紝 绗簩琛岀殑淇℃伅锛屽寘鎷浘鐗囦俊鎭� - * @param file - * @param request - */ - private void readExcel(MultipartFile file, EamMaintenanceStandardRequest request) { - Workbook book = null; - boolean isXSSFWorkbook = false; + * 鐐规瀵煎叆 + */ + @PostMapping("/importPointInspection") + public Result<?> importPointInspectionExcel(HttpServletRequest request) { try { - book = WorkbookFactory.create(file.getInputStream()); - if (book instanceof XSSFWorkbook) { - isXSSFWorkbook = true; + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); + + Map<String, String> results = new LinkedHashMap<>(); + int successCount = 0; + int failureCount = 0; + + for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue(); + String fileName = file.getOriginalFilename(); + + Result<?> importResult = eamMaintenanceStandardService.importPointInspectionExcel(file); + + if (importResult.isSuccess()) { + results.put(fileName, "鎴愬姛: " + importResult.getMessage()); + successCount++; + } else { + results.put(fileName, "澶辫触: " + importResult.getMessage()); + failureCount++; + } } - Sheet sheet = book.getSheetAt(0); - //绗竴琛岃鍙� - Row row = sheet.getRow(0); - //璁惧缂栫爜 - Cell equipmentCode = row.getCell(15); - if(CellType.NUMERIC.equals(equipmentCode.getCellType())) { - request.setEquipmentCode(String.valueOf((int) equipmentCode.getNumericCellValue())); - }else if(CellType.STRING.equals(equipmentCode.getCellType())) { - request.setEquipmentCode(equipmentCode.getStringCellValue()); - } - if (StringUtils.isBlank(request.getEquipmentCode())) { - throw new JeecgBootException("Excel銆� " + file.getOriginalFilename() + "銆戞病鏈夎鍙栧埌璁惧缂栧彿锛屽鍏ュけ璐ワ紒"); - } - //鍒濆鏃ユ湡 - Cell initialDate = row.getCell(11); - if (DateUtil.isCellDateFormatted(initialDate)) { - request.setInitialDate(initialDate.getDateCellValue()); - } else { - request.setInitialDate(new Date()); - } - //璁惧鍚嶇О - Cell equipmentName = row.getCell(13); - request.setEquipmentName(equipmentName.getStringCellValue()); + // 鏋勫缓鍝嶅簲 + Map<String, Object> response = new HashMap<>(); + response.put("results", results); + response.put("totalFiles", fileMap.size()); + response.put("successCount", successCount); + response.put("failureCount", failureCount); - //绗簩琛岃鍙� - row = sheet.getRow(1); - //淇濆吇鍛ㄦ湡 - Cell period = row.getCell(11); - if (CellType.NUMERIC.equals(period.getCellType())) { - request.setMaintenancePeriod((int) period.getNumericCellValue()); + if (failureCount == 0) { + return Result.ok("鎵�鏈夌偣妫�鏂囦欢瀵煎叆鎴愬姛"+response); + } else if (successCount == 0) { + return Result.error("鎵�鏈夌偣妫�鏂囦欢瀵煎叆澶辫触", response); } else { - //榛樿鐐规鍛ㄦ湡 1 - request.setMaintenancePeriod(1); + return Result.error("閮ㄥ垎鐐规鏂囦欢瀵煎叆澶辫触", response); } - //鏂囦欢缂栫爜 - Cell fileCode = row.getCell(13); - request.setFileCode(fileCode.getStringCellValue()); + } catch (Exception e) { - log.error("璇诲彇Excel淇℃伅澶辫触锛歿}", e.getMessage(), e); + log.error("鐐规瀵煎叆澶勭悊寮傚父", e); + return Result.error("鐐规瀵煎叆澶勭悊澶辫触: " + e.getMessage()); + } + } + + + /** + * 浜屼繚瀵煎叆 + */ + @PostMapping("/importSecondMaintenanceStandard") + public Result<?> importSecondMaintenanceStandard(HttpServletRequest request) { + try { + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map<String, String> results = new LinkedHashMap<>(); + Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); + + // 缁熻瀵煎叆缁撴灉 + int successCount = 0; + int failureCount = 0; + + for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue(); + String fileName = file.getOriginalFilename(); + + Result<?> importResult = eamMaintenanceStandardService.importMaintenanceStandard(file, "SECOND"); + + if (importResult.isSuccess()) { + results.put(fileName, "鎴愬姛: " + importResult.getMessage()); + successCount++; + } else { + results.put(fileName, "澶辫触: " + importResult.getMessage()); + failureCount++; + } + } + + // 鏋勫缓鏈�缁堝搷搴� + Map<String, Object> response = new HashMap<>(); + response.put("results", results); + response.put("totalFiles", fileMap.size()); + response.put("successCount", successCount); + response.put("failureCount", failureCount); + + if (failureCount > 0) { + return Result.error("閮ㄥ垎鏂囦欢瀵煎叆澶辫触", response); + } + + return Result.ok("鎵�鏈夋枃浠跺鍏ユ垚鍔�"+response); + + } catch (Exception e) { + log.error("瀵煎叆澶勭悊寮傚父", e); + return Result.error("瀵煎叆澶勭悊澶辫触: " + e.getMessage()); } } /** - * 璇诲彇Excel 绗竴琛岋紝 绗簩琛岀殑淇℃伅 - * @param file - * @param request + * 涓変繚瀵煎叆 */ - public void readWeekExcel(MultipartFile file, EamMaintenanceStandardRequest request) { - Workbook book = null; - boolean isXSSFWorkbook = false; + @PostMapping("/importThirdMaintenanceStandard") + public Result<?> importThirdMaintenanceStandard(HttpServletRequest request) { try { - book = WorkbookFactory.create(file.getInputStream()); - if (book instanceof XSSFWorkbook) { - isXSSFWorkbook = true; + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map<String, String> results = new LinkedHashMap<>(); + Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); + + // 缁熻瀵煎叆缁撴灉 + int successCount = 0; + int failureCount = 0; + + for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue(); + String fileName = file.getOriginalFilename(); + + Result<?> importResult = eamMaintenanceStandardService.importMaintenanceStandard(file, "THIRD"); + + if (importResult.isSuccess()) { + results.put(fileName, "鎴愬姛: " + importResult.getMessage()); + successCount++; + } else { + results.put(fileName, "澶辫触: " + importResult.getMessage()); + failureCount++; + } } - Sheet sheet = book.getSheetAt(0); - //绗竴琛岃鍙� - Row row = sheet.getRow(0); - //璁惧缂栫爜 - Cell equipmentCode = row.getCell(10); - if(CellType.NUMERIC.equals(equipmentCode.getCellType())) { - request.setEquipmentCode(String.valueOf((int) equipmentCode.getNumericCellValue())); - }else if(CellType.STRING.equals(equipmentCode.getCellType())) { - request.setEquipmentCode(equipmentCode.getStringCellValue()); - } - if (StringUtils.isBlank(request.getEquipmentCode())) { - throw new JeecgBootException("Excel銆� " + file.getOriginalFilename() + "銆戞病鏈夎鍙栧埌璁惧缂栧彿锛屽鍏ュけ璐ワ紒"); - } - //鍒濆鏃ユ湡 - Cell initialDate = row.getCell(6); - if (DateUtil.isCellDateFormatted(initialDate)) { - request.setInitialDate(initialDate.getDateCellValue()); - } else { - request.setInitialDate(new Date()); - } - //璁惧鍚嶇О - Cell equipmentName = row.getCell(8); - request.setEquipmentName(equipmentName.getStringCellValue()); + // 鏋勫缓鏈�缁堝搷搴� + Map<String, Object> response = new HashMap<>(); + response.put("results", results); + response.put("totalFiles", fileMap.size()); + response.put("successCount", successCount); + response.put("failureCount", failureCount); - //绗簩琛岃鍙� - row = sheet.getRow(1); - //淇濆吇鍛ㄦ湡 - Cell period = row.getCell(6); - if (CellType.NUMERIC.equals(period.getCellType())) { - request.setMaintenancePeriod((int) period.getNumericCellValue()); - } else { - request.setMaintenancePeriod(null); + if (failureCount > 0) { + return Result.error("閮ㄥ垎鏂囦欢瀵煎叆澶辫触", response); } - //鏂囦欢缂栫爜 - Cell fileCode = row.getCell(8); - request.setFileCode(fileCode.getStringCellValue()); + + return Result.ok("鎵�鏈夋枃浠跺鍏ユ垚鍔�"+response); + } catch (Exception e) { - log.error("璇诲彇Excel淇℃伅澶辫触锛歿}", e.getMessage(), e); + log.error("瀵煎叆澶勭悊寮傚父", e); + return Result.error("瀵煎叆澶勭悊澶辫触: " + e.getMessage()); } } + } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationStandardController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationStandardController.java new file mode 100644 index 0000000..56009c2 --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationStandardController.java @@ -0,0 +1,176 @@ +package org.jeecg.modules.eam.controller; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.modules.eam.constant.BusinessCodeConst; +import org.jeecg.modules.eam.constant.TechnicalStatusEvaluationStandardEnum; +import org.jeecg.modules.eam.entity.EamMaintenanceStandard; +import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandard; +import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationStandardRequest; +import org.jeecg.modules.eam.service.IEamTechnicalStatusEvaluationStandardService; +import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @Description: 鎶�鏈姸鎬侀壌瀹氳鑼� + * @Author: jeecg-boot + * @Date: 2025-07-07 + * @Version: V1.0 + */ +@Slf4j +@Api(tags = "鎶�鏈姸鎬侀壌瀹氳鑼�") +@RestController +@RequestMapping("/eam/eamTechnicalStatusEvaluationStandard") +public class EamTechnicalStatusEvaluationStandardController extends JeecgController<EamTechnicalStatusEvaluationStandard, IEamTechnicalStatusEvaluationStandardService> { + @Autowired + private IEamTechnicalStatusEvaluationStandardService eamTechnicalStatusEvaluationStandardService; + @Autowired + private ISysBusinessCodeRuleService businessCodeRuleService; + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param eamTechnicalStatusEvaluationStandard + * @param pageNo + * @param pageSize + * @return + */ + @ApiOperation(value = "鎶�鏈姸鎬侀壌瀹氳鑼�-鍒嗛〉鍒楄〃鏌ヨ", notes = "鎶�鏈姸鎬侀壌瀹氳鑼�-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<?> queryPageList(EamTechnicalStatusEvaluationStandard eamTechnicalStatusEvaluationStandard, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { + Page<EamTechnicalStatusEvaluationStandard> page = new Page<>(pageNo, pageSize); + IPage<EamTechnicalStatusEvaluationStandard> pageList = eamTechnicalStatusEvaluationStandardService.queryPageList(page, eamTechnicalStatusEvaluationStandard); + return Result.OK(pageList); + } + + /** + * 娣诲姞 + * + * @param request + * @return + */ + @AutoLog(value = "鎶�鏈姸鎬侀壌瀹氳鑼�-娣诲姞") + @ApiOperation(value = "鎶�鏈姸鎬侀壌瀹氳鑼�-娣诲姞", notes = "鎶�鏈姸鎬侀壌瀹氳鑼�-娣诲姞") + @PostMapping(value = "/add") + public Result<?> add(@RequestBody EamTechnicalStatusEvaluationStandardRequest request) { + if (request == null) { + return Result.error("娣诲姞鐨勫璞′笉鑳戒负绌猴紒"); + } + if (CollectionUtil.isEmpty(request.getTableDetailList())) { + return Result.error("妫�鏌ラ」涓嶈兘涓虹┖锛�"); + } + String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.TECHNICAL_STATUS_EVALUATION_STANDARD_CODE_RULE); + request.setStandardCode(codeSeq); + boolean b = eamTechnicalStatusEvaluationStandardService.addEamTechnicalStatusEvaluationStandard(request); + if (!b) { + return Result.error("娣诲姞澶辫触锛�"); + } + return Result.OK("娣诲姞鎴愬姛锛�"); + } + + /** + * 缂栬緫 + * + * @param request + * @return + */ + @AutoLog(value = "鎶�鏈姸鎬侀壌瀹氳鑼�-缂栬緫") + @ApiOperation(value = "鎶�鏈姸鎬侀壌瀹氳鑼�-缂栬緫", notes = "鎶�鏈姸鎬侀壌瀹氳鑼�-缂栬緫") + @PutMapping(value = "/edit") + public Result<?> edit(@RequestBody EamTechnicalStatusEvaluationStandardRequest request) { + if (request == null) { + return Result.error("娣诲姞鐨勫璞′笉鑳戒负绌猴紒"); + } + if (CollectionUtil.isEmpty(request.getTableDetailList())) { + return Result.error("妫�鏌ラ」涓嶈兘涓虹┖锛�"); + } + boolean b = eamTechnicalStatusEvaluationStandardService.editEamTechnicalStatusEvaluationStandard(request); + if (!b) { + return Result.error("缂栬緫澶辫触锛�"); + } + return Result.OK("缂栬緫鎴愬姛!"); + } + + /** + * 鍗囩増 + * + * @param request + * @return + */ + @AutoLog(value = "鎶�鏈姸鎬侀壌瀹氳鑼�-鍗囩増") + @ApiOperation(value = "鎶�鏈姸鎬侀壌瀹氳鑼�-鍗囩増", notes = "鎶�鏈姸鎬侀壌瀹氳鑼�-鍗囩増") + @PutMapping(value = "/upgrade") + public Result<?> upgrade(@RequestBody EamTechnicalStatusEvaluationStandardRequest request) { + if (request == null) { + return Result.error("娣诲姞鐨勫璞′笉鑳戒负绌猴紒"); + } + if (CollectionUtil.isEmpty(request.getTableDetailList())) { + return Result.error("淇濆吇椤逛笉鑳戒负绌猴紒"); + } + String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.TECHNICAL_STATUS_EVALUATION_STANDARD_CODE_RULE); + request.setStandardCode(codeSeq); + boolean b = eamTechnicalStatusEvaluationStandardService.upgrade(request); + if (!b) { + return Result.error("鍗囩増澶辫触锛�"); + } + return Result.OK("鍗囩増鎴愬姛!"); + } + + /** + * 閫氳繃id鏌ヨ + * + * @param id + * @return + */ + @AutoLog(value = "鎶�鏈姸鎬侀壌瀹氳鑼�-閫氳繃id鏌ヨ") + @ApiOperation(value = "鎶�鏈姸鎬侀壌瀹氳鑼�-閫氳繃id鏌ヨ", notes = "鎶�鏈姸鎬侀壌瀹氳鑼�-閫氳繃id鏌ヨ") + @GetMapping(value = "/queryById") + public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { + EamTechnicalStatusEvaluationStandard eamTechnicalStatusEvaluationStandard = eamTechnicalStatusEvaluationStandardService.getById(id); + return Result.OK(eamTechnicalStatusEvaluationStandard); + } + + /** + * 鎻愪氦 + * @param id + * @return + */ + @AutoLog(value = "鎶�鏈姸鎬侀壌瀹氳鑼�-鎻愪氦") + @ApiOperation(value = "鎶�鏈姸鎬侀壌瀹氳鑼�-鎻愪氦", notes = "鎶�鏈姸鎬侀壌瀹氳鑼�-鎻愪氦") + @GetMapping(value = "/submit") + public Result<?> submit(@RequestParam(name = "id", required = true) String id) { + EamTechnicalStatusEvaluationStandard entity = eamTechnicalStatusEvaluationStandardService.getById(id); + if (entity != null) { + entity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.ENABLE.name()); + eamTechnicalStatusEvaluationStandardService.updateById(entity); + } + return Result.OK("鍒犻櫎鎴愬姛!"); + } + + /** + * 閫氳繃excel瀵煎叆鏁版嵁 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, EamTechnicalStatusEvaluationStandard.class); + } + +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationStandardDetailController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationStandardDetailController.java new file mode 100644 index 0000000..9aaf3cd --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationStandardDetailController.java @@ -0,0 +1,129 @@ +package org.jeecg.modules.eam.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandardDetail; +import org.jeecg.modules.eam.service.IEamTechnicalStatusEvaluationStandardDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; + +/** + * @Description: 鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁� + * @Author: jeecg-boot + * @Date: 2025-07-07 + * @Version: V1.0 + */ +@Slf4j +@Api(tags = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�") +@RestController +@RequestMapping("/eam/eamTechnicalStatusEvaluationStandardDetail") +public class EamTechnicalStatusEvaluationStandardDetailController extends JeecgController<EamTechnicalStatusEvaluationStandardDetail, IEamTechnicalStatusEvaluationStandardDetailService> { + @Autowired + private IEamTechnicalStatusEvaluationStandardDetailService eamTechnicalStatusEvaluationStandardDetailService; + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param eamTechnicalStatusEvaluationStandardDetail + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-鍒嗛〉鍒楄〃鏌ヨ", notes = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<?> queryPageList(EamTechnicalStatusEvaluationStandardDetail eamTechnicalStatusEvaluationStandardDetail, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<EamTechnicalStatusEvaluationStandardDetail> queryWrapper = QueryGenerator.initQueryWrapper(eamTechnicalStatusEvaluationStandardDetail, req.getParameterMap()); + Page<EamTechnicalStatusEvaluationStandardDetail> page = new Page<EamTechnicalStatusEvaluationStandardDetail>(pageNo, pageSize); + IPage<EamTechnicalStatusEvaluationStandardDetail> pageList = eamTechnicalStatusEvaluationStandardDetailService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 娣诲姞 + * + * @param eamTechnicalStatusEvaluationStandardDetail + * @return + */ + @AutoLog(value = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-娣诲姞") + @ApiOperation(value = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-娣诲姞", notes = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-娣诲姞") + @PostMapping(value = "/add") + public Result<?> add(@RequestBody EamTechnicalStatusEvaluationStandardDetail eamTechnicalStatusEvaluationStandardDetail) { + eamTechnicalStatusEvaluationStandardDetailService.save(eamTechnicalStatusEvaluationStandardDetail); + return Result.OK("娣诲姞鎴愬姛锛�"); + } + + /** + * 缂栬緫 + * + * @param eamTechnicalStatusEvaluationStandardDetail + * @return + */ + @AutoLog(value = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-缂栬緫") + @ApiOperation(value = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-缂栬緫", notes = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-缂栬緫") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result<?> edit(@RequestBody EamTechnicalStatusEvaluationStandardDetail eamTechnicalStatusEvaluationStandardDetail) { + eamTechnicalStatusEvaluationStandardDetailService.updateById(eamTechnicalStatusEvaluationStandardDetail); + return Result.OK("缂栬緫鎴愬姛!"); + } + + /** + * 閫氳繃id鍒犻櫎 + * + * @param id + * @return + */ + @AutoLog(value = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-閫氳繃id鍒犻櫎") + @ApiOperation(value = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-閫氳繃id鍒犻櫎", notes = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-閫氳繃id鍒犻櫎") + @DeleteMapping(value = "/delete") + public Result<?> delete(@RequestParam(name = "id", required = true) String id) { + eamTechnicalStatusEvaluationStandardDetailService.removeById(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } + + /** + * 鎵归噺鍒犻櫎 + * + * @param ids + * @return + */ + @AutoLog(value = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-鎵归噺鍒犻櫎") + @ApiOperation(value = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-鎵归噺鍒犻櫎", notes = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-鎵归噺鍒犻櫎") + @DeleteMapping(value = "/deleteBatch") + public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.eamTechnicalStatusEvaluationStandardDetailService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("鎵归噺鍒犻櫎鎴愬姛锛�"); + } + + /** + * 閫氳繃id鏌ヨ + * + * @param id + * @return + */ + @AutoLog(value = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-閫氳繃id鏌ヨ") + @ApiOperation(value = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-閫氳繃id鏌ヨ", notes = "鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�-閫氳繃id鏌ヨ") + @GetMapping(value = "/queryById") + public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { + EamTechnicalStatusEvaluationStandardDetail eamTechnicalStatusEvaluationStandardDetail = eamTechnicalStatusEvaluationStandardDetailService.getById(id); + return Result.OK(eamTechnicalStatusEvaluationStandardDetail); + } + +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamTechnicalStatusEvaluationStandard.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamTechnicalStatusEvaluationStandard.java new file mode 100644 index 0000000..01e1c6b --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamTechnicalStatusEvaluationStandard.java @@ -0,0 +1,78 @@ +package org.jeecg.modules.eam.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.util.Date; + +/** + * @Description: 鎶�鏈姸鎬侀壌瀹氳鑼� + * @Author: jeecg-boot + * @Date: 2025-07-07 + * @Version: V1.0 + */ +@Data +@TableName("eam_technical_status_evaluation_standard") +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="eam_technical_status_evaluation_standard瀵硅薄", description="鎶�鏈姸鎬侀壌瀹氳鑼�") +public class EamTechnicalStatusEvaluationStandard { + + /**涓婚敭*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "涓婚敭") + private String id; + /**鍒涘缓浜�*/ + @ApiModelProperty(value = "鍒涘缓浜�") + private String createBy; + /**鍒涘缓鏃堕棿*/ + @ApiModelProperty(value = "鍒涘缓鏃堕棿") + private Date createTime; + /**鏇存柊浜�*/ + @ApiModelProperty(value = "鏇存柊浜�") + private String updateBy; + /**鏇存柊鏃堕棿*/ + @ApiModelProperty(value = "鏇存柊鏃堕棿") + private Date updateTime; + /**鍒犻櫎鏍囪*/ + @ApiModelProperty(value = "鍒犻櫎鏍囪") + private Integer delFlag; + /**瑙勮寖鍚嶇О*/ + @ApiModelProperty(value = "瑙勮寖鍚嶇О") + private String standardName; + /**瑙勮寖缂栫爜*/ + @ApiModelProperty(value = "瑙勮寖缂栫爜") + private String standardCode; + /**閴村畾鍛ㄦ湡*/ + @ApiModelProperty(value = "閴村畾鍛ㄦ湡") + private Integer evaluationPeriod; + /**璁惧ID*/ + @ApiModelProperty(value = "璁惧ID") + private String equipmentId; + /**瑙勮寖鐘舵��;寰呮彁浜ゃ�佸惎鐢ㄣ�佷綔搴�*/ + @ApiModelProperty(value = "瑙勮寖鐘舵��;寰呮彁浜ゃ�佸惎鐢ㄣ�佷綔搴�") + private String standardStatus; + /**鏄惁鏈夊畨鍏ㄨ缃鏌�;鏄惁*/ + @ApiModelProperty(value = "鏄惁鏈夊畨鍏ㄨ缃鏌�;鏄惁") + private String hasSafetyEquipmentCheck; + /**鏄惁鏈夎澶囩簿搴︽鏌�;鏄惁*/ + @ApiModelProperty(value = "鏄惁鏈夎澶囩簿搴︽鏌�;鏄惁") + private String hasPrecisionCheck; + /**鏄惁鏈夊叾浠栨鏌�;鏄惁*/ + @ApiModelProperty(value = "鏄惁鏈夊叾浠栨鏌�;鏄惁") + private String hasOtherCheck; + /**鐗堟湰 V1,V2+*/ + @ApiModelProperty(value = "鐗堟湰 V1,V2") + private String standardVersion; + /**澶囨敞*/ + @Excel(name = "澶囨敞", width = 15) + @ApiModelProperty(value = "澶囨敞") + private String remark; +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamTechnicalStatusEvaluationStandardDetail.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamTechnicalStatusEvaluationStandardDetail.java new file mode 100644 index 0000000..d9dcbbf --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamTechnicalStatusEvaluationStandardDetail.java @@ -0,0 +1,73 @@ +package org.jeecg.modules.eam.entity; + +import java.io.Serializable; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; + +/** + * @Description: 鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁� + * @Author: jeecg-boot + * @Date: 2025-07-07 + * @Version: V1.0 + */ +@Data +@TableName("eam_technical_status_evaluation_standard_detail") +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="eam_technical_status_evaluation_standard_detail瀵硅薄", description="鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁�") +public class EamTechnicalStatusEvaluationStandardDetail { + + /**涓婚敭*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "涓婚敭") + private String id; + /**鍒涘缓浜�*/ + @Excel(name = "鍒涘缓浜�", width = 15) + @ApiModelProperty(value = "鍒涘缓浜�") + private String createBy; + /**鍒涘缓鏃堕棿*/ + @ApiModelProperty(value = "鍒涘缓鏃堕棿") + private Date createTime; + /**鏇存柊浜�*/ + @Excel(name = "鏇存柊浜�", width = 15) + @ApiModelProperty(value = "鏇存柊浜�") + private String updateBy; + /**鏇存柊鏃堕棿*/ + @ApiModelProperty(value = "鏇存柊鏃堕棿") + private Date updateTime; + /**瑙勮寖ID*/ + @Excel(name = "瑙勮寖ID", width = 15) + @ApiModelProperty(value = "瑙勮寖ID") + private String standardId; + /**妫�鏌ュ垎绫�;绮惧害妫�鏌ャ�佸畨鍏ㄨ缃鏌ャ�佸叾浠栨鏌�*/ + @Excel(name = "妫�鏌ュ垎绫�;绮惧害妫�鏌ャ�佸畨鍏ㄨ缃鏌ャ�佸叾浠栨鏌�", width = 15) + @ApiModelProperty(value = "妫�鏌ュ垎绫�;绮惧害妫�鏌ャ�佸畨鍏ㄨ缃鏌ャ�佸叾浠栨鏌�") + private String checkCategory; + /**椤圭洰搴忓彿*/ + @Excel(name = "椤圭洰搴忓彿", width = 15) + @ApiModelProperty(value = "椤圭洰搴忓彿") + private Integer itemCode; + /**妫�鏌ラ」鐩�*/ + @Excel(name = "妫�鏌ラ」鐩�", width = 15) + @ApiModelProperty(value = "妫�鏌ラ」鐩�") + private String itemName; + /**鍏佸樊鍊�;绮惧害妫�鏌ュ睍绀�*/ + @Excel(name = "鍏佸樊鍊�;绮惧害妫�鏌ュ睍绀�", width = 15) + @ApiModelProperty(value = "鍏佸樊鍊�;绮惧害妫�鏌ュ睍绀�") + private String toleranceValue; + /**妫�鏌ュ瓙椤圭洰;绮惧害妫�鏌ュ睍绀猴紝鍙互涓虹┖*/ + @Excel(name = "妫�鏌ュ瓙椤圭洰;绮惧害妫�鏌ュ睍绀猴紝鍙互涓虹┖", width = 15) + @ApiModelProperty(value = "妫�鏌ュ瓙椤圭洰;绮惧害妫�鏌ュ睍绀猴紝鍙互涓虹┖") + private String subItemName; +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamTechnicalStatusEvaluationStandardDetailMapper.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamTechnicalStatusEvaluationStandardDetailMapper.java new file mode 100644 index 0000000..a94812d --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamTechnicalStatusEvaluationStandardDetailMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.eam.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandardDetail; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁� + * @Author: jeecg-boot + * @Date: 2025-07-07 + * @Version: V1.0 + */ +public interface EamTechnicalStatusEvaluationStandardDetailMapper extends BaseMapper<EamTechnicalStatusEvaluationStandardDetail> { + +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamTechnicalStatusEvaluationStandardMapper.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamTechnicalStatusEvaluationStandardMapper.java new file mode 100644 index 0000000..4d7b91f --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamTechnicalStatusEvaluationStandardMapper.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.eam.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandard; + +/** + * @Description: 鎶�鏈姸鎬侀壌瀹氳鑼� + * @Author: jeecg-boot + * @Date: 2025-07-07 + * @Version: V1.0 + */ +public interface EamTechnicalStatusEvaluationStandardMapper extends BaseMapper<EamTechnicalStatusEvaluationStandard> { + + /** + * 鍒嗛〉鏌ヨ + * @param page + * @param queryWrapper + * @return + */ + IPage<EamTechnicalStatusEvaluationStandard> queryPageList(Page<EamTechnicalStatusEvaluationStandard> page, QueryWrapper<EamTechnicalStatusEvaluationStandard> queryWrapper); +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamTechnicalStatusEvaluationStandardDetailMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamTechnicalStatusEvaluationStandardDetailMapper.xml new file mode 100644 index 0000000..4370e3c --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamTechnicalStatusEvaluationStandardDetailMapper.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="org.jeecg.modules.eam.mapper.EamTechnicalStatusEvaluationStandardDetailMapper"> + +</mapper> \ No newline at end of file diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamTechnicalStatusEvaluationStandardMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamTechnicalStatusEvaluationStandardMapper.xml new file mode 100644 index 0000000..b1aa00b --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamTechnicalStatusEvaluationStandardMapper.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="org.jeecg.modules.eam.mapper.EamTechnicalStatusEvaluationStandardMapper"> + <select id="queryPageList" resultType="org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandard"> + select ems.*, e.equipment_code, e.equipment_name, e.equipment_model + from eam_technical_status_evaluation_standard ems + inner join eam_equipment e + on ems.equipment_id = e.id + ${ew.customSqlSegment} + </select> +</mapper> \ No newline at end of file diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamTechnicalStatusEvaluationStandardRequest.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamTechnicalStatusEvaluationStandardRequest.java new file mode 100644 index 0000000..5c9e196 --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamTechnicalStatusEvaluationStandardRequest.java @@ -0,0 +1,41 @@ +package org.jeecg.modules.eam.request; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandardDetail; + +import java.io.Serializable; +import java.util.List; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="eam_technical_status_evaluation_standard瀵硅薄", description="鎶�鏈姸鎬侀壌瀹氳鑼�") +public class EamTechnicalStatusEvaluationStandardRequest implements Serializable { + /**涓婚敭*/ + @ApiModelProperty(value = "涓婚敭") + private String id; + /**瑙勮寖缂栫爜*/ + @ApiModelProperty(value = "瑙勮寖缂栫爜") + private String standardCode; + /**瑙勮寖鍚嶇О*/ + @ApiModelProperty(value = "瑙勮寖鍚嶇О") + private String standardName; + /**閴村畾鍛ㄦ湡;鍗曚綅:骞�*/ + @ApiModelProperty(value = "閴村畾鍛ㄦ湡;鍗曚綅:骞�") + private Integer evaluationPeriod; + /**璁惧ID*/ + @ApiModelProperty(value = "璁惧ID") + private String equipmentId; + /**鍒楄〃 妫�鏌ラ」鏄庣粏*/ + @ApiModelProperty(value = "鍒楄〃 妫�鏌ラ」鏄庣粏") + private List<EamTechnicalStatusEvaluationStandardDetail> tableDetailList; + /**鍒犻櫎 妫�鏌ラ」鏄庣粏*/ + @ApiModelProperty(value = "鍒犻櫎 妫�鏌ラ」鏄庣粏") + private List<EamTechnicalStatusEvaluationStandardDetail> removeDetailList; + + +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamMaintenanceStandardService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamMaintenanceStandardService.java index 61bef31..b320af0 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamMaintenanceStandardService.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamMaintenanceStandardService.java @@ -9,6 +9,7 @@ import org.jeecg.modules.eam.vo.EamMaintenanceStandardVo; import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; import java.util.List; /** @@ -87,4 +88,7 @@ * 鐐规琛ㄥ鍏ュ叆鍙� */ public Result<?> importPointInspectionExcel(MultipartFile file); + + + Result<?> importMaintenanceStandard(MultipartFile file, String type); } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationStandardDetailService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationStandardDetailService.java new file mode 100644 index 0000000..c3afc15 --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationStandardDetailService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.eam.service; + +import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandardDetail; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁� + * @Author: jeecg-boot + * @Date: 2025-07-07 + * @Version: V1.0 + */ +public interface IEamTechnicalStatusEvaluationStandardDetailService extends IService<EamTechnicalStatusEvaluationStandardDetail> { + +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationStandardService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationStandardService.java new file mode 100644 index 0000000..5e24179 --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationStandardService.java @@ -0,0 +1,53 @@ +package org.jeecg.modules.eam.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandard; +import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationStandardRequest; + +/** + * @Description: 鎶�鏈姸鎬侀壌瀹氳鑼� + * @Author: jeecg-boot + * @Date: 2025-07-07 + * @Version: V1.0 + */ +public interface IEamTechnicalStatusEvaluationStandardService extends IService<EamTechnicalStatusEvaluationStandard> { + + /** + * + * @param page + * @param eamTechnicalStatusEvaluationStandard + * @return + */ + IPage<EamTechnicalStatusEvaluationStandard> queryPageList(Page<EamTechnicalStatusEvaluationStandard> page, EamTechnicalStatusEvaluationStandard eamTechnicalStatusEvaluationStandard); + + /** + * 鏂板 + * @param request + * @return + */ + boolean addEamTechnicalStatusEvaluationStandard(EamTechnicalStatusEvaluationStandardRequest request); + + /** + * 閲嶅鏍¢獙 + * @param equipmentId + * @param id + * @return + */ + EamTechnicalStatusEvaluationStandard checkDuplicate(String equipmentId, String id); + + /** + * 缂栬緫 + * @param request + * @return + */ + boolean editEamTechnicalStatusEvaluationStandard(EamTechnicalStatusEvaluationStandardRequest request); + + /** + * 鍗囩増 + * @param request + * @return + */ + boolean upgrade(EamTechnicalStatusEvaluationStandardRequest request); +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamMaintenanceStandardServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamMaintenanceStandardServiceImpl.java index 596714b..5c3d56a 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamMaintenanceStandardServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamMaintenanceStandardServiceImpl.java @@ -10,8 +10,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.jeecg.weibo.exception.BusinessException; +import liquibase.pro.packaged.R; +import liquibase.pro.packaged.S; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.apache.poi.xwpf.usermodel.*; import org.apache.shiro.SecurityUtils; import org.flowable.engine.TaskService; import org.flowable.task.api.Task; @@ -24,12 +29,16 @@ import org.jeecg.modules.eam.base.service.IBaseFactoryService; import org.jeecg.modules.eam.base.service.IBaseFactoryUserService; import org.jeecg.modules.eam.constant.BusinessCodeConst; +import org.jeecg.modules.eam.constant.EamMaintenanceStandardDetailCategory; import org.jeecg.modules.eam.constant.MaintenanceStandardStatusEnum; import org.jeecg.modules.eam.entity.EamEquipment; +import org.jeecg.modules.eam.entity.EamEquipmentExtend; import org.jeecg.modules.eam.entity.EamMaintenanceStandard; import org.jeecg.modules.eam.entity.EamMaintenanceStandardDetail; import org.jeecg.modules.eam.mapper.EamMaintenanceStandardMapper; import org.jeecg.modules.eam.request.EamMaintenanceStandardRequest; +import org.jeecg.modules.eam.request.ImportException; +import org.jeecg.modules.eam.service.IEamEquipmentExtendService; import org.jeecg.modules.eam.service.IEamEquipmentService; import org.jeecg.modules.eam.service.IEamMaintenanceStandardDetailService; import org.jeecg.modules.eam.service.IEamMaintenanceStandardService; @@ -40,6 +49,7 @@ import org.jeecg.modules.flowable.apithird.service.FlowCommonService; import org.jeecg.modules.flowable.service.IFlowDefinitionService; import org.jeecg.modules.flowable.service.IFlowTaskService; +import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; import org.jeecg.modules.system.service.ISysUserService; import org.jeecg.modules.system.vo.UserSelector; import org.springframework.beans.BeanUtils; @@ -87,6 +97,22 @@ private ISysUserService sysUserService; @Autowired private IEamEquipmentService eamEquipmentService; + @Autowired + private IEamEquipmentExtendService eamEquipmentExtendService; + @Autowired + private ISysBusinessCodeRuleService businessCodeRuleService; + + // 甯搁噺瀹氫箟 + private static final String REPAIR_TITLE = "缁翠慨浜哄憳淇濆吇鍐呭"; + private static final String OPERATOR_TITLE = "鎿嶄綔浜哄憳淇濆吇鍐呭"; + private static final Map<String, EamMaintenanceStandardDetailCategory> SECOND_CATEGORY_MAPPING = new HashMap<>(); + + // 鏋氫妇鏄犲皠鍒濆鍖� + static { + SECOND_CATEGORY_MAPPING.put(REPAIR_TITLE, EamMaintenanceStandardDetailCategory.REPAIRER_MAINTENANCE); + SECOND_CATEGORY_MAPPING.put(OPERATOR_TITLE, EamMaintenanceStandardDetailCategory.OPERATOR_MAINTENANCE); + } + @Override public IPage<EamMaintenanceStandard> queryPageList(Page<EamMaintenanceStandard> page, EamMaintenanceStandard eamMaintenanceStandard) { QueryWrapper<EamMaintenanceStandard> queryWrapper = new QueryWrapper<>(); @@ -520,7 +546,7 @@ /*娴佺▼涓氬姟浠g爜--------------------------缁撴潫*/ - /*瀵煎叆鏂囦欢--------------------------寮�濮�*/ + /*瀵煎叆鐐规鏂囦欢Excel--------------------------寮�濮�*/ /** * 鐐规琛ㄥ鍏ュ叆鍙� */ @@ -536,7 +562,7 @@ // 1. 鎻愬彇璁惧淇℃伅 EamMaintenanceStandard eamMaintenanceStandard = extractDeviceInfo(sheet); if (eamMaintenanceStandard == null) { - throw new BusinessException("璁惧淇℃伅鎻愬彇澶辫触"); + return Result.error("璁惧淇℃伅鎻愬彇澶辫触"); } eamMaintenanceStandard.setStandardName(name); @@ -544,9 +570,15 @@ // 2. 鎻愬彇姣忔棩鐐规椤圭洰 List<EamMaintenanceStandardDetail> dailyDetails = extractDailyItems(sheet, eamMaintenanceStandard); + if(dailyDetails.isEmpty()){ + return Result.error("鏈壘鍒版瘡鏃ョ偣妫�椤圭洰"); + } // 3. 鎻愬彇鍛ㄤ繚鍏婚」鐩� List<EamMaintenanceStandardDetail> weeklyDetails = extractWeeklyItems(sheet, eamMaintenanceStandard); + if(weeklyDetails.isEmpty()){ + return Result.error("鏈壘鍒板懆淇濆吇椤圭洰"); + } // 鍚堝苟骞朵繚瀛樻墍鏈夐」鐩� List<EamMaintenanceStandardDetail> allDetails = new ArrayList<>(); @@ -618,7 +650,7 @@ EamMaintenanceStandard standard = new EamMaintenanceStandard(); standard.setEquipmentName(extractField(headerText, "璁惧鍚嶇О[:锛歖\\s*(\\S+)")); standard.setEquipmentId(extractField(headerText, "璁惧鍨嬪彿[:锛歖\\s*(\\S+)")); - standard.setStandardCode(extractField(headerText, "缁熶竴缂栧彿[:锛歖\\s*(\\S+)")); + // 鏃ユ湡澶勭悊 String dateStr = extractField(headerText, "鏃ユ湡[:锛歖\\s*(\\S+)"); @@ -633,11 +665,31 @@ } } + // 鍏宠仈璁惧ID + if (isNotBlank(standard.getEquipmentCode()) && + isNotBlank(standard.getEquipmentName())) { + + List<EamEquipment> equipments = eamEquipmentService.list( + new QueryWrapper<EamEquipment>() + .eq("equipment_code", standard.getEquipmentCode()) + .eq("equipment_name", standard.getEquipmentName()) + ); + + if (!equipments.isEmpty()) { + standard.setEquipmentId(equipments.get(0).getId()); + }else { + return null; + } + } + + String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.MAINTENANCE_STANDARD_CODE_RULE); + standard.setStandardCode(codeSeq); standard.setMaintenanceCategory("POINT_INSPECTION"); standard.setPeriodUnit("澶�"); standard.setStandardStatus(MaintenanceStandardStatusEnum.START.name()); standard.setStandardVersion("v" + CommonConstant.OPERATE_TYPE_1); standard.setDelFlag(0); + standard.setMaintenancePeriod(1); return standard; } @@ -800,7 +852,7 @@ } /** - * 璇嗗埆鏂拌〃澶村紑濮� + * 璇嗗埆鏂拌〃澶村紑濮� */ private boolean isNewHeaderStart(Row row) { for (int colIdx = 0; colIdx < row.getLastCellNum(); colIdx++) { @@ -837,7 +889,6 @@ */ private String extractField(String text, String regex) { if (StringUtils.isBlank(text)) return ""; - Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(text); return matcher.find() ? matcher.group(1) : ""; @@ -848,7 +899,6 @@ */ private String getCellStringValue(Cell cell) { if (cell == null) return ""; - switch (cell.getCellType()) { case STRING: return cell.getStringCellValue().trim(); @@ -886,5 +936,462 @@ return ""; } } - /*瀵煎叆鏂囦欢--------------------------缁撴潫*/ + /*瀵煎叆鐐规鏂囦欢Excel--------------------------缁撴潫*/ + + /*瀵煎叆浜屼繚涓変繚鏂囦欢Excel--------------------------寮�濮�*/ + /** + * 缁熶竴淇濆吇瑙勮寖瀵煎叆鍏ュ彛 + * @param file 涓婁紶鏂囦欢 + * @param type 淇濆吇绫诲瀷 (SECOND/THIRD) + * @return 瀵煎叆缁撴灉锛堝寘鍚垚鍔�/澶辫触淇℃伅锛� + */ + @Override + @Transactional + public Result<?> importMaintenanceStandard(MultipartFile file, String type) { + String fileName = file.getOriginalFilename(); + + try (XWPFDocument doc = new XWPFDocument(file.getInputStream())) { + // 鍩虹楠岃瘉 + if (doc.getTables().isEmpty()) { + return Result.error(fileName + ": 鏂囨。涓湭鎵惧埌琛ㄦ牸"); + } + + XWPFTable table = doc.getTables().get(0); + + // 鏂囨。绫诲瀷鏍¢獙 - 闃叉浜屼繚浼犲叆涓変繚鎴栧弽涔� + if (isWrongDocumentType(table, type)) { + return Result.error(fileName + ": 鏂囨。绫诲瀷涓嶅尮閰� - " + + ("SECOND".equals(type) ? "璇峰鍏ヤ簩绾т繚鍏绘枃妗�" : "璇峰鍏ヤ笁绾т繚鍏绘枃妗�")); + } + + EamMaintenanceStandard standard = extractDeviceInfo(table); + if (standard == null) { + return Result.error(fileName + ": 璁惧淇℃伅鎻愬彇澶辫触"); + } + + // 閰嶇疆绫诲瀷鐩稿叧鍙傛暟 + configureStandard(standard, type, file); + eamMaintenanceStandardMapper.insert(standard); + String standardId = standard.getId(); + + // 鎻愬彇淇濆吇椤圭洰 + List<EamMaintenanceStandardDetail> items; + if ("SECOND".equals(type)) { + items = extractSecondMaintenanceItems(table, standardId); + } else if ("THIRD".equals(type)) { + items = extractThirdMaintenanceItems(table, standardId); + } else { + return Result.error(fileName + ": 涓嶆敮鎸佺殑淇濆吇绫诲瀷: " + type); + } + + // 椤圭洰楠岃瘉 + if (items.isEmpty()) { + return Result.error(fileName + ": 鏈彁鍙栧埌浠讳綍淇濆吇椤圭洰"); + } + + // 淇濆瓨椤圭洰 + eamMaintenanceStandardDetailService.saveBatch(items); + + return Result.ok(fileName + ": 瀵煎叆鎴愬姛, 椤圭洰鏁�: " + items.size()); + + } catch (ImportException e) { + return Result.error(e.getMessage()); + } catch (Exception e) { + return Result.error(fileName + ": 绯荤粺閿欒 - " + e.getClass().getSimpleName()); + } + } + + /** + * 鏂囨。绫诲瀷鏍¢獙 - 闃叉浜屼繚浼犲叆涓変繚鎴栧弽涔� + */ + private boolean isWrongDocumentType(XWPFTable table, String requestedType) { + boolean hasRepairTitle = false; + boolean hasOperatorTitle = false; + boolean hasMaintenancePart = false; + + // 鍙鏌ュ墠10琛岋紙閫氬父鏍囬鍦ㄥ墠鍑犺锛� + int maxRows = Math.min(table.getNumberOfRows(), 10); + + for (int i = 0; i < maxRows; i++) { + XWPFTableRow row = table.getRow(i); + if (row == null) continue; + + // 妫�鏌ユ墍鏈夊崟鍏冩牸鍐呭 + for (int j = 0; j < row.getTableCells().size(); j++) { + String cellText = getCellText(row.getCell(j)); + + // 妫�鏌ヤ簩绾т繚鍏荤壒寰� + if (cellText.contains(REPAIR_TITLE)) { + hasRepairTitle = true; + } + if (cellText.contains(OPERATOR_TITLE)) { + hasOperatorTitle = true; + } + + // 妫�鏌ヤ笁绾т繚鍏荤壒寰� + if (cellText.contains("淇濆吇閮ㄤ綅")) { + hasMaintenancePart = true; + } + } + } + + // 閫昏緫鍒ゆ柇 + if ("SECOND".equals(requestedType)) { + // 濡傛灉璇锋眰瀵煎叆浜岀骇淇濆吇锛屼絾鏂囨。涓湁涓夌骇淇濆吇鐗瑰緛 + return !(hasRepairTitle || hasOperatorTitle) || hasMaintenancePart; + } else if ("THIRD".equals(requestedType)) { + // 濡傛灉璇锋眰瀵煎叆涓夌骇淇濆吇锛屼絾鏂囨。涓湁浜岀骇淇濆吇鐗瑰緛 + return !hasMaintenancePart || (hasRepairTitle || hasOperatorTitle); + } + + return false; + } + + /** + * 鎻愬彇璁惧鍩烘湰淇℃伅 + */ + private EamMaintenanceStandard extractDeviceInfo(XWPFTable table) { + if (table.getNumberOfRows() < 2) return null; + + // 鎻愬彇鍓嶄袱琛屾暟鎹� + Map<String, String> row1Data = extractRowData(table.getRow(0)); + Map<String, String> row2Data = extractRowData(table.getRow(1)); + + // 鍒涘缓璁惧鏍囧噯瀵硅薄 + EamMaintenanceStandard standard = new EamMaintenanceStandard(); + standard.setEquipmentText(row1Data.get("璁惧绫诲埆")); + standard.setEquipmentCode(row1Data.get("璁惧缂栧彿")); + standard.setEquipmentName(row2Data.get("璁惧鍚嶇О")); + standard.setEquipmentModel(row2Data.get("璁惧鍨嬪彿")); + + // 鍏宠仈璁惧ID + if (isNotBlank(standard.getEquipmentCode()) && + isNotBlank(standard.getEquipmentName())) { + + List<EamEquipment> equipments = eamEquipmentService.list( + new QueryWrapper<EamEquipment>() + .eq("equipment_code", standard.getEquipmentCode()) + .eq("equipment_name", standard.getEquipmentName()) + ); + + if (!equipments.isEmpty()) { + standard.setEquipmentId(equipments.get(0).getId()); + }else { + return null; + } + } + + return standard; + } + + // 绠�鏄撶増瀛楃涓查潪绌哄垽鏂� + private boolean isNotBlank(String str) { + return str != null && !str.trim().isEmpty(); + } + + /** + * 琛ㄦ牸琛屾暟鎹В鏋� + */ + private Map<String, String> extractRowData(XWPFTableRow row) { + Map<String, String> data = new HashMap<>(); + int cellCount = row.getTableCells().size(); + + try { + // 閿�煎妯″紡 (鏍囩|鍊紎鏍囩|鍊�) + if (cellCount >= 4 && cellCount % 2 == 0) { + for (int i = 0; i < cellCount; i += 2) { + String key = cleanKey(getCellText(row.getCell(i))); + String value = getCellText(row.getCell(i + 1)); + if (!key.isEmpty()) data.put(key, value); + } + } + // 杩炵画鍗曞厓鏍兼ā寮� + else { + for (int i = 0; i < cellCount; i++) { + String text = getCellText(row.getCell(i)); + int colonIndex = text.indexOf('锛�'); + if (colonIndex > 0) { + String key = cleanKey(text.substring(0, colonIndex)); + String value = text.substring(colonIndex + 1); + data.put(key, value); + } + } + } + } catch (Exception e) { + log.error("琛屾暟鎹В鏋愬紓甯�", e); + } + return data; + } + + /** + * 閿悕鏍囧噯鍖栧鐞� + */ + private String cleanKey(String key) { + if (key == null) return ""; + // 绉婚櫎绌烘牸鍜屼腑鏂囧啋鍙� + return key.replaceAll("\\s", "").replace("锛�", ""); + } + + /** + * 閰嶇疆淇濆吇鏍囧噯鍙傛暟 + */ + private void configureStandard(EamMaintenanceStandard standard, String type, MultipartFile file) { + // 鍩虹鍙傛暟 + String filename = file.getOriginalFilename(); + if (filename != null && filename.contains(".")) { + filename = filename.substring(0, filename.lastIndexOf('.')); + } + + standard.setStandardName(filename) + .setInitialDate(new Date()) + .setStandardStatus(MaintenanceStandardStatusEnum.START.name()) + .setStandardVersion("v1.0") + .setDelFlag(0) + .setStandardCode(businessCodeRuleService.generateBusinessCodeSeq( + BusinessCodeConst.MAINTENANCE_STANDARD_CODE_RULE + )); + + // 绫诲瀷鐗瑰畾鍙傛暟 + if ("SECOND".equals(type)) { + standard.setMaintenanceCategory("SECOND_MAINTENANCE") + .setMaintenancePeriod(6) + .setPeriodUnit("鏈�"); + } else { + standard.setMaintenanceCategory("THIRD_MAINTENANCE") + .setPeriodUnit("骞�"); + + // 鑾峰彇涓夌骇淇濆吇鍛ㄦ湡 + if (standard.getEquipmentId() != null) { + EamEquipmentExtend extend = eamEquipmentExtendService.getById(standard.getEquipmentId()); + if (extend != null) { + standard.setMaintenancePeriod(extend.getThirdMaintenancePeriod()); + } + } + } + } + + /** + * 鎻愬彇浜岀骇淇濆吇椤圭洰 + */ + private List<EamMaintenanceStandardDetail> extractSecondMaintenanceItems( + XWPFTable table, String standardId) { + + List<EamMaintenanceStandardDetail> items = new ArrayList<>(); + EamMaintenanceStandardDetailCategory currentCategory = null; + + for (int i = 0; i < table.getNumberOfRows(); i++) { + XWPFTableRow row = table.getRow(i); + if (row == null) continue; + + // 妫�鏌ユ槸鍚︽槸鏍囬琛岋紙缁翠慨浜哄憳淇濆吇鍐呭鎴栨搷浣滀汉鍛樹繚鍏诲唴瀹癸級 + String firstCell = getCellText(row.getCell(0)); + if (firstCell != null) { + for (String title : SECOND_CATEGORY_MAPPING.keySet()) { + if (firstCell.contains(title)) { + currentCategory = SECOND_CATEGORY_MAPPING.get(title); + + // 妫�鏌ョ浜屽垪鍜岀涓夊垪鏄惁鏄�"搴忓彿"鍜�"淇濆吇鍐呭" + if (row.getTableCells().size() > 2) { + String secondCell = getCellText(row.getCell(1)); + String thirdCell = getCellText(row.getCell(2)); + + // 鏄庣‘璺宠繃鏍囬琛� + if ("搴忓彿".equals(secondCell) && "淇濆吇鍐呭".equals(thirdCell)) { + continue; // 璺宠繃杩欎竴琛� + } + } + + // 灏濊瘯鎻愬彇鏍囬琛屼腑鐨勯」鐩紙濡傛灉瀛樺湪锛� + if (row.getTableCells().size() > 2) { + String content = getCellText(row.getCell(2)); + if (content != null && !content.trim().isEmpty() && + !"淇濆吇鍐呭".equals(content.trim())) { // 杩囨护鏃犳晥鍐呭 + items.add(createItem(currentCategory, content.trim(), standardId)); + } + } + continue; + } + } + } + + // 澶勭悊鏅�氶」鐩 + if (currentCategory != null && isValidItemRow(row)) { + // 鑾峰彇鍐呭 + String content = row.getTableCells().size() > 2 ? + getCellText(row.getCell(2)) : ""; + + // 鎺掗櫎鏍囬鍐呭 + if ("淇濆吇鍐呭".equals(content) || + "搴忓彿".equals(content) || + content.contains("缁翠慨浜哄憳淇濆吇鍐呭") || + content.contains("鎿嶄綔浜哄憳淇濆吇鍐呭")) { + continue; + } + + EamMaintenanceStandardDetail item = new EamMaintenanceStandardDetail(); + item.setItemCategory(String.valueOf(currentCategory)); + item.setStandardId(standardId); + item.setItemName(cleanContent(content)); + + // 澶勭悊搴忓彿锛堢浜屽垪锛� + if (row.getTableCells().size() > 1) { + String seqText = getCellText(row.getCell(1)); + try { + if (seqText != null && !seqText.trim().isEmpty()) { + item.setItemCode(Integer.parseInt(seqText.trim())); + } + } catch (NumberFormatException e) { + // 蹇界暐搴忓彿瑙f瀽閿欒 + } + } + + items.add(item); + } + } + return items; + } + + /** + * 鍒涘缓淇濆吇椤圭洰 + */ + private EamMaintenanceStandardDetail createItem( + EamMaintenanceStandardDetailCategory category, + String content, + String standardId) { + + EamMaintenanceStandardDetail item = new EamMaintenanceStandardDetail(); + item.setItemCategory(category.name()); + item.setStandardId(standardId); + item.setItemName(cleanContent(content)); + return item; + } + + /** + * 鎻愬彇涓夌骇淇濆吇椤圭洰锛堟棤绫诲瀷锛� + */ + private List<EamMaintenanceStandardDetail> extractThirdMaintenanceItems( + XWPFTable table, String standardId) { + + List<EamMaintenanceStandardDetail> items = new ArrayList<>(); + String currentPart = ""; + int itemCount = 1; + + // 浠庣涓夎寮�濮嬶紙璺宠繃琛ㄥご鍜岃澶囦俊鎭級 + for (int i = 2; i < table.getNumberOfRows(); i++) { + XWPFTableRow row = table.getRow(i); + if (row == null || isRowEmpty(row)) continue; + + // 璺宠繃"淇濆吇閮ㄤ綅"鏍囬琛� + String firstCell = getCellText(row.getCell(0)); + if ("淇濆吇閮ㄤ綅".equals(firstCell)) { + continue; + } + + EamMaintenanceStandardDetail item = new EamMaintenanceStandardDetail(); + // 涓夌骇淇濆吇涓嶉渶瑕佺被鍨嬶紝涓嶈缃甶temCategory + item.setStandardId(standardId); + item.setItemCode(itemCount++); + + // 澶勭悊閮ㄤ綅鍒� + if (!row.getTableCells().isEmpty()) { + String partCell = getCellText(row.getCell(0)); + if (!partCell.trim().isEmpty()) { + currentPart = partCell.trim(); + } + } + item.setItemPart(currentPart); + + // 鏍规嵁鍒楁暟纭畾鍐呭鍜屾爣鍑嗙殑浣嶇疆 + int cellCount = row.getTableCells().size(); + if (cellCount == 3) { // 閮ㄤ綅|鍐呭|鏍囧噯 + item.setItemName(getCellText(row.getCell(1))); + item.setItemDemand(getCellText(row.getCell(2))); + } + else if (cellCount == 2) { // 鍐呭|鏍囧噯 + item.setItemName(getCellText(row.getCell(0))); + item.setItemDemand(getCellText(row.getCell(1))); + } + else if (cellCount == 1) { // 鍗曞垪鍐呭 + item.setItemName(getCellText(row.getCell(0))); + } + else if (cellCount > 3) { // 澶氬垪澶勭悊 + // 鍙栫2鍒椾綔涓哄唴瀹癸紝鏈�鍚庝竴鍒椾綔涓烘爣鍑� + item.setItemName(getCellText(row.getCell(1))); + item.setItemDemand(getCellText(row.getCell(cellCount - 1))); + } + + items.add(item); + } + return items; + } + + /** + * 鍏煎鐗堝崟鍏冩牸鏂囨湰鎻愬彇 + */ + private String getCellText(XWPFTableCell cell) { + if (cell == null) return ""; + + StringBuilder text = new StringBuilder(); + for (XWPFParagraph para : cell.getParagraphs()) { + if (para != null) { + for (XWPFRun run : para.getRuns()) { + if (run != null) { + String runText = run.getText(0); + if (runText != null) { + text.append(runText); + } + } + } + } + } + return text.toString(); + } + + /** + * 鍐呭娓呯悊 + */ + private String cleanContent(String text) { + if (text == null) return ""; + + // 鏇挎崲鐗规畩绌烘牸鍜屽悎骞惰繛缁┖鏍� + text = text.replace('\u00A0', ' ') + .replace('\u2007', ' ') + .replace('\u202F', ' ') + .replaceAll("\\s+", " "); + + // 瑙勮寖鏍囩偣绗﹀彿 + return text.replace(',', '銆�') + .replace('锛�', '銆�') + .replace(';', '锛�') + .replace('锛�', '锛�') + .replace(':', '锛�') + .replace('锛�', '锛�') + .trim(); + } + + /** + * 楠岃瘉鏈夋晥椤圭洰琛� + */ + private boolean isValidItemRow(XWPFTableRow row) { + return row != null && + row.getTableCells().size() >= 2 && + !getCellText(row.getCell(1)).trim().isEmpty(); + } + + /** + * 绌鸿妫�娴� + */ + private boolean isRowEmpty(XWPFTableRow row) { + if (row == null) return true; + for (XWPFTableCell cell : row.getTableCells()) { + String text = getCellText(cell); + if (text != null && !text.trim().isEmpty()) { + return false; + } + } + return true; + } + + /*瀵煎叆浜屼繚涓変繚鏂囦欢Excel--------------------------缁撴潫*/ + } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardDetailServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardDetailServiceImpl.java new file mode 100644 index 0000000..7a8597b --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardDetailServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.eam.service.impl; + +import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandardDetail; +import org.jeecg.modules.eam.mapper.EamTechnicalStatusEvaluationStandardDetailMapper; +import org.jeecg.modules.eam.service.IEamTechnicalStatusEvaluationStandardDetailService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 鎶�鏈姸鎬侀壌瀹氳鑼冩槑缁� + * @Author: jeecg-boot + * @Date: 2025-07-07 + * @Version: V1.0 + */ +@Service +public class EamTechnicalStatusEvaluationStandardDetailServiceImpl extends ServiceImpl<EamTechnicalStatusEvaluationStandardDetailMapper, EamTechnicalStatusEvaluationStandardDetail> implements IEamTechnicalStatusEvaluationStandardDetailService { + +} diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java new file mode 100644 index 0000000..a1c6644 --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java @@ -0,0 +1,226 @@ +package org.jeecg.modules.eam.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.exception.JeecgBootException; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.common.util.SimpleVersionGenerateUtil; +import org.jeecg.modules.eam.base.entity.BaseFactory; +import org.jeecg.modules.eam.base.entity.BaseFactoryUser; +import org.jeecg.modules.eam.base.service.IBaseFactoryService; +import org.jeecg.modules.eam.base.service.IBaseFactoryUserService; +import org.jeecg.modules.eam.constant.TechnicalStatusEvaluationStandardEnum; +import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandard; +import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandardDetail; +import org.jeecg.modules.eam.mapper.EamTechnicalStatusEvaluationStandardMapper; +import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationStandardRequest; +import org.jeecg.modules.eam.service.IEamTechnicalStatusEvaluationStandardDetailService; +import org.jeecg.modules.eam.service.IEamTechnicalStatusEvaluationStandardService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Description: 鎶�鏈姸鎬侀壌瀹氳鑼� + * @Author: jeecg-boot + * @Date: 2025-07-07 + * @Version: V1.0 + */ +@Service +public class EamTechnicalStatusEvaluationStandardServiceImpl extends ServiceImpl<EamTechnicalStatusEvaluationStandardMapper, EamTechnicalStatusEvaluationStandard> implements IEamTechnicalStatusEvaluationStandardService { + + @Autowired + private IBaseFactoryUserService baseFactoryUserService; + @Autowired + private IBaseFactoryService baseFactoryService; + @Autowired + private IEamTechnicalStatusEvaluationStandardDetailService standardDetailService; + + @Override + public IPage<EamTechnicalStatusEvaluationStandard> queryPageList(Page<EamTechnicalStatusEvaluationStandard> page, EamTechnicalStatusEvaluationStandard query) { + QueryWrapper<EamTechnicalStatusEvaluationStandard> queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("ems.del_flag", CommonConstant.DEL_FLAG_0); + //鐢ㄦ埛鏁版嵁鏉冮檺 + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + if (sysUser == null) { + return page; + } + if (StringUtils.isNotBlank(sysUser.getEamEquipmentIds())) { + //閫夋嫨浜嗚澶囷紝鏍规嵁璁惧id杩囨护璁惧 + List<String> equipArr = Arrays.asList(sysUser.getEamEquipmentIds().split(",")); + queryWrapper.in("e.equipment_code", equipArr); + } else { + //娌℃湁閫夋嫨璁惧锛屾牴鎹腑蹇冭繃婊よ澶� + List<BaseFactoryUser> baseFactoryUserList = baseFactoryUserService. + list(new LambdaQueryWrapper<BaseFactoryUser>().eq(BaseFactoryUser::getUserId, sysUser.getId())); + if (!CollectionUtils.isEmpty(baseFactoryUserList)) { + List<String> factoryIds = baseFactoryUserList.stream().map(BaseFactoryUser::getFactoryId).collect(Collectors.toList()); + List<String> factoryCode = baseFactoryService.listByIds(factoryIds).stream().map(BaseFactory::getFactoryCode).collect(Collectors.toList()); + queryWrapper.in("e.factory_code", factoryCode); + } else { + return page; + } + } + if (query != null) { + //缂栫爜 妯$硦鏌ヨ + if (StringUtils.isNotBlank(query.getStandardCode())) { + queryWrapper.like("ems.standard_code", query.getStandardCode()); + } + //鍚嶇О 妯$硦鏌ヨ + if (StringUtils.isNotBlank(query.getStandardName())) { + queryWrapper.like("ems.standard_name", query.getStandardName()); + } + //璁惧 + if (StringUtils.isNotBlank(query.getEquipmentId())) { + queryWrapper.eq("ems.equipment_id", query.getEquipmentId()); + } + + //淇濆吇鍒嗙被 + if (StringUtils.isNotBlank(query.getStandardStatus())) { + queryWrapper.eq("ems.standard_status", query.getStandardStatus()); + } + } + queryWrapper.orderByDesc("ems.create_time"); + return this.getBaseMapper().queryPageList(page, queryWrapper); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean addEamTechnicalStatusEvaluationStandard(EamTechnicalStatusEvaluationStandardRequest request) { + EamTechnicalStatusEvaluationStandard entity = new EamTechnicalStatusEvaluationStandard(); + BeanUtils.copyProperties(request, entity); + entity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.WAIT_SUBMIT.name()); + //鐗堟湰閫掑 + entity.setStandardVersion(SimpleVersionGenerateUtil.getInitVersion()); + //璁惧澶勭悊 + entity.setEquipmentId(request.getEquipmentId()); + //鍒犻櫎鏍囪 + entity.setDelFlag(CommonConstant.DEL_FLAG_0); + //閲嶅鎬ф牎楠� + EamTechnicalStatusEvaluationStandard exist = checkDuplicate(entity.getEquipmentId(), null); + if(exist != null){ + throw new JeecgBootException("瑙勮寖宸插瓨鍦紝涓嶈兘閲嶅娣诲姞锛�"); + } + this.getBaseMapper().insert(entity); + //澶勭悊鏄庣粏鏁版嵁 + if(CollectionUtil.isNotEmpty(request.getTableDetailList())) { + request.getTableDetailList().forEach(tableDetail -> { + tableDetail.setStandardId(entity.getId()); + }); + standardDetailService.saveBatch(request.getTableDetailList()); + } + return true; + } + + @Override + public EamTechnicalStatusEvaluationStandard checkDuplicate(String equipmentId, String id) { + LambdaQueryWrapper<EamTechnicalStatusEvaluationStandard> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(EamTechnicalStatusEvaluationStandard::getEquipmentId, equipmentId); + queryWrapper.eq(EamTechnicalStatusEvaluationStandard::getDelFlag, CommonConstant.DEL_FLAG_0); + //寰呮彁浜ゃ�佸惎鐢ㄧ姸鎬� + queryWrapper.in(EamTechnicalStatusEvaluationStandard::getStandardStatus, Arrays.asList(TechnicalStatusEvaluationStandardEnum.ENABLE.name(), TechnicalStatusEvaluationStandardEnum.WAIT_SUBMIT.name())); + queryWrapper.orderByDesc(EamTechnicalStatusEvaluationStandard::getStandardVersion); + if(StringUtils.isNotBlank(id)){ + queryWrapper.ne(EamTechnicalStatusEvaluationStandard::getId, id); + } + List<EamTechnicalStatusEvaluationStandard> list = this.getBaseMapper().selectList(queryWrapper); + if(CollectionUtil.isEmpty(list)) { + return null; + } + return list.get(0); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean editEamTechnicalStatusEvaluationStandard(EamTechnicalStatusEvaluationStandardRequest request) { + EamTechnicalStatusEvaluationStandard entity = this.getBaseMapper().selectById(request.getId()); + if(entity == null){ + throw new JeecgBootException("缂栬緫鐨勬暟鎹凡鍒犻櫎锛岃鍒锋柊閲嶈瘯锛�"); + } + entity.setStandardName(request.getStandardName()); + entity.setEvaluationPeriod(request.getEvaluationPeriod()); + this.getBaseMapper().updateById(entity); + //澶勭悊璇︽儏 + if(CollectionUtil.isNotEmpty(request.getTableDetailList())) { + List<EamTechnicalStatusEvaluationStandardDetail> addList = new ArrayList<>(); + List<EamTechnicalStatusEvaluationStandardDetail> updateList = new ArrayList<>(); + request.getTableDetailList().forEach(tableDetail -> { + tableDetail.setStandardId(entity.getId()); + if(tableDetail.getId() == null){ + addList.add(tableDetail); + }else { + updateList.add(tableDetail); + } + }); + if(CollectionUtil.isNotEmpty(addList)){ + standardDetailService.saveBatch(addList); + } + if(CollectionUtil.isNotEmpty(updateList)){ + standardDetailService.updateBatchById(updateList); + } + } + if(CollectionUtil.isNotEmpty(request.getRemoveDetailList())) { + List<String> ids = request.getRemoveDetailList().stream().map(EamTechnicalStatusEvaluationStandardDetail::getId).collect(Collectors.toList()); + standardDetailService.removeBatchByIds(ids); + } + return true; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean upgrade(EamTechnicalStatusEvaluationStandardRequest request) { + EamTechnicalStatusEvaluationStandard entity = this.getBaseMapper().selectById(request.getId()); + if(entity == null){ + throw new JeecgBootException("鍗囩増鐨勬暟鎹凡鍒犻櫎锛岃鍒锋柊閲嶈瘯锛�"); + } + + //鏂板涓�涓増鏈� + EamTechnicalStatusEvaluationStandard newEntity = new EamTechnicalStatusEvaluationStandard(); + newEntity.setStandardCode(request.getStandardCode()); + newEntity.setStandardName(request.getStandardName()); + newEntity.setEvaluationPeriod(request.getEvaluationPeriod()); + newEntity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.ENABLE.name()); + //鐗堟湰閫掑 + newEntity.setStandardVersion(SimpleVersionGenerateUtil.addVersion(entity.getStandardVersion())); + //璁惧澶勭悊 + newEntity.setEquipmentId(request.getEquipmentId()); + //鍒犻櫎鏍囪 + newEntity.setDelFlag(CommonConstant.DEL_FLAG_0); + //閲嶅鎬ф牎楠� + EamTechnicalStatusEvaluationStandard exist = checkDuplicate(newEntity.getEquipmentId(), entity.getId()); + if(exist != null){ + throw new JeecgBootException("閴村畾瑙勮寖宸插瓨鍦紝涓嶈兘閲嶅娣诲姞锛�"); + } + this.getBaseMapper().insert(newEntity); + //澶勭悊鏄庣粏鏁版嵁 + if(CollectionUtil.isNotEmpty(request.getTableDetailList())) { + request.getTableDetailList().forEach(tableDetail -> { + tableDetail.setId(null); + tableDetail.setCreateBy(null); + tableDetail.setUpdateBy(null); + tableDetail.setCreateTime(null); + tableDetail.setUpdateTime(null); + tableDetail.setStandardId(newEntity.getId()); + }); + standardDetailService.saveBatch(request.getTableDetailList()); + } + //绂佺敤鍘熸潵鐨勭増鏈� + entity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.DISABLE.name()); + this.getBaseMapper().updateById(entity); + return true; + } +} -- Gitblit v1.9.3