From 7df1d61319149a666e8b2801a3c89c1d80900d2e Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期五, 07 四月 2023 17:57:46 +0800
Subject: [PATCH] 编码规则相关代码上传

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java |  866 ++++++++++++++-------------------------------------------
 1 files changed, 211 insertions(+), 655 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java
index 0a10361..90c590b 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java
@@ -1,686 +1,242 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 搴勯獮 (smallchill@163.com)
+ */
 package com.vci.ubcs.code.service.impl;
 
-import com.vci.ubcs.code.constant.MdmBtmTypeConstant;
-import com.vci.ubcs.code.mapper.CodeBasicSecMapper;
-import com.vci.ubcs.code.mapper.CodeRuleMapper;
-import com.vci.ubcs.code.lifecycle.CodeRuleLC;
-import com.vci.ubcs.code.entity.CodeAllCodeDO;
-import com.vci.ubcs.code.entity.CodeBasicSecDO;
-import com.vci.ubcs.code.entity.CodeClassifyDO;
-import com.vci.ubcs.code.entity.CodeRuleDO;
-import com.vci.ubcs.code.service.CodeBasicSecServiceI;
-import com.vci.ubcs.code.service.CodeClassifyServiceI;
-import com.vci.ubcs.code.service.CodeRuleServiceI;
-import com.vci.corba.common.VCIError;
-import com.vci.starter.revision.service.RevisionModelUtil;
-import com.vci.starter.web.exception.VciBaseException;
-import com.vci.starter.web.pagemodel.BaseResult;
-import com.vci.starter.web.pagemodel.DataGrid;
-import com.vci.starter.web.pagemodel.KeyValue;
-import com.vci.starter.web.pagemodel.PageHelper;
-import com.vci.starter.web.util.BeanUtilForVCI;
-import com.vci.starter.web.util.VciBaseUtil;
-import com.vci.starter.web.wrapper.VciQueryWrapperForDO;
-import com.vci.web.pageModel.BatchCBO;
-import com.vci.web.service.WebBoServiceI;
-import com.vci.web.util.WebUtil;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.vci.ubcs.code.dto.CodeBasicSecDTO;
+import com.alibaba.cloud.commons.lang.StringUtils;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.vci.ubcs.code.dto.CodeRuleDTO;
-import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
+import com.vci.ubcs.code.entity.CodeAllcode;
+import com.vci.ubcs.code.entity.CodeClassify;
+import com.vci.ubcs.code.entity.CodeRule;
+import com.vci.ubcs.code.lifecycle.CodeRuleLC;
+import com.vci.ubcs.code.mapper.CodeRuleMapper;
+import com.vci.ubcs.code.service.ICodeAllcodeService;
+import com.vci.ubcs.code.service.ICodeBasicSecService;
+import com.vci.ubcs.code.service.ICodeClassifyService;
+import com.vci.ubcs.code.service.ICodeRuleService;
 import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Lazy;
+import com.vci.ubcs.code.wrapper.CodeClassifyWrapper;
+import com.vci.ubcs.code.wrapper.CodeRuleWrapper;
+import com.vci.ubcs.com.vci.starter.exception.VciBaseException;
+import com.vci.ubcs.com.vci.starter.revision.service.RevisionModelUtil;
+import com.vci.ubcs.com.vci.starter.web.util.VciBaseUtil;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
-import plm.bs.bom.clientobject.ClientBusinessObject;
-import plm.bs.bom.clientobject.ClientBusinessObjectOperation;
 
 import javax.annotation.Resource;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
 
-import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.*;
+import static com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_EDITING;
+import static com.vci.ubcs.code.constant.FrameWorkLangCodeConstant.DATA_OID_NOT_EXIST;
+import static com.vci.ubcs.code.constant.MdmLifeCycleConstant.CODE_RULE_LC;
 
 /**
- * 涓绘暟鎹紪鐮佽鍒欐湇鍔�
+ * 缂栫爜瑙勫垯 鏈嶅姟瀹炵幇绫�
  *
- * @author weidy
- * @date 2022-01-24
+ * @author ludc
+ * @since 2023-04-03
  */
 @Service
-public class CodeRuleServiceImpl implements CodeRuleServiceI {
+public class CodeRuleServiceImpl extends ServiceImpl<CodeRuleMapper, CodeRule> implements ICodeRuleService {
 
-    /**
-     * 鏃ュ織
-     */
-    private Logger logger = LoggerFactory.getLogger(getClass());
+	/**
+	 * 鏁版嵁鎿嶄綔灞�
+	 */
+	@Resource
+	private CodeRuleMapper codeRuleMapper;
 
-    /**
-     * 鏁版嵁鎿嶄綔灞�
-     */
-    @Resource
-    private CodeRuleMapper codeRuleMapper;
+	@Resource
+	private ICodeClassifyService codeClassifyServcie;
 
-    /**
-     * 涓氬姟绫诲瀷鎿嶄綔鐨勬湇鍔�
-     */
-    @Autowired
-    @Lazy
-	private WebBoServiceI boService;
+	@Resource
+	private ICodeAllcodeService codeAllcodeService;
 
-    /**
-     * 瀵硅薄鐨勬搷浣�
-     */
-    @Autowired
-    private RevisionModelUtil revisionModelUtil;
+	@Resource
+	private ICodeBasicSecService codeBasicSecService;
 
-    /**
-     * 涓婚搴撳垎绫绘暟鎹搷浣滃眰
-     */
-    @Autowired
-    private CodeClassifyServiceI codeClassifyService;
+	/**
+	 * 瀵硅薄鐨勬搷浣�
+	 */
+	@Resource
+	private RevisionModelUtil revisionModelUtil;
 
-    /**
-     * 鐮佹鍩虹淇℃伅鏈嶅姟
-     */
-    @Autowired
-    private CodeBasicSecServiceI codeBasicSecService;
+	@Override
+	public IPage<CodeRuleVO> selectPlCodeRulePage(IPage<CodeRuleVO> page, CodeRuleVO codeRule) {
+		//瀵圭敓鍛藉懆鏈熺殑鏋氫妇杩涜杞崲
+		if(!StringUtils.isEmpty(codeRule.getLcStatusText())){
+			codeRule.setLcStatus(CodeRuleLC.getValueByText(codeRule.getLcStatusText()));
+		}
+		List<CodeRule> codeRulePage = codeRuleMapper.selectCodeRulePage(page, codeRule);
+		//do杞瑅o鍚屾椂setLcStatusText鐢熷懡鍛ㄦ湡鍊硷紝骞跺寘瑁呮垚鍒嗛〉瀵硅薄杩斿洖
+		return page.setRecords(CodeRuleWrapper.build().listVO(codeRulePage));
+	}
 
-    /**
-     * 鐮佹鍩虹淇℃伅鏁版嵁鎿嶄綔灞�
-     */
-    @Resource
-    private CodeBasicSecMapper codeBasicSecMapper;
+	/**
+	 * 澧炲姞涓绘暟鎹紪鐮佽鍒�
+	 *
+	 * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞�
+	 * @return 鎵ц缁撴灉
+	 * @throws VciBaseException 鍙傛暟涓虹┖锛屽敮涓�椤癸紝蹇呰緭椤逛笉閫氳繃鏃朵細鎶涘嚭寮傚父
+	 */
+	@Override
+	public Boolean addSave(CodeRuleDTO codeRuleDTO) throws VciBaseException{
+		VciBaseUtil.alertNotNull(codeRuleDTO, "闇�瑕佹坊鍔犵殑鏁版嵁瀵硅薄");
+		//灏咲TO杞崲涓篋O
+		CodeRule codeRule = Objects.requireNonNull(BeanUtil.copy(codeRuleDTO, CodeRule.class));
+		String userId = AuthUtil.getUserId().toString();
+		codeRule.setOid(VciBaseUtil.getPk());
+		codeRule.setRevisionOid(VciBaseUtil.getPk());
+		codeRule.setNameOid(VciBaseUtil.getPk());
+		codeRule.setBtmname("coderule");
+		codeRule.setLastR("1");
+		codeRule.setLastV("1");
+		codeRule.setFirstR("1");
+		codeRule.setFirstV("1");
+		codeRule.setCreator(userId);
+		codeRule.setCreateTime(new Date());
+		codeRule.setLastModifier("1");
+		codeRule.setLastModifyTime(new Date());
+		codeRule.setVersionRule("0");
+		codeRule.setVersionSeq(1);
+		codeRule.setLctid(CODE_RULE_LC);
+		codeRule.setLcStatus(FRAMEWORK_RELEASE_EDITING);
+		codeRule.setOwner("1");
+		codeRule.setCreator(userId);
+		codeRule.setLastModifier(userId);
+		return codeRuleMapper.insert(codeRule)>0;
+	}
 
+	/**
+	 * 鏍¢獙缂栫爜瑙勫垯鐨勭姸鎬佹槸鍚﹀彲浠ョ紪杈戞垨鍒犻櫎
+	 *
+	 * @param lcStatus 缂栫爜瑙勫垯
+	 * @return true琛ㄧず鍙互缂栬緫鎴栧垹闄わ紝false琛ㄧず涓嶅彲浠�
+	 */
+	@Override
+	public boolean checkEditDelStatus(String lcStatus) {
+		if (CodeRuleLC.RELEASED.getValue().equals(lcStatus) || CodeRuleLC.DISABLED.getValue().equals(lcStatus)) {
+			return false;
+		}
+		return true;
+	}
 
-    /**
-     * 鏌ヨ鎵�鏈夌殑涓绘暟鎹紪鐮佽鍒�
-     *
-     * @param conditionMap 鏌ヨ鏉′欢
-     * @param pageHelper   鍒嗛〉鍜屾帓搴�
-     * @return 鎵ц缁撴灉
-     * @throws VciBaseException 鏌ヨ鏉′欢鍜屽垎椤靛嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
-     */
-    @Override
-    public DataGrid<CodeRuleVO> gridCodeRule(Map<String, String> conditionMap, PageHelper pageHelper) throws VciBaseException {
-        if (pageHelper == null) {
-            pageHelper = new PageHelper(-1);
-        }
-        pageHelper.addDefaultDesc("createTime");
-        List<CodeRuleDO> doList = codeRuleMapper.selectByCondition(conditionMap, pageHelper);
-        DataGrid<CodeRuleVO> dataGrid = new DataGrid<CodeRuleVO>();
-        if (!CollectionUtils.isEmpty(doList)) {
-            dataGrid.setData(codeRuleDO2VOs(doList));
-            dataGrid.setTotal(VciBaseUtil.getInt(String.valueOf(codeRuleMapper.countByCondition(conditionMap))));
-        }
-        return dataGrid;
-    }
+	/**
+	 * 淇敼涓绘暟鎹紪鐮佽鍒�
+	 *
+	 * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞�
+	 * @return 鎵ц缁撴灉
+	 * @throws VciBaseException 鍙傛暟涓虹┖锛屽敮涓�椤癸紝蹇呰緭椤逛笉閫氳繃鏃朵細鎶涘嚭寮傚父
+	 */
+	@Override
+	public Boolean editSave(CodeRuleDTO codeRuleDTO) throws VciBaseException{
+		VciBaseUtil.alertNotNull(codeRuleDTO, "鏁版嵁瀵硅薄", codeRuleDTO.getOid(), "涓绘暟鎹紪鐮佽鍒欎富閿�");
+		if (!checkEditDelStatus(codeRuleDTO.getLcStatus())) {
+			throw new VciBaseException("缂栫爜瑙勫垯宸插彂甯冿紝涓嶅厑璁哥紪杈戞垨鍒犻櫎");
+		}
+		//灏咲TO杞崲涓篋O
+		CodeRule codeRule = selectByOid(codeRuleDTO.getOid());
+		revisionModelUtil.copyFromDTOIgnore(codeRuleDTO, codeRule);
+		return codeRuleMapper.updateById(codeRule)>0;
+	}
 
-    /**
-     * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
-     *
-     * @param codeRuleDOs 鏁版嵁瀵硅薄鍒楄〃
-     * @return 鏄剧ず瀵硅薄
-     * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
-     */
-    @Override
-    public List<CodeRuleVO> codeRuleDO2VOs(Collection<CodeRuleDO> codeRuleDOs) throws VciBaseException {
-        return codeRuleDO2VOs(codeRuleDOs, false);
-    }
+	/**
+	 * 鍒犻櫎涓绘暟鎹紪鐮佽鍒�
+	 *
+	 * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈�
+	 * @return 鍒犻櫎缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐�
+	 * @throws VciBaseException 鍙傛暟涓虹┖锛岃寮曠敤鏃舵姏鍑哄紓甯�
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R deleteCodeRule(CodeRuleDTO codeRuleDTO) throws VciBaseException {
+		VciBaseUtil.alertNotNull(codeRuleDTO, "涓绘暟鎹紪鐮佽鍒欐暟鎹璞�", codeRuleDTO.getOid(), "涓绘暟鎹紪鐮佽鍒欑殑涓婚敭");
+		CodeRule codeRule = selectByOid(codeRuleDTO.getOid());
+		if (!checkEditDelStatus(codeRule.getLcStatus())) {
+			return R.fail("缂栫爜瑙勫垯宸插彂甯冿紝涓嶅厑璁哥紪杈戞垨鍒犻櫎");
+		} else {
+			if (isAlreadyInUse(codeRule.getOid())) {
+				return R.fail("缂栫爜瑙勫垯宸茶寮曠敤锛屼笉鍏佽缂栬緫鎴栧垹闄わ紒");
+			}
+		}
 
-    /**
-     * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
-     *
-     * @param codeRuleDOs 鏁版嵁瀵硅薄鍒楄〃
-     * @param hasSec      鏄惁鍖呭惈鐮佹
-     * @return 鏄剧ず瀵硅薄
-     * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
-     */
-    @Override
-    public List<CodeRuleVO> codeRuleDO2VOs(Collection<CodeRuleDO> codeRuleDOs, boolean hasSec) throws VciBaseException {
-        List<CodeRuleVO> voList = new ArrayList<CodeRuleVO>();
-        if (!CollectionUtils.isEmpty(codeRuleDOs)) {
-            for (CodeRuleDO s : codeRuleDOs) {
-                CodeRuleVO vo = codeRuleDO2VO(s);
-                if (vo != null) {
-                    voList.add(vo);
-                }
-            }
-            if (hasSec) {
-                List<CodeBasicSecVO> secVOList = codeBasicSecService.listCodeBasicSecByRuleOids(voList.stream().map(CodeRuleVO::getOid).collect(Collectors.toList()));
-                if (!CollectionUtils.isEmpty(secVOList)) {
-                    Map<String, List<CodeBasicSecVO>> secVOMap = secVOList.stream().collect(Collectors.groupingBy(CodeBasicSecVO::getPkCodeRule));
-                    voList.stream().forEach(vo -> {
-                        vo.setSecVOList(secVOMap.getOrDefault(vo.getOid(), new ArrayList<>()));
-                    });
-                }
-            }
-        }
-        return voList;
-    }
+		List<CodeAllcode> codeDOList = codeAllcodeService.selectByWrapper(Wrappers.<CodeAllcode>query().eq("codeRuleOid", codeRuleDTO.getOid()));
+		if (!CollectionUtils.isEmpty(codeDOList)) {
+			return R.fail("缂栫爜瑙勫垯宸茬敓鎴愮紪鐮侊紝涓嶅厑璁稿垹闄�");
+		}
+		//鎵ц鍒犻櫎鎿嶄綔
+		//WebUtil.setPersistence(false);
+		boolean resBoolean = codeBasicSecService.batchDeleteSecByCodeRuleOid(codeRule.getOid());
+		resBoolean = codeRuleMapper.deleteById(codeRule.getOid())>0;
+		//WebUtil.setPersistence(true);
+		return R.status(resBoolean);
+	}
 
-    /**
-     * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
-     *
-     * @param codeRuleDO 鏁版嵁瀵硅薄
-     * @return 鏄剧ず瀵硅薄
-     * @throws VciBaseException 鎷疯礉灞炴�у嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
-     */
-    @Override
-    public CodeRuleVO codeRuleDO2VO(CodeRuleDO codeRuleDO) throws VciBaseException {
-        CodeRuleVO vo = new CodeRuleVO();
-        if (codeRuleDO != null) {
-            BeanUtilForVCI.copyPropertiesIgnoreCase(codeRuleDO, vo);
-            //濡傛灉鏈塴cstatus鐨勭被鐨勮瘽
-            vo.setLcStatusText(CodeRuleLC.getTextByValue(vo.getLcStatus()));
+	/**
+	 * 涓婚敭鏌ヨ鏁版嵁瀵硅薄
+	 *
+	 * @param oid 涓婚敭
+	 * @return 鏁版嵁瀵硅薄
+	 * @throws VciBaseException 鍙傛暟涓虹┖锛屽苟涓旀暟鎹笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
+	 */
+	private CodeRule selectByOid(String oid) throws VciBaseException {
+		VciBaseUtil.alertNotNull(oid, "涓婚敭");
+		CodeRule codeRuleDO = codeRuleMapper.selectById(oid.trim());
+		if (codeRuleDO == null || StringUtils.isBlank(codeRuleDO.getOid())) {
+			throw new VciBaseException(DATA_OID_NOT_EXIST);
+		}
+		return codeRuleDO;
+	}
 
-        }
-        return vo;
-    }
+	/**
+	 * 妫�楠岀紪鐮佽鍒欐槸鍚﹀凡缁忚浣跨敤
+	 *
+	 * @param oid 缂栫爜瑙勫垯涓婚敭
+	 * @return true琛ㄧず宸茬粡浣跨敤锛宖alse琛ㄧず鏈浣跨敤
+	 */
+	@Override
+	public boolean isAlreadyInUse(String oid) {
+		Collection<CodeClassifyVO> codeClassifyVOS = listUseRangeInCodeClassify(oid);
+		if (codeClassifyVOS.size() > 0) {
+			return true;
+		} else {
+			return false;
+		}
+	}
 
-    /**
-     * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
-     *
-     * @param codeRuleDO 瑙勫垯鐨勬暟鎹璞�
-     * @param hasSec     鏄惁鏌ヨ鐮佹
-     * @return 鏄剧ず瀵硅薄
-     * @throws VciBaseException 鎷疯礉灞炴�у嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
-     */
-    public CodeRuleVO codeRuleDO2VO(CodeRuleDO codeRuleDO, boolean hasSec) throws VciBaseException {
-        CodeRuleVO vo = new CodeRuleVO();
-        if (codeRuleDO != null) {
-            BeanUtilForVCI.copyPropertiesIgnoreCase(codeRuleDO, vo);
-            //濡傛灉鏈塴cstatus鐨勭被鐨勮瘽
-            vo.setLcStatusText(CodeRuleLC.getTextByValue(vo.getLcStatus()));
-            if (hasSec) {
-                //鏌ヨ鐮佹
-                vo.setSecVOList(codeBasicSecService.listCodeBasicSecByRuleOid(vo.getOid()));
-            }
-        }
-        return vo;
-    }
+	/**
+	 * 鏌ョ湅涓绘暟鎹紪鐮佽鍒欑殑浣跨敤鑼冨洿
+	 *
+	 * @param oid 缂栫爜瑙勫垯涓婚敭
+	 * @return 涓婚搴撳垎绫讳娇鐢ㄥ埌璇ョ紪鐮佽鍒欑殑鎵�鏈夐泦鍚�
+	 */
+	@Override
+	public Collection<CodeClassifyVO> listUseRangeInCodeClassify(String oid) {
+		List<CodeClassify> codeClassifies = codeClassifyServcie.selectByWrapper(Wrappers.<CodeClassify>query().eq("codeRuleOid", oid));
+		return CodeClassifyWrapper.build().listVO(codeClassifies);
+	}
 
-    /**
-     * 澧炲姞涓绘暟鎹紪鐮佽鍒�
-     *
-     * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞�
-     * @return 鎵ц缁撴灉
-     * @throws VciBaseException 鍙傛暟涓虹┖锛屽敮涓�椤癸紝蹇呰緭椤逛笉閫氳繃鏃朵細鎶涘嚭寮傚父
-     */
-    @Override
-    public CodeRuleVO addSave(CodeRuleDTO codeRuleDTO) throws VciBaseException {
-        VciBaseUtil.alertNotNull(codeRuleDTO, "闇�瑕佹坊鍔犵殑鏁版嵁瀵硅薄");
-        //灏咲TO杞崲涓篋O
-        CodeRuleDO codeRuleDO = new CodeRuleDO();
-        BeanUtilForVCI.copyPropertiesIgnoreCase(codeRuleDTO, codeRuleDO);
-        codeRuleMapper.insert(codeRuleDO);
-        return codeRuleDO2VO(codeRuleDO);
-    }
-
-    /**
-     * 淇敼涓绘暟鎹紪鐮佽鍒�
-     *
-     * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞�
-     * @return 鎵ц缁撴灉
-     * @throws VciBaseException 鍙傛暟涓虹┖锛屽敮涓�椤癸紝蹇呰緭椤逛笉閫氳繃鏃朵細鎶涘嚭寮傚父
-     */
-    @Override
-    public CodeRuleVO editSave(CodeRuleDTO codeRuleDTO) throws VciBaseException {
-        VciBaseUtil.alertNotNull(codeRuleDTO, "鏁版嵁瀵硅薄", codeRuleDTO.getOid(), "涓绘暟鎹紪鐮佽鍒欎富閿�");
-        if (!checkEditDelStatus(codeRuleDTO.getLcStatus())) {
-            throw new VciBaseException("缂栫爜瑙勫垯宸插彂甯冿紝涓嶅厑璁哥紪杈戞垨鍒犻櫎");
-        }
-        //灏咲TO杞崲涓篋O
-        CodeRuleDO codeRuleDO = selectByOid(codeRuleDTO.getOid());
-        revisionModelUtil.copyFromDTOIgnore(codeRuleDTO, codeRuleDO);
-        codeRuleMapper.updateByPrimaryKey(codeRuleDO);
-        return codeRuleDO2VO(codeRuleDO);
-    }
-
-
-    /**
-     * 鏍¢獙鏄惁鍙互鍒犻櫎锛屽鏋滃瓨鍦ㄤ笅绾э紝骞朵笖涓嬬骇鏈夋暟鎹紩鐢ㄥ垯涓嶈兘鍒犻櫎
-     *
-     * @param codeRuleDTO 鏁版嵁浼犺緭瀵硅薄
-     * @param codeRuleDO  鏁版嵁搴撲腑鐨勬暟鎹璞�
-     * @return success涓簍rue涓哄彲浠ュ垹闄わ紝false琛ㄧず鏈夋暟鎹紩鐢紝obj涓簍rue琛ㄧず鏈変笅绾�
-     */
-    private BaseResult checkIsCanDeleteForDO(CodeRuleDTO codeRuleDTO, CodeRuleDO codeRuleDO) {
-        boService.checkTs(codeRuleDTO);
-        if (!checkIsLinked(codeRuleDO.getOid())) {
-            return BaseResult.success();
-        } else {
-            return BaseResult.fail(DATA_LINKED_NOT_DELETE, new String[]{""});
-        }
-    }
-
-    /**
-     * 鏍¢獙鏄惁琚紩鐢�
-     *
-     * @param oid 涓婚敭
-     * @throws VciBaseException 琚紩鐢ㄧ殑鏃跺�欎細鎶涘嚭寮傚父
-     */
-    private boolean checkIsLinked(String oid) throws VciBaseException {
-        //TODO 娣诲姞闇�瑕佹牎楠屽紩鐢ㄧ殑鍦版柟
-        return false;
-    }
-
-    /**
-     * 鍒犻櫎涓绘暟鎹紪鐮佽鍒�
-     *
-     * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈�
-     * @return 鍒犻櫎缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐�
-     * @throws VciBaseException 鍙傛暟涓虹┖锛岃寮曠敤鏃舵姏鍑哄紓甯�
-     */
-    @Override
-    public BaseResult deleteCodeRule(CodeRuleDTO codeRuleDTO) throws VciBaseException {
-        VciBaseUtil.alertNotNull(codeRuleDTO, "涓绘暟鎹紪鐮佽鍒欐暟鎹璞�", codeRuleDTO.getOid(), "涓绘暟鎹紪鐮佽鍒欑殑涓婚敭");
-        CodeRuleDO codeRuleDO = selectByOid(codeRuleDTO.getOid());
-        //BaseResult baseResult = checkIsCanDeleteForDO(codeRuleDTO,codeRuleDO);
-        // if(baseResult.isSuccess()) {
-        //             }else{
-        //     return baseResult;
-        // }
-        if (!checkEditDelStatus(codeRuleDO.getLcStatus())) {
-            return BaseResult.fail("缂栫爜瑙勫垯宸插彂甯冿紝涓嶅厑璁哥紪杈戞垨鍒犻櫎");
-        } else {
-            if (isAlreadyInUse(codeRuleDO.getOid())) {
-                return BaseResult.fail("缂栫爜瑙勫垯宸茶寮曠敤锛屼笉鍏佽缂栬緫鎴栧垹闄わ紒");
-            }
-        }
-        Map<String, String> conditionMap = new HashMap<>();
-        conditionMap.put("codeRuleOid", codeRuleDTO.getOid());
-        List<CodeAllCodeDO> codeDOList = boService.queryObject(CodeAllCodeDO.class, conditionMap);
-        if (!CollectionUtils.isEmpty(codeDOList)) {
-            return BaseResult.fail("缂栫爜瑙勫垯宸茬敓鎴愮紪鐮侊紝涓嶅厑璁稿垹闄�");
-        }
-        //鎵ц鍒犻櫎鎿嶄綔
-        WebUtil.setPersistence(false);
-        BatchCBO batchCBO = codeBasicSecService.batchDeleteSecByCodeRuleOid(codeRuleDO.getOid());
-        BatchCBO mainCBO = codeRuleMapper.deleteByPrimaryKey(codeRuleDO.getOid());
-        WebUtil.setPersistence(true);
-        Set<ClientBusinessObject> deleteSet = new HashSet<>();
-        deleteSet.addAll(batchCBO.getDeleteCbos());
-        deleteSet.addAll(mainCBO.getDeleteCbos());
-        batchCBO.setDeleteCbos(deleteSet);
-        boService.persistenceBatch(batchCBO);
-        return (batchCBO != null && batchCBO.getDeleteCbos() != null && batchCBO.getDeleteCbos().size() > 0) ? BaseResult.successMsg(DELETE_SUCCESS) : BaseResult.fail(DELETE_FAIL);
-    }
-
-    /**
-     * 鏍¢獙缂栫爜瑙勫垯鐨勭姸鎬佹槸鍚﹀彲浠ョ紪杈戞垨鍒犻櫎
-     *
-     * @param lcStatus 缂栫爜瑙勫垯
-     * @return true琛ㄧず鍙互缂栬緫鎴栧垹闄わ紝false琛ㄧず涓嶅彲浠�
-     */
-    @Override
-    public boolean checkEditDelStatus(String lcStatus) {
-        if (CodeRuleLC.RELEASED.getValue().equals(lcStatus) || CodeRuleLC.DISABLED.getValue().equals(lcStatus)) {
-            return false;
-        }
-        return true;
-    }
-
-
-    /**
-     * 涓婚敭鑾峰彇涓绘暟鎹紪鐮佽鍒�
-     *
-     * @param oid 涓婚敭
-     * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞�
-     * @throws VciBaseException 鍙傛暟涓虹┖锛屾暟鎹笉瀛樺湪鏃朵細鎶涘嚭寮傚父
-     */
-    @Override
-    public CodeRuleVO getObjectByOid(String oid) throws VciBaseException {
-        return codeRuleDO2VO(selectByOid(oid));
-    }
-
-    /**
-     * 涓婚敭鏌ヨ鏁版嵁瀵硅薄
-     *
-     * @param oid 涓婚敭
-     * @return 鏁版嵁瀵硅薄
-     * @throws VciBaseException 鍙傛暟涓虹┖锛屽苟涓旀暟鎹笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
-     */
-    private CodeRuleDO selectByOid(String oid) throws VciBaseException {
-        VciBaseUtil.alertNotNull(oid, "涓婚敭");
-        CodeRuleDO codeRuleDO = codeRuleMapper.selectByPrimaryKey(oid.trim());
-        if (codeRuleDO == null || StringUtils.isBlank(codeRuleDO.getOid())) {
-            throw new VciBaseException(DATA_OID_NOT_EXIST);
-        }
-        return codeRuleDO;
-    }
-
-    /**
-     * 涓婚敭鎵归噺鑾峰彇涓绘暟鎹紪鐮佽鍒�
-     *
-     * @param oidCollections 涓婚敭闆嗗悎锛屼絾鏄彈鎬ц兘褰卞搷锛屽缓璁竴娆℃煡璇笉瓒呰繃10000涓�
-     * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞�
-     * @throws VciBaseException 鏌ヨ鍑虹幇寮傚父鏃朵細鎶涘嚭
-     */
-    @Override
-    public Collection<CodeRuleVO> listCodeRuleByOids(Collection<String> oidCollections) throws VciBaseException {
-        VciBaseUtil.alertNotNull(oidCollections, "鏁版嵁瀵硅薄涓婚敭闆嗗悎");
-        List<CodeRuleDO> codeRuleDOList = listCodeRuleDOByOidCollections(oidCollections);
-        return codeRuleDO2VOs(codeRuleDOList);
-    }
-
-    /**
-     * 涓婚敭鎵归噺鑾峰彇涓绘暟鎹紪鐮佽鍒�
-     *
-     * @param oidCollections 涓婚敭闆嗗悎锛屼絾鏄彈鎬ц兘褰卞搷锛屽缓璁竴娆℃煡璇笉瓒呰繃10000涓�
-     * @param hasSec         鏄惁鍖呭惈鐮佹
-     * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞�
-     * @throws VciBaseException 鏌ヨ鍑虹幇寮傚父鏃朵細鎶涘嚭
-     */
-    @Override
-    public Collection<CodeRuleVO> listCodeRuleByOids(Collection<String> oidCollections, boolean hasSec) throws VciBaseException {
-        VciBaseUtil.alertNotNull(oidCollections, "鏁版嵁瀵硅薄涓婚敭闆嗗悎");
-        List<CodeRuleDO> codeRuleDOList = listCodeRuleDOByOidCollections(oidCollections);
-        return codeRuleDO2VOs(codeRuleDOList, true);
-    }
-
-    /**
-     * 浣跨敤缂栧彿鐨勯泦鍚堣幏鍙栬鍒欑殑鍐呭
-     *
-     * @param idCollection 缂栧彿鐨勯泦鍚�
-     * @return 瑙勫垯鐨勫唴瀹�
-     */
-    @Override
-    public List<CodeRuleVO> listCodeRuleByIds(Collection<String> idCollection) {
-        return codeRuleDO2VOs(listCodeRuleDOByIdCollections(idCollection));
-    }
-
-    /**
-     * 浣跨敤涓婚敭闆嗗悎鏌ヨ鏁版嵁瀵硅薄
-     *
-     * @param oidCollections 涓婚敭鐨勯泦鍚�
-     * @return 鏁版嵁瀵硅薄鍒楄〃
-     */
-    private List<CodeRuleDO> listCodeRuleDOByOidCollections(Collection<String> oidCollections) {
-        List<CodeRuleDO> codeRuleDOList = new ArrayList<CodeRuleDO>();
-        if (!CollectionUtils.isEmpty(oidCollections)) {
-            Collection<Collection<String>> oidCollectionsList = VciBaseUtil.switchCollectionForOracleIn(oidCollections);
-            for (Collection<String> oids : oidCollectionsList) {
-                List<CodeRuleDO> tempDOList = codeRuleMapper.selectByPrimaryKeyCollection(oids);
-                if (!CollectionUtils.isEmpty(tempDOList)) {
-                    codeRuleDOList.addAll(tempDOList);
-                }
-            }
-        }
-        return codeRuleDOList;
-    }
-
-    /**
-     * 浣跨敤缂栧彿闆嗗悎鏌ヨ鏁版嵁瀵硅薄
-     *
-     * @param idCollections 缂栧彿鐨勯泦鍚�
-     * @return 鏁版嵁瀵硅薄鍒楄〃
-     */
-    private List<CodeRuleDO> listCodeRuleDOByIdCollections(Collection<String> idCollections) {
-        List<CodeRuleDO> codeRuleDOList = new ArrayList<CodeRuleDO>();
-        if (!CollectionUtils.isEmpty(idCollections)) {
-            Collection<Collection<String>> idCollectionsList = VciBaseUtil.switchCollectionForOracleIn(idCollections);
-            for (Collection<String> ids : idCollectionsList) {
-                List<CodeRuleDO> tempDOList = codeRuleMapper.selectByIdCollection(ids);
-                if (!CollectionUtils.isEmpty(tempDOList)) {
-                    codeRuleDOList.addAll(tempDOList);
-                }
-            }
-        }
-        return codeRuleDOList;
-    }
-
-
-    /**
-     * 鍙傜収涓绘暟鎹紪鐮佽鍒欏垪琛�
-     *
-     * @param conditionMap 鏌ヨ鏉′欢
-     * @param pageHelper   鍒嗛〉鍜屾帓搴�
-     * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞″垪琛紝鐢熸晥鐨勫唴瀹�
-     * @throws VciBaseException 鏌ヨ鏉′欢鍜屽垎椤靛嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
-     */
-    @Override
-    public DataGrid<CodeRuleVO> refDataGridCodeRule(Map<String, String> conditionMap, PageHelper pageHelper) throws VciBaseException {
-        if (conditionMap == null) {
-            conditionMap = new HashMap<String, String>();
-        }
-        return gridCodeRule(conditionMap, pageHelper);
-    }
-
-    /**
-     * 鏌ョ湅涓绘暟鎹紪鐮佽鍒欑殑浣跨敤鑼冨洿
-     *
-     * @param oid 缂栫爜瑙勫垯涓婚敭
-     * @return 涓婚搴撳垎绫讳娇鐢ㄥ埌璇ョ紪鐮佽鍒欑殑鎵�鏈夐泦鍚�
-     */
-    @Override
-    public Collection<CodeClassifyVO> listUseRangeInCodeClassify(String oid) {
-        Map<String, String> conditionMap = new HashMap<>();
-        conditionMap.put("codeRuleOid", oid);
-        VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(conditionMap, CodeClassifyDO.class);
-        List<CodeClassifyDO> dos = codeClassifyService.selectByWrapper(queryWrapper);
-        return codeClassifyService.codeClassifyDO2VOs(dos);
-    }
-
-    /**
-     * 妫�楠岀紪鐮佽鍒欐槸鍚﹀凡缁忚浣跨敤
-     *
-     * @param oid 缂栫爜瑙勫垯涓婚敭
-     * @return true琛ㄧず宸茬粡浣跨敤锛宖alse琛ㄧず鏈浣跨敤
-     */
-    @Override
-    public boolean isAlreadyInUse(String oid) {
-        Collection<CodeClassifyVO> codeClassifyVOS = listUseRangeInCodeClassify(oid);
-        if (codeClassifyVOS.size() > 0) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * 鍋滅敤涓庡惎鐢ㄧ紪鐮佽鍒�
-     *
-     * @param oid    缂栫爜瑙勫垯涓婚敭
-     * @param update enable:鍚敤 disable:鍋滅敤 release:鍙戝竷
-     * @return 鎵ц缁撴灉
-     */
-    @Override
-    public BaseResult updateStatus(String oid, String update) {
-        int count = 0;
-        CodeRuleDO codeRuleDO = selectByOid(oid);
-        if ("enable".equalsIgnoreCase(update)) {
-            if (!CodeRuleLC.DISABLED.getValue().equals(codeRuleDO.getLcStatus())) {
-                return BaseResult.fail("闈炲仠鐢ㄧ姸鎬佺殑缂栫爜瑙勫垯鏃犻渶鐐瑰嚮鍚敤");
-            }
-            count = codeRuleMapper.updateLcStatus(oid, CodeRuleLC.RELEASED.getValue());
-        } else if ("disable".equalsIgnoreCase(update)) {
-            if (!CodeRuleLC.RELEASED.getValue().equals(codeRuleDO.getLcStatus())) {
-                return BaseResult.fail("闈炲彂甯冪姸鎬佺殑缂栫爜瑙勫垯鏃犳硶鍋滅敤");
-            }
-            count = codeRuleMapper.updateLcStatus(oid, CodeRuleLC.DISABLED.getValue());
-        } else if ("release".equalsIgnoreCase(update)) {
-            if (!CodeRuleLC.EDITING.getValue().equals(codeRuleDO.getLcStatus())) {
-                return BaseResult.fail("闈炵紪杈戠姸鎬佺殑缂栫爜瑙勫垯鏃犳硶鍙戝竷");
-            }
-            count = codeRuleMapper.updateLcStatus(oid, CodeRuleLC.RELEASED.getValue());
-        } else {
-            return BaseResult.fail("鏆備笉鏀寔鐨勬搷浣滅被鍨�");
-        }
-        if (count > 0) {
-            return BaseResult.success();
-        } else {
-            return BaseResult.fail("鏇存柊鐘舵�佸け璐�");
-        }
-    }
-
-    /**
-     * 鍏嬮殕缂栫爜瑙勫垯
-     *
-     * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈�
-     * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞�
-     */
-    public BaseResult cloneCodeRule_v1(CodeRuleDTO codeRuleDTO) {
-        VciBaseUtil.alertNotNull(codeRuleDTO.getOid(), "缂栫爜瑙勫垯涓婚敭");
-        ClientBusinessObjectOperation operation = new ClientBusinessObjectOperation();
-        Map<String, String> conditionMap = new HashMap<>();
-        conditionMap.put("pkCodeRule", codeRuleDTO.getOid());
-        List<CodeBasicSecDO> basicSecDOS = boService.queryObject(CodeBasicSecDO.class, conditionMap);
-        List<String> secOidList = new ArrayList<>();
-        for (CodeBasicSecDO secDO : basicSecDOS) {
-            secOidList.add(secDO.getOid());
-        }
-        List<ClientBusinessObject> cboList = new ArrayList<>();
-        try {
-            ClientBusinessObject templateCbo = operation.readBusinessObjectById(codeRuleDTO.getOid(), MdmBtmTypeConstant.CODE_RULE);
-            ClientBusinessObject codeRuleCbo = operation.initBusinessObject(templateCbo.getBtmName());
-            String curOid = codeRuleCbo.getOid();
-            String curRevisionId = codeRuleCbo.getRevisionid();
-            String curNameOid = codeRuleCbo.getNameoid();
-            BeanUtilForVCI.copyPropertiesIgnoreCase(templateCbo, codeRuleCbo);
-            codeRuleCbo.setOid(curOid);
-            codeRuleCbo.setRevisionid(curRevisionId);
-            codeRuleCbo.setNameoid(curNameOid);
-            codeRuleCbo.setId(templateCbo.getId() + "_copy");
-            codeRuleCbo.setName(templateCbo.getName() + "_copy");
-            if (!CollectionUtils.isEmpty(secOidList)) {
-                ClientBusinessObject[] secCboArr = operation.readBusinessObjectById(secOidList.toArray(new String[0]), MdmBtmTypeConstant.CODE_BASIC_SEC);
-                for (ClientBusinessObject cbo : secCboArr) {
-                    ClientBusinessObject newSecCbo = operation.initBusinessObject(cbo.getBtmName());
-                    String newSecCboOid = newSecCbo.getOid();
-                    String newSecCboRevisionId = newSecCbo.getRevisionid();
-                    String newSecCboNameOid = newSecCbo.getNameoid();
-                    BeanUtilForVCI.copyPropertiesIgnoreCase(cbo, newSecCbo);
-                    newSecCbo.setOid(newSecCboOid);
-                    newSecCbo.setRevisionid(newSecCboRevisionId);
-                    newSecCbo.setNameoid(newSecCboNameOid);
-                    newSecCbo.setId(newSecCbo.getId() + "_copy");
-                    newSecCbo.setName(newSecCbo.getName() + "_copy");
-                    newSecCbo.setAttributeValue("pkCodeRule", codeRuleCbo.getOid());
-                    cboList.add(newSecCbo);
-                }
-            }
-            cboList.add(codeRuleCbo);
-            ClientBusinessObject[] saveList = operation.batchSaveCreateBuinessObject(cboList.toArray(new ClientBusinessObject[0]));
-            if (saveList.length == 0) {
-                return BaseResult.fail("鍏嬮殕鍑洪敊浜嗏�︹��");
-            }
-        } catch (VCIError vciError) {
-            vciError.printStackTrace();
-        }
-        return BaseResult.success();
-    }
-
-    /**
-     * 鍏嬮殕缂栫爜瑙勫垯
-     *
-     * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈�
-     * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞�
-     */
-    @Override
-    public BaseResult cloneCodeRule(CodeRuleDTO codeRuleDTO) {
-        VciBaseUtil.alertNotNull(codeRuleDTO, "闇�瑕佹坊鍔犵殑鏁版嵁瀵硅薄");
-        CodeRuleDO codeRuleDO = new CodeRuleDO();
-        BeanUtilForVCI.copyPropertiesIgnoreCase(codeRuleDTO, codeRuleDO);
-        WebUtil.setPersistence(false);
-        BatchCBO batchInsertCBO = codeRuleMapper.insert(codeRuleDO);
-        List<CodeBasicSecDTO> secList = codeRuleDTO.getElements();
-        secList.forEach(codeBasicSecDTO -> {
-            codeBasicSecDTO.setPkCodeRule(codeRuleDO.getOid());
-            KeyValue attrKv = codeBasicSecService.checkAttrNullableBySecType(codeBasicSecDTO);
-            if (!"success".equals(attrKv.getKey())) {
-                throw new VciBaseException(attrKv.getValue() + "涓嶈兘涓虹┖");
-            }
-            CodeBasicSecDO codeBasicSecDO = new CodeBasicSecDO();
-            BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecDTO, codeBasicSecDO);
-            codeBasicSecDO.setOid("");
-            codeBasicSecDO.setRevisionOid("");
-            codeBasicSecDO.setNameOid("");
-			//codeBasicSecMapper涓殑璇彞鍏ㄩ儴杩佺Щ鍒拌繖閲�
-			VciBaseUtil.alertNotNull(codeBasicSecDO,"瑕佹坊鍔犵殑鏁版嵁");
-			BatchCBO cbo = boService.addSave(codeBasicSecDO);
-			batchInsertCBO.addCreateCbo(cbo.getCreateCboArray()[0]);
-        });
-        boService.persistenceBatch(batchInsertCBO);
-        return BaseResult.success();
-    }
-
-    /**
-     * 浣跨敤涓婚敭鑾峰彇缂栫爜瑙勫垯鐨勫唴瀹�
-     *
-     * @param oid 涓婚敭
-     * @return 瑙勫垯鐨勬樉绀哄璞�
-     */
-    @Override
-    public CodeRuleVO getObjectHasSecByOid(String oid) {
-        CodeRuleDO ruleDO = selectByOid(oid);
-        return codeRuleDO2VO(ruleDO, true);
-    }
-
-    /**
-     * 缂栫爜瑙勫垯娓呯┖鎵�鏈夊凡鐢熸垚鐨勭紪鐮�
-     *
-     * @param oid 缂栫爜瑙勫垯涓婚敭
-     * @return 鎵ц缁撴灉
-     */
-    @Override
-    public BaseResult clearAllCode(String oid) {
-        WebUtil.alertNotNull(oid, "缂栫爜瑙勫垯涓婚敭");
-        Map<String, String> conditionMap = new HashMap<>();
-        conditionMap.put("codeRuleOid", oid);
-        List<CodeAllCodeDO> codeDOList = boService.queryObject(CodeAllCodeDO.class, conditionMap);
-        if (CollectionUtils.isEmpty(codeDOList)) {
-            return BaseResult.fail("褰撳墠缂栫爜瑙勫垯娌℃湁鐢熸垚缂栫爜,鏃犻渶娓呯┖");
-        }
-        //鏄惁闇�瑕佽繘琛宐tm涓嶇粺涓�鐨勫垽鏂�?
-        String btmType = codeDOList.get(0).getCreateCodeBtm();
-        /*boolean flag = codeDOList.stream().anyMatch(s -> !StringUtils.equalsIgnoreCase(btmType, s.getCreateCodeBtm()));
-        if (flag) {
-            return BaseResult.fail("褰撳墠缂栫爜瑙勫垯鐢熸垚缂栫爜鍦ㄤ笉鍚岀被鍨嬩笅浣跨敤杩�");
-        }*/
-        //澶氱绫诲瀷涓嬬殑鏌ヨ
-        Set<String> btmTypeSet = codeDOList.stream().filter(s -> {
-            return !StringUtils.equalsIgnoreCase(btmType, s.getCreateCodeBtm());
-        }).map(s -> s.getCreateCodeBtm()).collect(Collectors.toSet());
-        List<ClientBusinessObject> businessDataList = new ArrayList<>();
-        if (btmTypeSet.size() > 1) {
-            for (String btm : btmTypeSet) {
-                String sql = "select COUNT(w.OID) from PLATFORMBTM_" + btm + "  w\n" +
-                        "join PLATFORMBTM_" + MdmBtmTypeConstant.CODE_ALL_CODE + " c on w.OID = c.CREATECODEOID\n" +
-                        "where c.CREATECODEBTM = '" + btm + "' and c.CODERULEOID = '" + oid + "'" +
-                        "and w.ISLASTR = '1' and w.ISLASTV = '1'";
-                List<ClientBusinessObject> businessData = boService.queryByOnlySql(sql);
-                businessDataList.addAll(businessData);
-            }
-        }else {
-            String sql = "select COUNT(w.OID) from PLATFORMBTM_" + btmType + "  w\n" +
-                    "join PLATFORMBTM_" + MdmBtmTypeConstant.CODE_ALL_CODE + " c on w.OID = c.CREATECODEOID\n" +
-                    "where c.CREATECODEBTM = '" + btmType + "' and c.CODERULEOID = '" + oid + "'" +
-                    "and w.ISLASTR = '1' and w.ISLASTV = '1'";
-            List<ClientBusinessObject> businessData = boService.queryByOnlySql(sql);
-            businessDataList.addAll(businessData);
-        }
-        if (CollectionUtils.isEmpty(businessDataList) || StringUtils.isBlank(businessDataList.get(0).getAttributeValue("COUNT(w.OID)"))) {
-            //鏃犳晥鏌ヨ
-            return BaseResult.fail("鏌ヨ澶辫触");
-        } else if (!StringUtils.equalsIgnoreCase("0", businessDataList.get(0).getAttributeValue("COUNT(w.OID)"))) {
-            return BaseResult.fail("缂栫爜瑙勫垯鐢熸垚鐨勭紪鐮佸凡鍦ㄤ笟鍔℃暟鎹腑搴旂敤锛屼笉鍏佽娓呯┖");
-        }
-        //娌℃湁鏁版嵁锛屽彲浠ュ畨鍏ㄥ垹闄�
-        WebUtil.setPersistence(false);
-        //鍒犻櫎鐮佸�艰〃涓殑鏁版嵁锛屼絾涓嶅锛屽鏋滄湁娴佹按鐨勭爜娈碉紝闇�瑕侀噸鏂拌绠楁祦姘�
-        conditionMap.clear();
-        conditionMap.put("codeRuleOid", oid);
-        List<ClientBusinessObject> serialValueList = boService.queryCBO("codeserialvalue", conditionMap);
-        BatchCBO batchCBO = boService.batchDelete(codeDOList);
-        batchCBO.getDeleteCbos().addAll(serialValueList);
-        WebUtil.setPersistence(true);
-        boService.persistenceBatch(batchCBO);
-        return BaseResult.success();
-    }
 }
-

--
Gitblit v1.9.3