|
@@ -3,9 +3,12 @@ package com.welampiot.controller;
|
|
|
import com.welampiot.common.BaseResult;
|
|
|
import com.welampiot.common.InterfaceResultEnum;
|
|
|
import com.welampiot.dto.ManholeDTO;
|
|
|
+import com.welampiot.dto.TiltDevDTO;
|
|
|
import com.welampiot.service.ManholeService;
|
|
|
+import com.welampiot.service.TiltDevService;
|
|
|
import com.welampiot.utils.ToolUtils;
|
|
|
import com.welampiot.vo.ManholeVO;
|
|
|
+import com.welampiot.vo.TiltDevVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -36,6 +39,9 @@ public class ManholeController {
|
|
|
@Autowired
|
|
|
private ToolUtils toolUtils;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TiltDevService tiltDevService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取井盖设备统计信息
|
|
|
* @param request
|
|
@@ -183,4 +189,99 @@ public class ManholeController {
|
|
|
}
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取倾斜设备监测列表
|
|
|
+ * @param request 请求参数
|
|
|
+ * @return tiltDevVO
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "tiltList", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> tiltList(HttpServletRequest request) {
|
|
|
+ int version = (int) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
|
|
|
+ int count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
|
|
|
+ String keyword = (String) toolUtils.getRequestContent(request,"keyword",2);
|
|
|
+
|
|
|
+ TiltDevDTO tiltDevDTO = new TiltDevDTO();
|
|
|
+ tiltDevDTO.setPage(count * (page - 1));
|
|
|
+ tiltDevDTO.setCount(count);
|
|
|
+ tiltDevDTO.setKeyword(keyword);
|
|
|
+ tiltDevDTO.setSectionList(toolUtils.getSectionList(request));
|
|
|
+
|
|
|
+ TiltDevVO tiltDevVO = tiltDevService.getTiltDevByDTO(tiltDevDTO);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,tiltDevVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取倾斜监测设备统计数据
|
|
|
+ * @param request 请求数据
|
|
|
+ * @return vo
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "tiltData", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> tiltData(HttpServletRequest request) {
|
|
|
+ int version = (int) toolUtils.getRequestContent(request,"version",1);
|
|
|
+
|
|
|
+ TiltDevDTO tiltDevDTO = new TiltDevDTO();
|
|
|
+ tiltDevDTO.setSectionList(toolUtils.getSectionList(request));
|
|
|
+
|
|
|
+ TiltDevVO vo = tiltDevService.getTiltData(tiltDevDTO);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除倾斜监测设备
|
|
|
+ * @param request id
|
|
|
+ * @return 操作成功
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "tiltDel", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> tiltDel(HttpServletRequest request) {
|
|
|
+ int version = (int) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ String id = request.getParameter("id");
|
|
|
+ if (id == null || id.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+ String[] split = id.split(",");
|
|
|
+ for (String tiltId : split) {
|
|
|
+ int l = Integer.parseInt(tiltId);
|
|
|
+ tiltDevService.deleteTiltDevById(l);
|
|
|
+ }
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑倾斜监测设备
|
|
|
+ * @param request 要编辑的监测设备的属性
|
|
|
+ * @return 更新数据
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "tiltSave", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> tiltSave(HttpServletRequest request) {
|
|
|
+ int version = (int) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ int id = (int) toolUtils.getRequestContent(request,"id",1);
|
|
|
+ if (id == 0) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
|
|
|
+ int protocolType = (int) toolUtils.getRequestContent(request,"protocolType",1);
|
|
|
+ if (String.valueOf(protocolType).length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_PROTOCOL_TYPE_ERROR,version);
|
|
|
+ String address = request.getParameter("address");
|
|
|
+ if (address == null || address.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_TILT_ADDRESS_ERROR,version);
|
|
|
+ int port = (int) toolUtils.getRequestContent(request,"port",1);
|
|
|
+ String simNumber = request.getParameter("simNumber");
|
|
|
+ if (protocolType == 2 && (simNumber == null || simNumber.length() == 0)) {
|
|
|
+ return toolUtils.response(InterfaceResultEnum.LACK_SIM_NUMBER_ERROR,version);
|
|
|
+ }
|
|
|
+ String macNumber = request.getParameter("macNumber");
|
|
|
+ if ((protocolType == 1 || protocolType == 2) && (macNumber == null || macNumber.length() == 0)) {
|
|
|
+ return toolUtils.response(InterfaceResultEnum.LACK_MAC_NUMBER_ERROR,version);
|
|
|
+ }
|
|
|
+
|
|
|
+ TiltDevDTO dto = new TiltDevDTO();
|
|
|
+ dto.setId(id);
|
|
|
+ dto.setProtocolType(protocolType);
|
|
|
+ dto.setAddress(address);
|
|
|
+ dto.setPort(port);
|
|
|
+ dto.setSimNumber(simNumber);
|
|
|
+ dto.setMacNumber(macNumber);
|
|
|
+ if (protocolType == 0 || protocolType == 2) {
|
|
|
+ if (tiltDevService.findByTiltDTO(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.TILT_ADDRESS_UNIQUE_ERROR,version);
|
|
|
+ }
|
|
|
+ tiltDevService.updateTiltDataByDTO(dto);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
}
|