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 5
 import com.dashitech.migration.core.DataMigrationter;
6 6
 import com.dashitech.migration.core.FieldMapper;
7 7
 import com.dashitech.migration.core.RowsWrap;
8
+import com.dashitech.migration.util.JdbcRow;
8 9
 import com.dashitech.migration.util.JdbcUtil;
9 10
 import org.apache.commons.logging.Log;
10 11
 import org.apache.commons.logging.LogFactory;
@@ -14,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
14 15
 
15 16
 import java.util.List;
16 17
 import java.util.Map;
18
+import java.util.stream.Collectors;
17 19
 
18 20
 /**
19 21
  * Created by CX on 2024/10/10.
@@ -56,7 +58,10 @@ public class UserTask extends BaseTask {
56 58
         RowsWrap rw = DataMigrationter.getRowsWrap(mapper,userMapper);
57 59
         JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
58 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 66
         //clear释放内存
62 67
         mapper.clear();