CX 8 ay önce
ebeveyn
işleme
c1e1880ff6

+ 3 - 2
src/main/java/com/dashitech/migration/StartApplication.java

@@ -1,5 +1,6 @@
1 1
 package com.dashitech.migration;
2 2
 
3
+import com.dashitech.migration.core.FieldMapper;
3 4
 import com.dashitech.utils.SpringContextHolder;
4 5
 import org.apache.commons.logging.Log;
5 6
 import org.apache.commons.logging.LogFactory;
@@ -37,8 +38,8 @@ public class StartApplication {
37 38
 //        task.start();
38 39
 //        task = SpringContextHolder.getBean("companyTask");
39 40
 //        task.start();
40
-        task = SpringContextHolder.getBean("userTask");
41
-        task.start();
41
+//        task = SpringContextHolder.getBean("userTask");
42
+//        task.start();
42 43
 //        task = SpringContextHolder.getBean("userGroupTask");
43 44
 //        task.start();
44 45
 //        task = SpringContextHolder.getBean("roleUserTask");

+ 8 - 0
src/main/java/com/dashitech/migration/task/incident/IncidentLogTask.java

@@ -50,11 +50,19 @@ public class IncidentLogTask extends BaseTask {
50 50
         mapper.addOperationReplace("worker_id", userCache);
51 51
         mapper.addOperationReplace("group_id", groupTask.loadCache().getIdCache());
52 52
         mapper.addOperationReplace("duty_id", hospitalTask.loadCache().getIdCache());
53
+        mapper.addOperationReplace("extra1", dictionaryTask.loadCache().getIdCache());
53 54
         mapper.trans2JdbcRow(list);
54 55
 
55 56
         JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
56 57
         jdbcUtil.batchPageInsert("itsm_itsm_incident_log", mapper.getRows());
57 58
 
59
+        //补空操作类型数据
60
+        String sql = " UPDATE itsm_itsm_incident_log SET log_type = (SELECT id from itsm_base_dictionary WHERE _key = 'incident_log_type' and _value = 'edit' ) WHERE log_type is null ";
61
+        jdbcTemplateHsms.execute(sql);
62
+        //补超时颜色
63
+        sql = " UPDATE itsm_itsm_rule_colour SET colourInfo = (SELECT id from itsm_base_dictionary WHERE _key = 'incident_colourinfo' and _value = '#FADB14' ) WHERE colourInfo is null ";
64
+        jdbcTemplateHsms.execute(sql);
65
+
58 66
         //clear释放内存
59 67
         mapper.clear();
60 68
     }

+ 1 - 0
src/main/java/com/dashitech/migration/task/incident/IncidentTask.java

@@ -65,6 +65,7 @@ public class IncidentTask extends BaseTask {
65 65
         mapper.addOperationReplace("sourceid", dicCache);
66 66
         mapper.addOperationReplace("statusid", dicCache);
67 67
         mapper.addOperationReplace("handleresult", dicCache);
68
+        mapper.addOperationReplace("handlecategory", dicCache);
68 69
         mapper.addOperationReplace("wxdegreeid", dicCache);
69 70
         mapper.addOperationReplace("requesterid", userCache);
70 71
         mapper.addOperationReplace("handleruserid", userCache);

+ 109 - 165
src/main/java/com/dashitech/migration/task/other/DictionaryTask.java

@@ -19,6 +19,9 @@ import java.util.Map;
19 19
 public class DictionaryTask extends BaseTask {
20 20
 
21 21
     public static Log log = LogFactory.getLog(DictionaryTask.class);
22
+
23
+    private static Map<Long, Long> idCache = new HashMap<>();
24
+
22 25
     @Override
23 26
     @Transactional(rollbackFor = Exception.class)
24 27
     public void start() {
@@ -28,150 +31,62 @@ public class DictionaryTask extends BaseTask {
28 31
     @Override
29 32
     public FieldMapper loadCache() {
30 33
         FieldMapper mapper = null;
31
-        if ("xiangyang".equals(appName)) {
32
-            mapper = loadXiangYangCache();
33
-        } else {
34
-            mapper = loadNanJingCache();
34
+
35
+        if(idCache.isEmpty()) {
36
+            mapper = loadCache2();
37
+        }else {
38
+            mapper = new FieldMapper();
39
+            mapper.setIdCache(idCache);
35 40
         }
41
+
36 42
         return mapper;
37 43
     }
38 44
 
39 45
 
40
-    private FieldMapper loadXiangYangCache() {
41
-        log.info(" *** 加载襄阳字典缓存 *** ");
42
-        FieldMapper mapper = new FieldMapper();
43
-        Map<Long, Long> idCache = new HashMap<>();
44
-        mapper.setIdCache(idCache);
45
-        //知识库
46
-        idCache.put(71L, 20404L); //待审核
47
-        idCache.put(72L, 20405L); //已发布
48
-        idCache.put(73L, 20406L); //待整改
49
-        idCache.put(74L, 20407L); //已停用
50
-        //耗材消耗
51
-        idCache.put(1735L, 20557L);//消耗
52
-        idCache.put(1736L, 20558L);//撤销
53
-        //公司分类
54
-        idCache.put(1709L,20240L);
55
-        idCache.put(1710L,20241L);
56
-        //性别
57
-        idCache.put(1609L,279L);
58
-        idCache.put(1610L,280L);
59
-
60
-        //事件-关闭代码
61
-        idCache.put(1572L,20501L);
62
-        idCache.put(1573L,20502L);
63
-        idCache.put(1575L,20503L);
64
-        idCache.put(1574L,20504L);
65
-        idCache.put(1576L,20504L);
66
-        idCache.put(1577L,20504L);
67
-
68
-        //事件-满意度
69
-        idCache.put(1578L,20496L);
70
-        idCache.put(1579L,20497L);
71
-        idCache.put(1580L,20498L);
72
-        idCache.put(1581L,20499L);
73
-        idCache.put(1582L,20500L);
74
-
75
-        //事件-优先级
76
-        idCache.put(1560L,5L);
77
-        idCache.put(1561L,4L);
78
-        idCache.put(1562L,3L);
79
-        idCache.put(1563L,2L);
80
-        idCache.put(1704L,1L);
81
-
82
-        //事件-incident_source
83
-        idCache.put(1547L,20484L);
84
-        idCache.put(1548L,20485L);
85
-        idCache.put(1549L,20486L);
86
-        idCache.put(1550L,20488L);
87
-        idCache.put(1551L,20487L);
88
-        idCache.put(1552L,20488L);
89
-        idCache.put(1700L,20488L);
90
-        idCache.put(1747L,20488L);
91
-
92
-        //事件-incident_status
93
-        idCache.put(1479L,20505L);
94
-        idCache.put(1543L,20506L);
95
-        idCache.put(1544L,20507L);
96
-        idCache.put(1545L,20508L);
97
-        idCache.put(1546L,20508L);
98
-        idCache.put(1674L,20509L);
99
-        idCache.put(1748L,20510L);
100
-        idCache.put(1749L,20511L);
101
-        idCache.put(1750L,20512L);
102
-
103
-        //事件-incident_handleresult
104
-        idCache.put(1568L,20483L);
105
-        idCache.put(1569L,20483L);
106
-        idCache.put(1570L,20483L);
107
-        idCache.put(1571L,20483L);
108
-
109
-        //事件-wxincident_degree
110
-        idCache.put(1598L,20496L);
111
-        idCache.put(1599L,20497L);
112
-        idCache.put(1600L,20498L);
113
-        idCache.put(1601L,20499L);
114
-        idCache.put(1602L,20500L);
115
-
116
-        //事件日志-incident_log_type
117
-        idCache.put(1736L,20517L);
118
-        idCache.put(1737L,20518L);
119
-        idCache.put(1738L,20519L);
120
-        idCache.put(1739L,20520L);
121
-        idCache.put(1740L,20521L);
122
-        idCache.put(1741L,20522L);
123
-        idCache.put(1742L,20523L);
124
-        idCache.put(1743L,20524L);
125
-        idCache.put(1744L,20525L);
126
-        idCache.put(1745L,20526L);
127
-        idCache.put(1751L,20527L);
128
-        idCache.put(1752L,20528L);
129
-        idCache.put(1753L,20529L);
130
-        idCache.put(1754L,20530L);
131
-        idCache.put(1755L,20531L);
132
-        idCache.put(1766L,20532L);
133
-
134
-        return mapper;
135
-    }
136 46
 
137
-    private FieldMapper loadNanJingCache() {
138
-        log.info(" *** 加载南京字典缓存 *** ");
47
+    private FieldMapper loadCache2() {
48
+        log.info(" *** 加载DictionaryTask字典缓存 *** ");
139 49
         FieldMapper mapper = new FieldMapper();
140 50
         Map<Long, Long> idCache = new HashMap<>();
141 51
         mapper.setIdCache(idCache);
142 52
 
143 53
         //知识库
144
-        idCache.put(71L, 20328L); //待审核
145
-        idCache.put(72L, 20329L); //已发布
146
-        idCache.put(73L, 20330L); //待整改
147
-        idCache.put(74L, 20331L); //已停用
54
+        idCache.put(71L, getDicId(jdbcTemplateHsms,"solution_status","2")); //待审核
55
+        idCache.put(72L, getDicId(jdbcTemplateHsms,"solution_status","3")); //已发布
56
+        idCache.put(73L, getDicId(jdbcTemplateHsms,"solution_status","4")); //待整改
57
+        idCache.put(74L, getDicId(jdbcTemplateHsms,"solution_status","5")); //已停用
148 58
 
149 59
         //耗材消耗
150
-        idCache.put(1732L, 20475L);//消耗
151
-        idCache.put(1733L, 20476L);//撤销
60
+        if ("xiangyang".equals(appName)) {
61
+            idCache.put(1735L, getDicId(jdbcTemplateHsms,"consumables_consume_type","1"));//消耗
62
+            idCache.put(1736L, getDicId(jdbcTemplateHsms,"consumables_consume_type","2"));//撤销
63
+        }else {
64
+            idCache.put(1732L, getDicId(jdbcTemplateHsms,"consumables_consume_type","1"));//消耗
65
+            idCache.put(1733L, getDicId(jdbcTemplateHsms,"consumables_consume_type","2"));//撤销
66
+        }
152 67
 
153 68
         //公司分类
154
-        idCache.put(1709L,20309L);
155
-        idCache.put(1710L,20311L);
69
+        idCache.put(1709L,getDicId(jdbcTemplateHsms,"company_type","1"));
70
+        idCache.put(1710L,getDicId(jdbcTemplateHsms,"company_type","3"));
156 71
 
157 72
         //性别
158
-        idCache.put(1609L,279L);
159
-        idCache.put(1610L,280L);
73
+        idCache.put(1609L,getDicId(jdbcTemplateHsms,"user_gender","0"));
74
+        idCache.put(1610L,getDicId(jdbcTemplateHsms,"user_gender","1"));
160 75
 
161 76
         //事件-关闭代码
162
-        idCache.put(1572L,20419L);
163
-        idCache.put(1573L,20420L);
164
-        idCache.put(1575L,20421L);
165
-        idCache.put(1574L,20422L);
166
-        idCache.put(1576L,20422L);
167
-        idCache.put(1577L,20422L);
77
+        idCache.put(1572L,getDicId(jdbcTemplateHsms,"incident_closecode","1"));
78
+        idCache.put(1573L,getDicId(jdbcTemplateHsms,"incident_closecode","2"));
79
+        idCache.put(1575L,getDicId(jdbcTemplateHsms,"incident_closecode","3"));
80
+        idCache.put(1574L,getDicId(jdbcTemplateHsms,"incident_closecode","4"));
81
+        idCache.put(1576L,getDicId(jdbcTemplateHsms,"incident_closecode","4"));
82
+        idCache.put(1577L,getDicId(jdbcTemplateHsms,"incident_closecode","4"));
168 83
 
169 84
         //事件-满意度
170
-        idCache.put(1578L,20414L);
171
-        idCache.put(1579L,20415L);
172
-        idCache.put(1580L,20416L);
173
-        idCache.put(1581L,20417L);
174
-        idCache.put(1582L,20418L);
85
+        idCache.put(1578L,getDicId(jdbcTemplateHsms,"incident_degree","5"));
86
+        idCache.put(1579L,getDicId(jdbcTemplateHsms,"incident_degree","4"));
87
+        idCache.put(1580L,getDicId(jdbcTemplateHsms,"incident_degree","3"));
88
+        idCache.put(1581L,getDicId(jdbcTemplateHsms,"incident_degree","2"));
89
+        idCache.put(1582L,getDicId(jdbcTemplateHsms,"incident_degree","1"));
175 90
 
176 91
         //事件-优先级
177 92
         idCache.put(1560L,5L);
@@ -181,56 +96,85 @@ public class DictionaryTask extends BaseTask {
181 96
         idCache.put(1704L,1L);
182 97
 
183 98
         //事件-incident_source
184
-        idCache.put(1547L,20402L);
185
-        idCache.put(1548L,20403L);
186
-        idCache.put(1549L,1549L);
187
-        idCache.put(1550L,20406L);
188
-        idCache.put(1551L,20405L);
189
-        idCache.put(1552L,20406L);
190
-        idCache.put(1700L,20406L);
191
-        idCache.put(1747L,20406L);
99
+        idCache.put(1547L,getDicId(jdbcTemplateHsms,"incident_source","phone"));
100
+        idCache.put(1548L,getDicId(jdbcTemplateHsms,"incident_source","record"));
101
+        idCache.put(1549L,getDicId(jdbcTemplateHsms,"incident_source","im"));
102
+        idCache.put(1550L,getDicId(jdbcTemplateHsms,"incident_source","other"));
103
+        idCache.put(1551L,getDicId(jdbcTemplateHsms,"incident_source","leader"));
104
+        idCache.put(1552L,getDicId(jdbcTemplateHsms,"incident_source","other"));
105
+        idCache.put(1700L,getDicId(jdbcTemplateHsms,"incident_source","other"));
106
+        idCache.put(1747L,getDicId(jdbcTemplateHsms,"incident_source","other"));
192 107
 
193 108
         //事件-incident_status
194
-        idCache.put(1479L,20423L);
195
-        idCache.put(1543L,20424L);
196
-        idCache.put(1544L,20425L);
197
-        idCache.put(1545L,20426L);
198
-        idCache.put(1546L,20426L);
199
-        idCache.put(1674L,20427L);
200
-        idCache.put(1748L,20428L);
201
-        idCache.put(1749L,20429L);
202
-        idCache.put(1750L,20430L);
109
+        idCache.put(1479L,getDicId(jdbcTemplateHsms,"incident_status","reassign"));
110
+        idCache.put(1543L,getDicId(jdbcTemplateHsms,"incident_status","pending"));
111
+        idCache.put(1544L,getDicId(jdbcTemplateHsms,"incident_status","handler"));
112
+        idCache.put(1545L,getDicId(jdbcTemplateHsms,"incident_status","close"));
113
+        idCache.put(1546L,getDicId(jdbcTemplateHsms,"incident_status","close"));
114
+        idCache.put(1674L,getDicId(jdbcTemplateHsms,"incident_status","storage"));
115
+        idCache.put(1748L,getDicId(jdbcTemplateHsms,"incident_status","cancel"));
116
+        idCache.put(1749L,getDicId(jdbcTemplateHsms,"incident_status","reject"));
117
+        idCache.put(1750L,getDicId(jdbcTemplateHsms,"incident_status","accept"));
203 118
 
204 119
         //事件-incident_handleresult
205
-        idCache.put(1568L,20401L);
206
-        idCache.put(1569L,20401L);
207
-        idCache.put(1570L,20401L);
208
-        idCache.put(1571L,20401L);
120
+        idCache.put(1568L,getDicId(jdbcTemplateHsms,"incident_handle_type","1"));
121
+        idCache.put(1569L,getDicId(jdbcTemplateHsms,"incident_handle_type","1"));
122
+        idCache.put(1570L,getDicId(jdbcTemplateHsms,"incident_handle_type","1"));
123
+        idCache.put(1571L,getDicId(jdbcTemplateHsms,"incident_handle_type","1"));
209 124
 
210 125
         //事件-wxincident_degree
211
-        idCache.put(1598L,20414L);
212
-        idCache.put(1599L,20415L);
213
-        idCache.put(1600L,20416L);
214
-        idCache.put(1601L,20417L);
215
-        idCache.put(1602L,20418L);
126
+        idCache.put(1598L,getDicId(jdbcTemplateHsms,"incident_degree","5"));
127
+        idCache.put(1599L,getDicId(jdbcTemplateHsms,"incident_degree","4"));
128
+        idCache.put(1600L,getDicId(jdbcTemplateHsms,"incident_degree","3"));
129
+        idCache.put(1601L,getDicId(jdbcTemplateHsms,"incident_degree","2"));
130
+        idCache.put(1602L,getDicId(jdbcTemplateHsms,"incident_degree","1"));
216 131
 
217 132
         //事件日志-incident_log_type
218
-        idCache.put(1736L,20435L);
219
-        idCache.put(1737L,20436L);
220
-        idCache.put(1738L,20437L);
221
-        idCache.put(1739L,20438L);
222
-        idCache.put(1740L,20439L);
223
-        idCache.put(1741L,20440L);
224
-        idCache.put(1742L,20441L);
225
-        idCache.put(1743L,20442L);
226
-        idCache.put(1744L,20443L);
227
-        idCache.put(1745L,20444L);
228
-        idCache.put(1751L,20445L);
229
-        idCache.put(1752L,20446L);
230
-        idCache.put(1753L,20447L);
231
-        idCache.put(1754L,20448L);
232
-        idCache.put(1755L,20449L);
233
-        idCache.put(1766L,20450L);
133
+        idCache.put(1736L,getDicId(jdbcTemplateHsms,"incident_log_type","accept"));
134
+        idCache.put(1737L,getDicId(jdbcTemplateHsms,"incident_log_type","receive"));
135
+        idCache.put(1738L,getDicId(jdbcTemplateHsms,"incident_log_type","doing"));
136
+        idCache.put(1739L,getDicId(jdbcTemplateHsms,"incident_log_type","resolve"));
137
+        idCache.put(1740L,getDicId(jdbcTemplateHsms,"incident_log_type","close"));
138
+        idCache.put(1741L,getDicId(jdbcTemplateHsms,"incident_log_type","reassign"));
139
+        idCache.put(1742L,getDicId(jdbcTemplateHsms,"incident_log_type","assign"));
140
+        idCache.put(1743L,getDicId(jdbcTemplateHsms,"incident_log_type","redeploy"));
141
+        idCache.put(1744L,getDicId(jdbcTemplateHsms,"incident_log_type","upgrade"));
142
+        idCache.put(1745L,getDicId(jdbcTemplateHsms,"incident_log_type","schassign"));
143
+        idCache.put(1751L,getDicId(jdbcTemplateHsms,"incident_log_type","overtime"));
144
+        idCache.put(1752L,getDicId(jdbcTemplateHsms,"incident_log_type","callback"));
145
+        idCache.put(1753L,getDicId(jdbcTemplateHsms,"incident_log_type","cancel"));
146
+        idCache.put(1754L,getDicId(jdbcTemplateHsms,"incident_log_type","reject"));
147
+        idCache.put(1755L,getDicId(jdbcTemplateHsms,"incident_log_type","request"));
148
+        idCache.put(1766L,getDicId(jdbcTemplateHsms,"incident_log_type","edit"));
149
+
150
+        //事件-incident_handleCategory
151
+        idCache.put(1564L,getDicId(jdbcTemplateHsms,"incident_handle_type","1"));
152
+        idCache.put(1565L,idCache.get(1564L));
153
+        idCache.put(1566L,idCache.get(1564L));
154
+        idCache.put(1567L,idCache.get(1564L));
155
+        idCache.put(1725L,idCache.get(1564L));
156
+        idCache.put(1726L,idCache.get(1564L));
157
+        idCache.put(1727L,idCache.get(1564L));
158
+        idCache.put(1728L,idCache.get(1564L));
159
+        if ("xiangyang".equals(appName)) {
160
+            idCache.put(1740L, idCache.get(1564L));
161
+        }else {
162
+            idCache.put(1746L, idCache.get(1564L));
163
+        }
164
+
165
+        //事件日志-repair_type
166
+        if ("xiangyang".equals(appName)) {
167
+            idCache.put(1723L,getDicId(jdbcTemplateHsms,"repair_type","1"));
168
+            idCache.put(1724L,getDicId(jdbcTemplateHsms,"repair_type","2"));
169
+            idCache.put(1729L,getDicId(jdbcTemplateHsms,"repair_type","ljmale8n"));
170
+            idCache.put(1730L,getDicId(jdbcTemplateHsms,"repair_type","limalzle"));
171
+            idCache.put(1731L,getDicId(jdbcTemplateHsms,"repair_type","ljmamxbm"));
172
+            idCache.put(1739L,getDicId(jdbcTemplateHsms,"repair_type","lr623zun"));
173
+        }else {
174
+            idCache.put(1723L,getDicId(jdbcTemplateHsms,"repair_type","1"));
175
+            idCache.put(1724L,getDicId(jdbcTemplateHsms,"repair_type","2"));
176
+        }
177
+
234 178
 
235 179
         return mapper;
236 180
     }

+ 1 - 1
src/main/resources/migration.sql

@@ -75,7 +75,7 @@ ftp 安装
75 75
 callSocket 重新配置hsms
76 76
 
77 77
 
78
-
78
+//TODO 系统执行的用户name,改成id 0,启动前:gender -> 279
79 79
 
80 80
 
81 81