| | |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | 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.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 org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description: 技术状态鉴定规范 |
| | |
| | | if (CollectionUtil.isEmpty(request.getTableDetailList())) { |
| | | return Result.error("检查项不能为空!"); |
| | | } |
| | | String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.MAINTENANCE_STANDARD_CODE_RULE); |
| | | String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.TECHNICAL_STATUS_EVALUATION_STANDARD_CODE_RULE); |
| | | request.setStandardCode(codeSeq); |
| | | boolean b = eamTechnicalStatusEvaluationStandardService.addEamTechnicalStatusEvaluationStandard(request); |
| | | if (!b) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * 升版 |
| | | * |
| | | * @param id |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "技术状态鉴定规范-通过id删除") |
| | | @ApiOperation(value = "技术状态鉴定规范-通过id删除", notes = "技术状态鉴定规范-通过id删除") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
| | | eamTechnicalStatusEvaluationStandardService.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.eamTechnicalStatusEvaluationStandardService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("批量删除成功!"); |
| | | @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("升版成功!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 通过excel导入数据 |
| | | * 提交 |
| | | * @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("提交成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 安全装置检查明细导入 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/importSafetyEquipmentCheck") |
| | | public Result<?> importSafetyEquipmentCheck(HttpServletRequest request) { |
| | | 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 = eamTechnicalStatusEvaluationStandardService.importSafetyEquipmentCheck(file); |
| | | |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | | * 安全装置检查明细导入 |
| | | * |
| | | * @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); |
| | | @PostMapping(value = "/importPrecisionCheck") |
| | | public Result<?> importPrecisionCheck(HttpServletRequest request, HttpServletResponse response) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 安全装置检查明细导入 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/importOtherCheck") |
| | | public Result<?> importOtherCheck(HttpServletRequest request, HttpServletResponse response) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |