| | |
| | | package com.doumee.core.utils; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.text.Collator; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | |
| | | public class Constants { |
| | | public static final String HEADER_USER_TOKEN = "dm_user_token"; |
| | | public static final String REDIS_USER_KEY = "user_token_list_"; |
| | | public static final String REDIS_TOKEN_KEY = "token_"; |
| | | public static final String REDIS_HK_TOKEN_KEY = "hk_token_"; |
| | | public static final String HK_TOKEN_VALIDITY = "HK_TOKEN_VALIDITY"; |
| | |
| | | public static final int ZERO = 0 ; |
| | | public static final int ONE = 1 ; |
| | | public static final int TWO = 2 ; |
| | | public static final Integer DD_STATUS_SUCCESS_CODE = 200 ; |
| | | public static final Long DD_ERR_CODE = 0L ; |
| | | public static final String HK_PARAM ="HK_PARAM" ; |
| | | public static final String HK_WEBSITE_DOMAIN_URL ="HK_WEBSITE_DOMAIN_URL" ; |
| | | public static final String LED_CONTENT_SPEED ="LED_CONTENT_SPEED" ; |
| | | public static final String HK_HOST ="HK_HOST" ; |
| | | public static final String HK_APPKEY ="HK_APPKEY" ; |
| | |
| | | public static final String HK_HTTPS ="HK_HTTPS" ; |
| | | public static final String HK_PUSH_URL = "HK_PUSH_URL"; |
| | | public static final String HK_CARS_OPENAPI_ACCESS_KEY = "HK_CARS_OPENAPI_ACCESS_KEY"; |
| | | public static final String GAODE_DISTANCE_GEOAPI_URL = "GAODE_DISTANCE_GEOAPI_URL"; |
| | | public static final String HK_CARS_OPENAPI_ACCESS_SECRET = "HK_CARS_OPENAPI_ACCESS_SECRET"; |
| | | public static final String HK_CARS_OPENAPI_URL = "HK_CARS_OPENAPI_URL"; |
| | | public static final String HK_ROOTORG_CODE ="HK_ROOTORG_CODE" ; |
| | |
| | | public static final String SIGN_IN_ATTENTION ="SIGN_IN_ATTENTION" ; |
| | | public static final String SIGN_IN_QRCODE_PREFIX ="SIGN_IN_QRCODE_PREFIX" ; |
| | | |
| | | /** |
| | | * 操作类型,用于做接口验证分组 |
| | | */ |
| | | public interface OperaType { |
| | | |
| | | /** |
| | | * 创建 |
| | | */ |
| | | interface Create {} |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | interface Update {} |
| | | |
| | | /** |
| | | * 修改状态 |
| | | */ |
| | | interface UpdateStatus {} |
| | | } |
| | | |
| | | public static final String WEATHER_CONFIG ="WEATHER_CONFIG" ; |
| | | public static final String REQUEST_URL ="REQUEST_URL" ; |
| | | public static final String LOCATION ="LOCATION" ; |
| | | public static final String API_KEY ="API_KEY" ; |
| | | public static final String CABINET_CONFIG ="CABINET_CONFIG" ; |
| | | public static final String BLOW_TIME ="BLOW_TIME" ; |
| | | public static final String PRESSURE ="PRESSURE" ; |
| | | public static final String CONCENTRATION ="CONCENTRATION" ; |
| | | public static final String THRESHOLD ="THRESHOLD" ; |
| | | public static final String LINK_PHONE ="LINK_PHONE" ; |
| | | //被拜访人信息校验方式(0手机号单独校验 1手机号和姓名组合校验) |
| | | public static final String BEVISITED_USER_VALID = "BEVISITED_USER_VALID"; |
| | | public static final String LW_BEVISITED_USER_VALID = "LW_BEVISITED_USER_VALID"; |
| | |
| | | public static final String FTP_PORT ="FTP_PORT" ; |
| | | public static final String FTP_USERNAME ="FTP_USERNAME" ; |
| | | public static final String FTP_PWD ="FTP_PWD" ; |
| | | public static final String COMPANY_DOCUMENTS ="COMPANY_DOCUMENTS" ; |
| | | public static final String APP_FILE ="APP_FILE" ; |
| | | |
| | | public static final String FTP_RESOURCE_PATH ="FTP_RESOURCE_PATH" ; |
| | | public static final String FTP_LOCAL_RESOURCE_PATH ="FTP_LOCAL_RESOURCE_PATH" ; |
| | | public static final String ERP_ORGLIST_URL ="ERP_ORGLIST_URL" ; |
| | | public static final String ERP_USERLIST_URL ="ERP_USERLIST_URL" ; |
| | | public static final String ERP_APPROVE_URL ="ERP_APPROVE_URL" ; |
| | | public static final String ERP_USERSTATUS_RL ="ERP_USERSTATUS_RL" ; |
| | | |
| | | public static final String ERP ="ERP" ; |
| | | public static final Integer THREE =3 ; |
| | | public static final Integer FOUR =4 ; |
| | | public static final Integer FIVE =5 ; |
| | | public static final Integer SIX =6 ; |
| | | public static final String ORG_USER_ORIGIN = "ORG_USER_ORIGIN"; |
| | | public static final String VIRTUAL_CARD_INDEX = "02098469790"; |
| | | public static final String RETRY_CONNECT_NUM ="RETRY_CONNECT_NUM" ; |
| | |
| | | public static final String SCREEN_SEVENT_ARRIVAL_STARTDATE = "SCREEN_SEVENT_ARRIVAL_STARTDATE"; |
| | | public static final String EARLY_START_WX_NOTICE = "EARLY_START_WX_NOTICE"; |
| | | public static final String OVER_NOTICE_WX = "OVER_NOTICE_WX"; |
| | | public static final String PRESSURE_LEVEL_UNIT = "PRESSURE_LEVEL_UNIT"; |
| | | public static final String LIQUID_LEVEL_UNIT ="LIQUID_LEVEL_UNIT" ; |
| | | public static final String OUT_HY_LOT_TOTAL ="OUT_HY_LOT_TOTAL" ; |
| | | public static final String BANNER_IMG ="BANNER_IMG" ; |
| | | public static final String COMPANY_LOCATION = "COMPANY_LOCATION"; |
| | | public static final String GAODE_LOCATION_GEOAPI_URL = "GAODE_LOCATION_GEOAPI_URL"; |
| | | |
| | | public static boolean DEALING_HK_SYNCPRIVILEGE= false; |
| | | public static boolean DEALING_HK_SYNCDEVICE = false; |
| | |
| | | int invalid =9; |
| | | } |
| | | |
| | | /** |
| | | * 0=访客车辆-访客车辆 |
| | | * 1=wms推送的物流车辆(非自有车):货运车辆-外协运输车辆 |
| | | * 2= 市公司的预约入园车辆:货运车辆-市公司卸货车辆 |
| | | * 3= 安泰的预约入园车辆:货运车辆-加工烟卸货车辆 |
| | | * 4= 安泰公务车:公务车-安泰物流公务用车 |
| | | * 5= 安泰自有车:货运车辆-安泰物流货运车辆 |
| | | */ |
| | | public interface RetentionCarType{ |
| | | //车辆类型 0内部车辆 1相关方车辆 2访客车辆 3内运物流车 4外协车辆 5市公司卸货车 |
| | | int internal = 0; |
| | | int relation = 1; |
| | | int visitor = 2; |
| | | int selfTruck = 3; |
| | | int outTruck = 4; |
| | | int cityComTruck = 5; |
| | | int unknown = 6; |
| | | //作业类型 0自有车卸货 1自有车装货 2外协车卸货 3外协车装货 4市公司外协车卸货 |
| | | // int internal = 0; |
| | | // int relation = 1; |
| | | // int visitor = 2; |
| | | // int selfTruck = 3; |
| | | // int outTruck = 4; |
| | | // int cityComTruck = 5; |
| | | // int unknown = 6; |
| | | int fkCar = 0;//访客车辆-访客车辆 |
| | | int wxysCar = 1;//推送的物流车辆(非自有车):货运车辆-外协运输车辆 |
| | | int sgsxhCar = 2;//市公司的预约入园车辆:货运车辆-市公司卸货车辆 |
| | | int jgyxhCar = 3;//安泰的预约入园车辆:货运车辆-加工烟卸货车辆 |
| | | int atwlgwCar = 4;//安泰公务车:公务车-安泰物流公务用车 |
| | | int atwlzyCar = 5;//安泰自有车:货运车辆-安泰物流货运车辆 |
| | | int other = 6;//未知车辆 |
| | | int self = 7;//自有车 |
| | | } |
| | | |
| | | /** |
| | | * 在场人员类型 |
| | | */ |
| | | public interface RetentionMemberType{ |
| | | //类型 0劳务访客 1普通访客 2内部员工 3车辆信息 4相关方人员 5货运司机 |
| | | int lwfk = 0;//0劳务访客 |
| | | int fk = 1;//1普通访客 |
| | | int internalMember = 2;//内部员工 |
| | | int car = 3;//车辆信息 |
| | | int relMember = 4;//相关方人员 |
| | | int driver = 5;//货运司机 |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | public static final String HOME_IMAGE ="HOME_IMAGE"; |
| | | public static final String DD_TALK ="DD_TALK"; |
| | | public static final String APP_KEY ="APP_KEY"; |
| | | public static final String APP_SECRET ="APP_SECRET"; |
| | | public static final String ACCESS_TOKEN ="ACCESS_TOKEN"; |
| | | public static final String AGENT_ID ="AGENT_ID"; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | public static final String PROHIBIT_TIME = "PROHIBIT_TIME"; |
| | | public static final String ERR_TIMES = "ERR_TIMES"; |
| | | public static final String PROHIBIT_LOGIN_OPEN = "PROHIBIT_LOGIN_OPEN"; |
| | | public static final String OPEN_JOINT_ACCOUNT = "OPEN_JOINT_ACCOUNT"; |
| | | |
| | | |
| | | |
| | | public interface RedisKeys { |
| | | public static final String IMPORTING_CARS ="IMPORTING_CARS"; |
| | | public static final String CHECKING_JKCUSTOMER_LOCATION ="CHECKING_JKCUSTOMER_LOCATION"; |
| | | public static final String JKLINE_JOB ="JKLINE_JOB_"; |
| | | public static final String IMPORTING_JKCUSTOMER ="IMPORTING_JKCUSTOMER"; |
| | | public static final String IMPORTING_JKORDERS ="IMPORTING_JKORDERS"; |
| | | public static final String IMPORTING_JKLINE ="IMPORTING_JKLINE"; |
| | | public static final String IMPORTING_MEMBER ="IMPORTING_MEMBER"; |
| | | public static final String BIGSCREEN_UUID ="BIGSCREEN_UUID"; |
| | | public static final String IMPORTING_GAS ="IMPORTING_GAS"; |
| | |
| | | return d; |
| | | } |
| | | public static BigDecimal formatBigdecimal4Float(BigDecimal d) { |
| | | return formatBigdecimalScale(d,4); |
| | | } |
| | | public static BigDecimal formatBigdecimalScale(BigDecimal d,int scale) { |
| | | if (d == null) { |
| | | d = new BigDecimal(0.0); |
| | | } |
| | | //保留两位小数且四舍五入 |
| | | d = d.setScale(4, BigDecimal.ROUND_HALF_UP); |
| | | d = d.setScale(scale, BigDecimal.ROUND_HALF_UP); |
| | | return d; |
| | | } |
| | | public static BigDecimal formatBigdecimal0Float(BigDecimal d) { |
| | | if (d == null) { |
| | | d = new BigDecimal(0.0); |
| | | } |
| | | //保留两位小数且四舍五入 |
| | | d = d.setScale(0, BigDecimal.ROUND_HALF_UP); |
| | | return d; |
| | | return formatBigdecimalScale(d,0); |
| | | } |
| | | public static BigDecimal formatBigdecimal2Float(BigDecimal d) { |
| | | if (d == null) { |
| | | d = new BigDecimal(0.0); |
| | | } |
| | | //保留两位小数且四舍五入 |
| | | d = d.setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | return d; |
| | | return formatBigdecimalScale(d,2); |
| | | } |
| | | |
| | | |
| | |
| | | int reason = 6;//入园原因 |
| | | } |
| | | |
| | | public interface noticesObjectType{ |
| | | int visit = 0;//访客申请 |
| | | int visitReporting = 1;//访客报备 |
| | | int useCar = 2;//用车申请 |
| | | int dangerDeal = 3;//隐患处理 |
| | | int logisticsCarUse = 4;//物流车审批 |
| | | int system = 5;//系统消息 |
| | | int reason = 6;//入园原因 |
| | | int hknotice = 7;//海康考勤代办 |
| | | } |
| | | |
| | | |
| | | public static Integer approveTypeToNoticeType(Integer approveType){ |
| | |
| | | |
| | | |
| | | |
| | | public interface noticesObjectType{ |
| | | int visit = 0;//访客申请 |
| | | int visitReporting = 1;//访客报备 |
| | | int useCar = 2;//用车申请 |
| | | int dangerDeal = 3;//隐患处理 |
| | | int logisticsCarUse = 4;//物流车审批 |
| | | int system = 5;//系统消息 |
| | | int reason = 6;//入园原因 |
| | | int hknotice = 7;//海康考勤代办 |
| | | } |
| | | |
| | | |
| | | public interface approveStatus{ |
| | |
| | | // System.out.println(Constants.getVehiclePlateNo("湘B140D17").getDescription()); |
| | | // System.out.println(Constants.getVehiclePlateNo("宿AP0637").getDescription()); |
| | | |
| | | System.out.println("<script> SELECT \n" + |
| | | "t1.REALNAME `REALNAME`,\n" + |
| | | "MAX(t1.`01`) `januaryCount`,\n" + |
| | | "MAX(t1.`02`) `februaryCount`,\n" + |
| | | "MAX(t1.`03`) `marchCount`,\n" + |
| | | "MAX(t1.`04`) `aprilCount`,\n" + |
| | | "MAX(t1.`05`) `mayCount`,\n" + |
| | | "MAX(t1.`06`) `juneCount`,\n" + |
| | | "MAX(t1.`07`) `julyCount`,\n" + |
| | | "MAX(t1.`08`) `augustCount`,\n" + |
| | | "MAX(t1.`09`) `septemberCount`,\n" + |
| | | "MAX(t1.`10`) `octoberCount`,\n" + |
| | | "MAX(t1.`11`) `novemberCount`,\n" + |
| | | "MAX(t1.`12`) `decemberCount`\n" + |
| | | "FROM(\n" + |
| | | "SELECT \n" + |
| | | "t.id,\n" + |
| | | "t.REALNAME,\n" + |
| | | "CASE WHEN t.yue='01' THEN t.c ELSE 0 END AS `01`,\n" + |
| | | "CASE WHEN t.yue='02' THEN t.c ELSE 0 END AS `02`,\n" + |
| | | "CASE WHEN t.yue='03' THEN t.c ELSE 0 END AS `03`,\n" + |
| | | "CASE WHEN t.yue='04' THEN t.c ELSE 0 END AS `04`,\n" + |
| | | "CASE WHEN t.yue='05' THEN t.c ELSE 0 END AS `05`,\n" + |
| | | "CASE WHEN t.yue='06' THEN t.c ELSE 0 END AS `06`,\n" + |
| | | "CASE WHEN t.yue='07' THEN t.c ELSE 0 END AS `07`,\n" + |
| | | "CASE WHEN t.yue='08' THEN t.c ELSE 0 END AS `08`,\n" + |
| | | "CASE WHEN t.yue='09' THEN t.c ELSE 0 END AS `09`,\n" + |
| | | "CASE WHEN t.yue='10' THEN t.c ELSE 0 END AS `10`,\n" + |
| | | "CASE WHEN t.yue='11' THEN t.c ELSE 0 END AS `11`,\n" + |
| | | "CASE WHEN t.yue='12' THEN t.c ELSE 0 END AS `12` \n" + |
| | | "FROM \n" + |
| | | "(SELECT \n" + |
| | | "su.id,\n" + |
| | | "su.REALNAME,\n" + |
| | | "DATE_FORMAT(b.START_TIME,'%m') yue,\n" + |
| | | "SUM(" + |
| | | "CONVERT( (UNIX_TIMESTAMP(b.END_TIME) - UNIX_TIMESTAMP(b.START_TIME))/(60*60), DECIMAL(5,1))) c\n" + |
| | | "FROM \n" + |
| | | "meeting_user_rel ur\n" + |
| | | "LEFT JOIN `SYSTEM_USER` su ON ur.USER_ID = su.id \n" + |
| | | "LEFT JOIN meeting_book b ON ur.OBJ_ID = b.id \n" + |
| | | "WHERE DATE_FORMAT(b.START_TIME,'%Y') = #{yearNum} AND b.STATUS in(0,2) and b.isdeleted=0" + |
| | | "<if test='userId != null'>"+ |
| | | "and ur.USER_ID = #{userId}\n" + |
| | | "</if>"+ |
| | | "GROUP BY su.id, DATE_FORMAT(b.START_TIME,'%m')) t) t1 GROUP BY t1.id" + |
| | | "</script>"); |
| | | // 0789150665 C97B092F 0789150561 |
| | | |
| | | |
| | | System.out.println(getRFIDNumber("0789150745")); // 输出反转后的十六进制数 |
| | | } |
| | | |
| | | |
| | | |
| | | public static String getRFIDNumber(String no) { |
| | | try { |
| | | int number = Integer.parseInt(no); |
| | | String hexString = Integer.toHexString(number); |
| | | BigInteger bigInteger = new BigInteger(hexString, 16); // 示例十六进制数 |
| | | String reversedHex = new StringBuilder(bigInteger.toString(16)).reverse().toString(); |
| | | String result = ""; |
| | | for (int i =0;i< 4;i++){ |
| | | String t = reversedHex.substring(i*2,i*2+2); |
| | | result += new StringBuilder(t).reverse().toString(); |
| | | } |
| | | return result; |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 数据状态枚举 |
| | |
| | | AUTHED_LEAVE(9, "下发授权离园","下发授权离园" ), |
| | | LEAVED(10, "已离园 ","车辆从{data}离场 " ), |
| | | OVER_NUMBER(11, "已过号","超时未到指定月台自动过号" ), |
| | | CHANGE_GROUP(12, "更换月台组","从【{data}】更换到【{data1}】" ), |
| | | ; |
| | | |
| | | // 成员变量 |
| | |
| | | public String getNoteinfo() { |
| | | return noteinfo; |
| | | } |
| | | } |
| | | |
| | | |
| | | public static String strToJson(String key,String val){ |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put(key,val); |
| | | return JSONObject.toJSONString(map); |
| | | } |
| | | |
| | | |
| | | |
| | | public enum WarningConfig { |
| | | ALARM_TEST(10002, "酒精测试"), |
| | | GRID_TIME_OUT_INFO(10003, "开门超时未关闭"), |
| | | KEY_TIME_OUT_BACK(10004, "钥匙超时未归还"), |
| | | ; |
| | | // 成员变量 |
| | | private int key; |
| | | private String info; |
| | | |
| | | // 构造方法 |
| | | WarningConfig(int key,String info) { |
| | | this.key = key; |
| | | this.info = info; |
| | | } |
| | | |
| | | |
| | | public int getKey() { |
| | | return key; |
| | | } |
| | | |
| | | public void setKey(int key) { |
| | | this.key = key; |
| | | } |
| | | |
| | | public String getInfo() { |
| | | return info; |
| | | } |
| | | |
| | | public void setInfo(String info) { |
| | | this.info = info; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |