| | |
| | | import com.fgkj.actions.ActionUtil;
|
| | | import com.fgkj.dao.FBS9100_ComBase;
|
| | | import com.fgkj.dao.UinfDaoFactory;
|
| | | import com.fgkj.dto.BattInf;
|
| | | import com.fgkj.dto.ServiceModel;
|
| | | import com.fgkj.dto.User_log;
|
| | | import com.fgkj.dto.ram.Fbs9100_battparam;
|
| | |
| | | result = tojson(model);
|
| | | return SUCCESS;
|
| | | }
|
| | | //批量设置电池参数时,根据省市区,电池单体型号(伏数),组数筛选出电池组并读取它的实际电池参数
|
| | | public String serchBattinfAndParam() {
|
| | | BattInf binf=getGson().fromJson(json, BattInf.class);
|
| | | ServiceModel model = service.serchBattinfAndParam(binf);
|
| | | result = tojson(model); |
| | | return SUCCESS; |
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
| | | //批量设置放电参数时,根据省市区,电池单体型号(伏数),组数筛选出电池组
|
| | | public List serchByDischarge(Object obj) {
|
| | | BattInf binf=(BattInf) obj;
|
| | | Page page=binf.getPage();
|
| | | //Page page=binf.getPage();
|
| | | /*Connection conn=DBUtil.getConn();
|
| | | String numberSql=" SELECT FOUND_ROWS() number";SQL_CALC_FOUND_ROWS*/
|
| | | String sql=" select distinct(StationId),StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationIp,FBSDeviceId,"
|
| | | + "FBSDeviceName,GroupIndexInFBSDevice,db_battinf.tb_battinf.battgroupId,battGroupName" +
|
| | | + "FBSDeviceName,GroupIndexInFBSDevice,db_battinf.tb_battinf.battgroupId,battGroupName,battGroupNum" +
|
| | | ",MonCount,MonCapStd,monVolStd,monResStd,MonSerStd,Load_curr,DisCurrMax"
|
| | | + ",db_ram_db.tb_fbs9100_state.dev_version "
|
| | | + " from db_battinf.tb_battinf,db_ram_db.tb_fbs9100_state "
|
| | |
| | | try {
|
| | | while(rs.next()) {
|
| | | BattInf binf = new BattInf();
|
| | | binf.setNum(0);
|
| | | binf.setStationId(rs.getString("stationId"));
|
| | | binf.setStationName(rs.getString("stationName"));
|
| | | binf.setStationName1(rs.getString("stationName1"));
|
| | |
| | | binf.setFBSDeviceName(rs.getString("fBSDeviceName"));
|
| | | binf.setGroupIndexInFBSDevice(rs.getInt("groupIndexInFBSDevice"));
|
| | | binf.setBattGroupId(rs.getInt("battGroupId"));
|
| | | binf.setBattGroupNum(rs.getInt("battGroupNum"));
|
| | | binf.setBattGroupName(rs.getString("battGroupName"));
|
| | | /*binf.setBattGroupNum(rs.getInt("battGroupNum"));
|
| | | binf.setFloatVolLevel(rs.getFloat("floatVolLevel"));
|
| | |
| | | ,bparam.getBattTemp(),bparam.getFloatChargeVol(),bparam.getFloatChargeCurr(),bparam.getOnlineVolLow(),bparam.getGroupConnType()});
|
| | | return bl;
|
| | | }
|
| | | //批量设置参数前往表中加入数据
|
| | | public boolean updatePL(Object obj) {
|
| | | Fbs9100_battparam bparam=(Fbs9100_battparam) obj;
|
| | | /*String sql=" update db_ram_db.tb_fbs9100_battparam set STD_CAP=?,STD_RES=?,BattGroupCount=?,EachGroupBattCount=?,MonomerVol=?,GroupVol=?,BattTemp=?,FloatChargeVol=?,FloatChargeCurr=?,OnlineVolLow=?,GroupConnType=? " +
|
| | | " where dev_id=? ";*/
|
| | | String sql=" replace into db_ram_db.tb_fbs9100_battparam(dev_id,op_cmd,dev_ip,STD_CAP,STD_RES,BattGroupCount,EachGroupBattCount,MonomerVol,GroupVol,BattTemp,FloatChargeVol,FloatChargeCurr,OnlineVolLow,GroupConnType) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
| | | boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[]{bparam.getDev_id(),bparam.getOp_cmd(),bparam.getDev_ip(),bparam.getSTD_CAP(),bparam.getSTD_RES(),bparam.getBattGroupCount(),bparam.getEachGroupBattCount(),bparam.getMonomerVol(),bparam.getGroupVol()
|
| | | ,bparam.getBattTemp(),bparam.getFloatChargeVol(),bparam.getFloatChargeCurr(),bparam.getOnlineVolLow(),bparam.getGroupConnType()});
|
| | | return bl;
|
| | | }
|
| | | //批量修改电池参数
|
| | | public boolean updatePro(Object obj) {
|
| | | List<Fbs9100_battparam> list=(List<Fbs9100_battparam>) obj;
|
| | |
| | | if(list!=null&&list.size()>0){
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | Fbs9100_battparam fs=list.get(i);
|
| | | String sql="replace into db_ram_db.tb_fbs9100_battparam(dev_id,dev_ip,STD_CAP,STD_RES,BattGroupCount,EachGroupBattCount"
|
| | | String sql="replace into db_ram_db.tb_fbs9100_battparam(dev_id,op_cmd,dev_ip,STD_CAP,STD_RES,BattGroupCount,EachGroupBattCount"
|
| | | + ",MonomerVol,GroupVol,BattTemp,FloatChargeVol,FloatChargeCurr,OnlineVolLow,GroupConnType) "
|
| | | + " values("+fs.getDev_id()+",'"+fs.getDev_ip()+"',"+fs.getSTD_CAP()+","+fs.getSTD_RES()+","+fs.getBattGroupCount()+","+fs.getEachGroupBattCount()
|
| | | + " values("+fs.getDev_id()+","+fs.getOp_cmd()+",'"+fs.getDev_ip()+"',"+fs.getSTD_CAP()+","+fs.getSTD_RES()+","+fs.getBattGroupCount()+","+fs.getEachGroupBattCount()
|
| | | +","+fs.getMonomerVol()+","+fs.getGroupVol()+","+fs.getBattTemp()+","+fs.getFloatChargeVol()+","+fs.getFloatChargeCurr()+","+fs.getOnlineVolLow()+","+fs.getGroupConnType()+")";
|
| | | sql_str.add(sql);
|
| | | {
|
| | |
| | | package com.fgkj.services.ram;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.List;
|
| | |
|
| | |
| | | import com.fgkj.dao.impl.ram.Bts_gprs_stateImpl;
|
| | | import com.fgkj.dao.impl.ram.Fbs9100_battparamImpl;
|
| | | import com.fgkj.dao.impl.ram.Fbs9100_sysparamImpl;
|
| | | import com.fgkj.dto.BattInf;
|
| | | import com.fgkj.dto.ServiceModel;
|
| | | import com.fgkj.dto.ram.Bts_gprs_state;
|
| | | import com.fgkj.dto.ram.Fbs9100_battparam;
|
| | |
| | | }
|
| | | //批量设置电池参数时,根据省市区,电池单体型号(伏数),组数筛选出电池组并读取它的实际电池参数
|
| | | public ServiceModel serchBattinfAndParam(Object obj) {
|
| | | List list=(new BattInfImpl()).serchByDischarge(obj);
|
| | | List<BattInf> list=(new BattInfImpl()).serchByDischarge(obj);
|
| | | if(list!=null&&list.size()>0) {
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | |
| | | }
|
| | | Calendar c = Calendar.getInstance(); |
| | | //现在的时间(单位:毫秒) |
| | | long now_time = c.getTimeInMillis();
|
| | | long time=0;
|
| | | int success=0;
|
| | | int count=0;
|
| | | do {
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | BattInf binf=list.get(i);
|
| | | Fbs9100_battparam fs=new Fbs9100_battparam();
|
| | | fs.setDev_id(binf.getFBSDeviceId());
|
| | | fs.setOp_cmd(FBS9100_ComBase.CMD_GetBattParam);
|
| | | if(count==0) {
|
| | | fs.setDev_ip("127.0.0.0");
|
| | | fs.setSTD_CAP(1);
|
| | | fs.setSTD_RES(1);
|
| | | fs.setBattGroupCount(1);
|
| | | fs.setEachGroupBattCount(1);
|
| | | fs.setMonomerVol(1);
|
| | | fs.setGroupVol(1);
|
| | | fs.setBattTemp(1);
|
| | | fs.setFloatChargeVol(1);
|
| | | fs.setFloatChargeCurr(1);
|
| | | fs.setOnlineVolLow(1);
|
| | | fs.setGroupConnType(1);
|
| | | boolean bl=((Fbs9100_battparamImpl)dao).updatePL(fs);
|
| | | }
|
| | | if(binf.getNum()==0) {
|
| | | boolean b=((Fbs9100_battparamImpl)dao).getCmdAck(fs.getOp_cmd(), fs.getDev_id());
|
| | | if(b) {
|
| | | success+=1;
|
| | | list.get(i).setNum(1);
|
| | | List listbatt=dao.serchByCondition(fs);
|
| | | list.get(i).setObj(listbatt);
|
| | | // System.out.println(list.get(i).getFBSDeviceId());
|
| | | }
|
| | | }
|
| | | }
|
| | | count++;
|
| | | if(success==list.size()) {
|
| | | break;
|
| | | }
|
| | | Calendar cl = Calendar.getInstance(); |
| | | long moment_time = cl.getTimeInMillis();
|
| | | time=moment_time-now_time;
|
| | | }while(time<=5*1000);
|
| | | model.setData(list);
|
| | | model.setCode(1);
|
| | | model.setSum(success);
|
| | | model.setMsg("修改成功!");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | | |
| | | public static void main(String[] args) {
|
| | | Fbs9100_battparamService service=new Fbs9100_battparamService();
|
| | | BattInf binf=new BattInf();
|
| | | binf.setNum(2);
|
| | | binf.setStationName("百色");
|
| | | binf.setGroupIndexInFBSDevice(0);
|
| | | binf.setMonVolStd(12f);
|
| | | ServiceModel model=service.serchBattinfAndParam(binf);
|
| | | List list=(List)model.getData();
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | System.out.println(((BattInf)list.get(i)).getObj());
|
| | | }
|
| | | }
|
| | | }
|