Commit 741685d5 by 王军业

12415421452

1 parent e50059d0
...@@ -18,7 +18,7 @@ import cn.afterturn.easypoi.handler.inter.IExcelDataHandler; ...@@ -18,7 +18,7 @@ import cn.afterturn.easypoi.handler.inter.IExcelDataHandler;
public class ImportExcel { public class ImportExcel {
private static final Logger log=LoggerFactory.getLogger(ImportExcel.class); private static final Logger log=LoggerFactory.getLogger(ImportExcel.class);
public Boolean flag=true; public Boolean flag=true;
public List<ImportModel> Import(MultipartFile file) throws IOException, Exception { public List<List<ImportModel>> Import(MultipartFile file) throws IOException, Exception {
ImportParams importParams = new ImportParams(); ImportParams importParams = new ImportParams();
IExcelDataHandler<ImportModel> handle=new ImportHandle(); IExcelDataHandler<ImportModel> handle=new ImportHandle();
handle.setNeedHandlerFields(new String[] {"合同编号"}); handle.setNeedHandlerFields(new String[] {"合同编号"});
...@@ -28,6 +28,11 @@ public class ImportExcel { ...@@ -28,6 +28,11 @@ public class ImportExcel {
List<ImportModel> successList=result.getList(); List<ImportModel> successList=result.getList();
List<ImportModel> failList=result.getFailList(); List<ImportModel> failList=result.getFailList();
List<List<ImportModel>> list = new ArrayList<List<ImportModel>>();
list.add(successList);
list.add(failList);
log.info(list.get(0).size()+ "");
log.info("是否存在验证未通过的数据:"+result.isVerfiyFail()); log.info("是否存在验证未通过的数据:"+result.isVerfiyFail());
log.info("验证通过的数量:"+successList.size()); log.info("验证通过的数量:"+successList.size());
log.info("验证未通过的数量"+failList.size()); log.info("验证未通过的数量"+failList.size());
...@@ -48,6 +53,6 @@ public class ImportExcel { ...@@ -48,6 +53,6 @@ public class ImportExcel {
ImportModel flag=new ImportModel(); ImportModel flag=new ImportModel();
flag.setContract_unid("数据格式出错"); flag.setContract_unid("数据格式出错");
successList.add(flag);*/ successList.add(flag);*/
return successList; return list;
} }
} }
...@@ -576,6 +576,9 @@ public class ContractServiceImpl implements ContractService { ...@@ -576,6 +576,9 @@ public class ContractServiceImpl implements ContractService {
@Override @Override
public Object importExcel(MultipartFile file) { public Object importExcel(MultipartFile file) {
logger.info("========================导入合同Excel表格===========================");
//ImportExcel importExcel = new ImportExcel(); //ImportExcel importExcel = new ImportExcel();
try { try {
/* ImportParams importParams = new ImportParams(); /* ImportParams importParams = new ImportParams();
...@@ -600,7 +603,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -600,7 +603,7 @@ public class ContractServiceImpl implements ContractService {
/* List<ImportModel> successList=importExcel.Import(file); /* List<ImportModel> successList=importExcel.Import(file);
ImportModel impor=null;*/ ImportModel impor=null;*/
ImportExcel importExcel = new ImportExcel(); ImportExcel importExcel = new ImportExcel();
List<ImportModel> successList=importExcel.Import(file); List<List<ImportModel>> list=importExcel.Import(file);
/* Boolean flag=true; /* Boolean flag=true;
if(importExcel.flag) { if(importExcel.flag) {
flag=false; flag=false;
...@@ -617,7 +620,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -617,7 +620,7 @@ public class ContractServiceImpl implements ContractService {
s=s+"!"; s=s+"!";
logger.info(s); logger.info(s);
} }
if(importExcel.flag) { if(list.get(1).size()==0) {
ContractVo contractVo = null; ContractVo contractVo = null;
ReturnInfo returnInfo=null; ReturnInfo returnInfo=null;
Receipt receipt=null; Receipt receipt=null;
...@@ -630,7 +633,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -630,7 +633,7 @@ public class ContractServiceImpl implements ContractService {
PaymentAgree acceptanc_aymentAgree=null; PaymentAgree acceptanc_aymentAgree=null;
PaymentAgree mainten_aymentAgree=null; PaymentAgree mainten_aymentAgree=null;
DeliverGoods deliverGoods=null; DeliverGoods deliverGoods=null;
for(ImportModel importModel:successList) { for(ImportModel importModel:list.get(0)) {
/*if(contractMapper.queryOne(importModel.getContract_unid())!=null) { /*if(contractMapper.queryOne(importModel.getContract_unid())!=null) {
contractMapper.actualDeleteOne(importModel.getContract_unid()); contractMapper.actualDeleteOne(importModel.getContract_unid());
}*/ }*/
...@@ -903,7 +906,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -903,7 +906,7 @@ public class ContractServiceImpl implements ContractService {
} }
return successCode; return successCode;
} }
return successList; return list.get(1);
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!