Browse Source

console 修改登录时走api 服务

wuxw7 7 years ago
parent
commit
0819935913

+ 1 - 1
Api/src/main/java/com/java110/api/listener/AbstractServiceApiDataFlowListener.java

@@ -40,7 +40,7 @@ public abstract class AbstractServiceApiDataFlowListener implements ServiceDataF
             if (CommonConstant.HTTP_METHOD_GET.equals(service.getMethod())) {
                 String requestUrl = dataFlowContext.getRequestHeaders().get("REQUEST_URL");
                 if (!StringUtil.isNullOrNone(requestUrl)) {
-                    String param = requestUrl.contains("?") ? requestUrl.substring(requestUrl.indexOf("?"), requestUrl.length()) : "";
+                    String param = requestUrl.contains("?") ? requestUrl.substring(requestUrl.indexOf("?")+1, requestUrl.length()) : "";
                     if (service.getUrl().contains("?")) {
                         requestUrl = service.getUrl() + "&" + param;
                     } else {

+ 75 - 0
Api/src/main/java/com/java110/api/listener/OrderServiceListener.java

@@ -0,0 +1,75 @@
+package com.java110.api.listener;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.CommonConstant;
+import com.java110.common.constant.ServiceCodeConstant;
+import com.java110.common.util.Assert;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.AppService;
+import com.java110.event.service.api.ServiceDataFlowEvent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+
+/**
+ * 订单类信息处理 侦听
+ * Created by wuxw on 2018/5/18.
+ */
+@Java110Listener("orderServiceListener")
+public class OrderServiceListener extends AbstractServiceApiDataFlowListener{
+
+    private final static Logger logger = LoggerFactory.getLogger(OrderServiceListener.class);
+
+
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeConstant.SERVICE_CODE_DO_SERVICE_ORDER;
+    }
+
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+
+    @Override
+    public void soService(ServiceDataFlowEvent event) {
+        //获取数据上下文对象
+        DataFlowContext dataFlowContext = event.getDataFlowContext();
+        AppService service = event.getAppService();
+        String paramIn = dataFlowContext.getReqData();
+        Assert.jsonObjectHaveKey(paramIn,"orders","请求参数中未包含");
+        JSONObject paramInObj = JSONObject.parseObject(paramIn);
+        HttpHeaders header = new HttpHeaders();
+        for(String key : dataFlowContext.getRequestCurrentHeaders().keySet()){
+            header.add(key,dataFlowContext.getRequestCurrentHeaders().get(key));
+
+            if(CommonConstant.HTTP_APP_ID.equals(key)) {
+                paramInObj.put("appId", dataFlowContext.getRequestCurrentHeaders().get(key));
+            }
+            if(CommonConstant.HTTP_TRANSACTION_ID.equals(key)) {
+                paramInObj.put("transactionId", dataFlowContext.getRequestCurrentHeaders().get(key));
+            }
+            if(CommonConstant.HTTP_SIGN.equals(key)) {
+                paramInObj.put("sign", dataFlowContext.getRequestCurrentHeaders().get(key));
+            }
+
+            if(CommonConstant.HTTP_SIGN.equals(key)) {
+                paramInObj.put("requestTime", dataFlowContext.getRequestCurrentHeaders().get(key));
+            }
+        }
+
+        HttpEntity<String> httpEntity = new HttpEntity<String>(paramInObj.toJSONString(), header);
+        //http://user-service/test/sayHello
+        super.doRequest(dataFlowContext, service, httpEntity);
+    }
+
+
+
+
+
+}

+ 6 - 7
CenterService/src/main/java/com/java110/center/smo/impl/CenterServiceSMOImpl.java

@@ -229,6 +229,10 @@ public class CenterServiceSMOImpl extends LoggerEngine implements ICenterService
             logger.error("内部异常了:",e);
             responseEntity = new ResponseEntity<String>("内部异常了:"+e.getMessage() + e.getLocalizedMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
         } finally {
+
+            if(responseEntity == null){
+                responseEntity = new ResponseEntity<String>(responseJson.toJSONString(),HttpStatus.OK);
+            }
             if(dataFlow != null) {
                 //这里记录日志
                 Date endDate = DateUtil.getCurrentDate();
@@ -236,21 +240,16 @@ public class CenterServiceSMOImpl extends LoggerEngine implements ICenterService
                 dataFlow.setEndDate(endDate);
                 if(responseJson != null ) {
                     dataFlow.setResJson(responseJson);
-                    //处理返回报文鉴权
-                    AuthenticationFactory.putSign(dataFlow, responseJson);
                 }
                 //添加耗时
                 //DataFlowFactory.addCostTime(dataFlow, "service", "业务处理总耗时", dataFlow.getStartDate(), dataFlow.getEndDate());
                 //保存耗时
                 //saveCostTimeLogMessage(dataFlow);
                 saveLogMessage(dataFlow,LogAgent.createLogMessage(dataFlow.getRequestHeaders(),dataFlow.getReqJson().toJSONString()),
-                        LogAgent.createLogMessage(dataFlow.getResponseHeaders(),dataFlow.getResJson().toJSONString()),endDate.getTime()-dataFlow.getStartDate().getTime());
+                        LogAgent.createLogMessage(dataFlow.getResponseHeaders(),responseEntity.getBody()),endDate.getTime()-dataFlow.getStartDate().getTime());
                 DataFlowEventPublishing.dataResponse(dataFlow,reqJson,headers);
             }
-            if(responseEntity == null){
-                String resJson = encrypt(responseJson.toJSONString(),headers);
-                responseEntity = new ResponseEntity<String>(resJson,HttpStatus.OK);
-            }
+
             //这里保存耗时,以及日志
             return responseEntity ;
 

+ 39 - 21
ConsoleService/src/main/java/com/java110/console/smo/impl/ConsoleServiceSMOImpl.java

@@ -8,17 +8,22 @@ import com.java110.common.constant.MappingConstant;
 import com.java110.common.constant.ResponseConstant;
 import com.java110.common.constant.ServiceCodeConstant;
 import com.java110.common.exception.SMOException;
+import com.java110.common.util.DateUtil;
 import com.java110.core.factory.AuthenticationFactory;
 import com.java110.core.factory.DataTransactionFactory;
 import com.java110.common.log.LoggerEngine;
 import com.java110.common.util.Assert;
 import com.java110.common.util.StringUtil;
 import com.java110.console.smo.IConsoleServiceSMO;
+import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.entity.service.PageData;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
+import org.springframework.web.client.HttpClientErrorException;
 import org.springframework.web.client.RestTemplate;
 
 import java.util.HashMap;
@@ -73,7 +78,6 @@ public class ConsoleServiceSMOImpl extends LoggerEngine implements IConsoleServi
         paramIn.put("userCode", userCode);
         paramIn.put(CommonConstant.ORDER_USER_ID,CommonConstant.ORDER_DEFAULT_USER_ID);
         paramIn.put(ServiceCodeConstant.SERVICE_CODE,ServiceCodeConstant.SERVICE_CODE_QUERY_USER_LOGIN);
-        paramIn.put(ServiceCodeConstant.SERVICE_CODE_NAME,ServiceCodeConstant.SERVICE_CODE_QUERY_USER_LOGIN_NAME);
         //paramIn.put("userPwd", userPwd);
         JSONObject businessObj = doExecute(paramIn);
 
@@ -168,22 +172,20 @@ public class ConsoleServiceSMOImpl extends LoggerEngine implements IConsoleServi
         }
     }
 
-    private JSONObject doExecute(Map paramIn) {
+    private JSONObject doExecute(Map<String,Object> paramIn) {
         //获取组件
         String appId = MappingCache.getValue(MappingConstant.KEY_CONSOLE_SERVICE_APP_ID);
 
         Assert.hasLength(appId, "组件不能为空");
 
-        String centerServiceUrl = MappingCache.getValue(MappingConstant.KEY_CENTER_SERVICE_URL);
+        String apiServiceUrl = MappingCache.getValue(MappingConstant.KEY_API_SERVICE_URL);
 
-        Assert.hasLength(centerServiceUrl, "中心服务器地址没有配置");
+        Assert.hasLength(apiServiceUrl, "api服务器地址没有配置");
 
         String securityCode = MappingCache.getValue(MappingConstant.KEY_CONSOLE_SECURITY_CODE);
         Assert.hasLength(securityCode, "签名秘钥没有配置");
 
         String serviceCode = paramIn.get(ServiceCodeConstant.SERVICE_CODE).toString();
-        String serviceCodeName = paramIn.get(ServiceCodeConstant.SERVICE_CODE_NAME).toString();
-        String userId = paramIn.get(CommonConstant.ORDER_USER_ID).toString();
         if(paramIn.containsKey(ServiceCodeConstant.SERVICE_CODE)){
             paramIn.remove(ServiceCodeConstant.SERVICE_CODE);
         }
@@ -194,30 +196,46 @@ public class ConsoleServiceSMOImpl extends LoggerEngine implements IConsoleServi
         if(paramIn.containsKey(CommonConstant.ORDER_USER_ID)){
             paramIn.remove(CommonConstant.ORDER_USER_ID);
         }
-
-        String responseMsg = "";
-        String requestBody = DataTransactionFactory.createQueryOneCenterServiceRequestJson(appId, userId, securityCode,
-                DataTransactionFactory.createQueryOneBusinessRequestJson(serviceCode,
-                        serviceCodeName, paramIn));
+        String params = "?";
+        for(String key : paramIn.keySet()){
+            params += (key +"=" + paramIn.get(key)+"&");
+        }
+        params = params.lastIndexOf("&") >-1 ? params.substring(0,params.length()-1):params;
+        apiServiceUrl = apiServiceUrl.replace("#serviceCode#",serviceCode) + params;
+        ResponseEntity<String> responseEntity = null;
         if (MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_CONSOLE_SERVICE_SECURITY_ON_OFF))) {
             try {
-                requestBody = DataTransactionFactory.encrypt(requestBody, 2048);
-                //调用查询菜单信息
-                HttpHeaders header = new HttpHeaders();
-                header.add(CommonConstant.ENCRYPT, MappingConstant.VALUE_ON);
-                header.add(CommonConstant.ENCRYPT_KEY_SIZE, "2048");
-                HttpEntity<String> httpEntity = new HttpEntity<String>(requestBody, header);
-                responseMsg = restTemplate.postForObject(centerServiceUrl, httpEntity, String.class);
-                responseMsg = DataTransactionFactory.decrypt(responseMsg, 2048);
+//                requestBody = DataTransactionFactory.encrypt(requestBody, 2048);
+//                //调用查询菜单信息
+//                HttpHeaders header = new HttpHeaders();
+//                header.add(CommonConstant.ENCRYPT, MappingConstant.VALUE_ON);
+//                header.add(CommonConstant.ENCRYPT_KEY_SIZE, "2048");
+//                HttpEntity<String> httpEntity = new HttpEntity<String>(requestBody, header);
+//                responseMsg = restTemplate.postForObject(centerServiceUrl, httpEntity, String.class);
+//                responseMsg = DataTransactionFactory.decrypt(responseMsg, 2048);
             }catch (Exception e){
                 logger.error("调用接口失败",e);
                 throw new SMOException(ResponseConstant.RESULT_CODE_NO_AUTHORITY_ERROR,"调用接口失败"+e);
             }
         } else {
-            responseMsg = restTemplate.postForObject(centerServiceUrl,requestBody,String.class);
+            HttpHeaders header = new HttpHeaders();
+            header.add(CommonConstant.HTTP_APP_ID, appId);
+            header.add(CommonConstant.HTTP_TRANSACTION_ID, GenerateCodeFactory.getTransactionId());
+            header.add(CommonConstant.HTTP_REQ_TIME, DateUtil.getNowDefault());
+            header.add(CommonConstant.HTTP_SIGN, "");
+            HttpEntity<String> httpEntity = new HttpEntity<String>(header);
+            try {
+                responseEntity = restTemplate.exchange(apiServiceUrl, HttpMethod.GET, httpEntity, String.class);
+            }catch (HttpClientErrorException e){
+                //responseEntity = new ResponseEntity<String>(e.getResponseBodyAsString(),e.getStatusCode());
+
+                return null;
+            }
         }
 
-        return DataTransactionFactory.getOneBusinessFromCenterServiceResponseJson(responseMsg);
+        Assert.isJsonObject(responseEntity.getBody(),"下游系统返回报文不是有效的json格式");
+
+        return JSONObject.parseObject(responseEntity.getBody());
     }
 
 

+ 8 - 8
ConsoleService/src/main/resources/application-dev.yml

@@ -7,7 +7,7 @@ jedis:
       maxTotal: 100
       maxIdle: 20
       maxWaitMillis: 20000
-    host: 192.168.31.199
+    host: hc.java110.com
     port: 6379
 
 eureka:
@@ -16,7 +16,7 @@ eureka:
     leaseExpirationDurationInSeconds: 30
   client:
     serviceUrl:
-      defaultZone: http://192.168.31.199:8761/eureka/
+      defaultZone: http://hc.java110.com:8761/eureka/
       #defaultZone: http://localhost:8761/eureka/
 server:
   port: 8443
@@ -41,7 +41,7 @@ spring:
     name: console-service
   redis:
     database: 0
-    host: 192.168.31.199
+    host: hc.java110.com
     port: 6379
     pool:
       max-active: 300
@@ -58,7 +58,7 @@ spring:
     filters: stat,wall,log4j
     poolPreparedStatements: true
     type: com.alibaba.druid.pool.DruidDataSource
-    url: jdbc:mysql://192.168.31.199:3306/TT?useUnicode=true&characterEncoding=utf-8
+    url: jdbc:mysql://hc.java110.com:3306/TT?useUnicode=true&characterEncoding=utf-8
     maxPoolPreparedStatementPerConnectionSize: 20
     password: TT@12345678
     testOnBorrow: false
@@ -85,8 +85,8 @@ spring:
 kafka:
   consumer:
     zookeeper:
-      connect: 192.168.31.199:2181
-    servers: 192.168.31.199:9092
+      connect: hc.java110.com:2181
+    servers: hc.java110.com:9092
     enable:
       auto:
         commit: true
@@ -104,8 +104,8 @@ kafka:
 
   producer:
     zookeeper:
-      connect: 192.168.31.199:2181
-    servers: 192.168.31.199:9092
+      connect: hc.java110.com:2181
+    servers: hc.java110.com:9092
     retries: 0
     batch:
       size: 4096

+ 1 - 1
ConsoleService/src/main/resources/application.yml

@@ -1,3 +1,3 @@
 spring:
   profiles:
-    active: prod
+    active: dev

File diff suppressed because it is too large
+ 1687 - 1788
MicroCommunity.sql


+ 8 - 8
UserService/src/main/resources/application-dev.yml

@@ -4,7 +4,7 @@ jedis:
       maxTotal: 100
       maxIdle: 20
       maxWaitMillis: 20000
-    host: 192.168.31.199
+    host: hc.java110.com
     port: 6379
 
 eureka:
@@ -13,7 +13,7 @@ eureka:
     leaseExpirationDurationInSeconds: 30
   client:
     serviceUrl:
-      defaultZone: http://192.168.31.199:8761/eureka/
+      defaultZone: http://hc.java110.com:8761/eureka/
       #defaultZone: http://localhost:8761/eureka/
 server:
   port: 8002
@@ -30,7 +30,7 @@ spring:
     name: user-service
   redis:
     database: 0
-    host: 192.168.31.199
+    host: hc.java110.com
     port: 6379
     pool:
       max-active: 300
@@ -47,7 +47,7 @@ spring:
     filters: stat,wall,log4j
     poolPreparedStatements: true
     type: com.alibaba.druid.pool.DruidDataSource
-    url: jdbc:mysql://192.168.31.199:3306/TT?useUnicode=true&characterEncoding=utf-8
+    url: jdbc:mysql://hc.java110.com:3306/TT?useUnicode=true&characterEncoding=utf-8
     maxPoolPreparedStatementPerConnectionSize: 20
     password: TT@12345678
     testOnBorrow: false
@@ -63,8 +63,8 @@ spring:
 kafka:
   consumer:
     zookeeper:
-      connect: 192.168.31.199:2181
-    servers: 192.168.31.199:9092
+      connect: hc.java110.com:2181
+    servers: hc.java110.com:9092
     enable:
       auto:
         commit: true
@@ -82,8 +82,8 @@ kafka:
 
   producer:
     zookeeper:
-      connect: 192.168.31.199:2181
-    servers: 192.168.31.199:9092
+      connect: hc.java110.com:2181
+    servers: hc.java110.com:9092
     retries: 0
     batch:
       size: 4096

+ 1 - 1
UserService/src/main/resources/application.yml

@@ -1,3 +1,3 @@
 spring:
   profiles:
-    active: test
+    active: dev

+ 8 - 0
java110-bean/src/main/java/com/java110/entity/service/DataQuery.java

@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import org.springframework.http.ResponseEntity;
 
+import java.util.Map;
+
 /**
  * 数据查询对象
  * Created by wuxw on 2018/4/19.
@@ -112,4 +114,10 @@ public class DataQuery {
         this.setRequestParams(currentBusinessInfo.getJSONObject("datas").getJSONObject("params"));
         return this;
     }
+
+    public DataQuery builder(Map<String, Object> headers){
+        this.setServiceCode(headers.get("service").toString());
+        this.setRequestParams(JSONObject.parseObject(JSONObject.toJSONString(headers.get("params"))));
+        return this;
+    }
 }

+ 1 - 0
java110-common/src/main/java/com/java110/common/constant/CommonConstant.java

@@ -134,6 +134,7 @@ public class CommonConstant {
     public final static String HTTP_TRANSACTION_ID = "transaction_id";
     public final static String HTTP_REQ_TIME = "req_time";
     public final static String HTTP_SIGN = "sign";
+    public final static String HTTP_PARAM = "params";
 
 
     public final static String HTTP_METHOD_POST = "POST";

+ 2 - 0
java110-common/src/main/java/com/java110/common/constant/MappingConstant.java

@@ -58,6 +58,8 @@ public class MappingConstant {
      */
     public final static String KEY_CENTER_SERVICE_URL = "CENTER_SERVICE_URL";
 
+    public final static String KEY_API_SERVICE_URL = "API_SERVICE_URL";
+
     /**
      * 控制中心服务APP_ID
      */

+ 5 - 0
java110-common/src/main/java/com/java110/common/constant/ServiceCodeConstant.java

@@ -163,6 +163,11 @@ public class ServiceCodeConstant {
      */
     public static final String SERVICE_CODE_DO_SERVICE_TRANSFER = "do.service.transfer";
 
+    /**
+     * 订单类服务处理
+     */
+    public static final String SERVICE_CODE_DO_SERVICE_ORDER = "do.service.order";
+
 
 
 }

+ 13 - 0
java110-common/src/main/java/com/java110/common/util/Assert.java

@@ -38,6 +38,8 @@ public class Assert extends org.springframework.util.Assert{
     }
 
 
+
+
     /**
      * 判断 jsonObject 是否为空
      * @param jsonStr
@@ -131,6 +133,17 @@ public class Assert extends org.springframework.util.Assert{
 
     }
 
+    /**
+     * 判断 jsonObject 是否为空
+     * @param strValue
+     * @param message
+     */
+    public static void isJsonObject(String strValue,String message){
+        if(!isJsonObject(strValue)){
+            throw new IllegalArgumentException(message);
+        }
+    }
+
     /**
      * 校验是否为JSON
      * @param msg

+ 69 - 69
java110-config/db/CenterService/create_table.db

@@ -139,7 +139,8 @@ CREATE TABLE c_service(
     retry_count INT NOT NULL DEFAULT 3 COMMENT '重试次数',
     provide_app_id VARCHAR(30) NOT NULL COMMENT '应用ID',
     create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-    status_cd VARCHAR(2) NOT NULL default '0' COMMENT '数据状态,详细参考c_status表,0在用,1失效'
+    status_cd VARCHAR(2) NOT NULL default '0' COMMENT '数据状态,详细参考c_status表,0在用,1失效',
+    UNIQUE KEY (service_id)
 );
 
 
@@ -175,6 +176,7 @@ INSERT c_mapping(domain,`name`,`key`,`value`,remark) VALUES('DOMAIN.COMMON','控
 INSERT c_mapping(domain,`name`,`key`,`value`,remark) VALUES('DOMAIN.COMMON','控制服务加密开关','KEY_CONSOLE_SERVICE_SECURITY_ON_OFF','ON','控制服务加密开关');
 INSERT c_mapping(domain,`name`,`key`,`value`,remark) VALUES('DOMAIN.COMMON','控制服务鉴权秘钥','CONSOLE_SECURITY_CODE','WEBURFPKIFJUHNCJUEIKMKJUJHULSMNCHDY89KMC','控制服务鉴权秘钥');
 INSERT c_mapping(domain,`name`,`key`,`value`,remark) VALUES('DOMAIN.COMMON','编码生成服务地址','CODE_PATH','http://code-service/codeApi/generate','编码生成服务地址');
+INSERT c_mapping(domain,`name`,`key`,`value`,remark) VALUES('DOMAIN.COMMON','API服务地址','API_SERVICE_URL','http://api-service/api/#serviceCode#','API服务地址');
 
 -- c_app
 CREATE TABLE c_app(
@@ -186,7 +188,8 @@ CREATE TABLE c_app(
     black_list_ip VARCHAR(200) COMMENT '黑名单ip 多个之间用;隔开',
     remark VARCHAR(200) COMMENT '描述',
     create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-    status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,0在用,1失效'
+    status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,0在用,1失效',
+    UNIQUE KEY (app_id)
 );
 
 -- c_service_sql
@@ -219,108 +222,105 @@ values('8000418002','控制中心应用','WEBURFPKIFJUHNCJUEIKMKJUJHULSMNCHDY89K
 insert into c_app(app_id,`name`,security_code,remark,status_cd)
 values('8000418003','用户管理应用','WEBURFPKIFJUHNCJUEIKMKJUJHULSMNCHDY89KMC','用户管理应用','0');
 
+insert into c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
+values('1','query.user.userInfo','Q','用户信息查询',1,'http://...','8000418001','0');
 
-insert into c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
-values('query.user.userInfo','Q','用户信息查询',1,'http://...','8000418001','0');
-
-insert into c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
-values('query.order.orderInfo','Q','订单信息',1,'http://center-service/businessApi/query','8000418001','0');
+insert into c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
+values('2','query.order.orderInfo','Q','订单信息',1,'http://center-service/businessApi/query','8000418001','0');
 
-insert into c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
-values('query.console.menu','Q','查询菜单',1,'http://center-service/businessApi/query','8000418002','0');
+insert into c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
+values('3','query.console.menu','Q','查询菜单',1,'http://center-service/businessApi/query','8000418002','0');
 
-insert into c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
-values('query.user.loginInfo','Q','查询用户登录信息',1,'http://console-service/businessApi/query','8000418002','0');
+insert into c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
+values('4','query.user.loginInfo','Q','查询用户登录信息',1,'http://center-service/businessApi/query','8000418002','0');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.console.template','Q','查询模板信息',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('5','query.console.template','Q','查询模板信息',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.console.templateCol','Q','查询列模板信息',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('6','query.console.templateCol','Q','查询列模板信息',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.center.mapping','Q','查询映射数据',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('7','query.center.mapping','Q','查询映射数据',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.center.apps','Q','查询外部应用',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('8','query.center.apps','Q','查询外部应用',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.center.services','Q','查询服务',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('9','query.center.services','Q','查询服务',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.center.routes','Q','查询路由',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('10','query.center.routes','Q','查询路由',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('flush.center.cache','Q','CenterService缓存',1,'http://center-service/cacheApi/flush','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('11','flush.center.cache','Q','CenterService缓存',1,'http://center-service/cacheApi/flush','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.console.caches','Q','查询所有缓存',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('12','query.console.caches','Q','查询所有缓存',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.console.cache','Q','查询所有缓存',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('13','query.console.cache','Q','查询所有缓存',1,'http://center-service/businessApi/query','8000418002');
 
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('save.center.mapping','Q','保存映射信息',1,'http://center-service/businessApi/do','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('14','save.center.mapping','Q','保存映射信息',1,'http://center-service/businessApi/do','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('delete.center.mapping','Q','删除映射信息',1,'http://center-service/businessApi/do','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('15','delete.center.mapping','Q','删除映射信息',1,'http://center-service/businessApi/do','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('update.center.mapping','Q','修改映射信息',1,'http://center-service/businessApi/do','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('16','update.center.mapping','Q','修改映射信息',1,'http://center-service/businessApi/do','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('save.user.userInfo','D','保存用户信息',1,'http://user-service/userApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('17','save.user.userInfo','D','保存用户信息',1,'http://user-service/userApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('save.store.info','D','保存商户信息',1,'http://store-service/storeApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('18','save.store.info','D','保存商户信息',1,'http://store-service/storeApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('update.store.info','D','修改商户信息',1,'http://store-service/storeApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('19','update.store.info','D','修改商户信息',1,'http://store-service/storeApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('delete.store.info','D','删除商户信息',1,'http://store-service/storeApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('20','delete.store.info','D','删除商户信息',1,'http://store-service/storeApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('member.joined.store','D','商户成员加入',1,'http://store-service/storeApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('member.quit.store','D','商户成员退出',1,'http://store-service/storeApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('21','transfer.console.menu','T','透传菜单查询',1,'http://192.168.31.199:8001/userApi/service','8000418001');
 
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('22','save.shop.info','D','保存商品信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('transfer.console.menu','T','透传菜单查询',1,'http://192.168.31.199:8001/userApi/service','8000418001');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('23','update.shop.info','D','修改商品信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('save.shop.info','D','保存商品信息',1,'http://shop-service/shopApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('24','delete.shop.info','D','删除商品信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('update.shop.info','D','修改商品信息',1,'http://shop-service/shopApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('25','buy.shop.info','D','购买商品信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('delete.shop.info','D','删除商品信息',1,'http://shop-service/shopApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('26','save.shop.catalog','D','保存商品目录信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('buy.shop.info','D','购买商品信息',1,'http://shop-service/shopApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('27','update.shop.catalog','D','修改商品目录信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('save.shop.catalog','D','保存商品目录信息',1,'http://shop-service/shopApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('28','delete.shop.catalog','D','删除商品目录信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('update.shop.catalog','D','修改商品目录信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('delete.shop.catalog','D','删除商品目录信息',1,'http://shop-service/shopApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('29','save.comment.info','D','保存评论',1,'http://comment-service/commentApi/service','8000418003');
 
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('30','delete.comment.info','D','删除评论',1,'http://comment-service/commentApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('save.comment.info','D','保存评论',1,'http://comment-service/commentApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('delete.comment.info','D','删除评论',1,'http://comment-service/commentApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('31','member.joined.store','D','商户成员加入',1,'http://store-service/storeApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('delete.comment.info','D','删除评论',1,'http://comment-service/commentApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('32','member.quit.store','D','商户成员退出',1,'http://store-service/storeApi/service','8000418003');
 
 
 insert into c_route(app_id,service_id,invoke_model,order_type_cd,status_cd) values(

+ 73 - 65
java110-config/docker/mysql/create_sql.sql

@@ -132,24 +132,25 @@ CREATE TABLE c_route(
 -- c_service
 
 CREATE TABLE c_service(
-    service_id INT NOT NULL AUTO_INCREMENT KEY COMMENT 'id',
+    id INT NOT NULL AUTO_INCREMENT KEY COMMENT 'id',
+    service_id VARCHAR(12) NOT NULL COMMENT '服务ID',
     service_code VARCHAR(50) NOT NULL UNIQUE COMMENT '自定义,命名方式查询类query.+目标系统+.+业务名称 保存类 save.+目标系统+.+业务名称 修改类 modify.+目标系统+.+业务名称 删除类 remove.+目标系统+.+业务名称 例如:query.user.userinfo save.user.adduserinfo',
     business_type_cd VARCHAR(4) NOT NULL COMMENT '业务项类型,参考c_business_type表',
     `name` VARCHAR(50) NOT NULL COMMENT '服务名称',
     seq INT NOT NULL COMMENT '顺序 只有同步方式下根据seq从小到大调用接口',
     messageQueueName VARCHAR(50) COMMENT '消息队里名称 只有异步时有用',
-    is_instance varchar(2) not null default 'N' comment '是否Instance Y 需要,N不需要',
+    is_instance varchar(2) not null default 'N' comment '是否Instance Y 需要,N不需要,NT透传类',
     url VARCHAR(200) COMMENT '目标地址',
     method VARCHAR(50) COMMENT '方法 空 为http post LOCAL_SERVICE 为调用本地服务 其他为webservice方式调用',
     timeout INT NOT NULL DEFAULT 60 COMMENT '超时时间',
     retry_count INT NOT NULL DEFAULT 3 COMMENT '重试次数',
     provide_app_id VARCHAR(30) NOT NULL COMMENT '应用ID',
     create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-    status_cd VARCHAR(2) NOT NULL default '0' COMMENT '数据状态,详细参考c_status表,0在用,1失效'
+    status_cd VARCHAR(2) NOT NULL default '0' COMMENT '数据状态,详细参考c_status表,0在用,1失效',
+    UNIQUE KEY (service_id)
 );
 
 
-
 -- c_mapping
 
 CREATE TABLE c_mapping(
@@ -192,7 +193,8 @@ CREATE TABLE c_app(
     black_list_ip VARCHAR(200) COMMENT '黑名单ip 多个之间用;隔开',
     remark VARCHAR(200) COMMENT '描述',
     create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-    status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,0在用,1失效'
+    status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,0在用,1失效',
+    UNIQUE KEY (app_id)
 );
 
 -- c_service_sql
@@ -226,99 +228,105 @@ insert into c_app(app_id,`name`,security_code,remark,status_cd)
 values('8000418003','用户管理应用','WEBURFPKIFJUHNCJUEIKMKJUJHULSMNCHDY89KMC','用户管理应用','0');
 
 
-insert into c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
-values('query.user.userInfo','Q','用户信息查询',1,'http://...','8000418001','0');
+insert into c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
+values('1','query.user.userInfo','Q','用户信息查询',1,'http://...','8000418001','0');
+
+insert into c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
+values('2','query.order.orderInfo','Q','订单信息',1,'http://center-service/businessApi/query','8000418001','0');
+
+insert into c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
+values('3','query.console.menu','Q','查询菜单',1,'http://center-service/businessApi/query','8000418002','0');
 
-insert into c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
-values('query.order.orderInfo','Q','订单信息',1,'http://center-service/businessApi/query','8000418001','0');
+insert into c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
+values('4','query.user.loginInfo','Q','查询用户登录信息',1,'http://center-service/businessApi/query','8000418002','0');
 
-insert into c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
-values('query.console.menu','Q','查询菜单',1,'http://center-service/businessApi/query','8000418002','0');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('5','query.console.template','Q','查询模板信息',1,'http://center-service/businessApi/query','8000418002');
 
-insert into c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id,status_cd)
-values('query.user.loginInfo','Q','查询用户登录信息',1,'http://center-service/businessApi/query','8000418002','0');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('6','query.console.templateCol','Q','查询列模板信息',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.console.template','Q','查询模板信息',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('7','query.center.mapping','Q','查询映射数据',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.console.templateCol','Q','查询列模板信息',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('8','query.center.apps','Q','查询外部应用',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.center.mapping','Q','查询映射数据',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('9','query.center.services','Q','查询服务',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.center.apps','Q','查询外部应用',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('10','query.center.routes','Q','查询路由',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.center.services','Q','查询服务',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('11','flush.center.cache','Q','CenterService缓存',1,'http://center-service/cacheApi/flush','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.center.routes','Q','查询路由',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('12','query.console.caches','Q','查询所有缓存',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('flush.center.cache','Q','CenterService缓存',1,'http://center-service/cacheApi/flush','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('13','query.console.cache','Q','查询所有缓存',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.console.caches','Q','查询所有缓存',1,'http://center-service/businessApi/query','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('query.console.cache','Q','查询所有缓存',1,'http://center-service/businessApi/query','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('14','save.center.mapping','Q','保存映射信息',1,'http://center-service/businessApi/do','8000418002');
 
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('15','delete.center.mapping','Q','删除映射信息',1,'http://center-service/businessApi/do','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('save.center.mapping','Q','保存映射信息',1,'http://center-service/businessApi/do','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('16','update.center.mapping','Q','修改映射信息',1,'http://center-service/businessApi/do','8000418002');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('delete.center.mapping','Q','删除映射信息',1,'http://center-service/businessApi/do','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('17','save.user.userInfo','D','保存用户信息',1,'http://user-service/userApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('update.center.mapping','Q','修改映射信息',1,'http://center-service/businessApi/do','8000418002');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('18','save.store.info','D','保存商户信息',1,'http://store-service/storeApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('save.user.userInfo','D','保存用户信息',1,'http://user-service/userApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('19','update.store.info','D','修改商户信息',1,'http://store-service/storeApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('save.store.info','D','保存商户信息',1,'http://store-service/storeApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('20','delete.store.info','D','删除商户信息',1,'http://store-service/storeApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('update.store.info','D','修改商户信息',1,'http://store-service/storeApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('delete.store.info','D','删除商户信息',1,'http://store-service/storeApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('21','transfer.console.menu','T','透传菜单查询',1,'http://192.168.31.199:8001/userApi/service','8000418001');
 
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('22','save.shop.info','D','保存商品信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('transfer.console.menu','T','透传菜单查询',1,'http://192.168.31.199:8001/userApi/service','8000418001');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('23','update.shop.info','D','修改商品信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('save.shop.info','D','保存商品信息',1,'http://shop-service/shopApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('24','delete.shop.info','D','删除商品信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('update.shop.info','D','修改商品信息',1,'http://shop-service/shopApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('25','buy.shop.info','D','购买商品信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('delete.shop.info','D','删除商品信息',1,'http://shop-service/shopApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('26','save.shop.catalog','D','保存商品目录信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('buy.shop.info','D','购买商品信息',1,'http://shop-service/shopApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('27','update.shop.catalog','D','修改商品目录信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('save.shop.catalog','D','保存商品目录信息',1,'http://shop-service/shopApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('28','delete.shop.catalog','D','删除商品目录信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('update.shop.catalog','D','修改商品目录信息',1,'http://shop-service/shopApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('delete.shop.catalog','D','删除商品目录信息',1,'http://shop-service/shopApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('29','save.comment.info','D','保存评论',1,'http://comment-service/commentApi/service','8000418003');
 
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('30','delete.comment.info','D','删除评论',1,'http://comment-service/commentApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('save.comment.info','D','保存评论',1,'http://comment-service/commentApi/service','8000418003');
 
-INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id)
-VALUES('delete.comment.info','D','删除评论',1,'http://comment-service/commentApi/service','8000418003');
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('31','member.joined.store','D','商户成员加入',1,'http://store-service/storeApi/service','8000418003');
 
+INSERT INTO c_service(service_id,service_code,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('32','member.quit.store','D','商户成员退出',1,'http://store-service/storeApi/service','8000418003');
 
 insert into c_route(app_id,service_id,invoke_model,order_type_cd,status_cd) values(
 '8000418001','1','S','Q','0'

+ 24 - 0
java110-core/src/main/java/com/java110/core/base/controller/BaseController.java

@@ -82,6 +82,30 @@ public class BaseController extends AppBase {
 
     }
 
+    public static Map<String, String> getParameterStringMap(HttpServletRequest request) {
+        Map<String, String[]> properties = request.getParameterMap();//把请求参数封装到Map<String, String[]>中
+        Map<String, String> returnMap = new HashMap<String, String>();
+        String name = "";
+        String value = "";
+        for (Map.Entry<String, String[]> entry : properties.entrySet()) {
+            name = entry.getKey();
+            String[] values = entry.getValue();
+            if (null == values) {
+                value = "";
+            } else if (values.length>1) {
+                for (int i = 0; i < values.length; i++) { //用于请求参数中有多个相同名称
+                    value = values[i] + ",";
+                }
+                value = value.substring(0, value.length() - 1);
+            } else {
+                value = values[0];//用于请求参数中请求参数名唯一
+            }
+            returnMap.put(name, value);
+
+        }
+        return returnMap;
+    }
+
     protected void initHeadParam(HttpServletRequest request,Map headers) {
 
         Enumeration reqHeaderEnum = request.getHeaderNames();

+ 44 - 2
java110-service/src/main/java/com/java110/service/api/BusinessApi.java

@@ -1,6 +1,8 @@
 package com.java110.service.api;
 
+import com.java110.common.constant.CommonConstant;
 import com.java110.common.constant.ResponseConstant;
+import com.java110.common.util.Assert;
 import com.java110.core.factory.DataQueryFactory;
 import com.java110.core.factory.DataTransactionFactory;
 import com.java110.core.base.controller.BaseController;
@@ -18,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * 查询服务
@@ -30,9 +34,29 @@ public class BusinessApi extends BaseController {
     @Autowired
     private IQueryServiceSMO queryServiceSMOImpl;
 
+
     @RequestMapping(path = "/businessApi/query",method= RequestMethod.GET)
-    public String queryGet(HttpServletRequest request) {
-        return DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR,"不支持Get方法请求").toJSONString();
+    @ApiOperation(value="业务查询get请求", notes="test: 返回 2XX 表示服务正常")
+    @ApiImplicitParam(paramType="query", name = "method", value = "用户编号", required = true, dataType = "String")
+    @Deprecated
+    public ResponseEntity<String> service(HttpServletRequest request) {
+        try {
+            Map<String, Object> headers = new HashMap<String, Object>();
+            this.getRequestInfo(request, headers);
+            Assert.isNotNull(headers, CommonConstant.HTTP_SERVICE.toLowerCase(),"请求信息中没有包含service信息");
+            //Assert.isNotNull(headers, CommonConstant.HTTP_PARAM,"请求信息中没有包含参数(params)信息");
+            Map readOnlyMap = super.getParameterStringMap(request);
+            headers.put("params",readOnlyMap);
+            DataQuery dataQuery = DataQueryFactory.newInstance().builder(headers);
+            initConfig(dataQuery);
+            queryServiceSMOImpl.commonQueryService(dataQuery);
+            return dataQuery.getResponseEntity();
+        }catch (Exception e){
+            logger.error("请求订单异常",e);
+            //DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR,e.getMessage()+e).toJSONString();
+            return new ResponseEntity<String>("请求发生异常,"+e.getMessage()+e, HttpStatus.INTERNAL_SERVER_ERROR);
+
+        }
     }
 
     /**
@@ -54,6 +78,7 @@ public class BusinessApi extends BaseController {
     @RequestMapping(path = "/businessApi/query",method= RequestMethod.POST)
     @ApiOperation(value="业务查询post请求", notes="test: 返回 2XX 表示服务正常")
     @ApiImplicitParam(paramType="query", name = "method", value = "用户编号", required = true, dataType = "String")
+    @Deprecated
     public ResponseEntity<String> queryPost(@RequestBody String businessInfo) {
         try {
             DataQuery dataQuery = DataQueryFactory.newInstance().builder(businessInfo);
@@ -112,6 +137,23 @@ public class BusinessApi extends BaseController {
         dataQuery.setServiceSql(DataQueryFactory.getServiceSql(dataQuery));
     }
 
+
+    /**
+     * 获取请求信息
+     * @param request
+     * @param headers
+     * @throws RuntimeException
+     */
+    private void getRequestInfo(HttpServletRequest request,Map headers) throws Exception{
+        try{
+            super.initHeadParam(request,headers);
+            super.initUrlParam(request,headers);
+        }catch (Exception e){
+            logger.error("加载头信息失败",e);
+            throw e;
+        }
+    }
+
     public IQueryServiceSMO getQueryServiceSMOImpl() {
         return queryServiceSMOImpl;
     }

+ 15 - 5
java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java

@@ -16,6 +16,7 @@ import com.java110.entity.service.DataQuery;
 import com.java110.entity.service.ServiceSql;
 import com.java110.service.dao.IQueryServiceDAO;
 import com.java110.service.smo.IQueryServiceSMO;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -59,20 +60,21 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
             dataQuery.setServiceSql(currentServiceSql);
             if (CommonConstant.QUERY_MODEL_SQL.equals(currentServiceSql.getQueryModel())) {
                 doExecuteSql(dataQuery);
-                return;
             }else if(CommonConstant.QUERY_MODE_JAVA.equals(currentServiceSql.getQueryModel())){
                 doExecuteJava(dataQuery);
-                return ;
+            }else {
+                doExecuteProc(dataQuery);
             }
-            doExecuteProc(dataQuery);
             responseEntity = new ResponseEntity<String>(dataQuery.getResponseInfo().toJSONString(), HttpStatus.OK);
         }catch (BusinessException e){
             logger.error("公用查询异常:",e);
             /*dataQuery.setResponseInfo(DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_PARAM_ERROR,
                     e.getMessage()));*/
             responseEntity = new ResponseEntity<String>("请求发生异常,"+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+        }finally {
+            dataQuery.setResponseEntity(responseEntity);
         }
-        dataQuery.setResponseEntity(responseEntity);
+
 
     }
     @Override
@@ -260,7 +262,15 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
                     }
                 } else {
                     currentSqlNew += "?";
-                    currentParams.add(params.get(sqls[sqlIndex]) instanceof Integer ? params.getInteger(sqls[sqlIndex]) : "" + params.getString(sqls[sqlIndex]) + "");
+                    Object param =  params.getString(sqls[sqlIndex]);
+                    if(params.get(sqls[sqlIndex]) instanceof Integer){
+                        param = params.getInteger(sqls[sqlIndex]);
+                    }
+                   //这里对 page 和 rows 特殊处理 ,目前没有想到其他的办法
+                    if(StringUtils.isNumeric(param.toString()) && "page,rows".contains(sqls[sqlIndex])){
+                        param = Integer.parseInt(param.toString());
+                    }
+                    currentParams.add(param);
                     //currentSqlNew += params.get(sqls[sqlIndex]) instanceof Integer ? params.getInteger(sqls[sqlIndex]) : "'" + params.getString(sqls[sqlIndex]) + "'";
                 }
             }