song 5 months ago
parent
commit
24ed546760
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/main/java/com/dashitech/migration/task/uc/UserTask.java

+ 6 - 1
src/main/java/com/dashitech/migration/task/uc/UserTask.java

@@ -5,6 +5,7 @@ import com.dashitech.migration.SqlTask;
5
 import com.dashitech.migration.core.DataMigrationter;
5
 import com.dashitech.migration.core.DataMigrationter;
6
 import com.dashitech.migration.core.FieldMapper;
6
 import com.dashitech.migration.core.FieldMapper;
7
 import com.dashitech.migration.core.RowsWrap;
7
 import com.dashitech.migration.core.RowsWrap;
8
+import com.dashitech.migration.util.JdbcRow;
8
 import com.dashitech.migration.util.JdbcUtil;
9
 import com.dashitech.migration.util.JdbcUtil;
9
 import org.apache.commons.logging.Log;
10
 import org.apache.commons.logging.Log;
10
 import org.apache.commons.logging.LogFactory;
11
 import org.apache.commons.logging.LogFactory;
@@ -14,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
14
 
15
 
15
 import java.util.List;
16
 import java.util.List;
16
 import java.util.Map;
17
 import java.util.Map;
18
+import java.util.stream.Collectors;
17
 
19
 
18
 /**
20
 /**
19
  * Created by CX on 2024/10/10.
21
  * Created by CX on 2024/10/10.
@@ -56,7 +58,10 @@ public class UserTask extends BaseTask {
56
         RowsWrap rw = DataMigrationter.getRowsWrap(mapper,userMapper);
58
         RowsWrap rw = DataMigrationter.getRowsWrap(mapper,userMapper);
57
         JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
59
         JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
58
         jdbcUtil.batchPageInsert("itsm_uc_user", rw.getInsertRows());
60
         jdbcUtil.batchPageInsert("itsm_uc_user", rw.getInsertRows());
59
-        jdbcUtil.batchPageUpdate("itsm_uc_user", rw.getUpdateRows());
61
+        List<JdbcRow> updateRows = rw.getUpdateRows();
62
+        //过滤微信不为空的数据做更新处理
63
+        updateRows = updateRows.stream().filter(s -> s.getRow().get("WEIXIN") != null).collect(Collectors.toList());
64
+        jdbcUtil.batchPageUpdate("itsm_uc_user", updateRows);
60
 
65
 
61
         //clear释放内存
66
         //clear释放内存
62
         mapper.clear();
67
         mapper.clear();