song 5 місяців тому
батько
коміт
37182ab5de

+ 7 - 1
src/main/java/com/dashitech/migration/StartApplication.java

@@ -1,7 +1,7 @@
1 1
 package com.dashitech.migration;
2 2
 
3
-import com.dashitech.migration.core.FieldMapper;
4 3
 import com.dashitech.migration.task.uc.CompanyTask;
4
+import com.dashitech.migration.task.uc.DepartmentTask;
5 5
 import com.dashitech.migration.task.uc.HospitalTask;
6 6
 import com.dashitech.migration.task.uc.XyGroupTask;
7 7
 import org.apache.commons.logging.Log;
@@ -33,6 +33,8 @@ public class StartApplication {
33 33
     CompanyTask companyTask;
34 34
     @Autowired
35 35
     SqlTask roleUserTask;
36
+    @Autowired
37
+    DepartmentTask departmentTask;
36 38
 
37 39
     @Value("${application.name}")
38 40
     private String appName;
@@ -53,11 +55,15 @@ public class StartApplication {
53 55
 
54 56
 //            userGroupTask.start();
55 57
 
58
+           // userTask.loadCache();
56 59
 //            roleUserTask.start();
57 60
 
58 61
             System.out.println("AAAAA");
59 62
         }
60 63
 
64
+        //companyTask.start();
65
+        //userTask.start();
66
+        departmentTask.start();
61 67
 
62 68
         log.info("########### 迁移任务完成!###########");
63 69
     }

+ 48 - 0
src/main/java/com/dashitech/migration/task/category/IncidentCategoryConfigTask.java

@@ -0,0 +1,48 @@
1
+package com.dashitech.migration.task.category;
2
+
3
+import com.dashitech.migration.BaseTask;
4
+import com.dashitech.migration.core.FieldMapper;
5
+import com.dashitech.migration.util.JdbcUtil;
6
+import org.apache.commons.collections.CollectionUtils;
7
+import org.apache.commons.logging.Log;
8
+import org.apache.commons.logging.LogFactory;
9
+import org.springframework.stereotype.Component;
10
+import org.springframework.transaction.annotation.Transactional;
11
+
12
+import java.util.List;
13
+import java.util.Map;
14
+
15
+/**
16
+ * @author song
17
+ * @date 2024年10月12日
18
+ */
19
+@Component
20
+public class IncidentCategoryConfigTask extends BaseTask {
21
+
22
+    public static Log log = LogFactory.getLog(IncidentCategoryConfigTask.class);
23
+    @Override
24
+    @Transactional
25
+    public void start() {
26
+        StringBuffer sql = new StringBuffer("SELECT version,a.category_id,b._priority as priority,a.duty_id,a.branch_user_group_type as user_group,a.group_id,");
27
+        sql.append("a.user_id,NOW() as add_time,a.branch_id as hos_id FROM itsm_incident_category_usergroup a ");
28
+        sql.append(" JOIN itsm_incident_category b ON a.category_id = b.id");
29
+        if ("xiangyang".equals(appName)) {
30
+            sql.append(" WHERE a.branch_id <> 4 ");
31
+        }
32
+        List<Map<String, Object>> categoryConfigList = jdbcTemplateMdv2.queryForList(sql.toString());
33
+        FieldMapper mapper = new FieldMapper();
34
+        if (CollectionUtils.isNotEmpty(categoryConfigList)) {
35
+            mapper.addOperationAdd("score", getDicId(jdbcTemplateHsms,"incident_score","1"));
36
+            mapper.trans2JdbcRow(categoryConfigList);
37
+
38
+            JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
39
+            jdbcUtil.batchPageInsert("itsm_itsm_incident_category_config", mapper.getRows());
40
+        }
41
+        mapper.clear();
42
+    }
43
+
44
+    @Override
45
+    public FieldMapper loadCache() {
46
+        return null;
47
+    }
48
+}

+ 43 - 0
src/main/java/com/dashitech/migration/task/category/IncidentCategoryTask.java

@@ -0,0 +1,43 @@
1
+package com.dashitech.migration.task.category;
2
+
3
+import com.dashitech.migration.BaseTask;
4
+import com.dashitech.migration.core.FieldMapper;
5
+import com.dashitech.migration.util.JdbcUtil;
6
+import org.apache.commons.logging.Log;
7
+import org.apache.commons.logging.LogFactory;
8
+import org.springframework.stereotype.Component;
9
+import org.springframework.transaction.annotation.Transactional;
10
+
11
+import java.util.List;
12
+import java.util.Map;
13
+
14
+/**
15
+ * @author song
16
+ * @date 2024年10月12日
17
+ */
18
+@Component
19
+public class IncidentCategoryTask extends BaseTask {
20
+
21
+    public static Log log = LogFactory.getLog(IncidentCategoryTask.class);
22
+    @Override
23
+    @Transactional
24
+    public void start() {
25
+        StringBuffer sql = new StringBuffer("SELECT id,version,category,parentid as parent,delete_flag,quanPinyin as qp,suoPinyin as jp,now() as add_time,");
26
+        sql.append("hierarchy,muti_category,muti_suoPinyin as muti_jp,muti_quanPinyin as muti_qp,alias,IFNULL(branch_id,1) as hos_id ");
27
+        sql.append(" FROM itsm_incident_category ");
28
+        List<Map<String, Object>> categoryList = jdbcTemplateMdv2.queryForList(sql.toString());
29
+
30
+        FieldMapper mapper = new FieldMapper();
31
+        mapper.trans2JdbcRow(categoryList);
32
+
33
+        JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
34
+        jdbcUtil.batchPageInsert("itsm_itsm_incident_category", mapper.getRows());
35
+
36
+        mapper.clear();
37
+    }
38
+
39
+    @Override
40
+    public FieldMapper loadCache() {
41
+        return null;
42
+    }
43
+}

+ 71 - 0
src/main/java/com/dashitech/migration/task/consumable/ConsumableHistoryTask.java

@@ -0,0 +1,71 @@
1
+package com.dashitech.migration.task.consumable;
2
+
3
+import com.dashitech.migration.BaseTask;
4
+import com.dashitech.migration.core.FieldMapper;
5
+import com.dashitech.migration.task.uc.DepartmentTask;
6
+import com.dashitech.migration.task.uc.HospitalTask;
7
+import com.dashitech.migration.task.uc.UserTask;
8
+import com.dashitech.migration.util.JdbcUtil;
9
+import org.apache.commons.collections.CollectionUtils;
10
+import org.apache.commons.logging.Log;
11
+import org.apache.commons.logging.LogFactory;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.stereotype.Component;
14
+import org.springframework.transaction.annotation.Transactional;
15
+
16
+import java.util.List;
17
+import java.util.Map;
18
+
19
+/**
20
+ * @author song
21
+ * @date 2024年10月12日
22
+ */
23
+@Component
24
+public class ConsumableHistoryTask extends BaseTask {
25
+
26
+    public static Log log = LogFactory.getLog(ConsumableHistoryTask.class);
27
+
28
+    @Autowired
29
+    private HospitalTask hospitalTask;
30
+
31
+    @Autowired
32
+    private UserTask userTask;
33
+
34
+    @Autowired
35
+    private DepartmentTask departmentTask;
36
+
37
+    @Override
38
+    @Transactional
39
+    public void start() {
40
+        StringBuffer sql = new StringBuffer("SELECT id,asset_consumables_id,operator,VERSION,time,motion,source,source_id,type,consumables_sum,_description,");
41
+        sql.append("_version_number,_details,extra1,extra2,spd_code,consume_type,consume_source,use_dept,his_id,incident_id,repair_summary_id,summary_id,");
42
+        if ("xiangyang".equals(appName)) {
43
+            sql.append("if(repair_duty=4,10,repair_duty) as repair_duty,IF(branch_id=4,3,branch_id) as hos_id ");
44
+        } else {
45
+            sql.append("repair_duty,hos_id ");
46
+        }
47
+        sql.append(" FROM itsm_asset_consumables_history ");
48
+        List<Map<String, Object>> consumableHistoryList = jdbcTemplateMdv2.queryForList(sql.toString());
49
+        FieldMapper mapper = new FieldMapper();
50
+        if (CollectionUtils.isNotEmpty(consumableHistoryList)) {
51
+            mapper.addOperationReplace("repair_duty", hospitalTask.loadCache().getIdCache());
52
+            mapper.addOperationReplace("operator", userTask.loadCache().getIdCache());
53
+            if ("xiangyang".equals(appName)) {
54
+                mapper.addOperationReplace("use_dept", departmentTask.loadCache().getIdCache());
55
+            }
56
+            mapper.trans2JdbcRow(consumableHistoryList);
57
+
58
+            JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
59
+            jdbcUtil.batchPageInsert("itsm_asset_consumables_history", mapper.getRows());
60
+        }
61
+
62
+
63
+        mapper.clear();
64
+
65
+    }
66
+
67
+    @Override
68
+    public FieldMapper loadCache() {
69
+        return null;
70
+    }
71
+}

+ 49 - 0
src/main/java/com/dashitech/migration/task/consumable/ConsumableTask.java

@@ -0,0 +1,49 @@
1
+package com.dashitech.migration.task.consumable;
2
+
3
+import com.dashitech.migration.BaseTask;
4
+import com.dashitech.migration.core.FieldMapper;
5
+import com.dashitech.migration.task.uc.HospitalTask;
6
+import com.dashitech.migration.util.JdbcUtil;
7
+import org.apache.commons.logging.Log;
8
+import org.apache.commons.logging.LogFactory;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.stereotype.Component;
11
+import org.springframework.transaction.annotation.Transactional;
12
+
13
+import java.util.List;
14
+import java.util.Map;
15
+
16
+/**
17
+ * @author song
18
+ * @date 2024年10月12日
19
+ */
20
+@Component
21
+public class ConsumableTask extends BaseTask {
22
+
23
+    public static Log log = LogFactory.getLog(ConsumableTask.class);
24
+
25
+    @Autowired
26
+    private HospitalTask hospitalTask;
27
+
28
+    @Override
29
+    @Transactional
30
+    public void start() {
31
+        StringBuffer sql = new StringBuffer("SELECT id,version,NAME,brand_model as model,inventory_num as stock,start_price as price,company_ids as supplier_id,");
32
+        sql.append("delete_flag,unit,IFNULL(spd_code,spdcode) as spd_code,duty_id as hos_id FROM itsm_asset_consumable");
33
+        List<Map<String, Object>> consumableList = jdbcTemplateMdv2.queryForList(sql.toString());
34
+        FieldMapper mapper = new FieldMapper();
35
+        mapper.addOperationReplace("hos_id", hospitalTask.loadCache().getIdCache());
36
+        mapper.trans2JdbcRow(consumableList);
37
+
38
+        JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
39
+        jdbcUtil.batchPageInsert("itsm_itsm_consumable", mapper.getRows());
40
+
41
+        mapper.clear();
42
+
43
+    }
44
+
45
+    @Override
46
+    public FieldMapper loadCache() {
47
+        return null;
48
+    }
49
+}

+ 41 - 0
src/main/java/com/dashitech/migration/task/consumable/SummaryConsumableTask.java

@@ -0,0 +1,41 @@
1
+package com.dashitech.migration.task.consumable;
2
+
3
+import com.dashitech.migration.BaseTask;
4
+import com.dashitech.migration.core.FieldMapper;
5
+import com.dashitech.migration.util.JdbcUtil;
6
+import org.apache.commons.logging.Log;
7
+import org.apache.commons.logging.LogFactory;
8
+import org.springframework.stereotype.Component;
9
+import org.springframework.transaction.annotation.Transactional;
10
+
11
+import java.util.List;
12
+import java.util.Map;
13
+
14
+/**
15
+ * @author song
16
+ * @date 2024年10月12日
17
+ */
18
+@Component
19
+public class SummaryConsumableTask extends BaseTask {
20
+
21
+    public static Log log = LogFactory.getLog(SummaryConsumableTask.class);
22
+    @Override
23
+    @Transactional
24
+    public void start() {
25
+        StringBuffer sql = new StringBuffer("SELECT * from itsm_summary_consumables");
26
+        List<Map<String, Object>> summaryConsuableList = jdbcTemplateMdv2.queryForList(sql.toString());
27
+        FieldMapper mapper = new FieldMapper();
28
+        mapper.trans2JdbcRow(summaryConsuableList);
29
+
30
+        JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
31
+        jdbcUtil.batchPageInsert("itsm_itsm_summary_consumables", mapper.getRows());
32
+
33
+        mapper.clear();
34
+
35
+    }
36
+
37
+    @Override
38
+    public FieldMapper loadCache() {
39
+        return null;
40
+    }
41
+}

+ 6 - 3
src/main/java/com/dashitech/migration/task/other/DictionaryTask.java

@@ -35,21 +35,24 @@ public class DictionaryTask extends BaseTask {
35 35
     }
36 36
 
37 37
 
38
-    public FieldMapper loadXiangYangCache() {
38
+    private FieldMapper loadXiangYangCache() {
39 39
         log.info(" *** 加载襄阳字典缓存 *** ");
40 40
         FieldMapper mapper = new FieldMapper();
41 41
         Map<Long, Long> dicIdCache = new HashMap<>();
42 42
         mapper.setIdCache(dicIdCache);
43
-
43
+        //知识库
44 44
         dicIdCache.put(71L, 20404L); //待审核
45 45
         dicIdCache.put(72L, 20405L); //已发布
46 46
         dicIdCache.put(73L, 20406L); //待整改
47 47
         dicIdCache.put(74L, 20407L); //已停用
48
+        //耗材消耗
49
+        dicIdCache.put(1735L, 20557L);//消耗
50
+        dicIdCache.put(1736L, 20558L);//撤销
48 51
 
49 52
         return mapper;
50 53
     }
51 54
 
52
-    public FieldMapper loadNanJingCache() {
55
+    private FieldMapper loadNanJingCache() {
53 56
         log.info(" *** 加载南京字典缓存 *** ");
54 57
         FieldMapper mapper = new FieldMapper();
55 58
         Map<Long, Long> idCache = new HashMap<>();

+ 42 - 0
src/main/java/com/dashitech/migration/task/solution/SolutionIntroduce.java

@@ -0,0 +1,42 @@
1
+package com.dashitech.migration.task.solution;
2
+
3
+import com.dashitech.migration.BaseTask;
4
+import com.dashitech.migration.core.FieldMapper;
5
+import com.dashitech.migration.task.uc.UserTask;
6
+import com.dashitech.migration.util.JdbcUtil;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.stereotype.Component;
9
+import org.springframework.transaction.annotation.Transactional;
10
+
11
+import java.util.List;
12
+import java.util.Map;
13
+
14
+/**
15
+ * @author song
16
+ * @date 2024年10月12日
17
+ */
18
+@Component
19
+public class SolutionIntroduce extends BaseTask {
20
+
21
+    @Autowired
22
+    private UserTask userTask;
23
+
24
+    @Override
25
+    @Transactional
26
+    public void start() {
27
+        StringBuffer sql = new StringBuffer("select * from itsm_itsm_solution_introduce");
28
+        List<Map<String, Object>> solutionStarList = jdbcTemplateMdv2.queryForList(sql.toString());
29
+        FieldMapper mapper = new FieldMapper();
30
+        Map<Long, Long> userIdCache = userTask.loadCache().getIdCache();
31
+        mapper.addOperationReplace("user_id", userIdCache);
32
+        mapper.trans2JdbcRow(solutionStarList);
33
+
34
+        JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
35
+        jdbcUtil.batchPageInsert("itsm_itsm_solution_introduce", mapper.getRows());
36
+    }
37
+
38
+    @Override
39
+    public FieldMapper loadCache() {
40
+        return null;
41
+    }
42
+}

+ 25 - 1
src/main/java/com/dashitech/migration/task/solution/SolutionTask.java

@@ -2,6 +2,11 @@ package com.dashitech.migration.task.solution;
2 2
 
3 3
 import com.dashitech.migration.BaseTask;
4 4
 import com.dashitech.migration.core.FieldMapper;
5
+import com.dashitech.migration.task.other.DictionaryTask;
6
+import com.dashitech.migration.task.uc.HospitalTask;
7
+import com.dashitech.migration.util.JdbcUtil;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.stereotype.Component;
5 10
 import org.springframework.transaction.annotation.Transactional;
6 11
 
7 12
 import java.util.List;
@@ -11,16 +16,35 @@ import java.util.Map;
11 16
  * @author song
12 17
  * @date 2024年10月12日
13 18
  */
19
+@Component
14 20
 public class SolutionTask extends BaseTask {
15 21
 
22
+    @Autowired
23
+    HospitalTask hospitalTask;
24
+
25
+    @Autowired
26
+    DictionaryTask dictionaryTask;
27
+
16 28
     @Override
17 29
     @Transactional
18 30
     public void start() {
19
-        StringBuffer sql = new StringBuffer("SELECT id,version,case when categoryId is null then 20342 else 20340 end as type,title,keywords,content,STATUS,");
31
+        StringBuffer sql = new StringBuffer("SELECT id,version,case when categoryId is null then 20342 else 20340 end as type,title,keywords,content,status,");
20 32
         sql.append("create_user_id,createtime as create_time,renew_user_id,renewtime as renew_time,solutionnumber as solution_number,");
21 33
         sql.append("version_number,star,categoryId as category_id,introduce_count,file_abstract,duty_dept,IF( `status` = 74, 1, 0 ) AS delete_flag FROM itsm_solution");
22 34
         List<Map<String, Object>> solutionList = jdbcTemplateMdv2.queryForList(sql.toString());
23 35
         FieldMapper mapper = new FieldMapper();
36
+        mapper.addOperationUpdate("duty_dept", "hos_id");
37
+        Map<Long, Long> hosIdCache = hospitalTask.loadCache().getIdCache();
38
+        Map<Long, Long> dicIdCache = dictionaryTask.loadCache().getIdCache();
39
+        mapper.addOperationReplace("duty_dept", hosIdCache);
40
+        mapper.addOperationReplace("status", dicIdCache);
41
+        mapper.trans2JdbcRow(solutionList);
42
+
43
+        JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
44
+        jdbcUtil.batchPageInsert("itsm_itsm_solution", mapper.getRows());
45
+
46
+        //clear释放内存
47
+        mapper.clear();
24 48
     }
25 49
 
26 50
     @Override

+ 61 - 0
src/main/java/com/dashitech/migration/task/uc/DepartmentTask.java

@@ -0,0 +1,61 @@
1
+package com.dashitech.migration.task.uc;
2
+
3
+import com.dashitech.migration.BaseTask;
4
+import com.dashitech.migration.core.DataMigrationter;
5
+import com.dashitech.migration.core.FieldMapper;
6
+import com.dashitech.migration.core.RowsWrap;
7
+import com.dashitech.migration.util.JdbcUtil;
8
+import org.apache.commons.logging.Log;
9
+import org.apache.commons.logging.LogFactory;
10
+import org.springframework.stereotype.Component;
11
+import org.springframework.transaction.annotation.Transactional;
12
+
13
+import java.util.List;
14
+import java.util.Map;
15
+
16
+/**
17
+ * @author song
18
+ * @date 2024年10月12日
19
+ */
20
+@Component
21
+public class DepartmentTask extends BaseTask {
22
+
23
+    public static Log log = LogFactory.getLog(DepartmentTask.class);
24
+
25
+    @Override
26
+    @Transactional
27
+    public void start() {
28
+        StringBuffer sql = new StringBuffer("SELECT dept,CODE,parentId,email,delete_flag,address as _address,place_id as floor_id,area_id as building_id,pinyin,");
29
+        sql.append("branch_id as _hospital_id,dept_alias,input_code,phone as many_phone,qrcode,1 as flag,IF(phone is not null,SUBSTRING_INDEX(phone,',',1),null) as _phone ");
30
+        sql.append(" FROM itsm_uc_dept where id in (select distinct b.id from itsm_incident a join itsm_uc_dept b on a.dept = b.id where a.dept > 1204)");
31
+        List<Map<String, Object>> deptList = jdbcTemplateMdv2.queryForList(sql.toString());
32
+
33
+        FieldMapper mapper = new FieldMapper();
34
+        mapper.addOperationAdd("_type", getDicId(jdbcTemplateHsms, "dept_type", "other"));
35
+        mapper.trans2JdbcRow(deptList);
36
+
37
+        FieldMapper deptMapper = this.loadCache();
38
+        RowsWrap rw = DataMigrationter.getRowsWrap(mapper,deptMapper);
39
+        JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
40
+        //科室只做更新 已有的科室不做处理
41
+        jdbcUtil.batchPageInsert("itsm_uc_dept", rw.getInsertRows());
42
+
43
+        mapper.clear();
44
+        deptMapper.clear();
45
+    }
46
+
47
+    @Override
48
+    public FieldMapper loadCache() {
49
+        log.info(" *** 加载科室缓存 *** ");
50
+        StringBuffer sql = new StringBuffer("select id,dept from itsm_uc_dept");
51
+        List<Map<String, Object>> hsmsDeptList = jdbcTemplateHsms.queryForList(sql.toString());
52
+        List<Map<String, Object>> itsmDeptList = jdbcTemplateMdv2.queryForList(sql.toString());
53
+
54
+        FieldMapper mapper = new FieldMapper();
55
+        mapper.addFieldMapper("dept", "dept");
56
+
57
+        DataMigrationter.loadCache(hsmsDeptList, itsmDeptList, mapper);
58
+
59
+        return mapper;
60
+    }
61
+}

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

@@ -24,6 +24,9 @@ public class UserTask extends BaseTask {
24 24
     @Autowired
25 25
     SqlTask hospitalTask;
26 26
 
27
+    @Autowired
28
+    SqlTask departmentTask;
29
+
27 30
     public static Log log = LogFactory.getLog(UserTask.class);
28 31
 
29 32
     @Override
@@ -44,6 +47,9 @@ public class UserTask extends BaseTask {
44 47
         mapper.addOperationAdd("usertype", getDicId(jdbcTemplateHsms,"usertype","4")); //用户类型-默认三方人员
45 48
         mapper.addOperationReplace("hospital_id", hospitalTask.loadCache().getIdCache());
46 49
         mapper.addOperationReplace("duty_dept", hospitalTask.loadCache().getIdCache());
50
+        if ("xiangyang".equals(appName)) {
51
+            mapper.addOperationReplace("DEPTID", departmentTask.loadCache().getIdCache());
52
+        }
47 53
         mapper.trans2JdbcRow(list);
48 54
 
49 55
         FieldMapper userMapper = loadCache();

+ 3 - 1
src/main/java/com/dashitech/migration/task/uc/XyGroupTask.java

@@ -7,6 +7,7 @@ import org.apache.commons.logging.Log;
7 7
 import org.apache.commons.logging.LogFactory;
8 8
 import org.springframework.beans.factory.annotation.Autowired;
9 9
 import org.springframework.stereotype.Component;
10
+import org.springframework.transaction.annotation.Transactional;
10 11
 
11 12
 import java.util.List;
12 13
 import java.util.Map;
@@ -25,6 +26,7 @@ public class XyGroupTask extends BaseTask {
25 26
 
26 27
 
27 28
     @Override
29
+    @Transactional
28 30
     public void start() {
29 31
         log.info(" *** 襄阳工作组group转换开始 *** ");
30 32
 
@@ -43,7 +45,7 @@ public class XyGroupTask extends BaseTask {
43 45
         mapper.trans2JdbcRow(groupList);
44 46
 
45 47
         JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
46
-        //jdbcUtil.batchPageInsert("itsm_uc_groups", mapper.getRows());
48
+        jdbcUtil.batchPageInsert("itsm_uc_groups", mapper.getRows());
47 49
 
48 50
         //clear释放内存
49 51
         mapper.clear();

+ 43 - 0
src/main/java/com/dashitech/migration/task/workhour/WorkHourManagementTask.java

@@ -0,0 +1,43 @@
1
+package com.dashitech.migration.task.workhour;
2
+
3
+import com.dashitech.migration.BaseTask;
4
+import com.dashitech.migration.core.FieldMapper;
5
+import com.dashitech.migration.task.uc.HospitalTask;
6
+import com.dashitech.migration.util.JdbcUtil;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.stereotype.Component;
9
+
10
+import java.util.List;
11
+import java.util.Map;
12
+
13
+/**
14
+ * @author song
15
+ * @date 2024年10月12日
16
+ */
17
+@Component
18
+public class WorkHourManagementTask extends BaseTask {
19
+
20
+    @Autowired
21
+    private HospitalTask hospitalTask;
22
+
23
+    @Override
24
+    public void start() {
25
+        StringBuffer sql = new StringBuffer("SELECT id,version,work_unit,work_name,tree_level,parent,wage,");
26
+        sql.append("work_hour_num as work_hour,duty as hos_id,delete_flag FROM itsm_work_hour_management ");
27
+        List<Map<String, Object>> workHourList = jdbcTemplateMdv2.queryForList(sql.toString());
28
+
29
+        FieldMapper mapper = new FieldMapper();
30
+        mapper.addOperationReplace("hos_id", hospitalTask.loadCache().getIdCache());
31
+        mapper.trans2JdbcRow(workHourList);
32
+
33
+        JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
34
+        jdbcUtil.batchPageInsert("itsm_itsm_work_hour_management", mapper.getRows());
35
+
36
+        mapper.clear();
37
+    }
38
+
39
+    @Override
40
+    public FieldMapper loadCache() {
41
+        return null;
42
+    }
43
+}