Kaynağa Gözat

加入代码

wuxw 6 yıl önce
ebeveyn
işleme
c503665d5f

+ 2 - 0
CommunityService/src/main/resources/application-dev.yml

@@ -6,6 +6,8 @@ jedis:
       maxWaitMillis: 20000
     host: dev.redis.java110.com
     port: 6379
+    timeout: 2000
+    password:
 
 eureka:
   instance:

+ 14 - 2
java110-cacheAgent/src/main/java/com/java110/cache/RedisConfiguration.java

@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cache.annotation.CachingConfigurerSupport;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.util.StringUtils;
 import redis.clients.jedis.JedisPool;
 import redis.clients.jedis.JedisPoolConfig;
 
@@ -19,8 +20,19 @@ public class RedisConfiguration extends CachingConfigurerSupport  {
     @Autowired
     public JedisPool jedisPool(@Qualifier("jedis.pool.config") JedisPoolConfig config,
                                @Value("${jedis.pool.host}")String host,
-                               @Value("${jedis.pool.port}")int port) {
-        return new JedisPool(config, host, port);
+                               @Value("${jedis.pool.port}")int port,
+                               @Value("${jedis.pool.timeout}")int timeout,
+                               @Value("${jedis.pool.password}") String password) {
+        //没有配置改为默认值
+        if(timeout == 0){
+            timeout = 2000;
+        }
+
+        if(StringUtils.isEmpty(password)) {
+            return new JedisPool(config, host, port,timeout);
+        }else{
+            return new JedisPool(config,host,port,timeout,password);
+        }
     }
 
     @Bean(name= "jedis.pool.config")

+ 22 - 7
java110-code-generator/src/main/java/com/java110/code/relationship/GeneratorBindingComponent.java

@@ -19,7 +19,7 @@ public class GeneratorBindingComponent extends BaseGenerator {
         genneratorListSmoImpl(data);
 
 
-        //genneratorListListener(data);
+        genneratorListListener(data);
 
         //genneratorServiceCodeConstant(data);
 
@@ -369,18 +369,33 @@ public class GeneratorBindingComponent extends BaseGenerator {
      * @param data
      */
     private void genneratorListListener(JSONObject data) {
-        StringBuffer sb = readFile(GeneratorStart.class.getResource("/web/add/SaveListener.java").getFile());
+        StringBuffer sb = readFile(GeneratorStart.class.getResource("/relationship/binding/BindingListener.java").getFile());
         String fileContext = sb.toString();
 
         fileContext = super.replaceTemplateContext(fileContext, data);
 
         //替换校验部分代码 @@validateTemplateColumns@@
-        JSONArray columns = data.getJSONArray("columns");
+        JSONArray flows = data.getJSONArray("flows");
         StringBuffer validateStr = new StringBuffer();
-        for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) {
-            JSONObject column = columns.getJSONObject(columnIndex);
-            if (column.getBoolean("required")) {
-                validateStr.append("Assert.hasKeyAndValue(reqJson, \"" + column.getString("code") + "\", \"" + column.getString("desc") + "\");\n");
+        for(int flowIndex = 0 ; flowIndex < flows.size() ; flowIndex ++) {
+
+            JSONObject flowObj = flows.getJSONObject(flowIndex);
+
+            if(flowObj.containsKey("existsComponent") && flowObj.getBoolean("existsComponent")){
+                continue;
+            }
+
+            String vcName = flowObj.getString("vcName");
+
+            JSONObject vcObject = data.getJSONObject("components").getJSONObject(vcName);
+
+            JSONArray columns = vcObject.getJSONArray("columns");
+
+            for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) {
+                JSONObject column = columns.getJSONObject(columnIndex);
+                if (column.getBoolean("required")) {
+                    validateStr.append("Assert.hasKeyByFlowData(infos, \""+ flowObj.getString("vcName") +"\", \"" + column.getString("code") + "\", \"" + column.getString("desc") + "\");\n");
+                }
             }
         }
 

+ 4 - 0
java110-code-generator/src/main/resources/relationship/binding/BindingListener.java

@@ -28,6 +28,7 @@ public class Binding@@TemplateCode@@Listener extends AbstractServiceApiListener
     @Override
     protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
         //Assert.hasKeyAndValue(reqJson, "xxx", "xxx");
+        JSONArray infos = reqJson.getJSONObject("infos")
 
         @@validateTemplateColumns@@
     }
@@ -44,6 +45,9 @@ public class Binding@@TemplateCode@@Listener extends AbstractServiceApiListener
 
         JSONArray infos = reqJson.getJSONArray("data");
 
+
+        @@doSoService@@
+
         JSONObject appInfo = getObj(infos, "APP"); //应用信息
         JSONObject serviceInfo = getObj(infos, "SERVICE"); // 服务信息