| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.protobuf.ServiceException; |
| | | import com.vci.ubcs.code.applyjtcodeservice.feign.IMdmInterJtClient; |
| | | import com.vci.ubcs.code.bo.AttributeValue; |
| | | import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO; |
| | |
| | | |
| | | @Value("${batchadd.redis.time:6000000}") |
| | | public int BATCHADD_REDIS_TIME; |
| | | |
| | | @Value("${batchadd.import_data_limit:5001}") |
| | | private Integer IMPORT_DATA_LIMIT; |
| | | |
| | | /** |
| | | * 主题库分类的服务 |
| | | */ |
| | |
| | | || sheetDataSetList.get(i).getRowData().size() < 1) { |
| | | continue; |
| | | } |
| | | // 单次导入数量限制 |
| | | if(sheetDataSetList.get(i).getRowData().size() > IMPORT_DATA_LIMIT){ |
| | | throw new ServiceException("为了保证系统的稳定性,请一次不要导入超过"+IMPORT_DATA_LIMIT+"条的数据"); |
| | | } |
| | | //历史导入的时候不处理编码 |
| | | //----逻辑内容---- |
| | | //1. 分类的路径可以在页面上选择是分类编号还是分类的名称 |
| | |
| | | //VciBaseUtil.setCurrentUserSessionInfo(sessionInfo); |
| | | List<String> rowIndexList = ruleRowIndexMap.get(ruleOid); |
| | | List<ClientBusinessObject> thisCbos = finalNeedSaveCboList.stream().filter(cbo -> rowIndexList.contains(cbo.getAttributeValue(IMPORT_ROW_INDEX)) && !errorMap.containsKey(cbo.getAttributeValue(IMPORT_ROW_INDEX))).collect(Collectors.toList()); |
| | | List<BaseModel> dataCBOList=new ArrayList<>(); |
| | | List<BaseModel> dataCBOList=new CopyOnWriteArrayList<>(); |
| | | thisCbos.stream().forEach(clientBusinessObject -> { |
| | | BaseModel baseModel=new BaseModel(); |
| | | BeanUtil.convert(clientBusinessObject,baseModel); |
| | |
| | | // if (lifeCycleVO != null) { |
| | | // cbo.setLcStatus(lifeCycleVO.getStartStatus()); |
| | | // } else { |
| | | cbo.setLcStatus(CodeDefaultLC.EDITING.getValue()); |
| | | cbo.setLcStatus(CodeDefaultLC.RELEASED.getValue()); |
| | | // } |
| | | } else { |
| | | cbo.setLcStatus(CodeDefaultLC.EDITING.getValue()); |
| | | cbo.setLcStatus(CodeDefaultLC.RELEASED.getValue()); |
| | | } |
| | | |
| | | } |
| | |
| | | Integer userSecret = VciBaseUtil.getCurrentUserSecret(); |
| | | cbo.setAttributeValue(SECRET_FIELD,String.valueOf((userSecret==null || userSecret ==0)? UserSecretEnum.NONE.getValue():userSecret)); |
| | | } |
| | | cbo.setLcStatus(CodeDefaultLC.EDITING.getValue()); |
| | | cbo.setLcStatus(CodeDefaultLC.RELEASED.getValue()); |
| | | }else{ |
| | | //此时还没有转换路径 |
| | | //cbo.setAttributeValue(CODE_FULL_PATH_FILED, childOidPathMap.getOrDefault(rowData.getData().getOrDefault(CODE_CLASSIFY_OID_FIELD,""),fullPath)); |
| | |
| | | Integer userSecret = VciBaseUtil.getCurrentUserSecret(); |
| | | cbo.setAttributeValue(SECRET_FIELD,String.valueOf((userSecret==null || userSecret ==0)? UserSecretEnum.NONE.getValue():userSecret)); |
| | | } |
| | | cbo.setLcStatus(CodeDefaultLC.EDITING.getValue()); |
| | | cbo.setLcStatus(CodeDefaultLC.RELEASED.getValue()); |
| | | }else{ |
| | | //此时还没有转换路径 |
| | | //cbo.setAttributeValue(CODE_FULL_PATH_FILED, childOidPathMap.getOrDefault(rowData.getData().getOrDefault(CODE_CLASSIFY_OID_FIELD,""),fullPath)); |
| | |
| | | //2.判断关键属性在系统里是否重复 |
| | | //因为数据量很大,所以得想办法并行 |
| | | //SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); |
| | | Map<String,List<BaseModel>> indexTODataMap=new HashMap<>(); |
| | | Map<String,List<BaseModel>> indexTODataMap=new ConcurrentHashMap<>(); |
| | | List<ClientBusinessObject> repeatDataMap = cboList.parallelStream().filter(cbo -> { |
| | | //每行都得查询.如果其中出现了错误,我们就直接抛出异常,其余的显示 |
| | | //VciBaseUtil.setCurrentUserSessionInfo(sessionInfo); |