|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.common.domain.entity.MatExcel; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.Mat; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.Tag; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.mapper.ManTagMapper; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.service.ManMatService; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.service.ManTagService; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.mapper.TagMapper; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.service.MatService; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.service.TagService; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.Cools; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.SpringUtils; | 
|---|
|  |  |  | import com.zy.asrs.framework.exception.CoolException; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private int total = 0; | 
|---|
|  |  |  | private Long userId; | 
|---|
|  |  |  | private Long hostId; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public MatExcelListener() { | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public MatExcelListener(Long userId) { | 
|---|
|  |  |  | public MatExcelListener(Long userId, Long hostId) { | 
|---|
|  |  |  | this.userId = userId; | 
|---|
|  |  |  | this.hostId = hostId; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void invoke(MatExcel excel, AnalysisContext ctx) { | 
|---|
|  |  |  | ManTagService tagService = SpringUtils.getBean(ManTagService.class); | 
|---|
|  |  |  | ManTagMapper tagMapper = SpringUtils.getBean(ManTagMapper.class); | 
|---|
|  |  |  | ManMatService matService = SpringUtils.getBean(ManMatService.class); | 
|---|
|  |  |  | TagService tagService = SpringUtils.getBean(TagService.class); | 
|---|
|  |  |  | TagMapper tagMapper = SpringUtils.getBean(TagMapper.class); | 
|---|
|  |  |  | MatService matService = SpringUtils.getBean(MatService.class); | 
|---|
|  |  |  | Date now = new Date(); | 
|---|
|  |  |  | Long tagId; | 
|---|
|  |  |  | // 分类 | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(excel.getPriClass()) && !Cools.isEmpty(excel.getSecClass())) { | 
|---|
|  |  |  | Tag priTag = tagService.getOne(new LambdaQueryWrapper<Tag>().eq(Tag::getName, excel.getPriClass()).eq(Tag::getLevel, 2)); | 
|---|
|  |  |  | if (priTag == null) { | 
|---|
|  |  |  | Tag top = tagService.getTop(); | 
|---|
|  |  |  | Tag top = tagService.getTop(hostId); | 
|---|
|  |  |  | NodeUtils nodeUtils = new NodeUtils(); | 
|---|
|  |  |  | nodeUtils.executePath(top.getId()); | 
|---|
|  |  |  | priTag = new Tag( | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | tagId = secTag.getId(); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | tagId = tagService.getTop().getId(); | 
|---|
|  |  |  | tagId = tagService.getTop(hostId).getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 商品 | 
|---|
|  |  |  | Mat mat = matService.getOne(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, excel.getMatnr())); | 
|---|