From 5c9f92ea3ce6692b9dda65c768f104b2e6c2c736 Mon Sep 17 00:00:00 2001 From: qushaowei <qushaowei@163.com> Date: 星期一, 04 九月 2023 15:22:14 +0800 Subject: [PATCH] 三保变更单 --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PlanChangeApplyController.java | 38 ++++++++++++++++++ lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PlanChangeApply.java | 54 +++++++++++--------------- 2 files changed, 60 insertions(+), 32 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PlanChangeApplyController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PlanChangeApplyController.java index 3bf58bc..3fa85bf 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PlanChangeApplyController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PlanChangeApplyController.java @@ -10,7 +10,12 @@ 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.common.util.DateUtils; +import org.jeecg.modules.eam.entity.DailyMaintenanceOrder; +import org.jeecg.modules.eam.entity.MaintenanceCycle; import org.jeecg.modules.eam.entity.PlanChangeApply; +import org.jeecg.modules.eam.service.IDailyMaintenanceOrderService; +import org.jeecg.modules.eam.service.IMaintenanceCycleService; import org.jeecg.modules.eam.service.IPlanChangeApplyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -19,8 +24,9 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; +import java.util.Date; - /** +/** * @Description: mom_eam_plan_change_apply * @Author: jeecg-boot * @Date: 2023-09-04 @@ -33,6 +39,12 @@ public class PlanChangeApplyController extends JeecgController<PlanChangeApply, IPlanChangeApplyService> { @Autowired private IPlanChangeApplyService planChangeApplyService; + + @Autowired + private IDailyMaintenanceOrderService dailyMaintenanceOrderService; + + @Autowired + private IMaintenanceCycleService maintenanceCycleService; /** * 鍒嗛〉鍒楄〃鏌ヨ @@ -67,7 +79,31 @@ //@RequiresPermissions("org.jeecg.modules.mdc:mom_eam_plan_change_apply:add") @PostMapping(value = "/add") public Result<String> add(@RequestBody PlanChangeApply planChangeApply) { + planChangeApply.setMaintenanceOrderId(planChangeApply.getId()); + planChangeApply.setId(""); planChangeApplyService.save(planChangeApply); + + /** + * 鏍规嵁鐢宠寤朵繚鏃堕棿 閲嶆柊璁$畻宸ュ崟鐨勭粨鏉熸椂闂� + */ + DailyMaintenanceOrder dailyMaintenanceOrder = dailyMaintenanceOrderService.getById(planChangeApply.getMaintenanceOrderId()); + String maintenanceCycleId = dailyMaintenanceOrder.getMaintenanceCycleId(); + Date planDelayTime = planChangeApply.getPlanDelayTime(); + MaintenanceCycle maintenanceCycle = maintenanceCycleService.getById(maintenanceCycleId); + String unit = maintenanceCycle.getUnit(); + int effectiveTime = maintenanceCycle.getEffectiveTime().intValue(); + Date date = null; + if ("min".equals(unit)) { + date = DateUtils.getMinAfter(planDelayTime, effectiveTime); + } else if ("hour".equals(unit)) { + date = DateUtils.getHourAfter(planDelayTime, effectiveTime); + } else if ("day".equals(unit)) { + date = DateUtils.getDayAfter(planDelayTime, effectiveTime); + } + dailyMaintenanceOrder.setPlanEndTime(date); + dailyMaintenanceOrder.setPlanStartTime(planDelayTime); + dailyMaintenanceOrderService.updateById(dailyMaintenanceOrder); + return Result.OK("娣诲姞鎴愬姛锛�"); } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PlanChangeApply.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PlanChangeApply.java index 417d176..fc06091 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PlanChangeApply.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PlanChangeApply.java @@ -8,8 +8,11 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Data; import com.fasterxml.jackson.annotation.JsonFormat; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.system.base.entity.JeecgEntity; import org.springframework.format.annotation.DateTimeFormat; import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecg.common.aspect.annotation.Dict; @@ -29,13 +32,9 @@ @Accessors(chain = true) @EqualsAndHashCode(callSuper = false) @ApiModel(value="mom_eam_plan_change_apply瀵硅薄", description="mom_eam_plan_change_apply") -public class PlanChangeApply implements Serializable { +public class PlanChangeApply extends JeecgEntity implements Serializable { private static final long serialVersionUID = 1L; - /**id*/ - @TableId(type = IdType.ASSIGN_ID) - @ApiModelProperty(value = "id") - private String id; /**applyUnit*/ @Excel(name = "applyUnit", width = 15) @ApiModelProperty(value = "applyUnit") @@ -55,15 +54,15 @@ @ApiModelProperty(value = "maintenanceOrderId") private String maintenanceOrderId; /**planStartTime*/ - @Excel(name = "planStartTime", width = 15, format = "yyyy-MM-dd") - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") + @Excel(name = "planStartTime", width = 15, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "planStartTime") private Date planStartTime; /**planDelayTime*/ - @Excel(name = "planDelayTime", width = 15, format = "yyyy-MM-dd") - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") + @Excel(name = "planDelayTime", width = 15, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "planDelayTime") private Date planDelayTime; /**planUser*/ @@ -75,29 +74,22 @@ @ApiModelProperty(value = "delayReason") private String delayReason; /**annex*/ - @Excel(name = "annex", width = 15) - @ApiModelProperty(value = "annex") - private String annex; + @Excel(name = "闄勪欢鍚嶇О", width = 15) + @ApiModelProperty(value = "闄勪欢鍚嶇О") + private String annexName; + + @Excel(name = "闄勪欢澶у皬", width = 15) + @ApiModelProperty(value = "闄勪欢澶у皬") + private String annexSize; + + @Excel(name = "璺緞", width = 15) + @ApiModelProperty(value = "璺緞") + private String annexPath; /**remark*/ @Excel(name = "remark", width = 15) @ApiModelProperty(value = "remark") private String remark; - /**createBy*/ - @ApiModelProperty(value = "createBy") - private String createBy; - /**createTime*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") - @ApiModelProperty(value = "createTime") - private Date createTime; - /**updateBy*/ - @ApiModelProperty(value = "updateBy") - private String updateBy; - /**updateTime*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") - @ApiModelProperty(value = "updateTime") - private Date updateTime; + /**tenantId*/ @Excel(name = "tenantId", width = 15) @ApiModelProperty(value = "tenantId") @@ -106,5 +98,5 @@ @Excel(name = "delFlag", width = 15) @ApiModelProperty(value = "delFlag") @TableLogic - private Integer delFlag; + private Integer delFlag = CommonConstant.DEL_FLAG_0; } -- Gitblit v1.9.3