package com.ld.igds.order.data; import com.fasterxml.jackson.annotation.JsonFormat; import com.ld.igds.constant.ControlModel; import com.ld.igds.io.request.*; import com.ld.igds.order.constant.ExeStatus; import com.ld.igds.util.ContextUtil; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * 执行需求记录信息 * * @author jiazx */ @Data public class ExeRequest implements Serializable { /** * */ private static final long serialVersionUID = 1L; private String orderId;//命令ID,系统生成,可以重复。命令相同的 private String companyId;//组织编码 private String exeUser;// 发起人 private String depotId;//仓库编号 private String deptId;//分库编码 private String depotName;//仓库名称 private String depotIds;//总仓库 private String thConf;//仓温湿通道,温湿度请求也是用 private String tempSerId;//温湿度分机 private String serId = "0";//分机编号 private String ip; //分机IP private Integer port;//分机端口号 private String bizType;//业务类型 private String serName; private String status = ExeStatus.IN_PROGRESS.getCode(); private boolean repeatTag = false;// 是否支持重复执行,即在上个命令未响应的时候,允许执行第二遍 private boolean addLogTag = true;//是否添加日志 private String controlModel = ControlModel.MODEL_02.getCode();// 控制柜操作模式 private Object reqData;//命令内容JSON格式报文 private String msg;//说明信息 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8") private Date exeTime = new Date();//开始执行时间 public ExeRequest() { super(); //this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm"); } public ExeRequest(String companyId, String serId, String bizType) { // this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm"); this.orderId = ContextUtil.buildExeOrderId(companyId, serId, bizType); this.companyId = companyId; this.serId = serId; this.bizType = bizType; } public ExeRequest(CheckGrainRequest request) { // this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm"); this.companyId = request.getCompanyId(); this.depotId = request.getDepotId(); this.bizType = request.getBizType(); this.serId = request.getSerId(); this.exeUser = ContextUtil.getLoginUserCName(); this.deptId = request.getDeptId(); this.tempSerId = request.getThSerId(); this.thConf = request.getThConf(); this.deptId = request.getDeptId(); this.ip = request.getIp(); this.port = request.getPort(); this.serName = request.getSerName(); this.depotName = request.getDepotName(); this.deptId = request.getDeptId(); this.orderId = request.getOrderId(); } public ExeRequest(TempControlRequest request, boolean repeatTag) { // this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm"); this.orderId = request.getOrderId(); this.companyId = request.getCompanyId(); this.depotId = request.getDepotId(); this.bizType = request.getBizType(); this.serId = request.getSerId(); this.exeUser = ContextUtil.getLoginUserCName(); this.repeatTag = repeatTag; this.ip = request.getIp(); this.port = request.getPort(); this.deptId = request.getDeptId(); this.serName = request.getSerName(); this.depotName = request.getDepotName(); // List list = new ArrayList<>(); // list.add(request.getExeDevice()); // // this.deviceList = list; this.controlModel = request.getControlModel(); this.msg = "操作设备=" + request.getExeDevice().getName() + "--" + request.getExeDevice().getTargetStatus(); this.reqData = request; } public ExeRequest(DeviceControlRequest request, boolean repeatTag) { // this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm"); this.orderId = request.getOrderId(); this.companyId = request.getCompanyId(); this.depotId = request.getDepotId(); this.bizType = request.getBizType(); this.repeatTag = repeatTag; this.serId = request.getSerId(); this.exeUser = ContextUtil.getLoginUserCName(); this.ip = request.getIp(); this.port = request.getPort(); this.serName = request.getSerName(); this.depotName = request.getDepotName(); //this.deviceList = request.getDeviceList(); this.controlModel = request.getControlModel(); this.reqData = request; this.deptId = request.getDeptId(); if (null != request.getDeviceList()) { String msg = "执行设备="; for (ExeDevice device : request.getDeviceList()) { msg += device.getName() + "--" + device.getTargetStatus() + ";"; } this.msg = msg; } } public ExeRequest(CheckGasRequest request) { // this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm"); this.orderId = request.getOrderId(); this.companyId = request.getCompanyId(); this.depotId = request.getDepotId(); this.bizType = request.getBizType(); this.serId = request.getSerId(); this.exeUser = ContextUtil.getLoginUserCName(); this.ip = request.getIp(); this.port = request.getPort(); this.serName = request.getSerName(); this.depotName = request.getDepotName(); this.deptId = request.getDeptId(); this.reqData = request; } public ExeRequest(BaseRequest request) { // this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm"); this.orderId = request.getOrderId(); this.companyId = request.getCompanyId(); this.depotId = request.getDepotId(); this.bizType = request.getBizType(); this.serId = request.getSerId(); this.exeUser = ContextUtil.getLoginUserCName(); this.serName = request.getSerName(); this.depotName = request.getDepotName(); this.deptId = request.getDeptId(); this.reqData = request; } public ExeRequest(BaseRequest request, boolean repeatTag) { // this.exeTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm"); this.orderId = request.getOrderId(); this.companyId = request.getCompanyId(); this.depotId = request.getDepotId(); this.bizType = request.getBizType(); this.serId = request.getSerId(); this.exeUser = ContextUtil.getLoginUserCName(); this.repeatTag = repeatTag; this.serName = request.getSerName(); this.depotName = request.getDepotName(); this.deptId = request.getDeptId(); this.reqData = request; } }