fix: utils
This commit is contained in:
@@ -1,61 +1,116 @@
|
||||
package org.nl.acs;
|
||||
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public interface AcsConfig {
|
||||
//指令下发agv
|
||||
/**
|
||||
* 指令下发agv
|
||||
*/
|
||||
String FORKAGV = "forkagv";
|
||||
//单工指令下发agv
|
||||
/**
|
||||
* 单工指令下发agv
|
||||
*/
|
||||
String ONEFORKAGV = "oneforkagv";
|
||||
//同一站点运行最大任务数
|
||||
/**
|
||||
* 同一站点运行最大任务数
|
||||
*/
|
||||
String ONEPOINTMAXTASK = "onePointMaxTask";
|
||||
//同一任务创建最大指令数
|
||||
/**
|
||||
* 同一任务创建最大指令数
|
||||
*/
|
||||
String MAXINSTNUMBER = "maxInstNumber";
|
||||
//创建任务检查
|
||||
/**
|
||||
* 创建任务检查
|
||||
*/
|
||||
String CREATETASKCHECK = "createTaskCheck";
|
||||
//撤销任务检查
|
||||
/**
|
||||
* 撤销任务检查
|
||||
*/
|
||||
String CANCELTASKCHECK = "cancelTaskCheck";
|
||||
//一楼agv系统接口地址
|
||||
/**
|
||||
* 一楼agv系统接口地址
|
||||
*/
|
||||
String AGVURL = "agvurl";
|
||||
//AGV系统端口
|
||||
/**
|
||||
* AGV系统端口
|
||||
*/
|
||||
String AGVPORT = "agvport";
|
||||
//二楼1区agv系统接口地址
|
||||
/**
|
||||
* 二楼1区agv系统接口地址
|
||||
*/
|
||||
String AGVURL2 = "agvurl2";
|
||||
//二楼1区AGV系统端口
|
||||
/**
|
||||
* 二楼1区AGV系统端口
|
||||
*/
|
||||
String AGVPORT2 = "agvport2";
|
||||
//二楼2区agv系统接口地址
|
||||
/**
|
||||
* 二楼2区agv系统接口地址
|
||||
*/
|
||||
String AGVURL22 = "agvurl22";
|
||||
//二楼2区AGV系统端口
|
||||
/**
|
||||
* 二楼2区AGV系统端口
|
||||
*/
|
||||
String AGVPORT22 = "agvport22";
|
||||
//指定AGV系统
|
||||
/**
|
||||
* 指定AGV系统
|
||||
*/
|
||||
String AGVTYPE = "agvType";
|
||||
//WMS系统接口地址
|
||||
/**
|
||||
* WMS系统接口地址
|
||||
*/
|
||||
String WMSURL = "wmsurl";
|
||||
//WCS系统接口地址
|
||||
/**
|
||||
* WCS系统接口地址
|
||||
*/
|
||||
String WCSURL = "wcsurl";
|
||||
|
||||
String HASOTHERSYSTEM = "hasOtherSystem";
|
||||
|
||||
String ERPURL = "erpurl";
|
||||
//是否存在wms系统
|
||||
/**
|
||||
* 是否存在wms系统
|
||||
*/
|
||||
String HASWMS = "hasWms";
|
||||
//lucene日志索引目录
|
||||
/**
|
||||
* lucene日志索引目录
|
||||
*/
|
||||
String LUCENEURL = "luceneUrl";
|
||||
//路由选择
|
||||
/**
|
||||
* 路由选择
|
||||
*/
|
||||
String ROUTE = "route";
|
||||
//忽略取放货校验
|
||||
/**
|
||||
* 忽略取放货校验
|
||||
*/
|
||||
String IGNOREHASGOODS = "ignoreHasGoods";
|
||||
//项目类型
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
String BUSINESSTYPE = "businessType";
|
||||
//海亮贴标设备ip
|
||||
/**
|
||||
* 海亮贴标设备ip
|
||||
*/
|
||||
String LETTERINGURL = "letteringUrl";
|
||||
//海亮贴标设备
|
||||
/**
|
||||
* 海亮贴标设备
|
||||
*/
|
||||
String LETTERINGPORT = "letteringPort";
|
||||
//NDC断线重连reconnection
|
||||
/**
|
||||
* NDC断线重连reconnection
|
||||
*/
|
||||
String NDC_RECONNECTION = "NDC_reconnection";
|
||||
//自动清理日志保留时间
|
||||
/**
|
||||
* 自动清理日志保留时间
|
||||
*/
|
||||
String AutoCleanDays = "AutoCleanDays";
|
||||
//最大任务下发时间
|
||||
/**
|
||||
* 最大任务下发时间
|
||||
*/
|
||||
String MAXSENDTASKTIME = "maxSendTaskTime";
|
||||
//指令下发立库
|
||||
/**
|
||||
* 指令下发立库
|
||||
*/
|
||||
String INSTSENDLK = "instSendLk";
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 转换
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public class ConvertUtil {
|
||||
public static <T, S> T convert(final S s, Class<T> clz) {
|
||||
|
||||
@@ -226,9 +226,12 @@ public class DateUtil {
|
||||
String second = "00";
|
||||
if (value != null && !"".equals(value.trim())) {
|
||||
int v_int = Integer.valueOf(value);
|
||||
hour = v_int / 3600 + "";//获得小时;
|
||||
minute = v_int % 3600 / 60 + "";//获得小时;
|
||||
second = v_int % 3600 % 60 + "";//获得小时;
|
||||
//获得小时
|
||||
hour = v_int / 3600 + "";;
|
||||
//获得小时
|
||||
minute = v_int % 3600 / 60 + "";;
|
||||
//获得小时
|
||||
second = v_int % 3600 % 60 + "";;
|
||||
}
|
||||
return (hour.length() > 1 ? hour : "0" + hour) + ":" + (minute.length() > 1 ? minute : "0" + minute) + ":" + (second.length() > 1 ? second : "0" + second);
|
||||
}
|
||||
@@ -480,25 +483,32 @@ public class DateUtil {
|
||||
Date dd = DateUtil.strToDate(sdate);
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(dd);
|
||||
if (num.equals(CommonFinalParam.ONE)) // 返回星期一所在的日期
|
||||
// 返回星期一所在的日期
|
||||
if (num.equals(CommonFinalParam.ONE))
|
||||
{
|
||||
c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
|
||||
} else if (num.equals("2")) // 返回星期二所在的日期
|
||||
// 返回星期二所在的日期
|
||||
} else if ("2".equals(num))
|
||||
{
|
||||
c.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
|
||||
} else if (num.equals("3")) // 返回星期三所在的日期
|
||||
// 返回星期三所在的日期
|
||||
} else if ("3".equals(num))
|
||||
{
|
||||
c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
|
||||
} else if (num.equals("4")) // 返回星期四所在的日期
|
||||
// 返回星期四所在的日期
|
||||
} else if ("4".equals(num))
|
||||
{
|
||||
c.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY);
|
||||
} else if (num.equals("5")) // 返回星期五所在的日期
|
||||
// 返回星期五所在的日期
|
||||
} else if ("5".equals(num))
|
||||
{
|
||||
c.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
|
||||
} else if (num.equals("6")) // 返回星期六所在的日期
|
||||
// 返回星期六所在的日期
|
||||
} else if ("6".equals(num))
|
||||
{
|
||||
c.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
|
||||
} else if (num.equals("0")) // 返回星期日所在的日期
|
||||
// 返回星期日所在的日期
|
||||
} else if ("0".equals(num))
|
||||
{
|
||||
c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
|
||||
}
|
||||
@@ -551,10 +561,10 @@ public class DateUtil {
|
||||
* @return
|
||||
*/
|
||||
public static long getDays(String date1, String date2) {
|
||||
if (date1 == null || date1.equals("")) {
|
||||
if (date1 == null || "".equals(date1)) {
|
||||
return 0;
|
||||
}
|
||||
if (date2 == null || date2.equals("")) {
|
||||
if (date2 == null || "".equals(date2)) {
|
||||
return 0;
|
||||
}
|
||||
// 转换为标准时间
|
||||
@@ -643,23 +653,27 @@ public class DateUtil {
|
||||
public static String getStringDateMonth(String sdate, String nd, String yf, String rq, String format) {
|
||||
Date currentTime = new Date();
|
||||
String dateString = formatter.format(currentTime);
|
||||
String s_nd = dateString.substring(0, 4); // 年份
|
||||
String s_yf = dateString.substring(5, 7); // 月份
|
||||
String s_rq = dateString.substring(8, 10); // 日期
|
||||
// 年份
|
||||
String s_nd = dateString.substring(0, 4);
|
||||
// 月份
|
||||
String s_yf = dateString.substring(5, 7);
|
||||
// 日期
|
||||
String s_rq = dateString.substring(8, 10);
|
||||
String sreturn = "";
|
||||
//roc.util.MyChar mc = new roc.util.MyChar();
|
||||
//if (sdate == null || sdate.equals("") || !mc.Isdate(sdate)) { // 处理空值情况
|
||||
if (sdate == null || sdate.equals("")) {
|
||||
// 处理空值情况
|
||||
//if (sdate == null || sdate.equals("") || !mc.Isdate(sdate)) {
|
||||
if (sdate == null || "".equals(sdate)) {
|
||||
if (nd.equals(CommonFinalParam.ONE)) {
|
||||
sreturn = s_nd;
|
||||
// 处理间隔符
|
||||
if (format.equals(CommonFinalParam.ONE)) {
|
||||
sreturn = sreturn + "年";
|
||||
} else if (format.equals("2")) {
|
||||
} else if ("2".equals(format)) {
|
||||
sreturn = sreturn + "-";
|
||||
} else if (format.equals("3")) {
|
||||
} else if ("3".equals(format)) {
|
||||
sreturn = sreturn + "/";
|
||||
} else if (format.equals("5")) {
|
||||
} else if ("5".equals(format)) {
|
||||
sreturn = sreturn + ".";
|
||||
}
|
||||
}
|
||||
@@ -668,11 +682,11 @@ public class DateUtil {
|
||||
sreturn = sreturn + s_yf;
|
||||
if (format.equals(CommonFinalParam.ONE)) {
|
||||
sreturn = sreturn + "月";
|
||||
} else if (format.equals("2")) {
|
||||
} else if ("2".equals(format)) {
|
||||
sreturn = sreturn + "-";
|
||||
} else if (format.equals("3")) {
|
||||
} else if ("3".equals(format)) {
|
||||
sreturn = sreturn + "/";
|
||||
} else if (format.equals("5")) {
|
||||
} else if ("5".equals(format)) {
|
||||
sreturn = sreturn + ".";
|
||||
}
|
||||
}
|
||||
@@ -686,19 +700,22 @@ public class DateUtil {
|
||||
} else {
|
||||
// 不是空值,也是一个合法的日期值,则先将其转换为标准的时间格式
|
||||
sdate = getOKDate(sdate);
|
||||
s_nd = sdate.substring(0, 4); // 年份
|
||||
s_yf = sdate.substring(5, 7); // 月份
|
||||
s_rq = sdate.substring(8, 10); // 日期
|
||||
// 年份
|
||||
s_nd = sdate.substring(0, 4);
|
||||
// 月份
|
||||
s_yf = sdate.substring(5, 7);
|
||||
// 日期
|
||||
s_rq = sdate.substring(8, 10);
|
||||
if (nd.equals(CommonFinalParam.ONE)) {
|
||||
sreturn = s_nd;
|
||||
// 处理间隔符
|
||||
if (format.equals(CommonFinalParam.ONE)) {
|
||||
sreturn = sreturn + "年";
|
||||
} else if (format.equals("2")) {
|
||||
} else if ("2".equals(format)) {
|
||||
sreturn = sreturn + "-";
|
||||
} else if (format.equals("3")) {
|
||||
} else if ("3".equals(format)) {
|
||||
sreturn = sreturn + "/";
|
||||
} else if (format.equals("5")) {
|
||||
} else if ("5".equals(format)) {
|
||||
sreturn = sreturn + ".";
|
||||
}
|
||||
}
|
||||
@@ -707,11 +724,11 @@ public class DateUtil {
|
||||
sreturn = sreturn + s_yf;
|
||||
if (format.equals(CommonFinalParam.ONE)) {
|
||||
sreturn = sreturn + "月";
|
||||
} else if (format.equals("2")) {
|
||||
} else if ("2".equals(format)) {
|
||||
sreturn = sreturn + "-";
|
||||
} else if (format.equals("3")) {
|
||||
} else if ("3".equals(format)) {
|
||||
sreturn = sreturn + "/";
|
||||
} else if (format.equals("5")) {
|
||||
} else if ("5".equals(format)) {
|
||||
sreturn = sreturn + ".";
|
||||
}
|
||||
}
|
||||
@@ -754,7 +771,7 @@ public class DateUtil {
|
||||
* @version 2015-3-31 上午09:29:31 <br/>
|
||||
*/
|
||||
public static String getOKDate(String sdate) {
|
||||
if (sdate == null || sdate.equals("")) {
|
||||
if (sdate == null || "".equals(sdate)) {
|
||||
return getStringDateShort();
|
||||
}
|
||||
|
||||
@@ -840,7 +857,7 @@ public class DateUtil {
|
||||
calendar.setTime(new Date());
|
||||
String five = " 05:00:00";
|
||||
|
||||
if (getDateAMPM().equals("AM") && compareToDateString(getStringDate(), getStringDateShort() + five) == -1) {
|
||||
if ("AM".equals(getDateAMPM()) && compareToDateString(getStringDate(), getStringDateShort() + five) == -1) {
|
||||
dates[0] = getBeforeDay(calendar) + five;
|
||||
dates[1] = getStringDateShort() + five;
|
||||
} else {
|
||||
@@ -856,7 +873,7 @@ public class DateUtil {
|
||||
calendar.setTime(new Date());
|
||||
String five = " 05:00:00";
|
||||
String reStr = "";
|
||||
if (getDateAMPM().equals("AM") && compareToDateString(getStringDate(), getStringDateShort() + five) == -1) {
|
||||
if ("AM".equals(getDateAMPM()) && compareToDateString(getStringDate(), getStringDateShort() + five) == -1) {
|
||||
reStr = getBeforeDay(calendar);
|
||||
} else {
|
||||
reStr = getStringDateShort();
|
||||
|
||||
@@ -14,6 +14,9 @@ import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public class ExportCSVUtil {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ExportCSVUtil.class);
|
||||
|
||||
@@ -27,6 +27,9 @@ import java.net.UnknownHostException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
@Slf4j
|
||||
public class ReadUtil {
|
||||
|
||||
@@ -69,7 +72,7 @@ public class ReadUtil {
|
||||
String key = (String) it.next();
|
||||
Item byteItem = group.addItem(key);
|
||||
Object o = strings.get(key);
|
||||
if (o == null || o.equals("")) {
|
||||
if (o == null || "".equals(o)) {
|
||||
break;
|
||||
}
|
||||
WriteRequest write1 = new WriteRequest(byteItem, new JIVariant(o.toString()));
|
||||
|
||||
Reference in New Issue
Block a user