kangwei:修改bug,优化代码
正在显示
2 个修改的文件
包含
13 行增加
和
8 行删除
... | @@ -6,6 +6,8 @@ import com.skua.core.util.DateUtils; | ... | @@ -6,6 +6,8 @@ import com.skua.core.util.DateUtils; |
6 | import com.skua.modules.edu.entity.Paper; | 6 | import com.skua.modules.edu.entity.Paper; |
7 | import com.skua.modules.edu.service.IPaperService; | 7 | import com.skua.modules.edu.service.IPaperService; |
8 | import com.skua.modules.statistics.service.IEquipmentInfoDurationService; | 8 | import com.skua.modules.statistics.service.IEquipmentInfoDurationService; |
9 | import com.skua.modules.system.entity.SysDepart; | ||
10 | import com.skua.modules.system.service.ISysDepartService; | ||
9 | import com.skua.modules.system.service.ISysUserService; | 11 | import com.skua.modules.system.service.ISysUserService; |
10 | import com.skua.modules.system.service.SmsService; | 12 | import com.skua.modules.system.service.SmsService; |
11 | import lombok.extern.slf4j.Slf4j; | 13 | import lombok.extern.slf4j.Slf4j; |
... | @@ -33,6 +35,8 @@ public class EquipmentInfoDurationJob implements Job { | ... | @@ -33,6 +35,8 @@ public class EquipmentInfoDurationJob implements Job { |
33 | 35 | ||
34 | @Autowired | 36 | @Autowired |
35 | private IEquipmentInfoDurationService equipmentInfoDurationService; | 37 | private IEquipmentInfoDurationService equipmentInfoDurationService; |
38 | @Autowired | ||
39 | private ISysDepartService departService; | ||
36 | @Override | 40 | @Override |
37 | public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { | 41 | public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { |
38 | log.info(String.format(" Jeecg-Boot 设备运行时长定时任务 EquipmentInfoDurationJob ! 时间:" + DateUtils.getTimestamp())); | 42 | log.info(String.format(" Jeecg-Boot 设备运行时长定时任务 EquipmentInfoDurationJob ! 时间:" + DateUtils.getTimestamp())); |
... | @@ -45,9 +49,9 @@ public class EquipmentInfoDurationJob implements Job { | ... | @@ -45,9 +49,9 @@ public class EquipmentInfoDurationJob implements Job { |
45 | String todayDate = today.format(formatter);//今天 | 49 | String todayDate = today.format(formatter);//今天 |
46 | 50 | ||
47 | try { | 51 | try { |
48 | String[] departIds = BaseContextHandler.getDeparts().split(","); | 52 | List<SysDepart> departList = departService.getFactoryList(); |
49 | for(String departId : departIds){ | 53 | for(SysDepart depart : departList){ |
50 | equipmentInfoDurationService.fillOutEquipmentInfoDuration(departId, todayDate, todayDate); | 54 | equipmentInfoDurationService.fillOutEquipmentInfoDuration(depart.getId(), todayDate, todayDate); |
51 | } | 55 | } |
52 | 56 | ||
53 | } catch (Exception e) { | 57 | } catch (Exception e) { | ... | ... |
... | @@ -172,7 +172,8 @@ public class WorkAnalysisController { | ... | @@ -172,7 +172,8 @@ public class WorkAnalysisController { |
172 | } | 172 | } |
173 | endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比 | 173 | endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比 |
174 | 174 | ||
175 | String sql = "select count(d.id) 'departNum', sum(ifnull(aaa.count,0)) 'meet_num' ,sum(ifnull(bbb.count,0)) 'meet_total' ,sum(ifnull(ccc.count,0)) 'exam_num' ,sum(ifnull(ddd.count,0)) 'exam_total',sum(ifnull(eee.count,0)) 'frequency_num' ,sum(ifnull(fff.count,0)) 'frequency_total' "; | 175 | String sql = "select count(d.id) 'departNum', sum(ifnull(aaa.count,0)) 'meet_num' ,sum(ifnull(bbb.count,0)) 'meet_total' ,sum(ifnull(ccc.count,0)) 'exam_num' ,sum(ifnull(ddd.count,0)) 'exam_total'," + |
176 | "sum(ifnull(eee.count,0)) 'frequency_num' ,sum(ifnull(ggg.count,0)) 'frequency_total' "; | ||
176 | sql += " from sys_depart d "; | 177 | sql += " from sys_depart d "; |
177 | sql += getSafeProgressSql(departIds, startTime,endTime); | 178 | sql += getSafeProgressSql(departIds, startTime,endTime); |
178 | sql += " where d.depart_type =1 "; | 179 | sql += " where d.depart_type =1 "; |
... | @@ -321,14 +322,14 @@ public class WorkAnalysisController { | ... | @@ -321,14 +322,14 @@ public class WorkAnalysisController { |
321 | } | 322 | } |
322 | String sql = ""; | 323 | String sql = ""; |
323 | //会议任务 | 324 | //会议任务 |
324 | sql += " left join( select depart_id , count(1) 'count' from ajh_meeting_send where meet_status =2 and meet_end_time >='"+startTime+"' and meet_end_time <= '"+endTime+"' group by depart_id )aaa on aaa.depart_id = d.id "; | 325 | sql += " left join( select depart_id , count(1) 'count' from ajh_meeting_send where meet_status =2 and meet_time >='"+startTime+"' and meet_time <= '"+endTime+"' group by depart_id )aaa on aaa.depart_id = d.id "; |
325 | sql += " left join (select depart_id , count(1) 'count' from ajh_meeting_send where meet_id in (select id from ajh_meeting where end_time >='"+startTime+"' and end_time <= '"+endTime+"') group by depart_id ) bbb on bbb.depart_id = d.id "; | 326 | sql += " left join (select depart_id , count(1) 'count' from ajh_meeting_send where meet_id in (select id from ajh_meeting where send_time >='"+startTime+"' and send_time <= '"+endTime+"') group by depart_id ) bbb on bbb.depart_id = d.id "; |
326 | // 考试任务 | 327 | // 考试任务 |
327 | sql += " left join (select depart_id,count(user_id) 'count' from edu_user_paper where DATE_FORMAT(end_time,'%Y-%m-%d') >='"+startTime+"' and end_time <= '"+endTime+"' and user_id in("+userIds+") group by depart_id )ccc on ccc.depart_id = d.id"; | 328 | sql += " left join (select depart_id,count(user_id) 'count' from edu_user_paper where DATE_FORMAT(end_time,'%Y-%m-%d') >='"+startTime+"' and end_time <= '"+endTime+"' and user_id in("+userIds+") group by depart_id )ccc on ccc.depart_id = d.id"; |
328 | sql += " left join ( select dep_id,count(user_id) 'count' from sys_user_depart where user_id in("+userIds+") group by dep_id )ddd on ddd.dep_id = d.id"; | 329 | sql += " left join ( select dep_id,count(user_id) 'count' from sys_user_depart where user_id in("+userIds+") group by dep_id )ddd on ddd.dep_id = d.id"; |
329 | //风险排查任务 | 330 | //风险排查任务 |
330 | sql += " left join ( select depart_id ,count(id) 'count' from danger_inspection_record where status = '2' and end_date >= '"+startTime+" 00:00:00' and end_date <='"+endTime+" 23:59:59' group by depart_id ) eee on eee.depart_id = d.id "; | 331 | sql += " left join ( select depart_id ,count(id) 'count' from danger_inspection_record where status = '2' and report_date >= '"+startTime+" 00:00:00' and report_date <='"+endTime+" 23:59:59' group by depart_id ) eee on eee.depart_id = d.id "; |
331 | sql += " left join ( select depart_id ,count(id) 'count' from danger_inspection_record where report_date >= '"+startTime+" 00:00:00' and report_date <='"+endTime+" 23:59:59' group by depart_id ) ggg on ggg.depart_id = d.id "; | 332 | sql += " left join ( select depart_id ,count(id) 'count' from danger_inspection_record where report_date >= '"+startTime+" 00:00:00' and report_date <='"+endTime+" 23:59:59' group by depart_id ) ggg on ggg.depart_id = d.id "; |
332 | sql += " left join( select sum( (DATEDIFF('"+endTime+"', '"+startTime+"') +1)*24/ dlm.frequency ) 'count' , dlm.depart_id from danger_level_manage dlm where dlm.frequency IS NOT NULL and frequency <> '' ) fff on fff.depart_id = d.id "; | 333 | sql += " left join( select sum( (DATEDIFF('"+endTime+"', '"+startTime+"') +1)*24/ dlm.frequency ) 'count' , dlm.depart_id from danger_level_manage dlm where dlm.frequency IS NOT NULL and frequency <> '' ) fff on fff.depart_id = d.id "; |
333 | 334 | ||
334 | return sql ; | 335 | return sql ; | ... | ... |
-
请 注册 或 登录 后发表评论