From 4fabfe4dbd2eb28d07a4350597d314958cc1c281 Mon Sep 17 00:00:00 2001 From: MrShi <1878285526@qq.com> Date: 星期四, 09 十月 2025 11:16:43 +0800 Subject: [PATCH] 优化 --- server/services/src/main/java/com/doumee/core/constants/Constants.java | 348 ++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 300 insertions(+), 48 deletions(-) diff --git a/server/services/src/main/java/com/doumee/core/constants/Constants.java b/server/services/src/main/java/com/doumee/core/constants/Constants.java index b1cfc2a..bf2d151 100644 --- a/server/services/src/main/java/com/doumee/core/constants/Constants.java +++ b/server/services/src/main/java/com/doumee/core/constants/Constants.java @@ -1,86 +1,196 @@ package com.doumee.core.constants; +import ch.qos.logback.core.util.COWArrayList; +import com.doumee.dao.business.web.request.LocaltionDTO; import org.apache.commons.codec.binary.Hex; import org.apache.commons.lang3.StringUtils; import javax.servlet.http.HttpServletRequest; +import java.awt.*; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.net.InetAddress; import java.net.UnknownHostException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; +import java.util.*; import java.util.List; -import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Constants { - public static final String DEFAULT_PWD = "DEFAULT_PWD"; - public static final String TRUE = "t"; - public static final String FALSE = "f"; - public static final String TOKEN = "TOKEN"; - public static final String SYSTEM = "SYSTEM"; - public static final String MINI_PROGRAMME = "MINI_PROGRAMME"; - public static final String IMG_DIR = "IMG_DIR"; - public static final String FILE_DIR = "FILE_DIR"; - public static final String PRIVATE_KEY = "PRIVATE_KEY"; - public static String REDIS_DEBUG_STR = "test_"; + public static final String DEFAULT_PWD = "DEFAULT_PWD"; + public static final String TRUE = "t"; + public static final String FALSE = "f"; + public static final String TOKEN ="TOKEN" ; + public static final String SYSTEM ="SYSTEM" ; + public static final String DINGDING ="DINGDING" ; + public static final String DINGDING_APPKEY ="DINGDING_APPKEY" ; + public static final String DINGDING_CHATTOKEN ="DINGDING_CHATTOKEN" ; + public static final String DINGDING_ROBOTCODE ="DINGDING_ROBOTCODE" ; + public static final String DINGDING_SECRET ="DINGDING_SECRET" ; + public static final String DINGDING_TOKEN ="DINGDING_TOKEN" ; - /** - * 鏁版嵁鏉冮檺鑼冨洿锛�0鍙湅鑷繁锛�1鍙湅鑷繁鎵�鍦ㄦ牎鍖猴紱2鐪嬪叏閮ㄦ牎鍖猴紱3鐪嬫寚瀹氭牎鍖猴紙澶氶�夛級 - */ - public interface PermissionType { - int self = 0; - int self_campus = 1; - int all = 2; - int partful = 3; - } + public static final String MINI_PROGRAMME ="MINI_PROGRAMME" ; + public static final String FREE_RENT_TIME ="FREE_RENT_TIME" ; + public static final String LOW_VOLTAGE ="LOW_VOLTAGE" ; + public static final String ACCESS_TOKEN ="ACCESS_TOKEN" ; + public static final String IMG_DIR = "IMG_DIR"; + public static final String FILE_DIR ="FILE_DIR" ; + public static final String PRIVATE_KEY = "PRIVATE_KEY"; + public static final String PROJECT_FILE = "PROJECT_FILE"; + public static final String PROJECTS = "PROJECTS"; + public static final String DISCOUNT = "DISCOUNT"; + public static final String ELEC_BIKE_CONTRIL_API_URL = "ELEC_BIKE_CONTRIL_API_URL"; + public static final String FORCE_BACK_LOCK = "FORCE_BACK_LOCK"; + public static final String FORCE_BACK_SITE = "FORCE_BACK_SITE"; + //杞﹁締绫诲瀷鏁版嵁 + public static final String BIKE_TYPE ="0,1,2,3,4,5,6,7,8" ; + public static final String MINI_PROGRAMME_REALEASE ="MINI_PROGRAMME_REALEASE" ; + public static final String TIME_OUT_TEMPID ="TIME_OUT_TEMPID" ; - public interface goodsorderStatus { - int waitPay = 0; - int pay = 1; - int cancel = 2; - int fail = 3; - int over = 4; + public static final int FOUR =4 ; + public static final String PAUSE_BIKE_TYPE ="PAUSE_BIKE_TYPE" ; + public static final String HEART_TIME_EXPIRE_TIME ="HEART_TIME_EXPIRE_TIME" ; + public static final String PARK_LAT_LNG_LIST = "PARK_LAT_LNG_LIST"; + public static final String LOW_BIKE_VOLTAGE ="LOW_BIKE_VOLTAGE" ; + public static final String OBLINE_HEART_TIME_LIMIT ="OBLINE_HEART_TIME_LIMIT" ; + public static final String EBIKE_PREFIX ="ebike-" ; + public static String REDIS_DEBUG_STR="test_"; + public static final String AD = "AD"; + public static String REPAIR = "REPAIR"; + public static final String NOTICE_SITE_LINK_LIMIT="NOTICE_SITE_LINK_LIMIT"; + + public static boolean equalsInteger(Integer a, Integer b) { + if (formatIntegerNum(a) == formatIntegerNum(b)) { + return true; } + return false; + } + + public interface MqttTopic{ + + String topic_index = "device/lock/"; + //寮�閿侊紙鍙戝竷锛� + String pub_openLock = "device/lock/{siteId}/{lockId}/unlock"; + //绔欑偣鍏ㄩ噺閿佸ご鏁伴噺淇℃伅 + String sub_siteInfo = "device/lock/+/siteInfo"; + //绠$悊鍛樺埛鍗¤褰曚笂鎶� + String sub_adminCard = "device/lock/+/+/adminCard"; + //閿佷俊鎭紝鍦ㄥ垵濮嬪寲銆佺姸鎬佸彉鏇存椂浼氭帹閫侀攣鐨勫畬鏁寸姸鎬�(璁㈤槄锛� + String sub_lockInfo = "device/lock/+/+/info"; + //杩樿溅閿佸ご锛堣闃咃級 + String sub_closeLock = "device/lock/+/+/bike"; + String sub_health= "device/lock/+/health"; + + String sub_brokers = "$SYS/brokers/+/clients/#"; + //瀹炴椂鑾峰彇閿佷俊鎭紙鍙戝竷锛� + String pub_getLockInfo = "device/lock/{siteId}/{lockId}/getInfo"; + } + + /** + * 鏁版嵁鏉冮檺鑼冨洿锛�0鍙湅鑷繁锛�1鍙湅鑷繁鎵�鍦ㄦ牎鍖猴紱2鐪嬪叏閮ㄦ牎鍖猴紱3鐪嬫寚瀹氭牎鍖猴紙澶氶�夛級 + */ + public interface PermissionType{ + int self =0; + int self_campus =1; + int all =2; + int partful = 3; + } + public interface LockStatus{ + // //鐘舵�侊紝0闂悎, 1鎵撳紑锛�2杩愯涓�, 3寮傚父 -1鑷 + int closed =0; + int open =1; + int running =2; + int error= 3; + int checking= -1; + } + public interface goodsorderStatus{ + int waitPay =0; + int pay =1; + int cancel =2; + int fail = 3; + int over = 4; + } public interface goodsorderPayStatus{ int waitPay =0; int pay =1; } - public interface transactionsType{ - int deposit =0; - int consumption =1; - int refund =2; - int platformRefund = 3; + public enum TRANSACTIONS_TYPE{ + //浜ゆ槗绫诲瀷 0绉熻溅鎶奸噾 1缁撶畻瀹為檯娑堣垂 2缁撶畻閫�娆� 3骞冲彴閫�娆�" + DEPOSIT(0,"绉熻溅鎶奸噾", "绉熻溅鎶奸噾"), + + CONSUMPTION(1,"璁㈠崟娑堣垂缁撶畻", "璁㈠崟娑堣垂缁撶畻"), + + REFUND(2,"缁撶畻閫�鎶奸噾", "缁撶畻閫�鎶奸噾"), + + PLATFORM_REFUND(3,"骞冲彴閫�娆�", "骞冲彴閫�娆�"), + + DISCOUNT(4,"濂楅璐拱", "濂楅璐拱") + + ; + String name; + + Integer key; + + String info; + + TRANSACTIONS_TYPE(Integer key, String name, String info) { + this.name = name; + this.key = key; + this.info = info; + } + public static TRANSACTIONS_TYPE get(int key) { + TRANSACTIONS_TYPE[] values = TRANSACTIONS_TYPE.values(); + for (TRANSACTIONS_TYPE object : values) { + if (object.key == key) { + return object; + } + } + return null; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getKey() { + return key; + } + + public void setKey(Integer key) { + this.key = key; + } + + public String getInfo() { + return info; + } + + public void setInfo(String info) { + this.info = info; + } } + public static String getUUID(){ return UUID.randomUUID().toString().replace("-",""); } public interface RedisKeys { public static final String submission_period_key = "sp_"; + public static final String import_bikes = "import_bikes"; } - public static final String ACCESS_ID = "ACCESS_ID"; - public static final String BUCKETNAME = "BUCKETNAME"; - public static final String OSS = "OSS"; - public static final String ACCESS_KEY = "ACCESS_KEY"; - - public static final String SCRATCH_REDIRECT = "SCRATCH_REDIRECT"; - public static final String ENDPOINT = "ENDPOINT"; - - public static final String TESTCASE_UPLOAD_PATH = "TESTCASE_UPLOAD_PATH"; - public static final String RESOURCE_PATH = "RESOURCE_PATH"; - public static final String UPLOAD_FILE = "UPLOAD_FILE"; public static final String AVATAR_FILE = "AVATAR_FILE"; //鐢ㄦ埛鍗忚 public static final String AGREEMENT = "AGREEMENT"; @@ -98,8 +208,36 @@ public static final String LEASE_NOTICE_URL = "LEASE_NOTICE_URL"; //鎶奸噾 public static final String RENT_DEPOSIT = "RENT_DEPOSIT"; + //鐢佃溅涓村仠鑷姩鍏抽攣鏃堕暱锛堝垎閽燂級 + public static final String PAUSE_AUTO_CLOSE_TIME = "PAUSE_AUTO_CLOSE_TIME"; + //娓╅Θ鎻愮ず public static final String TIPS = "TIPS"; + //娓╅Θ鎻愮ず + public static final String RENT_NOTICE = "RENT_NOTICE"; + //灏忕▼搴忓仠姝㈡湇鍔℃彁绀� + public static final String STOP_SERVE_TIPS = "STOP_SERVE_TIPS"; + //灏忕▼搴忔槸鍚﹀仠姝㈡湇鍔� 0鍚� 1鏄� + public static final String IS_STOP_SERVE = "IS_STOP_SERVE"; + //灏忕▼搴忓仠姝㈠紑濮嬫椂闂� + public static final String STOP_SERVE_STARTTIME = "STOP_SERVE_STARTTIME"; + //灏忕▼搴忓仠姝㈢粨鏉熸椂闂� + public static final String STOP_SERVE_ENDTIME = "STOP_SERVE_ENDTIME"; + //灏忕▼搴忔瘡鏃ユ湇鍔″紑濮嬫椂闂� + public static final String BUSINESS_STARTTIME = "BUSINESS_STARTTIME"; + //灏忕▼搴忔瘡鏃ユ湇鍔$粨鏉熸椂闂� + public static final String BUSINESS_ENDTIME = "BUSINESS_ENDTIME"; + //鐢佃溅浜岀淮鐮佸墠缂� + public static final String ELECTRICITY_PREFIX = "ELECTRICITY_PREFIX"; + + //閽夐拤閫氱煡鍦板潃 + public static final String DINGDING_URL = "DINGDING_URL"; + //閽夐拤绛惧悕 + + //灏忕▼搴忔弧杞介璀�(%)鏈�澶у�� + public static final String WARN_MAX = "WARN_MAX"; + //灏忕▼搴忔弧杞介璀�(%)鏈�灏忓�� + public static final String WARN_MIN = "WARN_MIN"; public static final String FILES_DIR = "FILES_DIR"; @@ -114,6 +252,14 @@ return 0; } return num; + } + public static Integer formatIntegerFromStr(String num) { + try { + return Integer.parseInt(num); + }catch (Exception e){ + + } + return null; } public interface UserActionsType { @@ -132,6 +278,52 @@ String rent = "RENT"; } + public interface ActionLogObjType { + int memberrides =0;//楠戣璁板綍 + + } + + public enum ACTIONLOG_TYPE{ + // 0楠戣璁板綍 + FORCE_BACK(0,"寮哄埗杩樿溅","鍚庡彴寮哄埗杩樿溅"), + UPDATE_DURATION(1,"淇敼楠戣鏃堕暱","鍚庡彴淇敼楠戣鏃堕暱") + ; + String name; + + Integer key; + + String info; + + ACTIONLOG_TYPE(Integer key,String name, String info) { + this.name = name; + this.key = key; + this.info = info; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getKey() { + return key; + } + + public void setKey(Integer key) { + this.key = key; + } + + public String getInfo() { + return info; + } + + public void setInfo(String info) { + this.info = info; + } + } public enum GOODSORDER_STATUS{ // 0寰呮敮浠� 1宸叉敮浠� 2宸插彇娑� 3鏀粯澶辫触 4宸茬粨绠� UN_PAY("寰呮敮浠�", 0,"寰呮敮浠�"), @@ -181,6 +373,63 @@ } } + public enum REFUND_TYPE{ + // '閫�娆剧被鍨� 0鐢ㄦ埛缁撶畻閫�娆� 1骞冲彴鑷姩缁撶畻閫�娆� 2寮哄埗缁撶畻閫�娆� 3缁撶畻鍚庨��娆�' + NORMAL( 0,"鐢ㄦ埛缁撶畻閫�娆�","缁撶畻閫�鎶奸噾"), + + PLAT_AUTO( 1,"骞冲彴鑷姩缁撶畻閫�娆�","骞冲彴閫�鎶奸噾"), + + PLAT_FORCE( 2,"寮哄埗缁撶畻閫�娆�","骞冲彴閫�鎶奸噾"), + + BACK( 3,"缁撶畻鍚庨��娆�","骞冲彴閫�娆�"), + + ; + String name; + + Integer key; + + String info; + + + REFUND_TYPE(Integer key,String name, String info) { + this.name = name; + this.key = key; + this.info = info; + } + + public static REFUND_TYPE get(int key) { + REFUND_TYPE[] values = REFUND_TYPE.values(); + for (REFUND_TYPE object : values) { + if (object.key == key) { + return object; + } + } + return null; + } + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getKey() { + return key; + } + + public void setKey(Integer key) { + this.key = key; + } + + public String getInfo() { + return info; + } + + public void setInfo(String info) { + this.info = info; + } + } public enum MEMBER_RIDES_STATUS{ // 0璇锋眰寮�閿佷腑 1楠戣涓� 2宸茶繕杞� 3寮�閿佸け璐� LOCKING("璇锋眰寮�閿佷腑", 0,"璇锋眰寮�閿佷腑"), @@ -189,7 +438,8 @@ BACK_CYCLING("宸茶繕杞�", 2,"宸茶繕杞�"), - LOCKING_DEFEAT("寮�閿佸け璐�", 3,"寮�閿佸け璐�") + LOCKING_DEFEAT("寮�閿佸け璐�", 3,"寮�閿佸け璐�"), + RIDES_PAUSING("涓村仠涓�", 4,"涓村仠涓�") ; String name; @@ -227,7 +477,6 @@ this.info = info; } } - public static BigDecimal formatDecimalNum(BigDecimal num) { if (num == null) { return new BigDecimal(0); @@ -249,21 +498,18 @@ } return 0; } - public static long formatLongNum(Long num) { if (num == null) { return 0; } return num; } - public static String formatImgPath(String avatar, String imgPath) { if (StringUtils.isBlank(avatar)) { return null; } return imgPath + avatar; } - public static String getIpAddr(HttpServletRequest request) { String ipAddress = request.getHeader("x-forwarded-for"); if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { @@ -372,4 +618,10 @@ } + public static BigDecimal translateMoney(BigDecimal money){ + return Constants.formatDecimalNum(money).divide(new BigDecimal(100), 2, BigDecimal.ROUND_UP); + + } + + } -- Gitblit v1.9.3