| | |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | import java.util.concurrent.CopyOnWriteArraySet; |
| | | import java.util.concurrent.ForkJoinPool; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | * 客户现场excel为老版本,导出的总数限制为65535 |
| | | */ |
| | | public static final int EXPORT_LIMIT = 65535; |
| | | |
| | | /** |
| | | * 自定义并发ForkJoinPool |
| | | */ |
| | | private static final ForkJoinPool customForkJoinPool = new ForkJoinPool(Runtime.getRuntime().availableProcessors()-1); |
| | | |
| | | /** |
| | | * 批量申请:选取选中分类下的所有模板关键属性,相似属性,必填属性,写入execl中 |
| | |
| | | // 查询不需要参与关键属性校验的除自己以外的所有分类oid |
| | | final String isParticipateCheckOids = classifyService.selectLeafByParentClassifyOid(classifyFullInfo.getTopClassifyVO().getOid(), classifyFullInfo.getCurrentClassifyVO().getOid()); |
| | | final BladeUser user = AuthUtil.getUser(); |
| | | //cboList = new CopyOnWriteArrayList<>(cboList); |
| | | // TODO:Thread limit exceeded replacing blocked 异常是这部分代码抛出的,所以暂时将parallelStream改成了stream |
| | | List<ClientBusinessObject> repeatDataMap = cboList.stream().filter(cbo -> { |
| | | // TODO:Thread limit exceeded replacing blocked 异常是这部分代码抛出的 |
| | | // ,所以暂时将parallelStream改成了stream,改成了stream之后发现巨慢 |
| | | // customForkJoinPool控制并发度 |
| | | List<ClientBusinessObject> finalCboList = cboList; |
| | | List<ClientBusinessObject> repeatDataMap = (List<ClientBusinessObject>) customForkJoinPool.submit(()->{ |
| | | finalCboList.parallelStream().filter(cbo -> { |
| | | //每行都得查询.如果其中出现了错误,我们就直接抛出异常,其余的显示 |
| | | //VciBaseUtil.setCurrentUserSessionInfo(sessionInfo); |
| | | Map<String, String> conditionMap = new HashMap<>(); |
| | |
| | | return false; |
| | | } |
| | | }).collect(Collectors.toList()); |
| | | }).join(); |
| | | if(!CollectionUtils.isEmpty(repeatDataMap)){ |
| | | resultVO.setKeyAttrRepeatRowIndexList(repeatDataMap.stream().map(s->s.getAttributeValue(IMPORT_ROW_INDEX)).collect(Collectors.toSet())); |
| | | } |