//对比数据
public static String compareData(String articleType,String currencyCode,String voucher,Integer amount,Connection conn,ZjLogger logger) {
Integer sum = 0;
String flag = "";
String qryArticle = "select AMOUNT from ENTITY_REAL_TIME_DETAIL where ENTITY_TYPE = ? and CURRENCY_CODE = ?";
List<SQLPara> sqlParas = new ArrayList<SQLPara>();
sqlParas.add(new SQLPara("ENTITY_TYPE",Types.VARCHAR,articleType));
sqlParas.add(new SQLPara("CURRENCY_CODE",Types.VARCHAR,currencyCode));
if (articleType.equals("1")) {
qryArticle+=" and CURRENCY = ?";
sqlParas.add(new SQLPara("CURRENCY",Types.VARCHAR,voucher));
}
try {
CachedRowSet checkResult = DbOperate.executeQueryByParamName(qryArticle, sqlParas, conn,
logger);
while(checkResult.next()) {
sum+=checkResult.getInt("AMOUNT");
}
if(sum==amount) {
flag = "ok";
}else {
flag = "fail";
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return flag;
}