diff --git a/hw-api/hw-api-job/src/main/java/com/hw/job/api/RemoteJobService.java b/hw-api/hw-api-job/src/main/java/com/hw/job/api/RemoteJobService.java index 65f5568..4c778eb 100644 --- a/hw-api/hw-api-job/src/main/java/com/hw/job/api/RemoteJobService.java +++ b/hw-api/hw-api-job/src/main/java/com/hw/job/api/RemoteJobService.java @@ -25,4 +25,16 @@ public interface RemoteJobService { @PostMapping("/jobinner/remove/{jobIds}") R remove(@RequestHeader(SecurityConstants.FROM_SOURCE) String source, @PathVariable("jobIds") Long[] jobIds); + /** + * 通过用户名查询用户信息 + * + * @param jobId job主键 + * @param source 请求来源 + * @return 结果 + */ + @GetMapping("/jobinner/info/{jobId}") + public SysJob getJobInfo(@PathVariable("jobId") Long jobId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); + + @PostMapping("/jobinner/update") + R update(@RequestHeader(SecurityConstants.FROM_SOURCE) String source, SysJob job); } diff --git a/hw-api/hw-api-job/src/main/java/com/hw/job/api/factory/RemoteJobFallbackFactory.java b/hw-api/hw-api-job/src/main/java/com/hw/job/api/factory/RemoteJobFallbackFactory.java index 27f0484..eed81c1 100644 --- a/hw-api/hw-api-job/src/main/java/com/hw/job/api/factory/RemoteJobFallbackFactory.java +++ b/hw-api/hw-api-job/src/main/java/com/hw/job/api/factory/RemoteJobFallbackFactory.java @@ -35,6 +35,16 @@ public class RemoteJobFallbackFactory implements FallbackFactory update(String source, SysJob job) { + return null; + } + }; } diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBillsLubeInstanceController.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBillsLubeInstanceController.java index bf173e6..b8627ab 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBillsLubeInstanceController.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBillsLubeInstanceController.java @@ -94,24 +94,9 @@ public class DmsBillsLubeInstanceController extends BaseController * 自动创建 * */ @PostMapping("/autoAdd") - public AjaxResult autoAdd(@RequestBody String lubeInstanceId) + public AjaxResult autoAdd(@RequestBody String lubeInstanceCode) { - String s = lubeInstanceId.replaceAll("\"", ""); - - DmsPlanLube dmsPlanLube = dmsPlanLubeService.selectDmsPlanLubeByPlanLubeId(Long.valueOf(s)); - DmsBillsLubeInstance dmsBillsLubeInstance = new DmsBillsLubeInstance(); - // DmsRepairInstance dmsRepairInstance = dmsRepairInstanceService.selectDmsRepairInstanceByRepairInstanceId(2l); - Date nowDate = DateUtils.getNowDate(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHH"); - String strDate = sdf.format(nowDate); - dmsBillsLubeInstance.setPlanLubeId(dmsPlanLube.getPlanLubeId()); - dmsBillsLubeInstance.setBillsLubeCode(strDate); - - - - return toAjax(dmsBillsLubeInstanceService.insertDmsBillsLubeInstance(dmsBillsLubeInstance)); - - + return toAjax(dmsBillsLubeInstanceService.insertDmsBillsLubeInstance(lubeInstanceCode)); } diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBillsMaintInstanceController.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBillsMaintInstanceController.java index 324c6c5..3096b84 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBillsMaintInstanceController.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsBillsMaintInstanceController.java @@ -94,9 +94,7 @@ public class DmsBillsMaintInstanceController extends BaseController @PostMapping("/autoAdd") public AjaxResult autoAdd(@RequestBody String planMaintCode) { - String planMaintCodeS = planMaintCode.replaceAll("\"", ""); - DmsPlanMaint dmsPlanMaint = dmsPlanMaintService.selectDmsPlanMaintJoinByPlanMaintCode(planMaintCodeS); - return toAjax(dmsBillsMaintInstanceService.insertDmsBillsMaintInstance(dmsPlanMaint)); + return toAjax(dmsBillsMaintInstanceService.insertDmsBillsMaintInstance(planMaintCode)); } /** diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsPlanLubeDetailController.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsPlanLubeDetailController.java index 5fd5c34..1fbd35c 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsPlanLubeDetailController.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/controller/DmsPlanLubeDetailController.java @@ -152,6 +152,7 @@ public class DmsPlanLubeDetailController extends BaseController @GetMapping(value = "/getBaseDeviceLedgers") public AjaxResult getBaseDeviceLedgers(DmsBaseDeviceLedger dmsBaseDeviceLedger) { + System.out.println(dmsBaseDeviceLedgerService.selectDmsBaseDeviceLedgerList(dmsBaseDeviceLedger)); return success(dmsBaseDeviceLedgerService.selectDmsBaseDeviceLedgerList(dmsBaseDeviceLedger)); } diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsPlanLube.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsPlanLube.java index 2dfbce9..5f05d1f 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsPlanLube.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/domain/DmsPlanLube.java @@ -1,6 +1,8 @@ package com.hw.dms.domain; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -64,6 +66,8 @@ public class DmsPlanLube extends BaseEntity private Long timeLimitHours; private String cronExpression; + private List dmsPlanLubeDetailList; + public Long getTimeLimitDays() { return timeLimitDays; } @@ -188,6 +192,14 @@ public class DmsPlanLube extends BaseEntity return isFlag; } + public List getDmsPlanLubeDetailList() { + return dmsPlanLubeDetailList; + } + + public void setDmsPlanLubeDetailList(List dmsPlanLubeDetailList) { + this.dmsPlanLubeDetailList = dmsPlanLubeDetailList; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsBillsLubeInstanceMapper.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsBillsLubeInstanceMapper.java index 419da30..432b55f 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsBillsLubeInstanceMapper.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsBillsLubeInstanceMapper.java @@ -1,6 +1,8 @@ package com.hw.dms.mapper; import java.util.List; + +import com.hw.dms.domain.DmsBillsLubeDetail; import com.hw.dms.domain.DmsBillsLubeInstance; /** @@ -62,6 +64,13 @@ public interface DmsBillsLubeInstanceMapper + /** + * 批量新增润滑工单明细 + * + * @param dmsBillsLubeDetailList 润滑工单明细列表 + * @return 结果 + */ + public int batchDmsBillsLubeDetail(List dmsBillsLubeDetailList); /** * 查询最新一条润滑工单,Join 第一步实例节点 diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsPlanLubeMapper.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsPlanLubeMapper.java index 938800e..d3257c3 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsPlanLubeMapper.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/mapper/DmsPlanLubeMapper.java @@ -71,4 +71,14 @@ public interface DmsPlanLubeMapper * @return 润滑计划 */ public DmsPlanLube selectDmsPlanLubeJoinByPlanLubeCode(String planLubeCode); + + + /** + * 查询润滑计划,Join job + * + * @param planLubeId 润滑计划主键 + * @return 润滑计划 + */ + public DmsPlanLube selectPlanLubeJoinJobByPlanLubeId(Long planLubeId); + } diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBillsLubeInstanceService.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBillsLubeInstanceService.java index 2783fed..3bb35f9 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBillsLubeInstanceService.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBillsLubeInstanceService.java @@ -4,6 +4,7 @@ import java.util.List; import com.hw.dms.domain.DmsBillsLubeDetail; import com.hw.dms.domain.DmsBillsLubeInstance; +import com.hw.dms.domain.DmsPlanLube; import org.springframework.transaction.annotation.Transactional; /** @@ -30,6 +31,17 @@ public interface IDmsBillsLubeInstanceService */ public List selectDmsBillsLubeInstanceList(DmsBillsLubeInstance dmsBillsLubeInstance); + + /** + * 新增润滑工单 + * + * @param lubeInstanceCode 润滑计划编号 + * @return 结果 + */ + public int insertDmsBillsLubeInstance(String lubeInstanceCode); + + + /** * 新增润滑工单 * diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBillsMaintInstanceService.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBillsMaintInstanceService.java index 1ab6c10..bc0d02d 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBillsMaintInstanceService.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/IDmsBillsMaintInstanceService.java @@ -34,10 +34,10 @@ public interface IDmsBillsMaintInstanceService /** * 新增保养工单 * - * @param dmsPlanMaint 保养计划 + * @param planMaintCode 保养计划编号 * @return 结果 */ - public int insertDmsBillsMaintInstance(DmsPlanMaint dmsPlanMaint); + public int insertDmsBillsMaintInstance(String planMaintCode); /** * 修改保养工单 diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBillsLubeInstanceServiceImpl.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBillsLubeInstanceServiceImpl.java index c50a940..55c0833 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBillsLubeInstanceServiceImpl.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBillsLubeInstanceServiceImpl.java @@ -1,6 +1,7 @@ package com.hw.dms.service.impl; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -10,6 +11,7 @@ import com.hw.common.core.constant.SecurityConstants; import com.hw.common.core.exception.ServiceException; import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.StringUtils; +import com.hw.common.core.utils.uuid.Seq; import com.hw.common.security.utils.SecurityUtils; import com.hw.dms.domain.*; import com.hw.dms.mapper.DmsBillsLubeDetailMapper; @@ -68,6 +70,61 @@ public class DmsBillsLubeInstanceServiceImpl implements IDmsBillsLubeInstanceSer return dmsBillsLubeInstanceMapper.selectDmsBillsLubeInstanceList(dmsBillsLubeInstance); } + /** + * 新增润滑工单 + * + * @param lubeInstanceCode 润滑计划编号 + * @return 结果 + */ + @Override + @Transactional + public int insertDmsBillsLubeInstance(String lubeInstanceCode) { + String lubeInstanceCodeS = lubeInstanceCode.replaceAll("\"", ""); + + DmsPlanLube dmsPlanLube = dmsPlanLubeMapper.selectDmsPlanLubeJoinByPlanLubeCode(lubeInstanceCodeS); + + List planLubeDetails = dmsPlanLube.getDmsPlanLubeDetailList(); + if (planLubeDetails == null || planLubeDetails.isEmpty()) { + return 0; + } + DmsBillsLubeInstance dmsBillsLubeInstance = new DmsBillsLubeInstance(); + + Date lubeTime = dmsPlanLube.getLubeTime(); + dmsBillsLubeInstance.setPlanLubeId(dmsPlanLube.getPlanLubeId()); + dmsBillsLubeInstance.setCreateTime(DateUtils.getNowDate()); + dmsBillsLubeInstance.setPlanBeginTime(lubeTime); + dmsBillsLubeInstance.setBillsLubeCode(Seq.getId(Seq.lubeInstanceSeqType, Seq.lubeInstanceCode)); + dmsBillsLubeInstance.setLubeStatus(DmsConstants.DMS_BILLS_LUBE_INSTANCE_STATUS_TO_LUBE); + dmsBillsLubeInstance.setLubeGroup(dmsPlanLube.getLubeGroup()); + dmsBillsLubeInstance.setLubeSupervisor(dmsPlanLube.getLubeSupervisor()); + dmsBillsLubeInstance.setLubeLevel(dmsPlanLube.getLubeLevel()); + + Long timeLimit = dmsPlanLube.getTimeLimit(); + dmsBillsLubeInstance.setIsFlag("1"); + dmsBillsLubeInstance.setPlanEndTime(new Date(lubeTime.getTime() + timeLimit * 1000l)); + int i = dmsBillsLubeInstanceMapper.insertDmsBillsLubeInstance(dmsBillsLubeInstance); + + batchInsertDmsBillsLubeDetail(dmsPlanLube, dmsBillsLubeInstance.getLubeInstanceId()); + return i; + } + + public void batchInsertDmsBillsLubeDetail(DmsPlanLube dmsPlanLube, Long lubeInstanceId) { + List planLubeDetails = dmsPlanLube.getDmsPlanLubeDetailList(); + List billsLubeDetails = new ArrayList<>(); + planLubeDetails.forEach(planLubeDetail -> { + DmsBillsLubeDetail dmsBillsLubeDetail = new DmsBillsLubeDetail(); + dmsBillsLubeDetail.setLubeInstanceId(lubeInstanceId); + dmsBillsLubeDetail.setDeviceId(planLubeDetail.getDeviceId()); + dmsBillsLubeDetail.setLubeStationId(planLubeDetail.getLubeStationId()); + dmsBillsLubeDetail.setLubeStandardId(planLubeDetail.getLubeStandardId()); + dmsBillsLubeDetail.setIsFlag(1L); + billsLubeDetails.add(dmsBillsLubeDetail); + }); + + dmsBillsLubeInstanceMapper.batchDmsBillsLubeDetail(billsLubeDetails); + } + + /** * 新增润滑工单 * diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBillsMaintInstanceServiceImpl.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBillsMaintInstanceServiceImpl.java index e86f414..dd17c5c 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBillsMaintInstanceServiceImpl.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsBillsMaintInstanceServiceImpl.java @@ -69,16 +69,24 @@ public class DmsBillsMaintInstanceServiceImpl implements IDmsBillsMaintInstanceS /** * 新增保养工单 * - * @param dmsPlanMaint 保养计划 + * @param planMaintCode 保养计划编号 * @return 结果 */ @Override @Transactional - public int insertDmsBillsMaintInstance(DmsPlanMaint dmsPlanMaint) { + public int insertDmsBillsMaintInstance(String planMaintCode) { + String planMaintCodeS = planMaintCode.replaceAll("\"", ""); + DmsPlanMaint dmsPlanMaint = dmsPlanMaintMapper.selectDmsPlanMaintJoinByPlanMaintCode(planMaintCodeS); + List planMaintDetails = dmsPlanMaint.getDmsPlanMaintDetailList(); + if (planMaintDetails == null || planMaintDetails.isEmpty()) { + return 0; + } + DmsBillsMaintInstance dmsBillsMaintInstance = new DmsBillsMaintInstance(); dmsBillsMaintInstance.setCreateTime(DateUtils.getNowDate()); dmsBillsMaintInstance.setPlanBeginTime(dmsPlanMaint.getMaintTime()); + dmsBillsMaintInstance.setPlanMaintId(dmsPlanMaint.getPlanMaintId()); dmsBillsMaintInstance.setBillsMaintCode(Seq.getId(Seq.maintInstanceSeqType, Seq.maintInstanceCode)); dmsBillsMaintInstance.setMaintStatus(DmsConstants.DMS_BILLS_MAINT_INSTANCE_STATUS_TO_MAINT); dmsBillsMaintInstance.setMaintGroup(dmsPlanMaint.getMaintGroup()); @@ -96,12 +104,22 @@ public class DmsBillsMaintInstanceServiceImpl implements IDmsBillsMaintInstanceS return i; } - /** - * 修改保养工单 - * - * @param dmsBillsMaintInstance 保养工单 - * @return 结果 - */ + public void batchInsertDmsBillsMaintDetail(DmsPlanMaint dmsPlanMaint, Long maintInstanceId) { + List planMaintDetails = dmsPlanMaint.getDmsPlanMaintDetailList(); + List billsMaintDetails = new ArrayList<>(); + planMaintDetails.forEach(planMaintDetail -> { + DmsBillsMaintDetail dmsBillsMaintDetail = new DmsBillsMaintDetail(); + dmsBillsMaintDetail.setMaintInstanceId(maintInstanceId); + dmsBillsMaintDetail.setDeviceId(planMaintDetail.getDeviceId()); + dmsBillsMaintDetail.setStationId(planMaintDetail.getMaintStationId()); + dmsBillsMaintDetail.setMaintStandardId(planMaintDetail.getMaintStandardId()); + dmsBillsMaintDetail.setIsFlag(1L); + billsMaintDetails.add(dmsBillsMaintDetail); + }); + + dmsBillsMaintInstanceMapper.batchDmsBillsMaintDetail(billsMaintDetails); + } + @Override public int updateDmsBillsMaintInstance(DmsBillsMaintInstance dmsBillsMaintInstance) { dmsBillsMaintInstance.setUpdateTime(DateUtils.getNowDate()); @@ -176,23 +194,6 @@ public class DmsBillsMaintInstanceServiceImpl implements IDmsBillsMaintInstanceS } - public void batchInsertDmsBillsMaintDetail(DmsPlanMaint dmsPlanMaint, Long maintInstanceId) { - List planMaintDetails = dmsPlanMaint.getDmsPlanMaintDetailList(); - List billsMaintDetails = new ArrayList<>(); - planMaintDetails.forEach(planMaintDetail -> { - DmsBillsMaintDetail dmsBillsMaintDetail = new DmsBillsMaintDetail(); - dmsBillsMaintDetail.setMaintInstanceId(maintInstanceId); - dmsBillsMaintDetail.setDeviceId(planMaintDetail.getDeviceId()); - dmsBillsMaintDetail.setStationId(planMaintDetail.getMaintStationId()); - dmsBillsMaintDetail.setMaintStandardId(planMaintDetail.getMaintStandardId()); - dmsBillsMaintDetail.setIsFlag(1L); - billsMaintDetails.add(dmsBillsMaintDetail); - }); - - dmsBillsMaintInstanceMapper.batchDmsBillsMaintDetail(billsMaintDetails); - } - - /** * 开始保养 * diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanLubeServiceImpl.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanLubeServiceImpl.java index 8233c68..4e5c591 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanLubeServiceImpl.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanLubeServiceImpl.java @@ -6,14 +6,12 @@ import java.util.List; import com.hw.common.core.constant.SecurityConstants; import com.hw.common.core.domain.R; import com.hw.common.core.utils.DateUtils; +import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.uuid.Seq; import com.hw.common.security.utils.SecurityUtils; -import com.hw.dms.domain.DmsPlanMaint; -import com.hw.dms.domain.DmsPlanRepair; import com.hw.job.api.RemoteJobService; import com.hw.job.api.domain.SysJob; import com.hw.job.api.util.CronUtils; -import com.hw.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.hw.dms.mapper.DmsPlanLubeMapper; @@ -30,8 +28,7 @@ import javax.annotation.Resource; * @date 2024-01-12 */ @Service -public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService -{ +public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService { @Autowired private DmsPlanLubeMapper dmsPlanLubeMapper; @@ -45,17 +42,16 @@ public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService * @return 润滑计划 */ @Override - public DmsPlanLube selectDmsPlanLubeByPlanLubeId(Long planLubeId) - { - DmsPlanLube dmsPlanLube = dmsPlanLubeMapper.selectDmsPlanLubeByPlanLubeId(planLubeId); + public DmsPlanLube selectDmsPlanLubeByPlanLubeId(Long planLubeId) { + DmsPlanLube dmsPlanLube = dmsPlanLubeMapper.selectPlanLubeJoinJobByPlanLubeId(planLubeId); Long timeLimit = dmsPlanLube.getTimeLimit(); - if (timeLimit !=null){ + if (timeLimit != null) { Long days = timeLimit / (24 * 60 * 60l); Long hours = timeLimit % (24 * 60 * 60l); // System.out.println(days); // System.out.println(hours); dmsPlanLube.setTimeLimitDays(days); - dmsPlanLube.setTimeLimitHours(hours/(60*60l)); + dmsPlanLube.setTimeLimitHours(hours / (60 * 60l)); } return dmsPlanLube; } @@ -67,18 +63,17 @@ public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService * @return 润滑计划 */ @Override - public List selectDmsPlanLubeList(DmsPlanLube dmsPlanLube) - { + public List selectDmsPlanLubeList(DmsPlanLube dmsPlanLube) { List dmsPlanLubes = dmsPlanLubeMapper.selectDmsPlanLubeList(dmsPlanLube); - for (DmsPlanLube dmsPlanReapirFor : dmsPlanLubes){ + for (DmsPlanLube dmsPlanReapirFor : dmsPlanLubes) { Long timeLimit = dmsPlanReapirFor.getTimeLimit(); - if (timeLimit !=null){ + if (timeLimit != null) { Long days = timeLimit / (24 * 60 * 60l); Long hours = timeLimit % (24 * 60 * 60l); // System.out.println(days); // System.out.println(hours); dmsPlanReapirFor.setTimeLimitDays(days); - dmsPlanReapirFor.setTimeLimitHours(hours/(60*60l)); + dmsPlanReapirFor.setTimeLimitHours(hours / (60 * 60l)); } } return dmsPlanLubes; @@ -111,8 +106,10 @@ public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService dmsPlanLube.setLubeTime(nextExecution); dmsPlanLube.setJobId(jobIdR.getData().longValue()); dmsPlanLube.setPlanLubeCode(planLubeCode); - dmsPlanLube.setTimeLimit((dmsPlanLube.getTimeLimitDays() * 24 * 60 * 60) - + (dmsPlanLube.getTimeLimitHours() * 60 * 60)); + Long timeLimitDays = dmsPlanLube.getTimeLimitDays() == null ? 0L : dmsPlanLube.getTimeLimitDays(); + Long timeLimitHours = dmsPlanLube.getTimeLimitHours() == null ? 0L : dmsPlanLube.getTimeLimitHours(); + dmsPlanLube.setTimeLimit((timeLimitDays * 24 * 60 * 60) + + (timeLimitHours * 60 * 60)); dmsPlanLube.setIsFlag("1"); dmsPlanLube.setCreateBy(SecurityUtils.getUsername()); dmsPlanLube.setCreateTime(DateUtils.getNowDate()); @@ -128,8 +125,41 @@ public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService * @return 结果 */ @Override - public int updateDmsPlanLube(DmsPlanLube dmsPlanLube) - { + @Transactional(rollbackFor = Exception.class) + public int updateDmsPlanLube(DmsPlanLube dmsPlanLube) { + Long jobId = dmsPlanLube.getJobId(); + String cronExpression = dmsPlanLube.getCronExpression(); + if (StringUtils.isNotEmpty(cronExpression)) { + //通过cron表达式获取下一次执行时间 + Date nextExecution = CronUtils.getNextExecution(cronExpression); + dmsPlanLube.setLubeTime(nextExecution); + if (jobId == null) { + String planLubeCode = dmsPlanLube.getPlanLubeCode(); + SysJob job = new SysJob(); + job.setJobName("润滑计划编号" + planLubeCode + "工单任务"); + job.setJobGroup("DEFAULT"); + job.setInvokeTarget("ryTask.getDmsBillsLube(\"" + planLubeCode + "\")"); + job.setCronExpression(dmsPlanLube.getCronExpression()); + job.setMisfirePolicy("1"); + job.setConcurrent("1"); + job.setStatus("1"); + R jobIdR = remoteJobService.add(SecurityConstants.INNER, job); + dmsPlanLube.setJobId(jobIdR.getData().longValue()); + } else { + SysJob sysJob = remoteJobService.getJobInfo(jobId, SecurityConstants.INNER); + if (sysJob != null) { + sysJob.setCronExpression(dmsPlanLube.getCronExpression()); + remoteJobService.update(SecurityConstants.INNER, sysJob); + } + } + } + + + Long timeLimitDays = dmsPlanLube.getTimeLimitDays() == null ? 0L : dmsPlanLube.getTimeLimitDays(); + Long timeLimitHours = dmsPlanLube.getTimeLimitHours() == null ? 0L : dmsPlanLube.getTimeLimitHours(); + dmsPlanLube.setTimeLimit((timeLimitDays * 24 * 60 * 60) + + (timeLimitHours * 60 * 60)); + dmsPlanLube.setUpdateBy(SecurityUtils.getUsername()); dmsPlanLube.setUpdateTime(DateUtils.getNowDate()); return dmsPlanLubeMapper.updateDmsPlanLube(dmsPlanLube); } @@ -141,8 +171,7 @@ public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService * @return 结果 */ @Override - public int deleteDmsPlanLubeByPlanLubeIds(Long[] planLubeIds) - { + public int deleteDmsPlanLubeByPlanLubeIds(Long[] planLubeIds) { return dmsPlanLubeMapper.deleteDmsPlanLubeByPlanLubeIds(planLubeIds); } @@ -153,8 +182,7 @@ public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService * @return 结果 */ @Override - public int deleteDmsPlanLubeByPlanLubeId(Long planLubeId) - { + public int deleteDmsPlanLubeByPlanLubeId(Long planLubeId) { return dmsPlanLubeMapper.deleteDmsPlanLubeByPlanLubeId(planLubeId); } } diff --git a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanMaintDetailServiceImpl.java b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanMaintDetailServiceImpl.java index 98689be..3a6f336 100644 --- a/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanMaintDetailServiceImpl.java +++ b/hw-modules/hw-dms/src/main/java/com/hw/dms/service/impl/DmsPlanMaintDetailServiceImpl.java @@ -2,6 +2,7 @@ package com.hw.dms.service.impl; import java.util.List; import com.hw.common.core.utils.DateUtils; +import com.hw.common.security.utils.SecurityUtils; import com.hw.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -54,8 +55,7 @@ public class DmsPlanMaintDetailServiceImpl implements IDmsPlanMaintDetailService @Override public int insertDmsPlanMaintDetail(DmsPlanMaintDetail dmsPlanMaintDetail) { - LoginUser user = new LoginUser(); - dmsPlanMaintDetail.setCreateBy(user.getUsername()); + dmsPlanMaintDetail.setCreateBy(SecurityUtils.getUsername()); dmsPlanMaintDetail.setCreateTime(DateUtils.getNowDate()); dmsPlanMaintDetail.setIsFlag(1l); return dmsPlanMaintDetailMapper.insertDmsPlanMaintDetail(dmsPlanMaintDetail); @@ -70,8 +70,7 @@ public class DmsPlanMaintDetailServiceImpl implements IDmsPlanMaintDetailService @Override public int updateDmsPlanMaintDetail(DmsPlanMaintDetail dmsPlanMaintDetail) { - LoginUser user = new LoginUser(); - dmsPlanMaintDetail.setUpdateBy(user.getUsername()); + dmsPlanMaintDetail.setUpdateBy(SecurityUtils.getUsername()); dmsPlanMaintDetail.setUpdateTime(DateUtils.getNowDate()); return dmsPlanMaintDetailMapper.updateDmsPlanMaintDetail(dmsPlanMaintDetail); } diff --git a/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBillsLubeInstanceMapper.xml b/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBillsLubeInstanceMapper.xml index 536b2d7..af5a39a 100644 --- a/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBillsLubeInstanceMapper.xml +++ b/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsBillsLubeInstanceMapper.xml @@ -116,6 +116,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + insert into dms_bills_lube_detail( bills_lube_detail_id, lube_instance_id, device_id, lube_station_id, lube_standard_id, operation_description, maint_status, is_flag, remark, create_by, create_time, update_by, update_time) values + + ( #{item.billsLubeDetailId}, #{item.lubeInstanceId}, #{item.deviceId}, #{item.lubeStationId}, #{item.lubeStandardId}, #{item.operationDescription}, #{item.maintStatus}, #{item.isFlag}, #{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}) + + + + + and plan_lube_id = #{planLubeId} + and device_id = #{deviceId} + and lube_station_id = #{lubeStationId} + and lube_standard_id = #{lubeStandardId} + and operation_description = #{operationDescription} + and is_flag = #{isFlag} + + + + + + + insert into dms_plan_lube_detail + + plan_lube_id, + device_id, + lube_station_id, + lube_standard_id, + operation_description, + is_flag, + remark, + create_by, + create_time, + update_by, + update_time, + + + #{planLubeId}, + #{deviceId}, + #{lubeStationId}, + #{lubeStandardId}, + #{operationDescription}, + #{isFlag}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update dms_plan_lube_detail + + plan_lube_id = #{planLubeId}, + device_id = #{deviceId}, + lube_station_id = #{lubeStationId}, + lube_standard_id = #{lubeStandardId}, + operation_description = #{operationDescription}, + is_flag = #{isFlag}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where plan_lube_detail_id = #{planLubeDetailId} + + + + delete from dms_plan_lube_detail where plan_lube_detail_id = #{planLubeDetailId} + + + + delete from dms_plan_lube_detail where plan_lube_detail_id in + + #{planLubeDetailId} + + + \ No newline at end of file diff --git a/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsPlanLubeMapper.xml b/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsPlanLubeMapper.xml index f393eee..747e7ab 100644 --- a/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsPlanLubeMapper.xml +++ b/hw-modules/hw-dms/src/main/resources/mapper/dms/DmsPlanLubeMapper.xml @@ -21,6 +21,8 @@ + + @@ -150,4 +152,12 @@ left join dms_plan_lube_detail b on b.plan_lube_id = a.plan_lube_id where a.plan_lube_code = #{planLubeCode} + + diff --git a/hw-ui/src/views/dms/lube/index.vue b/hw-ui/src/views/dms/lube/index.vue index e657e01..65824fc 100644 --- a/hw-ui/src/views/dms/lube/index.vue +++ b/hw-ui/src/views/dms/lube/index.vue @@ -17,14 +17,7 @@ - - - + @@ -48,73 +41,7 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - + 搜索 重置 @@ -154,7 +81,7 @@ v-hasPermi="['dms:lube:remove']" >删除 - + @@ -172,18 +99,6 @@ - - -