保存进度

This commit is contained in:
Kane Wang 2025-03-13 22:15:51 +08:00
parent 66d55f9e87
commit bec378be36

View File

@ -47,7 +47,7 @@ public class CpicximToXMNHS
private static String password = "Kane@1981"; private static String password = "Kane@1981";
/** /**
* 数据库中获取未发送过的小药箱数据 * HmbXyxInfo_Update中获取未发送过的小药箱数据
* *
* @return * @return
*/ */
@ -139,6 +139,11 @@ public class CpicximToXMNHS
return items; return items;
} }
/**
* postedItems 中的小药箱数据冲HmbXyxInfo_update中清除
*
* @param postedItems 已发送的小药箱数据
*/
public static void removePostedHmbXyxInfo( Vector<HmbXyxInfo> postedItems ) public static void removePostedHmbXyxInfo( Vector<HmbXyxInfo> postedItems )
{ {
Vector<HmbXyxInfo> items = new Vector<HmbXyxInfo>(); Vector<HmbXyxInfo> items = new Vector<HmbXyxInfo>();
@ -286,19 +291,26 @@ public class CpicximToXMNHS
try try
{ {
logger.info( "发送请求内容:" + requestObject.toJSONString() ); logger.info( "发送请求内容:" + requestObject.toJSONString() );
req.setData( requestObject ); req.setData( requestObject );
resp = client.execute( req ); resp = client.execute( req );
logger.info( "发送成功,返回消息:" + resp.getData() ); if ( resp != null )
{
logger.info( "发送成功,返回消息:" + resp.getData() );
// 将已发送的数据从update表中清理掉 // 将已发送的数据从HmbXyxInfo_update表中清理掉
removePostedHmbXyxInfo( postedInfo ); removePostedHmbXyxInfo( postedInfo );
}
else
{
logger.info( "已发送请求但获取的DefaultZephyrResponse为null" );
}
} }
catch ( ZephyrApiException error ) catch ( ZephyrApiException error )
{ {
// 发送不成功记录日志 // 发送不成功记录日志
// 失败的数据就留在update表中待以后重新发送 // 不从HmbXyxInfo_update中清理当前这批数据待以后重新发送
logger.error( "发送异常:" + error.getMessage() ); logger.error( "发送异常:" + error.getMessage() );
} }
finally finally