| | |
| | | deleteBatchDTO.getCodeClassifyOid(), "主题库分类的主键"); |
| | | CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(deleteBatchDTO.getCodeClassifyOid()); |
| | | //找业务类型,然后使用主键去获取数据库里的数据 |
| | | Collection<String> oidCollection = null; |
| | | Collection<String> oidCollection = new ArrayList<>(); |
| | | for (Collection<String> strings : VciBaseUtil.switchCollectionForOracleIn(deleteBatchDTO.getOidList())) { |
| | | oidCollection.addAll(strings); |
| | | } |
| | | |
| | | List<CodeWupin> cboList = codeWupinMapper.selectBatchIds(oidCollection); |
| | | // List<ClientBusinessObject> cboList = new ArrayList<>(); |
| | | // oidCollection.stream().forEach(oids -> { |
| | | // Map<String, String> conditionMap = new HashMap<>(); |
| | | // List<CodeWupin> cboList = codeWupinMapper.selectBatchIds(oidCollection); |
| | | List<BaseModel> cboList = new ArrayList<>(); |
| | | oidCollection.stream().forEach(oids -> { |
| | | Map<String, String> conditionMap = new HashMap<>(); |
| | | // conditionMap.put("oid", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")"); |
| | | // List<ClientBusinessObject> cbos = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), conditionMap); |
| | | // cboList.addAll(cbos); |
| | | // }); |
| | | List<BaseModel> cbos = selectByTypeAndOid(classifyFullInfo.getTopClassifyVO().getBtmtypeid(),oids); |
| | | // boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), conditionMap); |
| | | cboList.addAll(cbos); |
| | | }); |
| | | if (CollectionUtils.isEmpty(cboList)) { |
| | | throw new VciBaseException("数据全部在系统中不存在"); |
| | | } |
| | | List<CodeWupin> editCBOs = cboList.stream().filter(s -> !CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(s.getLcStatus())).collect(Collectors.toList()); |
| | | List<BaseModel> editCBOs = cboList.stream().filter(s -> !CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(s.getLcStatus())).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(editCBOs)) { |
| | | CodeWupin cbo = editCBOs.get(0); |
| | | BaseModel cbo = editCBOs.get(0); |
| | | throw new VciBaseException("编码为{0}等共{1}条数据的状态不是[{2}],不允许删除", new String[]{cbo.getId(), String.valueOf(editCBOs.size()), CodeDefaultLC.EDITING.getText()}); |
| | | } |
| | | |
| | | //只能删除自己创建的数据 |
| | | String userId = AuthUtil.getUser().getUserName(); |
| | | for (CodeWupin clientBusinessObject : cboList) { |
| | | String userId = String.valueOf(AuthUtil.getUser().getUserId()); |
| | | for (BaseModel clientBusinessObject : cboList) { |
| | | String creator = clientBusinessObject.getCreator(); |
| | | if (!userId.equalsIgnoreCase(creator)) { |
| | | throw new VciBaseException("编码为" + clientBusinessObject.getId() + "的数据不是当前用户创建,不能删除!"); |
| | |
| | | // WebUtil.setPersistence(false); |
| | | // batchCBO.copyFromOther( |
| | | productCodeService.recycleCode(classifyFullInfo.getCurrentClassifyVO().getBtmtypeid(), deleteBatchDTO.getOidList()); |
| | | baseMapper.deleteBatchIds(cboList); |
| | | // baseMapper.deleteBatchIds(cboList); |
| | | //使用传入的业务类型查询表 |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getCurrentClassifyVO().getBtmtypeid())); |
| | | if (listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | commonsMapper.deleteByTaleAndOid(listR.getData().get(0).getTableName(), |
| | | "'"+(StringUtils.join(cboList.stream().map(BaseModel::getOid).collect(Collectors.toSet()),"','"))+"'"); |
| | | // ); |
| | | // WebUtil.setPersistence(true); |
| | | // boService.persistenceBatch(batchCBO); |