Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java
@@ -396,6 +396,25 @@ */ Integer insertBatchByType(String btmType, List<BaseModel> baseModels); /** * 传入业务类型以及ID查询业务表数据是否重复 * * @param btmType 业务类型 * @param ids 处理数据 * @return 查询到数据的总数 */ Integer selectIdsCounts(String btmType, List<String> ids); /** * 传入业务类型以及ID、OID查询业务表数据是否重复 * * @param btmType 业务类型 * @param id 处理数据id * @param oid 处理数据oid * @return 查询到数据的总数 */ Integer selectIdAndOidCounts(String btmType, String id, String oid); /** * 传入业务类型以及相oid集合查询数据进行返回 * * @param btmType 业务类型 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
@@ -2363,8 +2363,14 @@ // cbo.getData().putAll(orderDTO.getData()); cbo.setLastModifyTime(new Date()); cbo.setLastModifier(String.valueOf(AuthUtil.getUser().getUserId())); updateBatchByBaseModel(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), Collections.singletonList(cbo)); batchSaveSelectChar(templateVO, Collections.singletonList(cbo)); if(selectIdAndOidCounts(classifyFullInfo.getTopClassifyVO().getBtmTypeId(),cbo.getId(),cbo.getOid())>0){ throw new ServiceException("修改的编码数据ID已有历史记录请确认!!"); } R r = updateBatchByBaseModel(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), Collections.singletonList(cbo)); if(!r.isSuccess()){ throw new ServiceException(r.getMsg()); } batchSaveSelectChar(templateVO, Collections.singletonList(cbo)); } /** @@ -3522,6 +3528,42 @@ }); return commonsMapper.insertByBaseModel(listR.getData().get(0).getTableName(), maps.get(0), maps); } /** * 传入业务类型以及ID查询业务表数据是否重复 * * @param btmType 业务类型 * @param ids 处理数据 * @return 查询到数据的总数 */ @Override public Integer selectIdsCounts(String btmType, List<String> ids) { //使用传入的业务类型查询表 R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType)); if (!listR.isSuccess() || listR.getData().size() == 0) { throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); } return commonsMapper.queryCountBySql("select count(*) from " + listR.getData().get(0).getTableName() + " where id in ("+ ids.stream().map(s -> "'" + s + "'").collect(Collectors.joining(",")) +")"); } /** * 传入业务类型以及ID、OID查询业务表数据是否重复 * * @param btmType 业务类型 * @param id 处理数据id * @param oid 处理数据oid * @return 查询到数据的总数 */ @Override public Integer selectIdAndOidCounts(String btmType, String id, String oid) { //使用传入的业务类型查询表 R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType)); if (!listR.isSuccess() || listR.getData().size() == 0) { throw new VciBaseException("传入业务类型未查询到相应表单,请检查!"); } return commonsMapper.queryCountBySql("select count(*) from " + listR.getData().get(0).getTableName() + " where id ='" + id + "' and oid <> '" + oid + "'"); } /** * 传入业务类型以及相oid集合查询数据进行返回 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java
@@ -30,6 +30,7 @@ import com.vci.ubcs.starter.web.util.VciBaseUtil; import com.vci.ubcs.starter.web.util.VciDateUtil; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -275,6 +276,9 @@ codeAllCodeService.saveBatch(addCodeDOs); } mdmEngineService.insertBatchByType(dataCBOList.get(0).getBtmname(),dataCBOList); if(mdmEngineService.selectIdsCounts(dataCBOList.get(0).getBtmname(),dataCBOList.stream().map(BaseModel::getId).collect(Collectors.toList()))>0){ throw new ServiceException("生成编码数据ID已有历史记录请确认!!"); } } return codeList; }else { @@ -351,7 +355,10 @@ Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CodeAllCode::getId))), ArrayList::new)); if( distinctCodeAllCOdes.size() != allCodeDOList.size() ){ throw new VciBaseException("编码数据重复,无法保存,请注意!"); throw new ServiceException("编码数据重复,无法保存,请注意!"); } if(mdmEngineService.selectIdsCounts(dataCBOList.get(0).getBtmname(),dataCBOList.stream().map(BaseModel::getId).collect(Collectors.toList()))>0){ throw new ServiceException("生成编码数据ID已有历史记录请确认!!"); } codeAllCodeService.saveBatch(allCodeDOList); // iCodeWupinService.saveBatch(dataCBOList);