whycxzp
2023-07-26 3a0d6602e0ea5232fca72951c8d70b2da9cf70bf
更新大屏班组站点告警
15个文件已修改
142 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/BaoJiGroupController.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/GroupWithStationAndAlarmDTO.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BaoJiGroupMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BattalarmDataMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/DevalarmDataMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/PwrdevAlarmMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BaoJiGroupService.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattalarmDataService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/DevalarmDataService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/PwrdevAlarmService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/webSocket/ScreenSocket.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BaoJiGroupMapper.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattalarmDataMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/DevalarmDataMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/PwrdevAlarmMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/BaoJiGroupController.java
@@ -3,12 +3,14 @@
import com.whyc.dto.Response;
import com.whyc.pojo.BaoJiGroup;
import com.whyc.service.BaoJiGroupService;
import com.whyc.util.ActionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.swing.*;
import java.util.List;
@RestController
@@ -63,7 +65,8 @@
    @GetMapping("groupWithStationAndAlarm")
    @ApiOperation(value = "查询班组管理下的站点及告警")
    public Response<List<BaoJiGroup>> getGroupWithStationAndAlarm(){
        return service.getGroupWithStationAndAlarm();
        Long uId = ActionUtil.getUser().getUId();
        return service.getGroupWithStationAndAlarm(uId.intValue());
    }
}
src/main/java/com/whyc/dto/GroupWithStationAndAlarmDTO.java
@@ -9,6 +9,11 @@
    private String groupName;
    private List<StationInf> stationInfList;
    private Integer stationCount;
    private Integer battAlarmCount;
    private Integer deviceAlarmCount;
    private Integer powerAlarmCount;
    public String getGroupName() {
        return groupName;
    }
@@ -24,4 +29,36 @@
    public void setStationInfList(List<StationInf> stationInfList) {
        this.stationInfList = stationInfList;
    }
    public Integer getStationCount() {
        return stationCount;
    }
    public void setStationCount(Integer stationCount) {
        this.stationCount = stationCount;
    }
    public Integer getBattAlarmCount() {
        return battAlarmCount;
    }
    public void setBattAlarmCount(Integer battAlarmCount) {
        this.battAlarmCount = battAlarmCount;
    }
    public Integer getDeviceAlarmCount() {
        return deviceAlarmCount;
    }
    public void setDeviceAlarmCount(Integer deviceAlarmCount) {
        this.deviceAlarmCount = deviceAlarmCount;
    }
    public Integer getPowerAlarmCount() {
        return powerAlarmCount;
    }
    public void setPowerAlarmCount(Integer powerAlarmCount) {
        this.powerAlarmCount = powerAlarmCount;
    }
}
src/main/java/com/whyc/mapper/BaoJiGroupMapper.java
@@ -6,6 +6,6 @@
import java.util.List;
public interface BaoJiGroupMapper extends CustomMapper<BaoJiGroup> {
    List<GroupWithStationAndAlarmDTO> getGroupWithStation();
    List<GroupWithStationAndAlarmDTO> getGroupWithStation(int userId);
}
src/main/java/com/whyc/mapper/BattalarmDataMapper.java
@@ -77,4 +77,6 @@
    int getCapAlarmNum(int userId);
    int getCountByStationIds(List<String> stationIdList);
}
src/main/java/com/whyc/mapper/DevalarmDataMapper.java
@@ -37,4 +37,6 @@
    //设备告警机房
    int getQualityAnalysisStation(int userId);
    int getCountByStationIds(List<String> stationIdList);
}
src/main/java/com/whyc/mapper/PwrdevAlarmMapper.java
@@ -46,4 +46,7 @@
    //电源设备告警机房
    int getQualityAnalysisStation(int userId);
    int getCountByStationIds(List<String> stationIdList);
}
src/main/java/com/whyc/service/BaoJiGroupService.java
@@ -12,6 +12,7 @@
import com.whyc.pojo.BaoJiGroup;
import com.whyc.pojo.BaoJiGroupUser;
import com.whyc.pojo.BaojiGroupBattGroup;
import com.whyc.pojo.StationInf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -37,6 +38,15 @@
    @Autowired
    private BattInfService battInfService;
    @Autowired
    private BattalarmDataService battAlarmDataService;
    @Autowired
    private DevalarmDataService deviceAlarmDataService;
    @Autowired
    private PwrdevAlarmService powerAlarmService;
    public void add(String groupName) {
        BaoJiGroup baoJiGroup = new BaoJiGroup();
@@ -111,8 +121,22 @@
        return mapper.selectList(query);
    }
    public Response getGroupWithStationAndAlarm() {
        List<GroupWithStationAndAlarmDTO> list = mapper.getGroupWithStation();
    public Response getGroupWithStationAndAlarm(int userId) {
        List<GroupWithStationAndAlarmDTO> list = mapper.getGroupWithStation(userId);
        list.forEach(item->{
            List<StationInf> stationInfList = item.getStationInfList();
            item.setStationCount(stationInfList.size());
            List<String> stationIdList = stationInfList.stream().map(StationInf::getStationId).collect(Collectors.toList());
            //电池
            int battAlarmCount = battAlarmDataService.getCountByStationIds(stationIdList);
            item.setBattAlarmCount(battAlarmCount);
            //设备
            int deviceAlarmCount = deviceAlarmDataService.getCountByStationIds(stationIdList);
            item.setDeviceAlarmCount(deviceAlarmCount);
            //电源
            int powerAlarmCount = powerAlarmService.getCountByStationIds(stationIdList);
            item.setPowerAlarmCount(powerAlarmCount);
        });
        return new Response().set(1,list);
    }
src/main/java/com/whyc/service/BattalarmDataService.java
@@ -593,4 +593,8 @@
    public int getCapAlarmNum(int userId) {
        return mapper.getCapAlarmNum(userId);
    }
    public int getCountByStationIds(List<String> stationIdList) {
        return mapper.getCountByStationIds(stationIdList);
    }
}
src/main/java/com/whyc/service/DevalarmDataService.java
@@ -160,4 +160,8 @@
    public List<Integer> getStationList(int userId) {
        return mapper.getStationList(userId);
    }
    public int getCountByStationIds(List<String> stationIdList) {
        return mapper.getCountByStationIds(stationIdList);
    }
}
src/main/java/com/whyc/service/PwrdevAlarmService.java
@@ -343,4 +343,8 @@
    public List<Integer> getStationList(int userId) {
        return mapper.getStationList(userId);
    }
    public int getCountByStationIds(List<String> stationIdList) {
        return mapper.getCountByStationIds(stationIdList);
    }
}
src/main/java/com/whyc/webSocket/ScreenSocket.java
@@ -43,6 +43,8 @@
    private static BattEnduranceService battEnduranceService;
    private static BaoJiGroupService baoJiGroupService;
    @Autowired
    public void setPowerAlarmService(PwrdevAlarmService powerAlarmService) {
        ScreenSocket.powerAlarmService = powerAlarmService;
@@ -68,6 +70,10 @@
    public void setBattEnduranceService(BattEnduranceService battEnduranceService) {
        ScreenSocket.battEnduranceService = battEnduranceService;
    }
    @Autowired
    public void setBaoJiGroupService(BaoJiGroupService baoJiGroupService) {
        ScreenSocket.baoJiGroupService = baoJiGroupService;
    }
    @OnOpen
    public void onOpen(Session session, EndpointConfig config){
@@ -83,7 +89,7 @@
                    Map<String, Object> res = new HashMap<>();
                    while (!currentThread().isInterrupted()) {
                        ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor();
                        CountDownLatch latch = new CountDownLatch(8);
                        CountDownLatch latch = new CountDownLatch(9);
                        poolExecutor.execute(()->{
                            //一体   告警:交流ABC
                            Response res_acABC = powerAlarmService.getAcABCAnalysis(userId);
@@ -165,6 +171,11 @@
                            res.put("enduranceLow", res_endurance);
                            latch.countDown();
                        });
                        poolExecutor.execute(()->{
                            Response res_endurance = baoJiGroupService.getGroupWithStationAndAlarm(userId);
                            res.put("enduranceLow", res_endurance);
                            latch.countDown();
                        });
                        /*//一体   告警:交流ABC
                        Response res_acABC = powerAlarmService.getAcABCAnalysis(userId);
src/main/resources/mapper/BaoJiGroupMapper.xml
@@ -24,5 +24,13 @@
        where b.baoji_group_id = bb.baoji_group_id
        and bb.StationId = s.stationId
        and b.discharge_plan_flag = 1
        and s.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>
src/main/resources/mapper/BattalarmDataMapper.xml
@@ -476,4 +476,14 @@
        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="getCountByStationIds" resultType="java.lang.Integer">
        select count(distinct d.num)
        from db_battinf.tb_battinf b,
        db_alarm.tb_battalarm_data d
        where b.battgroupId = d.battgroupid
        and b.StationId in
        <foreach collection="list" item="item" separator="," open="(" close=")">
            #{item}
        </foreach>
    </select>
</mapper>
src/main/resources/mapper/DevalarmDataMapper.xml
@@ -278,4 +278,14 @@
                              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="getCountByStationIds" resultType="java.lang.Integer">
        select count(distinct d.num)
        from db_battinf.tb_battinf b,
        db_alarm.tb_devalarm_data d
        where b.FBSDeviceId = d.dev_id
        and b.StationId in
        <foreach collection="list" item="item" separator="," open="(" close=")">
            #{item}
        </foreach>
    </select>
</mapper>
src/main/resources/mapper/PwrdevAlarmMapper.xml
@@ -349,4 +349,14 @@
                                  db_user.tb_user_battgroup_baojigroup_usr.uid
                              and db_user.tb_user_inf.uid = #{userId})
    </select>
    <select id="getCountByStationIds" resultType="java.lang.Integer">
        select count(distinct d.num)
        from db_pwrdev_inf.tb_pwrdev_inf b,
        db_pwrdev_alarm.tb_pwrdev_alarm d
        where b.PowerDeviceId = d.PowerDeviceId
        and b.StationId in
        <foreach collection="list" item="item" separator="," open="(" close=")">
            #{item}
        </foreach>
    </select>
</mapper>