修改卡扣导入逻辑

This commit is contained in:
zhulianghua 2018-08-03 17:10:07 +08:00
parent 70c6b71318
commit 4219af5139

View File

@ -10,12 +10,15 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import jbo.app.tenwa.calc.LC_CARD_DEDUCT_DOC;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
@ -275,6 +278,10 @@ public class BaseImportExcelCallBack extends ImportCallBack{
int n = 0;
long start = System.currentTimeMillis();
BizObject bo = importObjects.get(0);
String deductInfoId = Sqlca.getString(new SqlObject("select id from lc_card_deduct_info where import_date is null"));
if(deductInfoId == null){
throw new BusinessException("所有导出的数据都已导入,不能再次导入!");
}
/*WebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext();
ComboPooledDataSource datasource = wac.getBean("dataSourceJDBC",ComboPooledDataSource.class);
con = datasource.getConnection();
@ -296,6 +303,7 @@ public class BaseImportExcelCallBack extends ImportCallBack{
for(int cindex=0;cindex<importObjects.size();cindex++){
count++;
bo = importObjects.get(cindex);
String status = bo.getAttribute("transtatus").getString();
DataElement[] des1 = bo.getAttributes();
for(int d=0;d<des1.length;d++){
switch(d){
@ -329,7 +337,9 @@ public class BaseImportExcelCallBack extends ImportCallBack{
continue;*/
case 22:
stat.setBigDecimal(d+1, new BigDecimal(des1[d].getString().replaceAll(",", "")));
money = money.add(new BigDecimal(des1[d].getDouble()));
if("0".equals(status)) {
money = money.add(new BigDecimal(des1[d].getDouble()));
}
continue;
default:
stat.setString(d+1, bo.getAttribute(des1[d].getName()).getString());
@ -361,7 +371,7 @@ public class BaseImportExcelCallBack extends ImportCallBack{
boLCDD.setAttributeValue("allmayope_money", money);
boLCDD.setAttributeValue("allhad_money", 0);
bomLCDD.saveObject(boLCDD);
con.commit();
stat.executeUpdate("update lc_card_deduct_info set import_date='"+StringFunction.getTodayNow().split(" ")[0]+"',updateuserid='"+CurUser.getUserID()+"',updateorgid='"+CurUser.getUserID()+"',updatetime='"+StringFunction.getTodayNow()+"' where import_date is null");
}catch(Exception e){
e.printStackTrace();
tx.rollback();