为微信账单支付导入增加去重校验
This commit is contained in:
parent
e311980b67
commit
e0b339fd66
60
src_tenwa/com/tenwa/apzl/comm/BillstopayImport.java
Normal file
60
src_tenwa/com/tenwa/apzl/comm/BillstopayImport.java
Normal file
@ -0,0 +1,60 @@
|
||||
package com.tenwa.apzl.comm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.amarsoft.are.jbo.BizObject;
|
||||
import com.amarsoft.are.jbo.JBOTransaction;
|
||||
import com.amarsoft.awe.util.SqlObject;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.amarsoft.context.ASUser;
|
||||
import com.amarsoft.dict.als.cache.CacheLoaderFactory;
|
||||
import com.tenwa.comm.exception.BusinessException;
|
||||
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||||
import com.tenwa.officetempalte.importcallback.impl.BaseImportExcelCallBack;
|
||||
|
||||
public class BillstopayImport extends BaseImportExcelCallBack{
|
||||
|
||||
@Override
|
||||
public void run(ASUser CurUser, BizObject importObject,Map<String, String> model, Integer rowIndex, JBOTransaction tx,Transaction Sqlca) throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runBefore(ASUser CurUser, Map<String, String> model, List<BizObject> importObjects, JBOTransaction tx,Transaction Sqlca) throws Exception {
|
||||
Transaction Sqlca1 = Transaction.createTransaction(CacheLoaderFactory.getDataSource());
|
||||
/**
|
||||
* 定义全局变量
|
||||
*/
|
||||
String error=""; // 错误描述
|
||||
boolean flag=false; // 错误描述
|
||||
String WX_order_number=null; // 导入的微信订单号
|
||||
String sql1=""; // 原有的数据
|
||||
/**
|
||||
* 校验本次Excel是否有重复的
|
||||
*/
|
||||
|
||||
/**
|
||||
* 校验本次导入数据在导入表是否已有
|
||||
*/
|
||||
List<Map<String, String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
for(BizObject bo:importObjects){
|
||||
WX_order_number=bo.getAttribute("WX_order_number").getString();
|
||||
|
||||
// 通过本次excel中的数据查询导入的表, 判断是否重复
|
||||
sql1="SELECT WX_order_number FROM wx_pay_the_bills WHERE WX_order_number='"+WX_order_number+"'";
|
||||
List<Map<String, String>> dataList = DataOperatorUtil.getDataBySql(Sqlca, sql1, null);
|
||||
// 有结果集, 说明重复
|
||||
if(dataList.size()>0){
|
||||
error=",【微信订单号: "+WX_order_number+"】";
|
||||
flag=true;
|
||||
}
|
||||
}
|
||||
if(flag) {
|
||||
error = error.substring(1);
|
||||
throw new BusinessException(error+"已存在 !");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user