Pārlūkot izejas kodu

[bug-3892]首页日程提醒了管审会议,实际没计划或者计划已删除

gaozl 11 mēneši atpakaļ
vecāks
revīzija
424f117c10

+ 32 - 0
ibps-provider-root/modules/provider-platform/src/main/java/com/lc/ibps/platform/plan/job/DailyJob.java

@@ -20,6 +20,7 @@ public class DailyJob extends AbstractJob {
             }
         }
         executeExpiredUser();
+        deleteCalendar();
     }
 
     private void executeExpiredUser(){
@@ -33,4 +34,35 @@ public class DailyJob extends AbstractJob {
                 "   JOIN ibps_party_attr attr ON attr.id_ = val.attr_id_ AND attr.key_='exp'" +
                 "   WHERE val.value_<NOW()");
     }
+
+
+    // 删除业务数据后  需要删除  日历日程表对应信息
+    private void deleteCalendar(){
+        try {
+            String sql = "SELECT id_,title_,data_source_id_,data_info_ from ibps_party_user_calendar where data_source_id_ is not null and data_source_id_<>'' and data_info_ is not null and data_info_<>''";
+            List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
+            logger.warn("删除业务数据后  需要删除  日历日程表对应信息,总数={}",list.size());
+            if (BeanUtils.isEmpty(list)) {
+                return;
+            }
+            int count = 0;
+            for (Map<String, Object> sqlMap : list) {
+                String id = sqlMap.get("id_").toString();
+                String sourceId = sqlMap.get("data_source_id_").toString();
+                String info = sqlMap.get("data_info_").toString();
+                String title_ = sqlMap.get("title_").toString();
+                Map<String, Object> data = commonDao.queryOne("select id_ from "+info+" where id_='"+sourceId+"'");
+                if (data == null) {
+                    commonDao.execute("DELETE FROM ibps_party_user_calendar WHERE id_='"+id+"'");
+                    logger.warn("Delete calendar id={},title={},data_source_id_={},data_info_={}",id,title_,sourceId,info);
+                    count++;
+                }
+            }
+            logger.warn("删除数:{}",count);
+        }catch (Exception e){
+            logger.error(e.getMessage());
+        }
+    }
+
+
 }