From b933bf8cfb7e0b3d231e7bc721b749fae54e911a Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 23 四月 2019 18:03:24 +0800
Subject: [PATCH] 删除feign工程
---
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java | 426 +++++++++++++++++++++++++++-------------------------
1 files changed, 223 insertions(+), 203 deletions(-)
diff --git a/java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java b/java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
index 4bb2dfe..c3a5d1a 100644
--- a/java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
+++ b/java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
@@ -9,13 +9,14 @@
import com.java110.common.factory.ApplicationContextFactory;
import com.java110.common.util.Assert;
import com.java110.common.util.DateUtil;
-import com.java110.feign.code.ICodeApi;
+import com.java110.core.smo.code.ICodeApi;
import org.springframework.web.client.RestTemplate;
import java.rmi.NoSuchObjectException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+import java.util.UUID;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@@ -76,56 +77,56 @@
public static final String CODE_PREFIX_floorId = "73";
/**
- *
* 鍙湁鍦ㄤ笉璋冪敤鏈嶅姟鐢熸垚ID鏃舵湁鐢�
*/
- private static Map<String,String> prefixMap = null;
+ private static Map<String, String> prefixMap = null;
+
static {
- prefixMap = new HashMap<String,String>();
+ prefixMap = new HashMap<String, String>();
//10+yyyymmdd+鍏綅搴忓垪
- prefixMap.put("oId","10");
+ prefixMap.put("oId", "10");
//锛�20+yyyymmdd+鍏綅搴忓垪锛�
- prefixMap.put("bId","20");
+ prefixMap.put("bId", "20");
//锛�11+yyyymmdd+鍏綅搴忓垪锛�
- prefixMap.put("attrId","11");
- prefixMap.put("transactionId","1000001");
- prefixMap.put("pageTransactionId","1000002");
- prefixMap.put("dataFlowId","2000");
- prefixMap.put("userId","30");
- prefixMap.put("storeId","40");
- prefixMap.put("storePhotoId","41");
- prefixMap.put("storeCerdentialsId","42");
- prefixMap.put("memberStoreId","43");
- prefixMap.put("propertyStoreId","44");
- prefixMap.put("storeUserId","45");
- prefixMap.put("shopId","50");
- prefixMap.put("shopAttrId","51");
- prefixMap.put("shopPhotoId","52");
- prefixMap.put("shopAttrParamId","53");
- prefixMap.put("shopPreferentialId","54");
- prefixMap.put("shopDescId","55");
- prefixMap.put("shopCatalogId","56");
- prefixMap.put("buyId","57");
- prefixMap.put("buyAttrId","58");
- prefixMap.put("commentId","60");
- prefixMap.put("subCommentId","61");
- prefixMap.put("subCommentAttrId","62");
- prefixMap.put("commentPhotoId","63");
- prefixMap.put("commentScoreId","64");
- prefixMap.put("communityId","70");
- prefixMap.put("communityPhotoId","71");
- prefixMap.put("communityMemberId","72");
- prefixMap.put("agentId","80");
- prefixMap.put("agentPhotoId","81");
- prefixMap.put("agentCerdentialsId","82");
- prefixMap.put("agentUserId","83");
- prefixMap.put("propertyId","90");
- prefixMap.put("propertyPhotoId","91");
- prefixMap.put("propertyCerdentialsId","92");
- prefixMap.put("propertyUserId","93");
- prefixMap.put("propertyFeeId","94");
- prefixMap.put("houseId","95");
- prefixMap.put("pgId","600");
+ prefixMap.put("attrId", "11");
+ prefixMap.put("transactionId", "1000001");
+ prefixMap.put("pageTransactionId", "1000002");
+ prefixMap.put("dataFlowId", "2000");
+ prefixMap.put("userId", "30");
+ prefixMap.put("storeId", "40");
+ prefixMap.put("storePhotoId", "41");
+ prefixMap.put("storeCerdentialsId", "42");
+ prefixMap.put("memberStoreId", "43");
+ prefixMap.put("propertyStoreId", "44");
+ prefixMap.put("storeUserId", "45");
+ prefixMap.put("shopId", "50");
+ prefixMap.put("shopAttrId", "51");
+ prefixMap.put("shopPhotoId", "52");
+ prefixMap.put("shopAttrParamId", "53");
+ prefixMap.put("shopPreferentialId", "54");
+ prefixMap.put("shopDescId", "55");
+ prefixMap.put("shopCatalogId", "56");
+ prefixMap.put("buyId", "57");
+ prefixMap.put("buyAttrId", "58");
+ prefixMap.put("commentId", "60");
+ prefixMap.put("subCommentId", "61");
+ prefixMap.put("subCommentAttrId", "62");
+ prefixMap.put("commentPhotoId", "63");
+ prefixMap.put("commentScoreId", "64");
+ prefixMap.put("communityId", "70");
+ prefixMap.put("communityPhotoId", "71");
+ prefixMap.put("communityMemberId", "72");
+ prefixMap.put("agentId", "80");
+ prefixMap.put("agentPhotoId", "81");
+ prefixMap.put("agentCerdentialsId", "82");
+ prefixMap.put("agentUserId", "83");
+ prefixMap.put("propertyId", "90");
+ prefixMap.put("propertyPhotoId", "91");
+ prefixMap.put("propertyCerdentialsId", "92");
+ prefixMap.put("propertyUserId", "93");
+ prefixMap.put("propertyFeeId", "94");
+ prefixMap.put("houseId", "95");
+ prefixMap.put("pgId", "600");
}
private static String PLATFORM_CODE = "0001";
@@ -140,11 +141,11 @@
count = lastCount++;
} finally {
LOCK.unlock();
- return getRandom()+String.format(idLength, count);
+ return getRandom() + String.format(idLength, count);
}
}
- public static String nextId(){
+ public static String nextId() {
return nextId("%04d");
}
@@ -162,10 +163,11 @@
/**
* 鑾峰彇鍐呴儴骞冲彴 浜ゆ槗娴佹按
+ *
* @return
* @throws NoSuchObjectException
*/
- public static String getInnerTransactionId() throws Exception{
+ public static String getInnerTransactionId() throws Exception {
return codeApi().generateCode(prefixMap.get("transactionId"));
}
@@ -183,19 +185,20 @@
/**
* pgId鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getGeneratorId(String prefix) throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefix +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getGeneratorId(String prefix) throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefix + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefix);
}
- public static String getOId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
+ public static String getOId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
return prefixMap.get("oId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
return getCode(prefixMap.get("oId"));
@@ -204,18 +207,19 @@
/**
* 鏌ヨCode
+ *
* @param prefix
* @return
* @throws GenerateCodeException
*/
- private static String getCode(String prefix) throws GenerateCodeException{
+ private static String getCode(String prefix) throws GenerateCodeException {
//璋冪敤鏈嶅姟
String code = "-1";
try {
String responseMessage = restTemplate().postForObject(MappingCache.getValue(MappingConstant.KEY_CODE_PATH),
- createCodeRequestJson(getTransactionId(),prefix,prefix).toJSONString(), String.class);
+ createCodeRequestJson(getTransactionId(), prefix, prefix).toJSONString(), String.class);
- if(ResponseConstant.RESULT_CODE_ERROR.equals(responseMessage)){
+ if (ResponseConstant.RESULT_CODE_ERROR.equals(responseMessage)) {
throw new ResponseErrorException(ResponseConstant.RESULT_CODE_ERROR, "鐢熸垚oId缂栫爜澶辫触");
}
Assert.jsonObjectHaveKey(responseMessage, "code", "缂栫爜鐢熸垚绯荤粺 杩斿洖鎶ユ枃閿欒" + responseMessage);
@@ -227,25 +231,24 @@
+ resJson.getString("message"));
}
code = resJson.getString("id");
- }catch (Exception e){
- throw new GenerateCodeException(ResponseConstant.RESULT_CODE_ERROR,e.getMessage());
- }
- finally {
+ } catch (Exception e) {
+ throw new GenerateCodeException(ResponseConstant.RESULT_CODE_ERROR, e.getMessage());
+ } finally {
return code;
}
}
- public static String getBId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
+ public static String getBId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
return prefixMap.get("bId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("bId"));
}
- public static String getAttrId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
+ public static String getAttrId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
return prefixMap.get("attrId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
@@ -254,57 +257,57 @@
/**
* 鐢熸垚dataFlowId
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getDataFlowId() throws GenerateCodeException{
+ public static String getDataFlowId() throws GenerateCodeException {
- return UUID.randomUUID().toString().replace("-","").toLowerCase();
+ return UUID.randomUUID().toString().replace("-", "").toLowerCase();
}
- public static String getUserId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("userId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getUserId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("userId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("userId"));
}
- public static String getStoreId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("storeId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getStoreId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("storeId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("storeId"));
}
- public static String getMemberStoreId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("memberStoreId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getMemberStoreId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("memberStoreId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("memberStoreId"));
}
- public static String getStorePhotoId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("storePhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getStorePhotoId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("storePhotoId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("storePhotoId"));
}
/**
- *
* @return
* @throws GenerateCodeException
*/
- public static String getStoreCerdentialsId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("storeCerdentialsId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getStoreCerdentialsId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("storeCerdentialsId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("storeCerdentialsId"));
@@ -312,13 +315,12 @@
/**
- *
* @return
* @throws GenerateCodeException
*/
- public static String getStoreUserId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("storeUserId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getStoreUserId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("storeUserId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("storeUserId"));
@@ -327,12 +329,13 @@
/**
* 鑾峰彇灏忓尯ID
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getCommunityId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("communityId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getCommunityId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("communityId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("communityId"));
@@ -341,12 +344,13 @@
/**
* 鑾峰彇灏忓尯鐓х墖ID
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getCommunityPhotoId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("communityPhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getCommunityPhotoId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("communityPhotoId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("communityPhotoId"));
@@ -354,24 +358,27 @@
/**
* 鐢熸垚灏忓尯鎴愬憳ID
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getCommunityMemberId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("communityMemberId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getCommunityMemberId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("communityMemberId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("communityMemberId"));
}
+
/**
* 鑾峰彇灏忓尯ID
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getAgentId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("agentId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getAgentId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("agentId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("agentId"));
@@ -380,40 +387,38 @@
/**
* 鑾峰彇灏忓尯鐓х墖ID
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getAgentPhotoId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("agentPhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getAgentPhotoId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("agentPhotoId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("agentPhotoId"));
}
/**
- *
* @return
* @throws GenerateCodeException
*/
- public static String getAgentCerdentialsId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("agentCerdentialsId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getAgentCerdentialsId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("agentCerdentialsId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("agentCerdentialsId"));
}
-
/**
- *
* @return
* @throws GenerateCodeException
*/
- public static String getAgentUserId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("agentUserId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getAgentUserId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("agentUserId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("agentUserId"));
@@ -422,12 +427,13 @@
/**
* 鑾峰彇灏忓尯ID
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getPropertyId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("propertyId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getPropertyId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("propertyId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("propertyId"));
@@ -436,25 +442,25 @@
/**
* 鑾峰彇灏忓尯鐓х墖ID
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getPropertyPhotoId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("propertyPhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getPropertyPhotoId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("propertyPhotoId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("propertyPhotoId"));
}
/**
- *
* @return
* @throws GenerateCodeException
*/
- public static String getPropertyCerdentialsId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("propertyCerdentialsId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getPropertyCerdentialsId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("propertyCerdentialsId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("propertyCerdentialsId"));
@@ -462,13 +468,12 @@
/**
- *
* @return
* @throws GenerateCodeException
*/
- public static String getPropertyUserId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("propertyUserId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getPropertyUserId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("propertyUserId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("propertyUserId"));
@@ -476,12 +481,13 @@
/**
* 鐗╀笟璐圭敤ID鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getPropertyFeeId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("propertyFeeId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H+nextId("%04d"));
+ public static String getPropertyFeeId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("propertyFeeId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H + nextId("%04d"));
}
return getCode(prefixMap.get("propertyFeeId"));
@@ -489,27 +495,28 @@
/**
* 浣忔埛ID鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getHouseId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("houseId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H+nextId("%04d"));
+ public static String getHouseId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("houseId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H + nextId("%04d"));
}
return getCode(prefixMap.get("houseId"));
}
-
/**
* 鍟嗗搧ID鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getShopId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("shopId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getShopId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("shopId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("shopId"));
@@ -517,12 +524,13 @@
/**
* 鍟嗗搧灞炴�D鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getShopAttrId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("shopAttrId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getShopAttrId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("shopAttrId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("shopAttrId"));
@@ -530,55 +538,57 @@
/**
* 鍟嗗搧浼樻儬ID鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getShopPreferentialId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("shopPreferentialId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getShopPreferentialId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("shopPreferentialId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("shopPreferentialId"));
}
-
/**
* 鍟嗗搧灞炴�у弬鏁癐D鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getShopAttrParamId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("shopAttrParamId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getShopAttrParamId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("shopAttrParamId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("shopAttrParamId"));
}
+
/**
* 鍟嗗搧灞炴�у弬鏁癐D鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getCommentPhotoId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("commentPhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getCommentPhotoId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("commentPhotoId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("commentPhotoId"));
}
-
-
/**
* 鍟嗗搧灞炴�D鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getShopPhotoId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("shopPhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getShopPhotoId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("shopPhotoId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("shopPhotoId"));
@@ -586,12 +596,13 @@
/**
* 鍟嗗搧鎻忚堪ID鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getShopDescId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("shopDescId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getShopDescId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("shopDescId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("shopDescId"));
@@ -599,12 +610,13 @@
/**
* 鍟嗗搧鐩綍ID鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getShopCatalogId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("shopCatalogId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getShopCatalogId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("shopCatalogId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("shopCatalogId"));
@@ -612,12 +624,13 @@
/**
* 鍟嗗搧buyID鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getShopBuyId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("buyId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getShopBuyId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("buyId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("buyId"));
@@ -625,12 +638,13 @@
/**
* 鍟嗗搧buyAttrID鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getShopBuyAttrId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("buyAttrId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getShopBuyAttrId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("buyAttrId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("buyAttrId"));
@@ -638,12 +652,13 @@
/**
* 璇勮ID鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getCommentId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("commentId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getCommentId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("commentId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("commentId"));
@@ -651,12 +666,13 @@
/**
* 璇勮ID鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getSubCommentId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("subCommentId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getSubCommentId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("subCommentId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("subCommentId"));
@@ -664,24 +680,27 @@
/**
* 璇勮ID鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getSubCommentAttrId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("subCommentAttrId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getSubCommentAttrId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("subCommentAttrId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("subCommentAttrId"));
}
+
/**
* commentScoreId鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getCommentScoreId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("commentScoreId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getCommentScoreId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("commentScoreId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("commentScoreId"));
@@ -689,45 +708,47 @@
/**
* pgId鐢熸垚
+ *
* @return
* @throws GenerateCodeException
*/
- public static String getPgId() throws GenerateCodeException{
- if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
- return prefixMap.get("pgId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
+ public static String getPgId() throws GenerateCodeException {
+ if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
+ return prefixMap.get("pgId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
}
//璋冪敤鏈嶅姟
return getCode(prefixMap.get("pgId"));
}
-
/**
* 鑾峰彇restTemplate
+ *
* @return
* @throws NoSuchObjectException
*/
- private static RestTemplate restTemplate() throws NoSuchObjectException{
+ private static RestTemplate restTemplate() throws NoSuchObjectException {
- Object bean = ApplicationContextFactory.getBean("restTemplate");
+ Object bean = ApplicationContextFactory.getBean("restTemplate");
- if(bean == null){
- throw new NoSuchObjectException("娌℃湁鎵惧埌restTemplate瀵硅薄锛岃鏍稿疄");
- }
+ if (bean == null) {
+ throw new NoSuchObjectException("娌℃湁鎵惧埌restTemplate瀵硅薄锛岃鏍稿疄");
+ }
- return (RestTemplate) bean;
+ return (RestTemplate) bean;
}
/**
* 鑾峰彇codeApi
+ *
* @return
* @throws NoSuchObjectException
*/
- private static ICodeApi codeApi() throws NoSuchObjectException{
+ private static ICodeApi codeApi() throws NoSuchObjectException {
Object bean = ApplicationContextFactory.getBean(ICodeApi.class.getName());
- if(bean == null){
+ if (bean == null) {
throw new NoSuchObjectException("codeApi锛岃鏍稿疄");
}
@@ -735,32 +756,31 @@
}
-
-
/**
* ID鐢熸垚璇锋眰鎶ユ枃
+ *
* @param transactionId
* @return
*/
- private static JSONObject createCodeRequestJson(String transactionId, String prefix, String name){
+ private static JSONObject createCodeRequestJson(String transactionId, String prefix, String name) {
JSONObject paramOut = JSONObject.parseObject("{}");
- paramOut.put("transactionId",transactionId);
- paramOut.put("prefix",prefix);
- paramOut.put("name",name);
- paramOut.put("requestTime",DateUtil.getNowDefault());
+ paramOut.put("transactionId", transactionId);
+ paramOut.put("prefix", prefix);
+ paramOut.put("name", name);
+ paramOut.put("requestTime", DateUtil.getNowDefault());
return paramOut;
}
/**
* 鑾峰彇闅忔満鏁�
+ *
* @return
*/
- private static String getRandom(){
+ private static String getRandom() {
Random random = new Random();
- String result="";
- for (int i=0;i<4;i++)
- {
- result+=random.nextInt(10);
+ String result = "";
+ for (int i = 0; i < 4; i++) {
+ result += random.nextInt(10);
}
return result;
}
--
Gitblit v1.8.0