song 5 月之前
父节点
当前提交
48bb6ab044

+ 14 - 22
src/main/java/com/dashitech/migration/StartApplication.java

@@ -5,12 +5,8 @@ import org.apache.commons.logging.Log;
5
 import org.apache.commons.logging.LogFactory;
5
 import org.apache.commons.logging.LogFactory;
6
 import org.springframework.beans.factory.annotation.Autowired;
6
 import org.springframework.beans.factory.annotation.Autowired;
7
 import org.springframework.beans.factory.annotation.Value;
7
 import org.springframework.beans.factory.annotation.Value;
8
-import org.springframework.context.ApplicationContext;
9
 import org.springframework.stereotype.Service;
8
 import org.springframework.stereotype.Service;
10
 
9
 
11
-import java.util.List;
12
-import java.util.Map;
13
-
14
 /**
10
 /**
15
  * 迁移数据启动类
11
  * 迁移数据启动类
16
  * Created by CX on 2024/10/10.
12
  * Created by CX on 2024/10/10.
@@ -29,15 +25,17 @@ public class StartApplication {
29
     public void start() {
25
     public void start() {
30
         log.info("########### 开始迁移任务!###########");
26
         log.info("########### 开始迁移任务!###########");
31
         SqlTask task = null;
27
         SqlTask task = null;
32
-        task = SpringContextHolder.getBean("dictionaryTask");
33
-        task.start();
34
-//        task = SpringContextHolder.getBean("attachmentTask");
35
-//        task.start();
36
-        task = SpringContextHolder.getBean("hospitalTask");
37
-        task.start();
38
-//        task = SpringContextHolder.getBean("hospitalConfigTask");
39
-//        task.start();
40
-        task = SpringContextHolder.getBean("groupTask");
28
+        //task = SpringContextHolder.getBean("dictionaryTask");
29
+        //task.start();
30
+        //task = SpringContextHolder.getBean("attachmentTask");
31
+        //task.start();
32
+        //task = SpringContextHolder.getBean("tokenTask");
33
+        //task.start();
34
+        //task = SpringContextHolder.getBean("hospitalTask");
35
+        //task.start();
36
+        task = SpringContextHolder.getBean("hospitalConfigTask");
37
+        task.start();
38
+        /*task = SpringContextHolder.getBean("groupTask");
41
         task.start();
39
         task.start();
42
         task = SpringContextHolder.getBean("departmentTask");
40
         task = SpringContextHolder.getBean("departmentTask");
43
         task.start();
41
         task.start();
@@ -53,8 +51,8 @@ public class StartApplication {
53
         task.start();
51
         task.start();
54
         task = SpringContextHolder.getBean("incidentCategoryConfigTask");
52
         task = SpringContextHolder.getBean("incidentCategoryConfigTask");
55
         task.start();
53
         task.start();
56
-//        task = SpringContextHolder.getBean("incidentTask");
57
-//        task.start();
54
+        task = SpringContextHolder.getBean("incidentTask");
55
+        task.start();
58
         task = SpringContextHolder.getBean("workHourManagementTask");
56
         task = SpringContextHolder.getBean("workHourManagementTask");
59
         task.start();
57
         task.start();
60
         task = SpringContextHolder.getBean("solutionTask");
58
         task = SpringContextHolder.getBean("solutionTask");
@@ -72,17 +70,11 @@ public class StartApplication {
72
         task = SpringContextHolder.getBean("callLogTask");
70
         task = SpringContextHolder.getBean("callLogTask");
73
         task.start();
71
         task.start();
74
         task = SpringContextHolder.getBean("hjzxRecordTask");
72
         task = SpringContextHolder.getBean("hjzxRecordTask");
75
-        task.start();
76
-
73
+        task.start();*/
77
 
74
 
78
 
75
 
79
-//        test();
80
-
81
         log.info("########### 迁移任务完成!###########");
76
         log.info("########### 迁移任务完成!###########");
82
     }
77
     }
83
 
78
 
84
-    public void startOrder() {
85
-        hospitalTask.start();
86
-    }
87
 
79
 
88
 }
80
 }

+ 11 - 0
src/main/java/com/dashitech/migration/task/other/AttachmentTask.java

@@ -2,11 +2,15 @@ package com.dashitech.migration.task.other;
2
 
2
 
3
 import com.dashitech.migration.BaseTask;
3
 import com.dashitech.migration.BaseTask;
4
 import com.dashitech.migration.core.FieldMapper;
4
 import com.dashitech.migration.core.FieldMapper;
5
+import com.dashitech.migration.util.JdbcUtil;
5
 import org.apache.commons.logging.Log;
6
 import org.apache.commons.logging.Log;
6
 import org.apache.commons.logging.LogFactory;
7
 import org.apache.commons.logging.LogFactory;
7
 import org.springframework.stereotype.Component;
8
 import org.springframework.stereotype.Component;
8
 import org.springframework.transaction.annotation.Transactional;
9
 import org.springframework.transaction.annotation.Transactional;
9
 
10
 
11
+import java.util.List;
12
+import java.util.Map;
13
+
10
 /**
14
 /**
11
  * Created by CX on 2024/10/10.
15
  * Created by CX on 2024/10/10.
12
  */
16
  */
@@ -19,8 +23,15 @@ public class AttachmentTask extends BaseTask {
19
     @Transactional(rollbackFor = Exception.class)
23
     @Transactional(rollbackFor = Exception.class)
20
     public void start() {
24
     public void start() {
21
         log.info(" *** AttachmentTask start开始 *** ");
25
         log.info(" *** AttachmentTask start开始 *** ");
26
+        StringBuffer sql = new StringBuffer("select * from itsm_base_attachment");
27
+        List<Map<String, Object>> attachmentList = jdbcTemplateMdv2.queryForList(sql.toString());
28
+
22
         FieldMapper mapper = new FieldMapper();
29
         FieldMapper mapper = new FieldMapper();
30
+        mapper.addOperationRemove("id");
31
+        mapper.trans2JdbcRow(attachmentList);
23
 
32
 
33
+        JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
34
+        jdbcUtil.batchPageInsert("itsm_base_attachment", mapper.getRows());
24
         //clear释放内存
35
         //clear释放内存
25
         mapper.clear();
36
         mapper.clear();
26
     }
37
     }

+ 50 - 0
src/main/java/com/dashitech/migration/task/other/TokenTask.java

@@ -0,0 +1,50 @@
1
+package com.dashitech.migration.task.other;
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
+ * Created by CX on 2024/10/10.
16
+ */
17
+@Component
18
+public class TokenTask extends BaseTask {
19
+
20
+    public static Log log = LogFactory.getLog(TokenTask.class);
21
+
22
+    @Override
23
+    @Transactional(rollbackFor = Exception.class)
24
+    public void start() {
25
+        log.info(" *** TokenTask start开始 *** ");
26
+        StringBuffer sql = new StringBuffer("select * from itsm_base_token");
27
+        List<Map<String, Object>> tokenList = jdbcTemplateMdv2.queryForList(sql.toString());
28
+
29
+        FieldMapper mapper = new FieldMapper();
30
+        mapper.addOperationRemove("id");
31
+        mapper.trans2JdbcRow(tokenList);
32
+
33
+        JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
34
+        jdbcUtil.batchPageInsert("itsm_base_token", mapper.getRows());
35
+
36
+        //clear释放内存
37
+        mapper.clear();
38
+    }
39
+
40
+    @Override
41
+    public FieldMapper loadCache() {
42
+        log.info(" *** AttachmentTask loadCache开始 *** ");
43
+        FieldMapper mapper = new FieldMapper();
44
+
45
+
46
+        return mapper;
47
+    }
48
+
49
+
50
+}

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

@@ -30,7 +30,7 @@ public class SolutionIntroduceTask extends BaseTask {
30
     public void start() {
30
     public void start() {
31
         log.info("知识库引用数据SolutionIntroduceTask转换开始");
31
         log.info("知识库引用数据SolutionIntroduceTask转换开始");
32
 
32
 
33
-        StringBuffer sql = new StringBuffer("select * from itsm_itsm_solution_introduce");
33
+        StringBuffer sql = new StringBuffer("select * from itsm_solution_introduce");
34
         List<Map<String, Object>> solutionStarList = jdbcTemplateMdv2.queryForList(sql.toString());
34
         List<Map<String, Object>> solutionStarList = jdbcTemplateMdv2.queryForList(sql.toString());
35
         FieldMapper mapper = new FieldMapper();
35
         FieldMapper mapper = new FieldMapper();
36
         Map<Long, Long> userIdCache = userTask.loadCache().getIdCache();
36
         Map<Long, Long> userIdCache = userTask.loadCache().getIdCache();

+ 0 - 2
src/main/java/com/dashitech/migration/task/uc/CompanyTask.java

@@ -8,7 +8,6 @@ import com.dashitech.migration.util.JdbcUtil;
8
 import org.apache.commons.logging.Log;
8
 import org.apache.commons.logging.Log;
9
 import org.apache.commons.logging.LogFactory;
9
 import org.apache.commons.logging.LogFactory;
10
 import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.beans.factory.annotation.Autowired;
11
-import org.springframework.core.annotation.Order;
12
 import org.springframework.stereotype.Component;
11
 import org.springframework.stereotype.Component;
13
 import org.springframework.transaction.annotation.Transactional;
12
 import org.springframework.transaction.annotation.Transactional;
14
 
13
 
@@ -19,7 +18,6 @@ import java.util.Map;
19
  * Created by CX on 2024/10/10.
18
  * Created by CX on 2024/10/10.
20
  */
19
  */
21
 @Component
20
 @Component
22
-@Order(3)
23
 public class CompanyTask extends BaseTask {
21
 public class CompanyTask extends BaseTask {
24
 
22
 
25
     public static Log log = LogFactory.getLog(CompanyTask.class);
23
     public static Log log = LogFactory.getLog(CompanyTask.class);

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

@@ -7,7 +7,6 @@ import com.dashitech.migration.core.RowsWrap;
7
 import com.dashitech.migration.util.JdbcUtil;
7
 import com.dashitech.migration.util.JdbcUtil;
8
 import org.apache.commons.logging.Log;
8
 import org.apache.commons.logging.Log;
9
 import org.apache.commons.logging.LogFactory;
9
 import org.apache.commons.logging.LogFactory;
10
-import org.springframework.core.annotation.Order;
11
 import org.springframework.stereotype.Component;
10
 import org.springframework.stereotype.Component;
12
 import org.springframework.transaction.annotation.Transactional;
11
 import org.springframework.transaction.annotation.Transactional;
13
 
12
 
@@ -19,7 +18,6 @@ import java.util.Map;
19
  * @date 2024年10月12日
18
  * @date 2024年10月12日
20
  */
19
  */
21
 @Component
20
 @Component
22
-@Order(3)
23
 public class DepartmentTask extends BaseTask {
21
 public class DepartmentTask extends BaseTask {
24
 
22
 
25
     public static Log log = LogFactory.getLog(DepartmentTask.class);
23
     public static Log log = LogFactory.getLog(DepartmentTask.class);

+ 0 - 2
src/main/java/com/dashitech/migration/task/uc/GroupTask.java

@@ -8,7 +8,6 @@ import com.dashitech.migration.util.JdbcUtil;
8
 import org.apache.commons.logging.Log;
8
 import org.apache.commons.logging.Log;
9
 import org.apache.commons.logging.LogFactory;
9
 import org.apache.commons.logging.LogFactory;
10
 import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.beans.factory.annotation.Autowired;
11
-import org.springframework.core.annotation.Order;
12
 import org.springframework.stereotype.Component;
11
 import org.springframework.stereotype.Component;
13
 import org.springframework.transaction.annotation.Transactional;
12
 import org.springframework.transaction.annotation.Transactional;
14
 
13
 
@@ -19,7 +18,6 @@ import java.util.Map;
19
  * Created by CX on 2024/10/10.
18
  * Created by CX on 2024/10/10.
20
  */
19
  */
21
 @Component
20
 @Component
22
-@Order(2)
23
 public class GroupTask extends BaseTask {
21
 public class GroupTask extends BaseTask {
24
 
22
 
25
     public static Log log = LogFactory.getLog(GroupTask.class);
23
     public static Log log = LogFactory.getLog(GroupTask.class);

+ 11 - 4
src/main/java/com/dashitech/migration/task/uc/HospitalConfigTask.java

@@ -1,24 +1,21 @@
1
 package com.dashitech.migration.task.uc;
1
 package com.dashitech.migration.task.uc;
2
 
2
 
3
 import com.dashitech.migration.BaseTask;
3
 import com.dashitech.migration.BaseTask;
4
-import com.dashitech.migration.core.DataMigrationter;
5
 import com.dashitech.migration.core.FieldMapper;
4
 import com.dashitech.migration.core.FieldMapper;
6
 import com.dashitech.migration.util.JdbcUtil;
5
 import com.dashitech.migration.util.JdbcUtil;
7
 import org.apache.commons.logging.Log;
6
 import org.apache.commons.logging.Log;
8
 import org.apache.commons.logging.LogFactory;
7
 import org.apache.commons.logging.LogFactory;
9
-import org.springframework.core.annotation.Order;
10
 import org.springframework.stereotype.Component;
8
 import org.springframework.stereotype.Component;
11
 import org.springframework.transaction.annotation.Transactional;
9
 import org.springframework.transaction.annotation.Transactional;
12
 
10
 
13
-import java.util.HashMap;
14
 import java.util.List;
11
 import java.util.List;
15
 import java.util.Map;
12
 import java.util.Map;
16
 
13
 
17
 /**
14
 /**
15
+ * 必须在HospitalTask转后执行
18
  * Created by CX on 2024/10/10.
16
  * Created by CX on 2024/10/10.
19
  */
17
  */
20
 @Component
18
 @Component
21
-@Order(1)
22
 public class HospitalConfigTask extends BaseTask {
19
 public class HospitalConfigTask extends BaseTask {
23
 
20
 
24
     public static Log log = LogFactory.getLog(HospitalConfigTask.class);
21
     public static Log log = LogFactory.getLog(HospitalConfigTask.class);
@@ -27,7 +24,17 @@ public class HospitalConfigTask extends BaseTask {
27
     @Transactional(rollbackFor = Exception.class)
24
     @Transactional(rollbackFor = Exception.class)
28
     public void start() {
25
     public void start() {
29
         log.info(" *** HospitalConfigTask start开始 *** ");
26
         log.info(" *** HospitalConfigTask start开始 *** ");
27
+        //查询维修科室 院区和院区配置def表笛卡尔积数据
28
+        StringBuffer sql = new StringBuffer("SELECT 0 AS version,b._key,b._value,b._value2,b._value3,");
29
+        sql.append("b._value4,b._desc,b._orders,b._active,b.id AS def_id,a.id AS hos_id, b.model as model");
30
+        sql.append(" FROM itsm_uc_hospital a JOIN itsm_system_hospital_config_def b where a.delete_flag = 0 ");
31
+        sql.append(" and a.type = (select id from itsm_base_dictionary where _key = 'hospital_type' and _value = '6') ");
32
+        List<Map<String, Object>> hosConfigList = jdbcTemplateHsms.queryForList(sql.toString());
30
         FieldMapper mapper = new FieldMapper();
33
         FieldMapper mapper = new FieldMapper();
34
+        mapper.trans2JdbcRow(hosConfigList);
35
+
36
+        JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
37
+        jdbcUtil.batchPageInsert("itsm_system_hospital_config", mapper.getRows());
31
 
38
 
32
         //clear释放内存
39
         //clear释放内存
33
         mapper.clear();
40
         mapper.clear();

+ 0 - 2
src/main/java/com/dashitech/migration/task/uc/HospitalTask.java

@@ -6,7 +6,6 @@ import com.dashitech.migration.core.FieldMapper;
6
 import com.dashitech.migration.util.JdbcUtil;
6
 import com.dashitech.migration.util.JdbcUtil;
7
 import org.apache.commons.logging.Log;
7
 import org.apache.commons.logging.Log;
8
 import org.apache.commons.logging.LogFactory;
8
 import org.apache.commons.logging.LogFactory;
9
-import org.springframework.core.annotation.Order;
10
 import org.springframework.stereotype.Component;
9
 import org.springframework.stereotype.Component;
11
 import org.springframework.transaction.annotation.Transactional;
10
 import org.springframework.transaction.annotation.Transactional;
12
 
11
 
@@ -18,7 +17,6 @@ import java.util.Map;
18
  * Created by CX on 2024/10/10.
17
  * Created by CX on 2024/10/10.
19
  */
18
  */
20
 @Component
19
 @Component
21
-@Order(1)
22
 public class HospitalTask extends BaseTask {
20
 public class HospitalTask extends BaseTask {
23
 
21
 
24
     public static Log log = LogFactory.getLog(HospitalTask.class);
22
     public static Log log = LogFactory.getLog(HospitalTask.class);

+ 0 - 2
src/main/java/com/dashitech/migration/task/uc/RoleUserTask.java

@@ -7,7 +7,6 @@ import com.dashitech.migration.util.JdbcUtil;
7
 import org.apache.commons.logging.Log;
7
 import org.apache.commons.logging.Log;
8
 import org.apache.commons.logging.LogFactory;
8
 import org.apache.commons.logging.LogFactory;
9
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.beans.factory.annotation.Autowired;
10
-import org.springframework.core.annotation.Order;
11
 import org.springframework.stereotype.Component;
10
 import org.springframework.stereotype.Component;
12
 import org.springframework.transaction.annotation.Transactional;
11
 import org.springframework.transaction.annotation.Transactional;
13
 
12
 
@@ -17,7 +16,6 @@ import java.util.List;
17
  * Created by CX on 2024/10/10.
16
  * Created by CX on 2024/10/10.
18
  */
17
  */
19
 @Component
18
 @Component
20
-@Order(6)
21
 public class RoleUserTask extends BaseTask {
19
 public class RoleUserTask extends BaseTask {
22
 
20
 
23
     public static Log log = LogFactory.getLog(RoleUserTask.class);
21
     public static Log log = LogFactory.getLog(RoleUserTask.class);

+ 0 - 2
src/main/java/com/dashitech/migration/task/uc/UserGroupTask.java

@@ -7,7 +7,6 @@ import com.dashitech.migration.util.JdbcUtil;
7
 import org.apache.commons.logging.Log;
7
 import org.apache.commons.logging.Log;
8
 import org.apache.commons.logging.LogFactory;
8
 import org.apache.commons.logging.LogFactory;
9
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.beans.factory.annotation.Autowired;
10
-import org.springframework.core.annotation.Order;
11
 import org.springframework.stereotype.Component;
10
 import org.springframework.stereotype.Component;
12
 import org.springframework.transaction.annotation.Transactional;
11
 import org.springframework.transaction.annotation.Transactional;
13
 
12
 
@@ -17,7 +16,6 @@ import java.util.List;
17
  * Created by CX on 2024/10/10.
16
  * Created by CX on 2024/10/10.
18
  */
17
  */
19
 @Component
18
 @Component
20
-@Order(5)
21
 public class UserGroupTask extends BaseTask {
19
 public class UserGroupTask extends BaseTask {
22
 
20
 
23
     @Autowired
21
     @Autowired

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

@@ -9,7 +9,6 @@ import com.dashitech.migration.util.JdbcUtil;
9
 import org.apache.commons.logging.Log;
9
 import org.apache.commons.logging.Log;
10
 import org.apache.commons.logging.LogFactory;
10
 import org.apache.commons.logging.LogFactory;
11
 import org.springframework.beans.factory.annotation.Autowired;
11
 import org.springframework.beans.factory.annotation.Autowired;
12
-import org.springframework.core.annotation.Order;
13
 import org.springframework.stereotype.Component;
12
 import org.springframework.stereotype.Component;
14
 import org.springframework.transaction.annotation.Transactional;
13
 import org.springframework.transaction.annotation.Transactional;
15
 
14
 
@@ -20,7 +19,6 @@ import java.util.Map;
20
  * Created by CX on 2024/10/10.
19
  * Created by CX on 2024/10/10.
21
  */
20
  */
22
 @Component
21
 @Component
23
-@Order(4)
24
 public class UserTask extends BaseTask {
22
 public class UserTask extends BaseTask {
25
 
23
 
26
     @Autowired
24
     @Autowired