Merge branch 'ext-dev' of http://git.estsh.com/i3-IMPP/i3plus-pojo into ext-dev

yun-zuoyi
andly.pan 3 years ago
commit a212e8591a

@ -0,0 +1,203 @@
package cn.estsh.i3plus.pojo.base.enumutil;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* @Description :
* @Reference :
* @Author : Castle
* @CreateDate : 2022/1/18 16:10
* @Modify:
**/
public class BspEnumUtil {
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum PARAM_TYPE {
METHOD_PARAM_TYPE(10, "method", "方法参数"),
SCRIPT_PARAM_TYPE(20, "script", "脚本参数");
private Integer value;
private String code;
private String description;
PARAM_TYPE(Integer value, String code, String description) {
this.value = value;
this.code = code;
this.description = description;
}
public static PARAM_TYPE getByValue(String value) {
for (PARAM_TYPE actionType : values()) {
if (actionType.getValue().equals(value)) {
return actionType;
}
}
return null;
}
public Integer getValue() {
return value;
}
public String getCode() {
return code;
}
public String getDescription() {
return description;
}
}
/**
* GroovyPythonJavaScriptScalaRuby
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum SCRIPT_LANGUAGE {
GROOVY(10, "Groovy"),
PYTHON(20, "Python"),
JAVA_SCRIPT(30, "JavaScript"),
SCALA(40, "Scala"),
RUBY(50, "Ruby");
private int value;
private String description;
SCRIPT_LANGUAGE(int value, String description) {
this.value = value;
this.description = description;
}
public int getValue() {
return value;
}
public String getDescription() {
return description;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
}
/**
* GroovyPythonJavaScriptScalaRuby
*
* language_type
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum SCRIPT_TYPE {
GROOVY(10, "groovyScript"),
PYTHON(20, "pythonScript"),
JAVA_SCRIPT(30, "javaScript"),
SCALA(40, "scalaScript"),
RUBY(50, "rubyScript");
private int value;
private String beanName;
SCRIPT_TYPE(int value, String beanName) {
this.value = value;
this.beanName = beanName;
}
public int getValue() {
return value;
}
public String getBeanName() {
return beanName;
}
public static String valueOfBeanName(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].beanName;
}
}
return tmp;
}
}
/**
*
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum METHOD_GROUP_TYPE {
BSP(10, "BSP"),
WMS(20, "WMS"),
MES(30, "MES"),
APS(40, "APS"),
MES_PCN(50, "MES_PCN");
private int value;
private String description;
METHOD_GROUP_TYPE(int value, String description) {
this.value = value;
this.description = description;
}
public int getValue() {
return value;
}
public String getDescription() {
return description;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
}
/**
*
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum METHOD_OR_SCRIPT {
METHOD(10, "METHOD"),
SCRIPT(20, "SCRIPT");
private int value;
private String description;
METHOD_OR_SCRIPT(int value, String description) {
this.value = value;
this.description = description;
}
public int getValue() {
return value;
}
public String getDescription() {
return description;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
}
}

@ -25,7 +25,7 @@ public class CommonEnumUtil {
*/ */
WMS(3, 8200, 10, 102000000L, "i3wms", "仓库管理软件"), WMS(3, 8200, 10, 102000000L, "i3wms", "仓库管理软件"),
SWEB(7, 8800, 19, 108000000L, "i3sweb", "供应商服务"), SWEB(7, 8800, 19, 108000000L, "i3sweb", "供应商服务"),
QMS(5, 0, 0, 0, "i3qms", "质量管理软件"), QMS(5, 8260, 29, 128000000L, "i3qms", "质量管理软件"),
TMS(101, 8250, 24, 118000000L, "i3tms", "运输管理系统"), TMS(101, 8250, 24, 118000000L, "i3tms", "运输管理系统"),
/** /**
@ -90,8 +90,11 @@ public class CommonEnumUtil {
/** /**
* *
*/ */
DEV(9999, 0000, 0, 120000000L, "Development", "系统调试"); DEV(9999, 0000, 0, 120000000L, "Development", "系统调试"),
/**
*
*/
LEO(50, 8234, 0, 106000000L, "impp-leo", "智能调度系统");
/** /**
* ID * ID

@ -13,6 +13,22 @@
<artifactId>i3plus-pojo-bsp</artifactId> <artifactId>i3plus-pojo-bsp</artifactId>
<dependencies> <dependencies>
<!-- Groovy 脚本引擎相关组件 -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-jsr223</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>org.python</groupId>
<artifactId>jython-standalone</artifactId>
<version>2.7.1</version>
</dependency>
<dependency> <dependency>
<groupId>i3plus.pojo</groupId> <groupId>i3plus.pojo</groupId>
<artifactId>i3plus-pojo-base</artifactId> <artifactId>i3plus-pojo-base</artifactId>

@ -1,11 +0,0 @@
package cn.estsh.i3plus.pojo.bsp.common;
/**
* @Description :
* @Reference :
* @Author : Castle
* @CreateDate : 2021/7/22 15:38
* @Modify:
**/
public class GroovyCommonUtil {
}

@ -1,98 +0,0 @@
package cn.estsh.i3plus.pojo.bsp.common;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : Castle
* @CreateDate : 2021/6/17 13:40
* @Modify:
**/
public class GsonTool {
private static Gson gson = null;
static {
gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
}
/**
* Object json
*
* @param src
* @return String
*/
public static String toJson(Object src) {
return gson.toJson(src);
}
/**
* json clsObject
*
* @param json
* @param classOfT
* @return
*/
public static <T> T fromJson(String json, Class<T> classOfT) {
return gson.fromJson(json, classOfT);
}
/**
* json rawClass<classOfT> Object
*
* @param json
* @param classOfT
* @param argClassOfT
* @return
*/
public static <T> T fromJson(String json, Class<T> classOfT, Class argClassOfT) {
Type type = new ParameterizedType4ReturnT(classOfT, new Class[]{argClassOfT});
return gson.fromJson(json, type);
}
public static class ParameterizedType4ReturnT implements ParameterizedType {
private final Class raw;
private final Type[] args;
public ParameterizedType4ReturnT(Class raw, Type[] args) {
this.raw = raw;
this.args = args != null ? args : new Type[0];
}
@Override
public Type[] getActualTypeArguments() {
return args;
}
@Override
public Type getRawType() {
return raw;
}
@Override
public Type getOwnerType() {
return null;
}
}
/**
* json clslist
*
* @param json
* @param classOfT
* @return
*/
public static <T> List<T> fromJsonList(String json, Class<T> classOfT) {
return gson.fromJson(
json,
new TypeToken<List<T>>() {
}.getType()
);
}
}

@ -1,149 +0,0 @@
//package cn.estsh.i3plus.pojo.bsp.common;
//
//import cn.estsh.i3plus.pojo.base.bean.BaseResultBean;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//import javax.net.ssl.*;
//import java.io.BufferedReader;
//import java.io.DataOutputStream;
//import java.io.InputStreamReader;
//import java.net.HttpURLConnection;
//import java.net.URL;
//import java.security.cert.CertificateException;
//import java.security.cert.X509Certificate;
//
///**
// * @Description :
// * @Reference :
// * @Author : Castle
// * @CreateDate : 2021/6/17 13:37
// * @Modify:
// **/
//public class HttpUtils {
// private static Logger logger = LoggerFactory.getLogger(HttpUtils.class);
//
// // trust-https start
// private static void trustAllHosts(HttpsURLConnection connection) {
// try {
// SSLContext sc = SSLContext.getInstance("TLS");
// sc.init(null, trustAllCerts, new java.security.SecureRandom());
// SSLSocketFactory newFactory = sc.getSocketFactory();
//
// connection.setSSLSocketFactory(newFactory);
// } catch (Exception e) {
// logger.error(e.getMessage(), e);
// }
// connection.setHostnameVerifier(new HostnameVerifier() {
// @Override
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
// }
//
// private static final TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
// @Override
// public X509Certificate[] getAcceptedIssuers() {
// return new X509Certificate[]{};
// }
//
// @Override
// public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
// }
//
// @Override
// public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
// }
// }};
// // trust-https end
//
//
// /**
// * post
// *
// * @param url
// * @param timeout
// * @param requestObj
// * @return
// */
// public static ResultBean postBody(String url, int timeout, Object requestObj) {
// HttpURLConnection connection = null;
// BufferedReader bufferedReader = null;
// try {
// // connection
// URL realUrl = new URL(url);
// connection = (HttpURLConnection) realUrl.openConnection();
//
// // trust-https
// boolean useHttps = url.startsWith("https");
// if (useHttps) {
// HttpsURLConnection https = (HttpsURLConnection) connection;
// trustAllHosts(https);
// }
//
// // connection setting
// connection.setRequestMethod("POST");
// connection.setDoOutput(true);
// connection.setDoInput(true);
// connection.setUseCaches(false);
// connection.setReadTimeout(timeout * 1000);
// connection.setConnectTimeout(3 * 1000);
// connection.setRequestProperty("connection", "Keep-Alive");
// connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
// connection.setRequestProperty("Accept-Charset", "application/json;charset=UTF-8");
//
// // do connection
// connection.connect();
//
// // write requestBody
// if (requestObj != null) {
// String requestBody = GsonTool.toJson(requestObj);
//
// DataOutputStream dataOutputStream = new DataOutputStream(connection.getOutputStream());
// dataOutputStream.write(requestBody.getBytes("UTF-8"));
// dataOutputStream.flush();
// dataOutputStream.close();
// }
//
// // valid StatusCode
// int statusCode = connection.getResponseCode();
// if (statusCode != 200) {
// return ResultBean.fail("rpc remoting fail, StatusCode(" + statusCode + ") invalid. for url : " + url);
//// return new BaseResultBean().errorMsg("rpc remoting fail, StatusCode(" + statusCode + ") invalid. for url : " + url);
//// return new ReturnT<String>(ReturnT.FAIL_CODE, "rpc remoting fail, StatusCode(" + statusCode + ") invalid. for url : " + url);
// }
//
// // result
// bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
// StringBuilder result = new StringBuilder();
// String line;
// while ((line = bufferedReader.readLine()) != null) {
// result.append(line);
// }
// String resultJson = result.toString();
// // parse returnT
// try {
// return GsonTool.fromJson(resultJson, BaseResultBean.class);
// } catch (Exception e) {
// logger.error("rpc remoting (url=" + url + ") response content invalid(" + resultJson + ").", e);
// return ResultBean.fail("rpc remoting fail, StatusCode(" + statusCode + ") invalid. for url : " + url);
// }
// } catch (Exception e) {
// logger.error(e.getMessage(), e);
// return ResultBean.fail("rpc remoting fail, error message(" + e.getMessage() + ") invalid. for url : " + url);
// } finally {
// try {
// if (bufferedReader != null) {
// bufferedReader.close();
// }
// if (connection != null) {
// connection.disconnect();
// }
// } catch (Exception e2) {
// logger.error(e2.getMessage(), e2);
// }
// }
// }
//
//}

@ -1,56 +0,0 @@
//package cn.estsh.i3plus.pojo.bsp.common;
//
//import java.io.Serializable;
//
///**
// * @author Castle
// */
//public class ReturnT<T> implements Serializable {
// public static final long serialVersionUID = 42L;
//
// public static final int SUCCESS_CODE = 200;
// public static final int FAIL_CODE = 500;
//
// public static final ReturnT<String> SUCCESS = new ReturnT<String>(null);
// public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null);
//
// private int code;
// private String msg;
// private T content;
//
// public ReturnT(){}
// public ReturnT(int code, String msg) {
// this.code = code;
// this.msg = msg;
// }
//
// public ReturnT(T content) {
// this.code = SUCCESS_CODE;
// this.content = content;
// }
//
// public int getCode() {
// return code;
// }
// public void setCode(int code) {
// this.code = code;
// }
// public String getMsg() {
// return msg;
// }
// public void setMsg(String msg) {
// this.msg = msg;
// }
// public T getContent() {
// return content;
// }
// public void setContent(T content) {
// this.content = content;
// }
//
// @Override
// public String toString() {
// return "ReturnT [code=" + code + ", msg=" + msg + ", content=" + content + "]";
// }
//
//}

@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
@ -16,9 +17,13 @@ import java.util.List;
**/ **/
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor
@ApiModel("添加方法组") @ApiModel("添加方法组")
public class MethodGroupModel { public class MethodGroupModel {
@ApiModelProperty("方法组id")
private Long id;
@ApiModelProperty("方法组的名称") @ApiModelProperty("方法组的名称")
private String methodGroupName; private String methodGroupName;
@ -29,6 +34,9 @@ public class MethodGroupModel {
private List<MethodLevelModel> methodLevel; private List<MethodLevelModel> methodLevel;
@ApiModelProperty("方法组分类") @ApiModelProperty("方法组分类")
private String classify; private Integer classification;
@ApiModelProperty("链接关系")
private String connections;
} }

@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
@ -16,6 +17,7 @@ import java.util.List;
**/ **/
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor
@ApiModel("添加方法组层级") @ApiModel("添加方法组层级")
public class MethodLevelModel { public class MethodLevelModel {

@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
/** /**
* @Description : * @Description :
@ -14,6 +15,7 @@ import lombok.Data;
**/ **/
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor
@ApiModel("添加方法组层级参数") @ApiModel("添加方法组层级参数")
public class MethodLevelParamModel { public class MethodLevelParamModel {
@ApiModelProperty("根据出参生成入参key = 层级 + methodId + 出参Name") @ApiModelProperty("根据出参生成入参key = 层级 + methodId + 出参Name")

@ -27,4 +27,12 @@ public class RequestModel {
private Map<String, Object> jsonParamMap; private Map<String, Object> jsonParamMap;
@ApiModelProperty("日志id") @ApiModelProperty("日志id")
private Long logId; private Long logId;
@ApiModelProperty("方法类型-脚本-方法")
private Integer type;
@ApiModelProperty("脚本类型")
private Integer scriptType;
@ApiModelProperty("脚本内容")
private String scriptContent;
// @ApiModelProperty("脚本执行位置")
// private Integer scriptExecutor;
} }

@ -19,7 +19,7 @@ import java.util.Date;
* @Modify: * @Modify:
**/ **/
@Entity @Entity
@Table(name = "EXECUTOR_GROUP_REGISTRY_INFO") @Table(name = "BSP_EXECUTOR_GROUP_REGISTRY_INFO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@NoArgsConstructor @NoArgsConstructor

@ -19,7 +19,7 @@ import java.util.Date;
* @Modify: * @Modify:
**/ **/
@Entity @Entity
@Table(name = "EXECUTOR_REGISTRY_INFO") @Table(name = "BSP_EXECUTOR_REGISTRY_INFO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@NoArgsConstructor @NoArgsConstructor
@ -48,4 +48,8 @@ public class ExecutorRegistryInfo extends BaseBean implements Serializable {
@Column(name = "HEART_BEAT") @Column(name = "HEART_BEAT")
@ApiModelProperty("心跳存活12死掉") @ApiModelProperty("心跳存活12死掉")
private Integer heartBeat; private Integer heartBeat;
@Column(name = "EXECUTOR_TYPE")
@ApiModelProperty("执行器的类型同枚举Method_group_Type")
private Integer executorType;
} }

@ -7,6 +7,7 @@ import lombok.*;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table; import javax.persistence.Table;
import java.io.Serializable; import java.io.Serializable;
@ -18,7 +19,7 @@ import java.io.Serializable;
* @Modify: * @Modify:
**/ **/
@Entity @Entity
@Table(name = "EXECUTOR_REGISTRY_METHOD_DOC_INFO") @Table(name = "BSP_REGISTRY_METHOD_DOC_INFO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@NoArgsConstructor @NoArgsConstructor
@ -28,30 +29,44 @@ import java.io.Serializable;
public class ExecutorRegistryMethodDocInfo extends BaseBean implements Serializable { public class ExecutorRegistryMethodDocInfo extends BaseBean implements Serializable {
private static final long serialVersionUID = 2770821289940006535L; private static final long serialVersionUID = 2770821289940006535L;
@Column(name = "BEAN_NAME") @ApiModelProperty(value = "应用名称")
@ApiModelProperty("beanName") @Column(name = "APP_NAME")
private String beanName; private String appName;
@Column(name = "VERSION") @ApiModelProperty(value = "markdown文本前端渲染")
@ApiModelProperty("方法版本") @Column(name = "MARKDOWN")
private String version; private String markdown;
@Column(name = "AFFECT_TABLE_STR") @ApiModelProperty(value = "方法名,方法名和应用名做唯一键")
@ApiModelProperty("受影响的表名,逗号分割,原来为数组") @Lob
private String affectTableClassNameStr; @Column(name = "METHOD_NAME")
private String methodName;
@Column(name = "SYSTEM_PROCESS_STR")
@ApiModelProperty("系统要执行的逻辑 逗号分割,原来为数组") @ApiModelProperty(value = "分类")
private String systemProcessStr; @Lob
/** @Column(name = "CLASSIFICATION")
* private String classification;
*/ // @Column(name = "BEAN_NAME")
@Column(name = "VALIDATION") // @ApiModelProperty("beanName")
@ApiModelProperty("参数验证 逗号分割,原来为数组") // private String beanName;
private String validation; //
// @Column(name = "VERSION")
@Column(name = "METHOD_ID") // @ApiModelProperty("方法版本")
@ApiModelProperty("方法ID") // private String version;
private Long methodId; //
//todo 缺少参数信息 // @Column(name = "AFFECT_TABLE_STR")
// @ApiModelProperty("受影响的表名,逗号分割,原来为数组")
// private String affectTableClassNameStr;
//
// @Column(name = "SYSTEM_PROCESS_STR")
// @ApiModelProperty("系统要执行的逻辑 逗号分割,原来为数组")
// private String systemProcessStr;
// @Column(name = "VALIDATION")
// @ApiModelProperty("参数验证 逗号分割,原来为数组")
// private String validation;
// @Column(name = "METHOD_ID")
// @ApiModelProperty("方法ID")
// private Long methodId;
} }

@ -19,7 +19,7 @@ import java.util.List;
* @CreateDate : 2021/6/16 13:39 * @CreateDate : 2021/6/16 13:39
* @Modify: * @Modify:
**/ **/
@Table(name = "EXECUTOR_REGISTRY_METHOD_INFO") @Table(name = "BSP_REGISTRY_METHOD_INFO")
@Entity @Entity
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ -50,6 +50,10 @@ public class ExecutorRegistryMethodInfo extends BaseBean implements Serializable
@ApiModelProperty("所属执行器的appName") @ApiModelProperty("所属执行器的appName")
private String appName; private String appName;
@Column(name = "METHOD_TYPE")
@ApiModelProperty("方法类型,属于那个执行器类型,同枚举类method_group_type")
private Integer methodType;
@Column(name = "description") @Column(name = "description")
@ApiModelProperty("方法描述") @ApiModelProperty("方法描述")
private String description; private String description;

@ -18,7 +18,7 @@ import java.io.Serializable;
* @Modify: * @Modify:
**/ **/
@Entity @Entity
@Table(name = "EXECUTOR_REGISTRY_PARAM_INFO") @Table(name = "BSP_REGISTRY_PARAM_INFO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@NoArgsConstructor @NoArgsConstructor
@ -42,7 +42,11 @@ public class ExecutorRegistryParamInfo extends BaseBean implements Serializable
private String typeName; private String typeName;
@Column(name = "METHOD_ID") @Column(name = "METHOD_ID")
@ApiModelProperty("所属方法的ID") @ApiModelProperty("所属方法/脚本的ID")
private Long methodId; private Long methodId;
// @Column(name = "PARAM_TYPE")
// @ApiModelProperty("区分方法还是脚本的参数,方法参数10,脚本参数20")
// private Integer paramType;
} }

@ -7,6 +7,7 @@ import lombok.*;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table; import javax.persistence.Table;
import java.io.Serializable; import java.io.Serializable;
@ -18,7 +19,7 @@ import java.io.Serializable;
* @Modify: * @Modify:
**/ **/
@Entity @Entity
@Table(name = "METHOD_GROUP_INFO") @Table(name = "BSP_METHOD_GROUP_INFO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@NoArgsConstructor @NoArgsConstructor
@ -32,15 +33,18 @@ public class MethodGroupInfo extends BaseBean implements Serializable {
@Column(name = "NAME") @Column(name = "NAME")
@ApiModelProperty("方法组名称") @ApiModelProperty("方法组名称")
private String name; private String methodGroupName;
@Column(name = "DESCRIPTION") @Column(name = "DESCRIPTION")
@ApiModelProperty("方法组描述") @ApiModelProperty("方法组描述")
private String description; private String description;
@Column(name = "CLASSIFY") @Column(name = "CLASSIFICATION")
@ApiModelProperty("方法组分类(唯一)") @ApiModelProperty("方法组分类,挂载到的wms,mes等,枚举类")
private String classify; private Integer classification;
@Lob
@Column(name = "CONNECTIONS")
@ApiModelProperty("方法组内的连线关系")
private String connections;
} }

@ -20,7 +20,7 @@ import java.util.List;
* @Modify: * @Modify:
**/ **/
@Entity @Entity
@Table(name = "METHOD_LEVEL_INFO") @Table(name = "BSP_METHOD_LEVEL_INFO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@NoArgsConstructor @NoArgsConstructor

@ -19,7 +19,7 @@ import java.io.Serializable;
* @Modify: * @Modify:
**/ **/
@Entity @Entity
@Table(name = "METHOD_LEVEL_PARAM_INFO") @Table(name = "BSP_METHOD_LEVEL_PARAM_INFO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@NoArgsConstructor @NoArgsConstructor

@ -18,7 +18,7 @@ import java.io.Serializable;
* @CreateDate : 2021/9/8 17:01 * @CreateDate : 2021/9/8 17:01
* @Modify: * @Modify:
**/ **/
@Table(name = "METHOD_LOG") @Table(name = "BSP_METHOD_LOG")
@Entity @Entity
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ -51,4 +51,8 @@ public class MethodLog extends BaseBean implements Serializable {
@ApiModelProperty("方法所属应用冗余") @ApiModelProperty("方法所属应用冗余")
@Column(name = "APP_NAME_RDD") @Column(name = "APP_NAME_RDD")
private String appNameRdd; private String appNameRdd;
@ApiModelProperty("区分方法或者脚本,BSP枚举")
@Column(name = "TYPE")
private Integer type;
} }

@ -0,0 +1,77 @@
package cn.estsh.i3plus.pojo.bsp.server.bean.po;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : Castle
* @CreateDate : 2022/1/19 11:49
* @Modify:
**/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "BSP_SCRIPT_PERSISTENCE", uniqueConstraints = {
@UniqueConstraint(columnNames = {"ORGANIZE_CODE", "SCRIPT_NO"})
})
@Api("系统动态脚本")
public class ScriptPersistence extends BaseBean {
@Column(name = "SCRIPT_NO", length = 50)
@ApiModelProperty(value = "脚本调用的唯一编号例如WMS_PDA_0001")
private String scriptNo;
@ApiModelProperty(value = "脚本的中文名称")
@Column(name = "SCRIPT_NAME", length = 50)
private String scriptName;
@ApiModelProperty(value = "目标执行器")
@Column(name = "TARGET_EXECUTOR")
private Integer targetExecutor;
@ApiModelProperty(value = "脚本编写的语言 10=Groovy, 20=Jython, 30=JavaScript, 40=Scala, 50=JRuby")
@Column(name = "LANGUAGE_TYPE")
private Integer languageType;
@Lob
@Column(name = "SCRIPT_CONTENT", columnDefinition = "TEXT")
@ApiModelProperty(value = "脚本的具体内容")
private String scriptContent;
@ApiModelProperty(value = "脚本的描述,包含脚本的用法,参数说明等")
@Column(name = "SCRIPT_REMARK", length = 2000)
private String scriptRemark;
@ApiModelProperty(value = "编译后的脚本内容,通过预编译加快脚本的运行速度")
@Transient
private Object compiledScript;
//暂时不提供历史版本号功能
// @Column(name = "SCRIPT_VERSION")
// @ApiModelProperty(value = "脚本版本号")
// private String scriptVersion;
//
// @ApiModelProperty(value = "脚本编号列表")
// @Transient
// private List<String> versionList;
@ApiModelProperty(value = "脚本参数列表")
@Transient
private List<ExecutorRegistryParamInfo> paramInfoList;
}

@ -0,0 +1,26 @@
package cn.estsh.i3plus.pojo.bsp.server.bean.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : Castle
* @CreateDate : 2022/1/24 16:27
* @Modify:
**/
@Data
@ApiModel(value = "methodGroup通用vo")
public class MethodGroupCommonVo {
@ApiModelProperty(value = "方法组的id")
private List<Long> ids;
@ApiModelProperty(value = "方法组启用禁用")
private Integer isValid;
}

@ -15,7 +15,9 @@ import lombok.Data;
@Data @Data
public class MethodGroupVo { public class MethodGroupVo {
@ApiParam(value = "方法组名称") @ApiParam(value = "方法组名称")
private String groupName; private String methodGroupName;
@ApiParam(value = "是否启用") @ApiParam(value = "是否启用")
private Integer valid; private Integer isValid;
@ApiParam(value = "方法组分类")
private Integer classification;
} }

@ -0,0 +1,19 @@
package cn.estsh.i3plus.pojo.bsp.server.bean.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : Castle
* @CreateDate : 2022/1/22 19:23
* @Modify:
**/
@Data
@ApiModel("deletedVO")
public class ScriptDeleteVo {
private List<Long> ids;
}

@ -0,0 +1,34 @@
package cn.estsh.i3plus.pojo.bsp.server.bean.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Map;
/**
* @Description :
* @Reference :
* @Author : Castle
* @CreateDate : 2022/1/22 14:27
* @Modify:
**/
@Data
@ApiModel(value = "脚本测试")
public class ScriptTestVo {
@ApiModelProperty(value = "脚本内容")
private String scriptContent;
@ApiModelProperty(value = "方法名默认为execute")
private String methodName;
@ApiModelProperty(value = "参数列表")
private Map<String,Object> arguments;
@ApiModelProperty(value = "执行器")
private Integer targetExecutor;
@ApiModelProperty(value = "脚本语言")
private Integer languageType;
}

@ -0,0 +1,29 @@
package cn.estsh.i3plus.pojo.bsp.server.bean.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description :
* @Reference :
* @Author : Castle
* @CreateDate : 2022/1/19 11:39
* @Modify:
**/
@ApiModel(value = "查询脚本vo")
@Data
public class ScriptVo {
@ApiModelProperty(value = "脚本名称")
private String scriptName;
@ApiModelProperty(value = "脚本状态")
private Integer isValid;
@ApiModelProperty(value = "脚本语言")
private Integer scriptLanguage;
@ApiModelProperty(value = "脚本No,唯一")
private String scriptNo;
}

@ -0,0 +1,21 @@
package cn.estsh.i3plus.pojo.bsp.server.dao;
import cn.estsh.i3plus.pojo.bsp.client.bean.po.EngineScriptPersistence;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : Castle
* @CreateDate : 2022/1/18 11:23
* @Modify:
**/
public interface IEngineScriptDao {
/**
*
* @param name
* @return
*/
List<EngineScriptPersistence> findAllVersionByScriptName(String name);
}

@ -1,7 +1,7 @@
package cn.estsh.i3plus.pojo.bsp.server.repository; package cn.estsh.i3plus.pojo.bsp.server.repository;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.bsp.client.bean.po.EngineScriptPersistence; import cn.estsh.i3plus.pojo.bsp.server.bean.po.ScriptPersistence;
/** /**
* @Description : * @Description :
@ -10,5 +10,5 @@ import cn.estsh.i3plus.pojo.bsp.client.bean.po.EngineScriptPersistence;
* @CreateDate : 2021/7/22 13:51 * @CreateDate : 2021/7/22 13:51
* @Modify: * @Modify:
**/ **/
public interface ScriptRepository extends BaseRepository<EngineScriptPersistence,Long> { public interface ScriptRepository extends BaseRepository<ScriptPersistence,Long> {
} }

@ -66,7 +66,8 @@ public class WmsHealthIndicator extends BaseBean {
@DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT) @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
private String indicatorColor; private String indicatorColor;
@Transient // @Transient
@Column(name = "INDICATOR_VALUE")
@ApiParam(value = "指标测算值") @ApiParam(value = "指标测算值")
@DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER) @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
private Double indicatorCalcValue; private Double indicatorCalcValue;

@ -46,10 +46,10 @@ public class WmsHealthVariable extends BaseBean {
@DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT) @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
private String variableName; private String variableName;
@Column(name = "CYCLE_RANGE") // @Column(name = "CYCLE_RANGE")
@ApiParam(value = "周期") // @ApiParam(value = "周期")
@DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT) // @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
private String cycleRange; // private String cycleRange;
@Column(name = "CALC_FREQUENCY") @Column(name = "CALC_FREQUENCY")
@ApiParam(value = "计算频次") @ApiParam(value = "计算频次")
@ -107,4 +107,10 @@ public class WmsHealthVariable extends BaseBean {
@ApiParam(value = "测算方式") @ApiParam(value = "测算方式")
@DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT) @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
private String calcWays; private String calcWays;
@Column(name = "VARIABLE_VALUE")
@ApiParam(value = "上次计算的值")
@DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
private Double varibleValue;
} }

@ -49,7 +49,7 @@ public class WmsHealthVariableResult extends BaseBean {
@Column(name = "VARIABLE_VALUE") @Column(name = "VARIABLE_VALUE")
@ApiParam(value = "变量测算值") @ApiParam(value = "变量测算值")
@DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER) @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
private Integer variableValue; private Double variableValue;
@Lob @Lob
@Column(name = "VARIABLE_DETAILS") @Column(name = "VARIABLE_DETAILS")

@ -26,4 +26,11 @@ public interface IWmsHealthIndexCron {
* *
*/ */
Date getNextDate(); Date getNextDate();
/**
*
* CRON5300000
*/
public long getDifference();
} }

@ -1,5 +1,7 @@
package cn.estsh.i3plus.pojo.wms.bean.health; package cn.estsh.i3plus.pojo.wms.bean.health;
import lombok.Getter;
/** /**
* *
* @author link * @author link
@ -18,9 +20,20 @@ public enum WmsHealthIndexCalcWay {
*/ */
SCRIPT("30"); SCRIPT("30");
@Getter
private String value; private String value;
private WmsHealthIndexCalcWay(String value){ private WmsHealthIndexCalcWay(String value){
this.value = value; this.value = value;
} }
public static WmsHealthIndexCalcWay value(String value) {
WmsHealthIndexCalcWay[] values = WmsHealthIndexCalcWay.values();
for(WmsHealthIndexCalcWay target:values) {
if(target.getValue().equals(value)) {
return target;
}
}
return null;
}
} }

@ -1,13 +1,7 @@
package cn.estsh.i3plus.pojo.wms.bean.health; package cn.estsh.i3plus.pojo.wms.bean.health;
import cn.estsh.i3plus.pojo.wms.bean.WmsHealthVariableResult;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import java.util.Set;
/** /**
* *
@ -36,12 +30,15 @@ public class WmsHealthIndexEntity {
*/ */
private WmsHealthIndexValue value; private WmsHealthIndexValue value;
/** /**
* * ()
*/ */
private Boolean refresh; private Boolean refresh;
public WmsHealthIndexEntity(final WmsHealthIndexId id, public WmsHealthIndexEntity(final WmsHealthIndexId id,
final WmsHealthIndexFormula formula){ final WmsHealthIndexFormula formula){
if(null==id){
throw new IllegalArgumentException("WmsHealthIndexId can't be null");
}
this.id = id; this.id = id;
this.formula = formula; this.formula = formula;
}; };
@ -50,7 +47,7 @@ public class WmsHealthIndexEntity {
final String indicatorCode, final String indicatorCode,
final String calcFormula){ final String calcFormula){
return new WmsHealthIndexEntity(WmsHealthIndexId.of(organizeCode,indicatorCode), return new WmsHealthIndexEntity(WmsHealthIndexId.of(organizeCode,indicatorCode),
WmsHealthIndexFormula.of(organizeCode,indicatorCode)); WmsHealthIndexFormula.of(organizeCode,calcFormula));
} }
@ -67,13 +64,17 @@ public class WmsHealthIndexEntity {
} }
} }
public boolean hashValue(){
return null != this.value;
}
private WmsHealthIndexValue generateWmsHealthIndexValue(){ private WmsHealthIndexValue generateWmsHealthIndexValue(){
if(!formula.isEmpty()){ if(!formula.isResultEmpty()){
String result = null; String result = null;
int size = formula.getResults().size(); int size = formula.getResults().size();
if(size==1){ if(size==1){
WmsHealthIndexVariableValue varValue = formula.getSingleValue(); WmsHealthIndexVariableValue varValue = formula.getSingleValue();
if(null!=varValue)
result = String.valueOf(varValue.getDetail()); result = String.valueOf(varValue.getDetail());
}else{ }else{
result = String.valueOf(formula.getSpelResult()); result = String.valueOf(formula.getSpelResult());

@ -9,6 +9,7 @@ import java.util.*;
/** /**
* *
* (#VAR202201070002/#VAR456)/(#VAR123/#VAR456)*100
*/ */
@Getter @Getter
public class WmsHealthIndexFormula { public class WmsHealthIndexFormula {
@ -17,7 +18,7 @@ public class WmsHealthIndexFormula {
*/ */
private final String organizeCode; private final String organizeCode;
/** /**
* (#VAR202201070002/#VAR456)/(#VAR123/#VAR456)*100% * (#VAR202201070002/#VAR456)/(#VAR123/#VAR456) * 100
*/ */
private final String calcFormula; private final String calcFormula;
/** /**
@ -32,6 +33,12 @@ public class WmsHealthIndexFormula {
public WmsHealthIndexFormula(final String organizeCode,final String calcFormula){ public WmsHealthIndexFormula(final String organizeCode,final String calcFormula){
if(null==organizeCode){
throw new IllegalArgumentException("organizeCode can't be null");
}
if(null==calcFormula){
throw new IllegalArgumentException("calcFormula can't be null");
}
this.calcFormula = calcFormula; this.calcFormula = calcFormula;
this.organizeCode = organizeCode; this.organizeCode = organizeCode;
checkCode(); checkCode();
@ -62,12 +69,15 @@ public class WmsHealthIndexFormula {
} }
public void addResult(WmsHealthIndexVariable key, WmsHealthIndexVariableValue result){ public void addResult(WmsHealthIndexVariable key, WmsHealthIndexVariableValue result){
if(null!=result) { if(null!=result && null!=key) {
this.results.put(key, result); if(key.isRefresh()) {
key.changeValue(result);
}
results.put(key, result);
} }
} }
public boolean isEmpty(){ public boolean isResultEmpty(){
return results.isEmpty(); return results.isEmpty();
} }
@ -83,7 +93,7 @@ public class WmsHealthIndexFormula {
* *
*/ */
public WmsHealthIndexVariableValue getSingleValue(){ public WmsHealthIndexVariableValue getSingleValue(){
if(!isEmpty()) { if(!isResultEmpty()) {
WmsHealthIndexVariableValue variableValue = com.google.common.collect.Lists WmsHealthIndexVariableValue variableValue = com.google.common.collect.Lists
.newArrayList(results.values()).get(0); .newArrayList(results.values()).get(0);
return variableValue; return variableValue;
@ -95,11 +105,11 @@ public class WmsHealthIndexFormula {
* calcFormulaSPEL * calcFormulaSPEL
* @return * @return
*/ */
public Integer getSpelResult(){ public Double getSpelResult(){
if(results.isEmpty()) { if(results.isEmpty()) {
return -1; return -1.0;
} }
Integer calcResult = 0; Double calcResult = 0.0;
int resultSize = results.size(); int resultSize = results.size();
StandardEvaluationContext ctx = new StandardEvaluationContext(); StandardEvaluationContext ctx = new StandardEvaluationContext();
ExpressionParser parser = new SpelExpressionParser(); ExpressionParser parser = new SpelExpressionParser();
@ -111,15 +121,15 @@ public class WmsHealthIndexFormula {
for (WmsHealthIndexVariable varKey : varKeys) { for (WmsHealthIndexVariable varKey : varKeys) {
// 取出该变量名称对应的计算结果 // 取出该变量名称对应的计算结果
WmsHealthIndexVariableValue variableValue = results.get(varKey); WmsHealthIndexVariableValue variableValue = results.get(varKey);
Integer value = variableValue.getValue(); Double value = variableValue.getValue();
ctx.setVariable(varKey.getId().getVariable(), value); ctx.setVariable(varKey.getId().getVariable(), value);
} }
// 存在多个变量则按照SPEL进行运算最后取值 // 存在多个变量则按照SPEL进行运算最后取值
try { try {
calcResult = (Integer) parser.parseExpression(calcFormula) calcResult = (Double) parser.parseExpression(calcFormula)
.getValue(ctx); .getValue(ctx);
} catch (Exception e) { } catch (Exception e) {
calcResult = -1; calcResult = -1.0;
} }
} }
return calcResult; return calcResult;

@ -1,6 +1,7 @@
package cn.estsh.i3plus.pojo.wms.bean.health; package cn.estsh.i3plus.pojo.wms.bean.health;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
/** /**
* *
@ -16,6 +17,11 @@ public class WmsHealthIndexId{
* *
*/ */
private final String indicatorCode; private final String indicatorCode;
/**
* ID(OPTION)
*/
@Setter
private Long pk;
public WmsHealthIndexId(final String organizeCode,final String indicatorCode){ public WmsHealthIndexId(final String organizeCode,final String indicatorCode){
if(null==indicatorCode){ if(null==indicatorCode){
@ -25,7 +31,7 @@ public class WmsHealthIndexId{
throw new IllegalArgumentException("organizeCode can't be null"); throw new IllegalArgumentException("organizeCode can't be null");
} }
this.indicatorCode = indicatorCode; this.indicatorCode = indicatorCode;
this.organizeCode = indicatorCode; this.organizeCode = organizeCode;
} }
public static WmsHealthIndexId of(String organizeCode,String indicatorCode){ public static WmsHealthIndexId of(String organizeCode,String indicatorCode){

@ -1,5 +1,6 @@
package cn.estsh.i3plus.pojo.wms.bean.health; package cn.estsh.i3plus.pojo.wms.bean.health;
import io.swagger.annotations.ApiModel;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -16,4 +17,5 @@ public class WmsHealthIndexQuery{
private Long endTime; private Long endTime;
private Integer pageIndex; private Integer pageIndex;
private Integer pageSize; private Integer pageSize;
private Integer maxSize;
} }

@ -13,6 +13,9 @@ public class WmsHealthIndexValue{
* *
*/ */
private final String result; private final String result;
/**
*
*/
@Setter @Setter
private Long time; private Long time;

@ -2,6 +2,11 @@ package cn.estsh.i3plus.pojo.wms.bean.health;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.apache.commons.lang3.time.DateUtils;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.Date;
/** /**
@ -9,23 +14,20 @@ import lombok.Setter;
*/ */
@Getter @Getter
public class WmsHealthIndexVariable { public class WmsHealthIndexVariable {
/** /**
* *
*/ */
private final WmsHealthIndexVariableId id; private final WmsHealthIndexVariableId id;
/** /**
* *
*/ */
@Setter @Setter
private String name; private String name;
/** // /**
* // * 计算周期
*/ // */
@Setter // @Setter
private IWmsHealthIndexCron cycleRange; // private IWmsHealthIndexCron cycleRange;
/** /**
* *
*/ */
@ -50,34 +52,59 @@ public class WmsHealthIndexVariable {
@Setter @Setter
private String applyPartGroup; private String applyPartGroup;
/**
*
*/
@Setter @Setter
private String sqlStatement; private String sqlStatement;
/**
* spring
*/
@Setter @Setter
private String className; private String className;
/**
*
*/
@Setter @Setter
private String functionName; private String functionName;
/**
*
*/
@Setter @Setter
private String scriptNo; private String scriptNo;
/** /**
* *
*/ */
@Setter @Setter
private Object value; private WmsHealthIndexVariableValue value;
/** /**
* CRON * CRON
*/ */
@Setter @Setter
private boolean refresh; private boolean refresh;
/**
*
*/
@Setter
private Instant lastCalcTime;
/**
*
*/
@Setter
private Instant nextCalcTime;
public WmsHealthIndexVariable(String organizeCode,String variable){
this(new WmsHealthIndexVariableId(organizeCode,variable)); public WmsHealthIndexVariable(final String organizeCode,final String variable){
this(new WmsHealthIndexVariableId(organizeCode, variable));
} }
public WmsHealthIndexVariable(WmsHealthIndexVariableId id){ public WmsHealthIndexVariable(WmsHealthIndexVariableId id){
if(null==id){
throw new IllegalArgumentException("WmsHealthIndexVariableId can't be null");
}
this.id = id; this.id = id;
} }
@ -92,17 +119,75 @@ public class WmsHealthIndexVariable {
return flag; return flag;
} }
public boolean checked(){
/**
*
* @return
*/
public boolean hasValue(){
return null!=value; return null!=value;
} }
/**
* CRON
* @param cron
*/
public void changeCalcFrequency(IWmsHealthIndexCron cron){ public void changeCalcFrequency(IWmsHealthIndexCron cron){
setCalcFrequency(cron); setCalcFrequency(cron);
setRefresh(true); setRefresh(true);
} }
public void changeCycleRange(IWmsHealthIndexCron cron){
setCycleRange(cron); /**
setRefresh(true); *
* @param formartTime yyyy-MM-dd HH:mm:ss 2022-01-13 10:45:43
*/
public boolean setLastCalcTimeFormat(String formartTime){
if(null==formartTime||formartTime.trim().isEmpty()){
return false;
}
try{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long time = sdf.parse(formartTime).getTime();
this.lastCalcTime = (Instant.ofEpochMilli(time));
}catch (Exception e){
return false;
}
return null!=lastCalcTime;
}
public String formatToDateTime(Long time) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(new Date(time));
}
/**
*
* @return
*/
public String getLastCalcTimeFormat() {
return null!=this.lastCalcTime ? formatToDateTime(this.lastCalcTime.toEpochMilli()):"";
}
/**
*
* @return
*/
public String getNextCalcTimeFormat() {
return formatToDateTime(calcFrequency.getNextDate().getTime());
}
/**
*
* @param value
*/
public void changeValue(WmsHealthIndexVariableValue value){
if(null!=value) {
this.setValue(value);
this.setRefresh(true);
this.setLastCalcTime(Instant.now());
}
} }
} }

@ -1,15 +1,20 @@
package cn.estsh.i3plus.pojo.wms.bean.health; package cn.estsh.i3plus.pojo.wms.bean.health;
import lombok.Getter; import lombok.Getter;
import lombok.Value; import lombok.Setter;
/** /**
* *
*/ */
@Getter @Getter
@Value
public class WmsHealthIndexVariableId { public class WmsHealthIndexVariableId {
/**
* ID
*/
@Getter
@Setter
private Long pk;
/** /**
* *
*/ */
@ -20,4 +25,16 @@ public class WmsHealthIndexVariableId {
private final String variable; private final String variable;
public WmsHealthIndexVariableId(final String organizeCode,final String variable){
if(null == organizeCode){
throw new IllegalArgumentException("organizeCode can't be null");
}
if(null == variable){
throw new IllegalArgumentException("variable can't be null");
}
this.organizeCode = organizeCode;
this.variable = variable;
}
} }

@ -7,13 +7,12 @@ import lombok.Value;
* *
*/ */
@Getter @Getter
@Value
public class WmsHealthIndexVariableValue { public class WmsHealthIndexVariableValue {
/** /**
* *
*/ */
private final Integer value; private final Double value;
/** /**
* *
@ -21,7 +20,19 @@ public class WmsHealthIndexVariableValue {
private final Object detail; private final Object detail;
public WmsHealthIndexVariableValue(final Double value,final Object detail){
if(null==value){
throw new IllegalArgumentException("value can't be null");
}
if(null==detail){
throw new IllegalArgumentException("detail can't be null");
}
this.value = value;
this.detail = detail;
}
public static WmsHealthIndexVariableValue empty(){ public static WmsHealthIndexVariableValue empty(){
return new WmsHealthIndexVariableValue(-1,""); return new WmsHealthIndexVariableValue(-1.0,"");
} }
} }

@ -17,7 +17,7 @@ public interface IWmsHealthIndexRepository {
* @param id * @param id
* @return * @return
*/ */
WmsHealthIndexEntity findAndInit(WmsHealthIndexId id); WmsHealthIndexEntity findAndInit(final WmsHealthIndexId id);
/** /**
* *
@ -31,7 +31,7 @@ public interface IWmsHealthIndexRepository {
* @param wmsHealthIndexEntity * @param wmsHealthIndexEntity
* @param source * @param source
*/ */
void save(final WmsHealthIndexEntity wmsHealthIndexEntity,String source); void save(final WmsHealthIndexEntity wmsHealthIndexEntity,final String source);
/** /**

Loading…
Cancel
Save