| | |
| | | import java.sql.PreparedStatement;
|
| | | import java.sql.SQLException;
|
| | | import java.text.ParseException;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.fgkj.actions.ActionUtil;
|
| | | import com.fgkj.dao.BaseDAO;
|
| | | import com.fgkj.dao.BaseDAOFactory;
|
| | | import com.fgkj.dao.BattCapFactory;
|
| | | import com.fgkj.dao.BattTestData;
|
| | | import com.fgkj.dao.BattinfGroupFactory;
|
| | | import com.fgkj.dao.DAOHelper;
|
| | | import com.fgkj.dao.FBS9100_ComBase;
|
| | | import com.fgkj.dao.ProcessServerDao;
|
| | | import com.fgkj.dao.impl.App_SysImpl;
|
| | | import com.fgkj.dao.impl.BattInfImpl;
|
| | | import com.fgkj.dao.impl.Batt_param_lowImpl;
|
| | | import com.fgkj.dao.impl.Batttestdata_infDAOImpl;
|
| | | import com.fgkj.dao.impl.BatttestdatastopDAOImpl;
|
| | | import com.fgkj.dao.impl.Process_surveyImpl;
|
| | | import com.fgkj.dao.impl.ram.Bts_station_stateImpl;
|
| | | import com.fgkj.dao.impl.ram.Fbs9100_setparamImpl;
|
| | | import com.fgkj.db.DBUtil;
|
| | | import com.fgkj.dto.App_Sys;
|
| | | import com.fgkj.dto.BattInf;
|
| | | import com.fgkj.dto.BattInf_Rebuild;
|
| | | import com.fgkj.dto.Batt_Maint_Dealarm;
|
| | | import com.fgkj.dto.Batt_param_low;
|
| | | import com.fgkj.dto.Batttestdata_inf;
|
| | | import com.fgkj.dto.Batttestdatastop;
|
| | | import com.fgkj.dto.Page;
|
| | | import com.fgkj.dto.Process_survey;
|
| | | import com.fgkj.dto.ServiceModel;
|
| | | import com.fgkj.dto.User_inf;
|
| | |
|
| | | public class BattInfServices {
|
| | | private ServiceModel model;
|
| | |
| | | public ServiceModel add(Object obj) {
|
| | | Boolean bl=dao.add(obj);
|
| | | if(bl){
|
| | | //将主程序的服务设为重启
|
| | | /*//将主程序的服务设为重启
|
| | | Process_survey process=new Process_survey();
|
| | | process.setProcessName(ProcessServerDao.BMS_FBSDEV);
|
| | | Boolean b=(new Process_surveyImpl()).update(process);
|
| | | Boolean b=(new Process_surveyImpl()).update(process);*/
|
| | | /*App_Sys as=new App_Sys();
|
| | | as.setAppServer_Reinit_BattGroupData_EN(BattTestData.AppServer_Reinit_BattGroupData_EN);
|
| | | Boolean b=(new App_SysImpl()).update(as);*/
|
| | | BattTestData.run_cmd();
|
| | | model.setCode(1);
|
| | | model.setMsg("添加成功!");
|
| | | }
|
| | |
| | | public ServiceModel update(Object obj) {
|
| | | Boolean bl=dao.update(obj);
|
| | | if(bl){
|
| | | //将主程序的服务设为重启
|
| | | /*//将主程序的服务设为重启
|
| | | Process_survey process=new Process_survey();
|
| | | process.setProcessName(ProcessServerDao.BMS_FBSDEV);
|
| | | Boolean b=(new Process_surveyImpl()).update(process);
|
| | | Boolean b=(new Process_surveyImpl()).update(process);*/
|
| | | /*App_Sys as=new App_Sys();
|
| | | as.setAppServer_Reinit_BattGroupData_EN(BattTestData.AppServer_Reinit_BattGroupData_EN);
|
| | | Boolean b=(new App_SysImpl()).update(as);*/
|
| | | BattTestData.run_cmd();
|
| | | model.setCode(1);
|
| | | model.setMsg("修改成功!");
|
| | | }
|
| | |
| | | PreparedStatement ps=null;
|
| | | boolean b=((BattInfImpl)dao).updateIp(obj);
|
| | | if(b){
|
| | | boolean bl=(new Fbs9100_setparamImpl()).sendCmdToFBS9100Dev(binf.getNum(), binf.getFBSDeviceId());
|
| | | boolean bl=(new Fbs9100_setparamImpl()).sendCmdToFBS9100Dev(binf.getNum(),FBS9100_ComBase.CMD_TESTCMD_NULL, binf.getFBSDeviceId());
|
| | | if(bl){
|
| | | //将6185的服务设为重启
|
| | | Process_survey process=new Process_survey();
|
| | |
| | | model.setCode(1);
|
| | | model.setMsg("修改成功!");
|
| | | }else{
|
| | | System.out.println(bl);
|
| | | //System.out.println(bl);
|
| | | binf.setFbsDeviceIp(binf.getFbsDeviceIp_old());
|
| | | binf.setFbsDeviceIp_WG(binf.getFbsDeviceIp_WG_old());
|
| | | binf.setFbsDeviceIp_YM(binf.getFbsDeviceIp_YM_old());
|
| | |
| | | //System.out.println(model);
|
| | | return model;
|
| | | }
|
| | | |
| | | //设置电池组充电电流阈值
|
| | | public ServiceModel update_charge(Object obj){
|
| | | boolean bl=((BattInfImpl)dao).update_charge(obj);
|
| | | if(bl){ |
| | | model.setCode(1);
|
| | | model.setMsg("修改成功!");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setMsg("修改失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | | //删除电池组
|
| | | public ServiceModel delete(Object obj) {
|
| | | Boolean bl=dao.del(obj);
|
| | | if(bl){
|
| | | //将主程序的服务设为重启
|
| | | /*//将主程序的服务设为重启
|
| | | Process_survey process=new Process_survey();
|
| | | process.setProcessName(ProcessServerDao.BMS_FBSDEV);
|
| | | Boolean b=(new Process_surveyImpl()).update(process);
|
| | | Boolean b=(new Process_surveyImpl()).update(process);*/
|
| | | /*App_Sys as=new App_Sys();
|
| | | as.setAppServer_Reinit_BattGroupData_EN(BattTestData.AppServer_Reinit_BattGroupData_EN);
|
| | | Boolean b=(new App_SysImpl()).update(as);*/
|
| | | BattTestData.run_cmd();
|
| | | model.setCode(1);
|
| | | model.setMsg("删除成功!");
|
| | | }
|
| | |
| | | //根据维护区和机房名称查询电池组信息
|
| | | public ServiceModel searchInform(Object obj) {
|
| | | List<BattInf> list=((BattInfImpl)dao).searchInform(obj);
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | model.setMsg("查询成功!");
|
| | | }
|
| | | else{
|
| | | model.setCode(0);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | | //根据维护区和机房名称查询电池组信息(电池组信息配置)<-------跨域----------->
|
| | | public ServiceModel searchInform_ky() {
|
| | | List<BattInf> list=((BattInfImpl)dao).searchInform_ky();
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | model.setMsg("查询成功!");
|
| | | }
|
| | | else{
|
| | | model.setCode(0);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | | //根据维护区和机房名称查询电池组信息
|
| | | public ServiceModel searchInform1(Object obj) {
|
| | | List<BattInf> list=((BattInfImpl)dao).searchInform1(obj);
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | |
| | | }
|
| | | return model;
|
| | | }
|
| | | //查询所有的省份(左侧导航第一层,查所有的省份)
|
| | | public ServiceModel serchAllStation_all(Object obj){
|
| | | List list=((BattInfImpl)dao).serchAllStation_all(obj);
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | model.setMsg("查询成功!");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setData(list);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | | //查询管理的市(左侧导航第二层,查所有的市,num中存放uid)
|
| | | public ServiceModel serchStationName2(Object obj){
|
| | | List list=((BattInfImpl)dao).serchStationName2(obj);
|
| | |
| | | }
|
| | | return model;
|
| | | }
|
| | | //查询管理的机房(左侧导航第三层,查所有的机房,num中存放uid)
|
| | | //查询管理的市(左侧导航第二层,查所有的市)
|
| | | public ServiceModel serchStationName2_all(Object obj){
|
| | | List list=((BattInfImpl)dao).serchStationName2_all(obj);
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | model.setMsg("查询成功!");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setData(list);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | | //查询管理的县/区(左侧导航第三层,查所有的县/区)
|
| | | public ServiceModel serchStationName5(Object obj){
|
| | | List list=((BattInfImpl)dao).serchStationName5(obj);
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | model.setMsg("查询成功!");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setData(list);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | | //查询管理的县/区(左侧导航第三层,查所有的县/区)
|
| | | public ServiceModel serchStationName5_all(Object obj){
|
| | | List list=((BattInfImpl)dao).serchStationName5_all(obj);
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | model.setMsg("查询成功!");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setData(list);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | | //查询管理的机房(左侧导航第四层,查所有的机房,num中存放uid)
|
| | | public ServiceModel serchStationName3(Object obj){
|
| | | List list=((BattInfImpl)dao).serchStationName3(obj);
|
| | | if (list != null && list.size() > 0) {
|
| | |
| | | }
|
| | | return model;
|
| | | }
|
| | | //根据机房id查询机房下的电池组信息(左侧导航第四层,根据机房查询下面的电池组,num中存放uid)
|
| | | //查询管理的机房(左侧导航第四层,查所有的机房)
|
| | | public ServiceModel serchStationName3_all(Object obj){
|
| | | List list=((BattInfImpl)dao).serchStationName3_all(obj);
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | model.setMsg("查询成功!");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setData(list);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | | //根据机房id查询机房下的电池组信息(左侧导航第五层,根据机房查询下面的电池组,num中存放uid)
|
| | | public ServiceModel serchBattByStation(Object obj){
|
| | | List list=((BattInfImpl)dao).serchBattByStation(obj);
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | model.setMsg("查询成功!");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setData(list);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | | //根据机房id查询机房下的电池组信息(左侧导航第五层,根据机房查询下面的电池组)
|
| | | public ServiceModel serchBattByStation_all(Object obj){
|
| | | List list=((BattInfImpl)dao).serchBattByStation_all(obj);
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | |
| | | //System.out.println(model);
|
| | | return model;
|
| | | }
|
| | | //电池配组管理(重要)
|
| | | public ServiceModel serchMakeGroup(Object obj){
|
| | | List<BattInf> list=((BattInfImpl)dao).serchMakeGroup(obj);
|
| | | Batt_param_low capLow=new Batt_param_low();
|
| | | capLow.setLow_type(BattCapFactory.CapType_type);//2容量
|
| | | capLow.setLow_nametype(BattCapFactory.CapType_name);//1次低
|
| | | capLow.setLow_method(BattCapFactory.CapType_method);//0
|
| | | List<Batt_param_low> listp=(new Batt_param_lowImpl()).serchByLow(capLow);
|
| | | float param=0f;//阈值
|
| | | if(listp!=null&&listp.size()>0){
|
| | | param=listp.get(listp.size()-1).getLow_value();//0.1
|
| | | }
|
| | | if(list!=null&&list.size()>0){
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | BattInf binf=list.get(i);
|
| | | List<Batttestdatastop> list_sdata=new ArrayList();
|
| | | //筛选出电池组有效的节能放电记录
|
| | | List<Batttestdata_inf> list_tinf=(new Batttestdata_infDAOImpl()).Batt_selecteffectiveBatt(binf, param);
|
| | | if(list_tinf!=null&&list_tinf.size()>0){
|
| | | Batttestdata_inf tinf=list_tinf.get(list_tinf.size()-1);
|
| | | //求出单体的实际容量
|
| | | list_sdata=(new BatttestdatastopDAOImpl().serchMakeGroup(binf, tinf));
|
| | | }else{
|
| | | List listr=(List) binf.getObj();
|
| | | for (int j = 0; j <binf.getMonCount(); j++) {
|
| | | Batttestdatastop sdata=new Batttestdatastop();
|
| | | sdata.setBattGroupId(binf.getBattGroupId());
|
| | | sdata.setNote(binf.getBattProducer());
|
| | | sdata.setMon_num(j+1);
|
| | | for (int z = 0; z < listr.size(); z++) {
|
| | | BattInf_Rebuild brinf=(BattInf_Rebuild) listr.get(z);
|
| | | if((j+1)==brinf.getOld_monum()&&sdata.getBattGroupId()==brinf.getOld_battgroupid()){
|
| | | sdata.setMon_num(-1);
|
| | | break;
|
| | | }
|
| | | if((j+1)==brinf.getNew_monum()&&sdata.getBattGroupId()==brinf.getNew_battgroupid()){
|
| | | sdata.setNote(brinf.getOld_battproducer());
|
| | | break;
|
| | | }
|
| | | }
|
| | | sdata.setTest_cap(binf.getMonCapStd());//没有放电默认为标称
|
| | | sdata.setPercent(1f);
|
| | | list_sdata.add(sdata);
|
| | | }
|
| | | }
|
| | | binf.setObj(list_sdata);
|
| | | }
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | model.setMsg("查询成功!");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | | //电池配组管理(重要)
|
| | | public ServiceModel serchGroupByInfor(Object obj){
|
| | | List<BattInf> list=((BattInfImpl)dao).serchGroupByInfor(obj);
|
| | | List list_b=new ArrayList();
|
| | | if(list!=null&&list.size()>0){
|
| | | for(int i=0;i<list.size();i++){
|
| | | BattInf binf=list.get(i);
|
| | | List<BattInf_Rebuild> listr=(List<BattInf_Rebuild>) binf.getObj();
|
| | | for (int j = 0; j <binf.getMonCount(); j++) {
|
| | | BattInf b=new BattInf();
|
| | | b.setBattGroupId(binf.getBattGroupId());
|
| | | b.setBattProducer(binf.getBattProducer());
|
| | | b.setStationName(binf.getStationName());
|
| | | b.setBattGroupName(binf.getBattGroupName());
|
| | | b.setMonVolStd(binf.getMonVolStd());
|
| | | b.setMonCapStd(binf.getMonCapStd());
|
| | | b.setStationId(binf.getStationId());
|
| | | b.setMonNum(j+1);
|
| | | for (int z = 0; z < listr.size(); z++) {
|
| | | BattInf_Rebuild brinf=(BattInf_Rebuild) listr.get(z);
|
| | | if((j+1)==brinf.getNew_monum()&&b.getBattGroupId()==brinf.getNew_battgroupid()){
|
| | | b.setBattProducer(brinf.getOld_battproducer());
|
| | | b.setNum(1);
|
| | | }
|
| | | if((j+1)==brinf.getOld_monum()&&b.getBattGroupId()==brinf.getOld_battgroupid()){
|
| | | b.setNum(0);
|
| | | }
|
| | | }
|
| | | list_b.add(b);
|
| | | }
|
| | | }
|
| | | model.setCode(1);
|
| | | model.setData(list_b);
|
| | | model.setMsg("查询成功!");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | |
|
| | | public static void main(String[] args) {
|
| | | //首页上根据stationid查询电池组的机历卡
|
| | | public ServiceModel serchBattAllInfoByStationId(Object obj){
|
| | | List list=((BattInfImpl)dao).serchBattAllInfoByStationId(obj);
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | model.setMsg("查询成功!");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | return model;
|
| | | }
|
| | | //首页上显示已安装数和全部基站数
|
| | | public ServiceModel serchDevice(Object obj){
|
| | | //int devNum=(new BattInfImpl()).serchByDeviceId(obj); //总设备数(已安装)
|
| | | List list=(new BattInfImpl()).serchByDeviceId_all(obj); //总设备数(全部)
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | model.setMsg("查询成功!");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | //System.out.println(model.getData());
|
| | | return model;
|
| | | }
|
| | | //头部查出已安装的所有机房
|
| | | public ServiceModel serchByDeviceId(Object obj){
|
| | | int devNum=(new BattInfImpl()).serchByDeviceId(obj); //总设备数(已安装)
|
| | | model.setCode(1);
|
| | | model.setSum(devNum);
|
| | | model.setMsg("查询成功!");
|
| | | return model;
|
| | | }
|
| | | //头部查出已安装的电池单体
|
| | | public ServiceModel serchByInstall_count(Object obj){
|
| | | int devNum=(new BattInfImpl()).serchByInstall_count(obj); //总设备数(已安装)
|
| | | model.setCode(1);
|
| | | model.setSum(devNum);
|
| | | model.setMsg("查询成功!");
|
| | | return model;
|
| | | }
|
| | | |
| | | //添加操作时查询出设备id
|
| | | public ServiceModel searchmaxdev_id(){
|
| | | int dev_id=BattinfGroupFactory.searchmaxdev_id();
|
| | | model.setData(dev_id);
|
| | | return model;
|
| | | }
|
| | | |
| | | public static void main(String[] args) {
|
| | | //new BattInfServices().findMenu();
|
| | | BattInf b=new BattInf();
|
| | | //b.setBattGroupId(1000005);
|
| | |
| | | b.setFbsDeviceIp_WG_old("192.168.0.1");
|
| | | b.setStationName("");
|
| | | b.setStationName1("");
|
| | | b.setStationName2("武汉市");
|
| | | b.setStationName9("");
|
| | | b.setBattGroupName("");
|
| | | b.setStationId("42070463");
|
| | | //b.setBattGroupName1("开关电源系统");
|
| | | //b.setBattProducer("光宇");
|
| | | b.setBattProducer("1");
|
| | | b.setMonCapStd(100f);
|
| | | b.setMonVolStd(12f);
|
| | | BattInfServices bs=new BattInfServices();
|
| | |
| | | bmd.setPage(page);
|
| | | //bs.searchInform(bmd);
|
| | | //bs.serchByBattGroupName(b);
|
| | | bs.updateIp(b);
|
| | | //bs.updateIp(b);
|
| | | /*ServiceModel model=bs.serchMakeGroup(b);
|
| | | List<BattInf> list=(List) model.getData();
|
| | | for (BattInf binf : list) {
|
| | | List<Batttestdatastop> list_sdata=(List) binf.getObj();
|
| | | for (Batttestdatastop s : list_sdata) {
|
| | | System.out.println(s);
|
| | | }
|
| | | }*/
|
| | | //BattTestData.run_cmd(BattTestData.STRCMD);
|
| | | User_inf uinf=new User_inf();
|
| | | uinf.setUId(1002);
|
| | | ServiceModel model=bs.serchDevice(uinf);
|
| | | System.out.println(model);
|
| | | }
|
| | | }
|
| | | }
|