Explorar o código

正式环境测试

weijianghai %!s(int64=2) %!d(string=hai) anos
pai
achega
36f74dcc6d

+ 1 - 1
readme.md

@@ -6,4 +6,4 @@
 
 ## 正式环境
 
-- 部署位置:192.168.70.130/data1/acl_task/
+- 部署位置:192.168.10.7/data/acl_task/

+ 1 - 1
scripts/product/gpload/gpload.sh

@@ -6,7 +6,7 @@ source /usr/local/greenplum-db-clients/greenplum_loaders_path.sh
 password=sqmdb_1QAZ
 expect -c "
 set timeout 300
-spawn gpload -f gpload/gpload.yml -V --gpfdist_timeout 30
+spawn gpload -f gpload/gpload.yml -V -l gpload/gpload.log --gpfdist_timeout 30
 expect {
 \"connecting (yes/no)?\" { send \"yes\n\";exp_continue }
 \"Password:\" { send \"${password}\n\"; exp_continue}

+ 1 - 1
scripts/product/gpload/gpload.yml

@@ -10,7 +10,7 @@ GPLOAD:
   INPUT:
     - SOURCE:
         LOCAL_HOSTNAME:
-          - 192.168.70.130
+          - 192.168.10.7
         PORT: 54331
         FILE:
           - top-user.csv

+ 1 - 1
scripts/test/gpload/gpload.sh

@@ -5,7 +5,7 @@ source /usr/local/greenplum-db-clients/greenplum_loaders_path.sh
 password=sqmdb_1QAZ
 expect -c "
 set timeout 300
-spawn gpload -f gpload/gpload.yml -V --gpfdist_timeout 30
+spawn gpload -f gpload/gpload.yml -V -l gpload/gpload.log --gpfdist_timeout 30
 expect {
 \"connecting (yes/no)?\" { send \"yes\n\";exp_continue }
 \"Password:\" { send \"${password}\n\"; exp_continue}

+ 28 - 28
src/main/java/com/nokia/task/SyncTask.java

@@ -1,6 +1,5 @@
 package com.nokia.task;
 
-import com.alibaba.fastjson2.JSON;
 import com.jcraft.jsch.JSchException;
 import com.jcraft.jsch.SftpException;
 import com.nokia.common.exception.MyRuntimeException;
@@ -17,7 +16,6 @@ import org.apache.commons.csv.CSVPrinter;
 import org.apache.commons.csv.CSVRecord;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
 
@@ -167,8 +165,10 @@ public class SyncTask {
                 throw new MyRuntimeException("数据为空");
             }
             // 查询所有用户,过滤已删除和测试用户
+//            String sql = "select user_id, login_name, city_id from sqmdb_rpt.acl_user"
+//                    + " where deleted = 0 and test_user = 0 order by user_id";
             String sql = "select user_id, login_name, city_id from sqmdb_rpt.acl_user"
-                    + " where deleted = 0 and test_user = 0 order by user_id";
+                    + " order by user_id";
             List<Map<String, Object>> allUsers = jdbcTemplate.queryForList(sql);
             Map<Object, Map<String, Object>> userMap = new HashMap<>();
             allUsers.forEach(t -> userMap.put(t.get("login_name"), t));
@@ -236,31 +236,31 @@ public class SyncTask {
             Files.deleteIfExists(inputPath);
             log.info("删除本地源文件 {}", filename);
             XxlJobHelper.log("删除本地源文件 {}", filename);
-            // 检查删除用户
-            sql = "select user_id from sqmdb_rpt.acl_user"
-                    + " where deleted = 0 and test_user = 0 and login_name not in (:loginNames)"
-                    + " order by user_id";
-            Map<String, Object> paramMap = new HashMap<>();
-            paramMap.put("loginNames", csvRecordMap.keySet());
-            NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
-            List<Integer> deletedUsers = namedParameterJdbcTemplate.queryForList(sql, paramMap, Integer.class);
-            if (!CollectionUtils.isEmpty(deletedUsers)) {
-                log.error("已删除用户: {}", JSON.toJSONString(deletedUsers));
-            }
-            // 检查权限地市
-            sql = "select distinct au.user_id"
-                    + " from sqmdb_rpt.acl_user au"
-                    + " inner join sqmdb_rpt.acl_user_role_city aurc on au.user_id = aurc.user_id"
-                    + " where au.city_id != aurc.city_id"
-                    + " and aurc.role_id != 3"
-                    + " order by au.user_id";
-            List<Integer> diffUsers = jdbcTemplate.queryForList(sql, Integer.class);
-            if (!CollectionUtils.isEmpty(diffUsers)) {
-                log.error("权限地市不一致用户: {}", JSON.toJSONString(diffUsers));
-            }
-            if (!CollectionUtils.isEmpty(modifiedUsers)) {
-                log.error("地市变化用户: {}", JSON.toJSONString(modifiedUsers));
-            }
+//            // 检查删除用户
+//            sql = "select user_id from sqmdb_rpt.acl_user"
+//                    + " where deleted = 0 and test_user = 0 and login_name not in (:loginNames)"
+//                    + " order by user_id";
+//            Map<String, Object> paramMap = new HashMap<>();
+//            paramMap.put("loginNames", csvRecordMap.keySet());
+//            NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
+//            List<Integer> deletedUsers = namedParameterJdbcTemplate.queryForList(sql, paramMap, Integer.class);
+//            if (!CollectionUtils.isEmpty(deletedUsers)) {
+//                log.error("已删除用户: {}", JSON.toJSONString(deletedUsers));
+//            }
+//            // 检查权限地市
+//            sql = "select distinct au.user_id"
+//                    + " from sqmdb_rpt.acl_user au"
+//                    + " inner join sqmdb_rpt.acl_user_role_city aurc on au.user_id = aurc.user_id"
+//                    + " where au.city_id != aurc.city_id"
+//                    + " and aurc.role_id != 3"
+//                    + " order by au.user_id";
+//            List<Integer> diffUsers = jdbcTemplate.queryForList(sql, Integer.class);
+//            if (!CollectionUtils.isEmpty(diffUsers)) {
+//                log.error("权限地市不一致用户: {}", JSON.toJSONString(diffUsers));
+//            }
+//            if (!CollectionUtils.isEmpty(modifiedUsers)) {
+//                log.error("地市变化用户: {}", JSON.toJSONString(modifiedUsers));
+//            }
         }
     }
 

+ 1 - 1
src/main/resources/application-product.properties

@@ -1,5 +1,5 @@
 # web服务端口号
-server.port=12129
+server.port=12130
 
 # log配置
 logging.level.root=info

+ 1 - 1
src/main/resources/application.properties

@@ -1,2 +1,2 @@
 # 启用的配置
-spring.profiles.active=test
+spring.profiles.active=product

+ 1 - 1
src/main/resources/logback-spring.xml

@@ -33,7 +33,7 @@
             <totalSizeCap>20GB</totalSizeCap>
         </rollingPolicy>
         <encoder>
-            <Pattern>%d %highlight(%-5level) %magenta([%thread]) %cyan(%logger:%line) %msg%n</Pattern>
+            <Pattern>%d %-5level [%thread] %logger:%line %msg%n</Pattern>
             <charset>UTF-8</charset>
         </encoder>
         <filter class="ch.qos.logback.classic.filter.LevelFilter">