| | |
| | |
|
| | | import com.fgkj.actions.ActionUtil;
|
| | | import com.fgkj.dao.BaseDAO;
|
| | | import com.fgkj.dao.BattinfGroupFactory;
|
| | | import com.fgkj.dao.CallBack;
|
| | | import com.fgkj.dao.DAOHelper;
|
| | | import com.fgkj.dao.FBS9100_ComBase;
|
| | |
| | | //获取当前最大的stationid和battgroupid
|
| | | int maxs=42000000;//最大stationid
|
| | | int maxb=1000001;//最大battgroupid
|
| | | List maxList=(new BattInfImpl()).searchMaxId();
|
| | | if(maxList!=null&&maxList.size()>0){
|
| | | maxs=BattinfGroupFactory.searchStationId();
|
| | | maxb=BattinfGroupFactory.searchMaxBattgroupId();
|
| | | /*if(maxList!=null&&maxList.size()>0){
|
| | | maxs=(Integer) maxList.get(0)+1;
|
| | | maxb=(Integer) maxList.get(1)+1;
|
| | | }
|
| | | //maxb=(Integer) maxList.get(1)+1;
|
| | | }*/
|
| | | if(list!=null && list.size()>0){
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | BattInf binf=list.get(i);
|
| | |
| | | binf.setStationId((String) listS.get(listS.size()-1));
|
| | | }else{
|
| | | //获取当前最大的stationid
|
| | | List maxList=(new BattInfImpl()).searchMaxId();
|
| | | if(maxList!=null&&maxList.size()>0){
|
| | | int maxs=BattinfGroupFactory.searchStationId();
|
| | | binf.setStationId(String.valueOf(maxs));
|
| | | /*if(maxList!=null&&maxList.size()>0){
|
| | | int maxs=(Integer) maxList.get(0)+1;
|
| | | binf.setStationId(String.valueOf(maxs));
|
| | | }
|
| | | }*/
|
| | | }
|
| | | String sql = "update db_battinf.tb_battinf set StationId='"+binf.getStationId()+"',StationName='"+binf.getStationName()+"',StationName1='"+binf.getStationName1()+"',StationName2='"+binf.getStationName2()+"',StationName3='"+binf.getStationName3()+"',StationName4='"+binf.getStationName4()+"',StationName5='"+binf.getStationName5()+"',StationIp='"+binf.getStationIp()+"',FBSDeviceId="+binf.getFBSDeviceId()+",FbsDeviceIp='"+binf.getFbsDeviceIp()+"',"
|
| | | + "FBSDeviceName='"+binf.getFBSDeviceName()+"',GroupIndexInFBSDevice="+binf.getGroupIndexInFBSDevice()+",BattGroupNum="+binf.getBattGroupNum()+",BattGroupName='"+binf.getBattGroupName()+"',FloatVolLevel="+binf.getFloatVolLevel()+",OfflineVolLevel="+binf.getOfflineVolLevel()+",BattFloatCurrent="+binf.getBattFloatCurrent()+"," +
|
| | |
| | | return list;
|
| | | }
|
| | | //添加电池组时查询出最大的机房id和电池组id
|
| | | public List searchMaxId(){
|
| | | String sql="select max(stationid) as maxs,max(battgroupid) as maxb from db_battinf.tb_battinf limit 1";
|
| | | public int searchMaxId(){
|
| | | //,max(battgroupid) as maxb
|
| | | String sql="select max(stationid) as stationid_maxs from db_battinf.tb_battinf limit 1";
|
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), null, new CallBack() {
|
| | |
|
| | | public List getResults(ResultSet rs) {
|
| | |
| | |
|
| | | while(rs.next()){
|
| | | int maxs=42000000;
|
| | | int maxb=1000001;
|
| | | if(rs.getString("maxs") != null){
|
| | | maxs=Integer.parseInt(rs.getString("maxs"));
|
| | | //int maxb=1000001;
|
| | | if(rs.getString("stationid_maxs") != null){
|
| | | maxs=Integer.parseInt(rs.getString("stationid_maxs"));
|
| | | }
|
| | | if(rs.getInt("maxb")!=0){
|
| | | /*if(rs.getInt("maxb")!=0){
|
| | | maxb=rs.getInt("maxb");
|
| | | }
|
| | | }*/
|
| | | list.add(maxs);
|
| | | list.add(maxb);
|
| | | //list.add(maxb);
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | |
| | | return list;
|
| | | }
|
| | | });
|
| | | return list;
|
| | | int stationid=0;
|
| | | if(list!=null&&list.size()>0){
|
| | | stationid=(Integer) list.get(list.size()-1);
|
| | | }
|
| | | return stationid;
|
| | | }
|
| | | //判断新增的电池组是否存在
|
| | | public List judgeBatt(Object obj){
|