From 51ebb09a85d622cae75dc169b4c86723977d3756 Mon Sep 17 00:00:00 2001 From: yangkang <yangkang@xalxzn.com> Date: 星期三, 13 九月 2023 15:39:48 +0800 Subject: [PATCH] 预测维护修改 --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanController.java | 418 +++++-------------------------------- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanWarnServiceImpl.java | 30 ++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkPlanSparePartMapper.xml | 4 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanWarnService.java | 3 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java | 2 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanSparePartService.java | 3 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanParameterService.java | 4 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java | 6 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanService.java | 4 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java | 2 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanServiceImpl.java | 42 +++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanSparePartServiceImpl.java | 27 ++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EquipmentChangeMapper.xml | 4 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkPlanMapper.xml | 12 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java | 6 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml | 22 ++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanParameterServiceImpl.java | 30 + 17 files changed, 232 insertions(+), 387 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java index 4d588b7..8418ba5 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java @@ -192,6 +192,12 @@ return Result.OK(pageList); } + @GetMapping(value = "/pageEquipment") + public Result<IPage<Equipment>> pageEquipment(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { + IPage<Equipment> pageList = equipmentService.pageEquipment(pageNo, pageSize, params); + return Result.OK(pageList); + } + /** * 娣诲姞 * diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanController.java index a3b32f6..fb8d2c5 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanController.java @@ -1,39 +1,24 @@ 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.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; -import org.apache.shiro.SecurityUtils; -import org.jeecg.common.api.dto.message.MessageDTO; 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.api.ISysBaseAPI; +import org.jeecg.common.exception.ExceptionCast; import org.jeecg.common.system.base.controller.JeecgController; -import org.jeecg.common.system.base.entity.SysUpload; -import org.jeecg.common.system.query.QueryGenerator; -import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.eam.entity.*; -import org.jeecg.modules.eam.model.DepartVo; import org.jeecg.modules.eam.service.*; -import org.jeecgframework.poi.excel.ExcelImportUtil; -import org.jeecgframework.poi.excel.entity.ImportParams; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.springframework.web.servlet.ModelAndView; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Arrays; +import java.lang.reflect.Executable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.Map; @@ -44,7 +29,6 @@ @Autowired private IPredictiveWorkPlanService predictiveWorkPlanService; - /** * 棰勬祴鎬х淮鎶ゆ柟妗� 鍒楄〃 @@ -81,343 +65,59 @@ return Result.OK("缂栬緫鎴愬姛!"); } -// /** -// * 閫氳繃id鍒犻櫎 -// * -// * @param id -// * @return -// */ -// @AutoLog(value = "mom_eam_equipment-閫氳繃id鍒犻櫎") -// @ApiOperation(value="mom_eam_equipment-閫氳繃id鍒犻櫎", notes="mom_eam_equipment-閫氳繃id鍒犻櫎") -// //@RequiresPermissions("org.jeecg.modules.demo:mom_eam_equipment:delete") -// @DeleteMapping(value = "/delete") -// public Result<String> delete(@RequestParam(name="id",required=true) String id) { -// Equipment equipment = equipmentService.getById(id); -// equipment.setDelFlag(1); -// equipmentService.updateById(equipment); -// return Result.OK("鍒犻櫎鎴愬姛!"); -// } -// -// /** -// * 鎵归噺鍒犻櫎 -// * -// * @param ids -// * @return -// */ -// @AutoLog(value = "mom_eam_equipment-鎵归噺鍒犻櫎") -// @ApiOperation(value="mom_eam_equipment-鎵归噺鍒犻櫎", notes="mom_eam_equipment-鎵归噺鍒犻櫎") -// //@RequiresPermissions("org.jeecg.modules.demo:mom_eam_equipment:deleteBatch") -// @DeleteMapping(value = "/deleteBatch") -// public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { -// List<String> stringList = Arrays.asList(ids.split(",")); -// for (String id : stringList) { -// Equipment equipment = equipmentService.getById(id); -// equipment.setDelFlag(1); -// equipmentService.updateById(equipment); -// } -//// this.equipmentService.removeByIds(Arrays.asList(ids.split(","))); -// return Result.OK("鎵归噺鍒犻櫎鎴愬姛!"); -// } -// -// /** -// * 閫氳繃id鏌ヨ -// * -// * @param id -// * @return -// */ -// //@AutoLog(value = "mom_eam_equipment-閫氳繃id鏌ヨ") -// @ApiOperation(value="mom_eam_equipment-閫氳繃id鏌ヨ", notes="mom_eam_equipment-閫氳繃id鏌ヨ") -// @GetMapping(value = "/queryById") -// public Result<Equipment> queryById(@RequestParam(name="id",required=true) String id) { -// Equipment equipment = equipmentService.getById(id); -// if(equipment==null) { -// return Result.error("鏈壘鍒板搴旀暟鎹�"); -// } -// return Result.OK(equipment); -// } -// -// /** -// * 瀵煎嚭excel -// * -// * @param request -// * @param equipment -// */ -// //@RequiresPermissions("org.jeecg.modules.demo:mom_eam_equipment:exportXls") -// @RequestMapping(value = "/exportXls") -// public ModelAndView exportXls(HttpServletRequest request, Equipment equipment) { -// return super.exportXls(request, equipment, Equipment.class, "mom_eam_equipment"); -// } -// -//// /** -//// * 閫氳繃excel瀵煎叆鏁版嵁 -//// * -//// * @param request -//// * @param response -//// * @return -//// */ -//// //@RequiresPermissions("mom_eam_equipment:importExcel") -//// @RequestMapping(value = "/importExcel", method = RequestMethod.POST) -//// public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { -//// return super.importExcel(request, response, Equipment.class); -//// } -// -// -// /** -// * 璁惧寤鸿处 鑾峰彇缁勭粐閮ㄩ棬 -// * qsw 2023-4-28 -// */ -// @GetMapping("getSysDeparts") -// public Result<?> getSysDeparts() { -// List<DepartVo> sysDeparts = equipmentService.getSysDeparts(); -// return Result.ok(sysDeparts); -// } -// -// -// /** -// *璁惧灞ュ巻 鑾峰彇璁惧浣跨敤璁板綍 -// * qsw 2023-7-28 -// */ -// @GetMapping(value = "/getResumeUseRecordList") -// public Result<?> getResumeUseRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { -// IPage<Map<String, Object>> resumeUseRecordList = equipmentService.getResumeUseRecordList(pageNo, pageSize, params); -// return Result.ok(resumeUseRecordList); -// } -// -// /** -// *璁惧灞ュ巻 鑾峰彇璁惧鐐规璁板綍 -// * qsw 2023-7-28 -// */ -// @GetMapping(value = "/getResumeInspectionRecordList") -// public Result<?> getResumeInspectionRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { -// IPage<Map<String, Object>> resumeInspectionRecordList = equipmentService.getResumeInspectionRecordList(pageNo, pageSize, params); -// LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); -// for (Map<String, Object> record : resumeInspectionRecordList.getRecords()) { -// String id = (String)record.get("id"); -// String inspectionType = (String)record.get("inspectionType"); -// if("鏃ュ父鐐规".equals(inspectionType)){ -// List<InspectionOrderDetail> failCount = inspectionOrderDetailService.lambdaQuery() -// .eq(InspectionOrderDetail::getInspectionOrderId, id) -// .eq(InspectionOrderDetail::getJudgmentResult, "fail") -// .eq(InspectionOrderDetail::getDelFlag, 0).list(); -// -// List<InspectionOrderDetail> passCount = inspectionOrderDetailService.lambdaQuery() -// .eq(InspectionOrderDetail::getInspectionOrderId, id) -// .eq(InspectionOrderDetail::getJudgmentResult,"pass") -// .eq(InspectionOrderDetail::getDelFlag, 0).list(); -// record.put("result","姝e父:"+passCount.size()+"锛�"+"寮傚父:"+failCount.size()); -// }else{ -// List<SpecialtyInspectionOrderDetail> failCount = specialtyInspectionOrderDetailService.lambdaQuery() -// .eq(SpecialtyInspectionOrderDetail::getSpecialtyInspectionOrderId, id) -// .eq(SpecialtyInspectionOrderDetail::getJudgmentResult,"fail") -// .eq(SpecialtyInspectionOrderDetail::getDelFlag, 0).list(); -// -// List<SpecialtyInspectionOrderDetail> passCount = specialtyInspectionOrderDetailService.lambdaQuery() -// .eq(SpecialtyInspectionOrderDetail::getSpecialtyInspectionOrderId, id) -// .eq(SpecialtyInspectionOrderDetail::getJudgmentResult,"pass") -// .eq(SpecialtyInspectionOrderDetail::getDelFlag, 0).list(); -// record.put("result","姝e父:"+passCount.size()+"锛�"+"寮傚父:"+failCount.size()); -// } -// } -// return Result.ok(resumeInspectionRecordList); -// } -// -// /** -// *璁惧灞ュ巻 鑾峰彇璁惧淇濆吇璁板綍 -// * qsw 2023-7-31 -// */ -// @GetMapping(value = "/getResumeMaintenanceRecordList") -// public Result<?> getResumeMaintenanceRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { -// IPage<Map<String, Object>> resumeMaintenanceRecordList = equipmentService.getResumeMaintenanceRecordList(pageNo, pageSize, params); -// return Result.ok(resumeMaintenanceRecordList); -// } -// -// /** -// *璁惧灞ュ巻 鑾峰彇璁惧缁翠慨璁板綍 -// * qsw 2023-7-31 -// */ -// @GetMapping(value = "/getResumeRepairRecordList") -// public Result<?> getResumeRepairRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { -// IPage<Map<String, Object>> resumeRepairRecordList = equipmentService.getResumeRepairRecordList(pageNo, pageSize, params); -// return Result.ok(resumeRepairRecordList); -// } -// -// /** -// *璁惧灞ュ巻 鑾峰彇璁惧妫�瀹氳褰� -// * qsw 2023-7-31 -// */ -// @GetMapping(value = "/getResumeCalibrationRecordList") -// public Result<?> getResumeCalibrationRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { -// IPage<Map<String, Object>> resumeCalibrationRecordList = equipmentService.getResumeCalibrationRecordList(pageNo, pageSize, params); -// for (Map<String, Object> record : resumeCalibrationRecordList.getRecords()) { -// String id = (String)record.get("id"); -// String status = (String)record.get("status"); -// String managementMode = (String)record.get("managementMode"); -// if("4".equals(status)){ -// if("data".equals(managementMode)){ -// List<CalibrationOrderDetail> calibrationOrderDetails = calibrationOrderDetailService.lambdaQuery() -// .eq(CalibrationOrderDetail::getCalibrationOrderId, id) -// .eq(CalibrationOrderDetail::getJudgmentResult, "fail") -// .eq(CalibrationOrderDetail::getDelFlag,"0").list(); -// if(calibrationOrderDetails.size()>0){ -// record.put("calibrationResult","寮傚父"); -// }else{ -// record.put("calibrationResult","姝e父甯�"); -// } -// }else{ -// List<CalibrationOrderReport> calibrationOrderReports = calibrationOrderReportService.lambdaQuery() -// .eq(CalibrationOrderReport::getCalibrationOrderId, id) -// .eq(CalibrationOrderReport::getJudgmentResult, "fail") -// .eq(CalibrationOrderReport::getDelFlag, "0").list(); -// if(calibrationOrderReports.size()>0){ -// record.put("calibrationResult","寮傚父"); -// }else{ -// record.put("calibrationResult","姝e父甯�"); -// } -// } -// } -// } -// return Result.ok(resumeCalibrationRecordList); -// } -// -// /** -// *璁惧灞ュ巻 鑾峰彇璁惧澶勭疆璁板綍 -// * qsw 2023-7-31 -// */ -// @GetMapping(value = "/getResumeChangeRecordList") -// public Result<?> getResumeChangeRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { -// IPage<Map<String, Object>> resumeChangeRecordList = equipmentService.getResumeChangeRecordList(pageNo, pageSize, params); -// return Result.ok(resumeChangeRecordList); -// } -// -// /** -// * 鏍规嵁鐘舵�佹煡璇㈣澶囧垪琛� -// */ -// @GetMapping(value = "/getEquipmentListByStatus") -// public Result<IPage<Equipment>> getEquipmentList(Equipment equipment,String status, -// @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, -// @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, -// HttpServletRequest req) { -// QueryWrapper<Equipment> queryWrapper = QueryGenerator.initQueryWrapper(equipment, req.getParameterMap()); -// List<String> statusList = Arrays.asList(status.split(",")); -// Page<Equipment> page = new Page<Equipment>(pageNo, pageSize); -// queryWrapper.in("equipment_status",statusList); -// IPage<Equipment> pageList = equipmentService.page(page, queryWrapper); -// return Result.OK(pageList); -// }/** -// * 瀵煎叆 -// * @return -// */ -// @RequestMapping(value = "/importExcel", method = RequestMethod.POST) -// @Transactional(rollbackFor = Exception.class) -// public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { -// MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; -// LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); -// Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); -// String exceptionInfo = ""; -// int exceptionNum = 0; -// for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { -// MultipartFile file = entity.getValue(); -// ImportParams params = new ImportParams(); -// params.setNeedSave(true); -// try { -// List<EquipmentImportVo> list = ExcelImportUtil.importExcel(file.getInputStream(), EquipmentImportVo.class, params); -// for(int i = 0;i<list.size();i++){ -// EquipmentImportVo equipmentImportVo = list.get(i); -// EquipmentCategory equipmentCategory = equipmentCategoryService.getOne(new QueryWrapper<EquipmentCategory>().eq("name",equipmentImportVo.getEquipmentCategoryName()),false); -// if( -// StringUtils.isBlank(equipmentImportVo.getNum()) -// || StringUtils.isBlank(equipmentImportVo.getName()) -// || StringUtils.isBlank(equipmentImportVo.getUseId()) -// || StringUtils.isBlank(equipmentImportVo.getEquipmentUda1()) -// || StringUtils.isBlank(equipmentImportVo.getManageId()) -// || StringUtils.isBlank(equipmentImportVo.getTeamId()) -// || StringUtils.isBlank(equipmentImportVo.getEquipmentImportanceId()) -// || StringUtils.isBlank(equipmentImportVo.getEquipmentCategoryName()) -// || StringUtils.isBlank(equipmentImportVo.getEquipmentStatus()) -// || StringUtils.isBlank(equipmentImportVo.getEquipmentUda3()) -// || StringUtils.isBlank(equipmentImportVo.getEquipmentUda5()) -// || StringUtils.isBlank(equipmentImportVo.getEquipmentUda2()) -// || StringUtils.isBlank(equipmentImportVo.getLeaveFactoryDate()) -// || StringUtils.isBlank(equipmentImportVo.getProjectApprovalNo()) -// || StringUtils.isBlank(equipmentImportVo.getFundSource()) -// || StringUtils.isBlank(equipmentImportVo.getAcceptanceCheckDate()) -// || StringUtils.isBlank(equipmentImportVo.getLeaveFactoryDate()) -// || StringUtils.isBlank(equipmentImportVo.getFactoryNo()) -// || StringUtils.isBlank(equipmentImportVo.getConstructorId()) -// || StringUtils.isBlank(equipmentImportVo.getSourceCountry()) -// || StringUtils.isBlank(equipmentImportVo.getModel()) -// || StringUtils.isBlank(equipmentImportVo.getSpecification()) -// || StringUtils.isBlank(equipmentImportVo.getGpo()) -// ){ -// exceptionInfo = exceptionInfo+"绗�"+(i+2)+"琛屽鍏ュけ璐�,鍘熷洜:鏁版嵁鏈夋湭濉」,璇峰~鍐欏繀濉」鍚庡啀瀵煎叆;"; -// exceptionNum++; -// }else if(ObjectUtils.isNull(equipmentCategory)) -// { -// exceptionInfo = exceptionInfo+"绗�"+(i+2)+"琛屽鍏ュけ璐�,鍘熷洜:璇ヨ澶囨墍灞炵被鍒笉瀛樺湪锛岃鍏堢淮鎶よ澶囩被鍒�;"; -// exceptionNum++; -// } -// else{ -// Equipment oriEquipment = equipmentService.getOne(new QueryWrapper<Equipment>().eq("num",equipmentImportVo.getNum()),false); -// if(ObjectUtils.isNull(oriEquipment)){ -// Equipment equipment = new Equipment(); -// equipment.setNum(equipmentImportVo.getNum()) -// .setName(equipmentImportVo.getName()) -// .setUseId(equipmentImportVo.getUseId()) -// .setEquipmentUda1(equipmentImportVo.getEquipmentUda1()) -// .setManageId(equipmentImportVo.getManageId()) -// .setTeamId(equipmentImportVo.getTeamId()) -// .setEquipmentImportanceId(equipmentImportVo.getEquipmentImportanceId()) -// .setEquipmentCategoryId(equipmentCategory.getId()) -// .setSpecificEquipment(equipmentImportVo.getKeyEquipmentIdentification()) -// .setSecurityConfiguration(equipmentImportVo.getSecurityConfiguration()) -// .setCoolingSystem(equipmentImportVo.getCoolingSystem()) -// .setFireExtinguisher(equipmentImportVo.getFireExtinguisher()) -// .setFireExtinguisherValidityPeriod(equipmentImportVo.getFireExtinguisherValidityPeriod()) -// .setOperatingSystem(equipmentImportVo.getOperatingSystem()) -// .setSystem(equipmentImportVo.getSystem()) -// .setPort(equipmentImportVo.getPort()) -// .setCoordinateNum(equipmentImportVo.getCoordinateNum()) -// .setEquipmentStatus(equipmentImportVo.getEquipmentStatus()) -// .setEquipmentUda3(equipmentImportVo.getEquipmentUda3()) -// .setEquipmentUda4(equipmentImportVo.getEquipmentUda4()) -// .setEquipmentUda5(equipmentImportVo.getEquipmentUda5()) -// .setLocation(equipmentImportVo.getEquipmentUda2()) -// .setLastVerificationDate(equipmentImportVo.getLeaveFactoryDate()) -// .setProjectApprovalNo(equipmentImportVo.getProjectApprovalNo()) -// .setFundSource(equipmentImportVo.getFundSource()) -// .setAcceptanceCheckDate(equipmentImportVo.getAcceptanceCheckDate()) -// .setFactoryNumber(equipmentImportVo.getFactoryNo()) -// .setConstructorId(equipmentImportVo.getConstructorId()) -// .setSourceCountry(equipmentImportVo.getSourceCountry()) -// .setModel(equipmentImportVo.getModel()) -// .setSpecification(equipmentImportVo.getSpecification()) -// .setGpo(equipmentImportVo.getGpo()); -// equipmentService.save(equipment); -// }else { -// exceptionInfo = exceptionInfo+"绗�"+(i+2)+"琛屽鍏ュけ璐ワ紝鍘熷洜锛氱粺涓�缂栫爜宸插瓨鍦紝鏁版嵁閲嶅瀵煎叆;"; -// exceptionNum++; -// } -// } -// } -// if(exceptionNum!=0){ -// String headInfo = "灏忓鎻愰啋鎮�!璁惧鍙拌处锛氬鍏ユ垚鍔�"+(list.size()-exceptionNum)+"鏉�,澶辫触"+exceptionNum+"鏉�"; -// MessageDTO messageDTO = new MessageDTO(); -// messageDTO.setTitle(headInfo); -// messageDTO.setFromUser("鏁版嵁瀵煎叆灏忓姪鎵�-灏忓"); -// messageDTO.setCategory("瀵煎叆鎿嶄綔闄勫姞淇℃伅"); -// messageDTO.setContent(exceptionInfo); -// messageDTO.setToUser(user.getUsername()); -// sysBaseApi.sendSysAnnouncement(messageDTO); -// return Result.OK(headInfo+",鍙湪-绯荤粺娑堟伅-鏌ョ湅瀵煎叆璇︽儏"); -// } -// return Result.OK("瀵煎叆鎴愬姛锛屽凡瀵煎叆鍏ㄩ儴鏁版嵁銆�"); -// } catch (Exception e) { -// log.error(e.getMessage(), e); -// return Result.error("鏂囦欢瀵煎叆澶辫触:" + e.getMessage()); -// } -// } -// return Result.error("鏂囦欢瀵煎叆澶辫触锛�"); -// } + //鍗囩増 + @RequestMapping(value = "/revise", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result<String> revise(@RequestBody PredictiveWorkPlan predictiveWorkPlan) { + predictiveWorkPlanService.revise(predictiveWorkPlan); + return Result.OK("鐢熺増鎴愬姛!"); + } + + @RequestMapping(value = "/versionTakeEffect", method = {RequestMethod.PUT, RequestMethod.POST}) + @Transactional(rollbackFor = {Exception.class}) + public Result<String> versionTakeEffect(@RequestBody PredictiveWorkPlan predictiveWorkPlan) { + + LambdaQueryChainWrapper<PredictiveWorkPlan> lambdaQuery = predictiveWorkPlanService.lambdaQuery(); + lambdaQuery.eq(PredictiveWorkPlan::getNum, predictiveWorkPlan.getNum()) + .eq(PredictiveWorkPlan::getStatus, "2").list(); + List<PredictiveWorkPlan> predictiveWorkPlanList = lambdaQuery.list(); + for (PredictiveWorkPlan temp : predictiveWorkPlanList) { + temp.setStatus("3"); + predictiveWorkPlanService.updateById(temp); + } + boolean b = predictiveWorkPlanService.updateById(predictiveWorkPlan); + if (b) { + return Result.OK("鐢熸晥鎴愬姛!"); + } else { + return Result.error("鐢熸晥澶辫触!"); + } + } + + @RequestMapping("/getReviseVersion") + public Result<?> getReviseVersion(@RequestBody PredictiveWorkPlan predictiveWorkPlan) { + List<PredictiveWorkPlan> predictiveWorkPlanList = predictiveWorkPlanService.lambdaQuery().eq(PredictiveWorkPlan::getNum, predictiveWorkPlan.getNum()) + .orderByDesc(PredictiveWorkPlan::getPlanVersion).list(); + String version = predictiveWorkPlanList.get(0).getPlanVersion(); + BigDecimal versionB = null; + if (StringUtils.isBlank(version)) { + versionB = new BigDecimal(0); + } else { + versionB = new BigDecimal(version); + } + BigDecimal versionCode = versionB.add(new BigDecimal(1)); + return Result.ok(versionCode.toString()); + } + + /** + * 閫氳繃id鍒犻櫎 + * + * @param id + * @return + */ + @DeleteMapping(value = "/delete") + public Result<String> delete(@RequestParam(name = "id", required = true) String id) { + predictiveWorkPlanService.delete(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java index 46d366c..5a79a25 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java @@ -58,4 +58,6 @@ * qsw 2023-7-31 */ IPage<Map<String, Object>> getResumeChangeRecordList(IPage<Map> pageData, @Param("params") Map<String,Object> params); + + IPage<Equipment> pageEquipment(IPage<Map> pageData,@Param("params") Map<String, Object> params); } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml index 6b7de40..efd267d 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml @@ -151,4 +151,26 @@ LEFT JOIN mom_eam_equipment_scrap_detail t5 ON t1.id = t5.equipment_change_id where t1.del_flag = '0' and (t2.equipment_id = #{params.equipmentId} or t3.equipment_id = #{params.equipmentId} or t4.equipment_id = #{params.equipmentId} or t5.equipment_id = #{params.equipmentId}) </select> + + <select id="pageEquipment" parameterType="Map" resultType="org.jeecg.modules.eam.entity.Equipment"> + SELECT + t1.id, + t1.num, + t1.name, + t1.model, + t1.specification, + t1.equipment_status equipmentStatus, + t2.item_text equipmentStatus_dictText + FROM + mom_eam_equipment t1 + LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'equipment_status' ) t2 ON t1.equipment_status = t2.item_value + WHERE t1.del_flag = '0' + <if test="params.num != 'null' and params.num != ''"> + and t1.num like concat('%',#{params.num},'%') + </if> + <if test="params.name != 'null' and params.name != ''"> + and t1.name like concat('%',#{params.name},'%') + </if> + </select> + </mapper> \ No newline at end of file diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EquipmentChangeMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EquipmentChangeMapper.xml index fa81e5a..1005f54 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EquipmentChangeMapper.xml +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EquipmentChangeMapper.xml @@ -22,8 +22,8 @@ <if test="num != 'null' and num != ''"> and num like concat('%',#{num},'%') </if> - <if test="auditStatus != 'null' and auditStatus != ''"> - and audit_status like concat('%',#{auditStatus},'%') + <if test="name != 'null' and name != ''"> + and audit_status like concat('%',#{name},'%') </if> <if test="changeMethod != 'null' and changeMethod != ''"> and change_method like concat('%',#{changeMethod},'%') diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkPlanMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkPlanMapper.xml index e5cb96e..f76295d 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkPlanMapper.xml +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkPlanMapper.xml @@ -5,6 +5,11 @@ <select id="pagePredictiveWorkPlan" parameterType="Map" resultType="Map"> SELECT t1.*, + t1.monitor_type monitorType, + t1.maintenance_method maintenanceMethod, + t1.assign_mode assignMode, + t1.equipment_id equipmentId, + t2.team_id teamId, t2.num deviceNum, t2.name deviceName, t2.model deviceModel, @@ -26,10 +31,13 @@ LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'monitor_type' ) t7 ON t7.item_value = t1.monitor_type WHERE t1.del_flag = 0 and t2.del_flag = 0 <if test="params.planNum != null and params.planNum != ''"> - and t1.num = concat('%',#{params.planNum},'%') + and t1.num like concat('%',#{params.planNum},'%') + </if> + <if test="params.status != null and params.status != ''"> + and t1.status = #{params.status} </if> <if test="params.deviceName != null and params.deviceName != ''"> - and t2.name = concat('%',#{params.deviceName},'%') + and t2.name like concat('%',#{params.deviceName},'%') </if> ORDER BY t1.create_time desc </select> diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkPlanSparePartMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkPlanSparePartMapper.xml index f3c3450..47c820c 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkPlanSparePartMapper.xml +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkPlanSparePartMapper.xml @@ -69,8 +69,8 @@ t1.duration, t1.start_time startTime, t1.start_long startLong, - t1.start_time startTime, - t1.start_long startLong + t1.end_time endTime, + t1.end_long endLong -- 鐘舵��,0:鍏虫満,1:寮�鏈�,2:寰呮満,3:宸ヤ綔,22:鎶ヨ from mdc_equipment_running_section t1 where t1.status IN (1,2,3,22) t1.equipment_id = #{mdcEquipmentId} order by start_time desc </select> diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java index 7c8a6ab..fe88276 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java @@ -53,4 +53,6 @@ * qsw 2023-7-31 */ IPage<Map<String, Object>> getResumeChangeRecordList(Integer pageNo, Integer pageSize, Map<String, Object> params); + + public IPage<Equipment> pageEquipment(Integer pageNo, Integer pageSize, Map<String, Object> params); } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanParameterService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanParameterService.java index e869120..0535f2d 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanParameterService.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanParameterService.java @@ -15,4 +15,8 @@ public IPage<Map<String, Object>> pagePredictiveWorkPlanParameter(Integer pageNo, Integer pageSize, Map<String, Object> params); public void createParameterWorkPlan(); + + public void removeByWorkPlanId(String predictiveWorkPlanId); + + void revise(String oldWorkPlanId, String workPlanId); } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanService.java index edb4914..38ca95f 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanService.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanService.java @@ -13,4 +13,8 @@ public IPage<Map<String, Object>> pagePredictiveWorkPlan(Integer pageNo, Integer pageSize, Map<String, Object> params); public List<PredictiveWorkPlan> listWorkPlan(String monitorType); + + void delete(String id); + + void revise(PredictiveWorkPlan predictiveWorkPlan); } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanSparePartService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanSparePartService.java index d207ade..7d6db96 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanSparePartService.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanSparePartService.java @@ -13,4 +13,7 @@ public void createSparePartWorkPlan(); + public void removeByWorkPlanId(String predictiveWorkPlanId); + + void revise(String oldWorkPlanId, String workPlanId); } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanWarnService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanWarnService.java index 4e34f59..e57923b 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanWarnService.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkPlanWarnService.java @@ -17,4 +17,7 @@ public void createWarnWorkPlan(); + public void removeByWorkPlanId(String predictiveWorkPlanId); + + void revise(String oldWorkPlanId, String workPlanId); } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java index 486354d..9c5660f 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java @@ -86,4 +86,10 @@ IPage<Map> pageData = new Page<Map>(pageNo, pageSize); return super.getBaseMapper().getResumeChangeRecordList(pageData,params); } + + @Override + public IPage<Equipment> pageEquipment(Integer pageNo, Integer pageSize, Map<String, Object> params) { + IPage<Map> pageData = new Page<Map>(pageNo, pageSize); + return super.getBaseMapper().pageEquipment(pageData,params); + } } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanParameterServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanParameterServiceImpl.java index 00c9b6a..1863614 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanParameterServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanParameterServiceImpl.java @@ -1,15 +1,11 @@ package org.jeecg.modules.eam.service.impl; -import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModelProperty; -import org.jeecg.common.constant.CommonConstant; -import org.jeecg.common.system.base.entity.JeecgEntity; -import org.jeecg.common.util.DateUtils; +import org.jeecg.common.util.UUIDGenerator; import org.jeecg.modules.eam.entity.PredictiveWorkOrder; import org.jeecg.modules.eam.entity.PredictiveWorkPlan; import org.jeecg.modules.eam.entity.PredictiveWorkPlanParameter; @@ -20,12 +16,9 @@ import org.jeecg.modules.eam.service.IPredictiveWorkPlanParameterHistoryService; import org.jeecg.modules.eam.service.IPredictiveWorkPlanParameterService; import org.jeecg.modules.eam.service.IPredictiveWorkPlanService; -import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.format.annotation.DateTimeFormat; import org.springframework.stereotype.Service; -import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -92,6 +85,25 @@ } } + @Override + public void removeByWorkPlanId(String predictiveWorkPlanId) { + LambdaUpdateChainWrapper<PredictiveWorkPlanParameter> lambdaUpdate = this.lambdaUpdate(); + lambdaUpdate.eq(PredictiveWorkPlanParameter::getWorkPlanId,predictiveWorkPlanId); + lambdaUpdate.remove(); + } + + @Override + public void revise(String oldWorkPlanId, String workPlanId) { + LambdaQueryChainWrapper<PredictiveWorkPlanParameter> lambdaQuery = this.lambdaQuery(); + lambdaQuery.eq(PredictiveWorkPlanParameter::getWorkPlanId,oldWorkPlanId).eq(PredictiveWorkPlanParameter::getDelFlag,0); + List<PredictiveWorkPlanParameter> insertList = lambdaQuery.list(); + for(PredictiveWorkPlanParameter predictiveWorkPlanParameter:insertList){ + predictiveWorkPlanParameter.setWorkPlanId(workPlanId); + predictiveWorkPlanParameter.setId(UUIDGenerator.generate()); + } + this.saveBatch(insertList); + } + private void createOrder(String workPlanId, String equipmentId) { PredictiveWorkOrder predictiveWorkOrder = new PredictiveWorkOrder(); predictiveWorkOrder.setWorkPlanId(workPlanId); diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanServiceImpl.java index 11e9384..ded79da 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanServiceImpl.java @@ -4,9 +4,16 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.exception.ExceptionCast; +import org.jeecg.common.util.UUIDGenerator; import org.jeecg.modules.eam.entity.PredictiveWorkPlan; import org.jeecg.modules.eam.mapper.PredictiveWorkPlanMapper; +import org.jeecg.modules.eam.service.IPredictiveWorkPlanParameterService; import org.jeecg.modules.eam.service.IPredictiveWorkPlanService; +import org.jeecg.modules.eam.service.IPredictiveWorkPlanSparePartService; +import org.jeecg.modules.eam.service.IPredictiveWorkPlanWarnService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import java.util.List; @@ -14,6 +21,19 @@ @Service public class PredictiveWorkPlanServiceImpl extends ServiceImpl<PredictiveWorkPlanMapper, PredictiveWorkPlan> implements IPredictiveWorkPlanService { + + + @Autowired + @Lazy + private IPredictiveWorkPlanWarnService predictiveWorkPlanWarnService; + + @Autowired + @Lazy + private IPredictiveWorkPlanSparePartService predictiveWorkPlanSparePartService; + + @Autowired + @Lazy + private IPredictiveWorkPlanParameterService predictiveWorkPlanParameterService; @Override public IPage<Map<String, Object>> pagePredictiveWorkPlan(Integer pageNo, Integer pageSize, Map<String, Object> params) { @@ -28,4 +48,26 @@ lambdaQuery.eq(PredictiveWorkPlan::getMonitorType,monitorType); return lambdaQuery.list(); } + + @Override + public void delete(String id) { + PredictiveWorkPlan predictiveWorkPlan = this.getById(id); + if (!"1".equals(predictiveWorkPlan.getStatus())) { + ExceptionCast.cast("璇ユ柟妗堜笉鏄湭鐢熸晥鐘舵��,涓嶈兘鍒犻櫎!"); + } + this.removeById(id); + predictiveWorkPlanWarnService.removeByWorkPlanId(id); + predictiveWorkPlanSparePartService.removeByWorkPlanId(id); + predictiveWorkPlanParameterService.removeByWorkPlanId(id); + } + + @Override + public void revise(PredictiveWorkPlan predictiveWorkPlan) { + String oldWorkPlanId = predictiveWorkPlan.getId(); + predictiveWorkPlan.setId(UUIDGenerator.generate()); + this.save(predictiveWorkPlan); + predictiveWorkPlanWarnService.revise(oldWorkPlanId,predictiveWorkPlan.getId()); + predictiveWorkPlanSparePartService.revise(oldWorkPlanId,predictiveWorkPlan.getId()); + predictiveWorkPlanParameterService.revise(oldWorkPlanId,predictiveWorkPlan.getId()); + } } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanSparePartServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanSparePartServiceImpl.java index e1ba978..0c4a646 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanSparePartServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanSparePartServiceImpl.java @@ -2,12 +2,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.modules.eam.entity.MaintenanceOrderActualMaterial; -import org.jeecg.modules.eam.entity.PredictiveWorkOrder; -import org.jeecg.modules.eam.entity.PredictiveWorkPlan; -import org.jeecg.modules.eam.entity.PredictiveWorkPlanSparePart; +import org.jeecg.common.util.UUIDGenerator; +import org.jeecg.modules.eam.entity.*; import org.jeecg.modules.eam.mapper.PredictiveWorkPlanSparePartMapper; import org.jeecg.modules.eam.model.MdcEquipmentRunningSectionVo; import org.jeecg.modules.eam.service.IPredictiveWorkOrderService; @@ -15,7 +14,6 @@ import org.jeecg.modules.eam.service.IPredictiveWorkPlanSparePartService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import sun.reflect.generics.tree.ArrayTypeSignature; import java.util.Arrays; import java.util.Date; @@ -58,6 +56,25 @@ } } + @Override + public void removeByWorkPlanId(String predictiveWorkPlanId) { + LambdaUpdateChainWrapper<PredictiveWorkPlanSparePart> lambdaUpdate = this.lambdaUpdate(); + lambdaUpdate.eq(PredictiveWorkPlanSparePart::getWorkPlanId, predictiveWorkPlanId); + lambdaUpdate.remove(); + } + + @Override + public void revise(String oldWorkPlanId, String workPlanId) { + LambdaQueryChainWrapper<PredictiveWorkPlanSparePart> lambdaQuery = this.lambdaQuery(); + lambdaQuery.eq(PredictiveWorkPlanSparePart::getWorkPlanId,oldWorkPlanId).eq(PredictiveWorkPlanSparePart::getDelFlag,0); + List<PredictiveWorkPlanSparePart> insertList = lambdaQuery.list(); + for(PredictiveWorkPlanSparePart predictiveWorkPlanSparePart:insertList){ + predictiveWorkPlanSparePart.setWorkPlanId(workPlanId); + predictiveWorkPlanSparePart.setId(UUIDGenerator.generate()); + } + this.saveBatch(insertList); + } + //娌℃湁瀵瑰簲鐨勭淮鎶ゅ伐鍗曞氨鐢熸垚宸ュ崟 private void createOrder(String workPlanId, String equipmentId, String itemId) { LambdaQueryChainWrapper<PredictiveWorkOrder> lambdaQuery = predictiveWorkOrderService.lambdaQuery(); diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanWarnServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanWarnServiceImpl.java index c1356f1..0a56743 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanWarnServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanWarnServiceImpl.java @@ -1,23 +1,18 @@ package org.jeecg.modules.eam.service.impl; -import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import io.swagger.annotations.ApiModelProperty; -import org.jeecg.common.constant.CommonConstant; -import org.jeecg.modules.eam.entity.PredictiveWorkOrder; -import org.jeecg.modules.eam.entity.PredictiveWorkPlan; -import org.jeecg.modules.eam.entity.PredictiveWorkPlanWarn; -import org.jeecg.modules.eam.entity.PredictiveWorkPlanWarnHistory; +import org.jeecg.common.util.UUIDGenerator; +import org.jeecg.modules.eam.entity.*; import org.jeecg.modules.eam.mapper.PredictiveWorkPlanWarnMapper; import org.jeecg.modules.eam.model.MdcEquipmentAlarmVo; import org.jeecg.modules.eam.service.IPredictiveWorkOrderService; import org.jeecg.modules.eam.service.IPredictiveWorkPlanService; import org.jeecg.modules.eam.service.IPredictiveWorkPlanWarnHistoryService; import org.jeecg.modules.eam.service.IPredictiveWorkPlanWarnService; -import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -87,6 +82,25 @@ } } + @Override + public void removeByWorkPlanId(String predictiveWorkPlanId) { + LambdaUpdateChainWrapper<PredictiveWorkPlanWarn> lambdaUpdate = this.lambdaUpdate(); + lambdaUpdate.eq(PredictiveWorkPlanWarn::getWorkPlanId, predictiveWorkPlanId); + lambdaUpdate.remove(); + } + + @Override + public void revise(String oldWorkPlanId, String workPlanId) { + LambdaQueryChainWrapper<PredictiveWorkPlanWarn> lambdaQuery = this.lambdaQuery(); + lambdaQuery.eq(PredictiveWorkPlanWarn::getWorkPlanId,oldWorkPlanId).eq(PredictiveWorkPlanWarn::getDelFlag,0); + List<PredictiveWorkPlanWarn> insertList = lambdaQuery.list(); + for(PredictiveWorkPlanWarn predictiveWorkPlanWarn:insertList){ + predictiveWorkPlanWarn.setWorkPlanId(workPlanId); + predictiveWorkPlanWarn.setId(UUIDGenerator.generate()); + } + this.saveBatch(insertList); + } + private void backInfo(String workPlanId, List<MdcEquipmentAlarmVo> predictiveWorkPlanWarnList) { List<PredictiveWorkPlanWarnHistory> list = new ArrayList<>(); for (MdcEquipmentAlarmVo mdcEquipmentAlarmVo : predictiveWorkPlanWarnList) { -- Gitblit v1.9.3