| | |
| | | import com.battmonitor.sql.Com;
|
| | | import com.battmonitor.sql.MysqlConnPool;
|
| | | import com.battmonitor.sql.Sql_Mysql;
|
| | | import com.dev.fgcd.data.FGCD_ComBase;
|
| | | import com.dev.fgcd.data.FGCD_TestFBOFile;
|
| | | import com.dev.fgcd.data.FGCD_TestFBOFile.FBOFile;
|
| | | import com.dev.fgcd.fbo.FboData;
|
| | |
| | | import com.mchange.v2.resourcepool.ResourcePoolListener;
|
| | |
|
| | | public class FGCD_Task_Thread_SQL {
|
| | | /**
|
| | | * 查询当前op_cmd
|
| | | * @param pool
|
| | | * @param BattGroupId
|
| | | * @return
|
| | | */
|
| | | public static int quereyDownLoadState_UserCancel(MysqlConnPool pool,int battgroupid) {
|
| | | int op_cmd = 0;
|
| | | String sql_str = " SELECT op_cmd " + |
| | | " FROM " + Sql_Mysql.Tb_Fgcd_Filedownload_Table +
|
| | | " WHERE BattGroupId = " + battgroupid;
|
| | | Sql_Mysql sql = new Sql_Mysql(pool);
|
| | | ResultSet res = null;
|
| | | try {
|
| | | res = sql.sqlMysqlQuery(sql_str);
|
| | | if(res.next()) {
|
| | | op_cmd = res.getInt("op_cmd");
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | if(null != res) {
|
| | | try {
|
| | | res.close();
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | sql.close_con();
|
| | | }
|
| | | return op_cmd;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 插入FBO历史数据
|
| | |
| | | //文件导入状态
|
| | | public static void updateFBOStateByOneSql(MysqlConnPool pool,int download_flag,int download_state,FGCD_TestFBOFile fbofile,int file_downloadNum) {
|
| | | String sql_str = " update " + Sql_Mysql.Tb_Fgcd_Filedownload_Table +
|
| | | " set download_flag"+(file_downloadNum+1)+"="+download_flag+",download_state"+(file_downloadNum+1)+"="+download_state+" WHERE BattGroupId = " + fbofile.battgroupid+" and dev_id="+fbofile.dev_id;
|
| | | " set op_cmd="+FGCD_ComBase.CMD_DownLoadFBDFile_Over_ACK+",download_flag"+(file_downloadNum+1)+"="+download_flag+",download_state"+(file_downloadNum+1)+"="+download_state+" WHERE BattGroupId = " + fbofile.battgroupid+" and dev_id="+fbofile.dev_id;
|
| | | Sql_Mysql sql = new Sql_Mysql(pool);
|
| | | try {
|
| | | sql.sqlMysqlExecute(sql_str);
|
| | |
| | | * @param pool
|
| | | * @param file
|
| | | */
|
| | | public static void updateFgcd_Filedownload_TableCmdByDevId(MysqlConnPool pool,FGCD_TestFBOFile file) {
|
| | | public static void updateFgcd_Filedownload_TableCmdByDevId(MysqlConnPool pool,FGCD_TestFBOFile file,int file_downloadNum) {
|
| | | String sql_str = " UPDATE " + Sql_Mysql.Tb_Fgcd_Filedownload_Table +
|
| | | " SET op_cmd = " + file.op_cmd +
|
| | | " ,stop_reason = " + file.getStop_reason() +
|
| | | " ,download_flag"+(file_downloadNum+1)+" = " + file.files[file_downloadNum].download_flag +
|
| | | " ,download_state"+(file_downloadNum+1)+" = " + file.files[file_downloadNum].download_state +
|
| | | " WHERE dev_id = " + file.dev_id;
|
| | | Sql_Mysql sql = new Sql_Mysql(pool);
|
| | | try {
|