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", "仓库管理软件"),
SWEB(7, 8800, 19, 108000000L, "i3sweb", "供应商服务"),
QMS(5, 0, 0, 0, "i3qms", "质量管理软件"),
QMS(5, 8260, 29, 128000000L, "i3qms", "质量管理软件"),
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

@ -13,6 +13,22 @@
<artifactId>i3plus-pojo-bsp</artifactId>
<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>
<groupId>i3plus.pojo</groupId>
<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 lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@ -16,9 +17,13 @@ import java.util.List;
**/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("添加方法组")
public class MethodGroupModel {
@ApiModelProperty("方法组id")
private Long id;
@ApiModelProperty("方法组的名称")
private String methodGroupName;
@ -29,6 +34,9 @@ public class MethodGroupModel {
private List<MethodLevelModel> methodLevel;
@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 lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@ -16,6 +17,7 @@ import java.util.List;
**/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("添加方法组层级")
public class MethodLevelModel {

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

@ -27,4 +27,12 @@ public class RequestModel {
private Map<String, Object> jsonParamMap;
@ApiModelProperty("日志id")
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:
**/
@Entity
@Table(name = "EXECUTOR_GROUP_REGISTRY_INFO")
@Table(name = "BSP_EXECUTOR_GROUP_REGISTRY_INFO")
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor

@ -19,7 +19,7 @@ import java.util.Date;
* @Modify:
**/
@Entity
@Table(name = "EXECUTOR_REGISTRY_INFO")
@Table(name = "BSP_EXECUTOR_REGISTRY_INFO")
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@ -48,4 +48,8 @@ public class ExecutorRegistryInfo extends BaseBean implements Serializable {
@Column(name = "HEART_BEAT")
@ApiModelProperty("心跳存活12死掉")
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.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
import java.io.Serializable;
@ -18,7 +19,7 @@ import java.io.Serializable;
* @Modify:
**/
@Entity
@Table(name = "EXECUTOR_REGISTRY_METHOD_DOC_INFO")
@Table(name = "BSP_REGISTRY_METHOD_DOC_INFO")
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@ -28,30 +29,44 @@ import java.io.Serializable;
public class ExecutorRegistryMethodDocInfo extends BaseBean implements Serializable {
private static final long serialVersionUID = 2770821289940006535L;
@Column(name = "BEAN_NAME")
@ApiModelProperty("beanName")
private String beanName;
@Column(name = "VERSION")
@ApiModelProperty("方法版本")
private String version;
@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;
//todo 缺少参数信息
@ApiModelProperty(value = "应用名称")
@Column(name = "APP_NAME")
private String appName;
@ApiModelProperty(value = "markdown文本前端渲染")
@Column(name = "MARKDOWN")
private String markdown;
@ApiModelProperty(value = "方法名,方法名和应用名做唯一键")
@Lob
@Column(name = "METHOD_NAME")
private String methodName;
@ApiModelProperty(value = "分类")
@Lob
@Column(name = "CLASSIFICATION")
private String classification;
// @Column(name = "BEAN_NAME")
// @ApiModelProperty("beanName")
// private String beanName;
//
// @Column(name = "VERSION")
// @ApiModelProperty("方法版本")
// private String version;
//
// @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
* @Modify:
**/
@Table(name = "EXECUTOR_REGISTRY_METHOD_INFO")
@Table(name = "BSP_REGISTRY_METHOD_INFO")
@Entity
@Data
@EqualsAndHashCode(callSuper = true)
@ -50,6 +50,10 @@ public class ExecutorRegistryMethodInfo extends BaseBean implements Serializable
@ApiModelProperty("所属执行器的appName")
private String appName;
@Column(name = "METHOD_TYPE")
@ApiModelProperty("方法类型,属于那个执行器类型,同枚举类method_group_type")
private Integer methodType;
@Column(name = "description")
@ApiModelProperty("方法描述")
private String description;

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

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

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

@ -18,7 +18,7 @@ import java.io.Serializable;
* @CreateDate : 2021/9/8 17:01
* @Modify:
**/
@Table(name = "METHOD_LOG")
@Table(name = "BSP_METHOD_LOG")
@Entity
@Data
@EqualsAndHashCode(callSuper = true)
@ -51,4 +51,8 @@ public class MethodLog extends BaseBean implements Serializable {
@ApiModelProperty("方法所属应用冗余")
@Column(name = "APP_NAME_RDD")
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
public class MethodGroupVo {
@ApiParam(value = "方法组名称")
private String groupName;
private String methodGroupName;
@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;
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 :
@ -10,5 +10,5 @@ import cn.estsh.i3plus.pojo.bsp.client.bean.po.EngineScriptPersistence;
* @CreateDate : 2021/7/22 13:51
* @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)
private String indicatorColor;
@Transient
// @Transient
@Column(name = "INDICATOR_VALUE")
@ApiParam(value = "指标测算值")
@DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
private Double indicatorCalcValue;

@ -46,10 +46,10 @@ public class WmsHealthVariable extends BaseBean {
@DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
private String variableName;
@Column(name = "CYCLE_RANGE")
@ApiParam(value = "周期")
@DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
private String cycleRange;
// @Column(name = "CYCLE_RANGE")
// @ApiParam(value = "周期")
// @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
// private String cycleRange;
@Column(name = "CALC_FREQUENCY")
@ApiParam(value = "计算频次")
@ -107,4 +107,10 @@ public class WmsHealthVariable extends BaseBean {
@ApiParam(value = "测算方式")
@DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
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")
@ApiParam(value = "变量测算值")
@DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
private Integer variableValue;
private Double variableValue;
@Lob
@Column(name = "VARIABLE_DETAILS")

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

@ -1,5 +1,7 @@
package cn.estsh.i3plus.pojo.wms.bean.health;
import lombok.Getter;
/**
*
* @author link
@ -18,9 +20,20 @@ public enum WmsHealthIndexCalcWay {
*/
SCRIPT("30");
@Getter
private String value;
private WmsHealthIndexCalcWay(String 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;
import cn.estsh.i3plus.pojo.wms.bean.WmsHealthVariableResult;
import lombok.Getter;
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 Boolean refresh;
public WmsHealthIndexEntity(final WmsHealthIndexId id,
final WmsHealthIndexFormula formula){
if(null==id){
throw new IllegalArgumentException("WmsHealthIndexId can't be null");
}
this.id = id;
this.formula = formula;
};
@ -50,7 +47,7 @@ public class WmsHealthIndexEntity {
final String indicatorCode,
final String calcFormula){
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(){
if(!formula.isEmpty()){
if(!formula.isResultEmpty()){
String result = null;
int size = formula.getResults().size();
if(size==1){
WmsHealthIndexVariableValue varValue = formula.getSingleValue();
if(null!=varValue)
result = String.valueOf(varValue.getDetail());
}else{
result = String.valueOf(formula.getSpelResult());

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

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

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

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

@ -2,6 +2,11 @@ package cn.estsh.i3plus.pojo.wms.bean.health;
import lombok.Getter;
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
public class WmsHealthIndexVariable {
/**
*
*/
private final WmsHealthIndexVariableId id;
/**
*
*/
@Setter
private String name;
/**
*
*/
@Setter
private IWmsHealthIndexCron cycleRange;
// /**
// * 计算周期
// */
// @Setter
// private IWmsHealthIndexCron cycleRange;
/**
*
*/
@ -50,34 +52,59 @@ public class WmsHealthIndexVariable {
@Setter
private String applyPartGroup;
/**
*
*/
@Setter
private String sqlStatement;
/**
* spring
*/
@Setter
private String className;
/**
*
*/
@Setter
private String functionName;
/**
*
*/
@Setter
private String scriptNo;
/**
*
*/
@Setter
private Object value;
private WmsHealthIndexVariableValue value;
/**
* CRON
*/
@Setter
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){
if(null==id){
throw new IllegalArgumentException("WmsHealthIndexVariableId can't be null");
}
this.id = id;
}
@ -92,17 +119,75 @@ public class WmsHealthIndexVariable {
return flag;
}
public boolean checked(){
/**
*
* @return
*/
public boolean hasValue(){
return null!=value;
}
/**
* CRON
* @param cron
*/
public void changeCalcFrequency(IWmsHealthIndexCron cron){
setCalcFrequency(cron);
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;
import lombok.Getter;
import lombok.Value;
import lombok.Setter;
/**
*
*/
@Getter
@Value
public class WmsHealthIndexVariableId {
/**
* ID
*/
@Getter
@Setter
private Long pk;
/**
*
*/
@ -20,4 +25,16 @@ public class WmsHealthIndexVariableId {
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
@Value
public class WmsHealthIndexVariableValue {
/**
*
*/
private final Integer value;
private final Double value;
/**
*
@ -21,7 +20,19 @@ public class WmsHealthIndexVariableValue {
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(){
return new WmsHealthIndexVariableValue(-1,"");
return new WmsHealthIndexVariableValue(-1.0,"");
}
}

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

Loading…
Cancel
Save