|
@@ -5,9 +5,7 @@ import com.welampiot.common.InterfaceResultEnum;
|
|
|
import com.welampiot.dto.*;
|
|
|
import com.welampiot.service.*;
|
|
|
import com.welampiot.utils.ToolUtils;
|
|
|
-import com.welampiot.vo.AlarmRepairInfoVO;
|
|
|
-import com.welampiot.vo.AllAlarmInfoLogVO;
|
|
|
-import com.welampiot.vo.RepairPersonnelDetailsVO;
|
|
|
+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;
|
|
@@ -17,10 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Collection;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
@@ -58,6 +53,14 @@ public class AlarmController {
|
|
|
private RepairInfoService repairInfoService;
|
|
|
@Autowired
|
|
|
private RepairPersonnelService repairPersonnelService;
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+ @Autowired
|
|
|
+ private GlobalLocationService globalLocationService;
|
|
|
+ @Autowired
|
|
|
+ private SectionService sectionService;
|
|
|
+ @Autowired
|
|
|
+ private SendStatusService sendStatusService;
|
|
|
|
|
|
/**
|
|
|
* 获取告警列表
|
|
@@ -339,4 +342,158 @@ public class AlarmController {
|
|
|
allAlarmInfoLogService.deleteAlarmData(id);
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 区域路段侧边栏列表
|
|
|
+ * @param request 故障id
|
|
|
+ * @return 区域路段侧边栏列表
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/alarmNav", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> alarmNav(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ String username = (String) toolUtils.getRequestContent(request,"username",2);
|
|
|
+ if (username.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+ UserDTO userDTO = userService.getPrivilegeList(username);
|
|
|
+ if (userDTO == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
|
|
|
+ GlobalLocationVO globalLocationVO = new GlobalLocationVO();
|
|
|
+ globalLocationVO.setList(new ArrayList<>());
|
|
|
+ if (userDTO.getZoneList() == null || userDTO.getZoneList().isEmpty()) {
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,globalLocationVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> zones = Arrays.asList(userDTO.getZoneList().split(","));
|
|
|
+ List<SectionDTO> list2;
|
|
|
+ List<GlobalLocationDTO> areaList = globalLocationService.getGlobalList(4, version);
|
|
|
+ List<SectionDTO> sectionList = sectionService.getListByIdList(zones);
|
|
|
+ List<GlobalLocationDTO> countryOfSectionList = globalLocationService.getCountryOfSectionList(1, version);
|
|
|
+ List<GlobalLocationDTO> provinceOfSectionList = globalLocationService.getCountryOfSectionList(2, version);
|
|
|
+ List<GlobalLocationDTO> cityOfSectionList = globalLocationService.getCountryOfSectionList(3, version);
|
|
|
+ areaList = Stream.of(areaList, countryOfSectionList, provinceOfSectionList, cityOfSectionList)
|
|
|
+ .flatMap(Collection::stream)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<GlobalLocationDTO> newAreaList = new ArrayList<>();
|
|
|
+ for (GlobalLocationDTO g : areaList) {
|
|
|
+ list2 = new ArrayList<>();
|
|
|
+ boolean isFlag = false;
|
|
|
+ for (SectionDTO s : sectionList) {
|
|
|
+ if (Objects.equals(g.getId(),s.getPid())) {
|
|
|
+ list2.add(s);
|
|
|
+ isFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isFlag) {
|
|
|
+ GlobalLocationDTO dto = new GlobalLocationDTO();
|
|
|
+ dto.setId(g.getId());
|
|
|
+ dto.setPid(g.getPid());
|
|
|
+ dto.setName(g.getName());
|
|
|
+ dto.setSectionList(list2);
|
|
|
+ newAreaList.add(dto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ globalLocationVO.setList(newAreaList);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,globalLocationVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 推送人员列表
|
|
|
+ * @param request 路段id,用户名
|
|
|
+ * @return 推送人员列表
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/sendUserList", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> sendUserList(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",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"));
|
|
|
+ SendStatusVO sendStatusVO = new SendStatusVO();
|
|
|
+ sendStatusVO.setPage(count * (page - 1));
|
|
|
+ sendStatusVO.setCount(count);
|
|
|
+ sendStatusVO.setSectionList(toolUtils.getSectionList(request));
|
|
|
+ sendStatusVO.setSectionId(sectionId);
|
|
|
+ List<SendStatusDTO> sendPersonList = sendStatusService.getSendPersonList(sendStatusVO);
|
|
|
+ SendStatusVO vo = new SendStatusVO();
|
|
|
+ vo.setList(sendPersonList);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除推送人员
|
|
|
+ * @param request 路段id,推送人员id
|
|
|
+ * @return 删除推送人员
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/delSendUser", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> delSendUser(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
|
|
|
+ Integer id = (Integer) toolUtils.getRequestContent(request,"id",1);
|
|
|
+ if (id == 0 || sectionId == 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+ sendStatusService.deleteSendStatusData(sectionId,id);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加推送人员
|
|
|
+ * @param request 路段id,推送人员id
|
|
|
+ * @return 添加推送人员
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/addSendUser", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> addSendUser(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
|
|
|
+ Integer id = (Integer) toolUtils.getRequestContent(request,"id",1);
|
|
|
+ if (id == 0 || sectionId == 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+ SendStatusDTO sendStatusDTO = new SendStatusDTO();
|
|
|
+ sendStatusDTO.setSectionId(sectionId);
|
|
|
+ sendStatusDTO.setRepairUserid(id);
|
|
|
+ sendStatusService.addSendStatusData(sendStatusDTO);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改推送人员状态
|
|
|
+ * @param request 路段id,推送人员id
|
|
|
+ * @return 修改推送人员状态
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/setSendUserStatus", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> setSendUserStatus(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
|
|
|
+ Integer id = (Integer) toolUtils.getRequestContent(request,"id",1);
|
|
|
+ Integer isPhone = (Integer) toolUtils.getRequestContent(request,"isPhone",1);
|
|
|
+ Integer isEmail = (Integer) toolUtils.getRequestContent(request,"isEmail",1);
|
|
|
+ if (id == 0 || sectionId == 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+ SendStatusDTO sendStatusDTO = new SendStatusDTO();
|
|
|
+ sendStatusDTO.setSectionId(sectionId);
|
|
|
+ sendStatusDTO.setRepairUserid(id);
|
|
|
+ sendStatusDTO.setIsPhone(isPhone);
|
|
|
+ sendStatusDTO.setIsEmail(isEmail);
|
|
|
+ sendStatusService.updateSendStatusData(sendStatusDTO);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 开启关闭推送
|
|
|
+ * @param request 路段id,推送人员id,推送状态
|
|
|
+ * @return 开启关闭推送
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/openCloseStatus", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> openCloseStatus(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
|
|
|
+ Integer id = (Integer) toolUtils.getRequestContent(request,"id",1);
|
|
|
+ Integer status = (Integer) toolUtils.getRequestContent(request,"status",1);
|
|
|
+ if (id == 0 || sectionId == 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+ SendStatusDTO sendStatusDTO = new SendStatusDTO();
|
|
|
+ sendStatusDTO.setSectionId(sectionId);
|
|
|
+ sendStatusDTO.setRepairUserid(id);
|
|
|
+ sendStatusDTO.setStatus(status);
|
|
|
+ sendStatusService.updateCloseStatus(sendStatusDTO);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
}
|