|
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -58,6 +59,8 @@ public class NewLampPoleController {
|
|
|
private LampInfoLogService lampInfoLogService;
|
|
|
@Autowired
|
|
|
private LampPoleAlarmLogService lampPoleAlarmLogService;
|
|
|
+ @Autowired
|
|
|
+ private LampInfoLogNewService lampInfoLogNewService;
|
|
|
|
|
|
@RequestMapping(value = "/info",method = RequestMethod.POST)
|
|
|
public BaseResult info(HttpServletRequest request){
|
|
@@ -729,4 +732,102 @@ public class NewLampPoleController {
|
|
|
listResponseVO.setList(gWRSDevDTOS);
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,listResponseVO);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 照明设备列表
|
|
|
+ * @param request 路段筛选,分页,关键字搜索
|
|
|
+ * @return 照明设备列表
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/lampList",method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> lampList(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer areaId = (Integer) toolUtils.getRequestContent(request,"areaId",1);
|
|
|
+ Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
|
|
|
+ Integer online = (Integer) toolUtils.getRequestContent(request,"online",1);
|
|
|
+ String keyword = (String) toolUtils.getRequestContent(request,"keyword",2);
|
|
|
+ int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
|
|
|
+ int count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
|
|
|
+
|
|
|
+ LampVO lampVO = new LampVO();
|
|
|
+ lampVO.setOnline(online);
|
|
|
+ lampVO.setVersion(version);
|
|
|
+ lampVO.setAreaId(areaId);
|
|
|
+ lampVO.setSectionId(sectionId);
|
|
|
+ lampVO.setKeyword(keyword);
|
|
|
+ lampVO.setPage(page);
|
|
|
+ lampVO.setCount(count);
|
|
|
+ lampVO.setSectionList(toolUtils.getSectionList(request));
|
|
|
+ List<LampInfoDTO> lampList = lampService.getLampList(lampVO);
|
|
|
+ List<LampInfoDTO> list = new ArrayList<>();
|
|
|
+ lampList.forEach(dto -> {
|
|
|
+ if (dto.getArea() == null) {
|
|
|
+ dto.setArea("");
|
|
|
+ }
|
|
|
+ if (dto.getSection() == null) {
|
|
|
+ dto.setSection("");
|
|
|
+ }
|
|
|
+ if (dto.getLampPoleName() == null) {
|
|
|
+ dto.setLampPoleName("");
|
|
|
+ }
|
|
|
+ if (dto.getPolicyName() == null) {
|
|
|
+ dto.setPolicyName("");
|
|
|
+ }
|
|
|
+ if (dto.getServerTime() == null) {
|
|
|
+ dto.setServerTime("");
|
|
|
+ }
|
|
|
+ list.add(dto);
|
|
|
+ });
|
|
|
+ Integer lampTotal = lampService.getLampTotal(lampVO);
|
|
|
+ LampVO lampVO1 = new LampVO();
|
|
|
+ lampVO1.setList(list);
|
|
|
+ lampVO1.setTotal(lampTotal);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampVO1);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 照明数据概览
|
|
|
+ * @param request sectionList、areaId、sectionId
|
|
|
+ * @return lampDataVO
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/lampInfo", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> lampInfo(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
|
|
|
+ Integer areaId = (Integer) toolUtils.getRequestContent(request, "areaId", 1);
|
|
|
+ Integer sectionId = (Integer) toolUtils.getRequestContent(request, "sectionId", 1);
|
|
|
+
|
|
|
+ LampInfoDTO lampInfoDTO = new LampInfoDTO();
|
|
|
+ lampInfoDTO.setAreaId(areaId);
|
|
|
+ lampInfoDTO.setSectionId(sectionId);
|
|
|
+ lampInfoDTO.setSectionList(toolUtils.getSectionList(request));
|
|
|
+ Integer lampInstallTotal = lampService.getLampInstallTotalByDTO(lampInfoDTO);
|
|
|
+ Integer lampOnlineTotal = lampService.getLampOnlineTotalByDTO(lampInfoDTO);
|
|
|
+ Integer lampFaultTotal = lampService.getLampFaultTotalByDTO(lampInfoDTO);
|
|
|
+ Integer lampLightTotal = lampService.getLampLightTotalByDTO(lampInfoDTO);
|
|
|
+ LampInfoLogNewDTO sumEle = lampInfoLogNewService.getSumEleByDTO(lampInfoDTO);
|
|
|
+ LampInfoLogNewDTO todayEle = lampInfoLogNewService.getTodayEleByDTO(lampInfoDTO);
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
|
|
+ String formatConDayEle,formatConSumEle;
|
|
|
+ Float daySumEle,conSumEle;
|
|
|
+ if (todayEle != null) {
|
|
|
+ daySumEle = Float.parseFloat(todayEle.getSumDayGeneraEnergy());
|
|
|
+ formatConDayEle = decimalFormat.format(daySumEle);
|
|
|
+ } else {
|
|
|
+ daySumEle = 0f;
|
|
|
+ formatConDayEle = "0";
|
|
|
+ }
|
|
|
+ if (sumEle != null) {
|
|
|
+ conSumEle = Float.parseFloat(sumEle.getSumTotalGeneraEnergy()) + daySumEle;
|
|
|
+ } else {
|
|
|
+ conSumEle = 0 + daySumEle;
|
|
|
+ }
|
|
|
+ formatConSumEle = decimalFormat.format(conSumEle);
|
|
|
+ LampDataVO lampDataVO = new LampDataVO();
|
|
|
+ lampDataVO.setInstallCount(lampInstallTotal);
|
|
|
+ lampDataVO.setOnlineCount(lampOnlineTotal);
|
|
|
+ lampDataVO.setFaultCount(lampFaultTotal);
|
|
|
+ lampDataVO.setLightingCount(lampLightTotal);
|
|
|
+ lampDataVO.setConSumEle(formatConSumEle);
|
|
|
+ lampDataVO.setConDayEle(formatConDayEle);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampDataVO);
|
|
|
+ }
|
|
|
}
|