Просмотр исходного кода

完成控制服务前台操作配置数据功能

wuxw7 лет назад: 8
Родитель
Сommit
573d22f534
27 измененных файлов с 1307 добавлено и 624 удалено
  1. 14 0
      CenterService/doc/start_centerService.sh
  2. 30 3
      CenterService/src/main/java/com/java110/center/CenterServiceApplicationStart.java
  3. 5 0
      CenterService/src/main/java/com/java110/center/smo/ICenterServiceCacheSMO.java
  4. 30 1
      CenterService/src/main/java/com/java110/center/smo/impl/CenterServiceCacheSMOImpl.java
  5. 84 0
      CenterService/src/main/resources/application-dev.yml
  6. 84 0
      CenterService/src/main/resources/application-prod.yml
  7. 84 0
      CenterService/src/main/resources/application-test.yml
  8. 2 83
      CenterService/src/main/resources/application.yml
  9. 14 0
      ConsoleService/doc/start_consoleService.sh
  10. 27 0
      ConsoleService/src/main/java/com/java110/console/rest/ConsoleRest.java
  11. 7 0
      ConsoleService/src/main/java/com/java110/console/smo/IConsoleServiceSMO.java
  12. 39 0
      ConsoleService/src/main/java/com/java110/console/smo/impl/ConsoleServiceSMOImpl.java
  13. 108 0
      ConsoleService/src/main/resources/application-dev.yml
  14. 108 0
      ConsoleService/src/main/resources/application-prod.yml
  15. 107 0
      ConsoleService/src/main/resources/application-test.yml
  16. 2 104
      ConsoleService/src/main/resources/application.yml
  17. 2 1
      ConsoleService/src/main/resources/data/list_template.json
  18. 37 340
      ConsoleService/src/main/resources/html/test.html
  19. 1 6
      ConsoleService/src/main/resources/static/javascript/java110_list_template.js
  20. 392 0
      MicroCommunity.sql
  21. 18 0
      java110-common/src/main/java/com/java110/common/constant/CommonConstant.java
  22. 56 3
      java110-config/db/CenterService/create_table.db
  23. 37 37
      java110-config/db/ConsoleService/create_table.db
  24. 8 44
      java110-event/src/main/java/com/java110/event/center/init/CenterServiceStartInit.java
  25. 1 0
      java110-service/src/main/java/com/java110/service/api/BusinessApi.java
  26. 3 0
      java110-service/src/main/java/com/java110/service/init/ServiceStartInit.java
  27. 7 2
      java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java

+ 14 - 0
CenterService/doc/start_centerService.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+#### debug model prod
+#nohup java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -jar -Dspring.profiles.active=dev CenterService.jar $1 > center.log 2>&1 &
+
+#### normal prod model
+#nohup java -jar -Dspring.profiles.active=prod $1 CenterService.jar > center.log $1 2>&1 &
+
+#### normal test model
+#nohup java -jar -Dspring.profiles.active=test $1 CenterService.jar > center.log $1 2>&1 &
+
+#### normal dev model
+nohup java -jar -Dspring.profiles.active=dev $1 CenterService.jar > center.log $1 2>&1 &
+
+tail -100f center.log

+ 30 - 3
CenterService/src/main/java/com/java110/center/CenterServiceApplicationStart.java

@@ -1,6 +1,11 @@
 package com.java110.center;
 
-import com.java110.event.center.init.CenterServiceStartInit;
+import com.java110.center.smo.ICenterServiceCacheSMO;
+import com.java110.common.factory.ApplicationContextFactory;
+import com.java110.common.factory.DataQueryFactory;
+import com.java110.entity.service.DataQuery;
+import com.java110.event.center.init.EventConfigInit;
+import com.java110.service.init.ServiceStartInit;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.web.client.RestTemplateBuilder;
@@ -43,8 +48,30 @@ public class CenterServiceApplicationStart {
     public static void main(String[] args) throws Exception{
         ApplicationContext context = SpringApplication.run(CenterServiceApplicationStart.class, args);
 
-        CenterServiceStartInit centerServiceStartInit = new CenterServiceStartInit();
+        //服务启动加载
+        ServiceStartInit.initSystemConfig(context);
 
-        centerServiceStartInit.initSystemConfig(context);
+        //加载事件数据
+        EventConfigInit.initSystemConfig();
+
+        //刷新缓存
+        flushMainCache(args);
+    }
+
+
+    /**
+     * 刷新主要的缓存
+     * @param args
+     */
+    private static void flushMainCache(String []args) {
+        if (args == null || args.length == 0) {
+            return;
+        }
+        for (int i = 0; i < args.length; i++) {
+            if (args[i].equalsIgnoreCase("-Dcache")) {
+                ICenterServiceCacheSMO centerServiceCacheSMO = (ICenterServiceCacheSMO) ApplicationContextFactory.getBean("centerServiceCacheSMOImpl");
+                centerServiceCacheSMO.startFlush();
+            }
+        }
     }
 }

+ 5 - 0
CenterService/src/main/java/com/java110/center/smo/ICenterServiceCacheSMO.java

@@ -11,4 +11,9 @@ public interface ICenterServiceCacheSMO {
      * 刷新 缓存
      */
     public void flush(DataQuery dataQuery);
+
+    /**
+     * 系统启动刷新
+     */
+    public void startFlush();
 }

+ 30 - 1
CenterService/src/main/java/com/java110/center/smo/impl/CenterServiceCacheSMOImpl.java

@@ -53,6 +53,21 @@ public class CenterServiceCacheSMOImpl implements ICenterServiceCacheSMO {
         dataQuery.setResponseInfo(DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_SUCCESS,"刷新成功"));
     }
 
+    /**
+     * 用来系统启动刷新
+     */
+    @Override
+    public void startFlush() {
+        //1.0 封装 AppRoute
+        doFlushAppRoute();
+
+        //2.0 分装 Mapping
+        doFlushMapping();
+
+        //3.0 分装 ServiceSql
+        doFlushServiceSql();
+    }
+
     private void checkCacheParam(DataQuery dataQuery) throws SMOException{
         JSONObject params = dataQuery.getRequestParams();
         if(params == null || !params.containsKey(CommonConstant.CACHE_PARAM_NAME)){
@@ -68,6 +83,11 @@ public class CenterServiceCacheSMOImpl implements ICenterServiceCacheSMO {
         if(!CommonConstant.CACHE_SERVICE_SQL.equals(params.getString(CommonConstant.CACHE_PARAM_NAME))){
             return ;
         }
+        // 刷新
+        doFlushServiceSql();
+    }
+
+    private void doFlushServiceSql() {
         List<ServiceSql> serviceSqls = queryServiceDAOImpl.qureyServiceSqlAll();
 
         if(serviceSqls == null || serviceSqls.size() == 0){
@@ -78,6 +98,7 @@ public class CenterServiceCacheSMOImpl implements ICenterServiceCacheSMO {
         }
     }
 
+
     /**
      * 刷新 Mapping 数据
      */
@@ -89,6 +110,10 @@ public class CenterServiceCacheSMOImpl implements ICenterServiceCacheSMO {
             return ;
         }
 
+        doFlushMapping();
+    }
+
+    private void doFlushMapping() {
         List<Mapping> mappings = centerServiceDAOImpl.getMappingInfoAll();
 
         for(Mapping mapping : mappings){
@@ -123,6 +148,11 @@ public class CenterServiceCacheSMOImpl implements ICenterServiceCacheSMO {
         if(!CommonConstant.CACHE_APP_ROUTE_SERVICE.equals(params.getString(CommonConstant.CACHE_PARAM_NAME))){
             return ;
         }
+        doFlushAppRoute();
+
+    }
+
+    private void doFlushAppRoute() {
         List<Map> appInfos = centerServiceDAOImpl.getAppRouteAndServiceInfoAll();
         Map<String,List<AppRoute>> appRoustsMap = new HashMap<String,List<AppRoute>>();
         List<AppRoute> appRoutes = null;
@@ -140,7 +170,6 @@ public class CenterServiceCacheSMOImpl implements ICenterServiceCacheSMO {
         for (String appId : appRoustsMap.keySet()) {
             AppRouteCache.setAppRoute(appRoustsMap.get(appId));
         }
-
     }
 
     public ICenterServiceDAO getCenterServiceDAOImpl() {

+ 84 - 0
CenterService/src/main/resources/application-dev.yml

@@ -0,0 +1,84 @@
+jedis:
+  pool:
+    config:
+      maxTotal: 100
+      maxIdle: 20
+      maxWaitMillis: 20000
+    host: 192.168.31.199
+    port: 6379
+
+eureka:
+  instance:
+    leaseRenewalIntervalInSeconds: 10
+    leaseExpirationDurationInSeconds: 30
+  client:
+    serviceUrl:
+      defaultZone: http://192.168.31.199:8761/eureka/
+      #defaultZone: http://localhost:8761/eureka/
+server:
+  port: 8001
+spring:
+  application:
+    name: center-service
+  redis:
+    database: 0
+    host: 192.168.31.199
+    port: 6379
+    pool:
+      max-active: 300
+      max-wait: 10000
+      max-idle: 100
+      min-idle: 0
+      timeout: 0
+  datasource:
+    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
+    minIdle: 5
+    validationQuery: SELECT 1 FROM DUAL
+    initialSize: 5
+    maxWait: 60000
+    filters: stat,wall,log4j
+    poolPreparedStatements: true
+    type: com.alibaba.druid.pool.DruidDataSource
+    url: jdbc:mysql://192.168.31.199:3306/TT
+    maxPoolPreparedStatementPerConnectionSize: 20
+    password: TT@12345678
+    testOnBorrow: false
+    testWhileIdle: true
+    minEvictableIdleTimeMillis: 300000
+    timeBetweenEvictionRunsMillis: 60000
+    testOnReturn: false
+    driverClassName: com.mysql.jdbc.Driver
+    maxActive: 20
+    username: TT
+
+#============== kafka ===================
+kafka:
+  consumer:
+    zookeeper:
+      connect: 192.168.31.199:2181
+    servers: 192.168.31.199:9092
+    enable:
+      auto:
+        commit: true
+    session:
+      timeout: 6000
+    auto:
+      commit:
+        interval: 100
+      offset:
+        reset: latest
+    topic: test
+    group:
+      id: notifyBusinessStatus
+    concurrency: 10
+
+  producer:
+    zookeeper:
+      connect: 192.168.31.199:2181
+    servers: 192.168.31.199:9092
+    retries: 0
+    batch:
+      size: 4096
+    linger: 1
+    buffer:
+      memory: 40960

+ 84 - 0
CenterService/src/main/resources/application-prod.yml

@@ -0,0 +1,84 @@
+jedis:
+  pool:
+    config:
+      maxTotal: 100
+      maxIdle: 20
+      maxWaitMillis: 20000
+    host: 135.192.86.200
+    port: 6379
+
+eureka:
+  instance:
+    leaseRenewalIntervalInSeconds: 10
+    leaseExpirationDurationInSeconds: 30
+  client:
+    serviceUrl:
+      defaultZone: http://135.192.86.200:8761/eureka/
+      #defaultZone: http://localhost:8761/eureka/
+server:
+  port: 8001
+spring:
+  application:
+    name: center-service
+  redis:
+    database: 0
+    host: 135.192.86.200
+    port: 6379
+    pool:
+      max-active: 300
+      max-wait: 10000
+      max-idle: 100
+      min-idle: 0
+      timeout: 0
+  datasource:
+    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
+    minIdle: 5
+    validationQuery: SELECT 1 FROM DUAL
+    initialSize: 5
+    maxWait: 60000
+    filters: stat,wall,log4j
+    poolPreparedStatements: true
+    type: com.alibaba.druid.pool.DruidDataSource
+    url: jdbc:mysql://135.192.86.200:3306/TT
+    maxPoolPreparedStatementPerConnectionSize: 20
+    password: TT@12345678
+    testOnBorrow: false
+    testWhileIdle: true
+    minEvictableIdleTimeMillis: 300000
+    timeBetweenEvictionRunsMillis: 60000
+    testOnReturn: false
+    driverClassName: com.mysql.jdbc.Driver
+    maxActive: 20
+    username: TT
+
+#============== kafka ===================
+kafka:
+  consumer:
+    zookeeper:
+      connect: 135.192.86.200:2181
+    servers: 135.192.86.200:9092
+    enable:
+      auto:
+        commit: true
+    session:
+      timeout: 6000
+    auto:
+      commit:
+        interval: 100
+      offset:
+        reset: latest
+    topic: test
+    group:
+      id: notifyBusinessStatus
+    concurrency: 10
+
+  producer:
+    zookeeper:
+      connect: 135.192.86.200:2181
+    servers: 135.192.86.200:9092
+    retries: 0
+    batch:
+      size: 4096
+    linger: 1
+    buffer:
+      memory: 40960

+ 84 - 0
CenterService/src/main/resources/application-test.yml

@@ -0,0 +1,84 @@
+jedis:
+  pool:
+    config:
+      maxTotal: 100
+      maxIdle: 20
+      maxWaitMillis: 20000
+    host: 135.192.86.200
+    port: 6379
+
+eureka:
+  instance:
+    leaseRenewalIntervalInSeconds: 10
+    leaseExpirationDurationInSeconds: 30
+  client:
+    serviceUrl:
+      defaultZone: http://135.192.86.200:8761/eureka/
+      #defaultZone: http://localhost:8761/eureka/
+server:
+  port: 8001
+spring:
+  application:
+    name: center-service
+  redis:
+    database: 0
+    host: 135.192.86.200
+    port: 6379
+    pool:
+      max-active: 300
+      max-wait: 10000
+      max-idle: 100
+      min-idle: 0
+      timeout: 0
+  datasource:
+    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
+    minIdle: 5
+    validationQuery: SELECT 1 FROM DUAL
+    initialSize: 5
+    maxWait: 60000
+    filters: stat,wall,log4j
+    poolPreparedStatements: true
+    type: com.alibaba.druid.pool.DruidDataSource
+    url: jdbc:mysql://135.192.86.200:3306/TT
+    maxPoolPreparedStatementPerConnectionSize: 20
+    password: TT@12345678
+    testOnBorrow: false
+    testWhileIdle: true
+    minEvictableIdleTimeMillis: 300000
+    timeBetweenEvictionRunsMillis: 60000
+    testOnReturn: false
+    driverClassName: com.mysql.jdbc.Driver
+    maxActive: 20
+    username: TT
+
+#============== kafka ===================
+kafka:
+  consumer:
+    zookeeper:
+      connect: 135.192.86.200:2181
+    servers: 135.192.86.200:9092
+    enable:
+      auto:
+        commit: true
+    session:
+      timeout: 6000
+    auto:
+      commit:
+        interval: 100
+      offset:
+        reset: latest
+    topic: test
+    group:
+      id: notifyBusinessStatus
+    concurrency: 10
+
+  producer:
+    zookeeper:
+      connect: 135.192.86.200:2181
+    servers: 135.192.86.200:9092
+    retries: 0
+    batch:
+      size: 4096
+    linger: 1
+    buffer:
+      memory: 40960

+ 2 - 83
CenterService/src/main/resources/application.yml

@@ -1,84 +1,3 @@
-jedis:
-  pool:
-    config:
-      maxTotal: 100
-      maxIdle: 20
-      maxWaitMillis: 20000
-    host: 135.192.86.200
-    port: 6379
-
-eureka:
-  instance:
-    leaseRenewalIntervalInSeconds: 10
-    leaseExpirationDurationInSeconds: 30
-  client:
-    serviceUrl:
-      defaultZone: http://135.192.86.200:8761/eureka/
-      #defaultZone: http://localhost:8761/eureka/
-server:
-  port: 8001
 spring:
-  application:
-    name: center-service
-  redis:
-    database: 0
-    host: 135.192.86.200
-    port: 6379
-    pool:
-      max-active: 300
-      max-wait: 10000
-      max-idle: 100
-      min-idle: 0
-      timeout: 0
-  datasource:
-    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
-    minIdle: 5
-    validationQuery: SELECT 1 FROM DUAL
-    initialSize: 5
-    maxWait: 60000
-    filters: stat,wall,log4j
-    poolPreparedStatements: true
-    type: com.alibaba.druid.pool.DruidDataSource
-    url: jdbc:mysql://135.192.86.200:3306/TT
-    maxPoolPreparedStatementPerConnectionSize: 20
-    password: TT@12345678
-    testOnBorrow: false
-    testWhileIdle: true
-    minEvictableIdleTimeMillis: 300000
-    timeBetweenEvictionRunsMillis: 60000
-    testOnReturn: false
-    driverClassName: com.mysql.jdbc.Driver
-    maxActive: 20
-    username: TT
-
-#============== kafka ===================
-kafka:
-  consumer:
-    zookeeper:
-      connect: 135.192.86.200:2181
-    servers: 135.192.86.200:9092
-    enable:
-      auto:
-        commit: true
-    session:
-      timeout: 6000
-    auto:
-      commit:
-        interval: 100
-      offset:
-        reset: latest
-    topic: test
-    group:
-      id: notifyBusinessStatus
-    concurrency: 10
-
-  producer:
-    zookeeper:
-      connect: 135.192.86.200:2181
-    servers: 135.192.86.200:9092
-    retries: 0
-    batch:
-      size: 4096
-    linger: 1
-    buffer:
-      memory: 40960
+  profiles:
+    active: dev

+ 14 - 0
ConsoleService/doc/start_consoleService.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+#### debug model prod
+#nohup java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -jar -Dspring.profiles.active=dev ConsoleService.jar > console.log 2>&1 &
+
+#### normal prod model
+#nohup java -jar -Dspring.profiles.active=prod ConsoleService.jar > console.log 2>&1 &
+
+#### normal test model
+#nohup java -jar -Dspring.profiles.active=test ConsoleService.jar > console.log 2>&1 &
+
+#### normal dev model
+nohup java -jar -Dspring.profiles.active=dev ConsoleService.jar > console.log 2>&1 &
+
+tail -100f console.log

+ 27 - 0
ConsoleService/src/main/java/com/java110/console/rest/ConsoleRest.java

@@ -69,6 +69,7 @@ public class ConsoleRest extends BaseController {
         return pd.getResJson().toJSONString();
     }
 
+
     @RequestMapping(path = "/console/flushCache",method = RequestMethod.POST)
     public String flushCache(HttpServletRequest request){
         PageData pd = null;
@@ -88,4 +89,30 @@ public class ConsoleRest extends BaseController {
 
         return pd.getResJson().toJSONString();
     }
+
+    /**
+     * 编辑模板数据
+     * @param request
+     * @return
+     */
+    @RequestMapping(path = "/console/editTemplateData",method = RequestMethod.POST)
+    public  String  editTemplateData(HttpServletRequest request){
+        PageData pd = null;
+        try {
+            pd = this.getPageData(request);
+            // 判断用户是否登录
+            checkLogin(pd);
+            consoleServiceSMOImpl.editTemplateData(pd);
+        }catch (IllegalArgumentException e){
+            return DataTransactionFactory.pageResponseJson(pd, ResponseConstant.RESULT_PARAM_ERROR,e.getMessage(),null);
+        }catch (SMOException e){
+            return DataTransactionFactory.pageResponseJson(pd,e.getResult().getCode(),e.getMessage(),null);
+        }catch (Exception e){
+            logger.error("异常信息:",e);
+            return DataTransactionFactory.pageResponseJson(pd,ResponseConstant.RESULT_CODE_ERROR,"请求参数出错 ",null);
+        }
+
+        return pd.getResJson().toJSONString();
+    }
+
 }

+ 7 - 0
ConsoleService/src/main/java/com/java110/console/smo/IConsoleServiceSMO.java

@@ -64,5 +64,12 @@ public interface IConsoleServiceSMO {
      */
     public void queryCacheOne(PageData pd) throws  SMOException;
 
+    /**
+     * 编辑模板数据
+     * @param pd
+     * @throws SMOException
+     */
+    public void editTemplateData(PageData pd) throws SMOException;
+
 
 }

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

@@ -346,6 +346,45 @@ public class ConsoleServiceSMOImpl extends LoggerEngine implements IConsoleServi
         pd.setResJson(DataTransactionFactory.pageResponseJson(pd.getTransactionId(),ResponseConstant.RESULT_CODE_SUCCESS,"查询成功 ",templateObj));
 
     }
+
+    /**
+     * 编辑模板数据
+     * @param pd
+     * @throws SMOException
+     */
+    public void editTemplateData(PageData pd) throws SMOException{
+
+        //查询模板信息
+        getTemplate(pd);
+        JSONObject template = pd.getData().getJSONObject("template");
+        String oper = pd.getParam().getString("oper");
+        Assert.hasLength(oper,"oper 字段不能为空");
+        String templateUrl = template.getString("templateUrl");
+        if(StringUtil.isNullOrNone(templateUrl)){
+            throw new SMOException(ResponseConstant.RESULT_CODE_CONFIG_ERROR,"配置错误,模板中url 没有被配置");
+        }
+        String serviceCode = "";
+        if(CommonConstant.TEMPLATE_OPER_ADD.equals(oper)){
+            serviceCode = CommonConstant.TEMPLATE_URL_INSERT;
+        }else if(CommonConstant.TEMPLATE_OPER_EDIT.equals(oper)){
+            serviceCode = CommonConstant.TEMPLATE_URL_UPDATE;
+        }else if(CommonConstant.TEMPLATE_OPER_DEL.equals(oper)){
+            serviceCode = CommonConstant.TEMPLATE_URL_DELETE;
+        }else{
+            throw new SMOException(ResponseConstant.RESULT_PARAM_ERROR,"入参错误oper 只能为 add edit del 中的一种");
+        }
+        Map paramIn = new HashMap();
+        paramIn.putAll(pd.getParam());
+        paramIn.put("userId", pd.getUserId());
+        paramIn.put(CommonConstant.ORDER_USER_ID,pd.getUserId());
+        paramIn.put(ServiceCodeConstant.SERVICE_CODE,getServiceCode(templateUrl,serviceCode));
+        paramIn.put(ServiceCodeConstant.SERVICE_CODE_NAME,"数据操作");
+        //paramIn.put("userPwd", userPwd);
+        JSONObject businessObj = doExecute(paramIn);
+
+        pd.setResJson(businessObj);
+    }
+
     /**
      * 获取serviceCode
      * @param templateUrl

+ 108 - 0
ConsoleService/src/main/resources/application-dev.yml

@@ -0,0 +1,108 @@
+project:
+  name: dev
+
+jedis:
+  pool:
+    config:
+      maxTotal: 100
+      maxIdle: 20
+      maxWaitMillis: 20000
+    host: 192.168.31.199
+    port: 6379
+
+eureka:
+  instance:
+    leaseRenewalIntervalInSeconds: 10
+    leaseExpirationDurationInSeconds: 30
+  client:
+    serviceUrl:
+      defaultZone: http://192.168.31.199:8761/eureka/
+      #defaultZone: http://localhost:8761/eureka/
+server:
+  port: 8443
+  ssl:
+    keyStoreType: PKCS12
+    keyAlias: tomcat
+    key-store: classpath:keystore.p12
+    key-store-password: 12345678
+  session:
+      cookie:
+        http-only: true
+spring:
+  application:
+    name: console-service
+  redis:
+    database: 0
+    host: 192.168.31.199
+    port: 6379
+    pool:
+      max-active: 300
+      max-wait: 10000
+      max-idle: 100
+      min-idle: 0
+      timeout: 0
+  datasource:
+    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
+    minIdle: 5
+    validationQuery: SELECT 1 FROM DUAL
+    initialSize: 5
+    maxWait: 60000
+    filters: stat,wall,log4j
+    poolPreparedStatements: true
+    type: com.alibaba.druid.pool.DruidDataSource
+    url: jdbc:mysql://192.168.31.199:3306/TT
+    maxPoolPreparedStatementPerConnectionSize: 20
+    password: TT@12345678
+    testOnBorrow: false
+    testWhileIdle: true
+    minEvictableIdleTimeMillis: 300000
+    timeBetweenEvictionRunsMillis: 60000
+    testOnReturn: false
+    driverClassName: com.mysql.jdbc.Driver
+    maxActive: 20
+    username: TT
+
+  freemarker:
+    charset: UTF-8
+    cache: false
+    expose-request-attributes: true
+    request-context-attribute: request
+    expose-session-attributes: true
+    content-type: text/html
+    template-loader-path: classpath:/html/
+    suffix: .html
+    check-template-location: true
+
+#============== kafka ===================
+kafka:
+  consumer:
+    zookeeper:
+      connect: 192.168.31.199:2181
+    servers: 192.168.31.199:9092
+    enable:
+      auto:
+        commit: true
+    session:
+      timeout: 6000
+    auto:
+      commit:
+        interval: 100
+      offset:
+        reset: latest
+    topic: test
+    group:
+      id: consoleService
+    concurrency: 10
+
+  producer:
+    zookeeper:
+      connect: 192.168.31.199:2181
+    servers: 192.168.31.199:9092
+    retries: 0
+    batch:
+      size: 4096
+    linger: 1
+    buffer:
+      memory: 40960
+
+

+ 108 - 0
ConsoleService/src/main/resources/application-prod.yml

@@ -0,0 +1,108 @@
+project:
+  name: prod
+
+jedis:
+  pool:
+    config:
+      maxTotal: 100
+      maxIdle: 20
+      maxWaitMillis: 20000
+    host: 135.192.86.200
+    port: 6379
+
+eureka:
+  instance:
+    leaseRenewalIntervalInSeconds: 10
+    leaseExpirationDurationInSeconds: 30
+  client:
+    serviceUrl:
+      defaultZone: http://135.192.86.200:8761/eureka/
+      #defaultZone: http://localhost:8761/eureka/
+server:
+  port: 8443
+  ssl:
+    keyStoreType: PKCS12
+    keyAlias: tomcat
+    key-store: classpath:keystore.p12
+    key-store-password: 12345678
+  session:
+      cookie:
+        http-only: true
+spring:
+  application:
+    name: console-service
+  redis:
+    database: 0
+    host: 135.192.86.200
+    port: 6379
+    pool:
+      max-active: 300
+      max-wait: 10000
+      max-idle: 100
+      min-idle: 0
+      timeout: 0
+  datasource:
+    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
+    minIdle: 5
+    validationQuery: SELECT 1 FROM DUAL
+    initialSize: 5
+    maxWait: 60000
+    filters: stat,wall,log4j
+    poolPreparedStatements: true
+    type: com.alibaba.druid.pool.DruidDataSource
+    url: jdbc:mysql://135.192.86.200:3306/TT
+    maxPoolPreparedStatementPerConnectionSize: 20
+    password: TT@12345678
+    testOnBorrow: false
+    testWhileIdle: true
+    minEvictableIdleTimeMillis: 300000
+    timeBetweenEvictionRunsMillis: 60000
+    testOnReturn: false
+    driverClassName: com.mysql.jdbc.Driver
+    maxActive: 20
+    username: TT
+
+  freemarker:
+    charset: UTF-8
+    cache: false
+    expose-request-attributes: true
+    request-context-attribute: request
+    expose-session-attributes: true
+    content-type: text/html
+    template-loader-path: classpath:/html/
+    suffix: .html
+    check-template-location: true
+
+#============== kafka ===================
+kafka:
+  consumer:
+    zookeeper:
+      connect: 135.192.86.200:2181
+    servers: 135.192.86.200:9092
+    enable:
+      auto:
+        commit: true
+    session:
+      timeout: 6000
+    auto:
+      commit:
+        interval: 100
+      offset:
+        reset: latest
+    topic: test
+    group:
+      id: consoleService
+    concurrency: 10
+
+  producer:
+    zookeeper:
+      connect: 135.192.86.200:2181
+    servers: 135.192.86.200:9092
+    retries: 0
+    batch:
+      size: 4096
+    linger: 1
+    buffer:
+      memory: 40960
+
+

+ 107 - 0
ConsoleService/src/main/resources/application-test.yml

@@ -0,0 +1,107 @@
+project:
+  name: test
+jedis:
+  pool:
+    config:
+      maxTotal: 100
+      maxIdle: 20
+      maxWaitMillis: 20000
+    host: 135.192.86.200
+    port: 6379
+
+eureka:
+  instance:
+    leaseRenewalIntervalInSeconds: 10
+    leaseExpirationDurationInSeconds: 30
+  client:
+    serviceUrl:
+      defaultZone: http://135.192.86.200:8761/eureka/
+      #defaultZone: http://localhost:8761/eureka/
+server:
+  port: 8443
+  ssl:
+    keyStoreType: PKCS12
+    keyAlias: tomcat
+    key-store: classpath:keystore.p12
+    key-store-password: 12345678
+  session:
+      cookie:
+        http-only: true
+spring:
+  application:
+    name: console-service
+  redis:
+    database: 0
+    host: 135.192.86.200
+    port: 6379
+    pool:
+      max-active: 300
+      max-wait: 10000
+      max-idle: 100
+      min-idle: 0
+      timeout: 0
+  datasource:
+    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
+    minIdle: 5
+    validationQuery: SELECT 1 FROM DUAL
+    initialSize: 5
+    maxWait: 60000
+    filters: stat,wall,log4j
+    poolPreparedStatements: true
+    type: com.alibaba.druid.pool.DruidDataSource
+    url: jdbc:mysql://135.192.86.200:3306/TT
+    maxPoolPreparedStatementPerConnectionSize: 20
+    password: TT@12345678
+    testOnBorrow: false
+    testWhileIdle: true
+    minEvictableIdleTimeMillis: 300000
+    timeBetweenEvictionRunsMillis: 60000
+    testOnReturn: false
+    driverClassName: com.mysql.jdbc.Driver
+    maxActive: 20
+    username: TT
+
+  freemarker:
+    charset: UTF-8
+    cache: false
+    expose-request-attributes: true
+    request-context-attribute: request
+    expose-session-attributes: true
+    content-type: text/html
+    template-loader-path: classpath:/html/
+    suffix: .html
+    check-template-location: true
+
+#============== kafka ===================
+kafka:
+  consumer:
+    zookeeper:
+      connect: 135.192.86.200:2181
+    servers: 135.192.86.200:9092
+    enable:
+      auto:
+        commit: true
+    session:
+      timeout: 6000
+    auto:
+      commit:
+        interval: 100
+      offset:
+        reset: latest
+    topic: test
+    group:
+      id: consoleService
+    concurrency: 10
+
+  producer:
+    zookeeper:
+      connect: 135.192.86.200:2181
+    servers: 135.192.86.200:9092
+    retries: 0
+    batch:
+      size: 4096
+    linger: 1
+    buffer:
+      memory: 40960
+
+

+ 2 - 104
ConsoleService/src/main/resources/application.yml

@@ -1,105 +1,3 @@
-jedis:
-  pool:
-    config:
-      maxTotal: 100
-      maxIdle: 20
-      maxWaitMillis: 20000
-    host: 135.192.86.200
-    port: 6379
-
-eureka:
-  instance:
-    leaseRenewalIntervalInSeconds: 10
-    leaseExpirationDurationInSeconds: 30
-  client:
-    serviceUrl:
-      defaultZone: http://135.192.86.200:8761/eureka/
-      #defaultZone: http://localhost:8761/eureka/
-server:
-  port: 8443
-  ssl:
-    keyStoreType: PKCS12
-    keyAlias: tomcat
-    key-store: classpath:keystore.p12
-    key-store-password: 12345678
-  session:
-      cookie:
-        http-only: true
 spring:
-  application:
-    name: console-service
-  redis:
-    database: 0
-    host: 135.192.86.200
-    port: 6379
-    pool:
-      max-active: 300
-      max-wait: 10000
-      max-idle: 100
-      min-idle: 0
-      timeout: 0
-  datasource:
-    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
-    minIdle: 5
-    validationQuery: SELECT 1 FROM DUAL
-    initialSize: 5
-    maxWait: 60000
-    filters: stat,wall,log4j
-    poolPreparedStatements: true
-    type: com.alibaba.druid.pool.DruidDataSource
-    url: jdbc:mysql://135.192.86.200:3306/TT
-    maxPoolPreparedStatementPerConnectionSize: 20
-    password: TT@12345678
-    testOnBorrow: false
-    testWhileIdle: true
-    minEvictableIdleTimeMillis: 300000
-    timeBetweenEvictionRunsMillis: 60000
-    testOnReturn: false
-    driverClassName: com.mysql.jdbc.Driver
-    maxActive: 20
-    username: TT
-
-  freemarker:
-    charset: UTF-8
-    cache: false
-    expose-request-attributes: true
-    request-context-attribute: request
-    expose-session-attributes: true
-    content-type: text/html
-    template-loader-path: classpath:/html/
-    suffix: .html
-    check-template-location: true
-
-#============== kafka ===================
-kafka:
-  consumer:
-    zookeeper:
-      connect: 135.192.86.200:2181
-    servers: 135.192.86.200:9092
-    enable:
-      auto:
-        commit: true
-    session:
-      timeout: 6000
-    auto:
-      commit:
-        interval: 100
-      offset:
-        reset: latest
-    topic: test
-    group:
-      id: consoleService
-    concurrency: 10
-
-  producer:
-    zookeeper:
-      connect: 135.192.86.200:2181
-    servers: 135.192.86.200:9092
-    retries: 0
-    batch:
-      size: 4096
-    linger: 1
-    buffer:
-      memory: 40960
-
-
+  profiles:
+    active: test

+ 2 - 1
ConsoleService/src/main/resources/data/list_template.json

@@ -13,7 +13,8 @@
         "index": "id",
         "width": 60,
         "sorttype": "int",
-        "editable": "true"
+        "editable": "true",
+        "editoptions": {"size" : "10"}
       }
     }, {
       "colName": "日期",

+ 37 - 340
ConsoleService/src/main/resources/html/test.html

@@ -23,6 +23,8 @@
 
 <div id="grid-pager"></div>
 
+<button class="btn btn-blue" id="bedata">新增</button>
+
 
 <script src="../static/assets/js/jquery-2.1.4.min.js"></script>
 <script src="../static/assets/js/jquery.jqGrid.min.js"></script>
@@ -33,346 +35,41 @@
 <!-- inline scripts related to this page -->
 <script type="text/javascript">
 
-        var reqJson = createRequestData('queryTemplate','');
-
-        var colNames = [];
-
-        var colModels = [];
-
-
-        $.ajax({
-               type: "POST",
-               url: "../data/list_template.json",
-               data: reqJson,
-               contentType: "application/text",
-               dataType:"text",
-               success: function(data){
-                       processResponse(data);
-                  },
-               error: function(data){
-                   //alertText("网络超时,请稍后再试");
-               }
-            });
-
-
-            function processResponse(data){
-                var data = getResponseInfo(data)
-                if(data.code != "0000"){
-                    alertText(data.msg+",错误ID:"+data.id);
-                    return ;
-                }
-                var templates = data.data.template;
-                if(templates == null || templates == undefined){
-                    return ;
-                }
-
-
-
-                for(var colIndex = 0; colIndex < templates.length; colIndex++){
-                    colNames.push(templates[colIndex].colName);
-                    if(templates[colIndex].colModel.formatter == undefined){
-                        colModels.push(templates[colIndex].colModel);
-                    }else{
-                    colModels.push(JSON.parse(JSON.stringify(templates[colIndex].colModel),function(k,v){
-                      if(v.indexOf && v.indexOf('function') > -1){
-                         return eval("(function(){return "+v+" })()")
-                      }
-                      return v;
-                    }));
-                    }
-                }
-            showGradData(colNames,colModels)
-            }
-
-
-        function showGradData(colNames,colModels){
-
-			jQuery(function($) {
-				var grid_selector = "#grid-table";
-				var pager_selector = "#grid-pager";
-
-
-				var parent_column = $(grid_selector).closest('[class*="col-"]');
-				//resize to fit page size
-				$(window).on('resize.jqGrid', function () {
-					$(grid_selector).jqGrid( 'setGridWidth', parent_column.width() );
-			    })
-
-				//resize on sidebar collapse/expand
-				$(document).on('settings.ace.jqGrid' , function(ev, event_name, collapsed) {
-					if( event_name === 'sidebar_collapsed' || event_name === 'main_container_fixed' ) {
-						//setTimeout is for webkit only to give time for DOM changes and then redraw!!!
-						setTimeout(function() {
-							$(grid_selector).jqGrid( 'setGridWidth', parent_column.width() );
-						}, 20);
-					}
-			    })
-
-				jQuery(grid_selector).jqGrid({
-					subGrid : false,
-					//data: grid_data,
-					url: "../data/list.json",
-					datatype: "json",
-					height: 250,
-					colNames:colNames,
-					colModel:colModels,
-					viewrecords : true,
-					rowNum:10,
-					rowList:[10,20,30],
-					pager : pager_selector,
-					altRows: true,
-					multiselect: true,
-			        multiboxonly: true,
-					loadComplete : function() {
-						var table = this;
-						setTimeout(function(){
-							styleCheckbox(table);
-
-							updateActionIcons(table);
-							updatePagerIcons(table);
-							enableTooltips(table);
-						}, 0);
-					},
-
-				});
-				$(window).triggerHandler('resize.jqGrid');//trigger window resize to make the grid get the correct size
-
-
-				//switch element when editing inline
-				function aceSwitch( cellvalue, options, cell ) {
-					setTimeout(function(){
-						$(cell) .find('input[type=checkbox]')
-							.addClass('ace ace-switch ace-switch-5')
-							.after('<span class="lbl"></span>');
-					}, 0);
-				}
-
-				function doItemData(cellvalue, options, rowObject){
-                    var temp ='<div style="margin-left:8px;"><div title="详情记录" style="float:left;cursor:pointer;" class="ui-pg-div" id="jEditButton_3" onclick="detail('+rowObject+')" onmouseover="jQuery(this).addClass("ui-state-hover");" onmouseout="jQuery(this).removeClass(\"ui-state-hover\");"><span class="ui-icon fa-search-plus"/></div></div>';
-                   return '['+cellvalue+']';
-                }
-
-				//enable datepicker
-				function pickDate( cellvalue, options, cell ) {
-					setTimeout(function(){
-						$(cell) .find('input[type=text]')
-							.datepicker({format:'yyyy-mm-dd' , autoclose:true});
-					}, 0);
-				}
-
-
-				//navButtons
-				jQuery(grid_selector).jqGrid('navGrid',pager_selector,
-					{ 	//navbar options
-						edit: true,
-						editicon : 'ace-icon fa fa-pencil blue',
-						add: true,
-						addicon : 'ace-icon fa fa-plus-circle purple',
-						del: true,
-						delicon : 'ace-icon fa fa-trash-o red',
-						search: true,
-						searchicon : 'ace-icon fa fa-search orange',
-						refresh: true,
-						refreshicon : 'ace-icon fa fa-refresh green',
-						view: true,
-						viewicon : 'ace-icon fa fa-search-plus grey',
-					},
-					{
-						//edit record form
-						//closeAfterEdit: true,
-						//width: 700,
-						recreateForm: true,
-						beforeShowForm : function(e) {
-							var form = $(e[0]);
-							form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />')
-							style_edit_form(form);
-						}
-					},
-					{
-						//new record form
-						//width: 700,
-						closeAfterAdd: true,
-						recreateForm: true,
-						viewPagerButtons: false,
-						beforeShowForm : function(e) {
-							var form = $(e[0]);
-							form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar')
-							.wrapInner('<div class="widget-header" />')
-							style_edit_form(form);
-						}
-					},
-					{
-						//delete record form
-						recreateForm: true,
-						beforeShowForm : function(e) {
-							var form = $(e[0]);
-							if(form.data('styled')) return false;
-
-							form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />')
-							style_delete_form(form);
-
-							form.data('styled', true);
-						},
-						onClick : function(e) {
-							//alert(1);
-						}
-					},
-					{
-						//search form
-						recreateForm: true,
-						afterShowSearch: function(e){
-							var form = $(e[0]);
-							form.closest('.ui-jqdialog').find('.ui-jqdialog-title').wrap('<div class="widget-header" />')
-							style_search_form(form);
-						},
-						afterRedraw: function(){
-							style_search_filters($(this));
-						}
-						,
-						multipleSearch: true,
-						/**
-						multipleGroup:true,
-						showQuery: true
-						*/
-					},
-					{
-						//view record form
-						recreateForm: true,
-						beforeShowForm: function(e){
-							var form = $(e[0]);
-							form.closest('.ui-jqdialog').find('.ui-jqdialog-title').wrap('<div class="widget-header" />')
-						}
-					}
-				)
-
-
-
-				function style_edit_form(form) {
-					//enable datepicker on "sdate" field and switches for "stock" field
-					form.find('input[name=sdate]').datepicker({format:'yyyy-mm-dd' , autoclose:true})
-
-					form.find('input[name=stock]').addClass('ace ace-switch ace-switch-5').after('<span class="lbl"></span>');
-							   //don't wrap inside a label element, the checkbox value won't be submitted (POST'ed)
-							  //.addClass('ace ace-switch ace-switch-5').wrap('<label class="inline" />').after('<span class="lbl"></span>');
-
-
-					//update buttons classes
-					var buttons = form.next().find('.EditButton .fm-button');
-					buttons.addClass('btn btn-sm').find('[class*="-icon"]').hide();//ui-icon, s-icon
-					buttons.eq(0).addClass('btn-primary').prepend('<i class="ace-icon fa fa-check"></i>');
-					buttons.eq(1).prepend('<i class="ace-icon fa fa-times"></i>')
-
-					buttons = form.next().find('.navButton a');
-					buttons.find('.ui-icon').hide();
-					buttons.eq(0).append('<i class="ace-icon fa fa-chevron-left"></i>');
-					buttons.eq(1).append('<i class="ace-icon fa fa-chevron-right"></i>');
-				}
-
-				function style_delete_form(form) {
-					var buttons = form.next().find('.EditButton .fm-button');
-					buttons.addClass('btn btn-sm btn-white btn-round').find('[class*="-icon"]').hide();//ui-icon, s-icon
-					buttons.eq(0).addClass('btn-danger').prepend('<i class="ace-icon fa fa-trash-o"></i>');
-					buttons.eq(1).addClass('btn-default').prepend('<i class="ace-icon fa fa-times"></i>')
-				}
-
-				function style_search_filters(form) {
-					form.find('.delete-rule').val('X');
-					form.find('.add-rule').addClass('btn btn-xs btn-primary');
-					form.find('.add-group').addClass('btn btn-xs btn-success');
-					form.find('.delete-group').addClass('btn btn-xs btn-danger');
-				}
-				function style_search_form(form) {
-					var dialog = form.closest('.ui-jqdialog');
-					var buttons = dialog.find('.EditTable')
-					buttons.find('.EditButton a[id*="_reset"]').addClass('btn btn-sm btn-info').find('.ui-icon').attr('class', 'ace-icon fa fa-retweet');
-					buttons.find('.EditButton a[id*="_query"]').addClass('btn btn-sm btn-inverse').find('.ui-icon').attr('class', 'ace-icon fa fa-comment-o');
-					buttons.find('.EditButton a[id*="_search"]').addClass('btn btn-sm btn-purple').find('.ui-icon').attr('class', 'ace-icon fa fa-search');
-				}
-
-				function beforeDeleteCallback(e) {
-					var form = $(e[0]);
-					if(form.data('styled')) return false;
-
-					form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />')
-					style_delete_form(form);
-
-					form.data('styled', true);
-				}
-
-				function beforeEditCallback(e) {
-					var form = $(e[0]);
-					form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />')
-					style_edit_form(form);
-				}
-
-
-
-				//it causes some flicker when reloading or navigating grid
-				//it may be possible to have some custom formatter to do this as the grid is being created to prevent this
-				//or go back to default browser checkbox styles for the grid
-				function styleCheckbox(table) {
-				/**
-					$(table).find('input:checkbox').addClass('ace')
-					.wrap('<label />')
-					.after('<span class="lbl align-top" />')
-
-
-					$('.ui-jqgrid-labels th[id*="_cb"]:first-child')
-					.find('input.cbox[type=checkbox]').addClass('ace')
-					.wrap('<label />').after('<span class="lbl align-top" />');
-				*/
-				}
-
-
-				//unlike navButtons icons, action icons in rows seem to be hard-coded
-				//you can change them like this in here if you want
-				function updateActionIcons(table) {
-					/**
-					var replacement =
-					{
-						'ui-ace-icon fa fa-pencil' : 'ace-icon fa fa-pencil blue',
-						'ui-ace-icon fa fa-trash-o' : 'ace-icon fa fa-trash-o red',
-						'ui-icon-disk' : 'ace-icon fa fa-check green',
-						'ui-icon-cancel' : 'ace-icon fa fa-times red'
-					};
-					$(table).find('.ui-pg-div span.ui-icon').each(function(){
-						var icon = $(this);
-						var $class = $.trim(icon.attr('class').replace('ui-icon', ''));
-						if($class in replacement) icon.attr('class', 'ui-icon '+replacement[$class]);
-					})
-					*/
-				}
-
-				//replace icons with FontAwesome icons like above
-				function updatePagerIcons(table) {
-					var replacement =
-					{
-						'ui-icon-seek-first' : 'ace-icon fa fa-angle-double-left bigger-140',
-						'ui-icon-seek-prev' : 'ace-icon fa fa-angle-left bigger-140',
-						'ui-icon-seek-next' : 'ace-icon fa fa-angle-right bigger-140',
-						'ui-icon-seek-end' : 'ace-icon fa fa-angle-double-right bigger-140'
-					};
-					$('.ui-pg-table:not(.navtable) > tbody > tr > .ui-pg-button > .ui-icon').each(function(){
-						var icon = $(this);
-						var $class = $.trim(icon.attr('class').replace('ui-icon', ''));
-
-						if($class in replacement) icon.attr('class', 'ui-icon '+replacement[$class]);
-					})
-				}
-
-				function enableTooltips(table) {
-					$('.navtable .ui-pg-button').tooltip({container:'body'});
-					$(table).find('.ui-pg-div').tooltip({container:'body'});
-				}
-
-				//var selr = jQuery(grid_selector).jqGrid('getGridParam','selrow');
-
-				$(document).one('ajaxloadstart.page', function(e) {
-					$.jgrid.gridDestroy(grid_selector);
-					$('.ui-jqdialog').remove();
-				});
-			});
-			}
+       $(function(){
+  pageInit();
+});
+function pageInit(){
+  jQuery("#grid-table").jqGrid(
+      {
+        url : '../data/list.json',
+        datatype : "json",
+        colNames : [ 'Inv No', 'Date', 'Client', 'Amount', 'Tax','Total', 'Closed', 'Ship via', 'Notes' ],
+        colModel : [
+                    {name : 'id',index : 'id',width : 55,editable : "true",editoptions : {readonly : true,size : 10}},
+                    {name : 'invdate',index : 'invdate',width : 80,editable : true,editoptions : {size : 10}},
+                    {name : 'name',index : 'name',width : 90,editable : true,editoptions : {size : 25}},
+                    {name : 'amount',index : 'amount',width : 60,align : "right",editable : true,editoptions : {size : 10}},
+                    {name : 'tax',index : 'tax',width : 60,align : "right",editable : true,editoptions : {size : 10}},
+                    {name : 'total',index : 'total',width : 60,align : "right",editable : true,editoptions : {size : 10}},
+                    {name : 'closed',index : 'closed',width : 55,align : 'center',editable : true,edittype : "checkbox",editoptions : {value : "Yes:No"}},
+                    {name : 'ship_via',index : 'ship_via',width : 70,editable : true,edittype : "select",editoptions : {value : "FE:FedEx;TN:TNT"}},
+                    {name : 'note',index : 'note',width : 100,sortable : false,editable : true,edittype : "textarea",editoptions : {rows : "2",cols : "20"}}
+                  ],
+        rowNum : 10,
+        rowList : [ 10, 20, 30 ],
+        pager : '#pagered',
+        sortname : 'id',
+        viewrecords : true,
+        sortorder : "desc",
+        caption : "Search Example",
+        editurl : "/RowEditing"
+      });
+  $("#bedata").click(function() {
+    jQuery("#grid-table").jqGrid('editGridRow', "new", {
+      reloadAfterSubmit : false
+    });
+  });
+}
 		</script>
 </body>
 </html>

+ 1 - 6
ConsoleService/src/main/resources/static/javascript/java110_list_template.js

@@ -99,7 +99,7 @@ function showGradData(colNames,colModels){
 					enableTooltips(table);
 				}, 0);
 			},
-
+            editurl: "/console/editTemplateData?templateCode="+templateCode,
 		});
 		$(window).triggerHandler('resize.jqGrid');//trigger window resize to make the grid get the correct size
 
@@ -113,11 +113,6 @@ function showGradData(colNames,colModels){
 			}, 0);
 		}
 
-		function doItemData(cellvalue, options, rowObject){
-            var temp ='<div style="margin-left:8px;"><div title="详情记录" style="float:left;cursor:pointer;" class="ui-pg-div" id="jEditButton_3" onclick="detail('+rowObject+')" onmouseover="jQuery(this).addClass("ui-state-hover");" onmouseout="jQuery(this).removeClass(\"ui-state-hover\");"><span class="ui-icon fa-search-plus"/></div></div>';
-           return '['+cellvalue+']';
-        }
-
 		//enable datepicker
 		function pickDate( cellvalue, options, cell ) {
 			setTimeout(function(){

Разница между файлами не показана из-за своего большого размера
+ 392 - 0
MicroCommunity.sql


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

@@ -82,9 +82,27 @@ public class CommonConstant {
     public final static String TEMPLATE_URL_QUERY = "QUERY->";
     public final static String TEMPLATE_URL_UPDATE = "UPDATE->";
     public final static String TEMPLATE_URL_DELETE = "DELETE->";
+    public final static String TEMPLATE_URL_INSERT = "INSERT->";
     public final static String TEMPLATE_URL_SPILT = ";";
 
 
+    /**
+     * 添加数据
+     */
+    public final static String TEMPLATE_OPER_ADD = "add";
+
+
+    /**
+     * 编辑数据
+     */
+    public final static String TEMPLATE_OPER_EDIT = "edit";
+
+    /**
+     * 删除数据
+     */
+    public final static String TEMPLATE_OPER_DEL = "del";
+
+
     public final static String CACHE_PARAM_NAME = "cacheName";
 
     /**

+ 56 - 3
java110-config/db/CenterService/create_table.db

@@ -238,6 +238,16 @@ VALUES('query.console.caches','S','Q','查询所有缓存',1,'http://center-serv
 INSERT INTO c_service(service_code,invoke_model,business_type_cd,`name`,seq,url,provide_app_id)
 VALUES('query.console.cache','S','Q','查询所有缓存',1,'http://center-service/businessApi/query','8000418002');
 
+
+INSERT INTO c_service(service_code,invoke_model,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('save.center.mapping','S','Q','保存映射信息',1,'http://center-service/businessApi/do','8000418002');
+
+INSERT INTO c_service(service_code,invoke_model,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('delete.center.mapping','S','Q','保存映射信息',1,'http://center-service/businessApi/do','8000418002');
+
+INSERT INTO c_service(service_code,invoke_model,business_type_cd,`name`,seq,url,provide_app_id)
+VALUES('update.center.mapping','S','Q','保存映射信息',1,'http://center-service/businessApi/do','8000418002');
+
 insert into c_route(app_id,service_id,order_type_cd,status_cd) values(
 '8000418001','1','Q','0'
 );
@@ -286,6 +296,17 @@ INSERT INTO c_route(app_id,service_id,order_type_cd,status_cd) VALUES(
 '8000418002','13','Q','0'
 );
 
+INSERT INTO c_route(app_id,service_id,order_type_cd,status_cd) VALUES(
+'8000418002','14','Q','0'
+);
+INSERT INTO c_route(app_id,service_id,order_type_cd,status_cd) VALUES(
+'8000418002','15','Q','0'
+);
+
+INSERT INTO c_route(app_id,service_id,order_type_cd,status_cd) VALUES(
+'8000418002','16','Q','0'
+);
+
 
 
 
@@ -434,9 +455,9 @@ VALUES('query.center.route','查询路由数据','page,rows,sord','1','{"param1"
                                                         }','','0');
 
 INSERT INTO c_service_sql(service_code,`name`,params,query_model,`sql`,proc,template,remark,status_cd)
-VALUES('query.console.caches','查询路由数据','userId','1','{
+VALUES('query.console.caches','查询缓存数据','userId','1','{
                                                              "param1":"SELECT c.id id,c.`cache_code` cacheCode, c.`name` cacheName FROM c_cache c, c_cache_2_user c2u WHERE c.`cache_code` = c2u.`cache_code` AND c.`status_cd` = ''0''
-                                                                       AND c2u.`status_cd` = ''0'' AND c2u.`user_id` = #10001# AND c.`group` = ''COMMON'' ORDER BY c.`seq` ASC"
+                                                                       AND c2u.`status_cd` = ''0'' AND c2u.`user_id` = #userId# AND c.`group` = ''COMMON'' ORDER BY c.`seq` ASC"
                                                              }','','{
                                                         	"PARAM": {
                                                         		"param1": "$.#rows#Array"
@@ -464,7 +485,39 @@ VALUES('query.console.cache','查询单条缓存信息','cacheCode','1','{
                                                         }','','0');
 
 
-
+INSERT INTO c_service_sql(service_code,`name`,params,query_model,`sql`,proc,template,remark,status_cd)
+VALUES('save.center.mapping','保存映射信息','domain,name,key,value,remark','1','{
+                                                             "param1":"INSERT c_mapping(domain,`name`,`key`,`value`,remark) VALUES(#domain#,#name#,#key#,#value#,#remark#)"
+                                                             }','','{
+                                                        	"TEMPLATE": {
+                                                        		"response": {
+                                                        			"code": "0000",
+                                                        			"message": "成功"
+                                                        		}
+                                                        	}
+                                                        }','','0');
+INSERT INTO c_service_sql(service_code,`name`,params,query_model,`sql`,proc,template,remark,status_cd)
+VALUES('delete.center.mapping','删除映射信息','id','1','{
+                                                             "param1":"UPDATE c_mapping m SET m.status_cd = ''1'' WHERE m.status_cd = ''0'' AND m.id = #id#"
+                                                             }','','{
+                                                        	"TEMPLATE": {
+                                                        		"response": {
+                                                        			"code": "0000",
+                                                        			"message": "成功"
+                                                        		}
+                                                        	}
+                                                        }','','0');
+INSERT INTO c_service_sql(service_code,`name`,params,query_model,`sql`,proc,template,remark,status_cd)
+VALUES('update.center.mapping','修改映射信息','id,domain,name,key,value,remark','1','{
+                                                             "param1":"UPDATE c_mapping m SET m.domain=#domain#,m.name = #name#,m.key=#key#,m.value=#value#,m.remark=#remark# WHERE m.status_cd = ''0'' AND m.id = #id#"
+                                                             }','','{
+                                                        	"TEMPLATE": {
+                                                        		"response": {
+                                                        			"code": "0000",
+                                                        			"message": "成功"
+                                                        		}
+                                                        	}
+                                                        }','','0');
 
 
 

Разница между файлами не показана из-за своего большого размера
+ 37 - 37
java110-config/db/ConsoleService/create_table.db


+ 8 - 44
java110-event/src/main/java/com/java110/event/center/init/CenterServiceStartInit.java

@@ -1,15 +1,10 @@
 package com.java110.event.center.init;
 
 import com.java110.common.factory.ApplicationContextFactory;
-import com.java110.entity.center.DataFlow;
 import com.java110.event.app.AppEventPublishing;
-import com.java110.event.app.AppListener;
 import com.java110.event.center.DataFlowEventPublishing;
 import com.java110.event.center.DataFlowListener;
-import com.java110.event.listener.common.CommonDispatchListener;
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.boot.context.event.ApplicationReadyEvent;
-import org.springframework.context.ApplicationContext;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.support.PropertiesLoaderUtils;
 
@@ -20,18 +15,18 @@ import java.util.Properties;
  * 系统启动时加载信息
  * Created by wuxw on 2017/4/14.
  */
-public class CenterServiceStartInit  {
+public class EventConfigInit {
 
     /**
      * 默认 事件配置路径classpath:/
      */
-    private final String DEFAULT_EVENT_PATH = "config/";
+    private final static String DEFAULT_EVENT_PATH = "config/";
 
 
     /**
      * 默认 文件名称  .properties
      */
-    private final String DEFAULT_FILE_NAME = "center_event.properties";
+    private final static String DEFAULT_FILE_NAME = "center_event.properties";
 
     /**
      * 订单调度处理侦听
@@ -44,42 +39,11 @@ public class CenterServiceStartInit  {
     private final static String DISPATCH_EVENT = "java110.event.properties.centerServiceEvent";
 
 
-
-
-    /**
-     * 加载配置文件,将侦听初始化
-     * @param event
-     */
-   // @Override
-    public void onApplicationEvent(ApplicationReadyEvent event){
-
-
-        //加载配置文件,注册订单处理侦听
-        try {
-
-            ApplicationContextFactory.setApplicationContext(event.getApplicationContext());
-
-            Properties properties = this.load(DEFAULT_EVENT_PATH,DEFAULT_FILE_NAME);
-
-            registerListener(properties);
-
-            //注册事件
-            registerEvent(properties);
-
-        }
-        catch (Exception ex) {
-            throw new IllegalStateException("system init error", ex);
-        }
-
-    }
-
-    public void initSystemConfig(ApplicationContext context){
+    public static void initSystemConfig(){
         //加载配置文件,注册订单处理侦听
         try {
 
-            ApplicationContextFactory.setApplicationContext(context);
-
-            Properties properties = this.load(DEFAULT_EVENT_PATH,DEFAULT_FILE_NAME);
+            Properties properties = load(DEFAULT_EVENT_PATH,DEFAULT_FILE_NAME);
 
             registerListener(properties);
 
@@ -99,7 +63,7 @@ public class CenterServiceStartInit  {
      * @param filename
      * @param
      */
-    private Properties load(String location,String filename) throws Exception{
+    private  static Properties load(String location,String filename) throws Exception{
         Properties properties = PropertiesLoaderUtils.loadProperties(new ClassPathResource(location+filename));
         return properties;
     }
@@ -108,7 +72,7 @@ public class CenterServiceStartInit  {
      * 注册侦听
      * @param properties
      */
-    private void registerListener(Properties properties) throws Exception{
+    private static void registerListener(Properties properties) throws Exception{
 
         String[] listeners = properties.getProperty(DATAFLOW_LISTENER).split("\\,");
 
@@ -128,7 +92,7 @@ public class CenterServiceStartInit  {
      * @param properties
      * @throws Exception
      */
-    private void registerEvent(Properties properties) throws Exception{
+    private static void registerEvent(Properties properties) throws Exception{
         String[] events = properties.getProperty(DISPATCH_EVENT).split("\\,");
 
         for (String event : events){

+ 1 - 0
java110-service/src/main/java/com/java110/service/api/BusinessApi.java

@@ -85,6 +85,7 @@ public class BusinessApi extends BaseController {
         try {
             DataQuery dataQuery = DataQueryFactory.newInstance().builder(businessInfo);
             initConfig(dataQuery);
+            //这里应该添加 只有配置类数据才能处理数据,业务类数据不能操作 逻辑
             queryServiceSMOImpl.commonDoService(dataQuery);
             return dataQuery.getResponseInfo().toJSONString();
         }catch (Exception e){

+ 3 - 0
java110-service/src/main/java/com/java110/service/init/ServiceStartInit.java

@@ -19,4 +19,7 @@ public class ServiceStartInit {
             throw new IllegalStateException("system init error", ex);
         }
     }
+
+
+
 }

+ 7 - 2
java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java

@@ -108,10 +108,12 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
      * @param dataQuery
      */
     private void doExecuteUpdateSql(DataQuery dataQuery) throws BusinessException{
-
+        JSONObject business = null;
         try {
             JSONObject params = dataQuery.getRequestParams();
             JSONObject sqlObj = JSONObject.parseObject(dataQuery.getServiceSql().getSql());
+            JSONObject templateObj = JSONObject.parseObject(dataQuery.getServiceSql().getTemplate());
+            business = JSONObject.parseObject(templateObj.getString("TEMPLATE"));
             List<Object> currentParams = new ArrayList<Object>();
             String currentSql = "";
             for(String key : sqlObj.keySet()) {
@@ -124,7 +126,7 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
                         continue;
                     }
                     currentSqlNew += "?";
-                    currentParams.add(params.get(sqls[sqlIndex]) instanceof Integer ? params.getInteger(sqls[sqlIndex]) : "'" + params.getString(sqls[sqlIndex]) + "'");
+                    currentParams.add(params.get(sqls[sqlIndex]) instanceof Integer ? params.getInteger(sqls[sqlIndex]) : "" + params.getString(sqls[sqlIndex]) + "");
                     //currentSqlNew += params.get(sqls[sqlIndex]) instanceof Integer ? params.getInteger(sqls[sqlIndex]) : "'" + params.getString(sqls[sqlIndex]) + "'";
                 }
 
@@ -139,6 +141,9 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
             logger.error("数据交互异常:",e);
             throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"数据交互异常。。。");
         }
+
+        dataQuery.setResponseInfo(DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_SUCCESS,
+                "成功",business));
     }
 
     /**