商用车导入去重校验
This commit is contained in:
parent
f41651cc7c
commit
616767151c
@ -1,69 +1,73 @@
|
||||
package com.tenwa.apzl.discount;
|
||||
|
||||
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.JBOFactory;
|
||||
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;
|
||||
|
||||
import jbo.app.tenwa.calc.LC_EBANK;
|
||||
import jbo.app.tenwa.customer.LB_CARDATA_COMMERCIAL_SERIES;
|
||||
|
||||
public class ModelLibraryImport 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 cars=null; // 导入的车系
|
||||
String brand=null; // 导入的品牌
|
||||
String models=null; // 导入的车辆类型
|
||||
String series_name=null; // 原有的车系
|
||||
String brand_name=null; // 原有的品牌
|
||||
String car_type=null; // 原有的车辆类型
|
||||
String sql1=""; // 原有的车辆类型
|
||||
/**
|
||||
* 校验本次Excel是否有重复的
|
||||
*/
|
||||
|
||||
/**
|
||||
* 校验本次导入数据在导入表是否以有
|
||||
* 校验本次导入数据在导入表是否已有
|
||||
*/
|
||||
|
||||
/**
|
||||
* 校验本次导入的数据是否以有
|
||||
*/
|
||||
Map<String,String> Ebank_Map =new HashMap<String,String>();
|
||||
List<BizObject> list=JBOFactory.createBizObjectQuery(LB_CARDATA_COMMERCIAL_SERIES.CLASS_NAME,null).getResultList(false);
|
||||
for(int i=0;i<list.size();i++) {
|
||||
Ebank_Map.put(list.get(i).getAttribute("series_name").getString(),list.get(i).getAttribute("brand_name").getString());
|
||||
}
|
||||
/*for(BizObject bo:importObjects){
|
||||
// 获取
|
||||
String ebankSn = bo.getAttribute("brand").getString();
|
||||
if(!Ebank_Map.containsKey(ebankSn)){
|
||||
error+=",【"+ebankSn+"】";
|
||||
List<Map<String, String>> list = new ArrayList<Map<String,String>>();
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
for(BizObject bo:importObjects){
|
||||
cars=bo.getAttribute("cars").getString();
|
||||
brand=bo.getAttribute("brand").getString();
|
||||
models=bo.getAttribute("models").getString();
|
||||
// 通过本次excel中的数据查询导入的表, 判断是否重复
|
||||
sql1="SELECT brand FROM li_cardata_commercial WHERE cars='"+cars+"' AND brand='"+brand+"' AND models='"+models+"'";
|
||||
List<Map<String, String>> dataList = DataOperatorUtil.getDataBySql(Sqlca, sql1, null);
|
||||
// 有结果集, 说明重复
|
||||
if(dataList !=null || !dataList.isEmpty()){
|
||||
error="【品牌: "+brand+", 车系: "+cars+", 车型 : "+models+"】";
|
||||
flag=true;
|
||||
}
|
||||
}
|
||||
if(flag) {
|
||||
error = error.substring(1);
|
||||
throw new BusinessException("网银: "+error+"不存在!");
|
||||
}*/
|
||||
throw new BusinessException(error+"已存在 !");
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void runAfter(ASUser CurUser, Map<String, String> model, List<BizObject> importObjects, JBOTransaction tx,
|
||||
Transaction Sqlca) throws Exception {
|
||||
// 错误描述
|
||||
String error="";
|
||||
// 用于判断是否错
|
||||
boolean flag = false;
|
||||
// 商用车车型导入配置
|
||||
Sqlca.executeSQL(new SqlObject("{call proc_insert_shangyongche()}"));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user