Merge remote-tracking branch 'origin/master'
| | |
| | | </filter-mapping> |
| | | <filter> |
| | | <filter-name>struts2</filter-name> |
| | | <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> |
| | | <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class> |
| | | </filter> |
| | | <filter-mapping> |
| | | <filter-name>struts2</filter-name> |
| | |
| | | || requestURI.contains("BattMap_informationAction!del") |
| | | || requestURI.contains("Station3DAction!getByDeviceId") |
| | | || requestURI.contains("BattMap_informationAction!multiAmount") |
| | | || requestURI.contains("User_infAction!searchSnIdByUId") |
| | | || requestURI.contains("."))) { |
| | | response.setStatus(403); |
| | | response.getWriter().write("非法请求,参数异常"); |
| | |
| | | || requestURI.contains("LicenseAction") |
| | | || requestURI.contains("UKey") |
| | | || requestURI.contains("closeBrowser") |
| | | || requestURI.contains("User_infAction!register") |
| | | //大屏需要直接调用接口 |
| | | || requestURI.contains("MapOutlineAction!getAll") |
| | | || requestURI.contains("BattMap_informationAction!findStationState") |
| | |
| | | || requestURI.contains("BattMap_informationAction!del") |
| | | || requestURI.contains("Station3DAction!getByDeviceId") |
| | | || requestURI.contains("BattMap_informationAction!multiAmount") |
| | | || requestURI.contains("User_infAction!searchSnIdByUId") |
| | | |
| | | ))) { |
| | | if (user == null) { |
| | |
| | | /**读取参数*/ |
| | | public String searchParam(){ |
| | | Li9130BmsAlm data = getGson().fromJson(json, Li9130BmsAlm.class); |
| | | ServiceModel model = service.searchParam(data.getDevId()); |
| | | ServiceModel model = service.searchParam(data.getDevId(),data.getGroupNum()); |
| | | result = getGson().toJson(model); |
| | | return SUCCESS; |
| | | } |
| | |
| | | /**读取参数*/ |
| | | public String searchParam(){ |
| | | Li9130BmsState state = getGson().fromJson(json, Li9130BmsState.class); |
| | | ServiceModel model = service.searchParam(state.getDevId()); |
| | | ServiceModel model = service.searchParam(state.getDevId(),state.getGroupNum()); |
| | | result = getGson().toJson(model); |
| | | return SUCCESS; |
| | | } |
| | |
| | | public String searchAllByUserId(){ |
| | | User_inf uinf=(User_inf) ActionUtil.getUser(); |
| | | UserWorkAlarmParam workAlarm = getGson().fromJson(json, UserWorkAlarmParam.class); |
| | | //workAlarm.setUserId(uinf.getUId()); |
| | | workAlarm.setUserId(1009); |
| | | workAlarm.setUserId(uinf.getUId()); |
| | | //workAlarm.setUserId(1009); |
| | | model = workAlarmService.searchByUserId(workAlarm); |
| | | result = getGson("yyyy-MM-dd HH:mm:ss").toJson(model); |
| | | return SUCCESS; |
| | |
| | | result = ActionUtil.tojson(model); |
| | | return SUCCESS; |
| | | } |
| | | |
| | | /** |
| | | * 注册用户: |
| | | * IOS审核使用 |
| | | * 账号,密码,性别,手机号 |
| | | * */ |
| | | public String register() { |
| | | uif=ActionUtil.getGson().fromJson(addjson, User_inf.class); |
| | | String passwordEncrypt = null; |
| | | try { |
| | | passwordEncrypt = URLDecoder.decode(uif.getUSnId(), "utf-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //密码AES密文 |
| | | //String uSnId = uif.getUSnId(); |
| | | //密码明文+MD5(明文) |
| | | String[] passwordArr = RSAUtil.decryptFront(passwordEncrypt, RSAUtil.fontSeparator); |
| | | String data = passwordArr[0]; |
| | | if(data.contains(uif.getUName())){ |
| | | result = ActionUtil.tojson(new ServiceModel().set(0,"密码包含用户名")); |
| | | return SUCCESS; |
| | | } |
| | | //验签md5 |
| | | if(!passwordArr[1].equals(ActionUtil.EncryptionMD5(data).toString())){ |
| | | result = ActionUtil.tojson(new ServiceModel().set(0,"密码验签失败")); |
| | | return SUCCESS; |
| | | } |
| | | String passwordRSA = RSAUtil.encrypt(data, RSAUtil.getPublicKey()); |
| | | uif.setUSnId(passwordRSA); |
| | | uif.setUpassword(passwordRSA); |
| | | |
| | | model = service.register(uif); |
| | | result = ActionUtil.tojson(model); |
| | | return SUCCESS; |
| | | } |
| | | |
| | | |
| | | //修改用户信息 |
| | | public String update() { |
| | | uif=ActionUtil.getGson("yyyy-MM-dd").fromJson(upjson, User_inf.class); |
| | |
| | | public String searchSnIdByUId(){ |
| | | Integer uId = ActionUtil.getGson().fromJson(json, User_inf.class).getUId(); |
| | | ServiceModel model = service.searchSnIdByUId(uId); |
| | | if(model.code == 1){ |
| | | User_inf u = (User_inf) ActionUtil.getUser(); |
| | | //System.out.println(u); |
| | | if(u!=null){ |
| | | model.setData(u.getUId()); |
| | | model.setData2(u.getURole()); //当前用户 派工告警角色:0-管理员、1-维护组长、2-维护组员、10-领导 |
| | | //setUserBaoji(u); //存储当前用户的包机组 |
| | | model.setMsgN(u.getUName()); |
| | | } |
| | | } |
| | | result = ActionUtil.tojson(model); |
| | | return SUCCESS; |
| | | } |
| | |
| | | default: |
| | | devId= fbsDeviceId*100000;break;*/ |
| | | } |
| | | devId+=9; |
| | | } |
| | | devId+=1; |
| | | |
| | |
| | | + "FBSDeviceName,GroupIndexInFBSDevice,battgroupId,BattGroupNum,BattGroupName,FloatVolLevel,OfflineVolLevel,BattFloatCurrent" + |
| | | ",MonCount,MonCapStd,monVolStd,monResStd,MonSerStd,MonVolLowToAvg,BattProducer,BattModel,BattProductDate,BattInUseDate,Load_curr,DisCurrMax,station_phone " |
| | | + ",Vol_grade,Manufacturers,Assetequipment,Deviceclasspath,Deviceoperationdepartment,PropertyRightUnit,PropertyAttribute,FactoryNumber,OperationTeam " |
| | | + ",DeviceIdentityCode,ProjectType,BatteryApplicationType,SingleRatedVoltage,RemoteMonitor,BatttIndependentPlaced,JunChargeVoltageValue,video_url,charge_type,buscouple_state,tmp_id " + |
| | | + ",DeviceIdentityCode,ProjectType,BatteryApplicationType,SingleRatedVoltage,RemoteMonitor,BatttIndependentPlaced,JunChargeVoltageValue,video_url,charge_type,buscouple_state,tmp_id,PackCount " + |
| | | ") values('" + binf.getStationId() + "','" + binf.getStationName() + "','" + binf.getStationName1() + "','" + binf.getStationName2() + "','" + binf.getStationName3() + "','" + binf.getStationName4() + |
| | | "','" + binf.getStationName5() + "','" + binf.getStationIp() + "'," + binf.getFBSDeviceId() + ",'" + binf.getFbsDeviceIp() + "','" + binf.getFbsDeviceIp_YM() + "','" + binf.getFbsDeviceIp_WG() + "','" + binf.getFBSDeviceName() + "'," + binf.getGroupIndexInFBSDevice() + |
| | | "," + binf.getBattGroupId() + "," + binf.getBattGroupNum() + ",'" + binf.getBattGroupName() + "'," + binf.getFloatVolLevel() + "," + binf.getOfflineVolLevel() + "," + binf.getBattFloatCurrent() + |
| | |
| | | ",'" + binf.getBattProducer() + "','" + binf.getBattModel() + "','" + DAOHelper.sdf.format(binf.getBattProductDate()) + "','" + DAOHelper.sdf.format(binf.getBattInUseDate()) + "'," + binf.getLoad_curr() + "," + binf.getDisCurrMax() + ",'" + binf.getStation_phone() + |
| | | "'," + binf.getVol_grade() + ",'" + binf.getManufacturers() + "','" + binf.getAssetequipment() + "','" + binf.getDeviceclasspath() + "','" + binf.getDeviceoperationdepartment() + "','" + binf.getPropertyRightUnit() + "','" + binf.getPropertyAttribute() + |
| | | "','" + binf.getFactoryNumber() + "','" + binf.getOperationTeam() + "','" + binf.getDeviceIdentityCode() + "','" + binf.getProjectType() + "','" + binf.getBatteryApplicationType() + "'," + binf.getSingleRatedVoltage() + ",'" + binf.getRemoteMonitor() + |
| | | "','" + binf.getBatttIndependentPlaced() + "','" + binf.getJunChargeVoltageValue() + "','" + binf.getVideoUrl() +"','" + binf.getChargeType()+"'," + binf.getBuscoupleState()+","+binf.getTmp_id()+")"; |
| | | "','" + binf.getBatttIndependentPlaced() + "','" + binf.getJunChargeVoltageValue() + "','" + binf.getVideoUrl() +"','" + binf.getChargeType()+"'," + binf.getBuscoupleState()+","+binf.getTmp_id()+","+binf.getPackCount()+")"; |
| | | sql_str.add(sql); |
| | | |
| | | String baoji_sql_main = "REPLACE into db_user.tb_user_battgroup_baojigroup_battgroup(baoji_group_id,StationId,BattGroupId) values('100011','" + binf.getStationId() + "'," + binf.getBattGroupId() + ")"; |
| | |
| | | + " Load_curr=" + binf.getLoad_curr() + ",DisCurrMax=" + binf.getDisCurrMax() + ",station_phone='" + binf.getStation_phone() + "', FbsDeviceIp='" + binf.getFbsDeviceIp() + "',FbsDeviceIp_YM='" + binf.getFbsDeviceIp_YM() + "',FbsDeviceIp_WG='" + binf.getFbsDeviceIp_WG() + "' " |
| | | + ",Vol_grade=" + binf.getVol_grade() + ",Manufacturers='" + binf.getManufacturers() + "',Assetequipment='" + binf.getAssetequipment() + "',Deviceclasspath='" + binf.getDeviceclasspath() + "',Deviceoperationdepartment='" + binf.getDeviceoperationdepartment() + "',PropertyRightUnit='" + binf.getPropertyRightUnit() + "',PropertyAttribute='" + binf.getPropertyAttribute() + "',FactoryNumber='" + binf.getFactoryNumber() + "',OperationTeam='" + binf.getOperationTeam() + "' " |
| | | + ",DeviceIdentityCode='" + binf.getDeviceIdentityCode() + "',ProjectType='" + binf.getProjectType() + "',BatteryApplicationType='" + binf.getBatteryApplicationType() + "',SingleRatedVoltage=" + binf.getSingleRatedVoltage() + ",RemoteMonitor='" + binf.getRemoteMonitor() + "',BatttIndependentPlaced='" + binf.getBatttIndependentPlaced() + "',JunChargeVoltageValue='" + binf.getJunChargeVoltageValue() + "',video_url ='" + binf.getVideoUrl() + "',charge_type ='" + binf.getChargeType() + "',buscouple_state =" + binf.getBuscoupleState() |
| | | +",tmp_id="+binf.getTmp_id()+" " |
| | | +",tmp_id="+binf.getTmp_id()+",PackCount="+binf.getPackCount()+" " |
| | | +" where battgroupId=" + binf.getBattGroupId(); |
| | | sql_str.add(sql); |
| | | { |
| | |
| | | + "FBSDeviceName,GroupIndexInFBSDevice,battgroupId,BattGroupNum,BattGroupName,FloatVolLevel,OfflineVolLevel,BattFloatCurrent,tmp_id " + |
| | | ",MonCount,MonCapStd,monVolStd,monResStd,MonSerStd,MonVolLowToAvg,BattProducer,BattModel,BattProductDate,BattInUseDate,Load_curr,DisCurrMax,station_phone " |
| | | + ",Vol_grade,Manufacturers,Assetequipment,Deviceclasspath,Deviceoperationdepartment,PropertyRightUnit,PropertyAttribute,FactoryNumber,OperationTeam " |
| | | + ",DeviceIdentityCode,ProjectType,BatteryApplicationType,SingleRatedVoltage,RemoteMonitor,BatttIndependentPlaced,JunChargeVoltageValue,video_url,charge_type,buscouple_state " + |
| | | + ",DeviceIdentityCode,ProjectType,BatteryApplicationType,SingleRatedVoltage,RemoteMonitor,BatttIndependentPlaced,JunChargeVoltageValue,video_url,charge_type,buscouple_state,PackCount " + |
| | | " From db_battinf.tb_battinf " + |
| | | " Where StationName1 like ? and StationName2 like ? and StationName5 like ? and StationName3 like ? " + |
| | | " and StationId in (" + |
| | |
| | | binf.setVideoUrl(rs.getString("video_url")); |
| | | binf.setChargeType(rs.getInt("charge_type")); |
| | | binf.setBuscoupleState(rs.getInt("buscouple_state")); |
| | | |
| | | binf.setPackCount(rs.getInt("PackCount")); |
| | | list.add(binf); |
| | | |
| | | } |
| | |
| | | //-----------查询电池组信息 |
| | | public List serchAllBattinf(Object obj) { |
| | | BattInf binf = (BattInf) obj; |
| | | String sql = " select DISTINCT StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationId,stationid_ex,StationIP,FBSDeviceId,BattGroupName,BattGroupName1,BattGroupName2,MonCount,battgroupId,MonCapStd,MonVolStd,MonResStd,MonSerStd,BattModel,BattProducer,BattProductDate,BattInUseDate,GroupIndexInFBSDevice,Load_curr,DisCurrMax " + |
| | | String sql = " select DISTINCT StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationId,stationid_ex,StationIP,FBSDeviceId,BattGroupName,BattGroupName1,BattGroupName2,MonCount,battgroupId,MonCapStd,MonVolStd,MonResStd,MonSerStd,BattModel,BattProducer,BattProductDate,BattInUseDate,GroupIndexInFBSDevice,Load_curr,DisCurrMax,PackCount " + |
| | | " from db_battinf.tb_battinf where StationName1 like ? and StationName2 like ? and StationName5 like ? " |
| | | + " and StationName3=? " |
| | | + " ORDER BY StationName4 asc,battgroupId asc "; |
| | |
| | | batt.setGroupIndexInFBSDevice(rs.getInt("groupIndexInFBSDevice")); |
| | | batt.setLoad_curr(rs.getFloat("load_curr")); |
| | | batt.setDisCurrMax(rs.getFloat("disCurrMax")); |
| | | batt.setPackCount(rs.getInt("PackCount")); |
| | | list.add(batt); |
| | | } |
| | | } catch (SQLException e) { |
| | |
| | | |
| | | //根据标称电压和测试容量查询出当前测试容量对应标准曲线的单体电压 |
| | | public List<Double> searchBattStandardVolList(double monvolstd, double moncapstd, float test_cap, long hourate, String battProducer, String battModel) { |
| | | String mainSql = "select mon_vol from db_battinf.tb_battmon_testcap_"+(int)monvolstd+"_"+(int)moncapstd+"_"+hourate+" where battproducer ="+battProducer+" and battmodel ="+battModel+" and test_cap = "; |
| | | String subSql = "select test_cap from db_battinf.tb_battmon_testcap_"+(int)monvolstd+"_"+(int)moncapstd+"_"+hourate+" where monvolstd="+monvolstd+" and abs(test_cap)<="+toFixed((Math.abs(test_cap)),1)+" and moncapstd = "+moncapstd+" and battproducer ="+battProducer+" and battmodel ="+battModel+" ORDER BY test_cap ASC limit 1"; |
| | | String mainSql = "select mon_vol from db_battinf.tb_battmon_testcap_"+(int)monvolstd+"_"+(int)moncapstd+"_"+hourate+" where battproducer ='"+battProducer+"' and battmodel = '"+battModel+"' and test_cap = "; |
| | | String subSql = "select test_cap from db_battinf.tb_battmon_testcap_"+(int)monvolstd+"_"+(int)moncapstd+"_"+hourate+" where monvolstd="+monvolstd+" and abs(test_cap)<="+toFixed((Math.abs(test_cap)),1)+" and moncapstd = "+moncapstd+" and battproducer = '"+battProducer+"' and battmodel = '"+battModel+"' ORDER BY test_cap ASC limit 1"; |
| | | String sql = mainSql+"("+subSql+")"; |
| | | List<Double> list = DAOHelper.executeQuery(sql, DBUtil.getConn(), null, new CallBack() { |
| | | @Override |
| | |
| | | |
| | | public class Li9130BmsAlmDaoImpl { |
| | | |
| | | public List<Li9130BmsAlm> searchParam(Integer devId) { |
| | | public List<Li9130BmsAlm> searchParam(Integer devId, Integer groupNum) { |
| | | //先检查是否指令发送正常 |
| | | //boolean flag = DAOHelper.checkOpCmdAndAck("db_ram_db.tb_li9130_bms_alm", devId, FBS9100_ComBase.CMD_GetLiBMSState, FBS9100_ComBase.CMD_GetLiBMSState_Ack, 40); |
| | | boolean flag = true; |
| | | |
| | | if(flag){ |
| | | String sql = "select * from db_ram_db.tb_li9130_bms_alm where dev_id = ? limit 4"; |
| | | List<Li9130BmsAlm> list = DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{devId}, new CallBack() { |
| | | String sql = "select * from db_ram_db.tb_li9130_bms_alm where dev_id = ? and group_num = ?"; |
| | | List<Li9130BmsAlm> list = DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{devId,groupNum}, new CallBack() { |
| | | @Override |
| | | public List<Li9130BmsAlm> getResults(ResultSet rs) throws SQLException { |
| | | List<Li9130BmsAlm> listTemp = new LinkedList(); |
| | |
| | | param.setFetStateCode(rs.getInt("fet_state_code")); |
| | | param.setJunhengStateCode(rs.getInt("junheng_state_code")); |
| | | param.setSysStateCode(rs.getInt("sys_state_code")); |
| | | param.setGroupNum(rs.getInt("group_num")); |
| | | param.setSysTmpCode(rs.getInt("sys_tmp_code")); |
| | | |
| | | listTemp.add(param); |
| | | } |
| | |
| | | import java.util.List; |
| | | |
| | | public class Li9130BmsStateDaoImpl { |
| | | public List<Li9130BmsState> searchParam(Integer devId) { |
| | | public List<Li9130BmsState> searchParam(Integer devId, Integer groupNum) { |
| | | //先检查是否指令发送正常 |
| | | //boolean flag = DAOHelper.checkOpCmdAndAck("db_ram_db.tb_li9130_bms_state", devId, FBS9100_ComBase.CMD_GetLiBMSData, FBS9100_ComBase.CMD_GetLiBMSData_Ack, 40); |
| | | boolean flag = true; |
| | | if(flag){ |
| | | String sql = "select * from db_ram_db.tb_li9130_bms_state where dev_id = ? limit 4"; |
| | | List<Li9130BmsState> list = DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{devId}, new CallBack() { |
| | | String sql = "select * from db_ram_db.tb_li9130_bms_state where dev_id = ? and group_num = ? "; |
| | | List<Li9130BmsState> list = DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{devId,groupNum}, new CallBack() { |
| | | @Override |
| | | public List<Li9130BmsState> getResults(ResultSet rs) throws SQLException { |
| | | List<Li9130BmsState> listTemp = new LinkedList(); |
| | |
| | | pageParams.add(new PageParam(37,"远程修改ip", 1, 7)); |
| | | pageParams.add(new PageParam(38,"启动放电添加人脸识别", 1, 7)); |
| | | |
| | | pageParams.add(new PageParam(39,"账号扫描策略", 1, 8)); |
| | | pageParams.add(new PageParam(40,"账号登录失败限制次数", 10, 9)); |
| | | pageParams.add(new PageParam(41,"账号登录失败锁定解锁策略", 2, 9)); |
| | | pageParams.add(new PageParam(42,"密码设置规则-位数", 8, 10)); |
| | | pageParams.add(new PageParam(43,"密码设置规则-符号类型", 4, 10)); |
| | | |
| | | pageParams.add(new PageParam(44,"历史数据的驼峰锅底功能开启", 1, 11)); |
| | | pageParams.add(new PageParam(45,"历史数据的数据显示粒度", 5, 11)); |
| | | |
| | | String sql = |
| | | "INSERT INTO `db_app_sys`.`tb_page_param` VALUES (?,?, ?, ?);"; |
| | | |
| | |
| | | uinf.getUNote(),uinf.getLicense(),uinf.getURole(),uinf.getType(),uinf.getStatus(),uinf.getExpirationTime(),uinf.getVisitTime(),uinf.getVisitIp()}); |
| | | return bl; |
| | | } |
| | | |
| | | //5.1用户管理(添加) |
| | | public boolean register(User_inf uinf) { |
| | | String sql="insert into db_user.tb_user_inf(uSnId,uPassword,uName,uMobilephone," + |
| | | "uSex,uRole,type,status,create_time) values(?,?,?,?,?,?,?,?,?)"; |
| | | Boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[]{ |
| | | uinf.getUSnId(),uinf.getUpassword(),uinf.getUName(),uinf.getUMobilephone(),uinf.getUSex(), |
| | | 2,1,1,new Date() |
| | | |
| | | }); |
| | | return bl; |
| | | } |
| | | |
| | | //5.1用户管理(添加时判断用户名和手机号是否重复) |
| | | public int addJudge(Object obj){ |
| | | User_inf uinf=(User_inf) obj; |
| | |
| | | return userList.get(0); |
| | | } |
| | | |
| | | public User_inf searchSnIdByUId(Integer uId) { |
| | | String sql = "select uSnId,uName from db_user.tb_user_inf where uId=? limit 1"; |
| | | public List<User_inf> searchSnIdByUId(Integer uId) { |
| | | /*String sql = "select uSnId,uName from db_user.tb_user_inf where uId=? limit 1"; |
| | | List list = DAOHelper |
| | | .executeQuery(sql, DBUtil.getConn(), new Object[]{uId}, |
| | | new CallBack() { |
| | |
| | | return list; |
| | | } |
| | | }); |
| | | return (User_inf) list.get(0); |
| | | return (User_inf) list.get(0);*/ |
| | | String sql = "select uid,uname,uSnId,upassword,unote,UKey_ID,uRole,password_update_time,status,visit_time,visit_ip from db_user.tb_user_inf where uId = ? limit 1"; |
| | | List list = DAOHelper |
| | | .executeQuery(sql, DBUtil.getConn(), new Object[]{uId}, |
| | | new CallBack() { |
| | | |
| | | public List getResults(ResultSet rs) { |
| | | List list=new ArrayList(); |
| | | try { |
| | | while(rs.next()){ |
| | | User_inf uinf=new User_inf(); |
| | | uinf.setUId(rs.getInt("uId")); |
| | | uinf.setUName(rs.getString("uName")); |
| | | uinf.setUSnId(rs.getString("uSnId")); |
| | | uinf.setUNote(rs.getString("uNote")); |
| | | uinf.setUpassword(rs.getString("upassword")); |
| | | uinf.setUKey_ID(rs.getString("uKey_ID")); |
| | | uinf.setURole(rs.getInt("uRole")); |
| | | uinf.setPasswordUpdateTime(rs.getTimestamp("password_update_time")); |
| | | uinf.setStatus(rs.getInt("status")); |
| | | uinf.setVisitTime(rs.getString("visit_time")); |
| | | uinf.setVisitIp(rs.getString("visit_ip")); |
| | | list.add(uinf); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | public void updateLoginTime(Integer uId) { |
| | |
| | | return list; |
| | | } |
| | | }); |
| | | return list.get(0); |
| | | if(!list.isEmpty()) { |
| | | return list.get(0); |
| | | }else{ |
| | | return -1; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | return res_exe; |
| | | } |
| | | |
| | | //机房命令操作设备时的cmd和ack校验 test_type -->默认启动测试的类型 |
| | | public boolean sendCmdToFBS9100Dev2(int cmd,int battGroupId,int test_type,int dev_id) |
| | | { |
| | | int m_cmd = cmd; |
| | | int m_cmd_ack = cmd; |
| | | switch(m_cmd) { |
| | | case FBS9100_ComBase.CMD_Start: m_cmd_ack = FBS9100_ComBase.CMD_StartAck; break; |
| | | case FBS9100_ComBase.CMD_Stop: m_cmd_ack = FBS9100_ComBase.CMD_StopAck; break; |
| | | case FBS9100_ComBase.CMD_SetDischargeParm: m_cmd_ack = FBS9100_ComBase.CMD_SetDischargeParmAck; break; |
| | | case FBS9100_ComBase.CMD_GetDischargeParm: m_cmd_ack = FBS9100_ComBase.CMD_GetDischargeParmAck; break; |
| | | case FBS9100_ComBase.CMd_SetIp_Tem: m_cmd_ack = FBS9100_ComBase.CMd_SetIpAck; break; |
| | | case FBS9100_ComBase.CMd_SetIp_Per: m_cmd_ack = FBS9100_ComBase.CMd_SetIpAck; break; |
| | | case FBS9100_ComBase.CMD_GetOffLineYHParam: m_cmd_ack = FBS9100_ComBase.CMD_GetOffLineYHParam_ACK; break; |
| | | case FBS9100_ComBase.CMD_SetOffLineYHParam: m_cmd_ack = FBS9100_ComBase.CMD_SetOffLineYHParam_ACK; break; |
| | | case FBS9100_ComBase.CMD_StartOffLine: m_cmd_ack = FBS9100_ComBase.CMD_StartOffLine_ACK; break; |
| | | case FBS9100_ComBase.CMD_StopOffLine: m_cmd_ack = FBS9100_ComBase.CMD_StopOffLine_ACK; break; |
| | | case FBS9100_ComBase.CMD_ResetSystem: m_cmd_ack = FBS9100_ComBase.CMD_ResetSystemAck; break; |
| | | //一体机A059 |
| | | case FBS9100_ComBase.CMD_StartDischarge: m_cmd_ack = FBS9100_ComBase.CMD_StartDischargeAck; break; |
| | | case FBS9100_ComBase.CMD_StopDischarge: m_cmd_ack = FBS9100_ComBase.CMD_StopDischargeAck; break; |
| | | case FBS9100_ComBase.CMD_PauseDischarge: m_cmd_ack = FBS9100_ComBase.CMD_PauseDischargeAck; break; |
| | | case FBS9100_ComBase.CMD_StartCharTest: m_cmd_ack = FBS9100_ComBase.CMD_StartCharTestAck; break; |
| | | case FBS9100_ComBase.CMD_StopCharTest: m_cmd_ack = FBS9100_ComBase.CMD_StopCharTestAck; break; |
| | | case FBS9100_ComBase.CMD_PauseCharTest: m_cmd_ack = FBS9100_ComBase.CMD_PauseCharTestAck; break; |
| | | case FBS9100_ComBase.CMD_StartHUOHUATest: m_cmd_ack = FBS9100_ComBase.CMD_StartHUOHUATestACK; break; |
| | | case FBS9100_ComBase.CMD_StopHUOHUATest: m_cmd_ack = FBS9100_ComBase.CMD_StopHUOHUATestACK; break; |
| | | case FBS9100_ComBase.CMD_PauseHUOHUATest: m_cmd_ack = FBS9100_ComBase.CMD_PauseHUOHUATestACK; break; |
| | | case FBS9100_ComBase.CMD_ReStartDCDC: m_cmd_ack = FBS9100_ComBase.CMD_ReStartDCDC_Ack; break; |
| | | //图片显示 |
| | | case FBS9100_ComBase.CMD_StartShowPic: m_cmd_ack = FBS9100_ComBase.CMD_StartShowPic_ACK; break; |
| | | case FBS9100_ComBase.CMD_StopShowPic: m_cmd_ack = FBS9100_ComBase.CMD_StopShowPic_ACK; break; |
| | | case FBS9100_ComBase. CMD_SetNowBatt: m_cmd_ack = FBS9100_ComBase.CMD_SetNowBatt_ACK; break; |
| | | default: return false; |
| | | } |
| | | String sql_end = ""; |
| | | if(test_type > 0 && cmd == FBS9100_ComBase.CMD_Start){ //启动测试时未点击设定参数按钮,会出现启动内阻测试bug修复 |
| | | sql_end = ",TestCmd="+test_type; |
| | | } |
| | | boolean res_exe = false; |
| | | String sql = "UPDATE db_ram_db.tb_fbs9100_setparam SET " |
| | | + " op_cmd=? , BattGroupNum = ? "+sql_end |
| | | + " WHERE dev_id=? "; |
| | | Boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[]{m_cmd,battGroupId,dev_id}); |
| | | if(true == bl) |
| | | { |
| | | sql = "SELECT op_cmd FROM db_ram_db.tb_fbs9100_setparam "+ |
| | | " WHERE dev_id="+dev_id; |
| | | Connection conn=DBUtil.getConn(); |
| | | PreparedStatement ps = null; |
| | | ResultSet rs = null; |
| | | for(int n=0; n<40; n++) |
| | | { |
| | | try { |
| | | ps = conn.prepareStatement(sql); |
| | | rs=ps.executeQuery(); |
| | | if(rs.next()) |
| | | { |
| | | if(rs.getInt("op_cmd") == m_cmd_ack) |
| | | { |
| | | res_exe = true; |
| | | break; |
| | | } |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | Thread.sleep(250); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | DBUtil.close(rs, ps, conn); |
| | | } |
| | | return res_exe; |
| | | } |
| | | |
| | | //根据dev_id获取A059的数据 |
| | | public List searchA059ParamByDev_id(Object obj){ |
| | | Fbs9100_setparam fsparam=(Fbs9100_setparam) obj; |
| | |
| | | ",db_ram_db.tb_fbs9100_setparam.MonomerLowCount,db_ram_db.tb_fbs9100_setparam.OnlineVolLowAction " + |
| | | ",db_ram_db.tb_fbs9100_setparam.dCVolHighLimit,db_ram_db.tb_fbs9100_setparam.chargeCurrSet,db_ram_db.tb_fbs9100_setparam.battgroupnum " + |
| | | ",db_ram_db.tb_fbs9100_setparam.testcmd,db_ram_db.tb_fbs9100_setparam.testcmd,db_ram_db.tb_fbs9100_setparam.MonomerTmp_High " + |
| | | ",db_ram_db.tb_fbs9100_setparam.AutoTestStartVol,db_ram_db.tb_fbs9100_setparam.OnLineVol_Low,db_ram_db.tb_fbs9100_setparam.OffLineYH_Cycle,OffLineYHstarttime,OffLineYHTimes,OffLineYHOnceCycle " + |
| | | ",db_ram_db.tb_fbs9100_setparam.AutoTestStartVol,db_ram_db.tb_fbs9100_setparam.OnLineVol_Low,db_ram_db.tb_fbs9100_setparam.OffLineYH_Cycle,OffLineYHstarttime,OffLineYHTimes,OffLineYHOnceCycle,db_ram_db.tb_fbs9100_setparam.BattGroupNum " + |
| | | " FROM db_battinf.tb_battinf " + |
| | | " LEFT OUTER JOIN db_ram_db.tb_fbs9100_setparam on db_ram_db.tb_fbs9100_setparam.dev_id=db_battinf.tb_battinf.FBSDeviceId " + |
| | | " WHERE db_battinf.tb_battinf.FBSDeviceId=? limit 1"; |
| | |
| | | fsparam.setOffLineYHstarttime(rs.getTimestamp("offLineYHstarttime")); |
| | | fsparam.setOffLineYHOnceCycle(rs.getInt("offLineYHOnceCycle")); |
| | | fsparam.setOffLineYHTimes(rs.getInt("offLineYHTimes")); |
| | | fsparam.setBattGroupNum(rs.getInt("BattGroupNum")); |
| | | fbs9100.setFsparam(fsparam); |
| | | |
| | | list.add(fbs9100); |
| | |
| | | private String publicKeyY; //做设备校验时的标识 |
| | | |
| | | private int tmp_id; |
| | | private int packCount; //锂电池包数量 |
| | | |
| | | /**追加链接 LD9升级表*/ |
| | | private LD9UpdateStatus ld9UpdateStatus; |
| | |
| | | this.ld9UpdateStatus = ld9UpdateStatus; |
| | | } |
| | | |
| | | public int getPackCount() { |
| | | return packCount; |
| | | } |
| | | |
| | | public void setPackCount(int packCount) { |
| | | this.packCount = packCount; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "BattInf [num=" + num + ", StationId=" + StationId |
| | |
| | | private Integer fetStateCode; //FET状态代码 |
| | | private Integer junhengStateCode; //均衡状态代码 |
| | | private Integer sysStateCode; //系统状态代码 |
| | | private Integer groupNum; |
| | | private Integer sysTmpCode; //系统温度编码 |
| | | |
| | | public Long getNum() { |
| | | return num; |
| | |
| | | public void setSysStateCode(Integer sysStateCode) { |
| | | this.sysStateCode = sysStateCode; |
| | | } |
| | | |
| | | public Integer getGroupNum() { |
| | | return groupNum; |
| | | } |
| | | |
| | | public void setGroupNum(Integer groupNum) { |
| | | this.groupNum = groupNum; |
| | | } |
| | | |
| | | public Integer getSysTmpCode() { |
| | | return sysTmpCode; |
| | | } |
| | | |
| | | public void setSysTmpCode(Integer sysTmpCode) { |
| | | this.sysTmpCode = sysTmpCode; |
| | | } |
| | | } |
| | |
| | | private Integer sumCap ; //总容量 |
| | | private Integer cycleTimes ; //电池循环次数 |
| | | private Integer userDefCnt ; //自定义遥测数量 |
| | | private Integer groupNum; //组号 |
| | | |
| | | public Long getNum() { |
| | | return num; |
| | |
| | | public void setUserDefCnt(Integer userDefCnt) { |
| | | this.userDefCnt = userDefCnt; |
| | | } |
| | | |
| | | public Integer getGroupNum() { |
| | | return groupNum; |
| | | } |
| | | |
| | | public void setGroupNum(Integer groupNum) { |
| | | this.groupNum = groupNum; |
| | | } |
| | | } |
| | |
| | | public class Li9130BmsAlmService { |
| | | private Li9130BmsAlmDaoImpl dao = new Li9130BmsAlmDaoImpl(); |
| | | |
| | | public ServiceModel searchParam(Integer devId) { |
| | | public ServiceModel searchParam(Integer devId,Integer groupNum) { |
| | | ServiceModel model = new ServiceModel(); |
| | | List<Li9130BmsAlm> dataList = dao.searchParam(devId); |
| | | List<Li9130BmsAlm> dataList = dao.searchParam(devId,groupNum); |
| | | if(dataList == null){ |
| | | model.setMsg("读取参数失败,请检查网络"); |
| | | }else { |
| | |
| | | public class Li9130BmsStateService { |
| | | private Li9130BmsStateDaoImpl dao = new Li9130BmsStateDaoImpl(); |
| | | |
| | | public ServiceModel searchParam(Integer devId) { |
| | | public ServiceModel searchParam(Integer devId, Integer groupNum) { |
| | | ServiceModel model = new ServiceModel(); |
| | | List<Li9130BmsState> dataList = dao.searchParam(devId); |
| | | List<Li9130BmsState> dataList = dao.searchParam(devId,groupNum); |
| | | if(dataList == null){ |
| | | model.setMsg("读取参数失败,请检查网络"); |
| | | }else { |
| | |
| | | import com.fgkj.dao.BaseDAO; |
| | | import com.fgkj.dao.BaseDAOFactory; |
| | | import com.fgkj.dao.impl.PageParamDao; |
| | | import com.fgkj.dao.impl.User_battgroup_baojigroup_usrImpl; |
| | | import com.fgkj.dao.impl.User_infImpl; |
| | | import com.fgkj.dao.impl.User_permitgroup_dataImpl; |
| | | import com.fgkj.dto.*; |
| | |
| | | else{ |
| | | model.setCode(0); |
| | | model.setMsg("添加失败!"); |
| | | } |
| | | }else{ |
| | | model.setCode(0); |
| | | model.setMsg("用户名或手机号已存在,请重新输入!"); |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | public ServiceModel register(User_inf userInf) { |
| | | int flag=((User_infImpl)dao).addJudge(userInf); |
| | | //System.out.println(flag); |
| | | if(flag!=0){ |
| | | Boolean bl=((User_infImpl)dao).register(userInf); |
| | | if(bl){ |
| | | //添加成功,分配到默认初始化权限组 |
| | | Integer uId = ((User_infImpl) dao).getUserInfoByPhoneNumber(((User_inf) userInf).getUMobilephone()).getUId(); |
| | | User_permitgroup_data permitGroupData = new User_permitgroup_data(); |
| | | permitGroupData.setPermit_group_id(100020); |
| | | permitGroupData.setuId(uId); |
| | | new User_permitgroup_dataImpl().add(permitGroupData); |
| | | |
| | | //添加成功,分配到默认的包机组 |
| | | com.fgkj.dto.User_battgroup_baojigroup_usr baojigroupUsr = new User_battgroup_baojigroup_usr(); |
| | | baojigroupUsr.setBaoji_group_id(100091); |
| | | baojigroupUsr.setuId(uId); |
| | | new User_battgroup_baojigroup_usrImpl().add(baojigroupUsr); |
| | | |
| | | model.setCode(1); |
| | | model.setMsg("注册成功!"); |
| | | } |
| | | else{ |
| | | model.setCode(0); |
| | | model.setMsg("注册失败!"); |
| | | } |
| | | }else{ |
| | | model.setCode(0); |
| | |
| | | } |
| | | } |
| | | if(flag==1){ |
| | | if (!uinf.getUpassword().equals(u.getUpassword())) { |
| | | //密码明文+MD5(明文) |
| | | String fontPasswordEncrypt = null; |
| | | try { |
| | | fontPasswordEncrypt = URLDecoder.decode(uinf.getUpassword(), "utf-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | String[] passwordArr = RSAUtil.decryptFront(fontPasswordEncrypt, RSAUtil.fontSeparator); |
| | | String data = passwordArr[0]; |
| | | //验签md5 |
| | | if(!passwordArr[1].equals(ActionUtil.EncryptionMD5(data).toString())){ |
| | | model.setMsg("密码验签失败"); |
| | | } |
| | | if (!data.equals(RSAUtil.decrypt(u.getUpassword(),RSAUtil.getPrivateKey()))) { |
| | | String decrypt = RSAUtil.decrypt(u.getUpassword(), RSAUtil.getPrivateKey()); |
| | | System.out.printf(decrypt); |
| | | System.out.println("密码错误"+uinf.getUpassword()+"=="+u.getUpassword()); |
| | | model.setMsg(getText("Password_error")); |
| | | } else { |
| | |
| | | } |
| | | |
| | | public ServiceModel searchSnIdByUId(Integer uId) { |
| | | ServiceModel model = new ServiceModel(); |
| | | /*ServiceModel model = new ServiceModel(); |
| | | User_inf userInf = ((User_infImpl)dao).searchSnIdByUId(uId); |
| | | model.setCode(1); |
| | | model.setData(userInf); |
| | | return model;*/ |
| | | |
| | | List list = ((User_infImpl)dao).searchSnIdByUId(uId); |
| | | if (list == null || list.size() < 1) { |
| | | model.setMsg("对应的用户不存在"); |
| | | } else { |
| | | User_inf u = (User_inf) list.get(0); |
| | | /** |
| | | * 先判断账户是否为激活账号 |
| | | * @see com.fgkj.constant.UserConstant |
| | | */ |
| | | if(u.getStatus()!=1){ |
| | | switch (u.getStatus()){ |
| | | case 0: model.setMsg("当前账号的状态异常,无法登录. 异常信息为: "+UserConstant.ACCOUNT_STATUS_CANCEL.getLabel());break; |
| | | case 2: model.setMsg("当前账号的状态异常,无法登录. 异常信息为: "+UserConstant.ACCOUNT_STATUS_HIBERNATE.getLabel());break; |
| | | case 3: model.setMsg("当前账号的状态异常,无法登录. 异常信息为: "+UserConstant.ACCOUNT_STATUS_LOCK.getLabel());break; |
| | | case 4: model.setMsg("当前账号的状态异常,无法登录. 异常信息为: "+UserConstant.ACCOUNT_STATUS_LOCK_FAIL.getLabel());break; |
| | | default:model.setMsg("当前账号的状态异常,无法登录. 异常信息为: 无"); |
| | | } |
| | | return model; |
| | | } |
| | | //判断是否为国网系统,校验密码是否3个月修改过一次 |
| | | if("1".equals(PropertiesUtil.props.get("system.type"))){ |
| | | |
| | | //登录之前,首先校验允许时间和登录ip |
| | | boolean ipPass = true; |
| | | |
| | | String firstTime = u.getVisitTime().split("~")[0]; |
| | | String lastTime = u.getVisitTime().split("~")[1]; |
| | | |
| | | List<String> ipRules = new LinkedList<>(); |
| | | String ipRuleStr = u.getVisitIp(); |
| | | ipRules = Arrays.asList(ipRuleStr.split(",")); |
| | | |
| | | Calendar instance = Calendar.getInstance(); |
| | | String hourOfDay = String.format("%1$02d",instance.get(Calendar.HOUR_OF_DAY)); |
| | | int minute = instance.get(Calendar.MINUTE); |
| | | int second = instance.get(Calendar.SECOND); |
| | | String nowTime = hourOfDay+":"+minute+":"+second; |
| | | //登录时间校验 |
| | | if(nowTime.compareTo(firstTime)>=0 && nowTime.compareTo(lastTime)<=0){ |
| | | //登录ip校验 |
| | | String clientIp = ActionUtil.getRequest().getRemoteAddr(); |
| | | if(!ipRules.contains("*")){ |
| | | for(String ipRule:ipRules){ |
| | | ipPass = true; |
| | | //ip规则格式为 * 或者 xxx.xxx.x.x |
| | | String[] ipArr = clientIp.split("\\."); |
| | | String[] ipRuleArr = ipRule.split("\\."); |
| | | for (int i = 0; i < ipRuleArr.length; i++) { |
| | | if(!ipRuleArr[i].equals("*") && !ipRuleArr[i].equals(ipArr[i])){ |
| | | ipPass = false; |
| | | break; |
| | | } |
| | | } |
| | | if(ipPass){ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if(!ipPass){ |
| | | return new ServiceModel().setMsgII(0,"您的IP禁止访问,请知晓"); |
| | | } |
| | | }else{ |
| | | return new ServiceModel().setMsgII(0,"登录时间不在允许的时间范围内"); |
| | | } |
| | | |
| | | /*Date passwordUpdateTime = u.getPasswordUpdateTime(); |
| | | Calendar now = Calendar.getInstance(); |
| | | now.add(Calendar.MONTH,-3); |
| | | if(passwordUpdateTime==null){ //密码修改时间为空,尚未修改初始口令 |
| | | model.setCode(3); |
| | | model.setMsg("首次登录,请先修改初始化口令"); |
| | | return model; |
| | | } |
| | | else if(passwordUpdateTime.compareTo(now.getTime()) < 0){ |
| | | model.setCode(2); |
| | | model.setMsg("超过3个月没有修改口令,请修改口令后重新登录"); |
| | | return model; |
| | | }*/ |
| | | } |
| | | |
| | | { |
| | | //校验通过,登录成功 |
| | | model.setCode(1); |
| | | //model.setMsg("index.jsp"); |
| | | model.setMsg("index-outline.jsp"); |
| | | //查询用户对应的权限组id并返回给前端 |
| | | int permitGroupId = new User_permitgroup_dataImpl().getPermitGroupId(uId); |
| | | model.setSum(permitGroupId); |
| | | // 将登陆成功的用户存入session |
| | | HttpSession session = ActionUtil.getSession(); |
| | | // System.out.println(session); |
| | | session.setAttribute("user", u); |
| | | |
| | | //设置session不活动时间为30分 |
| | | session.setMaxInactiveInterval(60*30); |
| | | session.setAttribute("ip",ActionUtil.getRequest().getRemoteAddr()); |
| | | User_permitgroupService upgs=new User_permitgroupService(); |
| | | ServiceModel model1=upgs.serchItem(u); |
| | | //System.out.println(model.getData()); |
| | | if(model1.getCode()==1){ |
| | | session.setAttribute("permits", ActionUtil.tojson(model1.getData())); |
| | | }else{ |
| | | model.setCode(0); |
| | | model.setMsg("还未分配权限"); |
| | | } |
| | | //将新登录的用户存入application |
| | | setApplication(u); |
| | | //集群专用 |
| | | //new User_infService_Cluster().setApplication(u); |
| | | } |
| | | } |
| | | return model; |
| | | } |
| | | |
| | |
| | | //右键查看参数和弹出框的刷新按钮 |
| | | public ServiceModel serchbyDev_id(Object obj) { |
| | | Fbs9100_setparam fsparam=(Fbs9100_setparam) obj; |
| | | boolean bl=((Fbs9100_setparamImpl)dao).sendCmdToFBS9100Dev(fsparam.getNum(),fsparam.getTestCmd()!=null?fsparam.getTestCmd():0, fsparam.getDev_id()); |
| | | boolean bl=((Fbs9100_setparamImpl)dao).sendCmdToFBS9100Dev2(fsparam.getNum(),fsparam.getBattGroupNum(),fsparam.getTestCmd()!=null?fsparam.getTestCmd():0, fsparam.getDev_id()); |
| | | //System.out.println(fsparam.getDev_id()+" "+bl); |
| | | List list=((Fbs9100_setparamImpl)dao).serchbyDev_id(obj); |
| | | if(bl){ |
| | |
| | | import com.fgkj.dao.BattTestData; |
| | | import com.google.gson.reflect.TypeToken; |
| | | |
| | | import org.apache.poi.xssf.usermodel.*; |
| | | import sun.misc.BASE64Decoder; |
| | | import sun.misc.BASE64Encoder; |
| | | |
| | |
| | | }; |
| | | try { |
| | | // 创建一个工作薄 |
| | | HSSFWorkbook wb = new HSSFWorkbook(); |
| | | HSSFSheet sheet1 = wb.createSheet("数据总表"); |
| | | //HSSFWorkbook wb = new HSSFWorkbook(); |
| | | //更改类型为 新的excel格式,支持更长的横向长度 |
| | | XSSFWorkbook wb = new XSSFWorkbook(); |
| | | XSSFSheet sheet1 = wb.createSheet("数据总表"); |
| | | // HSSFRow row = sheet1.createRow(2); |
| | | HSSFPatriarch patriarch = sheet1.createDrawingPatriarch(); |
| | | XSSFDrawing patriarch = sheet1.createDrawingPatriarch(); |
| | | int rownum = 1; |
| | | |
| | | sheet1.createRow(rownum); |
| | |
| | | sheet1.createRow(rownum); |
| | | sheet1.getRow(rownum).createCell(1).setCellValue(picName[i]); |
| | | rownum++; |
| | | HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255,(short) 1, rownum, (short) 10, 25 * (picnum + 1)); |
| | | XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 512, 255,(short) 1, rownum, (short) 10, 25 * (picnum + 1)); |
| | | anchor.setAnchorType(3); |
| | | patriarch.createPicture(anchor,wb.addPicture(bytes.get(picnum),HSSFWorkbook.PICTURE_TYPE_PNG)).resize(1); |
| | | picnum ++;rownum+=25; |
| | |
| | | } |
| | | } |
| | | |
| | | createMonInfoSheet(wb,mon_vol_list ,mon_tmp_list,groupinfo); |
| | | createMonInfoSheet2(wb,splitTime,timeCompareList,monVolCompareList ,monTempCompareList,monVolComparePic,monTempComparePic); |
| | | createMonInfoSheet_XSSF(wb,mon_vol_list ,mon_tmp_list,groupinfo); |
| | | createMonInfoSheet2_XSSF(wb,splitTime,timeCompareList,monVolCompareList ,monTempCompareList,monVolComparePic,monTempComparePic); |
| | | |
| | | if (qth.getCode()==1) { |
| | | rownum += 2; |
| | |
| | | // 转码防止乱码 |
| | | resp.addHeader("Content-Disposition", "attachment;filename=" |
| | | + new String(excelName.getBytes("gb2312"), "ISO8859-1") |
| | | + ".xls"); |
| | | + ".xlsx"); |
| | | OutputStream out = resp.getOutputStream(); |
| | | wb.write(out); |
| | | out.close(); |
| | |
| | | } |
| | | |
| | | //System.out.println("data.length"+datas.length+"\t datas[0].length:"+datas[0].length); |
| | | } |
| | | } |
| | | |
| | | public void createMonInfoSheet_XSSF(XSSFWorkbook wb,String[][] mon_vol_list ,String[][] mon_tmp_list,List<Batttestdata> groupinfo){ |
| | | XSSFSheet sheet = wb.createSheet("单体数据表"); |
| | | if(mon_vol_list != null && mon_tmp_list != null && groupinfo != null){ |
| | | int mon_count = mon_tmp_list.length; //总单体数量 |
| | | int total_col = mon_vol_list.length; //总记录条数 |
| | | |
| | | |
| | | List<String> tabTh = new ArrayList<String>(){{ |
| | | this.add("时间(HH:MM:SS)");this.add("在线电压(V)");this.add("组端电压(V)");this.add("电流(A)");this.add("测试容量(AH)"); |
| | | }}; |
| | | for(int i=1;i<=mon_count;i++){ |
| | | tabTh.add("单体电压"+i+"(V)"); |
| | | } |
| | | for(int i=0;i<=mon_count;i++){ |
| | | if(i == 0){ |
| | | tabTh.add(""); |
| | | continue; |
| | | } |
| | | tabTh.add("单体温度"+i+"(℃)"); |
| | | } |
| | | |
| | | String[][] datas = new String[total_col][tabTh.size()]; |
| | | |
| | | //System.out.println("datas.length"+datas.length+"\t datas[0].length:"+datas[0].length+"==mon_vol_list.length:"+mon_vol_list.length+"\tmon_vol_list[0].length"+mon_vol_list[0].length+"\tmon_tmp:"+mon_tmp_list[0].length); |
| | | |
| | | |
| | | for(int j=0;j < datas.length;j++){ |
| | | int currnum = 0; |
| | | datas[j][currnum++] = formatTestLong(groupinfo.get(j).getTest_timelong()); |
| | | datas[j][currnum++] = formartDouble(groupinfo.get(j).getOnline_vol(),2)+""; |
| | | datas[j][currnum++] = formartDouble(groupinfo.get(j).getGroup_vol(),2)+""; |
| | | datas[j][currnum++] = formartDouble(groupinfo.get(j).getTest_curr(),1)+""; |
| | | datas[j][currnum++] = formartDouble(groupinfo.get(j).getTest_cap(),1)+""; |
| | | |
| | | for(int i=0;i<mon_vol_list[j].length;i++){ |
| | | datas[j][currnum++] = mon_vol_list[j][i]; |
| | | } |
| | | datas[j][currnum++] = ""; |
| | | for(int i=0;i<mon_tmp_list.length;i++){ |
| | | datas[j][currnum++] = mon_tmp_list[i][j]; |
| | | } |
| | | } |
| | | //System.out.println("mon_vol_list"+mon_vol_list.length+"\t mon_tmp_list:"+mon_tmp_list.length); |
| | | |
| | | int maxcol = 254; //设置最大列数 |
| | | |
| | | int countReLine = (int) Math.ceil((double)total_col/maxcol); |
| | | int totalrow = countReLine *(tabTh.size()+1); //excel总行数 |
| | | for(int i=0;i<totalrow;i++){ |
| | | sheet.createRow(i); |
| | | } |
| | | |
| | | //System.out.println("countReLine:"+countReLine); |
| | | |
| | | int currRow = 0; //当前行 |
| | | int arr_index = 0; //当前列 |
| | | for(int i=0;i<countReLine;i++){ |
| | | for(int col = 0;col <= maxcol && col<=datas.length && arr_index<datas.length;col++){ |
| | | if(col == 0){ |
| | | for(int k=0;k<tabTh.size();k++){ |
| | | sheet.getRow(k+currRow).createCell(col).setCellValue(tabTh.get(k)); |
| | | } |
| | | }else{ |
| | | for(int k = 0;k<datas[arr_index].length;k++){ |
| | | sheet.getRow(k+currRow).createCell(col).setCellValue(datas[arr_index][k]); |
| | | } |
| | | arr_index++; |
| | | } |
| | | } |
| | | currRow += tabTh.size()+1; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | }*/ |
| | | |
| | | } |
| | | |
| | | private void createMonInfoSheet2_XSSF(XSSFWorkbook wb,String splitTime, String[] timeCompareList,String[][] monVolCompareList, String[][] monTempCompareList, String monVolComparePic, String monTempComparePic) { |
| | | |
| | | bytes=new ArrayList<byte[]>(); |
| | | //处理图片 |
| | | try { |
| | | if (ServletUtils.isNotNull(monVolComparePic)) { |
| | | String[] url = monVolComparePic.split(","); |
| | | bytes.add(new BASE64Decoder().decodeBuffer(url[1])); |
| | | } |
| | | if (ServletUtils.isNotNull(monTempComparePic)) { |
| | | String[] url = monTempComparePic.split(","); |
| | | bytes.add(new BASE64Decoder().decodeBuffer(url[1])); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | XSSFSheet sheet = wb.createSheet("单体电压对比表"); |
| | | //图片元素 |
| | | XSSFDrawing patriarch = sheet.createDrawingPatriarch(); |
| | | |
| | | //字体格式-加粗 |
| | | XSSFCellStyle cellStyle = wb.createCellStyle(); |
| | | XSSFFont font = wb.createFont(); |
| | | font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); |
| | | cellStyle.setFont(font); |
| | | |
| | | //一行一行的填充数据 |
| | | int rowNum = 0; |
| | | XSSFRow firstRow = sheet.createRow(rowNum++); |
| | | XSSFCell cell = firstRow.createCell(0); |
| | | cell.setCellValue("单体电压对比图"); |
| | | cell.setCellStyle(cellStyle); |
| | | |
| | | //插入对比图片 |
| | | int picNum = 0; |
| | | XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 512, 255,(short) 0, rowNum, (short) 10, rowNum+25); |
| | | anchor.setAnchorType(3); |
| | | patriarch.createPicture(anchor,wb.addPicture(bytes.get(picNum),HSSFWorkbook.PICTURE_TYPE_PNG)).resize(1); |
| | | picNum ++;rowNum+=25; |
| | | |
| | | //插入数据 |
| | | XSSFRow firstDataRow = sheet.createRow(rowNum++); |
| | | XSSFCell dataCell = firstDataRow.createCell(0); |
| | | dataCell.setCellValue("基准时间:"+splitTime+"分钟"); |
| | | dataCell.setCellStyle(cellStyle); |
| | | //数据行抬头 |
| | | XSSFRow rowDataTitle = sheet.createRow(rowNum++); |
| | | for (int i = 0; i < monVolCompareList.length+1; i++) { |
| | | XSSFCell cellTemp = rowDataTitle.createCell(i); |
| | | if(i==0){ |
| | | cellTemp.setCellValue("时间(HH:MM:SS)"); |
| | | }else{ |
| | | cellTemp.setCellValue("单体对比电压"+(i)+"(V)"); |
| | | } |
| | | cellTemp.setCellStyle(cellStyle); |
| | | } |
| | | //数据行[1,1,1],[2,2,2] |
| | | for (int i = 0; i < monVolCompareList[0].length; i++) { |
| | | XSSFRow row = sheet.createRow(rowNum++); |
| | | for (int j = 0; j < monVolCompareList.length+1; j++) { |
| | | row.createCell(0).setCellValue(timeCompareList[i]); |
| | | if(j!=0){ |
| | | row.createCell(j).setCellValue(monVolCompareList[j-1][i]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //第二个sheet |
| | | XSSFSheet sheet1 = wb.createSheet("单体温度对比表"); |
| | | //图片元素 |
| | | XSSFDrawing patriarch1 = sheet1.createDrawingPatriarch(); |
| | | |
| | | //字体格式-加粗 |
| | | XSSFCellStyle cellStyle1 = wb.createCellStyle(); |
| | | XSSFFont font1 = wb.createFont(); |
| | | font1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); |
| | | cellStyle1.setFont(font1); |
| | | |
| | | //一行一行的填充数据 |
| | | int rowNum1 = 0; |
| | | XSSFRow firstRow1 = sheet1.createRow(rowNum1++); |
| | | XSSFCell cell1 = firstRow1.createCell(0); |
| | | cell1.setCellValue("单体温度对比图"); |
| | | cell1.setCellStyle(cellStyle); |
| | | |
| | | //插入对比图片 |
| | | XSSFClientAnchor anchor1 = new XSSFClientAnchor(0, 0, 512, 255,(short) 0, rowNum1, (short) 10, rowNum1+25); |
| | | anchor1.setAnchorType(3); |
| | | patriarch1.createPicture(anchor1,wb.addPicture(bytes.get(picNum),HSSFWorkbook.PICTURE_TYPE_PNG)).resize(1); |
| | | rowNum1+=25; |
| | | |
| | | //插入数据 |
| | | XSSFRow firstDataRow1 = sheet1.createRow(rowNum1++); |
| | | XSSFCell dataCell1 = firstDataRow1.createCell(0); |
| | | dataCell1.setCellValue("基准时间:"+splitTime+"分钟"); |
| | | dataCell1.setCellStyle(cellStyle1); |
| | | //数据行抬头 |
| | | XSSFRow rowDataTitle1 = sheet1.createRow(rowNum1++); |
| | | for (int i = 0; i < monTempCompareList.length+1; i++) { |
| | | XSSFCell cellTemp = rowDataTitle1.createCell(i); |
| | | if(i==0){ |
| | | cellTemp.setCellValue("时间(HH:MM:SS)"); |
| | | }else{ |
| | | cellTemp.setCellValue("单体对比温度"+(i)+"(℃)"); |
| | | } |
| | | cellTemp.setCellStyle(cellStyle1); |
| | | } |
| | | //数据行[1,1,1],[2,2,2] |
| | | for (int i = 0; i < monTempCompareList[0].length; i++) { |
| | | XSSFRow row = sheet1.createRow(rowNum1++); |
| | | for (int j = 0; j < monTempCompareList.length+1; j++) { |
| | | row.createCell(0).setCellValue(timeCompareList[i]); |
| | | if(j!=0){ |
| | | row.createCell(j).setCellValue(monTempCompareList[j-1][i]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | //导出CT机样式报表 |
| | | private void ExprotCTReport(HttpServletRequest req, HttpServletResponse resp) { |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE struts PUBLIC |
| | | "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" |
| | | "http://struts.apache.org/dtds/struts-2.3.dtd"> |
| | | "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" |
| | | "http://struts.apache.org/dtds/struts-2.5.dtd"> |
| | | <struts> |
| | | <!--排除websocket连接的url,不拦截--> |
| | | <constant name="struts.action.excludePattern" value="/websocket/powerACData,/websocket/powerACDCData,/websocket/powerDCData,/websocket/powerAlarm"></constant> |
| | | |
| | | <!-- 配置开发模式 --> |
| | | <constant name="struts.devMode" value="false" /> |
| | |
| | | |
| | | <constant name="struts.multipart.maxSize" value ="1024000000" /> |
| | | |
| | | <!-- <constant name="struts.action.excludePattern" value="ws://*"></constant>--> |
| | | |
| | | <package name="myInterceptor" extends="struts-default" > |
| | | <package name="myInterceptor" extends="struts-default"> |
| | | <!-- 配置拦截器 --> |
| | | <interceptors> |
| | | <!-- 注册拦截器 --> |
| | |
| | | <!-- 指定包的默认拦截器栈 --> |
| | | <default-interceptor-ref name="customStack"/> |
| | | </package> |
| | | <package name="default" namespace="/" extends="json-default,myInterceptor" > |
| | | |
| | | <package name="default" namespace="/" extends="json-default,myInterceptor" strict-method-invocation="false"> |
| | | |
| | | <action name="CheckClientAction_check" class="com.fgkj.actions.CheckClientAction" method="check"> |
| | | <result name="none" type="redirect">/login.jsp</result> |
| | | <result name="success" type="redirect">/mobil/loginm.html</result> |
| | |
| | | </result> |
| | | </action> |
| | | </package> |
| | | <package name="p1" namespace="/" extends="struts-default"> |
| | | <!--<package name="p1" namespace="/" extends="struts-default"> |
| | | <result-types> |
| | | <!-- 用于处理下载文件点击取消时报出异常问题 --> |
| | | <!– 用于处理下载文件点击取消时报出异常问题 –> |
| | | <result-type name="streamx" class="com.sunspoter.lib.web.struts2.dispatcher.StreamResultX"></result-type> |
| | | </result-types> |
| | | <action name="FileDownloadAction" class="com.fgkj.actions.FileDownloadAction"> |
| | | <result type="streamx"> |
| | | <param name="contentType">application/octet-stream</param> |
| | | <!-- 设置返回的输入流,在对应的Action中要有对应的getDownloadFile方法 --> |
| | | <!– 设置返回的输入流,在对应的Action中要有对应的getDownloadFile方法 –> |
| | | <param name="inputName">downloadFile</param> |
| | | <!-- 设置下载时文件的名称,对应Action中药有filename属性 --> |
| | | <!– 设置下载时文件的名称,对应Action中药有filename属性 –> |
| | | <param name="contentDisposition">attachment;filename=${filename}</param> |
| | | <!-- 设置缓冲区大小4k --> |
| | | <!– 设置缓冲区大小4k –> |
| | | <param name="bufferSize">4096</param> |
| | | <!-- 下载时显示下载文件的大小,Action中要有对应的String类型的属性contentLength --> |
| | | <!– 下载时显示下载文件的大小,Action中要有对应的String类型的属性contentLength –> |
| | | <param name="contentLength">${contentLength}</param> |
| | | </result> |
| | | </action> |
| | | </package> |
| | | </package>--> |
| | | </struts> |