| | |
| | | |
| | | //没有限制分类,但是一个模板只可能在一个业务类型里面,所以直接查询这个业务类型即可 |
| | | if (!CollectionUtils.isEmpty(conditionMap)) { |
| | | conditionMap.put("CODETEMPLATEOID","'" + orderDTO.getTemplateOid() + "'"); |
| | | // TODO: 同一个库判重不需要区分分类oid |
| | | // conditionMap.put("CODETEMPLATEOID","'" + orderDTO.getTemplateOid() + "'"); |
| | | // final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "}; |
| | | R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getTopClassifyVO().getBtmTypeId())); |
| | | // String referTable = VciBaseUtil.getTableName(referVO.getReferType()); |
| | | if (!listR.isSuccess() || listR.getData().size() == 0) { |
| | | throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); |
| | | } |
| | | final String[] sql = {"select count(*) from " + listR.getData().get(0).getTableName() + " t where 1 = 1 "}; |
| | | //final String[] sql = {"select count(*) from " + listR.getData().get(0).getTableName() + " t where 1 = 1 "}; |
| | | final String[] sql = {"select id from " + listR.getData().get(0).getTableName() + " t where 1 = 1 "}; |
| | | conditionMap.forEach((key, value) -> { |
| | | if(StringUtils.isBlank(value)||value.equals(QueryOptionConstant.ISNULL)) { |
| | | sql[0] += " and " + key + " is null"; |
| | |
| | | sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'"; |
| | | } |
| | | sql[0] += " and lastR = '1' and lastV = '1' "; |
| | | String isParticipateCheckOids = classifyService.selectLeafByParentClassifyOid(classifyFullInfo.getTopClassifyVO().getOid(), classifyFullInfo.getCurrentClassifyVO().getOid()); |
| | | if(Func.isNotEmpty(isParticipateCheckOids)){ |
| | | sql[0] += " and codeclsfid not in(" + isParticipateCheckOids + ")"; |
| | | } |
| | | // if (boService.queryCountBySql(sql[0], new HashMap<>()) > 0) { |
| | | if (Integer.parseInt(commonsMapper.selectById(sql[0]).get(0)) > 0) { |
| | | List<String> repeatData = commonsMapper.selectList(sql[0]); |
| | | if (!repeatData.isEmpty()) { |
| | | String ruleInfoMsg = keyRuleVO == null ? "" : "查询规则:去除空格--{0},忽略大小写--{1},忽略全半角--{2},忽略全部空格--{3}"; |
| | | String[] objs = new String[]{trim ? "是" : "否", ignoreCase ? "是" : "否", ignoreWidth ? "是" : "否", trimAll ? "是" : "否"}; |
| | | throw new VciBaseException("根据您填写的关键属性的内容,结合关键属性查询规则,发现这个数据已经在系统中存在了。请修正!。" + ruleInfoMsg, objs); |
| | | throw new VciBaseException("根据您填写的关键属性的内容,结合关键属性查询规则,发现该数据已经与系统中编号为"+repeatData.stream().collect(Collectors.joining(","))+"的数据重复。请修正!。" + ruleInfoMsg, objs); |
| | | } |
| | | } |
| | | } |
| | |
| | | // cbo.setLcStatus("Editing"); |
| | | //// 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()); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据模板属性生成相应的sql信息 |
| | | * |
| | |
| | | String sqlHasPage = pageHelper.getLimit() > 0 ? ("select * from (select A.*,rownum RN from (" + sql + whereSubfixForPage) : sql; |
| | | String sqlCount = "select count(1) from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE)) |
| | | + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql; |
| | | String sqlId = "select ID from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE)) |
| | | + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql; |
| | | CodeTemplateAttrSqlBO sqlBO = new CodeTemplateAttrSqlBO(); |
| | | sqlBO.setTableName(tableName); |
| | | sqlBO.setJoinTable(joinTableList); |
| | |
| | | sqlBO.setSqlHasPage(sqlHasPage); |
| | | sqlBO.setSqlCount(sqlCount); |
| | | sqlBO.setSqlUnPage(sql); |
| | | sqlBO.setSqlId(sqlId); |
| | | return sqlBO; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 组合查询条件的sql |
| | |
| | | for (int i = 0; i < threadSafeMaps.size(); i += MAX_IMPORT_NUM) { |
| | | final int startIndex = i; |
| | | final int endIndex = Math.min(i + MAX_IMPORT_NUM, threadSafeMaps.size()); |
| | | |
| | | executor.execute(() -> { |
| | | List<Map<String, String>> subList = threadSafeMaps.subList(startIndex, endIndex); |
| | | // 调用插入数据库的方法 |
| | | commonsMapper.insertByBaseModel(tableName, threadSafeMaps.get(0), subList); |
| | | }); |
| | | try { |
| | | executor.execute(() -> { |
| | | List<Map<String, String>> subList = threadSafeMaps.subList(startIndex, endIndex); |
| | | // 调用插入数据库的方法 |
| | | commonsMapper.insertByBaseModel(tableName, threadSafeMaps.get(0), subList); |
| | | }); |
| | | }catch (Throwable e){ |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | // 关闭线程池 |