qushaowei
2023-09-04 5c9f92ea3ce6692b9dda65c768f104b2e6c2c736
三保变更单
已修改2个文件
92 ■■■■■ 文件已修改
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PlanChangeApplyController.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PlanChangeApply.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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("添加成功!");
    }
    
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;
}