| | |
| | | @Override |
| | | public void invoke(MatCodeExcel data, AnalysisContext ctx) { |
| | | MatCodeService matCodeService = SpringUtils.getBean(MatCodeService.class); |
| | | if (matCodeService.selectById(data.getMatNo()) == null) { |
| | | MatCode matCode = new MatCode(); |
| | | MatCode matCode = matCodeService.selectById(data.getMatNo()); |
| | | if (matCode == null) { |
| | | matCode = new MatCode(); |
| | | VersionUtils.setMatCode(matCode, data); |
| | | matCode.setModiTime(new Date()); |
| | | matCode.setModiUser(this.userId); |
| | | matCode.setAppeTime(new Date()); |
| | | matCode.setAppeUser(this.userId); |
| | | if (!matCodeService.insert(matCode)) { |
| | | throw new CoolException("导入数据异常"); |
| | | } |
| | | total ++; |
| | | } else { |
| | | VersionUtils.setMatCode(matCode, data); |
| | | matCode.setModiTime(new Date()); |
| | | matCode.setModiUser(this.userId); |
| | | if (!matCodeService.updateById(matCode)) { |
| | | throw new CoolException("导入数据异常"); |
| | | } |
| | | total ++; |
| | |
| | | */ |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext ctx) { |
| | | LOGGER.info("新增{}条产品信息!", total); |
| | | LOGGER.info("新增/修改{}条产品信息!", total); |
| | | } |
| | | |
| | | public int getTotal() { |