This commit is contained in:
zhangjun 2019-04-16 09:47:43 +08:00
parent bcdd148f58
commit cccdafe221

View File

@ -1,8 +1,11 @@
package com.tenwa.apzl.discount;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
import jbo.voucher.LB_DISCOUNT;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
@ -100,10 +103,10 @@ public class AssetsOffCallBack extends BaseImportExcelCallBack{
throw new BusinessException("该合同号 "+contractNo+" 不存在!");
}
//已经存在资产转出方的不允许导入
String ass = contractInfo.getAttribute("ASSETTRANSFERER")==null? "" : contractInfo.getAttribute("ASSETTRANSFERER").toString();
/*String ass = contractInfo.getAttribute("ASSETTRANSFERER")==null? "" : contractInfo.getAttribute("ASSETTRANSFERER").toString();
if (!"".equals(ass)) {
throw new BusinessException("该合同号 "+contractNo+" 已存在<<资产转出方>> 请勿重复导入!");
}
}*/
contractInfo.setAttributeValue("ASSETTRANSFERER", assettransferer);
contractInfo.setAttributeValue("TRANSFERDATE", transferdate);
@ -111,5 +114,36 @@ public class AssetsOffCallBack extends BaseImportExcelCallBack{
contractInfoManager.saveObject(contractInfo);
}
//
public void runBefore(ASUser CurUser, Map<String, String> model, List<BizObject> importObjects, JBOTransaction tx,Transaction Sqlca) throws Exception {
String error="";
boolean flag = false;
String insertSql="";
/**
* 校验重复导入
*/
// 用于校验是否重复
List<String> contractNo = new ArrayList<String>();
// 经所有业务合同号存入集合
List<BizObject> ConList=JBOFactory.createBizObjectQuery(LB_CONTRACT_INFO.CLASS_NAME,"ASSETTRANSFERER IS NOT NULL").getResultList(false);
for(int i=0;i<ConList.size();i++) {
contractNo.add(ConList.get(i).getAttribute("CONTRACT_NO").getString());
}
// 未导入的加到集合, 已有的报重复校验
for(BizObject bo:importObjects){
String CONTRACT_NO = bo.getAttribute("CONTRACT_NO").getString();
if(!contractNo.contains(CONTRACT_NO)){
contractNo.add(CONTRACT_NO);
}else {
insertSql="INSERT INTO li_assets_off(id,CONTRACT_NO,inputuser,inputtime,updateuser,updatetime) values()";
Sqlca.executeSQL(insertSql);
error+=",【"+CONTRACT_NO+"";
flag=true;
}
}
if(flag) {
error = error.substring(1);
throw new BusinessException("该合同号:"+error+"已存在<<资产转出方>> 请勿重复导入!");
}
}
}