QlygSyncAlert.java 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. package com.jtgh.qlyg.sync;
  2. import java.util.Date;
  3. import java.util.List;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.stereotype.Component;
  6. import com.jtgh.yjpt.common.Constants;
  7. import com.jtgh.yjpt.common.GlobalData;
  8. import com.jtgh.yjpt.common.Utils;
  9. import com.jtgh.yjpt.controller.BaseController;
  10. import com.jtgh.yjpt.entity.common.AccessoryEntity;
  11. import com.jtgh.yjpt.entity.qlyg.AlertEntity;
  12. import com.jtgh.yjpt.entity.qlyg.ApplyEntity;
  13. import com.jtgh.yjpt.entity.qlyg.ApplyProcessEntity;
  14. import com.jtgh.yjpt.service.common.AccessoryService;
  15. import com.jtgh.yjpt.service.qlyg.AlertService;
  16. import com.jtgh.yjpt.service.qlyg.ApplyProcessService;
  17. import com.jtgh.yjpt.service.qlyg.ApplyService;
  18. /**
  19. * 生成异常信息
  20. *
  21. * @author liangz
  22. *
  23. */
  24. @Component
  25. public class QlygSyncAlert extends BaseController {
  26. @Autowired
  27. private ApplyService applyService;
  28. @Autowired
  29. private AlertService alertService;
  30. @Autowired
  31. private ApplyProcessService applyProcessService;
  32. @Autowired
  33. private AccessoryService accessoryService;
  34. /**
  35. * 扫描办件相关数据
  36. */
  37. public void execute() {
  38. // logger.info(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
  39. // .format(new Date()) + "执行QlygSyncAlert");
  40. // ==============时效异常===================
  41. // -----办件基本信息异常-----
  42. /*
  43. * 事项预警
  44. */
  45. List<ApplyEntity> applyList = applyService.findAlarm();
  46. if (applyList != null) {
  47. for (ApplyEntity applyEntity : applyList) {
  48. saveData(applyEntity, Constants.DATE_ALERT,
  49. Constants.WARN_TYPE, Constants.DATE_ALERT_1,
  50. Utils.getResource("qlyg", "monitor.logo.warn"));
  51. }
  52. }
  53. /*
  54. * 事项报警
  55. */
  56. List<ApplyEntity> applyList2 = applyService.findWarn();
  57. if (applyList2 != null) {
  58. for (ApplyEntity applyEntity : applyList2) {
  59. saveData(applyEntity, Constants.DATE_ALERT,
  60. Constants.ALARM_TYPE, Constants.DATE_ALERT_2,
  61. Utils.getResource("qlyg", "monitor.logo.alarm"));
  62. }
  63. }
  64. /*
  65. * 超过三个月未处理报警
  66. */
  67. List<ApplyEntity> applyList3 = applyService.findThreeMon();
  68. if (applyList3 != null) {
  69. for (ApplyEntity applyEntity : applyList3) {
  70. saveData(applyEntity, Constants.DATE_ALERT,
  71. Constants.ALARM_TYPE, Constants.DATE_ALERT_5,
  72. Utils.getResource("qlyg", "monitor.logo.three"));
  73. }
  74. }
  75. // ------办件过程异常---------
  76. /*
  77. * 环节预警
  78. */
  79. List<ApplyProcessEntity> processList = applyProcessService.findAlarm();
  80. if (processList != null) {
  81. for (ApplyProcessEntity applyProcessEntity : processList) {
  82. saveData2(applyProcessEntity, Constants.DATE_ALERT,
  83. Constants.WARN_TYPE, Constants.DATE_ALERT_3,
  84. Utils.getResource("qlyg", "monitor.logo.warn2"));
  85. }
  86. }
  87. /*
  88. * 环节报警
  89. */
  90. List<ApplyProcessEntity> processList2 = applyProcessService.findWarn();
  91. if (processList2 != null) {
  92. for (ApplyProcessEntity applyProcessEntity : processList2) {
  93. saveData2(applyProcessEntity, Constants.DATE_ALERT,
  94. Constants.ALARM_TYPE, Constants.DATE_ALERT_4,
  95. Utils.getResource("qlyg", "monitor.logo.alarm2"));
  96. }
  97. }
  98. // ======================内容异常==================
  99. /*
  100. * 还没产生受理通知书异常的办件
  101. */
  102. List<ApplyEntity> list1 = applyService
  103. .findDone(Constants.CONTENT_ALERT_1);
  104. if (list1 != null) {
  105. for (ApplyEntity applyEntity : list1) {
  106. List<AccessoryEntity> fjList = accessoryService
  107. .findByEntityIdAndEntityTypeAndType(
  108. applyEntity.getId(), Constants.GGDM_ID_APPLY,
  109. null);
  110. if (fjList != null) {
  111. boolean flag = false;
  112. for (AccessoryEntity accessoryEntity : fjList) {
  113. if (accessoryEntity.getName().indexOf("受理通知") != -1) {
  114. flag = true;
  115. }
  116. }
  117. if (flag == false) {
  118. saveData(applyEntity, Constants.CONTENT_ALERT,
  119. Constants.ALARM_TYPE,
  120. Constants.CONTENT_ALERT_1, Utils.getResource(
  121. "qlyg", "monitor.content.warn1"));
  122. }
  123. }
  124. }
  125. }
  126. /*
  127. * 还没产生决定书异常的办件
  128. */
  129. List<ApplyEntity> list2 = applyService
  130. .findDone(Constants.CONTENT_ALERT_2);
  131. if (list2 != null) {
  132. for (ApplyEntity applyEntity : list2) {
  133. List<AccessoryEntity> fjList = accessoryService
  134. .findByEntityIdAndEntityTypeAndType(
  135. applyEntity.getId(), Constants.GGDM_ID_APPLY,
  136. null);
  137. if (fjList != null) {
  138. boolean flag = false;
  139. for (AccessoryEntity accessoryEntity : fjList) {
  140. if (accessoryEntity.getName().indexOf("决定书") != -1) {
  141. flag = true;
  142. }
  143. }
  144. if (flag == false) {
  145. saveData(applyEntity, Constants.CONTENT_ALERT,
  146. Constants.ALARM_TYPE,
  147. Constants.CONTENT_ALERT_2, Utils.getResource(
  148. "qlyg", "monitor.content.warn2"));
  149. }
  150. }
  151. }
  152. }
  153. /*
  154. * 还没产生申请材料异常的办件
  155. */
  156. List<ApplyEntity> list3 = applyService
  157. .findDone(Constants.CONTENT_ALERT_3);
  158. if (list3 != null) {
  159. for (ApplyEntity applyEntity : list3) {
  160. List<AccessoryEntity> fjList = accessoryService
  161. .findByEntityIdAndEntityTypeAndType(
  162. applyEntity.getId(), Constants.GGDM_ID_APPLY,
  163. null);
  164. if (fjList == null) {
  165. saveData(applyEntity, Constants.CONTENT_ALERT,
  166. Constants.ALARM_TYPE, Constants.CONTENT_ALERT_3,
  167. Utils.getResource("qlyg", "monitor.content.warn3"));
  168. }
  169. }
  170. }
  171. /*
  172. * 权力编码未确认
  173. */
  174. List<ApplyEntity> list4 = applyService
  175. .findDone(Constants.CONTENT_ALERT_4);
  176. if (list4 != null) {
  177. for (ApplyEntity applyEntity : list4) {
  178. if (applyEntity.getItemId() == null) {
  179. saveData(applyEntity, Constants.CONTENT_ALERT,
  180. Constants.ALARM_TYPE, Constants.CONTENT_ALERT_4,
  181. Utils.getResource("qlyg", "monitor.content.warn4"));
  182. }
  183. }
  184. }
  185. }
  186. /**
  187. * 往异常表中插入数据
  188. *
  189. * @param applyEntity
  190. * @param string
  191. * @param i
  192. */
  193. private void saveData(ApplyEntity applyEntity, String monitorType,
  194. int outWayType, String type, String logo) {
  195. AlertEntity alertEntity = new AlertEntity();
  196. alertEntity.setId(generateEntityId(Constants.SEQ_T_QLYG_MONITOR_ALERT));
  197. String dept_code = GlobalData.DEPT_CODE;
  198. if (Utils.getCurrentUser() != null) {
  199. dept_code = Utils.getCurrentUser().getSzd().getByzd4() + "JT";
  200. }
  201. alertEntity.setNo(generateQlygNo(dept_code, alertEntity.getId()));
  202. alertEntity.setBjNo(applyEntity.getNo());
  203. alertEntity.setInfApplyId(applyEntity);
  204. alertEntity.setBjType("1");
  205. alertEntity.setOrgId(dept_code);
  206. alertEntity.setInternalNo(applyEntity.getInternalNo());
  207. alertEntity.setQlRegId(applyEntity.getItemId());
  208. alertEntity.setMonitorType(monitorType);
  209. alertEntity.setOutWayType(outWayType);
  210. alertEntity.setMonitorLogo(logo);
  211. alertEntity.setType(type);
  212. alertEntity.setAddDate(new Date());
  213. alertService.save(alertEntity);
  214. }
  215. /**
  216. * 往异常表中插入数据2
  217. *
  218. * @param applyEntity
  219. * @param string
  220. * @param i
  221. */
  222. private void saveData2(ApplyProcessEntity applyEntity, String monitorType,
  223. int outWayType, String type, String logo) {
  224. AlertEntity alertEntity = new AlertEntity();
  225. alertEntity.setId(generateEntityId(Constants.SEQ_T_QLYG_MONITOR_ALERT));
  226. String dept_code = GlobalData.DEPT_CODE;
  227. if (Utils.getCurrentUser() != null) {
  228. dept_code = Utils.getCurrentUser().getSzd().getByzd4() + "JT";
  229. }
  230. alertEntity.setNo(generateQlygNo(dept_code, alertEntity.getId()));
  231. alertEntity.setBjNo(applyEntity.getNo());
  232. alertEntity.setInfApplyId(applyEntity.getInfApplyId());
  233. alertEntity.setBjType("1");
  234. alertEntity.setOrgId(dept_code);
  235. alertEntity.setInternalNo(applyEntity.getInternalNo());
  236. alertEntity.setQlRegId(applyEntity.getItemId());
  237. alertEntity.setMonitorType(monitorType);
  238. alertEntity.setOutWayType(outWayType);
  239. alertEntity.setMonitorLogo(logo);
  240. alertEntity.setType(type);
  241. alertEntity.setAddDate(new Date());
  242. alertService.save(alertEntity);
  243. }
  244. }