| | |
| | | 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.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; |
| | |
| | | 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: 保养标准 |
| | |
| | | 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); |
| | | } |
| | |
| | | |
| | | 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++; |
| | | } |
| | | file.getOriginalFilename(); |
| | | return eamMaintenanceStandardService.importPointInspectionExcel(file); |
| | | } |
| | | |
| | | // 构建响应 |
| | |
| | | response.put("successCount", successCount); |
| | | response.put("failureCount", failureCount); |
| | | |
| | | if (failureCount == 0) { |
| | | return Result.ok("所有点检文件导入成功"+response); |
| | | } else if (successCount == 0) { |
| | | return Result.error("所有点检文件导入失败", response); |
| | | } else { |
| | | return Result.error("部分点检文件导入失败", response); |
| | | } |
| | | return Result.ok("导入完成" + response); |
| | | |
| | | } catch (Exception e) { |
| | | log.error("点检导入处理异常", e); |
| | |
| | | |
| | | 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++; |
| | | } |
| | | file.getOriginalFilename(); |
| | | return eamMaintenanceStandardService.importMaintenanceStandard(file, "SECOND"); |
| | | } |
| | | |
| | | // 构建最终响应 |
| | |
| | | response.put("successCount", successCount); |
| | | response.put("failureCount", failureCount); |
| | | |
| | | if (failureCount > 0) { |
| | | return Result.error("部分文件导入失败", response); |
| | | } |
| | | |
| | | return Result.ok("所有文件导入成功"+response); |
| | | return Result.ok("导入完成"+response); |
| | | |
| | | } catch (Exception e) { |
| | | log.error("导入处理异常", e); |
| | |
| | | |
| | | 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++; |
| | | } |
| | | file.getOriginalFilename(); |
| | | return eamMaintenanceStandardService.importMaintenanceStandard(file, "THIRD"); |
| | | } |
| | | |
| | | // 构建最终响应 |
| | |
| | | response.put("successCount", successCount); |
| | | response.put("failureCount", failureCount); |
| | | |
| | | if (failureCount > 0) { |
| | | return Result.error("部分文件导入失败", response); |
| | | } |
| | | |
| | | return Result.ok("所有文件导入成功"+response); |
| | | return Result.ok("导入完成"+response); |
| | | |
| | | } catch (Exception e) { |
| | | log.error("导入处理异常", e); |