|
@@ -1,8 +1,8 @@
|
|
|
package com.welampiot.controller;
|
|
|
|
|
|
import com.welampiot.common.BaseResult;
|
|
|
+import com.welampiot.common.DevInfoEnum;
|
|
|
import com.welampiot.common.InterfaceResultEnum;
|
|
|
-import com.welampiot.dto.GWRSDevDTO;
|
|
|
import com.welampiot.dto.*;
|
|
|
import com.welampiot.service.*;
|
|
|
import com.welampiot.utils.ExcelUtil;
|
|
@@ -66,6 +66,10 @@ public class NewLampPoleController {
|
|
|
private VideoMonitorService videoMonitorService;
|
|
|
@Autowired
|
|
|
private AllAlarmInfoLogService allAlarmInfoLogService;
|
|
|
+ @Autowired
|
|
|
+ private LampPoleSnService lampPoleSnService;
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
|
|
|
@RequestMapping(value = "/info",method = RequestMethod.POST)
|
|
|
public BaseResult info(HttpServletRequest request){
|
|
@@ -885,40 +889,13 @@ public class NewLampPoleController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/GWRS485DevList",method = RequestMethod.POST)
|
|
|
- public BaseResult GWRS485DevList(HttpServletRequest request) {
|
|
|
+ public BaseResult<?> GWRS485DevList(HttpServletRequest request) {
|
|
|
Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
- ArrayList<GWRSDevDTO> gWRSDevDTOS = new ArrayList<>();
|
|
|
- GWRSDevDTO gWRSDevDTO = new GWRSDevDTO();
|
|
|
- gWRSDevDTO.setId(1);
|
|
|
- gWRSDevDTO.setName("百叶箱 X 6");
|
|
|
- gWRSDevDTOS.add(gWRSDevDTO);
|
|
|
- gWRSDevDTO = new GWRSDevDTO();
|
|
|
- gWRSDevDTO.setId(2);
|
|
|
- gWRSDevDTO.setName("风向");
|
|
|
- gWRSDevDTOS.add(gWRSDevDTO);
|
|
|
- gWRSDevDTO = new GWRSDevDTO();
|
|
|
- gWRSDevDTO.setId(3);
|
|
|
- gWRSDevDTO.setName("风速");
|
|
|
- gWRSDevDTOS.add(gWRSDevDTO);
|
|
|
- gWRSDevDTO = new GWRSDevDTO();
|
|
|
- gWRSDevDTO.setId(4);
|
|
|
- gWRSDevDTO.setName("雨量");
|
|
|
- gWRSDevDTOS.add(gWRSDevDTO);
|
|
|
- gWRSDevDTO = new GWRSDevDTO();
|
|
|
- gWRSDevDTO.setId(5);
|
|
|
- gWRSDevDTO.setName("太阳辐射");
|
|
|
- gWRSDevDTOS.add(gWRSDevDTO);
|
|
|
- gWRSDevDTO = new GWRSDevDTO();
|
|
|
- gWRSDevDTO.setId(6);
|
|
|
- gWRSDevDTO.setName("百叶箱 X 10");
|
|
|
- gWRSDevDTOS.add(gWRSDevDTO);
|
|
|
- gWRSDevDTO = new GWRSDevDTO();
|
|
|
- gWRSDevDTO.setId(7);
|
|
|
- gWRSDevDTO.setName("超声波风速风向");
|
|
|
- gWRSDevDTOS.add(gWRSDevDTO);
|
|
|
- ListResponseVO listResponseVO = new ListResponseVO();
|
|
|
- listResponseVO.setList(gWRSDevDTOS);
|
|
|
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,listResponseVO);
|
|
|
+ List<DevInfoEnum> enumList = ToolUtils.addAllEnum();
|
|
|
+ List<DevEnumVO> list = ToolUtils.getDevEnum(enumList, version);
|
|
|
+ DevEnumVO devEnumVO = new DevEnumVO();
|
|
|
+ devEnumVO.setList(list);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,devEnumVO);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1185,4 +1162,32 @@ public class NewLampPoleController {
|
|
|
lampPoleVO1.setFaultCount(lampPoleAlarmTotal);
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleVO1);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 云盒sn批量授权接口
|
|
|
+ * @param request sn
|
|
|
+ * @return 云盒sn批量授权接口
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/registerSn", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> registerSn(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
|
|
|
+ String username = (String) toolUtils.getRequestContent(request, "username", 2);
|
|
|
+ String sn = (String) toolUtils.getRequestContent(request, "sn", 2);
|
|
|
+ if (username.length() == 0 || sn.length() == 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+ UserDTO userDTO = userService.queryUserIdByUsername(username);
|
|
|
+ if (userDTO == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
|
|
|
+ if (userDTO.getRole() == 1) {
|
|
|
+ String[] split = sn.split(",");
|
|
|
+ for (String s : split) {
|
|
|
+ LampPoleSnDTO lampPoleSnDTO = new LampPoleSnDTO();
|
|
|
+ lampPoleSnDTO.setSn(s);
|
|
|
+ if (lampPoleSnService.checkLampPoleSnData(lampPoleSnDTO) > 0) continue;
|
|
|
+ lampPoleSnService.addLampPoleSn(lampPoleSnDTO);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return toolUtils.response(InterfaceResultEnum.PERMISSION_DENIED,version);
|
|
|
+ }
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
}
|