DictionaryTask.java 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. package com.dashitech.migration.task.other;
  2. import com.dashitech.migration.BaseTask;
  3. import com.dashitech.migration.core.FieldMapper;
  4. import org.apache.commons.logging.Log;
  5. import org.apache.commons.logging.LogFactory;
  6. import org.springframework.stereotype.Component;
  7. import org.springframework.transaction.annotation.Transactional;
  8. import java.util.HashMap;
  9. import java.util.Map;
  10. /**
  11. * @author song
  12. * @date 2024年10月12日
  13. */
  14. @Component
  15. public class DictionaryTask extends BaseTask {
  16. public static Log log = LogFactory.getLog(DictionaryTask.class);
  17. private static Map<Long, Long> idCache = new HashMap<>();
  18. @Override
  19. @Transactional(rollbackFor = Exception.class)
  20. public void start() {
  21. }
  22. @Override
  23. public FieldMapper loadCache() {
  24. FieldMapper mapper = null;
  25. if(idCache.isEmpty()) {
  26. mapper = loadCache2();
  27. }else {
  28. mapper = new FieldMapper();
  29. mapper.setIdCache(idCache);
  30. }
  31. return mapper;
  32. }
  33. private FieldMapper loadCache2() {
  34. log.info(" *** 加载DictionaryTask字典缓存 *** ");
  35. FieldMapper mapper = new FieldMapper();
  36. Map<Long, Long> idCache = new HashMap<>();
  37. mapper.setIdCache(idCache);
  38. //知识库
  39. idCache.put(71L, getDicId(jdbcTemplateHsms,"solution_status","2")); //待审核
  40. idCache.put(72L, getDicId(jdbcTemplateHsms,"solution_status","3")); //已发布
  41. idCache.put(73L, getDicId(jdbcTemplateHsms,"solution_status","4")); //待整改
  42. idCache.put(74L, getDicId(jdbcTemplateHsms,"solution_status","5")); //已停用
  43. //耗材消耗
  44. if ("xiangyang".equals(appName)) {
  45. idCache.put(1735L, getDicId(jdbcTemplateHsms,"consumables_consume_type","1"));//消耗
  46. idCache.put(1736L, getDicId(jdbcTemplateHsms,"consumables_consume_type","2"));//撤销
  47. }else {
  48. idCache.put(1732L, getDicId(jdbcTemplateHsms,"consumables_consume_type","1"));//消耗
  49. idCache.put(1733L, getDicId(jdbcTemplateHsms,"consumables_consume_type","2"));//撤销
  50. }
  51. //公司分类
  52. idCache.put(1709L,getDicId(jdbcTemplateHsms,"company_type","1"));
  53. idCache.put(1710L,getDicId(jdbcTemplateHsms,"company_type","3"));
  54. //性别
  55. idCache.put(1609L,getDicId(jdbcTemplateHsms,"user_gender","0"));
  56. idCache.put(1610L,getDicId(jdbcTemplateHsms,"user_gender","1"));
  57. //事件-关闭代码
  58. idCache.put(1572L,getDicId(jdbcTemplateHsms,"incident_closecode","1"));
  59. idCache.put(1573L,getDicId(jdbcTemplateHsms,"incident_closecode","2"));
  60. idCache.put(1575L,getDicId(jdbcTemplateHsms,"incident_closecode","3"));
  61. idCache.put(1574L,getDicId(jdbcTemplateHsms,"incident_closecode","4"));
  62. idCache.put(1576L,getDicId(jdbcTemplateHsms,"incident_closecode","4"));
  63. idCache.put(1577L,getDicId(jdbcTemplateHsms,"incident_closecode","4"));
  64. //事件-满意度
  65. idCache.put(1578L,getDicId(jdbcTemplateHsms,"incident_degree","5"));
  66. idCache.put(1579L,getDicId(jdbcTemplateHsms,"incident_degree","4"));
  67. idCache.put(1580L,getDicId(jdbcTemplateHsms,"incident_degree","3"));
  68. idCache.put(1581L,getDicId(jdbcTemplateHsms,"incident_degree","2"));
  69. idCache.put(1582L,getDicId(jdbcTemplateHsms,"incident_degree","1"));
  70. //事件-优先级
  71. idCache.put(1560L,5L);
  72. idCache.put(1561L,4L);
  73. idCache.put(1562L,3L);
  74. idCache.put(1563L,2L);
  75. idCache.put(1704L,1L);
  76. //事件-incident_source
  77. idCache.put(1547L,getDicId(jdbcTemplateHsms,"incident_source","phone"));
  78. idCache.put(1548L,getDicId(jdbcTemplateHsms,"incident_source","record"));
  79. idCache.put(1549L,getDicId(jdbcTemplateHsms,"incident_source","im"));
  80. idCache.put(1550L,getDicId(jdbcTemplateHsms,"incident_source","other"));
  81. idCache.put(1551L,getDicId(jdbcTemplateHsms,"incident_source","leader"));
  82. idCache.put(1552L,getDicId(jdbcTemplateHsms,"incident_source","other"));
  83. idCache.put(1700L,getDicId(jdbcTemplateHsms,"incident_source","other"));
  84. idCache.put(1747L,getDicId(jdbcTemplateHsms,"incident_source","other"));
  85. //事件-incident_status
  86. idCache.put(1479L,getDicId(jdbcTemplateHsms,"incident_status","reassign"));
  87. idCache.put(1543L,getDicId(jdbcTemplateHsms,"incident_status","pending"));
  88. idCache.put(1544L,getDicId(jdbcTemplateHsms,"incident_status","handler"));
  89. idCache.put(1545L,getDicId(jdbcTemplateHsms,"incident_status","close"));
  90. idCache.put(1546L,getDicId(jdbcTemplateHsms,"incident_status","close"));
  91. idCache.put(1674L,getDicId(jdbcTemplateHsms,"incident_status","storage"));
  92. idCache.put(1748L,getDicId(jdbcTemplateHsms,"incident_status","cancel"));
  93. idCache.put(1749L,getDicId(jdbcTemplateHsms,"incident_status","reject"));
  94. idCache.put(1750L,getDicId(jdbcTemplateHsms,"incident_status","accept"));
  95. //事件-incident_handleresult
  96. idCache.put(1568L,getDicId(jdbcTemplateHsms,"incident_handle_type","1"));
  97. idCache.put(1569L,getDicId(jdbcTemplateHsms,"incident_handle_type","1"));
  98. idCache.put(1570L,getDicId(jdbcTemplateHsms,"incident_handle_type","1"));
  99. idCache.put(1571L,getDicId(jdbcTemplateHsms,"incident_handle_type","1"));
  100. //事件-wxincident_degree
  101. idCache.put(1598L,getDicId(jdbcTemplateHsms,"incident_degree","5"));
  102. idCache.put(1599L,getDicId(jdbcTemplateHsms,"incident_degree","4"));
  103. idCache.put(1600L,getDicId(jdbcTemplateHsms,"incident_degree","3"));
  104. idCache.put(1601L,getDicId(jdbcTemplateHsms,"incident_degree","2"));
  105. idCache.put(1602L,getDicId(jdbcTemplateHsms,"incident_degree","1"));
  106. //事件日志-incident_log_type
  107. idCache.put(1736L,getDicId(jdbcTemplateHsms,"incident_log_type","accept"));
  108. idCache.put(1737L,getDicId(jdbcTemplateHsms,"incident_log_type","receive"));
  109. idCache.put(1738L,getDicId(jdbcTemplateHsms,"incident_log_type","doing"));
  110. idCache.put(1739L,getDicId(jdbcTemplateHsms,"incident_log_type","resolve"));
  111. idCache.put(1740L,getDicId(jdbcTemplateHsms,"incident_log_type","close"));
  112. idCache.put(1741L,getDicId(jdbcTemplateHsms,"incident_log_type","reassign"));
  113. idCache.put(1742L,getDicId(jdbcTemplateHsms,"incident_log_type","assign"));
  114. idCache.put(1743L,getDicId(jdbcTemplateHsms,"incident_log_type","redeploy"));
  115. idCache.put(1744L,getDicId(jdbcTemplateHsms,"incident_log_type","upgrade"));
  116. idCache.put(1745L,getDicId(jdbcTemplateHsms,"incident_log_type","schassign"));
  117. idCache.put(1751L,getDicId(jdbcTemplateHsms,"incident_log_type","overtime"));
  118. idCache.put(1752L,getDicId(jdbcTemplateHsms,"incident_log_type","callback"));
  119. idCache.put(1753L,getDicId(jdbcTemplateHsms,"incident_log_type","cancel"));
  120. idCache.put(1754L,getDicId(jdbcTemplateHsms,"incident_log_type","reject"));
  121. idCache.put(1755L,getDicId(jdbcTemplateHsms,"incident_log_type","request"));
  122. idCache.put(1766L,getDicId(jdbcTemplateHsms,"incident_log_type","edit"));
  123. //事件-incident_handleCategory
  124. idCache.put(1564L,getDicId(jdbcTemplateHsms,"incident_handle_type","1"));
  125. idCache.put(1565L,idCache.get(1564L));
  126. idCache.put(1566L,idCache.get(1564L));
  127. idCache.put(1567L,idCache.get(1564L));
  128. idCache.put(1725L,idCache.get(1564L));
  129. idCache.put(1726L,idCache.get(1564L));
  130. idCache.put(1727L,idCache.get(1564L));
  131. idCache.put(1728L,idCache.get(1564L));
  132. if ("xiangyang".equals(appName)) {
  133. idCache.put(1740L, idCache.get(1564L));
  134. }else {
  135. idCache.put(1746L, idCache.get(1564L));
  136. }
  137. //事件日志-repair_type
  138. if ("xiangyang".equals(appName)) {
  139. idCache.put(1723L,getDicId(jdbcTemplateHsms,"repair_type","1"));
  140. idCache.put(1724L,getDicId(jdbcTemplateHsms,"repair_type","2"));
  141. idCache.put(1729L,getDicId(jdbcTemplateHsms,"repair_type","ljmale8n"));
  142. idCache.put(1730L,getDicId(jdbcTemplateHsms,"repair_type","limalzle"));
  143. idCache.put(1731L,getDicId(jdbcTemplateHsms,"repair_type","ljmamxbm"));
  144. idCache.put(1739L,getDicId(jdbcTemplateHsms,"repair_type","lr623zun"));
  145. }else {
  146. idCache.put(1723L,getDicId(jdbcTemplateHsms,"repair_type","1"));
  147. idCache.put(1724L,getDicId(jdbcTemplateHsms,"repair_type","2"));
  148. }
  149. return mapper;
  150. }
  151. }