song 4 months ago
parent
commit
b5102f3546

+ 9 - 6
src/main/java/com/dashitech/migration/task/category/IncidentCategoryConfigTask.java

@@ -7,7 +7,6 @@ import com.dashitech.migration.task.uc.GroupTask;
7 7
 import com.dashitech.migration.task.uc.HospitalTask;
8 8
 import com.dashitech.migration.task.uc.UserTask;
9 9
 import com.dashitech.migration.util.JdbcUtil;
10
-import org.apache.commons.collections.CollectionUtils;
11 10
 import org.apache.commons.logging.Log;
12 11
 import org.apache.commons.logging.LogFactory;
13 12
 import org.springframework.beans.factory.annotation.Autowired;
@@ -48,12 +47,16 @@ public class IncidentCategoryConfigTask extends BaseTask {
48 47
             sql.append(" WHERE a.branch_id <> 4 ");
49 48
         }
50 49
         List<Map<String, Object>> categoryConfigList = jdbcTemplateMdv2.queryForList(sql.toString());
51
-        FieldMapper mapper = new FieldMapper();
52
-        if (CollectionUtils.isEmpty(categoryConfigList)) {
53
-            sql = new StringBuffer("select version,id as category_id,_priority as priority,_group as group_id,userOrGroupType as user_group,handle_user as user_id,");
54
-            sql.append("NOW() as add_time,branch_id as hos_id,duty_dept as duty_id FROM itsm_incident_category");
55
-            categoryConfigList = jdbcTemplateMdv2.queryForList(sql.toString());
50
+        //查询故障现象表的配置数据
51
+        sql = new StringBuffer("select version,id as category_id,_priority as priority,_group as group_id,userOrGroupType as user_group,handle_user as user_id,");
52
+        sql.append("NOW() as add_time,branch_id as hos_id,duty_dept as duty_id FROM itsm_incident_category");
53
+        if ("xiangyang".equals(appName)) {
54
+            sql.append(" WHERE branch_id <> 4 ");
56 55
         }
56
+        List<Map<String, Object>> list = jdbcTemplateMdv2.queryForList(sql.toString());
57
+        categoryConfigList.addAll(list);
58
+
59
+        FieldMapper mapper = new FieldMapper();
57 60
         mapper.addOperationAdd("score", getDicId(jdbcTemplateHsms,"incident_category_score","1"));
58 61
         mapper.addOperationReplace("priority", dictionaryTask.loadCache().getIdCache());
59 62
         mapper.addOperationReplace("duty_id", hospitalTask.loadCache().getIdCache());

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

@@ -23,7 +23,7 @@ public class IncidentCategoryTask extends BaseTask {
23 23
     @Transactional(rollbackFor = Exception.class)
24 24
     public void start() {
25 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,IFNULL(branch_id,1) as hos_id ");
26
+        sql.append("hierarchy,muti_category,muti_suoPinyin as muti_jp,muti_quanPinyin as muti_qp,IF(branch_id = 4,3,IFNULL(branch_id,1)) as hos_id ");
27 27
         sql.append(" FROM itsm_incident_category ");
28 28
         List<Map<String, Object>> categoryList = jdbcTemplateMdv2.queryForList(sql.toString());
29 29
 

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

@@ -48,8 +48,9 @@ public class DepartmentTask extends BaseTask {
48 48
             FieldMapper deptMapper = this.loadCache();
49 49
             RowsWrap rw = DataMigrationter.getRowsWrap(mapper,deptMapper);
50 50
             JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
51
-            //科室只做更新 已有的科室不做处理
51
+
52 52
             jdbcUtil.batchPageInsert("itsm_uc_dept", rw.getInsertRows());
53
+            jdbcUtil.batchPageUpdate("itsm_uc_dept", rw.getUpdateRows());
53 54
 
54 55
             mapper.clear();
55 56
             deptMapper.clear();

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

@@ -41,7 +41,12 @@ public class UserTask extends BaseTask {
41 41
 
42 42
         StringBuffer sb = new StringBuffer();
43 43
         sb.append(" select version,ACCOUNT,GENDER,NAME,PHONE,PWD,WEIXIN,DEPTID,delete_flag, ");
44
-        sb.append(" pinyin,py as 'input_code',online,duty_id as 'hospital_id', ");
44
+        sb.append(" pinyin,py as 'input_code',online, ");
45
+        if ("xiangyang".equals(appName)) {
46
+            sb.append("IF(branch_id == 4 or branch_id is null,3,branch_id)  as 'hospital_id',");
47
+        } else {
48
+            sb.append("duty_id as 'hospital_id',");
49
+        }
45 50
         sb.append(" duty_id as 'duty_dept',company as 'company_id',engineer ");
46 51
         sb.append(" from itsm_uc_user ");
47 52
         sb.append(" where ACCOUNT != 'dsadmin' ");