| | |
| | | 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,"添加成功"); |
| | | } |
| | | |
| | |
| | | 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 { |
| | |
| | | /** |
| | | * 电池组 新增/编辑/删除后执行 |
| | | */ |
| | | 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(); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 创建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(); |
| | |
| | | } |
| | | } |
| | | |
| | | 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); |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * 创建单体信息告警记录表 "`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(); |