| | |
| | | }); |
| | | return list; |
| | | } |
| | | //取出电池组信息构建excel文件的名称 |
| | | public String serchExcelName(int battGroupId) { |
| | | String sql = " select distinct stationName1,stationName2,stationName3,stationName5,BattProducer," + |
| | | " battproductdate,MonCapStd,BattGroupName " + |
| | | " from db_battinf.tb_battinf " + |
| | | " where db_battinf.tb_battinf.battGroupId=? limit 1"; |
| | | List list = DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{battGroupId}, new CallBack() { |
| | | |
| | | public List getResults(ResultSet rs) { |
| | | List list = new ArrayList(); |
| | | try { |
| | | while (rs.next()) { |
| | | BattInf binf = new BattInf(); |
| | | binf.setStationName1(rs.getString("stationName1")); |
| | | binf.setStationName2(rs.getString("stationName2")); |
| | | binf.setStationName3(rs.getString("stationName3")); |
| | | binf.setStationName5(rs.getString("stationName5")); |
| | | binf.setBattProducer(rs.getString("BattProducer")); |
| | | binf.setBattProductDate(rs.getDate("battproductdate")); |
| | | binf.setMonCapStd(rs.getFloat("MonCapStd")); |
| | | binf.setBattGroupName(rs.getString("BattGroupName")); |
| | | list.add(binf); |
| | | } |
| | | } catch (SQLException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | String excelName=""; |
| | | if(list!=null&&list.size()>0){ |
| | | BattInf binf= (BattInf) list.get(list.size()-1); |
| | | excelName=binf.getStationName1()+"-"+binf.getStationName2()+"-"+binf.getStationName5()+"-"+binf.getStationName3() |
| | | +"-"+DAOHelper.sdfwithOut.format(binf.getBattProductDate())+"-"+(int)((float)binf.getMonCapStd())+"AH"+"-"+binf.getBattGroupName(); |
| | | } |
| | | return excelName; |
| | | } |
| | | |
| | | /** |
| | | * 根据机房id查询电池组 |
| | |
| | | return list; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws ParseException { |
| | | //new BattInfImpl().searchAll(); |
| | | |
| | | BattInfImpl biml = new BattInfImpl(); |
| | | BattInf binf = new BattInf(); |
| | | binf.setNum(1002); |
| | | binf.setBattGroupId(0); |
| | | binf.setStationName("内蒙古"); |
| | | binf.setStationName1(""); |
| | | binf.setStationName2(""); |
| | | binf.setStationName5(""); |
| | | binf.setStationName3(""); |
| | | binf.setStationId("42070450"); |
| | | |
| | | User_inf uinf = new User_inf(); |
| | | uinf.setUId(1002); |
| | | |
| | | Page p = new Page(); |
| | | p.setPageCurr(1); |
| | | p.setPageSize(50); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date date1 = sdf.parse("2000-01-01"); |
| | | Date date2 = sdf.parse("2020-01-01"); |
| | | Batttestdata_inf tdata = new Batttestdata_inf(); |
| | | tdata.setTest_type(3); |
| | | tdata.setTest_starttype(3); |
| | | tdata.setRecord_time(ActionUtil.getSimpDate(date1)); |
| | | tdata.setRecord_time1(ActionUtil.getSimpDate(date2)); |
| | | |
| | | Batt_Maint_Dealarm bmd = new Batt_Maint_Dealarm(); |
| | | bmd.setBinf(binf); |
| | | bmd.setPage(p); |
| | | bmd.setTdata(tdata); |
| | | bmd.setUinf(uinf); |
| | | //List<BattInf> list = biml.serchByConditionNew(bmd); |
| | | //List<BattInf> list=biml.serchByTestType(bmd); |
| | | /*List<BattInf> list=biml.serchGroupAssess(bmd); |
| | | for (BattInf b : list) { |
| | | System.out.println(b); |
| | | }*/ |
| | | /*List<BattInf> list=biml.serchBattPlan(binf); |
| | | for (BattInf b : list) { |
| | | System.out.println(b.getBattGroupId()+" "+b.getFBSDeviceId()+" "+b.getFparam()); |
| | | }*/ |
| | | //List list=biml.searchDevByStationName3(binf); |
| | | List list = biml.serchBattAllInfoByStationId(binf); |
| | | System.out.println(list.size()); |
| | | } |
| | | |
| | | public List findBattProducer(int uId) { |
| | | String sql = "select BattProducer,count(BattProducer) as num from db_battinf.tb_battinf "; |
| | | String userSql = "where StationId in(select distinct db_battinf.tb_battinf.StationId " + |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws ParseException { |
| | | //new BattInfImpl().searchAll(); |
| | | |
| | | BattInfImpl biml = new BattInfImpl(); |
| | | BattInf binf = new BattInf(); |
| | | binf.setNum(1002); |
| | | binf.setBattGroupId(0); |
| | | binf.setStationName("内蒙古"); |
| | | binf.setStationName1(""); |
| | | binf.setStationName2(""); |
| | | binf.setStationName5(""); |
| | | binf.setStationName3(""); |
| | | binf.setStationId("42070450"); |
| | | |
| | | User_inf uinf = new User_inf(); |
| | | uinf.setUId(1002); |
| | | |
| | | Page p = new Page(); |
| | | p.setPageCurr(1); |
| | | p.setPageSize(50); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date date1 = sdf.parse("2000-01-01"); |
| | | Date date2 = sdf.parse("2020-01-01"); |
| | | Batttestdata_inf tdata = new Batttestdata_inf(); |
| | | tdata.setTest_type(3); |
| | | tdata.setTest_starttype(3); |
| | | tdata.setRecord_time(ActionUtil.getSimpDate(date1)); |
| | | tdata.setRecord_time1(ActionUtil.getSimpDate(date2)); |
| | | |
| | | Batt_Maint_Dealarm bmd = new Batt_Maint_Dealarm(); |
| | | bmd.setBinf(binf); |
| | | bmd.setPage(p); |
| | | bmd.setTdata(tdata); |
| | | bmd.setUinf(uinf); |
| | | //List<BattInf> list = biml.serchByConditionNew(bmd); |
| | | //List<BattInf> list=biml.serchByTestType(bmd); |
| | | /*List<BattInf> list=biml.serchGroupAssess(bmd); |
| | | for (BattInf b : list) { |
| | | System.out.println(b); |
| | | }*/ |
| | | /*List<BattInf> list=biml.serchBattPlan(binf); |
| | | for (BattInf b : list) { |
| | | System.out.println(b.getBattGroupId()+" "+b.getFBSDeviceId()+" "+b.getFparam()); |
| | | }*/ |
| | | //List list=biml.searchDevByStationName3(binf); |
| | | //List list = biml.serchBattAllInfoByStationId(binf); |
| | | //System.out.println(list.size()); |
| | | String excelName=biml.serchExcelName(1000061); |
| | | System.out.println(excelName); |
| | | } |
| | | } |