whycxzp
2023-03-08 3131f794e3336ff1497342bae5e11296a8097e3f
更新
4个文件已修改
52 ■■■■ 已修改文件
src/main/java/com/whyc/mapper/StationInfMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattInfService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/StationInfService.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/StationInfMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/StationInfMapper.java
@@ -15,4 +15,6 @@
    //查询指定机房信息
    StationInf getSystemSkipStation(int userId, String stationId);
    List<StationInf> getStationInfList(int userId);
}
src/main/java/com/whyc/service/BattInfService.java
@@ -783,11 +783,4 @@
        return false;
    }
    /**
     * 查询用户管理下的站点集合
     * @param userId
     */
    public void getStationList2(int userId) {
        battInfMapper.getStationList2(userId);
    }
}
src/main/java/com/whyc/service/StationInfService.java
@@ -9,11 +9,13 @@
import com.whyc.mapper.*;
import com.whyc.pojo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@Service
@@ -44,6 +46,9 @@
    @Autowired(required = false)
    private BattEnduranceMapper endMapper;
    @Autowired
    @Lazy
    private BattInfService battInfService;
    //插入站点
    public Response insertStation(StationInf stationInf) {
@@ -103,8 +108,32 @@
        }
    }
    /**
     *
     * @param userId
     * @return
     *  站点数:
     *  110v/35v:
     *  节点站:
     *  普通站:
     *  停点站:    tb_fbs9100_state.dev_workstate=3
     *  核容放电站:tb_fbs9100_state.dev_workstate=2
     *  故障告警站:
     *
     */
    public Response getStationStatistic(int userId) {
        return null;
        Map<String,Integer> stationInfoMap = new HashMap<>();
        List<StationInf> stationInfList = mapper.getStationInfList(userId);
        //站点数
        stationInfoMap.put("stationCount",stationInfList.size());
        //110v/35v/...
        Map<String, List<StationInf>> stationTypeMap = stationInfList.stream().filter(stationInf -> !stationInf.getStationType().equals("")).collect(Collectors.groupingBy(StationInf::getStationType));
        Set<String> stationTypeSet = stationTypeMap.keySet();
        for(String stationType : stationTypeSet){
            stationInfoMap.put(stationType,stationTypeMap.get(stationType).size());
        }
        return new Response().set(1,stationInfoMap);
    }
    //运维层首页:站点实时数据推送
src/main/resources/mapper/StationInfMapper.xml
@@ -98,4 +98,16 @@
                              and db_user.tb_user_inf.uid = db_user.tb_user_battgroup_baojigroup_usr.uid
                              and db_user.tb_user_inf.uid = #{userId})
    </select>
    <select id="getStationInfList" resultType="com.whyc.pojo.StationInf">
        select *
        from db_battinf.tb_station_inf
        where StationId in (select distinct StationId
        from db_user.tb_user_battgroup_baojigroup_battgroup
        , db_user.tb_user_battgroup_baojigroup_usr
        , db_user.tb_user_inf
        where db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id =
        db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id
        and db_user.tb_user_inf.uid = db_user.tb_user_battgroup_baojigroup_usr.uid
        and db_user.tb_user_inf.uid = #{userId})
    </select>
</mapper>