Jelajahi Sumber

增加回路列表、井盖设备列表、广告屏列表、云盒列表、垃圾桶列表的数据导出excel功能

zhj 2 tahun lalu
induk
melakukan
e46487f4d6

+ 129 - 14
src/main/java/com/welampiot/controller/LoopController.java

@@ -4,6 +4,7 @@ import com.welampiot.common.BaseResult;
 import com.welampiot.common.InterfaceResultEnum;
 import com.welampiot.dto.LoopDTO;
 import com.welampiot.service.LoopService;
+import com.welampiot.utils.ExcelUtil;
 import com.welampiot.utils.ToolUtils;
 import com.welampiot.vo.LoopDetailVO;
 import com.welampiot.vo.LoopVO;
@@ -14,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -38,24 +41,136 @@ public class LoopController {
 
     /**
      * 获取回路列表
-     * @param request
-     * @return
+     * @param request 路段筛选,分页
+     * @return 回路列表
      */
     @RequestMapping(value = "/getList", method = RequestMethod.POST)
-    public BaseResult<LoopDTO> getList(HttpServletRequest request){
+    public BaseResult<?> getList(HttpServletRequest request){
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
         Integer id = request.getParameter("id") == null ? 0 : Integer.parseInt(request.getParameter("id"));
-        Integer page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
-        Integer count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
+        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
+        int count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
+        Integer areaId = request.getParameter("areaId") == null ? 0 : Integer.parseInt(request.getParameter("areaId"));
+        Integer sectionId = request.getParameter("sectionId") == null ? 0 : Integer.parseInt(request.getParameter("sectionId"));
+        Integer netStatus = (Integer) toolUtils.getRequestContent(request,"netStatus",1);
+        int download = request.getParameter("download") == null ? 0 : Integer.parseInt(request.getParameter("download"));
         String keyword = request.getParameter("keyword") == null ? "" : request.getParameter("keyword");
 
         LoopDTO loopDTO = new LoopDTO();
+        LoopVO loopList;
         loopDTO.setId(id);
-        loopDTO.setPage(count * (page - 1));
-        loopDTO.setCount(count);
-        loopDTO.setKeyword(keyword);
-        loopDTO.setSectionList(toolUtils.getSectionList(request));
-        LoopVO loopList = loopService.getLoopList(loopDTO);
-        return BaseResult.success(loopList);
+        if (download == 1) {
+            loopDTO.setAreaId(areaId);
+            loopDTO.setVersion(String.valueOf(version));
+            loopDTO.setSectionId(sectionId);
+            loopDTO.setKeyword(keyword);
+            loopDTO.setNetStatus(netStatus);
+            loopDTO.setSectionList(toolUtils.getSectionList(request));
+            loopList = loopService.getLoopList(loopDTO);
+            String title;
+            if (version == 0) {
+                title = "回路名称,回路SN,设备类型,网络状态,区域,路段,分合闸,费率,策略方案," +
+                        "A相电压,A相电流,A相有功功率,B相电压,B相电流,B相有功功率,C相电压,C相电流,C相有功功率,更新日期";
+            } else if (version == 1) {
+                title = "Loop name,Loop SN,Device Type,Network Status,Area,Section,Switching,Rate,Strategy," +
+                        "Phase A voltage,Phase A current,Phase A active power,Phase B voltage,Phase B current," +
+                        "Phase B active power,Phase C voltage,Phase C current,Phase C active power,Update date";
+            } else {
+                title = "Контур назван,контур SN,тип устройств,интернет состоян,карточек,включ,тариф,стратег," +
+                        "а напряжен,а многофазн ток,а активн мощност,б напряжен,б многофазн ток,б активн мощност," +
+                        "C напряжен,C многофазн ток,C активн мощност,обновля дат";
+            }
+            List<String> titleList = Arrays.asList(title.split(","));
+            List<List<String>> contentList = new ArrayList<>();
+            List<LoopDTO> list = loopList.getList();
+            for (LoopDTO l : list) {
+                List<String> newString = new ArrayList<>();
+                newString.add(0,l.getName());
+                newString.add(1,l.getSn());
+                if (l.getDevType() == 1) {
+                    newString.add(2,"三相");
+                } else {
+                    newString.add(2,"单相");
+                }
+                if (l.getNetStatus() == 1) {
+                    newString.add(3,"在线");
+                } else {
+                    newString.add(3,"离线");
+                }
+                newString.add(4,l.getArea());
+                newString.add(5,l.getSection());
+                if (l.getStatus() == 1) {
+                    newString.add(6,"分闸");
+                } else {
+                    newString.add(6,"合闸");
+                }
+                newString.add(7,l.getRate());
+                newString.add(8,l.getPolicyName());
+                if (l.getVolPa() != null) {
+                    newString.add(9,l.getVolPa().toString());
+                } else {
+                    newString.add(9,"0");
+                }
+                if (l.getCurA() != null) {
+                    newString.add(10,l.getCurA().toString());
+                } else {
+                    newString.add(10,"0");
+                }
+                if (l.getInsPa() != null) {
+                    newString.add(11,l.getInsPa().toString());
+                } else {
+                    newString.add(11,"0");
+                }
+                if (l.getVolPb() != null) {
+                    newString.add(12,l.getVolPb().toString());
+                } else {
+                    newString.add(12,"0");
+                }
+                if (l.getCurB() != null) {
+                    newString.add(13,l.getCurB().toString());
+                } else {
+                    newString.add(13,"0");
+                }
+                if (l.getInsPb() != null) {
+                    newString.add(14,l.getInsPb().toString());
+                } else {
+                    newString.add(14,"0");
+                }
+                if (l.getVolPc() != null) {
+                    newString.add(15,l.getVolPc().toString());
+                } else {
+                    newString.add(15,"0");
+                }
+                if (l.getCurC() != null) {
+                    newString.add(16,l.getCurC().toString());
+                } else {
+                    newString.add(16,"0");
+                }
+                if (l.getInsPc() != null) {
+                    newString.add(17,l.getInsPc().toString());
+                } else {
+                    newString.add(17,"0");
+                }
+                newString.add(18,l.getUpdateTime());
+                contentList.add(list.indexOf(l),newString);
+            }
+            String excelPath = ExcelUtil.outExcel(titleList, contentList);
+            loopList.setPath(excelPath);
+        } else {
+            loopDTO.setPage(count * (page - 1));
+            loopDTO.setCount(count);
+            loopDTO.setAreaId(areaId);
+            loopDTO.setVersion(String.valueOf(version));
+            loopDTO.setSectionId(sectionId);
+            loopDTO.setKeyword(keyword);
+            loopDTO.setNetStatus(netStatus);
+            loopDTO.setSectionList(toolUtils.getSectionList(request));
+            loopList = loopService.getLoopList(loopDTO);
+            Integer total = loopList.getTotal();
+            int devTotal = (int) Math.ceil((double) total / count);
+            loopList.setTotal(devTotal);
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,loopList);
     }
 
     /**
@@ -64,9 +179,9 @@ public class LoopController {
      * @return
      */
     @RequestMapping(value = "/details",method = RequestMethod.POST)
-    public BaseResult<LoopDTO> details(HttpServletRequest request){
+    public BaseResult<?> details(HttpServletRequest request){
         Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
-        Integer id = request.getParameter("id") == null ? 0 : Integer.parseInt(request.getParameter("id"));
+        int id = request.getParameter("id") == null ? 0 : Integer.parseInt(request.getParameter("id"));
         if (id == 0) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL, version);
         LoopDetailVO loopDetail = loopService.getLoopDetail(id, version,toolUtils.getSectionList(request));
         if (loopDetail == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
@@ -79,7 +194,7 @@ public class LoopController {
      * @return
      */
     @RequestMapping(value = "/nav", method = RequestMethod.POST)
-    public BaseResult<LoopDTO> nav(HttpServletRequest request){
+    public BaseResult<?> nav(HttpServletRequest request){
         Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
         List sectionList = toolUtils.getSectionList(request);
         if (sectionList == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL, version);

+ 67 - 11
src/main/java/com/welampiot/controller/ManholeController.java

@@ -6,6 +6,7 @@ import com.welampiot.dto.ManholeDTO;
 import com.welampiot.dto.TiltDevDTO;
 import com.welampiot.service.ManholeService;
 import com.welampiot.service.TiltDevService;
+import com.welampiot.utils.ExcelUtil;
 import com.welampiot.utils.ToolUtils;
 import com.welampiot.vo.ManholeVO;
 import com.welampiot.vo.TiltDevVO;
@@ -18,6 +19,9 @@ 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.Arrays;
+import java.util.List;
 
 /**
  * ClassName: ManholeController
@@ -55,25 +59,77 @@ public class ManholeController {
 
     /**
      * 获取井盖设备信息列表
-     * @param request
-     * @return
+     * @param request 路段筛选,分页
+     * @return 井盖设备信息列表
      */
     @RequestMapping(value = "/getList", method = RequestMethod.POST)
-    public BaseResult<ManholeDTO> getList(HttpServletRequest request){
-        int version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
+    public BaseResult<?> getList(HttpServletRequest request){
+        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);
+        Integer online = (Integer) toolUtils.getRequestContent(request,"online",1);
+        String keywords = (String) toolUtils.getRequestContent(request,"keywords",2);
         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 keywords = request.getParameter("keywords") == null ? "" : request.getParameter("keywords");
 
         ManholeDTO dto = new ManholeDTO();
-        dto.setPage(count * (page - 1));
-        dto.setCount(count);
         dto.setKeywords(keywords);
+        dto.setAreaId(areaId);
+        dto.setSectionId(sectionId);
+        dto.setOnline(online);
         dto.setSectionList(toolUtils.getSectionList(request));
-
-        ManholeVO vo = manholeService.getListByDTO(dto, version);
-        if (vo == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
-        return BaseResult.success(vo);
+        ManholeVO vo;
+        if (download == 1) {
+            vo = manholeService.getListByDTO(dto, version);
+            if (vo.getList() == null) {
+                vo.setList(new ArrayList<>());
+            }
+            String title;
+            if (version == 0) {
+                title = "设备名称,ID,地理信息,创建日期,网络状态,倾斜角度,电池电压,报警状态,更新时间";
+            } else if (version == 1) {
+                title = "Device Name,ID,Geographic Information,Creation Date,Network Status," +
+                        "Tilt Angle,Battery Voltage,Alarm Status,Update Time";
+            } else {
+                title = "Имя устройства,ID,географическая информация,интернет состоян,тип сети," +
+                        "угол наклона,напряжение батареи,состояние сигнализации,время обновления";
+            }
+            List<String> titleList = Arrays.asList(title.split(","));
+            List<List<String>> contentList = new ArrayList<>();
+            List<ManholeDTO> list = vo.getList();
+            for (ManholeDTO m : list) {
+                List<String> newString = new ArrayList<>();
+                newString.add(0,m.getName());
+                newString.add(1,m.getAddress());
+                newString.add(2,m.getLocation());
+                newString.add(3,m.getCreateTime());
+                if (m.getOnline() == 1) {
+                    newString.add(4,"在线");
+                } else {
+                    newString.add(4,"离线");
+                }
+                newString.add(5,m.getAngle().toString());
+                newString.add(6,m.getBatteryVol().toString());
+                if (m.getAlarmStatus() == 1) {
+                    newString.add(7,"打开警告");
+                } else {
+                    newString.add(7,"正常");
+                }
+                newString.add(8,m.getUpdateTime());
+                contentList.add(list.indexOf(m),newString);
+            }
+            String path = ExcelUtil.outExcel(titleList, contentList);
+            vo.setPath(path);
+        } else {
+            dto.setPage(count * (page - 1));
+            dto.setCount(count);
+            vo = manholeService.getListByDTO(dto, version);
+            if (vo.getList() == null) {
+                vo.setList(new ArrayList<>());
+            }
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,vo);
     }
 
     /**

+ 142 - 25
src/main/java/com/welampiot/controller/NewLampPoleController.java

@@ -5,6 +5,7 @@ import com.welampiot.common.InterfaceResultEnum;
 import com.welampiot.dto.GWRSDevDTO;
 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;
@@ -154,24 +155,77 @@ public class NewLampPoleController {
 
     /**
      * 获取云盒列表
-     * @param request
-     * @return
+     * @param request 路段筛选,分页
+     * @return 云盒列表
      */
     @RequestMapping(value = "/wifiList", method = RequestMethod.POST)
-    public BaseResult<WifiDTO> wifiList(HttpServletRequest request){
-        Integer page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
-        Integer count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
+    public BaseResult<?> wifiList(HttpServletRequest request){
+        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);
+        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
+        int count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
         Integer online = request.getParameter("online") == null || request.getParameter("online").length() == 0 ? null : Integer.parseInt(request.getParameter("online"));
         String keyword = request.getParameter("keyword") == null ? "" : request.getParameter("keyword");
 
         WifiDTO dto = new WifiDTO();
-        dto.setPage(count * (page - 1));
-        dto.setCount(count);
-        dto.setKeyword(keyword);
-        if (online != null) dto.setOnlineState(online);
-        dto.setSectionList(toolUtils.getSectionList(request));
-        WifiVO vo = wifiService.getWifiList(dto);
-        return BaseResult.success(vo);
+        WifiVO vo;
+        if (download == 1) {
+            dto.setKeyword(keyword);
+            dto.setAreaId(areaId);
+            dto.setSectionId(sectionId);
+            if (online != null) dto.setOnlineState(online);
+            dto.setSectionList(toolUtils.getSectionList(request));
+            vo = wifiService.getWifiList(dto);
+            String title;
+            if (version == 0) {
+                title = "序号,授权SN,网络状态,今日流量,累计流量,WIFI开关,硬件版本,固件版本,所属灯杆,更新时间";
+            } else if (version == 1) {
+                title = "Serial number,Authorization SN,Network Status,Current Traffic,Cumulative Traffic," +
+                        "WIFI Switch,Hardware Version,Firmware Version,Owning Light Pole,Update Time";
+            } else {
+                title = "Порядковый номер,авторизация SN,состояние сети,текущий поток,суммарный трафик," +
+                        "WIFI переключатель,аппаратная версия,прошивка,время обновления";
+            }
+            List<String> titleList = Arrays.asList(title.split(","));
+            List<List<String>> contentList = new ArrayList<>();
+            List<WifiDTO> list = vo.getList();
+            for (WifiDTO w : list) {
+                List<String> newString = new ArrayList<>();
+                newString.add(0,w.getNum());
+                newString.add(1,w.getSn());
+                if (w.getOnline() == 1) {
+                    newString.add(2,"在线");
+                } else {
+                    newString.add(2,"离线");
+                }
+                newString.add(3,w.getDayFlow().toString());
+                newString.add(4,w.getFlow().toString());
+                if (w.getStatus() == 1) {
+                    newString.add(5,"开");
+                } else {
+                    newString.add(5,"关");
+                }
+                newString.add(6,w.getVersion());
+                newString.add(7,w.getFirVersion());
+                newString.add(8,w.getLampPoleName());
+                newString.add(9,w.getUpdateTime());
+                contentList.add(list.indexOf(w),newString);
+            }
+            String path = ExcelUtil.outExcel(titleList, contentList);
+            vo.setPath(path);
+        } else {
+            dto.setPage(count * (page - 1));
+            dto.setCount(count);
+            dto.setKeyword(keyword);
+            dto.setAreaId(areaId);
+            dto.setSectionId(sectionId);
+            if (online != null) dto.setOnlineState(online);
+            dto.setSectionList(toolUtils.getSectionList(request));
+            vo = wifiService.getWifiList(dto);
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,vo);
     }
 
     /**
@@ -418,23 +472,86 @@ public class NewLampPoleController {
 
     /**
      * 获取广告列表
-     * @param request
-     * @return
+     * @param request 路段筛选,分页
+     * @return 广告列表
      */
     @RequestMapping(value = "/screenList", method = RequestMethod.POST)
-    public BaseResult<ScreenDTO> screenList(HttpServletRequest request){
-        Integer page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
-        Integer count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
-        Integer online = request.getParameter("online") == null ? 0 : Integer.parseInt(request.getParameter("online"));
+    public BaseResult<?> screenList(HttpServletRequest request){
+        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);
+        Integer online = (Integer) toolUtils.getRequestContent(request,"online",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"));
 
+        ScreenVO vo;
         ScreenDTO dto = new ScreenDTO();
-        dto.setPage(count * (page - 1));
-        dto.setCount(count);
-        dto.setOnline(online);
-        dto.setSectionList(toolUtils.getSectionList(request));
-
-        ScreenVO vo = screenService.getScreenList(dto);
-        return BaseResult.success(vo);
+        if (download == 1) {
+            dto.setOnline(online);
+            dto.setAreaId(areaId);
+            dto.setSectionId(sectionId);
+            dto.setSectionList(toolUtils.getSectionList(request));
+            vo = screenService.getScreenList(dto);
+            String title;
+            if (version == 0) {
+                title = "名称,序列号,网络状态,开关,亮度值,音量,宽高,所属灯杆,当前节目,电源模式," +
+                        "电压(V),电流(A),功率(W),当天用电(kWh),累计用电(kWh)";
+            } else if (version == 1) {
+                title = "Name,Serial Number,Network Status,Switch,Brightness Values,The Volume," +
+                        "High Wide,Lamp Pole,The Current Program,The Power Supply Mode,Voltage(V)," +
+                        "Current(A),Power(W),The Power Consumption(kWh),Total Power Consumption(kWh)";
+            } else {
+                title = "серийн номер,сет состоян,выключател,яркост,громкост,ширин высок,фонарн столб," +
+                        "текущ шо,питан модел,напряжен(V),ток(а),мощност(W),мощност ден электричеств(квт. ч)," +
+                        "совокупн электричеств(квт. ч)";
+            }
+            List<String> titleList = Arrays.asList(title.split(","));
+            List<List<String>> contentList = new ArrayList<>();
+            List<ScreenDTO> list = vo.getList();
+            for (ScreenDTO s : list) {
+                List<String> newString = new ArrayList<>();
+                newString.add(0,s.getName());
+                newString.add(1,s.getNum());
+                if (s.getNetStatus() == 1) {
+                    newString.add(2,"在线");
+                } else {
+                    newString.add(2,"离线");
+                }
+                if (s.getStatus() == 1) {
+                    newString.add(3,"开");
+                } else {
+                    newString.add(3,"关");
+                }
+                newString.add(4,s.getLight().toString());
+                newString.add(5,s.getVolume().toString());
+                newString.add(6,s.getWidthHeight());
+                newString.add(7,s.getLampPoleName());
+                newString.add(8,s.getProgramName());
+                if (s.getOpenMode() == 1) {
+                    newString.add(9,"自动");
+                } else {
+                    newString.add(9,"手动");
+                }
+                newString.add(10,s.getVoltage().toString());
+                newString.add(11,s.getCurrent().toString());
+                newString.add(12,s.getPower().toString());
+                newString.add(13,s.getDayCom().toString());
+                newString.add(14,s.getTotalCom().toString());
+                contentList.add(list.indexOf(s),newString);
+            }
+            String path = ExcelUtil.outExcel(titleList, contentList);
+            vo.setPath(path);
+        } else {
+            dto.setPage(count * (page - 1));
+            dto.setCount(count);
+            dto.setOnline(online);
+            dto.setAreaId(areaId);
+            dto.setSectionId(sectionId);
+            dto.setSectionList(toolUtils.getSectionList(request));
+            vo = screenService.getScreenList(dto);
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,vo);
     }
 
     /**

+ 70 - 15
src/main/java/com/welampiot/controller/TranshController.java

@@ -4,6 +4,7 @@ import com.welampiot.common.BaseResult;
 import com.welampiot.common.InterfaceResultEnum;
 import com.welampiot.dto.TranshInfoDTO;
 import com.welampiot.service.TranshInfoService;
+import com.welampiot.utils.ExcelUtil;
 import com.welampiot.utils.ToolUtils;
 import com.welampiot.vo.TranshInfoVO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +14,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
 /**
  * ClassName: TranshController
@@ -47,24 +51,74 @@ public class TranshController {
 
     /**
      * 获取设备信息列表
-     * @param request
-     * @return
+     * @param request 路段筛选,分页
+     * @return 设备日志列表
      */
     @RequestMapping(value = "/getList", method = RequestMethod.POST)
-    public BaseResult<TranshInfoDTO> getList(HttpServletRequest request){
-        Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
-        Integer page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
-        Integer count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
+    public BaseResult<?> getList(HttpServletRequest request){
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer download = (Integer) toolUtils.getRequestContent(request,"download",1);
+        Integer areaId = (Integer) toolUtils.getRequestContent(request,"areaId",1);
+        Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
+        Integer online = (Integer) toolUtils.getRequestContent(request,"online",1);
         String keywords = request.getParameter("keywords") == null ? "" : request.getParameter("keywords");
+        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
+        int count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
 
         TranshInfoDTO dto = new TranshInfoDTO();
-        dto.setPage(count * (page - 1));
-        dto.setCount(count);
         dto.setKeywords(keywords);
         dto.setSectionList(toolUtils.getSectionList(request));
-
-        TranshInfoVO transhList = transhInfoService.getTranshList(dto,version);
-        return BaseResult.success(transhList);
+        dto.setAreaId(areaId);
+        dto.setSectionId(sectionId);
+        dto.setOnline(online);
+        TranshInfoVO transhInfoVO;
+        if (download == 1) {
+            transhInfoVO = transhInfoService.getTranshList(dto,version);
+            String title;
+            if (version == 0) {
+                title = "设备名称,ID,地理信息,创建日期,网络状态,注册状态,盖子距离,打开角度,电池电量,报警状态,更新时间";
+            } else if (version == 1) {
+                title = "Device name,ID,Geographic Information,Creation Date,Network Status,Registration Status," +
+                        "Cover Distance,Opening Angle,Battery Level,Alarm Status,Update Time";
+            } else {
+                title = "Имя устройства,ID,географическая информация,дата создания,состояние сети," +
+                        "состояние регистрации,расстояние до крышки,угол,количество электричества от батареи," +
+                        "состояние сигнализации,время обновления";
+            }
+            List<String> titleList = Arrays.asList(title.split(","));
+            List<List<String>> contentList = new ArrayList<>();
+            List<TranshInfoDTO> list = transhInfoVO.getList();
+            for (TranshInfoDTO t : list) {
+                List<String> newString = new ArrayList<>();
+                newString.add(0,t.getName());
+                newString.add(1,t.getDeviceId());
+                newString.add(2,t.getLocation());
+                newString.add(3,t.getCreateTime());
+                if (t.getOnline() == 1) {
+                    newString.add(4,"在线");
+                } else {
+                    newString.add(4,"离线");
+                }
+                if (t.getStatus() == 1) {
+                    newString.add(5,"已注册");
+                } else {
+                    newString.add(5,"未注册");
+                }
+                newString.add(6,t.getDistance().toString());
+                newString.add(7,t.getAngle().toString());
+                newString.add(8,t.getBatT().toString());
+                newString.add(9,t.getAlarmInfo());
+                newString.add(10,t.getUpdateTime());
+                contentList.add(list.indexOf(t),newString);
+            }
+            String path = ExcelUtil.outExcel(titleList, contentList);
+            transhInfoVO.setPath(path);
+        } else {
+            dto.setPage(count * (page - 1));
+            dto.setCount(count);
+            transhInfoVO = transhInfoService.getTranshList(dto,version);
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,transhInfoVO);
     }
 
     /**
@@ -73,8 +127,9 @@ public class TranshController {
      * @return
      */
     @RequestMapping(value = "/historyList", method = RequestMethod.POST)
-    public BaseResult<TranshInfoDTO> historyList(HttpServletRequest request){
-        int id = request.getParameter("id") == null ? 0 : Integer.parseInt(request.getParameter("id"));
+    public BaseResult<?> historyList(HttpServletRequest request){
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer id = (Integer) toolUtils.getRequestContent(request,"id",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"));
 
@@ -84,8 +139,8 @@ public class TranshController {
         dto.setCount(count);
         dto.setSectionList(toolUtils.getSectionList(request));
 
-        TranshInfoVO list = transhInfoService.getHistoryListByDTO(dto);
-        return BaseResult.success(list);
+        TranshInfoVO transhInfoVO = transhInfoService.getHistoryListByDTO(dto);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,transhInfoVO);
     }
 
     /**

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

@@ -204,5 +204,7 @@ public class LoopDTO implements Serializable {
 
     private Integer version1;
 
+    private String rate;
+
     private static final long serialVersionUID = 1L;
 }

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

@@ -140,6 +140,12 @@ public class ScreenDTO implements Serializable {
     /** 屏幕名 **/
     private String name;
 
+    private Integer areaId;
+
+    private Integer sectionId;
+
+    private String widthHeight;
+
     private List<Integer> sectionList;
 
     private Integer page;

+ 10 - 1
src/main/java/com/welampiot/service/impl/LoopServiceImpl.java

@@ -33,7 +33,7 @@ public class LoopServiceImpl implements LoopService {
     public LoopVO getLoopList(LoopDTO dto) {
         LoopVO loopVO = new LoopVO();
         Integer devTotal = loopDao.getTotalBySectionList(dto);//获取设备总数
-        loopVO.setTotal((int)Math.ceil((double)devTotal/dto.getCount()));
+        loopVO.setTotal(devTotal);
         List<LoopDTO> loopList = loopDao.getLoopListByLoopDTO(dto);
         List<LoopDTO> list = new ArrayList<>();
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -41,6 +41,15 @@ public class LoopServiceImpl implements LoopService {
             if (loopDTO.getPolicyId() == null || loopDTO.getPolicyId() == 0){
                 loopDTO.setPolicyName("");
             }
+            if (loopDTO.getArea() == null) {
+                loopDTO.setArea("");
+            }
+            if (loopDTO.getSection() == null) {
+                loopDTO.setSection("");
+            }
+            if (loopDTO.getRate() == null) {
+                loopDTO.setRate("");
+            }
             if (loopDTO.getUpdateTime() != null && !loopDTO.getUpdateTime().equals("")){
                 Date cmdTime;
                 try {

+ 5 - 7
src/main/java/com/welampiot/service/impl/ManholeServiceImpl.java

@@ -59,6 +59,7 @@ public class ManholeServiceImpl implements ManholeService {
     @Override
     public ManholeVO getListByDTO(ManholeDTO dto, Integer version) {
         ManholeVO vo = new ManholeVO();
+        vo.setTotal(manholeDao.getTotalBySectionList(dto.getSectionList()));
         List<ManholeDTO> listByDTO = manholeDao.getListByDTO(dto);
         List<ManholeDTO> list = new ArrayList<>();
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -95,14 +96,14 @@ public class ManholeServiceImpl implements ManholeService {
                         manholeDTO.setUpdateTime("");
                     }
                     //获取设备创建时间
-                    if (manholeDTO.getCreateTime() == null || !manholeDTO.getCreateTime().equals("")){
-                        manholeDTO.setCreateTime("");
-                    }else {
+                    if (manholeDTO.getCreateTime() != null && !manholeDTO.getCreateTime().equals("")){
                         try {
                             manholeDTO.setCreateTime(simpleDateFormat.format(simpleDateFormat.parse(manholeDTO.getCreateTime())));
                         } catch (ParseException e) {
                             throw new RuntimeException(e);
                         }
+                    }else {
+                        manholeDTO.setCreateTime("");
                     }
                     //获取设备安装时间
                     if (manholeDTO.getInstallDate() != null && !manholeDTO.getInstallDate().equals("")){
@@ -171,15 +172,12 @@ public class ManholeServiceImpl implements ManholeService {
                         }
                         manholeDTO.setLocation(manholeDTO.getCity() + " " + manholeDTO.getArea() + " " + manholeDTO.getSection());
                     }
-                    manholeDTO.setTotal(manholeDao.getTotalBySectionList(dto.getSectionList()));
                     list.add(manholeDTO);
                 }
             });
             vo.setList(list);
-            return vo;
-        }else {
-            return null;
         }
+        return vo;
     }
 
     @Override

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

@@ -78,6 +78,7 @@ public class ScreenServiceImpl implements ScreenService {
             }else {
                 screenDTO.setCanCut(0);
             }
+            screenDTO.setWidthHeight(screenDTO.getWidth() + "*" + screenDTO.getHeight());
             //数据更新时间
             if (screenDTO.getUpdateTime() != null && !screenDTO.getUpdateTime().equals("")){
                 Date cmdTime;

+ 8 - 11
src/main/java/com/welampiot/service/impl/TranshInfoServiceImpl.java

@@ -75,16 +75,13 @@ public class TranshInfoServiceImpl implements TranshInfoService {
             }else {
                 transhInfoDTO.setFull(0);
             }
-            //报警状态:0 正常,1 报警(前提是网络在线)
-            if (transhInfoDTO.getOnline() == 1){
-                if (transhInfoDTO.getState() == 1 || transhInfoDTO.getFull() == 1){
-                    transhInfoDTO.setAlarmStatus(1);
-                }else {
-                    transhInfoDTO.setAlarmStatus(0);
-                }
+            if (transhInfoDTO.getState() == 1 || transhInfoDTO.getFull() == 1){
+                transhInfoDTO.setAlarmStatus(1);
+            }else {
+                transhInfoDTO.setAlarmStatus(0);
             }
             //报警信息内容
-            if (transhInfoDTO.getAlarmStatus() != null && transhInfoDTO.getAlarmStatus() == 1){
+            if (transhInfoDTO.getAlarmStatus() == 1){
                 if (transhInfoDTO.getState() == 1 && transhInfoDTO.getFull() == 1){
                     transhInfoDTO.setAlarmInfo("满溢告警,翻盖告警");
                 }else if (transhInfoDTO.getState() == 1 && transhInfoDTO.getFull() == 0){
@@ -92,8 +89,8 @@ public class TranshInfoServiceImpl implements TranshInfoService {
                 }else {
                     transhInfoDTO.setAlarmInfo("满溢告警");
                 }
-            }else if (transhInfoDTO.getAlarmStatus() != null && transhInfoDTO.getAlarmStatus() == 0){
-                transhInfoDTO.setAlarmInfo("");
+            }else {
+                transhInfoDTO.setAlarmInfo("正常");
             }
             //数据更新时间
             if (transhInfoDTO.getUpdateTime() != null && !transhInfoDTO.getUpdateTime().equals("")){
@@ -180,10 +177,10 @@ public class TranshInfoServiceImpl implements TranshInfoService {
                 //组合设备位置名称:城市 + 区域 + 路段
                 transhInfoDTO.setLocation(transhInfoDTO.getCity() + " " + transhInfoDTO.getArea() + " " + transhInfoDTO.getSection());
             }
-            transhInfoDTO.setTotal(transhInfoDao.getTotalBySectionList(dto.getSectionList()));
             list.add(transhInfoDTO);
         });
         vo.setList(list);
+        vo.setTotal(transhInfoDao.getTotalBySectionList(dto.getSectionList()));
         return vo;
     }
 

+ 4 - 1
src/main/java/com/welampiot/vo/LoopVO.java

@@ -1,5 +1,6 @@
 package com.welampiot.vo;
 
+import com.welampiot.dto.LoopDTO;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -19,7 +20,9 @@ public class LoopVO implements Serializable {
     /** 总页数 **/
     private Integer total;
 
-    private List list;
+    private List<LoopDTO> list;
+
+    private String path;
 
     private static final long serialVersionUID = 1L;
 }

+ 2 - 0
src/main/java/com/welampiot/vo/ManholeVO.java

@@ -44,6 +44,8 @@ public class ManholeVO implements Serializable {
     /** 新建设备数 **/
     private Integer newCount;
 
+    private String path;
+
     private List<ManholeDTO> list;
 
     private static final long serialVersionUID = 1L;

+ 2 - 0
src/main/java/com/welampiot/vo/ScreenVO.java

@@ -21,5 +21,7 @@ public class ScreenVO implements Serializable {
 
     private Integer onlineTotal;
 
+    private String path;
+
     private List<ScreenDTO> list;
 }

+ 2 - 0
src/main/java/com/welampiot/vo/TranshInfoVO.java

@@ -43,5 +43,7 @@ public class TranshInfoVO implements Serializable {
 
     private List<TranshInfoDTO> list;
 
+    private String path;
+
     private static final long serialVersionUID = 1L;
 }

+ 2 - 0
src/main/java/com/welampiot/vo/WifiVO.java

@@ -30,6 +30,8 @@ public class WifiVO implements Serializable {
     /** 云盒列表 **/
     private List<WifiDTO> list;
 
+    private String path;
+
     private static final long serialVersionUID = 1L;
 
     private Integer id;

+ 32 - 2
src/main/resources/mapper/LoopMapper.xml

@@ -6,14 +6,44 @@
         select l.id,l.name,l.sn,l.dev_type as devType,l.net_status netStatus,
                l.volPa,l.cura as curA,l.insPa,l.volPb,l.curb as curB,l.insPb,
                l.volPc,l.curc as curC,l.insPc,l.updatetime as updateTime,l.lampcount as lampCount,
-               l.type,l.lock_status lockStatus,l.status,l.policyid as policyId,lp.name as policyName,s.timezone
-        from `loop` l left join loop_policy lp on l.policyid = lp.id left join section s on l.sectionid = s.id
+               l.type,l.lock_status lockStatus,l.status,l.policyid as policyId,lp.name as policyName,s.timezone,
+               r.name as rate,s.name as section
+               <choose>
+                   <when test="version == 0">
+                       ,g.chinese_name as area
+                   </when>
+                   <when test="version == 1">
+                       ,g.english_name as area
+                   </when>
+                   <otherwise>
+                       ,g.ru_name as area
+                   </otherwise>
+               </choose>
+        from `loop` l
+        left join loop_policy lp on l.policyid = lp.id
+        left join section s on l.sectionid = s.id
+        left join global_location g on l.areaid = g.id
+        left join rate r on l.rateid = r.id
         where 1=1 <if test="id != null and id != 0">
                 and l.id = #{id}
             </if>
             <if test="keyword != null and keyword != ''">
                 and (l.name like '%${keyword}%' or l.number like '%${keyword}%')
             </if>
+            <if test="areaId != null and areaId != 0">
+                and l.areaid = #{areaId}
+            </if>
+            <if test="sectionId != null and sectionId != 0">
+                and l.sectionid = #{sectionId}
+            </if>
+            <choose>
+                <when test="netStatus == 1">
+                    and l.net_status = 0
+                </when>
+                <when test="netStatus == 2">
+                    and l.net_status = 1
+                </when>
+            </choose>
             <if test="sectionList != null and !sectionList.isEmpty()">
                 and l.sectionid in
                 <foreach item="dto" collection="sectionList" open="(" separator="," close=")">

+ 15 - 1
src/main/resources/mapper/ManholeMapper.xml

@@ -60,7 +60,7 @@
     <select id="getListByDTO" resultType="com.welampiot.dto.ManholeDTO" parameterType="com.welampiot.dto.ManholeDTO">
         select m.id,m.name,m.areaid as areaId,m.sectionid as sectionId,m.model,m.address,
                m.online,m.angle,m.longitude,m.latitude,m.batteryVol,m.alarmStatus,m.alarmInfo,
-               m.updateTime,m.createTime,m.status,m.install_date installDate,
+               m.updateTime,m.createTime as createTime,m.status,m.install_date installDate,
                m.expiration_date expirationDate,g.chinese_name chArea,g.english_name enArea,g.ru_name ruArea,
                p.chinese_name chCity,p.english_name enCity,p.ru_name ruCity,s.timezone,s.name as section
         from manhole m left join section s on m.sectionid = s.id
@@ -72,6 +72,20 @@
                         #{dto}
                     </foreach>
             </if>
+            <if test="areaId != null and areaId != 0">
+                and m.areaid = #{areaId}
+            </if>
+            <if test="sectionId != null and sectionId != 0">
+                and m.sectionid = #{sectionId}
+            </if>
+            <choose>
+                <when test="online == 1">
+                    and m.online = 0
+                </when>
+                <when test="online == 2">
+                    and m.online = 1
+                </when>
+            </choose>
             <if test="keywords != null and keywords != ''">
                 and (m.name like '%${keywords}%' or m.address like '%${keywords}%')
             </if>

+ 8 - 2
src/main/resources/mapper/ScreenMapper.xml

@@ -16,11 +16,17 @@
                     #{dto}
                 </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>
             <choose>
-                <when test="online == 0">
+                <when test="online == 1">
                     and s.netStatus = 0
                 </when>
-                <when test="online == 1">
+                <when test="online == 2">
                     and s.netStatus = 1
                 </when>
             </choose>

+ 14 - 0
src/main/resources/mapper/TranshInfoMapper.xml

@@ -61,6 +61,20 @@
                         #{dto}
                     </foreach>
             </if>
+            <if test="areaId != null and areaId != 0">
+                and t.areaid = #{areaId}
+            </if>
+            <if test="sectionId != null and sectionId != 0">
+                and t.sectionid = #{sectionId}
+            </if>
+            <choose>
+                <when test="online == 1">
+                    and t.online = 0
+                </when>
+                <when test="online == 2">
+                    and t.online = 1
+                </when>
+            </choose>
             <if test="keywords != null and keywords != ''">
                 and (t.name like '%${keywords}%' or t.address like '%${keywords}%')
             </if>

+ 6 - 0
src/main/resources/mapper/WifiMapper.xml

@@ -14,6 +14,12 @@
                         #{dto}
                     </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>
             <choose>
                 <when test="onlineState == 0">
                     and w.online = 0