lxw
2023-03-27 6ad6f8e23de1532dba3d46d8fe6a15bd792d3637
管理员首页
4个文件已修改
43 ■■■■ 已修改文件
src/main/java/com/whyc/mapper/StationInfMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/StationInfService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/webSocket/HomeAdminSocket.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/StationInfMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/StationInfMapper.java
@@ -30,4 +30,7 @@
    List<StationInf> searchShuttle(long uId);
    List<StationInf> searchStationAll(String stationName1, String stationName2, String stationName5, String uId);
    //站点信息
    List<StationInf> getSateAnalysis(int userId);
}
src/main/java/com/whyc/service/StationInfService.java
@@ -789,4 +789,9 @@
        return new Response().setII(1, list.size() > 0, list, "首页上点击电池损坏站");
    }
    //站点信息
    public List<StationInf> getSateAnalysis(int userId) {
        List<StationInf> list = mapper.getSateAnalysis(userId);
        return list;
    }
}
src/main/java/com/whyc/webSocket/HomeAdminSocket.java
@@ -4,11 +4,9 @@
import com.whyc.dto.Response;
import com.whyc.pojo.Battinf;
import com.whyc.pojo.PowerInf;
import com.whyc.pojo.StationInf;
import com.whyc.pojo.UserInf;
import com.whyc.service.BadBattMonService;
import com.whyc.service.BattInfService;
import com.whyc.service.BatttestdataInfService;
import com.whyc.service.PowerInfService;
import com.whyc.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -40,6 +38,8 @@
    private static BattInfService battInfService;
    private static StationInfService stationInfService;
    private static BadBattMonService badBattMonService;
@@ -65,6 +65,11 @@
    @Autowired
    public void setBatttestdataInfService(BatttestdataInfService batttestdataInfService) {
        HomeAdminSocket.batttestdataInfService = batttestdataInfService;
    }
    @Autowired
    public void setStationInfService(StationInfService stationInfService) {
        HomeAdminSocket.stationInfService = stationInfService;
    }
    @OnOpen
@@ -237,13 +242,14 @@
        //站点信息
        Response resStationAnalysis = new Response();
        try {
            List<Battinf> battinfList = battInfService.getSateAnalysis(userId);
            Map<Integer, List<Battinf>> nodeStationMap = battinfList.stream().collect(Collectors.groupingBy(Battinf::getNodeStation));
            Map<String, List<Battinf>> stationTypeMap = battinfList.stream().collect(Collectors.groupingBy(Battinf::getStationType));
            //List<Battinf> battinfList = battInfService.getSateAnalysis(userId);
            List<StationInf> sinfList = stationInfService.getSateAnalysis(userId);
            Map<Integer, List<StationInf>> nodeStationMap = sinfList.stream().collect(Collectors.groupingBy(StationInf::getNodeStation));
            Map<String, List<StationInf>> stationTypeMap = sinfList.stream().collect(Collectors.groupingBy(StationInf::getStationType));
            Map<Integer, Object> nodeMap = new HashMap<>();
            Map<String, Object> stationMap = new HashMap<>();
            Map<String, Object> battGroupInfoMap = new HashMap<>();
            int battSize = battinfList.size();
            int battSize = sinfList.size();
            for (Integer node : nodeStationMap.keySet()) {
                nodeMap.put(node, nodeStationMap.get(node).size());
            }
src/main/resources/mapper/StationInfMapper.xml
@@ -231,4 +231,17 @@
            )
        </where>
    </select>
    <select id="getSateAnalysis" resultType="com.whyc.pojo.StationInf">
        select distinct(stationid), NodeStation, IFNULL(StationType, 0) as StationType
        from db_battinf.tb_station_inf
        where
          and stationId in (
            select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId
            from db_user.tb_user_battgroup_baojigroup_battgroup
            , db_user.tb_user_battgroup_baojigroup_usr
            where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id =
            db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id
          and db_user.tb_user_battgroup_baojigroup_usr.uId = #{userId}
            )
    </select>
</mapper>