From 8c6cf449e1a7de5101fe66799be6cc71bf9f00f7 Mon Sep 17 00:00:00 2001 From: zhangdongxu Date: Fri, 9 Feb 2018 17:49:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BC=94=E7=A4=BA=E7=B3=BB=E7=BB=9F=E7=BB=86?= =?UTF-8?q?=E8=8A=82=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/restful/ConfigSourcesService.java | 7 ++++ .../restful/UpdateCompileByJDBCThread.java | 42 +++++++++++++++++++ src/main/resources/jdbc.properties | 6 ++- src/main/resources/matt.properties | 4 +- 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java b/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java index 78f06ab..b5def87 100644 --- a/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java +++ b/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java @@ -80,6 +80,13 @@ public class ConfigSourcesService extends BaseService { public static Map> getTableRelation() { Map> tableMap = new HashMap>(); Map typeMap = new HashMap(); + typeMap.put("REUSE_IP", "ip"); + typeMap.put("HID_CONTENT", "ip"); + typeMap.put("GSB_PZ_IP", "ip"); + typeMap.put("FAKE_REGION_EXTEND", "str"); + tableMap.put(0, typeMap); + + typeMap = new HashMap(); typeMap.put("DF_IP_PORT", "ip"); tableMap.put(1, typeMap); diff --git a/src/main/java/com/nis/web/service/restful/UpdateCompileByJDBCThread.java b/src/main/java/com/nis/web/service/restful/UpdateCompileByJDBCThread.java index 39af8c7..bee41b8 100644 --- a/src/main/java/com/nis/web/service/restful/UpdateCompileByJDBCThread.java +++ b/src/main/java/com/nis/web/service/restful/UpdateCompileByJDBCThread.java @@ -435,6 +435,44 @@ public class UpdateCompileByJDBCThread implements Runnable { } } } + + /** + * + * @Description: 根据compileId更新与之对应的group关系表的生效状态 + * @author (zdx) + * @date 2017年8月16日 上午9:46:44 + * @param compileList + * @param conn + * @param opTime + * @param msgList + */ + public static void updateGroupByCompileId(List compileList, Connection conn, Date opTime, + List msgList) { + if (null != compileList && compileList.size() > 0) { + try { + StringBuffer sb = new StringBuffer(); + String tabName = Configurations.getStringProperty("groupTabName", "CONFIG_GROUP"); + sb.append("update "+tabName+" set IS_VALID=?,op_time=?,LAST_UPDATE=sysdate where COMPILE_ID=? "); + conn.setAutoCommit(false); + PreparedStatement ps = conn.prepareStatement(sb.toString()); + for (ConfigCompile compile : compileList) { + Object[] obj = new Object[] { compile.getIsValid(), opTime,compile.getCompileId() }; + for (int x = 0; x < obj.length; x++) { + if (x == 1) { + ps.setTimestamp(x + 1, utileDate2TimeStamp(opTime)); + } else { + ps.setObject(x + 1, obj[x]); + } + } + ps.addBatch(); + } + ps.executeBatch(); + } catch (Exception e) { + logger.error(e); + msgList.add(e); + } + } + } @Override public void run() { List msgList = ConfigSourcesService.getMsgList(); @@ -451,6 +489,10 @@ public class UpdateCompileByJDBCThread implements Runnable { } else if (null != numRegionList && numRegionList.size() > 0) { updateNumRegion(tableName, numRegionList, conn, opTime, msgList); } + + if((null !=compileList && compileList.size() > 0)&&(null != groupList && groupList.size()==0)){ + updateGroupByCompileId(compileList, conn, opTime, msgList); + } latch.countDown(); // System.out.println("latchCount=======================" + // latch.getCount()); diff --git a/src/main/resources/jdbc.properties b/src/main/resources/jdbc.properties index df116c8..5d20973 100644 --- a/src/main/resources/jdbc.properties +++ b/src/main/resources/jdbc.properties @@ -8,9 +8,11 @@ jdbc.devlop.password=/+7+DgxK++ZaD1nIcRRmDg== jdbc.product.driver=oracle.jdbc.driver.OracleDriver #jdbc.product.url=jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.17)(PORT = 1521))(LOAD_BALANCE = yes)(CONNECT_DATA =(SERVICE_NAME = ORCL)(FAILOVER_MODE =(TYPE = select)(METHOD = basic)(RETRIES = 180)(DELAY = 180)))) -jdbc.product.url=jdbc:oracle:thin:@10.0.6.212:1523:app +#jdbc.product.url=jdbc:oracle:thin:@10.0.6.212:1523:app +jdbc.product.url=jdbc:oracle:thin:@10.0.6.165:1521:orcl #jdbc.product.url=jdbc:oracle:thin:@10.174.196.20:1521:orcl -jdbc.product.username=gk_pz +jdbc.product.username=dfxj_2015 +#jdbc.product.username=gk_pz #jdbc.product.username=z2_5x9pz jdbc.product.key=3X3ZBejyxS7lkVsHVm9KTw== jdbc.product.password=sHqDBZIUS0hYZCbC+1xN3A== diff --git a/src/main/resources/matt.properties b/src/main/resources/matt.properties index 11b0025..bcb2d29 100644 --- a/src/main/resources/matt.properties +++ b/src/main/resources/matt.properties @@ -1,12 +1,12 @@ #编译表表名 -compileTabName=CONFIG_COMPILE +compileTabName=MATT_CONFIG_COMPILE_WY #编译表 新增配置时添加的字段 英文逗号分隔 compileFieldName=COMPILE_ID ,SERVICE ,ACTION , CONT_TYPE, ATTR_TYPE, CONT_LABEL, Task_id, Guarantee_ID, AFFAIR_ID, TOPIC_ID, DO_BLACKLIST ,DO_LOG ,EFFECTIVE_RANGE , ACTIVE_SYS, CONFIG_PERCENT ,CONFIG_OPTION ,START_TIME ,END_TIME , USER_REGION, IS_VALID,GROUP_NUM,FATHER_CFG_ID ,OP_TIME #编译表 配置状态更新的条件 compileUpdateCondition=COMPILE_ID #分组表表名 -groupTabName=CONFIG_GROUP +groupTabName=MAAT_CONFIG_GROUP_WY #分组表 新增配置时添加的字段 英文逗号分隔 #注意:第一个字段必需是分组表主键 groupFieldName=ID,GROUP_ID, COMPILE_ID, IS_VALID, OP_TIME