作者 朱兆平

已ROWNUM为基础,发送数据

@@ -8,12 +8,19 @@ package com.airport.bean; @@ -8,12 +8,19 @@ package com.airport.bean;
8 public class MessageBak { 8 public class MessageBak {
9 private int fid; 9 private int fid;
10 private String content; 10 private String content;
  11 + private int rownum_;
11 12
12 public MessageBak(int fid, String content) { 13 public MessageBak(int fid, String content) {
13 this.fid = fid; 14 this.fid = fid;
14 this.content = content; 15 this.content = content;
15 } 16 }
16 17
  18 + public MessageBak(int fid, String content,int rownum_) {
  19 + this.fid = fid;
  20 + this.content = content;
  21 + this.rownum_ = rownum_;
  22 + }
  23 +
17 public String toString() { 24 public String toString() {
18 return this.fid + " " + this.content; 25 return this.fid + " " + this.content;
19 } 26 }
@@ -33,4 +40,12 @@ public class MessageBak { @@ -33,4 +40,12 @@ public class MessageBak {
33 public void setContent(String content) { 40 public void setContent(String content) {
34 this.content = content; 41 this.content = content;
35 } 42 }
  43 +
  44 + public int getRownum_() {
  45 + return rownum_;
  46 + }
  47 +
  48 + public void setRownum_(int rownum_) {
  49 + this.rownum_ = rownum_;
  50 + }
36 } 51 }
@@ -111,7 +111,7 @@ public class IMFSender extends TimerTask { @@ -111,7 +111,7 @@ public class IMFSender extends TimerTask {
111 logger.info("开始发送数据 XML:" + sendMsg); 111 logger.info("开始发送数据 XML:" + sendMsg);
112 String is_send_ok = this.client.sendMSG(sendMsg); 112 String is_send_ok = this.client.sendMSG(sendMsg);
113 logger.info("is_send_ok=" + is_send_ok); 113 logger.info("is_send_ok=" + is_send_ok);
114 - is_ok = Utils.writeFIDIndex(this.indexFileName, m.getFid()); 114 + is_ok = Utils.writeFIDIndex(this.indexFileName, m.getRownum_());
115 logger.debug("FID:" + m.getFid() + " 缓存成功"); 115 logger.debug("FID:" + m.getFid() + " 缓存成功");
116 ++times; 116 ++times;
117 } else { 117 } else {
@@ -121,7 +121,7 @@ public class DaoImpl implements Dao { @@ -121,7 +121,7 @@ public class DaoImpl implements Dao {
121 String SQL_FMT = "select FID,CONTENT from MESSAGE_BAK WHERE (FID>%s and FID<%s+%s) AND (TYPE='CLR' OR TYPE='ES1' OR TYPE='IS1' OR STYP = 'BSTA' OR STYP = 'FZE_RCF' OR STYP = 'FSU_FOH' OR STYP = 'FSU_DEP' OR STYP = 'COST' OR STYP = 'ABME' OR STYP = 'FZE_DEP' OR STYP = 'FSU_RCF') ORDER BY FID "; 121 String SQL_FMT = "select FID,CONTENT from MESSAGE_BAK WHERE (FID>%s and FID<%s+%s) AND (TYPE='CLR' OR TYPE='ES1' OR TYPE='IS1' OR STYP = 'BSTA' OR STYP = 'FZE_RCF' OR STYP = 'FSU_FOH' OR STYP = 'FSU_DEP' OR STYP = 'COST' OR STYP = 'ABME' OR STYP = 'FZE_DEP' OR STYP = 'FSU_RCF') ORDER BY FID ";
122 //从配置文件读取sql语句 122 //从配置文件读取sql语句
123 String sql_select=ConfigUtils.SQl; 123 String sql_select=ConfigUtils.SQl;
124 - String sql = String.format(sql_select, fid, fid, ConfigUtils.RECORD_COUNT); 124 + String sql = String.format(sql_select, fid, fid, ConfigUtils.RECORD_COUNT); //这里修改从FID_INDEX文件读取的FID ,改为取搜索结果的rownum
125 logger.info(sql); 125 logger.info(sql);
126 final LobHandler lobHandler = new DefaultLobHandler(); 126 final LobHandler lobHandler = new DefaultLobHandler();
127 final ArrayList xmlList = new ArrayList(); 127 final ArrayList xmlList = new ArrayList();
@@ -130,12 +130,13 @@ public class DaoImpl implements Dao { @@ -130,12 +130,13 @@ public class DaoImpl implements Dao {
130 this.jdbcTemplate.query(sql, new AbstractLobStreamingResultSetExtractor() { 130 this.jdbcTemplate.query(sql, new AbstractLobStreamingResultSetExtractor() {
131 protected void streamData(ResultSet rs) throws SQLException, IOException, DataAccessException { 131 protected void streamData(ResultSet rs) throws SQLException, IOException, DataAccessException {
132 String content = ""; 132 String content = "";
133 - 133 + int rownum=0;
134 while(rs.next()) { 134 while(rs.next()) {
135 int fid = rs.getInt(1); 135 int fid = rs.getInt(1);
136 content = lobHandler.getClobAsString(rs, "CONTENT"); 136 content = lobHandler.getClobAsString(rs, "CONTENT");
  137 + rownum = rs.getInt("rownum_");
137 if (content != null) { 138 if (content != null) {
138 - MessageBak obj = new MessageBak(fid, content); 139 + MessageBak obj = new MessageBak(fid, content,rownum);
139 xmlList.add(obj); 140 xmlList.add(obj);
140 } else { 141 } else {
141 DaoImpl.logger.error("FID=" + fid + " content is NULL"); 142 DaoImpl.logger.error("FID=" + fid + " content is NULL");