2023年11月8日 修复智慧教室查询慢的问题
This commit is contained in:
parent
ffe83dbff0
commit
9373247221
|
@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.TimeInterval;
|
||||
import com.beust.jcommander.internal.Sets;
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.Data;
|
||||
|
@ -93,8 +94,11 @@ public class KcZhihuijiaoshiController extends JeecgController<KcZhihuijiaoshi,
|
|||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
QueryWrapper<KcZhihuijiaoshi> queryWrapper) {
|
||||
TimeInterval timer = DateUtil.timer();
|
||||
Page<KcZhihuijiaoshi> page = new Page<KcZhihuijiaoshi>(pageNo, pageSize);
|
||||
IPage<KcZhihuijiaoshi> pageList = kcZhihuijiaoshiService.page(page, queryWrapper);
|
||||
|
||||
log.info("01: {}",timer.intervalRestart());
|
||||
//查询今天的课,
|
||||
DateTime starTime = DateTime.now();
|
||||
|
||||
|
@ -107,9 +111,11 @@ public class KcZhihuijiaoshiController extends JeecgController<KcZhihuijiaoshi,
|
|||
//查询全部的教学楼
|
||||
//QueryWrapper<KcKetangbiao> jxlqw = new QueryWrapper<>();
|
||||
List<KcJiaoxuelouInfo> jiaoxuelouInfoList = kcJiaoxuelouInfoService.list();
|
||||
log.info("02: {}",timer.intervalRestart());
|
||||
|
||||
Map<String, KcJiaoxuelouInfo> jiaoxuelouInfoMap = jiaoxuelouInfoList.stream().collect(Collectors.toMap(KcJiaoxuelouInfo::getId,a -> a, (a,b) -> a));
|
||||
|
||||
log.info("03: {}",timer.intervalRestart());
|
||||
//下一节次映射表
|
||||
Map<String,String> nextJcMap = Maps.newHashMap();
|
||||
nextJcMap.put("01、02","03、04");
|
||||
|
@ -140,6 +146,7 @@ public class KcZhihuijiaoshiController extends JeecgController<KcZhihuijiaoshi,
|
|||
//下一节次
|
||||
|
||||
});
|
||||
log.info("04: {}",timer.intervalRestart());
|
||||
//补充进下一节次里
|
||||
kcJieciMap.forEach((k,v) -> {
|
||||
if(nextJcMap.containsKey(k)){
|
||||
|
@ -149,6 +156,7 @@ public class KcZhihuijiaoshiController extends JeecgController<KcZhihuijiaoshi,
|
|||
//}
|
||||
}
|
||||
});
|
||||
log.info("05: {}",timer.intervalRestart());
|
||||
|
||||
QueryWrapper<KcKetangbiao> ktqw = new QueryWrapper<>();
|
||||
ktqw.eq("skrq",nowStr);
|
||||
|
@ -158,6 +166,8 @@ public class KcZhihuijiaoshiController extends JeecgController<KcZhihuijiaoshi,
|
|||
ktqw.isNotNull("jsbh");
|
||||
List<KcKetangbiao> kcKetangbiaoList = kcKetangbiaoService.list(ktqw);
|
||||
|
||||
log.info("06: {}",timer.intervalRestart());
|
||||
|
||||
starTime = starTime.offset(DateField.DAY_OF_MONTH,1);//明天
|
||||
// String nowStr2 = starTime.toString("yyyy-MM-dd");
|
||||
|
||||
|
@ -165,10 +175,12 @@ public class KcZhihuijiaoshiController extends JeecgController<KcZhihuijiaoshi,
|
|||
nextDayKtqw.eq("hh","01、02");//明天的只查01、02这个节次的
|
||||
// nextDayKtqw.apply("skrq >= STR_TO_DATE('"+nowStr2+"', '%Y-%m-%d')");
|
||||
// nextDayKtqw.apply("skrq < DATE_ADD(STR_TO_DATE('"+nowStr2+"','%Y-%m-%d'),INTERVAL 1 DAY)");
|
||||
ktqw.eq("skrq",nowStr);
|
||||
ktqw.isNotNull("jsbh");
|
||||
nextDayKtqw.eq("skrq",nowStr);
|
||||
nextDayKtqw.isNotNull("jsbh");
|
||||
List<KcKetangbiao> nextDayKcKetangbiaoList = kcKetangbiaoService.list(nextDayKtqw);
|
||||
|
||||
log.info("07: {}",timer.intervalRestart());
|
||||
|
||||
//根据节次信息包装进Map
|
||||
Map<String, String> kcKetangbiaoNowSet = Maps.newHashMap();
|
||||
Map<String, String> kcKetangbiaoNextSet = Maps.newHashMap();
|
||||
|
@ -191,6 +203,8 @@ public class KcZhihuijiaoshiController extends JeecgController<KcZhihuijiaoshi,
|
|||
});
|
||||
}
|
||||
|
||||
log.info("08: {}",timer.intervalRestart());
|
||||
|
||||
//计算哪节在时间范围内
|
||||
|
||||
//装填到数据里
|
||||
|
@ -215,6 +229,7 @@ public class KcZhihuijiaoshiController extends JeecgController<KcZhihuijiaoshi,
|
|||
x.setJsNum(StringUtils.defaultString(info.getJsNum(),"0"));
|
||||
}
|
||||
});
|
||||
log.info("09: {}",timer.intervalRestart());
|
||||
return pageList;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue