Procházet zdrojové kódy

基础平台接口

zhj před 2 roky
rodič
revize
d55a7dd54d

+ 281 - 0
src/main/java/com/welampiot/controller/BasePlatformController.java

@@ -0,0 +1,281 @@
+package com.welampiot.controller;
+
+import com.welampiot.common.BaseResult;
+import com.welampiot.common.InterfaceResultEnum;
+import com.welampiot.dto.*;
+import com.welampiot.service.*;
+import com.welampiot.utils.ToolUtils;
+import com.welampiot.utils.WeatherUtil;
+import com.welampiot.vo.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+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.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * ClassName: BasePlatformController
+ * Package: com.welampiot.controller
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/9/6 - 16:10
+ * @Version: v1.0
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/basePlatform")
+public class BasePlatformController {
+    @Autowired
+    private ToolUtils toolUtils;
+    @Autowired
+    private LampPoleService lampPoleService;
+    @Autowired
+    private LampInfoLogNewService lampInfoLogNewService;
+    @Autowired
+    private OperationLogService operationLogService;
+    @Autowired
+    private UserService userService;
+    @Autowired
+    private WifiInfoLogService wifiInfoLogService;
+
+    /**
+     * 基础平台全局概览
+     * @param request sectionList
+     * @return 全局概览
+     */
+    @RequestMapping(value = "/data", method = RequestMethod.POST)
+    public BaseResult<?> data(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
+        List<?> sectionList = toolUtils.getSectionList(request);
+        LampInfoDTO lampInfoDTO = new LampInfoDTO();
+        lampInfoDTO.setSectionList(sectionList);
+        LampInfoLogNewDTO sumEleByDTO = lampInfoLogNewService.getSumEleByDTO(lampInfoDTO);
+        LampPoleVO lampPoleVO = new LampPoleVO();
+        lampPoleVO.setSectionList(sectionList);
+        Integer lampPoleAlarmTotal = lampPoleService.getLampPoleAlarmTotal(lampPoleVO); // 灯杆故障数
+        Integer lampPoleCount = lampPoleService.getLampPoleInstallTotal(lampPoleVO); // 灯杆总数
+        LampPoleDTO lampPoleDTO = new LampPoleDTO();
+        lampPoleDTO.setSectionList(sectionList);
+        LampPoleInfoVO lampPoleDevCount = lampPoleService.getLampPoleDevCount(lampPoleDTO);
+        lampPoleDevCount.setCarRoadCount(0); // 车路协同数量
+        lampPoleDevCount.setTrafficLightCount(0); // 交通灯数量
+        lampPoleDevCount.setFiveGCount(0); // 5G基站数量
+        lampPoleDevCount.setScreenCount(lampPoleDevCount.getLedCount()); // 屏幕数量
+        lampPoleDevCount.setEmCount(lampPoleDevCount.getOneKeyCount()); // 一键报警数量
+        lampPoleDevCount.setLampPoleAlarmCount(lampPoleAlarmTotal); // 故障数
+        lampPoleDevCount.setLampPoleCount(lampPoleCount); // 灯杆数
+        lampPoleDevCount.setCloudCount(lampPoleDevCount.getWifiCount()); // 云盒数
+        DecimalFormat decimalFormat = new DecimalFormat("0.00");
+        if (sumEleByDTO == null) { // 累计用电量、累计省电量
+            lampPoleDevCount.setTotalCom(0f);
+            lampPoleDevCount.setTotalSave(0f);
+        } else {
+            String totalEleSave = sumEleByDTO.getSumTotalEleSave();
+            String totalEle = sumEleByDTO.getSumTotalGeneraEnergy();
+            String save = decimalFormat.format(Float.parseFloat(totalEleSave));
+            String ele = decimalFormat.format(Float.parseFloat(totalEle));
+            lampPoleDevCount.setTotalCom(Float.parseFloat(save));
+            lampPoleDevCount.setTotalSave(Float.parseFloat(ele));
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleDevCount);
+    }
+
+    /**
+     * 基础平台智慧合杆
+     * @param request sectionList
+     * @return 智慧合杆
+     */
+    @RequestMapping(value = "/lampPoleData", method = RequestMethod.POST)
+    public BaseResult<?> lampPoleData(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
+        String username = (String) toolUtils.getRequestContent(request, "username", 2);
+        List<?> sectionList = toolUtils.getSectionList(request);
+        LampInfoDTO lampInfoDTO = new LampInfoDTO();
+        lampInfoDTO.setSectionList(sectionList);
+        LampInfoLogNewDTO sumEleByDTO = lampInfoLogNewService.getSumEleByDTO(lampInfoDTO);
+        LampPoleVO lampPoleVO = new LampPoleVO();
+        lampPoleVO.setSectionList(sectionList);
+        Integer lampPoleAlarmTotal = lampPoleService.getLampPoleAlarmTotal(lampPoleVO); // 灯杆故障数
+        Integer lampPoleCount = lampPoleService.getLampPoleInstallTotal(lampPoleVO); // 灯杆总数
+        LampPoleDTO lampPoleDTO = new LampPoleDTO();
+        lampPoleDTO.setSectionList(sectionList);
+        LampPoleInfoVO lampPoleDevCount = lampPoleService.getLampPoleDevCount(lampPoleDTO);
+        lampPoleDevCount.setCarRoadCount(0); // 车路协同数量
+        lampPoleDevCount.setTrafficLightCount(0); // 交通灯数量
+        lampPoleDevCount.setFiveGCount(0); // 5G基站数量
+        lampPoleDevCount.setScreenCount(lampPoleDevCount.getLedCount()); // 屏幕数量
+        lampPoleDevCount.setEmCount(lampPoleDevCount.getOneKeyCount()); // 一键报警数量
+        lampPoleDevCount.setLampPoleAlarmCount(lampPoleAlarmTotal); // 故障数
+        lampPoleDevCount.setLampPoleCount(lampPoleCount); // 灯杆数
+        lampPoleDevCount.setCloudCount(lampPoleDevCount.getWifiCount()); // 云盒数
+        DecimalFormat decimalFormat = new DecimalFormat("0.00");
+        if (sumEleByDTO == null) { // 累计用电量、累计省电量
+            lampPoleDevCount.setTotalCom(0f);
+            lampPoleDevCount.setTotalSave(0f);
+        } else {
+            String totalEleSave = sumEleByDTO.getSumTotalEleSave();
+            String totalEle = sumEleByDTO.getSumTotalGeneraEnergy();
+            String save = decimalFormat.format(Float.parseFloat(totalEleSave));
+            String ele = decimalFormat.format(Float.parseFloat(totalEle));
+            lampPoleDevCount.setTotalCom(Float.parseFloat(save));
+            lampPoleDevCount.setTotalSave(Float.parseFloat(ele));
+        }
+
+        // 事件监控
+        UserDTO userDTO = userService.queryUserIdByUsername(username);
+        if (userDTO == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
+        OperationLogVO operationLogVO = new OperationLogVO();
+        operationLogVO.setUserId(userDTO.getId());
+        operationLogVO.setRole(userDTO.getRole());
+        List<OperationLogDTO> logList = operationLogService.getLessOperationLogList(operationLogVO);
+        lampPoleDevCount.setActionList(logList);
+
+        // 故障列表
+        List<LampPoleDTO> lampPoleAlarmInfoList = lampPoleService.getLampPoleAlarmInfoList(lampPoleVO);
+        lampPoleDevCount.setAlarmList(lampPoleAlarmInfoList);
+
+        // 灯杆列表
+        List<LampPoleDTO> list = lampPoleService.getNewLampPoleList3(lampPoleVO);
+        for (LampPoleDTO dto : list) {
+            if (dto.getDevType() != null && !dto.getDevType().isEmpty()) {
+                String devType = dto.getDevType();
+                int length = devType.split(",").length;
+                dto.setDevCount(length);
+            } else {
+                dto.setDevCount(0);
+            }
+            if (dto.getAlarmStatus() != null && dto.getAlarmStatus() == 2) {
+                dto.setStatus(0);
+            } else if (dto.getAlarmStatus() != null && dto.getAlarmStatus() != 2) {
+                dto.setStatus(1);
+            }
+        }
+        lampPoleDevCount.setLampPoleList(list);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleDevCount);
+    }
+
+    /**
+     * 基础平台灯杆详情
+     * @param request id
+     * @return 灯杆详情
+     */
+    @RequestMapping(value = "/lampPoleDetails", method = RequestMethod.POST)
+    public BaseResult<?> lampPoleDetails(HttpServletRequest request) throws Exception {
+        Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
+        Integer id = (Integer) toolUtils.getRequestContent(request, "id", 1);
+        if (id == null) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+
+        // 故障列表
+        List<LampPoleDTO> alarmList = lampPoleService.getLampPoleAlarmListByLampPoleId(id);
+        // 灯控列表
+        List<LampPoleDTO> lampList = lampPoleService.getLampListByLampPoleId(id);
+        // 灯杆详情
+        LampPoleDTO dto = lampPoleService.getNewLampPoleDetailsById(id);
+        if (dto == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
+
+        LampPoleDetailVO lampPoleDetailVO = new LampPoleDetailVO();
+        // 气象信息
+        String longitude = dto.getLongitude();
+        String latitude = dto.getLatitude();
+        WeatherDTO weatherInfo = WeatherUtil.getNowWeatherInfo(longitude, latitude);
+        lampPoleDetailVO.setWeatherInfo(weatherInfo);
+        // 音柱当前播放的节目
+        lampPoleDetailVO.setBroadcastPro(dto.getBroadcastPro());
+        // 音柱当前播放节目的id
+        lampPoleDetailVO.setProgramId(dto.getProgramId());
+        // 音柱id
+        lampPoleDetailVO.setBroadcastId(dto.getBroadcastId());
+        // 当天流量
+        lampPoleDetailVO.setDayFlow(dto.getDayFlow());
+        // 故障列表
+        lampPoleDetailVO.setAlarmList(alarmList);
+        // 灯控列表
+        lampPoleDetailVO.setLampList(lampList);
+        // 摄像头
+        VideoMonitorDTO videoMonitorDTO = new VideoMonitorDTO();
+        videoMonitorDTO.setId(dto.getVideoId());
+        videoMonitorDTO.setVideoAddress(dto.getVideoAddress());
+        lampPoleDetailVO.setVideo(videoMonitorDTO);
+        // 屏幕
+        ScreenDTO screenDTO = new ScreenDTO();
+        screenDTO.setId(dto.getScreenId());
+        screenDTO.setName(dto.getProgramName());
+        screenDTO.setStatus(dto.getScreenStatus());
+        screenDTO.setLight(dto.getLight());
+        screenDTO.setVolume(dto.getVolume());
+        screenDTO.setMaxLight(dto.getMaxLight());
+        screenDTO.setPlayingId(dto.getPlayingId());
+        screenDTO.setScreenImage(dto.getImage());
+        lampPoleDetailVO.setScreen(screenDTO);
+        // 充电桩
+        ChargeDTO chargeDTO = new ChargeDTO();
+        chargeDTO.setOnline(dto.getChargeOnline());
+        chargeDTO.setStatus(dto.getChargeStatus());
+        chargeDTO.setEquipmentElectricity(dto.getEquipmentElectricity());
+        if (dto.getBillAmt() != null) {
+            chargeDTO.setBillAmt(Float.parseFloat(dto.getBillAmt()));
+        }
+        lampPoleDetailVO.setCharge(chargeDTO);
+        // 流量列表
+        List<Object> dateList = new ArrayList<>();
+        List<Object> flowList = new ArrayList<>();
+        long l = System.currentTimeMillis();
+        long startTime = l - 24 * 3600 * 1000 * 14;
+        HashMap<String, Integer> objectObjectHashMap = new HashMap<>();
+        long timeT = startTime;
+        int i = 0;
+
+        DecimalFormat decimalFormat = new DecimalFormat("0.00");
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
+        SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        while (timeT < l) {
+            objectObjectHashMap.put(simpleDateFormat.format(new Date(timeT)), i);
+            dateList.add(simpleDateFormat.format(new Date(timeT)));
+            flowList.add(0);
+            timeT += 3600 * 1000;
+            i++;
+        }
+
+        int dayNumber = 1;
+        WifiInfoLogDTO wifiInfoLogDTO = new WifiInfoLogDTO();
+        wifiInfoLogDTO.setDayNum(7);
+        wifiInfoLogDTO.setDayNumber(dayNumber);
+        wifiInfoLogDTO.setLampPoleId(id);
+        List<WifiInfoLogDTO> wifiInfoLogList = wifiInfoLogService.getWifiStatisticsListByDTO(wifiInfoLogDTO);
+        for (WifiInfoLogDTO dto1 : wifiInfoLogList) {
+            Date date = new Date(simpleDateFormat2.parse(dto.getUpdateTime()).getTime());
+            String s = simpleDateFormat.format(date);
+            long time = simpleDateFormat.parse(s).getTime();
+            String formatStart = simpleDateFormat.format(startTime);
+            startTime = simpleDateFormat.parse(formatStart).getTime();
+            long timespan = (time - startTime) / (3600 * 1000 * dayNumber);
+            long newTime = startTime + timespan * (3600 * 1000 * dayNumber);
+            date = new Date(newTime);
+            s = simpleDateFormat.format(date);
+            Integer integer = null;
+            if (objectObjectHashMap.containsKey(s)) {
+                integer = objectObjectHashMap.get(s);
+            }
+
+            if (dto1.getMinFlow() != null && !dto1.getMinFlow().equals("0") && integer != null &&
+                    dto1.getMaxFlow() != null && !dto1.getMaxFlow().equals("0")) {
+                Float flow = Float.parseFloat(dto1.getMaxFlow()) - Float.parseFloat(dto1.getMinFlow());
+                flowList.set(integer,Float.parseFloat(decimalFormat.format(flow)));
+            }
+        }
+        WifiInfoLogVO wifiInfoLogVO = new WifiInfoLogVO();
+        wifiInfoLogVO.setDate(dateList);
+        wifiInfoLogVO.setFlow(flowList);
+        lampPoleDetailVO.setFlowList(wifiInfoLogVO);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleDetailVO);
+    }
+}

+ 4 - 0
src/main/java/com/welampiot/dao/LampPoleDao.java

@@ -50,7 +50,11 @@ public interface LampPoleDao {
     LampInfoLogNewDTO getComBySectionList(LampPoleVO lampPoleVO);
     void updateLampPoleIcon(LampPoleDTO dto);
     List<LampPoleDTO> getNewLampPoleList2(LampPoleVO vo);
+    List<LampPoleDTO> getNewLampPoleList3(LampPoleVO vo);
     LampPoleDTO getLampPoleDetails(LampPoleVO vo);
     List<LampPoleDTO> getLampPoleDevList(LampPoleVO vo);
     List<LampPoleDTO> getLampPoleAlarmInfoList(LampPoleVO vo);
+    List<LampPoleDTO> getLampPoleAlarmListByLampPoleId(@Param("lampPoleId") Integer lampPoleId);
+    LampPoleDTO getNewLampPoleDetailsById(@Param("id") Integer id);
+    List<LampPoleDTO> getLampListByLampPoleId(@Param("lampPoleId") Integer lampPoleId);
 }

+ 2 - 0
src/main/java/com/welampiot/dao/OperationLogDao.java

@@ -22,4 +22,6 @@ public interface OperationLogDao {
     List<OperationLogDTO> getOperationLogList(OperationLogVO vo);
     int add(OperationLogDTO operationLogDTO);
     List<OperationLogDTO> getNewOperationLogList(OperationLogVO vo);
+
+    List<OperationLogDTO> getLessOperationLogList(OperationLogVO vo);
 }

+ 12 - 1
src/main/java/com/welampiot/dto/LampPoleDTO.java

@@ -9,6 +9,7 @@ import java.util.Map;
 public class LampPoleDTO {
     private Integer id;
     private String name;
+    private String alarmTypeStr; // 故障内容
     private String number;
     private String longitude;
     private String latitude;
@@ -97,7 +98,7 @@ public class LampPoleDTO {
     private String rtmpHd; // 高清播放地址
     private String proName;
     private Integer light;
-    private String screenId;
+    private Integer screenId;
     private String time;
     private Integer broadcastId;
     private String voltage;
@@ -118,4 +119,14 @@ public class LampPoleDTO {
     private Integer LED6;
     private Integer LED7;
     private Integer LED8;
+    private Integer chargeOnline;
+    private Integer programId;
+    private String videoAddress;
+    private String programName;
+    private Integer playingId;
+    private Integer screenStatus;
+    private Integer maxLight;
+    private Integer volume;
+    private String broadcastPro;
+    private Float equipmentElectricity; // 累计充电量
 }

+ 2 - 0
src/main/java/com/welampiot/dto/ScreenDTO.java

@@ -146,6 +146,8 @@ public class ScreenDTO implements Serializable {
 
     private String widthHeight;
 
+    private String screenImage; // 屏幕截屏图片
+
     private List<Integer> sectionList;
 
     private Integer page;

+ 1 - 0
src/main/java/com/welampiot/dto/VideoMonitorDTO.java

@@ -70,4 +70,5 @@ public class VideoMonitorDTO {
     private String channelId;
     private String rtmp2;
     private String rtmpHD2;
+    private String videoAddress;
 }

+ 3 - 0
src/main/java/com/welampiot/dto/WeatherDTO.java

@@ -19,4 +19,7 @@ public class WeatherDTO {
     private String aqi; // 空气质量指数
     private String level; // 空气质量水平
     private String category; // 空气质量等级
+    private String tempMax; // 最高气温
+    private String tempMin; // 最低气温
+    private String updateTime;
 }

+ 4 - 0
src/main/java/com/welampiot/service/LampPoleService.java

@@ -40,8 +40,12 @@ public interface LampPoleService {
     LampInfoLogNewDTO getComBySectionList(LampPoleVO lampPoleVO);
     void updateLampPoleIcon(LampPoleDTO dto);
     List<LampPoleDTO> getNewLampPoleList2(LampPoleVO vo);
+    List<LampPoleDTO> getNewLampPoleList3(LampPoleVO vo);
     LampPoleDTO getLampPoleDetails(LampPoleVO vo);
     List<LampPoleDTO> getLampPoleDevList(LampPoleVO vo);
     List<LampPoleDTO> getLampPoleAlarmInfoList(LampPoleVO vo);
     LampPoleInfoVO getLampPoleDevCount(LampPoleDTO dto);
+    List<LampPoleDTO> getLampPoleAlarmListByLampPoleId(Integer lampPoleId);
+    LampPoleDTO getNewLampPoleDetailsById(Integer id);
+    List<LampPoleDTO> getLampListByLampPoleId(Integer lampPoleId);
 }

+ 1 - 0
src/main/java/com/welampiot/service/OperationLogService.java

@@ -15,4 +15,5 @@ public interface OperationLogService {
     List<OperationLogDTO> getOperationLogList(OperationLogVO vo);
     int add(OperationLogDTO operationLogDTO);
     List<OperationLogDTO> getNewOperationLogList(OperationLogVO vo);
+    List<OperationLogDTO> getLessOperationLogList(OperationLogVO vo);
 }

+ 20 - 0
src/main/java/com/welampiot/service/impl/LampPoleServiceImpl.java

@@ -529,6 +529,11 @@ public class LampPoleServiceImpl implements LampPoleService {
         return lampPoleDao.getNewLampPoleList2(vo);
     }
 
+    @Override
+    public List<LampPoleDTO> getNewLampPoleList3(LampPoleVO vo) {
+        return lampPoleDao.getNewLampPoleList3(vo);
+    }
+
     @Override
     public LampPoleDTO getLampPoleDetails(LampPoleVO vo) {
         return lampPoleDao.getLampPoleDetails(vo);
@@ -567,6 +572,21 @@ public class LampPoleServiceImpl implements LampPoleService {
         return lampPoleInfoVO;
     }
 
+    @Override
+    public List<LampPoleDTO> getLampPoleAlarmListByLampPoleId(Integer lampPoleId) {
+        return lampPoleDao.getLampPoleAlarmListByLampPoleId(lampPoleId);
+    }
+
+    @Override
+    public LampPoleDTO getNewLampPoleDetailsById(Integer id) {
+        return lampPoleDao.getNewLampPoleDetailsById(id);
+    }
+
+    @Override
+    public List<LampPoleDTO> getLampListByLampPoleId(Integer lampPoleId) {
+        return lampPoleDao.getLampListByLampPoleId(lampPoleId);
+    }
+
     @Override
     public Integer getAlarmCountByVO(LampPoleCountVO lampPoleCountVO) {
         return lampPoleDao.getAlarmCountByVO(lampPoleCountVO);

+ 5 - 0
src/main/java/com/welampiot/service/impl/OperationLogServiceImpl.java

@@ -120,4 +120,9 @@ public class OperationLogServiceImpl implements OperationLogService {
     public List<OperationLogDTO> getNewOperationLogList(OperationLogVO vo) {
         return operationLogDao.getNewOperationLogList(vo);
     }
+
+    @Override
+    public List<OperationLogDTO> getLessOperationLogList(OperationLogVO vo) {
+        return operationLogDao.getLessOperationLogList(vo);
+    }
 }

+ 20 - 0
src/main/java/com/welampiot/utils/WeatherUtil.java

@@ -2,6 +2,7 @@ package com.welampiot.utils;
 
 import com.welampiot.dto.WeatherDTO;
 import lombok.Data;
+import org.json.JSONArray;
 import org.json.JSONObject;
 import org.springframework.http.HttpMethod;
 import org.springframework.web.client.RestTemplate;
@@ -37,6 +38,7 @@ public class WeatherUtil {
      * @throws Exception 异常
      */
     public static WeatherDTO getNowWeatherInfo(String longitude, String latitude) throws Exception {
+        // 实时天气
         String url = "https://devapi.qweather.com/v7/weather/now?location=" + longitude + "," + latitude +
                 "&key=2dca03c7d95c442ba8fbce9d7a96db78";
         RestTemplate restTemplate = new RestTemplate();
@@ -53,6 +55,24 @@ public class WeatherUtil {
         weatherDTO.setIcon(icon);
         weatherDTO.setText(text);
 
+        // 未来3天天气
+        url = "https://devapi.qweather.com/v7/weather/3d?location=" + longitude + "," + latitude +
+                "&key=2dca03c7d95c442ba8fbce9d7a96db78";
+        restTemplate = new RestTemplate();
+        byte[] oResult2 = restTemplate.exchange(url, HttpMethod.GET, null, byte[].class).getBody();
+        String unGZipResult2 = unGZip(oResult2);
+
+        JSONObject jsonObject2 = new JSONObject(unGZipResult2);
+        JSONArray daily = jsonObject2.getJSONArray("daily");
+        JSONObject object2 = daily.getJSONObject(0);
+        String fxDate = object2.getString("fxDate"); // 更新日期
+        String tempMax = object2.getString("tempMax"); // 当天最高气温
+        String tempMin = object2.getString("tempMin"); // 当天最低气温
+        weatherDTO.setTempMax(tempMax);
+        weatherDTO.setTempMin(tempMin);
+        weatherDTO.setUpdateTime(fxDate);
+
+        // 实时空气指数
         url = "https://devapi.qweather.com/v7/air/now?location=" + longitude + "," + latitude +
                 "&key=2dca03c7d95c442ba8fbce9d7a96db78";
         restTemplate = new RestTemplate();

+ 38 - 0
src/main/java/com/welampiot/vo/LampPoleDetailVO.java

@@ -0,0 +1,38 @@
+package com.welampiot.vo;
+
+import com.welampiot.dto.*;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * ClassName: LampPoleDetailVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/9/7 - 14:18
+ * @Version: v1.0
+ */
+@Data
+public class LampPoleDetailVO {
+    private String broadcastPro; // 音柱当前节目
+    private Integer programId; // 音柱当前节目id
+    private Integer broadcastId; // 音柱id
+
+    private String dayFlow; // 当天流量
+
+    private List<LampPoleDTO> lampList; // 灯控列表
+
+    private VideoMonitorDTO video; // 摄像头
+
+    private ScreenDTO screen; // 屏幕
+
+    private WeatherDTO weatherInfo; // 气象信息
+
+    private ChargeDTO charge; // 充电桩
+
+    private List<LampPoleDTO> alarmList; // 故障列表
+
+    private WifiInfoLogVO flowList; // 流量统计图
+}

+ 17 - 3
src/main/java/com/welampiot/vo/LampPoleInfoVO.java

@@ -1,7 +1,11 @@
 package com.welampiot.vo;
 
+import com.welampiot.dto.LampPoleDTO;
+import com.welampiot.dto.OperationLogDTO;
 import lombok.Data;
 
+import java.util.List;
+
 @Data
 public class LampPoleInfoVO {
     private String name;
@@ -15,10 +19,12 @@ public class LampPoleInfoVO {
     private Integer rfidCount;
     private Integer newCount;
     private Integer disableCount;
-    private float dayCom;
-    private float monthCom;
-    private float totalCom;
+    private Float dayCom;
+    private Float monthCom;
+    private Float totalCom;
+    private Float totalSave;
     private Integer lampCount;
+    private Integer lampPoleCount;
     private Integer videoCount;
     private Integer weatherCount;
     private Integer wifiCount;
@@ -36,4 +42,12 @@ public class LampPoleInfoVO {
     private Integer oneKeyCount;
     private Integer lineCount;
     private Integer ledCount;
+    private Integer trafficLightCount; // 交通灯数量
+    private Integer lampPoleAlarmCount; // 故障数
+    private Integer fiveGCount; // 5G基站数量
+    private Integer carRoadCount; // 车路协同数量
+    private Integer cloudCount; // 云盒数量
+    private List<OperationLogDTO> actionList; // 事件监控
+    private List<LampPoleDTO> alarmList; // 故障列表
+    private List<LampPoleDTO> lampPoleList; // 灯杆列表
 }

+ 3 - 0
src/main/java/com/welampiot/vo/WifiInfoLogVO.java

@@ -35,6 +35,9 @@ public class WifiInfoLogVO implements Serializable {
     /** 数据单位(0kb,1mb,2gb) **/
     private Integer formType;
 
+    private List<Object> date;
+    private List<Object> flow;
+
     private List<Object> onlineCountList; // 人数列表
 
     private List<Object> flowList; // 使用流量列表

+ 72 - 3
src/main/resources/mapper/LampPoleMapper.xml

@@ -913,9 +913,16 @@
         left join global_location gl on gl.id = s.pid
         left join lampinfo l on lp.id = l.lamp_pole_id
         left join wifi w on lp.id = w.lamp_pole_id
-        left join network n on l.networkid = n.id
-        LEFT JOIN all_alarm_info_log AS a ON a.lampid = lp.id and a.devType = 1
-        where 1=1
+        left join network n on l.networkid = n.id,
+        (SELECT t1.*
+        FROM all_alarm_info_log t1,
+        (SELECT lampid,
+        max(updatetime) AS maxtime
+        FROM all_alarm_info_log
+        GROUP BY lampid) t2
+        WHERE t1.lampid = t2.lampid
+        AND t1.updatetime = t2.maxtime) AS a
+        where a.lampid = lp.id and a.devType = 1
         <if test="sectionList != null and !sectionList.isEmpty()">
             and lp.sectionid in 
             <foreach collection="sectionList" item="item" open="(" separator="," close=")">
@@ -1095,5 +1102,67 @@
             and lp.sectionid = #{sectionId}
         </if>
     </select>
+
+    <select id="getNewLampPoleList3" resultType="LampPoleDTO">
+        select lp.id,lp.name,s.name as section,lp.devtype as devType,a.status as alarmStatus
+        from lamp_pole lp
+        left join section s on s.id = lp.sectionid,
+        (SELECT t1.*
+        FROM all_alarm_info_log t1,
+        (SELECT lampid,
+        max(updatetime) AS maxtime
+        FROM all_alarm_info_log
+        GROUP BY lampid) t2
+        WHERE t1.lampid = t2.lampid
+        AND t1.updatetime = t2.maxtime) as  a
+        where a.devType = 1 and a.lampid = lp.id
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and lp.sectionid in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="areaId != null and areaId != 0">
+            and lp.areaid = #{areaId}
+        </if>
+        <if test="sectionId != null and sectionId != 0">
+            and lp.sectionid = #{sectionId}
+        </if>
+    </select>
+
+    <!-- 单个灯杆的故障列表 -->
+    <select id="getLampPoleAlarmListByLampPoleId" resultType="LampPoleDTO">
+        select a.stralarmtype as alarmTypeStr,a.updatetime as updataTime,a.status
+        from all_alarm_info_log a
+        where a.devType = 1 and a.lampid = #{lampPoleId}
+    </select>
+
+    <!-- 灯杆详情 -->
+    <select id="getNewLampPoleDetailsById" resultType="LampPoleDTO">
+        select lp.id,c.online as chargeOnline,c.status as chargeStatus,c.equipmentElectricity,c.bill_amt as billAmt,
+               s.id as screenId,s.status as screenStatus,s.light,s.volume,s.maxLight,s.playingid as playingId,
+               p.name as programName,vm.image,vm.id as videoId,vm.address as videoAddress,b.id as broadcastId,b.itemId as programId,
+               bi.name as broadcastPro,w.day_flow as dayFlow,lp.latitude,lp.longitude
+        from lamp_pole lp
+        left join wifi w on lp.id = w.lamp_pole_id
+        left join charge c on lp.id = c.lamp_pole_id
+        left join screen s on lp.id = s.lamp_pole_id
+        left join video_monitor vm on vm.lamp_pole_id = lp.id
+        left join program p on s.playingid = p.id
+        left join broadcast b on lp.id = b.lamp_pole_id
+        left join broadcast_item bi on b.itemId = bi.id
+        where lp.id = #{id}
+    </select>
+
+    <!-- 灯杆列表 -->
+    <select id="getLampListByLampPoleId" resultType="LampPoleDTO">
+        select l.lighteness,l.number,l2.total_gener_energy_cache as usedEnergyTotal,l2.total_ele_save_cache as powerSave,
+               l2.work_time_total as workTimeTotal
+        from lampinfo l
+        left join lamp_info_log_new l2 on l.id = l2.lampid
+        left join policy p on l.policyid = p.id
+        left join lamp_pole lp on l.lamp_pole_id = lp.id
+        where lp.id = #{lampPoleId}
+    </select>
     
 </mapper>

+ 11 - 0
src/main/resources/mapper/OperationLogMapper.xml

@@ -159,4 +159,15 @@
         limit 100
     </select>
 
+    <select id="getLessOperationLogList" resultType="com.welampiot.dto.OperationLogDTO" parameterType="com.welampiot.vo.OperationLogVO">
+        select o.time as updateTime,o.remark as logInfo,o.acount as `name`
+        from operation_log o
+        where 1=1
+        <if test="role != 1">
+            and o.userid = #{userId}
+        </if>
+        order by o.time desc
+        limit 50
+    </select>
+
 </mapper>