| | |
| | | * @param file excel文件的信息 |
| | | * @return 有错误信息的excel |
| | | */ |
| | | @Transactional |
| | | @Override |
| | | public CodeImProtRusultVO batchImportEdit(String codeClassifyOid, String classifyAttr,File file) throws Throwable{ |
| | | VciBaseUtil.alertNotNull(codeClassifyOid,"分类的主键"); |
| | |
| | | titleRowData.remove(titleRowData.size()-1); |
| | | templateVO= templateVOList.get(0); |
| | | }catch (Throwable e){ |
| | | throw new VciBaseException(e.getMessage()); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | |
| | | CodeClassifyTemplateVO finalTemplateVO = templateVO; |
| | |
| | | //我们使用和业务类型的来查询 |
| | | List<Map> cbosB = commonsMapper.selectBySql(sqlBO.getSqlUnPage()); |
| | | if(cbosB.size() == 0){ |
| | | throw new ServiceException("编码:"+ sheetRowData.getData().get(0) + ",未能查询到相关数据。"); |
| | | throw new ServiceException("编码:"+ sheetRowData.getData().get(0) + ",未能查询到相关数据。"); |
| | | } |
| | | excelToCboEdit(fieldIndexMap, sheetRowData, orderDTO, cbosB.get(0)); |
| | | orderDTO.setCopyFromVersion(orderDTO.getOid()); |
| | | orderDTO.setOid(null); |
| | | try { |
| | | mdmEngineService.upSaveCode(orderDTO); |
| | | List<Map> newCbos = commonsMapper.selectBySql(sqlBO.getSqlUnPage()); |
| | | //对码值表进行处理替换创建数据的oid |
| | | QueryWrapper<CodeAllCode> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("CREATECODEOID",orderDTO.getCopyFromVersion()); |
| | | List<CodeAllCode> codeAllCodes = codeAllCodeService.selectByWrapper(wrapper); |
| | | codeAllCodes.get(0).setCreateCodeOid(newCbos.get(0).get("OID").toString()); |
| | | codeAllCodes.get(0).setLastModifyTime(new Date()); |
| | | codeAllCodes.get(0).setTs(new Date()); |
| | | codeAllCodes.get(0).setLastModifier(AuthUtil.getUser().getUserName()); |
| | | codeAllCodeService.updateBatchById(codeAllCodes); |
| | | } catch (Throwable e) { |
| | | log.error("批量产生编码的时候出错了", e); |
| | | errorMap.put(sheetRowData.getRowIndex(), ";系统错误,存储数据的时候出错了:"+e.getMessage()); |