|  |  | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.BeanUtils; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  | import java.util.*; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2019-11-25 | 
 |  |  | 
 |  |  |  | 
 |  |  |     private int total = 0; | 
 |  |  |     private int index = 1; | 
 |  |  |     private String recordLog = ""; | 
 |  |  |     private Long userId; | 
 |  |  |  | 
 |  |  |     public PlaExcelListener() { | 
 |  |  | 
 |  |  |         MatService matService = SpringUtils.getBean(MatService.class); | 
 |  |  |         Date now = new Date(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         // 商品 | 
 |  |  |         if(Cools.isEmpty(excel.getBatch()) || Cools.isEmpty(excel.getPackageNo())){ | 
 |  |  |             return; | 
 |  |  |             throw new CoolException("第" +  index++ + "数据错误,包号或者批号为空"); | 
 |  |  |         } | 
 |  |  |         Pla pla = plaService.selectByBatchAndPackageNo(excel.getBatch(),excel.getPackageNo()); | 
 |  |  |         if (pla == null) { | 
 |  |  | 
 |  |  |             pla = plaCreate(pla,excel,matService,nodeService); | 
 |  |  |             try { | 
 |  |  |                 plaService.updateById(pla); | 
 |  |  |                 recordLog = recordLog + index + "," + pla.getBatch() + "," + pla.getPackageNo() + ";" ; | 
 |  |  |             }catch (Exception e){ | 
 |  |  |                 log.error("保存商品信息失败,批号:" + excel.getBatch() + ", 包号:" + excel.getPackageNo() + "原因为:" + e.getMessage()); | 
 |  |  |                 throw new CoolException("保存商品信息失败,批号:" + excel.getBatch() + ", 包号:" + excel.getPackageNo() + "原因为:" + e.getMessage()); |