From ea7102bdbdb56abfc1201489de7ff51d0b42ff07 Mon Sep 17 00:00:00 2001 From: 星伟 <星伟@192.168.10.27> Date: 星期日, 30 九月 2018 08:47:15 +0800 Subject: [PATCH] 电池组删除添加修改时修改app——sys中值为1+配组管理 --- gx_tieta/src/com/fgkj/dao/impl/App_SysImpl.java | 52 ++++++ gx_tieta/src/com/fgkj/dao/impl/BatttestdatastopDAOImpl.java | 74 +++++++++ gx_tieta/src/com/fgkj/dto/App_Sys.java | 76 +++++++++ gx_tieta/src/com/fgkj/actions/BattInfAction.java | 16 - gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java | 42 +++++ gx_tieta/src/com/fgkj/dto/BattInf.java | 68 +++++--- gx_tieta/src/com/fgkj/dao/BattTestData.java | 2 gx_tieta/src/com/fgkj/dto/Batt_Maint_Dealarm.java | 1 gx_tieta/src/com/fgkj/services/BattInfServices.java | 91 ++++++++++- gx_tieta/src/com/fgkj/dao/impl/Batttestdata_infDAOImpl.java | 40 ++++ 10 files changed, 413 insertions(+), 49 deletions(-) diff --git a/gx_tieta/src/com/fgkj/actions/BattInfAction.java b/gx_tieta/src/com/fgkj/actions/BattInfAction.java index 303fa16..89b44ee 100644 --- a/gx_tieta/src/com/fgkj/actions/BattInfAction.java +++ b/gx_tieta/src/com/fgkj/actions/BattInfAction.java @@ -242,9 +242,6 @@ result = ActionUtil.tojson(model); return SUCCESS; } - - - //鎼滅储鏈烘埧鎴栫數姹犵粍 public String serchStationOrBattgroup(){ BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class); @@ -298,6 +295,13 @@ return SUCCESS; } + //鐢垫睜閰嶇粍绠$悊(閲嶈) + public String serchMakeGroup(){ + BattInf binf=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class); + ServiceModel model = service.serchMakeGroup(binf); + result = ActionUtil.tojson(model); + return SUCCESS; + } public BattInf getBif() { return bif; } @@ -331,12 +335,6 @@ this.btdif = btdif; } - - -// public ServiceModel getModel() { -// return model; -// } - public void setJson(String json) { this.json = json; diff --git a/gx_tieta/src/com/fgkj/dao/BattTestData.java b/gx_tieta/src/com/fgkj/dao/BattTestData.java index 8912670..1bae5f1 100644 --- a/gx_tieta/src/com/fgkj/dao/BattTestData.java +++ b/gx_tieta/src/com/fgkj/dao/BattTestData.java @@ -4,6 +4,8 @@ final public static int BATT_DISCHARGE=3;//鏀剧數娴嬭瘯 final public static int BATT_RES=5;//鍐呴樆娴嬭瘯 + final public static int AppServer_Reinit_BattGroupData_EN=1;//淇敼鍒犻櫎娣诲姞鐢垫睜缁勪俊鎭椂璇嗗埆淇″彿 + final public static int BATT_MON_COUNT_MAX = 512; final public static byte BATTDATA_NULL = 0; diff --git a/gx_tieta/src/com/fgkj/dao/impl/App_SysImpl.java b/gx_tieta/src/com/fgkj/dao/impl/App_SysImpl.java new file mode 100644 index 0000000..b931b71 --- /dev/null +++ b/gx_tieta/src/com/fgkj/dao/impl/App_SysImpl.java @@ -0,0 +1,52 @@ +package com.fgkj.dao.impl; + +import java.sql.ResultSet; +import java.util.List; + +import com.fgkj.dao.BaseDAO; +import com.fgkj.dao.BattTestData; +import com.fgkj.dao.CallBack; +import com.fgkj.dao.DAOHelper; +import com.fgkj.db.DBUtil; +import com.fgkj.dto.App_Sys; + +public class App_SysImpl implements BaseDAO,CallBack{ + + public List getResults(ResultSet rs) { + // TODO Auto-generated method stub + return null; + } + + public boolean add(Object obj) { + // TODO Auto-generated method stub + return false; + } + //鐢垫睜缁勪俊鎭坊鍔犱慨鏀瑰拰鍒犻櫎涓嶉噸鍚富绋嬪簭锛屽彧淇敼AppServer_Reinit_BattGroupData_EN鍊间负false + public boolean update(Object obj) { + App_Sys as=(App_Sys) obj; + String sql=" update db_app_sys.tb_app_sys set AppServer_Reinit_BattGroupData_EN=? "; + boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[]{as.getAppServer_Reinit_BattGroupData_EN()}); + return bl; + } + + public boolean del(Object obj) { + // TODO Auto-generated method stub + return false; + } + + public List searchAll() { + // TODO Auto-generated method stub + return null; + } + + public List serchByCondition(Object obj) { + // TODO Auto-generated method stub + return null; + } + + public List serchByInfo(Object obj) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java index 855d1e8..7f53011 100644 --- a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java +++ b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java @@ -29,6 +29,7 @@ import com.fgkj.dto.Batt_Maint_Dealarm; import com.fgkj.dto.Batt_maint_inf; import com.fgkj.dto.Batt_maintenance_inf; +import com.fgkj.dto.Batttestdata; import com.fgkj.dto.Batttestdata_inf; import com.fgkj.dto.Batttestdatastop; import com.fgkj.dto.Limit; @@ -3478,6 +3479,47 @@ return nums; } + + //鐢垫睜閰嶇粍绠$悊(閲嶈) + public List serchMakeGroup(Object obj){ + BattInf binf=(BattInf) obj; + String sql="SELECT distinct BattGroupId,stationid,stationname1,stationname2,stationname,stationname3,BattProducer,MonVolStd,MonCapStd,monCount from db_battinf.tb_battinf where stationname2 like ? "; + //閫変腑鍝佺墝涓�鑷� + String producerSqlT=" order by BattProducer,MonCapStd,MonVolStd ";//涓�鑷� + String producerSqlF=" order by MonCapStd,MonVolStd ";//涓嶄竴鑷� + if(binf.getBattProducer().equals("1")){ + sql+=producerSqlT; + }else{ + sql+=producerSqlF; + } + List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{"%"+binf.getStationName2()+"%"}, new CallBack() { + + public List getResults(ResultSet rs) { + List list=new ArrayList(); + try { + while(rs.next()){ + BattInf binf=new BattInf(); + binf.setBattGroupId(rs.getInt("battGroupId")); + binf.setStationId(rs.getString("stationId")); + binf.setStationName(rs.getString("stationName")); + binf.setStationName1(rs.getString("stationName1")); + binf.setStationName2(rs.getString("stationName2")); + binf.setStationName3(rs.getString("stationName3")); + binf.setBattProducer(rs.getString("battProducer")); + binf.setMonVolStd(rs.getFloat("monVolStd")); + binf.setMonCapStd(rs.getFloat("monCapStd")); + binf.setMonCount(rs.getInt("monCount")); + list.add(binf); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return list; + } + }); + return list; + } public static void main(String[] args) throws ParseException { //new BattInfImpl().searchAll(); diff --git a/gx_tieta/src/com/fgkj/dao/impl/Batttestdata_infDAOImpl.java b/gx_tieta/src/com/fgkj/dao/impl/Batttestdata_infDAOImpl.java index c854400..1fd9d7b 100644 --- a/gx_tieta/src/com/fgkj/dao/impl/Batttestdata_infDAOImpl.java +++ b/gx_tieta/src/com/fgkj/dao/impl/Batttestdata_infDAOImpl.java @@ -957,7 +957,45 @@ }); return list; } - + //鐢垫睜閰嶇粍鐢ㄥ埌(绛涢�夊嚭鏈夋晥鐨勬渶杩戠殑涓�娆¤妭鑳芥斁鐢垫妧鏈�) + public List Batt_selecteffectiveBatt(Object obj,float param){ + BattInf binf=(BattInf) obj; + String sql="SELECT distinct battGroupId,test_starttime,record_time,test_cap,max_monvol,min_monvol,test_record_count,test_curr FROM db_batt_testdata.tb_batttestdata_inf " + + " WHERE BattGroupId =? " + + " AND data_available=1 AND data_new = 1 AND " + + " test_type = 3 AND test_starttype = 3 AND " //鍒ゆ柇鏄妭鑳芥斁鐢� + + " abs(test_cap) >?*? " //鍒ゆ柇娴嬭瘯鏁版嵁瀹归噺鏄惁鏈夋晥 + + " ORDER BY test_record_count DESC LIMIT 1 "; + + List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getBattGroupId(),binf.getMonCapStd(),param}, new CallBack() { + + public List getResults(ResultSet rs) { + List list=new ArrayList(); + try { + while(rs.next()){ + Batttestdata_inf tinf=new Batttestdata_inf(); + tinf.setBattGroupId(rs.getInt("battGroupId")); + if(rs.getString("test_starttime")!=null) + tinf.setTest_starttime(rs.getTimestamp("test_starttime")); + if(rs.getString("record_time")!=null) + tinf.setRecord_time(rs.getTimestamp("record_time")); + tinf.setTest_cap(rs.getFloat("test_cap")); + tinf.setMax_monvol(rs.getFloat("max_monvol")); + tinf.setMin_monvol(rs.getFloat("min_monvol")); + tinf.setTest_record_count(rs.getInt("test_record_count")); + tinf.setTest_curr(rs.getFloat("test_curr")); + list.add(tinf); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return list; + } + }); + return list; + } + public static void main(String[] args) throws ParseException { Batttestdata_infDAOImpl bimpl=new Batttestdata_infDAOImpl(); Batttestdata_inf tdata=new Batttestdata_inf(); diff --git a/gx_tieta/src/com/fgkj/dao/impl/BatttestdatastopDAOImpl.java b/gx_tieta/src/com/fgkj/dao/impl/BatttestdatastopDAOImpl.java index 7826009..9f9e6f1 100644 --- a/gx_tieta/src/com/fgkj/dao/impl/BatttestdatastopDAOImpl.java +++ b/gx_tieta/src/com/fgkj/dao/impl/BatttestdatastopDAOImpl.java @@ -420,6 +420,80 @@ } return listB; } + //鐢垫睜閰嶇粍绠$悊(閲嶈) + public List serchMakeGroup(Object obj1,Object obj2){ + BattInf binf=(BattInf) obj1; + Batttestdata_inf tinf=(Batttestdata_inf) obj2; + String sql="select num,BattGroupId,test_record_count,test_type,data_new,data_available,record_num,test_starttime,record_time,test_timelong,group_vol," + + " test_curr,test_cap,mon_num,mon_vol " + + " from db_batt_testdata.tb_batttestdatastop_"+tinf.getBattGroupId()+" " + + " where " + + "test_record_count=? and record_time=? " + + " and db_batt_testdata.tb_batttestdatastop_"+tinf.getBattGroupId()+".data_available=1 ";//tb_batttestdatastop_id琛ㄤ腑绛涢�夊嚭瀹為檯鐢靛帇>鏍囧瓨鐢靛帇*0.9鐨勬椂鐨勯偅绗旀暟鎹�,new Object[]{tdata.getTest_record_count(),tdata.getRecord_time()} + + List<Batttestdatastop> list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{tinf.getTest_record_count(),tinf.getRecord_time()}, new CallBack() { + + public List getResults(ResultSet rs) { + List<Batttestdatastop> list=new ArrayList<Batttestdatastop>(); + try { + while(rs.next()){ + Batttestdatastop sdata=new Batttestdatastop(); + sdata.setNum(rs.getInt("num")); + sdata.setBattGroupId(rs.getInt("BattGroupId")); + sdata.setTest_record_count(rs.getInt("test_record_count")); + sdata.setTest_type(rs.getInt("test_type")); + sdata.setData_new(rs.getInt("data_new")); + sdata.setData_available(rs.getInt("data_available")); + sdata.setRecord_num(rs.getInt("record_num")); + sdata.setTest_starttime(rs.getTimestamp("test_starttime")); + sdata.setRecord_time(rs.getTimestamp("record_time")); + sdata.setTest_timelong(rs.getInt("test_timelong")); + sdata.setGroup_vol(rs.getFloat("group_vol")); + sdata.setTest_curr(rs.getFloat("test_curr")); + sdata.setTest_cap(rs.getFloat("test_cap")); + sdata.setMon_num(rs.getInt("mon_num")); + sdata.setMon_vol(rs.getFloat("mon_vol")); + list.add(sdata); + + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return list; + } + }); + double realCap=0;//瀹為檯瀹归噺 + double STDAH=0;//鏍囧瓨瀹归噺 + int hourRate=0;//灏忔椂鐜� + double current=0;//褰撳墠鐢垫祦 + double SumAH=0;//娴嬭瘯瀹归噺 + double MaxMonomerVol=0;//鏈�澶х數鍘� + double MonomerVol=0; //鏈�灏忕數鍘� + double MonomerVolType=0;//鐢垫睜鐢靛帇绫诲瀷 + int flag=1;//鐢垫睜鍗曚綋鍛婅鏍囪瘑 + if(list!=null&&list.size()>0){ + for(int i=0;i<list.size();i++){ + Batttestdatastop sdata=list.get(i); + STDAH=binf.getMonCapStd(); + MonomerVolType=binf.getMonVolStd(); + + current=sdata.getTest_curr(); + SumAH=sdata.getTest_cap(); + MaxMonomerVol=tinf.getMax_monvol(); + MonomerVol=sdata.getMon_vol(); + hourRate=BattCapFactory.GetHourRate(STDAH, current); + if(sdata.getMon_vol()>binf.getMonVolStd()*BattTestData.test_stop){ + realCap=BattCapFactory.GetMonomerCap(STDAH, hourRate, SumAH, MaxMonomerVol, MonomerVol, MonomerVolType, BattCapFactory.CapType_Real); + }else{ + sdata.setMon_vol(binf.getMonVolStd()*BattTestData.test_stop); + realCap=(new BatttestdataDAOImpl()).serchRealCap(sdata); + } + sdata.setTest_cap((float)realCap); + } + } + return list; + } //鏌ヨ鎸囧畾鐢垫睜缁勬寚瀹氬崟浣撶殑瀹為檯瀹归噺 public double serchRealCapByMon_num(Object obj) { BattInf binf=(BattInf) obj; diff --git a/gx_tieta/src/com/fgkj/dto/App_Sys.java b/gx_tieta/src/com/fgkj/dto/App_Sys.java new file mode 100644 index 0000000..e54e285 --- /dev/null +++ b/gx_tieta/src/com/fgkj/dto/App_Sys.java @@ -0,0 +1,76 @@ +package com.fgkj.dto; + +import java.io.Serializable; +import java.util.Date; + +public class App_Sys implements Serializable { + private int num; + private float SqlDB_Version; + private Date SqlDB_BackUpTime; + private int SqlDB_BackUpManual_EN; + private int AppServer_Reinit_BattGroupData_EN; + private float AppServer_Version; + private float AppClient_Version; + private String AppName; + public int getNum() { + return num; + } + public void setNum(int num) { + this.num = num; + } + public float getSqlDB_Version() { + return SqlDB_Version; + } + public void setSqlDB_Version(float sqlDB_Version) { + SqlDB_Version = sqlDB_Version; + } + public Date getSqlDB_BackUpTime() { + return SqlDB_BackUpTime; + } + public void setSqlDB_BackUpTime(Date sqlDB_BackUpTime) { + SqlDB_BackUpTime = sqlDB_BackUpTime; + } + public int getSqlDB_BackUpManual_EN() { + return SqlDB_BackUpManual_EN; + } + public void setSqlDB_BackUpManual_EN(int sqlDB_BackUpManual_EN) { + SqlDB_BackUpManual_EN = sqlDB_BackUpManual_EN; + } + public int getAppServer_Reinit_BattGroupData_EN() { + return AppServer_Reinit_BattGroupData_EN; + } + public void setAppServer_Reinit_BattGroupData_EN( + int appServer_Reinit_BattGroupData_EN) { + AppServer_Reinit_BattGroupData_EN = appServer_Reinit_BattGroupData_EN; + } + public float getAppServer_Version() { + return AppServer_Version; + } + public void setAppServer_Version(float appServer_Version) { + AppServer_Version = appServer_Version; + } + public float getAppClient_Version() { + return AppClient_Version; + } + public void setAppClient_Version(float appClient_Version) { + AppClient_Version = appClient_Version; + } + public String getAppName() { + return AppName; + } + public void setAppName(String appName) { + AppName = appName; + } + @Override + public String toString() { + return "App_Sys [num=" + num + ", SqlDB_Version=" + SqlDB_Version + + ", SqlDB_BackUpTime=" + SqlDB_BackUpTime + + ", SqlDB_BackUpManual_EN=" + SqlDB_BackUpManual_EN + + ", AppServer_Reinit_BattGroupData_EN=" + + AppServer_Reinit_BattGroupData_EN + ", AppServer_Version=" + + AppServer_Version + ", AppClient_Version=" + + AppClient_Version + ", AppName=" + AppName + "]"; + } + + +} diff --git a/gx_tieta/src/com/fgkj/dto/BattInf.java b/gx_tieta/src/com/fgkj/dto/BattInf.java index 2b61ba0..5c8b7fb 100644 --- a/gx_tieta/src/com/fgkj/dto/BattInf.java +++ b/gx_tieta/src/com/fgkj/dto/BattInf.java @@ -3,7 +3,11 @@ import java.io.Serializable; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; +import java.util.List; + +import com.mysql.fabric.xmlrpc.base.Array; /** * @author 鏄熶紵 @@ -70,11 +74,10 @@ private Integer StartNum; private Integer Size; + private Object obj; public BattInf() { super(); - // TODO Auto-generated constructor stub } - public Integer getNum() { return num; } @@ -486,7 +489,13 @@ public void setBattGuarantDayCount(Integer battGuarantDayCount) { BattGuarantDayCount = battGuarantDayCount; } - + + public Object getObj() { + return obj; + } + public void setObj(Object obj) { + this.obj = obj; + } @Override public String toString() { return "BattInf [num=" + num + ", StationId=" + StationId @@ -499,32 +508,35 @@ + ", StationName9=" + StationName9 + ", StationIp=" + StationIp + ", FBSDeviceId=" + FBSDeviceId + ", FbsDeviceIp=" + FbsDeviceIp + ", FbsDeviceIp_YM=" + FbsDeviceIp_YM - + ", FbsDeviceIp_WG=" + FbsDeviceIp_WG + ", FBSDeviceName=" - + FBSDeviceName + ", GroupIndexInFBSDevice=" - + GroupIndexInFBSDevice + ", BattModel=" + BattModel - + ", BattGroupId=" + BattGroupId + ", BattGroupNum=" - + BattGroupNum + ", BattGroupName=" + BattGroupName - + ", BattGroupName1=" + BattGroupName1 + ", BattGroupName2=" - + BattGroupName2 + ", BattGroupName3=" + BattGroupName3 - + ", BattGroupName4=" + BattGroupName4 + ", BattGroupName5=" - + BattGroupName5 + ", BattGroupName6=" + BattGroupName6 - + ", FloatVolLevel=" + FloatVolLevel + ", OfflineVolLevel=" - + OfflineVolLevel + ", BattFloatCurrent=" + BattFloatCurrent - + ", DeviceId=" + DeviceId + ", DeviceName=" + DeviceName - + ", MonCount=" + MonCount + ", MonCapStd=" + MonCapStd - + ", MonResStd=" + MonResStd + ", MonSerStd=" + MonSerStd - + ", MonTmpStd=" + MonTmpStd + ", MonVolStd=" + MonVolStd - + ", MonVolLowToAvg=" + MonVolLowToAvg + ", MonNum=" + MonNum - + ", BattProducer=" + BattProducer + ", BattProductDate=" - + BattProductDate + ", BattProductDate1=" + BattProductDate1 - + ", BattInUseDate=" + BattInUseDate + ", BattInUseDate1=" - + BattInUseDate1 + ", BattGuarantDayCount=" - + BattGuarantDayCount + ", SignalId=" + SignalId - + ", CInterFaceId=" + CInterFaceId + ", Load_curr=" + Load_curr - + ", SignalName=" + SignalName + ", StartNum=" + StartNum - + ", Size=" + Size + "]"; + + ", FbsDeviceIp_WG=" + FbsDeviceIp_WG + ", FbsDeviceIp_old=" + + FbsDeviceIp_old + ", FbsDeviceIp_YM_old=" + + FbsDeviceIp_YM_old + ", FbsDeviceIp_WG_old=" + + FbsDeviceIp_WG_old + ", FBSDeviceName=" + FBSDeviceName + + ", GroupIndexInFBSDevice=" + GroupIndexInFBSDevice + + ", BattModel=" + BattModel + ", BattGroupId=" + BattGroupId + + ", BattGroupNum=" + BattGroupNum + ", BattGroupName=" + + BattGroupName + ", BattGroupName1=" + BattGroupName1 + + ", BattGroupName2=" + BattGroupName2 + ", BattGroupName3=" + + BattGroupName3 + ", BattGroupName4=" + BattGroupName4 + + ", BattGroupName5=" + BattGroupName5 + ", BattGroupName6=" + + BattGroupName6 + ", FloatVolLevel=" + FloatVolLevel + + ", OfflineVolLevel=" + OfflineVolLevel + + ", BattFloatCurrent=" + BattFloatCurrent + ", DeviceId=" + + DeviceId + ", DeviceName=" + DeviceName + ", MonCount=" + + MonCount + ", MonCapStd=" + MonCapStd + ", MonResStd=" + + MonResStd + ", MonSerStd=" + MonSerStd + ", MonTmpStd=" + + MonTmpStd + ", MonVolStd=" + MonVolStd + ", MonVolLowToAvg=" + + MonVolLowToAvg + ", MonNum=" + MonNum + ", BattProducer=" + + BattProducer + ", BattProductDate=" + BattProductDate + + ", BattProductDate1=" + BattProductDate1 + ", BattInUseDate=" + + BattInUseDate + ", BattInUseDate1=" + BattInUseDate1 + + ", BattGuarantDayCount=" + BattGuarantDayCount + + ", SignalId=" + SignalId + ", CInterFaceId=" + CInterFaceId + + ", Load_curr=" + Load_curr + ", SignalName=" + SignalName + + ", StartNum=" + StartNum + ", Size=" + Size + ", obj=" + obj + + "]"; } - + diff --git a/gx_tieta/src/com/fgkj/dto/Batt_Maint_Dealarm.java b/gx_tieta/src/com/fgkj/dto/Batt_Maint_Dealarm.java index e3d24c9..f210e6e 100644 --- a/gx_tieta/src/com/fgkj/dto/Batt_Maint_Dealarm.java +++ b/gx_tieta/src/com/fgkj/dto/Batt_Maint_Dealarm.java @@ -1,6 +1,7 @@ package com.fgkj.dto; import java.io.Serializable; +import java.util.List; public class Batt_Maint_Dealarm implements Serializable{ private BattInf binf; //battinf瀵硅薄淇℃伅 diff --git a/gx_tieta/src/com/fgkj/services/BattInfServices.java b/gx_tieta/src/com/fgkj/services/BattInfServices.java index a6c5028..0875b15 100644 --- a/gx_tieta/src/com/fgkj/services/BattInfServices.java +++ b/gx_tieta/src/com/fgkj/services/BattInfServices.java @@ -4,21 +4,32 @@ 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; @@ -35,10 +46,13 @@ 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); model.setCode(1); model.setMsg("娣诲姞鎴愬姛!"); } @@ -53,10 +67,13 @@ 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); model.setCode(1); model.setMsg("淇敼鎴愬姛!"); } @@ -82,7 +99,7 @@ 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()); @@ -101,10 +118,13 @@ 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); model.setCode(1); model.setMsg("鍒犻櫎鎴愬姛!"); } @@ -722,7 +742,47 @@ //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()/binf.getMonCount());//娌℃湁鏀剧數榛樿涓烘爣绉� + 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(); @@ -737,11 +797,12 @@ 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(); @@ -765,6 +826,14 @@ 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); + } + } + } } -} -- Gitblit v1.9.1