|
@@ -39,6 +39,12 @@ public class LampController {
|
|
@Autowired
|
|
@Autowired
|
|
private LampService lampService;
|
|
private LampService lampService;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private LampInfoLogService lampInfoLogService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private LampInfoLogNewService lampInfoLogNewService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private LampInfoCacheByDayService lampInfoCacheByDayService;
|
|
|
|
+ @Autowired
|
|
private ToolUtils toolUtils;
|
|
private ToolUtils toolUtils;
|
|
@Autowired
|
|
@Autowired
|
|
private NetworkService networkService;
|
|
private NetworkService networkService;
|
|
@@ -1783,4 +1789,49 @@ public class LampController {
|
|
lampPoleVO.setList(lampPoleList);
|
|
lampPoleVO.setList(lampPoleList);
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleVO);
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleVO);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 灯控亮灯时长统计
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping(value = "/getLampLightTime", method = RequestMethod.POST)
|
|
|
|
+ public BaseResult<?> lampPoleData(LampVO lampVO) {
|
|
|
|
+ Integer version = lampVO.getVersion();
|
|
|
|
+ if (lampVO.getId() == null || lampVO.getId() == 0)
|
|
|
|
+ return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR, version);
|
|
|
|
+ LampInfoLogDTO nowDayDTO = lampInfoLogService.getNowDayLampInfoLog(lampVO.getId());
|
|
|
|
+ LampInfoLogDTO beforeDTO = lampInfoLogService.getBeforeTodayLampInfoLog(lampVO.getId());
|
|
|
|
+
|
|
|
|
+ LampLogVO lampLogVO = new LampLogVO();
|
|
|
|
+ if (nowDayDTO != null && beforeDTO != null) {
|
|
|
|
+ int nowLightTime = nowDayDTO.getWorkTimeTotal() - beforeDTO.getWorkTimeTotal();
|
|
|
|
+ nowLightTime = Math.max(nowLightTime, 0);
|
|
|
|
+ nowLightTime = Math.min(nowLightTime, 1440);
|
|
|
|
+ lampLogVO.setDayLightTime(nowLightTime);
|
|
|
|
+ } else if (nowDayDTO != null) {
|
|
|
|
+ lampLogVO.setDayLightTime(nowDayDTO.getWorkTimeTotal());
|
|
|
|
+ } else {
|
|
|
|
+ lampLogVO.setDayLightTime(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ LampInfoLogNewDTO newestLampInfoLog = lampInfoLogNewService.getNewestLampInfoLog(lampVO.getId());
|
|
|
|
+ if (newestLampInfoLog != null) {
|
|
|
|
+ lampLogVO.setTotalLightTime(Long.valueOf(newestLampInfoLog.getWorkTimeTotal()));
|
|
|
|
+ } else {
|
|
|
|
+ lampLogVO.setTotalLightTime(0L);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ LampInfoCacheByDayDTO sumMonth = lampInfoCacheByDayService.getSumMonthByLampId(lampVO.getId());
|
|
|
|
+ LampInfoCacheByDayDTO sumYear = lampInfoCacheByDayService.getSumYearByLampId(lampVO.getId());
|
|
|
|
+ if (sumMonth != null) {
|
|
|
|
+ lampLogVO.setMonthLightTime(sumMonth.getLightTime());
|
|
|
|
+ } else {
|
|
|
|
+ lampLogVO.setMonthLightTime(0L);
|
|
|
|
+ }
|
|
|
|
+ if (sumYear != null) {
|
|
|
|
+ lampLogVO.setYearLightTime(sumYear.getLightTime());
|
|
|
|
+ } else {
|
|
|
|
+ lampLogVO.setYearLightTime(0L);
|
|
|
|
+ }
|
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS, version, lampLogVO);
|
|
|
|
+ }
|
|
}
|
|
}
|