| | |
| | | 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.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.Fbs9100_setparamImpl;
|
| | | import com.fgkj.db.DBUtil;
|
| | | import com.fgkj.dto.App_Sys;
|
| | | import com.fgkj.dto.BattInf;
|
| | | 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;
|
| | |
| | | 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("修改成功!");
|
| | | }
|
| | |
| | | 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());
|
| | |
| | | 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("删除成功!");
|
| | | }
|
| | |
| | | }
|
| | | return model;
|
| | | }
|
| | | //查询所有的机房
|
| | | public ServiceModel serchAllStation(Object obj){
|
| | | List list=((BattInfImpl)dao).serchAllStation(obj);
|
| | | if (list != null && list.size() > 0) {
|
| | | model.setCode(1);
|
| | | model.setData(list);
|
| | | model.setMsg("查询成功!");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setData(list);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | //System.out.println(model);
|
| | | return model;
|
| | | }
|
| | | |
| | | //搜索机房或电池组
|
| | | public ServiceModel serchStationOrBattgroup(Object obj){
|
| | | List list=((BattInfImpl)dao).serchStationOrBattgroup(obj);
|
| | |
| | | //System.out.println(list.size());
|
| | | return model;
|
| | | }
|
| | | //根据机房id查询机房下的电池组信息
|
| | | //查询所有的省份(左侧导航第一层,查所有的省份)
|
| | | public ServiceModel serchAllStation(Object obj){
|
| | | List list=((BattInfImpl)dao).serchAllStation(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);
|
| | | 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) {
|
| | | 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.setData(list);
|
| | | model.setMsg("查询失败!");
|
| | | }
|
| | | //System.out.println(model);
|
| | | return model;
|
| | | }
|
| | | //查询所有的电池组数
|
| | |
| | | //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{
|
| | | for (int j = 0; j <binf.getMonCount(); j++) {
|
| | | Batttestdatastop sdata=new Batttestdatastop();
|
| | | sdata.setMon_num(j+1);
|
| | | 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 static void main(String[] args) {
|
| | | //new BattInfServices().findMenu();
|
| | | BattInf b=new BattInf();
|
| | |
| | | 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);
|
| | | }
|
| | | }
|
| | | }
|