kangwei:修改bug,优化代码

1 个父辈 e9308e9e
......@@ -6,6 +6,8 @@ import com.skua.core.util.DateUtils;
import com.skua.modules.edu.entity.Paper;
import com.skua.modules.edu.service.IPaperService;
import com.skua.modules.statistics.service.IEquipmentInfoDurationService;
import com.skua.modules.system.entity.SysDepart;
import com.skua.modules.system.service.ISysDepartService;
import com.skua.modules.system.service.ISysUserService;
import com.skua.modules.system.service.SmsService;
import lombok.extern.slf4j.Slf4j;
......@@ -33,6 +35,8 @@ public class EquipmentInfoDurationJob implements Job {
@Autowired
private IEquipmentInfoDurationService equipmentInfoDurationService;
@Autowired
private ISysDepartService departService;
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.info(String.format(" Jeecg-Boot 设备运行时长定时任务 EquipmentInfoDurationJob ! 时间:" + DateUtils.getTimestamp()));
......@@ -45,9 +49,9 @@ public class EquipmentInfoDurationJob implements Job {
String todayDate = today.format(formatter);//今天
try {
String[] departIds = BaseContextHandler.getDeparts().split(",");
for(String departId : departIds){
equipmentInfoDurationService.fillOutEquipmentInfoDuration(departId, todayDate, todayDate);
List<SysDepart> departList = departService.getFactoryList();
for(SysDepart depart : departList){
equipmentInfoDurationService.fillOutEquipmentInfoDuration(depart.getId(), todayDate, todayDate);
}
} catch (Exception e) {
......
......@@ -172,7 +172,8 @@ public class WorkAnalysisController {
}
endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比
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' ";
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(ggg.count,0)) 'frequency_total' ";
sql += " from sys_depart d ";
sql += getSafeProgressSql(departIds, startTime,endTime);
sql += " where d.depart_type =1 ";
......@@ -321,14 +322,14 @@ public class WorkAnalysisController {
}
String sql = "";
//会议任务
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 ";
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 ";
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 ";
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 ";
// 考试任务
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";
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";
//风险排查任务
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 ";
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 ";
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 ";
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 ";
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 ";
return sql ;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!