Merge remote-tracking branch 'remotes/origin/dev' into test

yun-zuoyi
wei.peng 6 years ago
commit 6d5fc7ab39

@ -1,5 +1,6 @@
package cn.estsh.i3plus.pojo.base.codemaker;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sun.management.VMManagement;
@ -10,6 +11,7 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.concurrent.ConcurrentHashMap;
/**
* @Description : 使SnowFlakeID
@ -20,32 +22,73 @@ import java.net.NetworkInterface;
* @CreateDate : 2018-09-11 16:35
* @Modify:
**/
public class SnowflakeIdMaker {
public class SnowflakeIdMaker {
public static final Logger LOGGER = LoggerFactory.getLogger(SnowflakeIdMaker.class);
private static final ConcurrentHashMap<String,SnowflakeIdMaker> RAM_CACHE_MAP = new ConcurrentHashMap();
private long workerId;
private long datacenterId;
private long sequence = 0L;
public SnowflakeIdMaker(){
/**
* ,ID
*/
@Deprecated
private SnowflakeIdMaker() {
this.workerId = getWorkerMacId();
this.datacenterId = getDatacenterPid();
this.sequence = 0L;
}
public SnowflakeIdMaker(long workerId, long datacenterId){
/**
* ID
* @param workerId ID
* @param datacenterId ID
*/
private SnowflakeIdMaker(long workerId, long datacenterId) {
if (workerId > maxWorkerId || workerId < 0) {
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0",maxWorkerId));
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
}
if (datacenterId > maxDatacenterId || datacenterId < 0) {
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0",maxDatacenterId));
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
}
this.workerId = workerId;
this.datacenterId = datacenterId;
}
/**
*
* @param workerId ID
* @param softType
* @return
*/
public static SnowflakeIdMaker getSnowflakeIdMaker(long workerId, CommonEnumUtil.SOFT_TYPE softType) {
if(softType == null){
throw new IllegalArgumentException(String.format("The data warehouse soft type in the data center cannot be empty"));
}
return getSnowflakeIdMaker(workerId, softType.getSnowflakeId());
}
/**
*
* @param workerId ID
* @param datacenterId ID
* @return
*/
public static SnowflakeIdMaker getSnowflakeIdMaker(long workerId, long datacenterId) {
String cacheKey = workerId + "_" + datacenterId;
SnowflakeIdMaker maker = RAM_CACHE_MAP.get(cacheKey);
if (maker == null) {
maker = new SnowflakeIdMaker(workerId, datacenterId);
RAM_CACHE_MAP.put(cacheKey, maker);
}
return maker;
}
private long twepoch = 1288834974657L;
private long workerIdBits = 5L;

@ -17,35 +17,54 @@ public class CommonEnumUtil {
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum SOFT_TYPE {
IMPP(1, "impp-platform", "IMPP平台"),
CORE(2, "i3core", "i3业务平台"),
WMS(3, "i3wms", "仓库管理软件"),
MES(4, "i3mes", "生产管理软件"),
QMS(5, "i3qms", "质量管理软件"),
MES_PCN(6, "i3mes-pcn", "生产管理软件-节点中心"),
SWEB(7, "i3sweb", "供应商服务"),
FORM(20,"block-form","智能表单"),
REPORT(21,"block-report","智能报表"),
WORKFLOW(22,"block-workflow","智能工作流"),
JOBFLOW(23,"block-jobflow","智能作业流"),
SOFTSWITCH(24,"block-softswitch","软件适配器"),
HARDSWITCH(25,"block-hardswitch","硬件适配器"),
LAC(26,"lac","连接适配器"),
ANDON(27,"andon","安灯"),
APS(28,"APS","高级计划与排程"),
CENTER(99,"icloud-server","注册中心"),
SURFACE(98,"i3surface","对外服务"),
CLOUD(97,"i3cloud","微服务"),
GATEWAY(96,"impp-gateway","服务网关"),
CONSOLE(95,"impp-console","服务监控台");
IMPP(1, 0, 0, "impp-platform", "IMPP平台"),
CORE(2, 8100, 4, "i3core", "i3业务平台"),
WMS(3, 8200, 10, "i3wms", "仓库管理软件"),
MES(4, 8300, 11, "i3mes", "生产管理软件"),
QMS(5, 0, 0, "i3qms", "质量管理软件"),
MES_PCN(6, 8350, 12, "i3mes-pcn", "生产管理软件-节点中心"),
SWEB(7, 8800, 19, "i3sweb", "供应商服务"),
FORM(20, 8900, 16, "block-form", "智能表单"),
REPORT(21, 8910, 17, "block-report", "智能报表"),
WORKFLOW(22, 0, 0, "block-workflow", "智能工作流"),
JOBFLOW(23, 0, 0, "block-jobflow", "智能作业流"),
SOFTSWITCH(24, 8920, 18, "block-softswitch", "软件适配器"),
HARDSWITCH(25, 0, 0, "block-hardswitch", "硬件适配器"),
LAC(26, 8600, 13, "lac", "连接适配器"),
ANDON(27, 8500, 14, "andon", "安灯"),
APS(28, 8410, 15, "APS", "高级计划与排程"),
CENTER(99, 8000, 1, "icloud-server", "注册中心"),
SURFACE(98, 0, 0, "i3surface", "对外服务"),
CLOUD(97, 0, 0, "i3cloud", "微服务"),
GATEWAY(96, 9000, 3, "impp-gateway", "服务网关"),
CONSOLE(95, 8010, 2, "impp-console", "服务监控台");
/**
* ID
*/
private int value;
/**
*
*/
private int prot;
/**
* DataBaseId(0-31)32
*/
private int snowflakeId;
/**
*
*/
private String code;
/**
*
*/
private String description;
private SOFT_TYPE(int value, String code, String description) {
SOFT_TYPE(int value, int prot, int snowflakeId, String code, String description) {
this.value = value;
this.prot = prot;
this.snowflakeId = snowflakeId;
this.code = code;
this.description = description;
}
@ -62,6 +81,14 @@ public class CommonEnumUtil {
return description;
}
public int getProt() {
return prot;
}
public int getSnowflakeId() {
return snowflakeId;
}
public static String valueOfCode(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
@ -82,6 +109,15 @@ public class CommonEnumUtil {
return tmp;
}
public static SOFT_TYPE codeOf(String code) {
for (int i = 0; i < values().length; i++) {
if (values()[i].code.equals(code)) {
return values()[i];
}
}
return null;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {

@ -9,10 +9,7 @@ import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import javax.persistence.*;
import java.math.BigDecimal;
/**
@ -31,7 +28,7 @@ import java.math.BigDecimal;
@Index(columnList = "ORDER_NO"),
@Index(columnList = "PART_NO"),
@Index(columnList = "ITEM_STATUS")
})
}, uniqueConstraints = {@UniqueConstraint(columnNames = {"REF_SRC", "ITEM", "TRANS_TYPE_CODE_RDD"})})
@Api("作业任务明细信息")
public class WmsTaskDetails extends BaseBean {
@ -143,6 +140,10 @@ public class WmsTaskDetails extends BaseBean {
@ApiParam("业务类型描述")
public String busiTypeDesc;
@Column(name = "TRANS_TYPE_CODE_RDD")
@ApiParam("交易类型")
public String transTypeCodeRdd;
public Double getQty() {
return this.qty == null ? 0 : this.qty;
}

Loading…
Cancel
Save