|
@@ -4,6 +4,7 @@ import com.welampiot.common.BaseResult;
|
|
|
import com.welampiot.common.InterfaceResultEnum;
|
|
|
import com.welampiot.dto.*;
|
|
|
import com.welampiot.service.*;
|
|
|
+import com.welampiot.utils.ExcelUtil;
|
|
|
import com.welampiot.utils.ToolUtils;
|
|
|
import com.welampiot.vo.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -69,25 +70,60 @@ public class AlarmController {
|
|
|
*/
|
|
|
@RequestMapping(value = "getList", method = RequestMethod.POST)
|
|
|
public BaseResult<?> getList(HttpServletRequest request) {
|
|
|
- int version = (int) toolUtils.getRequestContent(request,"version",1);
|
|
|
- int status = (int) toolUtils.getRequestContent(request,"status",1);
|
|
|
- int devType = (int) toolUtils.getRequestContent(request,"devType",1);
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer status = (Integer) toolUtils.getRequestContent(request,"status",1);
|
|
|
+ Integer devType = (Integer) toolUtils.getRequestContent(request,"devType",1);
|
|
|
+ Integer areaId = (Integer) toolUtils.getRequestContent(request,"areaId",1);
|
|
|
+ Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
|
|
|
+ Integer download = (Integer) toolUtils.getRequestContent(request,"download",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);
|
|
|
|
|
|
AllAlarmInfoLogVO allAlarmInfoLogVO = new AllAlarmInfoLogVO();
|
|
|
allAlarmInfoLogVO.setVersion(version);
|
|
|
- allAlarmInfoLogVO.setOffset(count * (page - 1));
|
|
|
- allAlarmInfoLogVO.setLimit(count);
|
|
|
allAlarmInfoLogVO.setStatus(status);
|
|
|
allAlarmInfoLogVO.setDevType(devType);
|
|
|
allAlarmInfoLogVO.setKeyword(keyword);
|
|
|
+ allAlarmInfoLogVO.setAreaId(areaId);
|
|
|
+ allAlarmInfoLogVO.setSectionId(sectionId);
|
|
|
allAlarmInfoLogVO.setSectionList(toolUtils.getSectionList(request));
|
|
|
- List<AllAlarmInfoLogDTO> allAlarmInfoLogList = allAlarmInfoLogService.getListByAllAlarmInfoLogVO(allAlarmInfoLogVO);
|
|
|
+ if (download == 0) {
|
|
|
+ allAlarmInfoLogVO.setOffset(count * (page - 1));
|
|
|
+ allAlarmInfoLogVO.setLimit(count);
|
|
|
+ }
|
|
|
+ List<AllAlarmInfoLogDTO> alarmList ;
|
|
|
List<AllAlarmInfoLogDTO> list = new ArrayList<>();
|
|
|
+ switch (devType) {
|
|
|
+ case 5:
|
|
|
+ alarmList = allAlarmInfoLogService.getElectricBoxAlarmListByVO(allAlarmInfoLogVO);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ alarmList = allAlarmInfoLogService.getWaterImmersionAlarmListByVO(allAlarmInfoLogVO);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ alarmList = allAlarmInfoLogService.getManholeAlarmListByVO(allAlarmInfoLogVO);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ alarmList = allAlarmInfoLogService.getLampPoleAlarmListByVO(allAlarmInfoLogVO);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ alarmList = allAlarmInfoLogService.getLampAlarmListByVO(allAlarmInfoLogVO);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ List<AllAlarmInfoLogDTO> eleBoxList = allAlarmInfoLogService.getElectricBoxAlarmListByVO(allAlarmInfoLogVO);
|
|
|
+ List<AllAlarmInfoLogDTO> waterList = allAlarmInfoLogService.getWaterImmersionAlarmListByVO(allAlarmInfoLogVO);
|
|
|
+ List<AllAlarmInfoLogDTO> lampPoleList = allAlarmInfoLogService.getLampPoleAlarmListByVO(allAlarmInfoLogVO);
|
|
|
+ List<AllAlarmInfoLogDTO> lampList = allAlarmInfoLogService.getLampAlarmListByVO(allAlarmInfoLogVO);
|
|
|
+ List<AllAlarmInfoLogDTO> manholeList = allAlarmInfoLogService.getManholeAlarmListByVO(allAlarmInfoLogVO);
|
|
|
+ // 将配电箱、水浸、灯杆、路灯、井盖合并成一个列表
|
|
|
+ alarmList = Stream.of(eleBoxList, waterList, lampPoleList, lampList, manholeList)
|
|
|
+ .flatMap(Collection::stream)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ break;
|
|
|
+ }
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- allAlarmInfoLogList.forEach(allAlarmInfoLogDTO -> {
|
|
|
+ alarmList.forEach(allAlarmInfoLogDTO -> {
|
|
|
if (allAlarmInfoLogDTO.getArea() == null) {
|
|
|
allAlarmInfoLogDTO.setArea("");
|
|
|
}
|
|
@@ -134,6 +170,51 @@ public class AlarmController {
|
|
|
allAlarmInfoLogVO1.setUnTreatedCount(allAlarmInfoLogService.getUnTreatedCountByStatus(allAlarmInfoLogVO));
|
|
|
allAlarmInfoLogVO1.setProcessingCount(allAlarmInfoLogService.getProcessingCountByStatus(allAlarmInfoLogVO));
|
|
|
allAlarmInfoLogVO1.setHandleCount(allAlarmInfoLogService.getHandleCountByStatus(allAlarmInfoLogVO));
|
|
|
+ if (download == 1) {
|
|
|
+ String title;
|
|
|
+ if (version == 0) {
|
|
|
+ title = "序号,设备编号,设备名称,设备类型,行政区,路段,故障类型,故障状态,更新时间";
|
|
|
+ } else if (version == 1) {
|
|
|
+ title = "Serial Number,Device Number,Device Name,Device Type,District," +
|
|
|
+ "Road Section,Fault Type,Fault Status,Update Time";
|
|
|
+ } else {
|
|
|
+ title = "Порядковый номер,номер оборудования,название оборудования,тип оборудования," +
|
|
|
+ "административный район,участок дороги, ип неисправности,состояние неисправности,время обновления";
|
|
|
+ }
|
|
|
+ List<String> titleList = Arrays.asList(title.split(","));
|
|
|
+ List<List<String>> contentList = new ArrayList<>();
|
|
|
+ for (AllAlarmInfoLogDTO a : list) {
|
|
|
+ List<String> newString = new ArrayList<>();
|
|
|
+ newString.add(0, String.valueOf(list.indexOf(a) + 1));
|
|
|
+ newString.add(1,a.getNumber());
|
|
|
+ newString.add(2,a.getName());
|
|
|
+ if (a.getDevType() == 4) {
|
|
|
+ newString.add(3,"配电箱");
|
|
|
+ } else if (a.getDevType() == 3) {
|
|
|
+ newString.add(3,"水浸");
|
|
|
+ } else if (a.getDevType() == 2) {
|
|
|
+ newString.add(3,"井盖");
|
|
|
+ } else if (a.getDevType() == 1) {
|
|
|
+ newString.add(3,"灯杆");
|
|
|
+ } else {
|
|
|
+ newString.add(3,"路灯");
|
|
|
+ }
|
|
|
+ newString.add(4,a.getArea());
|
|
|
+ newString.add(5,a.getSection());
|
|
|
+ newString.add(6,a.getStrAlarmType());
|
|
|
+ if (a.getStatus() == 2) {
|
|
|
+ newString.add(7,"已处理");
|
|
|
+ } else if (a.getStatus() == 1) {
|
|
|
+ newString.add(7,"进行中");
|
|
|
+ } else {
|
|
|
+ newString.add(7,"未处理");
|
|
|
+ }
|
|
|
+ newString.add(8,a.getUpdateTime());
|
|
|
+ contentList.add(list.indexOf(a),newString);
|
|
|
+ }
|
|
|
+ String path = ExcelUtil.outExcel(titleList, contentList);
|
|
|
+ allAlarmInfoLogVO1.setPath(path);
|
|
|
+ }
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,allAlarmInfoLogVO1);
|
|
|
}
|
|
|
|
|
@@ -182,19 +263,22 @@ public class AlarmController {
|
|
|
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 download = (Integer) toolUtils.getRequestContent(request,"download",1);
|
|
|
String keyword = (String) toolUtils.getRequestContent(request,"keyword",2);
|
|
|
Integer devType = (Integer) toolUtils.getRequestContent(request,"devType",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"));
|
|
|
|
|
|
AllAlarmInfoLogVO vo = new AllAlarmInfoLogVO();
|
|
|
- vo.setLimit(count * (page - 1));
|
|
|
- vo.setOffset(count);
|
|
|
vo.setSectionId(sectionId);
|
|
|
vo.setAreaId(areaId);
|
|
|
vo.setKeyword(keyword);
|
|
|
vo.setVersion(version);
|
|
|
vo.setSectionList(toolUtils.getSectionList(request));
|
|
|
+ if (download == 0) {
|
|
|
+ vo.setLimit(count * (page - 1));
|
|
|
+ vo.setOffset(count);
|
|
|
+ }
|
|
|
List<AllAlarmInfoLogDTO> alarmList;
|
|
|
List<AllAlarmInfoLogDTO> list = new ArrayList<>();
|
|
|
Integer total;
|
|
@@ -261,6 +345,51 @@ public class AlarmController {
|
|
|
AllAlarmInfoLogVO allAlarmInfoLogVO = new AllAlarmInfoLogVO();
|
|
|
allAlarmInfoLogVO.setList(list);
|
|
|
allAlarmInfoLogVO.setTotal((int) Math.ceil(total / Double.parseDouble(String.valueOf(count))));
|
|
|
+ if (download == 1) {
|
|
|
+ String title;
|
|
|
+ if (version == 0) {
|
|
|
+ title = "序号,设备编号,设备名称,设备类型,行政区,路段,故障类型,故障状态,更新时间";
|
|
|
+ } else if (version == 1) {
|
|
|
+ title = "Serial Number,Device Number,Device Name,Device Type,District," +
|
|
|
+ "Road Section,Fault Type,Fault Status,Update Time";
|
|
|
+ } else {
|
|
|
+ title = "Порядковый номер,номер оборудования,название оборудования,тип оборудования," +
|
|
|
+ "административный район,участок дороги, ип неисправности,состояние неисправности,время обновления";
|
|
|
+ }
|
|
|
+ List<String> titleList = Arrays.asList(title.split(","));
|
|
|
+ List<List<String>> contentList = new ArrayList<>();
|
|
|
+ for (AllAlarmInfoLogDTO a : list) {
|
|
|
+ List<String> newString = new ArrayList<>();
|
|
|
+ newString.add(0, String.valueOf(list.indexOf(a) + 1));
|
|
|
+ newString.add(1,a.getNumber());
|
|
|
+ newString.add(2,a.getName());
|
|
|
+ if (a.getDevType() == 4) {
|
|
|
+ newString.add(3,"配电箱");
|
|
|
+ } else if (a.getDevType() == 3) {
|
|
|
+ newString.add(3,"水浸");
|
|
|
+ } else if (a.getDevType() == 2) {
|
|
|
+ newString.add(3,"井盖");
|
|
|
+ } else if (a.getDevType() == 1) {
|
|
|
+ newString.add(3,"灯杆");
|
|
|
+ } else {
|
|
|
+ newString.add(3,"路灯");
|
|
|
+ }
|
|
|
+ newString.add(4,a.getArea());
|
|
|
+ newString.add(5,a.getSection());
|
|
|
+ newString.add(6,a.getStrAlarmType());
|
|
|
+ if (a.getStatus() == 2) {
|
|
|
+ newString.add(7,"已处理");
|
|
|
+ } else if (a.getStatus() == 1) {
|
|
|
+ newString.add(7,"进行中");
|
|
|
+ } else {
|
|
|
+ newString.add(7,"未处理");
|
|
|
+ }
|
|
|
+ newString.add(8,a.getUpdateTime());
|
|
|
+ contentList.add(list.indexOf(a),newString);
|
|
|
+ }
|
|
|
+ String path = ExcelUtil.outExcel(titleList, contentList);
|
|
|
+ allAlarmInfoLogVO.setPath(path);
|
|
|
+ }
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,allAlarmInfoLogVO);
|
|
|
}
|
|
|
|