package com.fgkj.services;
|
|
import java.sql.Connection;
|
import java.sql.PreparedStatement;
|
import java.sql.ResultSet;
|
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.BattTestData;
|
import com.fgkj.dao.BattinfGroupFactory;
|
import com.fgkj.dao.CallBack;
|
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.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.Page;
|
import com.fgkj.dto.Process_survey;
|
import com.fgkj.dto.ServiceModel;
|
|
public class BattInfServices {
|
private ServiceModel model;
|
private BaseDAO dao;
|
|
public BattInfServices() {
|
this.model = new ServiceModel();
|
this.dao = BaseDAOFactory.getBaseDAO(BaseDAO.BATTINF);
|
}
|
//添加新的电池组
|
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);*/
|
/*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("添加成功!");
|
}
|
else{
|
model.setCode(0);
|
model.setMsg("添加失败!");
|
}
|
return model;
|
|
}
|
//修改电池组信息
|
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);*/
|
/*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("修改成功!");
|
}
|
else{
|
model.setCode(0);
|
model.setMsg("修改失败!");
|
}
|
return model;
|
}
|
//修改电池信息配置(ip地址,掩码和网关)
|
public ServiceModel updateIp(Object obj) {
|
BattInf binf=(BattInf) obj;
|
Connection conn=DBUtil.getConn();
|
PreparedStatement ps=null;
|
boolean b=((BattInfImpl)dao).updateIp(obj);
|
if(b){
|
boolean bl=(new Fbs9100_setparamImpl()).sendCmdToFBS9100Dev(binf.getNum(),0, binf.getFBSDeviceId());
|
if(bl){
|
//将6185的服务设为重启
|
Process_survey process=new Process_survey();
|
process.setProcessName(ProcessServerDao.BMS_FBS61850_BATT);
|
Boolean bt=(new Process_surveyImpl()).update(process);
|
model.setCode(1);
|
model.setMsg("修改成功!");
|
}else{
|
System.out.println(bl);
|
binf.setFbsDeviceIp(binf.getFbsDeviceIp_old());
|
binf.setFbsDeviceIp_WG(binf.getFbsDeviceIp_WG_old());
|
binf.setFbsDeviceIp_YM(binf.getFbsDeviceIp_YM_old());
|
((BattInfImpl)dao).updateIp(binf);
|
model.setCode(0);
|
model.setMsg("修改61850设备IP信息失败,请检查网络!");
|
}
|
}else{
|
model.setCode(0);
|
model.setMsg("修改失败!");
|
}
|
//System.out.println(model);
|
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);*/
|
/*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("删除成功!");
|
}
|
else{
|
model.setCode(0);
|
model.setMsg("删除失败!");
|
}
|
return model;
|
}
|
//根据维护区和机房名称查询电池组信息
|
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 searchAll() {
|
List list = dao.searchAll();
|
/*for (int i = 0; i < 100; i++) {
|
System.out.println(list.get(i));
|
}
|
System.out.println("查询结束。。。");*/
|
if (list != null && list.size() > 0) {
|
model.setCode(1);
|
model.setData(list);
|
}
|
return model;
|
}
|
public ServiceModel serchByCondition(Object obj) {
|
BattInf bif=(BattInf) obj;
|
List<BattInf> list=dao.serchByCondition(bif);
|
model=new ServiceModel();
|
if (list != null && list.size() > 0) {
|
model.setCode(1);
|
model.setData(list);
|
model.setSum(list.size());
|
}
|
return model;
|
}
|
//查询出当前存在内存中最大的设备的id(很重要**********)
|
public ServiceModel searchMaxdevId_binf(){
|
int id=((BattInfImpl)dao).searchMaxdevId_binf();
|
if(id!=0){
|
model.setCode(1);
|
model.setData(id);
|
}else{
|
model.setCode(0);
|
model.setData(910000001);
|
}
|
return model;
|
}
|
|
//查询电池组左侧导航菜单(实时监测,历史数据查询)
|
public ServiceModel findMenu() {
|
BattInfImpl dtdao=(BattInfImpl)dao;
|
List<List> list = dtdao.findMenu();
|
model.setCode(1);
|
model.setData(list);
|
return model;
|
}
|
public ServiceModel findByBattGroupId(Object obj) {
|
List list=((BattInfImpl)dao).serchByBattgroupId(obj);
|
if (list != null && list.size() > 0) {
|
model.setCode(1);
|
model.setData(list);
|
}
|
return model;
|
}
|
//----------根据StationName1(维护区) 查不重复BattGroupName(蓄电池组)
|
public ServiceModel serchByStationName1(Object obj) {
|
List list=((BattInfImpl)dao).serchByStationName1(obj);
|
if (list != null && list.size() > 0) {
|
model.setCode(1);
|
model.setData(list);
|
model.setSum(list.size());
|
}
|
//System.out.println(model);
|
return model;
|
}
|
|
// ----------根据StationName1(维护区) 查不重复的StationName(站点)
|
public ServiceModel serchByStationName(Object obj) {
|
List list=((BattInfImpl)dao).serchByStationName(obj);
|
if (list != null && list.size() > 0) {
|
model.setCode(1);
|
model.setData(list);
|
model.setSum(list.size());
|
}
|
return model;
|
}
|
|
// ----------根据StationName1(维护区) 查不重复的StationName(站点)不包含91000000一期设备
|
public ServiceModel serchByStationNameNot91(Object obj) {
|
List list=((BattInfImpl)dao).serchByStationNameNot91(obj);
|
if (list != null && list.size() > 0) {
|
model.setCode(1);
|
model.setData(list);
|
model.setSum(list.size());
|
}
|
return model;
|
}
|
//-----------查询所有的省份
|
public ServiceModel serchAllStationName1(Object obj) {
|
List list=((BattInfImpl)dao).serchAllStationName1(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 serchAllStationName2(Object obj) {
|
List list=((BattInfImpl)dao).serchAllStationName2(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 serchAllStationName5(Object obj) {
|
List list=((BattInfImpl)dao).serchAllStationName5(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 serchAllStationName(Object obj) {
|
List list=((BattInfImpl)dao).serchAllStationName(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 serchAllBattinf(Object obj) {
|
List list=((BattInfImpl)dao).serchAllBattinf(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 serchByBattProducer() {
|
List list=((BattInfImpl)dao).serchByBattProducer();
|
if (list != null && list.size() > 0) {
|
model.setCode(1);
|
model.setData(list);
|
model.setSum(list.size());
|
}
|
//System.out.println(model);
|
return model;
|
}
|
//查单体电压
|
public ServiceModel serchByMonVolStd() {
|
List list=((BattInfImpl)dao).serchByMonVolStd();
|
if (list != null && list.size() > 0) {
|
model.setCode(1);
|
model.setData(list);
|
model.setSum(list.size());
|
}
|
//System.out.println(model);
|
return model;
|
}
|
//查电池容量
|
public ServiceModel serchByMonCapStd() {
|
List list=((BattInfImpl)dao).serchByMonCapStd();
|
if (list != null && list.size() > 0) {
|
model.setCode(1);
|
model.setData(list);
|
model.setSum(list.size());
|
}
|
//System.out.println(model);
|
return model;
|
}
|
//5.3添加选取电池组或者机房或者维护区(未被应用)
|
public ServiceModel serchBatt(Object obj) {
|
Boolean bl=false;
|
List<BattInf> list=(new BattInfImpl()).serchBatt(obj);
|
if(list!=null && list.size()>0){
|
model.setCode(1);
|
model.setData(list);
|
}else{
|
model.setCode(0);
|
model.setMsg("查询失败!");
|
}
|
return model;
|
}
|
|
// ----------查不重复的StationName1(维护区)
|
public ServiceModel serchByStation() {
|
List list=((BattInfImpl)dao).serchByStation();
|
if (list != null && list.size() > 0) {
|
model.setCode(1);
|
model.setData(list);
|
model.setSum(list.size());
|
}
|
return model;
|
}
|
// ----------查不重复的StationName1(维护区)不包含91000000一期设备
|
public ServiceModel serchByStationNot91() {
|
List list=((BattInfImpl)dao).serchByStationNot91();
|
if (list != null && list.size() > 0) {
|
model.setCode(1);
|
model.setData(list);
|
model.setSum(list.size());
|
}
|
return model;
|
}
|
//查单体编号
|
public ServiceModel serchByMonNum(Object obj) {
|
List list=((BattInfImpl)dao).serchByMonNum(obj);
|
if (list != null && list.size() > 0) {
|
model.setCode(1);
|
model.setData(list);
|
model.setSum(list.size());
|
}else{
|
model.setCode(0);
|
model.setSum(0);
|
}
|
return model;
|
}
|
//根据电池id查询电池的基本信息
|
public ServiceModel searchBattBybattgroupid(Object obj){
|
model=new ServiceModel();
|
List list=((BattInfImpl)dao).searchBattBybattgroupid(obj);
|
//System.out.println(list);
|
if(list!=null && list.size()>0){
|
model.setCode(1);
|
model.setData(list);
|
}
|
return model;
|
}
|
public ServiceModel serchByBattGroupName(Object obj) {
|
List list=((BattInfImpl)dao).serchByBattGroupName(obj);
|
if (list != null && list.size() > 0) {
|
model.setCode(1);
|
model.setData(list);
|
model.setSum(list.size());
|
model.setMsg("查询成功!");
|
}else{
|
model.setCode(0);
|
model.setMsg("查询失败!");
|
}
|
return model;
|
}
|
//6.4.7按地域和标称电压分组统计蓄电池组服役超期的数量
|
/*
|
* 区域层次放在stationid中
|
* battgroupnum 中存放统计方式:年度统计为0 季度统计为1
|
* moncount中存放统计季度:一季度为1 以此类推
|
* monnum 中存放年份*/
|
public ServiceModel serchBeyondTime(Object obj){
|
System.out.println(1111111111);
|
BattInf binf=(BattInf) obj;
|
int year=binf.getMonNum();//获取年份
|
int firstMonth=0;//获取起始月份
|
int lastMonth=0;//获取结束月份
|
String dateFirst=""; //起始时间
|
String dateLast=""; //结束时间
|
//做时间判断
|
if(binf.getBattGroupNum()==0){
|
firstMonth=0;//获取起始月份
|
lastMonth=11;//获取结束月份
|
}else if(binf.getBattGroupNum()==1){
|
if(binf.getMonCount()==1){
|
firstMonth=0;//获取起始月份
|
lastMonth=2;//获取结束月份
|
}else if(binf.getMonCount()==2){
|
firstMonth=3;//获取起始月份
|
lastMonth=5;//获取结束月份
|
}else if(binf.getMonCount()==3){
|
firstMonth=6;//获取起始月份
|
lastMonth=8;//获取结束月份
|
}else if(binf.getMonCount()==4){
|
firstMonth=9;//获取起始月份
|
lastMonth=11;//获取结束月份
|
}
|
}
|
try {
|
dateFirst=ActionUtil.getFirstDayOfMonth(year,firstMonth);//起始时间
|
binf.setBattInUseDate(DAOHelper.sdf.parse(dateFirst));
|
//System.out.println(dateFirst.substring(0,10));
|
dateLast=ActionUtil.getLastDayOfMonth(year,lastMonth);//结束时间
|
binf.setBattInUseDate1(DAOHelper.sdf.parse(dateLast));
|
} catch (Exception e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
|
//求总数
|
List<BattInf> list=(new BattInfImpl()).serchByMonVolStdGroup(binf);
|
List<BattInf> listB=BattinfGroupFactory.finishMonvol(list);
|
List<BattInf> listL=BattinfGroupFactory.delMonvol(listB);
|
//求超期服役的数量
|
try {
|
year=(new Date()).getYear()+1900-3;//当前时间减去年限
|
//System.out.println(year);
|
dateFirst=ActionUtil.getFirstDayOfMonth(year,firstMonth);//起始时间
|
binf.setBattInUseDate(DAOHelper.sdf.parse(dateFirst));
|
//System.out.println(binf.getBattInUseDate());
|
} catch (ParseException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
List<BattInf> listY=(new BattInfImpl()).serchBeyondTime(binf);//超期服役的电池组数
|
List<BattInf> listBY=BattinfGroupFactory.finishMonvol(listY);
|
List<BattInf> listLY=BattinfGroupFactory.delMonvol(listBY);
|
/*for (BattInf b : listBY) {
|
System.out.println("0 "+b.getBattGroupNum()+" "+
|
"2v: "+b.getBattGroupId()+" "+
|
"6v: "+b.getMonCount()+" "+
|
"12v: "+b.getMonNum());
|
}*/
|
int level = Integer.parseInt(binf.getStationId());
|
List<BattInf> listFalse=(new BattInfImpl()).serchBylevel(level);
|
/* for (BattInf b : listL) {
|
System.out.println("1 "+b.getBattGroupNum()+" "+
|
"2v: "+b.getBattGroupId()+" "+
|
"6v: "+b.getMonCount()+" "+
|
"12v: "+b.getMonNum());
|
}*/
|
List<BattInf> listEnd=BattinfGroupFactory.countAll(listL, listLY);
|
for (BattInf b : listEnd) {
|
System.out.println("2 "+b.getBattGroupNum()+" "+
|
"2v: "+b.getBattGroupId()+" 超过2v: "+b.getMonCapStd()+" "+
|
"6v: "+b.getMonCount()+" 超过6v: "+b.getMonResStd()+" "+
|
"12v: "+b.getMonNum()+" 超过12v: "+b.getMonSerStd());
|
}
|
if(listL!=null&&listL.size()>0){
|
model.setCode(1);
|
model.setData(listEnd);
|
model.setMsg("查询成功!");
|
}else{
|
model.setCode(0);
|
model.setData(listFalse);
|
System.out.println(listFalse.size());
|
model.setMsg("查询失败!");
|
}
|
return model;
|
}
|
//6.4.8按地域和标称电压分组统计蓄电池组的数量(蓄电池组数量统计)
|
/*
|
* 区域层次放在stationid中
|
* battgroupnum 中存放统计方式:年度统计为0 季度统计为1
|
* moncount中存放统计季度:一季度为1 以此类推
|
* monnum 中存放年份*/
|
public ServiceModel serchByMonVolStdGroup(Object obj){
|
BattInf binf=(BattInf) obj;
|
int year=binf.getMonNum();//获取年份
|
int firstMonth=0;//获取起始月份
|
int lastMonth=0;//获取结束月份
|
String dateFirst=""; //起始时间
|
String dateLast=""; //结束时间
|
//做时间判断
|
if(binf.getBattGroupNum()==0){
|
firstMonth=0;//获取起始月份
|
lastMonth=11;//获取结束月份
|
}else if(binf.getBattGroupNum()==1){
|
if(binf.getMonCount()==1){
|
firstMonth=0;//获取起始月份
|
lastMonth=2;//获取结束月份
|
}else if(binf.getMonCount()==2){
|
firstMonth=3;//获取起始月份
|
lastMonth=5;//获取结束月份
|
}else if(binf.getMonCount()==3){
|
firstMonth=6;//获取起始月份
|
lastMonth=8;//获取结束月份
|
}else if(binf.getMonCount()==4){
|
firstMonth=9;//获取起始月份
|
lastMonth=11;//获取结束月份
|
}
|
}
|
try {
|
dateFirst=ActionUtil.getFirstDayOfMonth(year,firstMonth);//起始时间
|
binf.setBattInUseDate(DAOHelper.sdf.parse(dateFirst));
|
//System.out.println(dateFirst.substring(0,10));
|
dateLast=ActionUtil.getLastDayOfMonth(year,lastMonth);//结束时间
|
binf.setBattInUseDate1(DAOHelper.sdf.parse(dateLast));
|
} catch (Exception e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
|
|
List<BattInf> list=(new BattInfImpl()).serchByMonVolStdGroup(binf);
|
List<BattInf> listB=BattinfGroupFactory.finishMonvol(list);
|
List<BattInf> listL=BattinfGroupFactory.delMonvol(listB);
|
//没有数据时传分组情况
|
int level = Integer.parseInt(binf.getStationId());
|
List<BattInf> listFalse=(new BattInfImpl()).serchBylevel(level);
|
// for (BattInf b : listL) {
|
// System.out.println(b.getBattGroupNum()+" "+
|
// "2v: "+b.getBattGroupId()+" "+
|
// "6v: "+b.getMonCount()+" "+
|
// "12v: "+b.getMonNum());
|
// }
|
if(listL!=null&&listL.size()>0){
|
model.setCode(1);
|
model.setData(listL);
|
model.setMsg("查询成功!");
|
}else{
|
model.setCode(0);
|
model.setData(listFalse);
|
model.setMsg("查询失败!");
|
}
|
return model;
|
}
|
//6.4.9按地域和标称电压分组统计蓄电池组品牌的数量(蓄电池供应商信息统计)
|
/*
|
* 区域层次放在stationid中
|
* battgroupnum 中存放统计方式:年度统计为0 季度统计为1
|
* moncount中存放统计季度:一季度为1 以此类推
|
* monnum 中存放年份*/
|
public ServiceModel serchByBattProducerGroup(Object obj){
|
BattInf binf=(BattInf) obj;
|
int year=binf.getMonNum();//获取年份
|
int firstMonth=0;//获取起始月份
|
int lastMonth=0;//获取结束月份
|
String dateFirst=""; //起始时间
|
String dateLast=""; //结束时间
|
//做时间判断
|
if(binf.getBattGroupNum()==0){
|
firstMonth=0;//获取起始月份
|
lastMonth=11;//获取结束月份
|
}else if(binf.getBattGroupNum()==1){
|
if(binf.getMonCount()==1){
|
firstMonth=0;//获取起始月份
|
lastMonth=2;//获取结束月份
|
}else if(binf.getMonCount()==2){
|
firstMonth=3;//获取起始月份
|
lastMonth=5;//获取结束月份
|
}else if(binf.getMonCount()==3){
|
firstMonth=6;//获取起始月份
|
lastMonth=8;//获取结束月份
|
}else if(binf.getMonCount()==4){
|
firstMonth=9;//获取起始月份
|
lastMonth=11;//获取结束月份
|
}
|
}
|
try {
|
dateFirst=ActionUtil.getFirstDayOfMonth(year,firstMonth);//起始时间
|
binf.setBattInUseDate(DAOHelper.sdf.parse(dateFirst));
|
//System.out.println(dateFirst.substring(0,10));
|
dateLast=ActionUtil.getLastDayOfMonth(year,lastMonth);//结束时间
|
binf.setBattInUseDate1(DAOHelper.sdf.parse(dateLast));
|
} catch (Exception e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
|
|
List<BattInf> list=(new BattInfImpl()).serchByBattProducerGroup(binf);
|
//没有数据时传分组情况
|
int level = Integer.parseInt(binf.getStationId());
|
List<BattInf> listFalse=(new BattInfImpl()).serchBylevel(level);
|
|
// for (BattInf b : list) {
|
// System.out.println(b.getNum()+" "+
|
// b.getStationName1()+" "+
|
// b.getStationName2()+" "+
|
// b.getStationName3()+" "+
|
// b.getStationName4()+" "+
|
// b.getBattProducer()+" "+
|
// b.getBattGroupNum());
|
// }
|
if(list!=null&&list.size()>0){
|
model.setCode(1);
|
model.setData(list);
|
model.setMsg("查询成功!");
|
}else{
|
model.setCode(0);
|
System.out.println(listFalse);
|
model.setData(listFalse);
|
model.setMsg("查询失败!");
|
}
|
return model;
|
}
|
//6.4.10按地域和标称电压分组统计蓄电池组使用时间(蓄电池投产年限统计)
|
/*
|
* 区域层次放在stationid中
|
* battgroupnum 中存放统计方式:年度统计为0 季度统计为1
|
* moncount中存放统计季度:一季度为1 以此类推
|
* monnum 中存放年份*/
|
public ServiceModel serchByBattInUseDateGroup(Object obj){
|
BattInf binf=(BattInf) obj;
|
int year=binf.getMonNum();//获取年份
|
int firstMonth=0;//获取起始月份
|
int lastMonth=0;//获取结束月份
|
String dateFirst=""; //起始时间
|
String dateLast=""; //结束时间
|
//做时间判断
|
if(binf.getBattGroupNum()==0){
|
firstMonth=0;//获取起始月份
|
lastMonth=11;//获取结束月份
|
}else if(binf.getBattGroupNum()==1){
|
if(binf.getMonCount()==1){
|
firstMonth=0;//获取起始月份
|
lastMonth=2;//获取结束月份
|
}else if(binf.getMonCount()==2){
|
firstMonth=3;//获取起始月份
|
lastMonth=5;//获取结束月份
|
}else if(binf.getMonCount()==3){
|
firstMonth=6;//获取起始月份
|
lastMonth=8;//获取结束月份
|
}else if(binf.getMonCount()==4){
|
firstMonth=9;//获取起始月份
|
lastMonth=11;//获取结束月份
|
}
|
}
|
try {
|
dateFirst=ActionUtil.getFirstDayOfMonth(year,firstMonth);//起始时间
|
binf.setBattInUseDate(DAOHelper.sdf.parse(dateFirst));
|
//System.out.println(dateFirst.substring(0,10));
|
dateLast=ActionUtil.getLastDayOfMonth(year,lastMonth);//结束时间
|
binf.setBattInUseDate1(DAOHelper.sdf.parse(dateLast));
|
} catch (Exception e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
|
|
List<BattInf> list=(new BattInfImpl()).serchByBattInUseDateGroup(binf);
|
//System.out.println(list.size());
|
//没有数据时传分组情况
|
int level = Integer.parseInt(binf.getStationId());
|
List<BattInf> listFalse=(new BattInfImpl()).serchBylevel(level);
|
|
// for (BattInf b : list) {
|
// System.out.println(b.getNum()+" "+
|
// b.getStationName1()+" "+
|
// b.getStationName2()+" "+
|
// b.getStationName3()+" "+
|
// b.getStationName4()+" "+
|
// b.getBattInUseDate()+" "+
|
// b.getBattGroupNum());
|
// }
|
if(list!=null&&list.size()>0){
|
model.setCode(1);
|
model.setData(list);
|
model.setMsg("查询成功!");
|
}else{
|
model.setCode(0);
|
model.setData(listFalse);
|
model.setMsg("查询失败!");
|
}
|
return model;
|
}
|
|
//1 根据机房id查询电池组id排序最小值
|
public ServiceModel serchByIdLow(Object obj){
|
List list=((BattInfImpl)dao).serchByIdLow(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查询机房中的电池组信息
|
* @param obj
|
* @return
|
*/
|
public ServiceModel searchBattByStationId(Object obj){
|
ServiceModel model = new ServiceModel();
|
List list = ((BattInfImpl)dao).searchBattByStationId(obj);
|
if(list != null && list.size()>0){
|
model.setCode(1);
|
model.setData(list);
|
|
}else{
|
model.setCode(0);
|
}
|
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);
|
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(list.size());
|
return model;
|
}
|
//根据机房id查询机房下的电池组信息
|
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("查询失败!");
|
}
|
//System.out.println(model);
|
return model;
|
}
|
//查询所有的电池组数
|
public ServiceModel serchAllBatt(Object obj){
|
int nums=((BattInfImpl)dao).serchAllBatt(obj);
|
model.setCode(1);
|
model.setSum(nums);
|
model.setMsg("查询成功!");
|
//System.out.println(model);
|
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 static void main(String[] args) {
|
//new BattInfServices().findMenu();
|
BattInf b=new BattInf();
|
//b.setBattGroupId(1000005);
|
b.setNum(58);
|
b.setFBSDeviceId(91000001);
|
b.setFbsDeviceIp("192.168.0.56");
|
b.setFbsDeviceIp_YM("255.255.255.0");
|
b.setFbsDeviceIp_WG("127.0.0.1");
|
b.setFbsDeviceIp_old("192.168.0.56");
|
b.setFbsDeviceIp_YM_old("255.255.255.0");
|
b.setFbsDeviceIp_WG_old("192.168.0.1");
|
b.setStationName("");
|
b.setStationName1("");
|
b.setStationName9("");
|
b.setBattGroupName("");
|
b.setStationId("42070463");
|
//b.setBattGroupName1("开关电源系统");
|
//b.setBattProducer("光宇");
|
b.setMonCapStd(100f);
|
b.setMonVolStd(12f);
|
BattInfServices bs=new BattInfServices();
|
//bs.serchByStation();
|
//bs.serchByStationName(b);
|
//bs.serchByStationName1(b);
|
//bs.serchByCondition(b);
|
|
//bs.searchBattBybattgroupid(b);
|
//bs.serchByBattGroupName(b);
|
//bs.findMenu();
|
//bs.serchAllStation();
|
//bs.serchStationOrBattgroup(b);
|
//bs.serchBattByStation(b);
|
|
Page page=new Page();
|
page.setPageCurr(1);
|
page.setPageSize(10);
|
Batt_Maint_Dealarm bmd=new Batt_Maint_Dealarm();
|
bmd.setBinf(b);
|
bmd.setPage(page);
|
//bs.searchInform(bmd);
|
//bs.serchByBattGroupName(b);
|
bs.updateIp(b);
|
}
|
}
|