src/main/java/com/whyc/controller/DevInfController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/dto/DevInfDto.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/mapper/DevInfMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/DevInfService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/webSocket/DevInfSocket.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/webSocket/DevRtstateSocket.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/DevInfMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/controller/DevInfController.java
@@ -1,10 +1,9 @@ package com.whyc.controller; import com.whyc.dto.Page; import com.whyc.dto.DevInfDto; import com.whyc.dto.Response; import com.whyc.pojo.db_lithium_ram_db.DevInf; import com.whyc.service.DevInfService; import com.whyc.service.UserInfService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -25,8 +24,8 @@ @ApiOperation(value = "获取设备信息") @PostMapping("getAllInf") public Response getAllInf(@RequestBody Page page){ return service.getAllInf(101,page); public Response getAllInf(@RequestBody DevInfDto devInfDto){ return service.getAllInf(101, devInfDto); } @ApiOperation(value = "获取左侧列表") src/main/java/com/whyc/dto/DevInfDto.java
File was renamed from src/main/java/com/whyc/dto/Page.java @@ -1,8 +1,9 @@ package com.whyc.dto; public class Page { public class DevInfDto { private int pageNum; private int pageSize; private int devType; public int getPageNum() { @@ -20,4 +21,12 @@ public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getDevType() { return devType; } public void setDevType(int devType) { this.devType = devType; } } src/main/java/com/whyc/mapper/DevInfMapper.java
@@ -9,7 +9,7 @@ public interface DevInfMapper extends CustomMapper<DevInf>{ //查询包机人管理的设备id List<DevInf> getAllInf(@Param("uid") Integer uid); List<DevInf> getAllInf(@Param("uid") Integer uid,@Param("devType") Integer devType); //查询该类型最大设备编号 Integer getMaxDevId(Integer devType); //获取左侧泪飙 src/main/java/com/whyc/service/DevInfService.java
@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.whyc.dto.Page; import com.whyc.dto.DevInfDto; import com.whyc.dto.Response; import com.whyc.mapper.A200RealstateMapper; import com.whyc.mapper.ActmRealstateMapper; @@ -12,8 +12,6 @@ import com.whyc.pojo.db_lithium_ram_db.A200Realstate; import com.whyc.pojo.db_lithium_ram_db.ActmRealstate; import com.whyc.pojo.db_lithium_ram_db.DevInf; import com.whyc.util.RSAUtil; import org.simpleframework.xml.Order; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -56,10 +54,10 @@ } //获取所有的设备信息 public Response getAllInf(Integer uid, Page page) { public Response getAllInf(Integer uid, DevInfDto devInfDto) { Map<String, Object> allMap = new HashMap<>(); PageHelper.startPage(page.getPageNum(),page.getPageSize()); List<DevInf> list=mapper.getAllInf(uid); PageHelper.startPage(devInfDto.getPageNum(), devInfDto.getPageSize()); List<DevInf> list=mapper.getAllInf(uid,devInfDto.getDevType()); Map<Integer, List<DevInf>> typeDevMap = list.stream().collect(Collectors.groupingBy(DevInf::getDevType)); Map<Integer, List<DevInf>> onlineDevMap = list.stream().collect(Collectors.groupingBy(DevInf::getDevOnline)); src/main/java/com/whyc/webSocket/DevInfSocket.java
@@ -1,7 +1,7 @@ package com.whyc.webSocket; import com.whyc.config.WebSocketConfig; import com.whyc.dto.Page; import com.whyc.dto.DevInfDto; import com.whyc.dto.Response; import com.whyc.service.DevInfService; import com.whyc.util.ActionUtil; @@ -47,7 +47,7 @@ } @OnMessage public void onMessage(Session session, String message) { Page page= ActionUtil.getGson().fromJson(message,Page.class); DevInfDto devInfDto = ActionUtil.getGson().fromJson(message, DevInfDto.class); //UserInf user = (UserInf) this.httpSession.getAttribute("user"); //final int userId = user.getUid(); final int userId = 101; @@ -58,7 +58,7 @@ Thread thread = currentThread(); threadFlagMap.put(thread.getId(), true); try { Response res=dinfService.getAllInf(userId,page); Response res=dinfService.getAllInf(userId, devInfDto); if (session.isOpen()) { //推送信息 synchronized (session) { src/main/java/com/whyc/webSocket/DevRtstateSocket.java
@@ -1,18 +1,15 @@ package com.whyc.webSocket; import com.whyc.config.WebSocketConfig; import com.whyc.dto.Page; import com.whyc.dto.Response; import com.whyc.dto.RtstateDto; import com.whyc.service.A200RealstateService; import com.whyc.service.ActmRealstateService; import com.whyc.service.BattRtdataService; import com.whyc.service.DevInfService; import com.whyc.util.ActionUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.servlet.http.HttpSession; import javax.websocket.*; import javax.websocket.server.ServerEndpoint; import java.util.HashMap; src/main/resources/mapper/DevInfMapper.xml
@@ -5,7 +5,8 @@ <select id="getAllInf" resultType="com.whyc.pojo.db_lithium_ram_db.DevInf"> select * from db_lithium_ram_db.tb_dev_inf <where> dev_id in ( dev_type=#{devType} and dev_id in ( SELECT distinct dev_id from db_user.tb_battgroup_baojigroup,db_user.tb_battgroup_usr <where> tb_battgroup_baojigroup.baoji_group_id=tb_battgroup_usr.baoji_group_id @@ -13,7 +14,6 @@ and uid=#{uid} </if> </where> ) </where> </select>