whycxzp
2023-03-07 41392c99a38ad8671f096bfec2ae678b1e814966
更新
1个文件已修改
29 ■■■■■ 已修改文件
src/main/java/com/whyc/service/BattInfService.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattInfService.java
@@ -198,8 +198,8 @@
        battInfMapper.insert(battinf);
        battInfMapper.insertUserBattgroupBaojigroupBattgroup(battinf.getStationId(),battinf.getBattGroupId());
        battInfMapper.insertUserBattgroupBaojigroupBattgroupSelect(battinf.getStationId(),battinf.getBattGroupId(),userId);
        doAfterBattGroupChange();
        run_cmd();
        doAfterBattGroupChange(battinf.getBattGroupId());
        //run_cmd();
        return new Response().set(1,battinf,"添加成功");
    }
@@ -281,13 +281,13 @@
    public void deleteByBattgroupId(Integer battgroupId){
        QueryWrapper<Battinf> wrapper = new QueryWrapper<Battinf>().eq("battgroupId",battgroupId);
        battInfMapper.delete(wrapper);
        doAfterBattGroupChange();
        doAfterBattGroupChange(battgroupId);
    }
    @Transactional
    public Response update(Battinf battinf){
        if (battInfMapper.updateById(battinf)>0){
            doAfterBattGroupChange();
            doAfterBattGroupChange(battinf.getBattGroupId());
            run_cmd();
            return new Response().set(1,"更新成功");
        }else {
@@ -655,11 +655,11 @@
    /**
     * 电池组 新增/编辑/删除后执行
     */
    public void doAfterBattGroupChange(){
    public void doAfterBattGroupChange(int battGroupId){
        createBattState_RT_RamDB_Table();
        createBattData_RT_RamDB_Table();
        createBattData_RT_RamDB_Table(battGroupId);
        createTb_Batt_RSAlarm_Table();
        createTb_Batt_RTAlarm_Table();
        createTb_Batt_RTAlarm_Table(battGroupId);
        setUpThreadRestart();
        updateTb_App_Sys_AppServerTable();
    }
@@ -675,12 +675,14 @@
    /**
     * 创建tb_batt_rtdata表并且根据集合bd_al,向表中添加电池组id和mon_num 值        "`db_ram_db`.tb_batt_rtdata"
     * @param battGroupId
     */
    public void createBattData_RT_RamDB_Table()
    public void createBattData_RT_RamDB_Table(int battGroupId)
    {
        List<Battinf> battInfList = getBattInfList();
        List<Battinf> battInfList = getBattInfList(battGroupId);
        for (Battinf battInf : battInfList) {
            int bg_id = battInf.getBattGroupId();
            System.out.println("执行到了:"+bg_id);
            int mon_cnt = battInf.getMonCount();
            int pack_count = battInf.getPackCount();
            int FBSDeviceId = battInf.getFBSDeviceId().intValue();
@@ -705,9 +707,9 @@
        }
    }
    private List<Battinf> getBattInfList() {
    private List<Battinf> getBattInfList(int battGroupId) {
        QueryWrapper<Battinf> query = Wrappers.query();
        query.select("BattGroupId","MonCount","FBSDeviceId","PackCount");
        query.select("BattGroupId","MonCount","FBSDeviceId","PackCount").eq("BattGroupId",battGroupId);
        return battInfMapper.selectList(query);
    }
@@ -721,9 +723,10 @@
    /**
     *     创建单体信息告警记录表        "`db_ram_db`.`tb_batt_rtalarm`"
     * @param battGroupId
     */
    public void createTb_Batt_RTAlarm_Table() {
        List<Battinf> battInfList = getBattInfList();
    public void createTb_Batt_RTAlarm_Table(int battGroupId) {
        List<Battinf> battInfList = getBattInfList(battGroupId);
        for (Battinf battInf : battInfList) {
            int bg_id = battInf.getBattGroupId();
            int mon_cnt = battInf.getMonCount();