123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- package com.jtgh.qlyg.sync;
- import java.util.Date;
- import java.util.List;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Component;
- import com.jtgh.yjpt.common.Constants;
- import com.jtgh.yjpt.common.GlobalData;
- import com.jtgh.yjpt.common.Utils;
- import com.jtgh.yjpt.controller.BaseController;
- import com.jtgh.yjpt.entity.common.AccessoryEntity;
- import com.jtgh.yjpt.entity.qlyg.AlertEntity;
- import com.jtgh.yjpt.entity.qlyg.ApplyEntity;
- import com.jtgh.yjpt.entity.qlyg.ApplyProcessEntity;
- import com.jtgh.yjpt.service.common.AccessoryService;
- import com.jtgh.yjpt.service.qlyg.AlertService;
- import com.jtgh.yjpt.service.qlyg.ApplyProcessService;
- import com.jtgh.yjpt.service.qlyg.ApplyService;
- /**
- * 生成异常信息
- *
- * @author liangz
- *
- */
- @Component
- public class QlygSyncAlert extends BaseController {
- @Autowired
- private ApplyService applyService;
- @Autowired
- private AlertService alertService;
- @Autowired
- private ApplyProcessService applyProcessService;
- @Autowired
- private AccessoryService accessoryService;
- /**
- * 扫描办件相关数据
- */
- public void execute() {
- // logger.info(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
- // .format(new Date()) + "执行QlygSyncAlert");
- // ==============时效异常===================
- // -----办件基本信息异常-----
- /*
- * 事项预警
- */
- List<ApplyEntity> applyList = applyService.findAlarm();
- if (applyList != null) {
- for (ApplyEntity applyEntity : applyList) {
- saveData(applyEntity, Constants.DATE_ALERT,
- Constants.WARN_TYPE, Constants.DATE_ALERT_1,
- Utils.getResource("qlyg", "monitor.logo.warn"));
- }
- }
- /*
- * 事项报警
- */
- List<ApplyEntity> applyList2 = applyService.findWarn();
- if (applyList2 != null) {
- for (ApplyEntity applyEntity : applyList2) {
- saveData(applyEntity, Constants.DATE_ALERT,
- Constants.ALARM_TYPE, Constants.DATE_ALERT_2,
- Utils.getResource("qlyg", "monitor.logo.alarm"));
- }
- }
- /*
- * 超过三个月未处理报警
- */
- List<ApplyEntity> applyList3 = applyService.findThreeMon();
- if (applyList3 != null) {
- for (ApplyEntity applyEntity : applyList3) {
- saveData(applyEntity, Constants.DATE_ALERT,
- Constants.ALARM_TYPE, Constants.DATE_ALERT_5,
- Utils.getResource("qlyg", "monitor.logo.three"));
- }
- }
- // ------办件过程异常---------
- /*
- * 环节预警
- */
- List<ApplyProcessEntity> processList = applyProcessService.findAlarm();
- if (processList != null) {
- for (ApplyProcessEntity applyProcessEntity : processList) {
- saveData2(applyProcessEntity, Constants.DATE_ALERT,
- Constants.WARN_TYPE, Constants.DATE_ALERT_3,
- Utils.getResource("qlyg", "monitor.logo.warn2"));
- }
- }
- /*
- * 环节报警
- */
- List<ApplyProcessEntity> processList2 = applyProcessService.findWarn();
- if (processList2 != null) {
- for (ApplyProcessEntity applyProcessEntity : processList2) {
- saveData2(applyProcessEntity, Constants.DATE_ALERT,
- Constants.ALARM_TYPE, Constants.DATE_ALERT_4,
- Utils.getResource("qlyg", "monitor.logo.alarm2"));
- }
- }
- // ======================内容异常==================
- /*
- * 还没产生受理通知书异常的办件
- */
- List<ApplyEntity> list1 = applyService
- .findDone(Constants.CONTENT_ALERT_1);
- if (list1 != null) {
- for (ApplyEntity applyEntity : list1) {
- List<AccessoryEntity> fjList = accessoryService
- .findByEntityIdAndEntityTypeAndType(
- applyEntity.getId(), Constants.GGDM_ID_APPLY,
- null);
- if (fjList != null) {
- boolean flag = false;
- for (AccessoryEntity accessoryEntity : fjList) {
- if (accessoryEntity.getName().indexOf("受理通知") != -1) {
- flag = true;
- }
- }
- if (flag == false) {
- saveData(applyEntity, Constants.CONTENT_ALERT,
- Constants.ALARM_TYPE,
- Constants.CONTENT_ALERT_1, Utils.getResource(
- "qlyg", "monitor.content.warn1"));
- }
- }
- }
- }
- /*
- * 还没产生决定书异常的办件
- */
- List<ApplyEntity> list2 = applyService
- .findDone(Constants.CONTENT_ALERT_2);
- if (list2 != null) {
- for (ApplyEntity applyEntity : list2) {
- List<AccessoryEntity> fjList = accessoryService
- .findByEntityIdAndEntityTypeAndType(
- applyEntity.getId(), Constants.GGDM_ID_APPLY,
- null);
- if (fjList != null) {
- boolean flag = false;
- for (AccessoryEntity accessoryEntity : fjList) {
- if (accessoryEntity.getName().indexOf("决定书") != -1) {
- flag = true;
- }
- }
- if (flag == false) {
- saveData(applyEntity, Constants.CONTENT_ALERT,
- Constants.ALARM_TYPE,
- Constants.CONTENT_ALERT_2, Utils.getResource(
- "qlyg", "monitor.content.warn2"));
- }
- }
- }
- }
- /*
- * 还没产生申请材料异常的办件
- */
- List<ApplyEntity> list3 = applyService
- .findDone(Constants.CONTENT_ALERT_3);
- if (list3 != null) {
- for (ApplyEntity applyEntity : list3) {
- List<AccessoryEntity> fjList = accessoryService
- .findByEntityIdAndEntityTypeAndType(
- applyEntity.getId(), Constants.GGDM_ID_APPLY,
- null);
- if (fjList == null) {
- saveData(applyEntity, Constants.CONTENT_ALERT,
- Constants.ALARM_TYPE, Constants.CONTENT_ALERT_3,
- Utils.getResource("qlyg", "monitor.content.warn3"));
- }
- }
- }
- /*
- * 权力编码未确认
- */
- List<ApplyEntity> list4 = applyService
- .findDone(Constants.CONTENT_ALERT_4);
- if (list4 != null) {
- for (ApplyEntity applyEntity : list4) {
- if (applyEntity.getItemId() == null) {
- saveData(applyEntity, Constants.CONTENT_ALERT,
- Constants.ALARM_TYPE, Constants.CONTENT_ALERT_4,
- Utils.getResource("qlyg", "monitor.content.warn4"));
- }
- }
- }
- }
- /**
- * 往异常表中插入数据
- *
- * @param applyEntity
- * @param string
- * @param i
- */
- private void saveData(ApplyEntity applyEntity, String monitorType,
- int outWayType, String type, String logo) {
- AlertEntity alertEntity = new AlertEntity();
- alertEntity.setId(generateEntityId(Constants.SEQ_T_QLYG_MONITOR_ALERT));
- String dept_code = GlobalData.DEPT_CODE;
- if (Utils.getCurrentUser() != null) {
- dept_code = Utils.getCurrentUser().getSzd().getByzd4() + "JT";
- }
- alertEntity.setNo(generateQlygNo(dept_code, alertEntity.getId()));
- alertEntity.setBjNo(applyEntity.getNo());
- alertEntity.setInfApplyId(applyEntity);
- alertEntity.setBjType("1");
- alertEntity.setOrgId(dept_code);
- alertEntity.setInternalNo(applyEntity.getInternalNo());
- alertEntity.setQlRegId(applyEntity.getItemId());
- alertEntity.setMonitorType(monitorType);
- alertEntity.setOutWayType(outWayType);
- alertEntity.setMonitorLogo(logo);
- alertEntity.setType(type);
- alertEntity.setAddDate(new Date());
- alertService.save(alertEntity);
- }
- /**
- * 往异常表中插入数据2
- *
- * @param applyEntity
- * @param string
- * @param i
- */
- private void saveData2(ApplyProcessEntity applyEntity, String monitorType,
- int outWayType, String type, String logo) {
- AlertEntity alertEntity = new AlertEntity();
- alertEntity.setId(generateEntityId(Constants.SEQ_T_QLYG_MONITOR_ALERT));
- String dept_code = GlobalData.DEPT_CODE;
- if (Utils.getCurrentUser() != null) {
- dept_code = Utils.getCurrentUser().getSzd().getByzd4() + "JT";
- }
- alertEntity.setNo(generateQlygNo(dept_code, alertEntity.getId()));
- alertEntity.setBjNo(applyEntity.getNo());
- alertEntity.setInfApplyId(applyEntity.getInfApplyId());
- alertEntity.setBjType("1");
- alertEntity.setOrgId(dept_code);
- alertEntity.setInternalNo(applyEntity.getInternalNo());
- alertEntity.setQlRegId(applyEntity.getItemId());
- alertEntity.setMonitorType(monitorType);
- alertEntity.setOutWayType(outWayType);
- alertEntity.setMonitorLogo(logo);
- alertEntity.setType(type);
- alertEntity.setAddDate(new Date());
- alertService.save(alertEntity);
- }
- }
|