From 716ded9c48898ff8fb9e4a1872ccfe676c7f2f99 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期六, 15 四月 2023 16:32:28 +0800
Subject: [PATCH] 代码整合

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java |  380 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 371 insertions(+), 9 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java
index 932cf97..cd84de8 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java
@@ -5,6 +5,7 @@
 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.constant.MdmBtmTypeConstant;
 import com.vci.ubcs.code.dto.CodeBasicSecDTO;
 import com.vci.ubcs.code.entity.CodeBasicSec;
 import com.vci.ubcs.code.entity.CodeClassifyValue;
@@ -15,18 +16,22 @@
 import com.vci.ubcs.code.mapper.CodeClassifyValueMapper;
 import com.vci.ubcs.code.mapper.CodeFixedValueMapper;
 import com.vci.ubcs.code.service.ICodeBasicSecService;
+import com.vci.ubcs.code.service.ICodeClassifyValueService;
 import com.vci.ubcs.code.service.ICodeRuleService;
 import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
 import com.vci.ubcs.code.wrapper.CodeBasicSecWrapper;
 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.enumpck.OsCodeFillTypeEnum;
 import com.vci.ubcs.com.vci.starter.web.pagemodel.KeyValue;
-import com.vci.ubcs.com.vci.starter.web.pagemodel.SessionInfo;
 import com.vci.ubcs.com.vci.starter.web.pagemodel.UIFormReferVO;
 import com.vci.ubcs.com.vci.starter.web.util.BeanUtilForVCI;
 import com.vci.ubcs.com.vci.starter.web.util.VciBaseUtil;
 import com.vci.ubcs.com.vci.starter.web.util.WebUtil;
+import com.vci.ubcs.omd.entity.DictBizM;
+import com.vci.ubcs.omd.feign.IDictBizClient;
+import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
@@ -34,11 +39,10 @@
 import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
+
+import static com.vci.ubcs.code.constant.FrameWorkLangCodeConstant.DATA_OID_NOT_EXIST;
 
 /**
  * 鐮佹鍩虹淇℃伅鏈嶅姟鎺ュ彛
@@ -65,8 +69,27 @@
 	private CodeClassifyValueMapper codeClassifyValueMapper;
 
 	@Resource
+	private RevisionModelUtil revisionModelUtil;
+
+	@Resource
 	@Lazy
 	private ICodeRuleService codeRuleService;
+
+	@Resource
+	private ICodeClassifyValueService codeClassifyValueService;
+
+	@Resource
+	private IDictBizClient iDictBizClient;
+
+	/**
+	 * 涓婂眰鍒嗙被鐮佹鐨勫睘鎬у悕绉�
+	 */
+	private static  final String PARENT_FIELD_NAME = "parentclassifysecoid";
+
+	/**
+	 * 涓婄骇鍒嗙被鐮佸�肩殑灞炴�у悕绉�
+	 */
+	private static final String PARENT_CLASSIFY_VALUE_FIELD_NAME = "parentClassifyValueOid";
 
 	/**
 	 * 鏌ヨ鎵�鏈夌殑鐮佹鍩虹淇℃伅
@@ -165,6 +188,7 @@
 	 * @throws VciBaseException 鍙傛暟涓虹┖锛屽敮涓�椤癸紝蹇呰緭椤逛笉閫氳繃鏃朵細鎶涘嚭寮傚父
 	 */
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public boolean addSave(CodeBasicSecDTO codeBasicSecDTO) throws VciBaseException {
 		VciBaseUtil.alertNotNull(codeBasicSecDTO, "闇�瑕佹坊鍔犵殑鏁版嵁瀵硅薄",codeBasicSecDTO.getPkCodeRule(),"缂栫爜瑙勫垯鐨勪富閿�");
 		CodeRuleVO ruleVO = codeRuleService.getObjectByOid(codeBasicSecDTO.getPkCodeRule());
@@ -206,10 +230,72 @@
 			}
 		}
 		boolean resBoolean = codeBasicSecMapper.insert(codeBasicSecDO) > 0;
-		SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
-		/*if(StringUtils.isNotBlank(codeBasicSecDO.getCodeFillSeparator())){
-			charService.save(MdmBtmTypeConstant.CODE_BASIC_SEC,"codefileseparator",codeBasicSecDO.getCodeFillSeparator(),sessionInfo);
-		}*/
+		//SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
+		if(StringUtils.isNotBlank(codeBasicSecDO.getCodeFillSeparator())){
+			DictBizM dictBiz = new DictBizM();
+			dictBiz.setCode(MdmBtmTypeConstant.CODE_BASIC_SEC);
+			dictBiz.setDictKey("codefileseparator");
+			dictBiz.setDictValue(codeBasicSecDO.getCodeFillSeparator());
+			//浠庡師鏉ョ殑charService锛堝彲杈撳彲閫夛級鏇存敼涓鸿皟鐢╫md涓殑鎺ュ彛鏉ュ疄鐜�
+			iDictBizClient.getCheck(dictBiz);
+			//charService.save(MdmBtmTypeConstant.CODE_BASIC_SEC,"codefileseparator",codeBasicSecDO.getCodeFillSeparator(),sessionInfo);
+		}
+		return resBoolean;
+	}
+
+	/**
+	 * 淇敼鐮佹鍩虹淇℃伅
+	 *
+	 * @param codeBasicSecDTO 鐮佹鍩虹淇℃伅鏁版嵁浼犺緭瀵硅薄
+	 * @return 鎵ц缁撴灉
+	 * @throws VciBaseException 鍙傛暟涓虹┖锛屽敮涓�椤癸紝蹇呰緭椤逛笉閫氳繃鏃朵細鎶涘嚭寮傚父
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public boolean editSave(CodeBasicSecDTO codeBasicSecDTO) throws VciBaseException {
+		VciBaseUtil.alertNotNull(codeBasicSecDTO, "闇�瑕佹坊鍔犵殑鏁版嵁瀵硅薄");
+		KeyValue attrKv = checkAttrNullableBySecType(codeBasicSecDTO);
+		if (! "success".equals(attrKv.getKey())){
+			throw new VciBaseException(attrKv.getValue() + "涓嶈兘涓虹┖");
+		}
+		//灏咲TO杞崲涓篋O
+		CodeBasicSec codeBasicSecDO = selectByOid(codeBasicSecDTO.getOid());
+		boolean status = codeRuleService.checkEditDelStatus(codeRuleService.getObjectByOid(codeBasicSecDO.getPkCodeRule()).getLcStatus());
+		boolean resBoolean;
+		if (!status){
+			//杩斿洖閿欒淇℃伅
+			throw new VciBaseException("缂栫爜瑙勫垯涓嶅厑璁哥紪杈戞垨鍒犻櫎锛�");
+		} else {
+			//琛ヤ綅鐨勬椂鍊欙紝瑕佹帶鍒惰ˉ浣嶅瓧绗�
+			if((OsCodeFillTypeEnum.LEFT.getValue().equalsIgnoreCase(codeBasicSecDO.getCodeFillType())
+				|| OsCodeFillTypeEnum.RIGHT.getValue().equalsIgnoreCase(codeBasicSecDO.getCodeFillType()))
+				&& StringUtils.isBlank(codeBasicSecDO.getCodeFillSeparator())){
+				throw new VciBaseException("褰撹ˉ浣嶆柟寮忎负宸﹁ˉ浣嶆垨鑰呭彸琛ヤ綅鐨勬椂鍊欙紝琛ヤ綅瀛楃涓嶈兘涓虹┖");
+			}
+			//寮曠敤鐮佹鐨勬椂鍊欙紝闇�瑕佸垽鏂弬鐓х殑淇℃伅鏄惁姝g‘
+			if(CodeSecTypeEnum.CODE_REFER_SEC.getValue().equalsIgnoreCase(codeBasicSecDO.getSecType())){
+				if(StringUtils.isBlank(codeBasicSecDO.getReferConfig())){
+					throw new VciBaseException("寮曠敤鐮佹鐨勬椂鍊欙紝闇�瑕佸~鍐� 鍙傜収閰嶇疆 鐨勫唴瀹�");
+				}
+				try{
+					JSONObject.parseObject(codeBasicSecDO.getReferConfig(), UIFormReferVO.class);
+				}catch (Throwable e){
+					throw new VciBaseException("寮曠敤鐮佹鐨勬椂鍊欙紝鍙傜収閰嶇疆鐨勫唴瀹圭殑鏍煎紡涓嶆纭�,",new String[0],e);
+				}
+			}
+			revisionModelUtil.copyFromDTOIgnore(codeBasicSecDTO, codeBasicSecDO);
+			resBoolean = codeBasicSecMapper.updateById(codeBasicSecDO)>0;
+			//SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
+			if(StringUtils.isNotBlank(codeBasicSecDO.getCodeFillSeparator())){
+				DictBizM dictBiz = new DictBizM();
+				dictBiz.setCode(MdmBtmTypeConstant.CODE_BASIC_SEC);
+				dictBiz.setDictKey("codefileseparator");
+				dictBiz.setDictValue(codeBasicSecDO.getCodeFillSeparator());
+				//浠庡師鏉ョ殑charService锛堝彲杈撳彲閫夛級鏇存敼涓鸿皟鐢╫md涓殑鎺ュ彛鏉ュ疄鐜�
+				iDictBizClient.getCheck(dictBiz);
+				//charService.save(MdmBtmTypeConstant.CODE_BASIC_SEC,"codefileseparator",codeBasicSecDO.getCodeFillSeparator(),sessionInfo);
+			}
+		}
 		return resBoolean;
 	}
 
@@ -257,6 +343,282 @@
 		return attrMap;
 	}
 
+	/**
+	 * 鍒犻櫎鐮佹鍩虹淇℃伅
+	 * @param codeBasicSecDTO 鐮佹鍩虹淇℃伅鏁版嵁浼犺緭瀵硅薄锛宱id鍜宼s闇�瑕佷紶杈�
+	 * @return 鍒犻櫎缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐�
+	 * @throws VciBaseException 鍙傛暟涓虹┖锛岃寮曠敤鏃舵姏鍑哄紓甯�
+	 */
+	@Override
+	public boolean deleteCodeBasicSec(CodeBasicSecDTO codeBasicSecDTO) throws VciBaseException {
+		VciBaseUtil.alertNotNull(codeBasicSecDTO, "鐮佹鍩虹淇℃伅鏁版嵁瀵硅薄", codeBasicSecDTO.getOid(), "鐮佹鍩虹淇℃伅鐨勪富閿�");
+		return this.codeBasicSecMapper.deleteById(codeBasicSecDTO.getOid())>0;
+	}
 
+	/**
+	 * 涓婚敭鑾峰彇鐮佹鍩虹淇℃伅
+	 *
+	 * @param oid 涓婚敭
+	 * @return 鐮佹鍩虹淇℃伅鏄剧ず瀵硅薄
+	 * @throws VciBaseException 鍙傛暟涓虹┖锛屾暟鎹笉瀛樺湪鏃朵細鎶涘嚭寮傚父
+	 */
+	@Override
+	public CodeBasicSecVO getObjectByOid(String oid) throws VciBaseException {
+		return CodeBasicSecWrapper.build().entityVO(selectByOid(oid));
+	}
+
+	/**
+	 * 涓婚敭鎵归噺鑾峰彇鐮佹鍩虹淇℃伅
+	 *
+	 * @param oidCollections 涓婚敭闆嗗悎锛屼絾鏄彈鎬ц兘褰卞搷锛屽缓璁竴娆℃煡璇笉瓒呰繃10000涓�
+	 * @return 鐮佹鍩虹淇℃伅鏄剧ず瀵硅薄
+	 * @throws VciBaseException 鏌ヨ鍑虹幇寮傚父鏃朵細鎶涘嚭
+	 */
+	@Override
+	public Collection<CodeBasicSecVO> listCodeBasicSecByOids(Collection<String> oidCollections) throws VciBaseException {
+		VciBaseUtil.alertNotNull(oidCollections, "鏁版嵁瀵硅薄涓婚敭闆嗗悎");
+		List<CodeBasicSec> codeBasicSecDOList = listCodeBasicSecDOByOidCollections(oidCollections);
+		return CodeBasicSecWrapper.build().listVO(codeBasicSecDOList);
+	}
+
+	/**
+	 * 鍙傜収鐮佹鍩虹淇℃伅鍒楄〃
+	 *
+	 * @param codeBasicSecVO 鏌ヨ鏉′欢
+	 * @param page   鍒嗛〉鍜屾帓搴�
+	 * @return 鐮佹鍩虹淇℃伅鏄剧ず瀵硅薄鍒楄〃锛岀敓鏁堢殑鍐呭
+	 * @throws VciBaseException 鏌ヨ鏉′欢鍜屽垎椤靛嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
+	 */
+	@Override
+	public IPage<CodeBasicSecVO> refDataGridCodeBasicSec(IPage<CodeBasicSecVO> page, CodeBasicSecVO codeBasicSecVO) throws VciBaseException {
+		return gridCodeBasicSec(page,codeBasicSecVO);
+	}
+
+	/**
+	 * 鍙傜収鍒嗙被鐨勭爜娈�
+	 * @param codeBasicSecVO 鏌ヨ鏉′欢
+	 * @param page 鍒嗛〉鐨勫璞�
+	 * @return 鐮佹鐨勫唴瀹�
+	 */
+	@Override
+	public IPage<CodeBasicSecVO> refDataGridClassifySec(IPage<CodeBasicSecVO> page, CodeBasicSecVO codeBasicSecVO) throws VciBaseException {
+		if(Func.isEmpty(codeBasicSecVO.getPkCodeRule()) || Func.isBlank(codeBasicSecVO.getPkCodeRule())){
+			return null;
+		}
+		codeBasicSecVO.setSectype(CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue());
+		return refDataGridCodeBasicSec(page,codeBasicSecVO);
+	}
+
+	/**
+	 * 鍏嬮殕鐮佹淇℃伅
+	 *
+	 * @param oidList 婧愮爜娈典俊鎭富閿泦鍚�
+	 * @param pkCodeRule 鐩爣缂栫爜瑙勫垯
+	 * @return 鍏嬮殕缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐�
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R cloneCodeBasicSec(List<String> oidList, String pkCodeRule) {
+		boolean isLinked = checkIsLinked(pkCodeRule,null);
+		if (isLinked) {
+			return R.fail("缂栫爜瑙勫垯宸茶寮曠敤锛屼笉鍏佽缂栬緫鎴栧垹闄�");
+		}
+		List<CodeBasicSec> createList = new ArrayList<>();
+		List<CodeBasicSec> basicSecDOS = codeBasicSecMapper.selectBatchIds(oidList);
+		basicSecDOS.forEach(sec -> {
+			CodeBasicSec newSecDO = new CodeBasicSec();
+			BeanUtilForVCI.copyPropertiesIgnoreCase(sec,newSecDO);
+			newSecDO.setOid("");
+			newSecDO.setNameOid("");
+			newSecDO.setRevisionOid("");
+			newSecDO.setId(newSecDO.getId() + "_copy");
+			newSecDO.setName(newSecDO.getName() + "_copy");
+			newSecDO.setPkCodeRule(pkCodeRule);
+			createList.add(newSecDO);
+		});
+		boolean b = saveBatch(createList);
+		//codeBasicSecMapper.insertBatch(createList);
+		return R.data(b,"鍏嬮殕鐮佹淇℃伅鎴愬姛");
+	}
+
+	/**
+	 * 鏌ヨ鐩爣鍒嗙被鐮佹鎵�鍦ㄧ殑鏍戠粨鏋�
+	 *
+	 * @param oid 鐩爣鍒嗙被鐮佹涓婚敭
+	 * @return 鍒嗙被鐮佹鏍戠粨鏋�
+	 */
+	/*@Override
+	public List<Tree> gridCodeClassifySecTree(String oid) {
+		VciParentQueryOption queryOption = new VciParentQueryOption(PARENT_FIELD_NAME);
+		queryOption.setfOid(oid);
+		queryOption.setLinkTypeFlag(false);
+		queryOption.setHasSelf(true);
+		VciQueryWrapperForDO wrapper = new VciQueryWrapperForDO(CodeBasicSec.class);
+		wrapper.childQueryParent(queryOption);
+		List<CodeBasicSec> doList = codeBasicSecMapper.selectByWrapper(wrapper);
+		List<String> secOid = new ArrayList<>();
+		doList.forEach(o -> secOid.add(o.getOid()));
+		List<CodeClassifyValueVO> valueVOs = (List<CodeClassifyValueVO>) codeClassifyValueService.listCodeClassifyValueByOids(secOid);
+		TreeQueryObject treeQueryObject = new TreeQueryObject();
+		treeQueryObject.setMultipleSelect(false);
+		treeQueryObject.setShowCheckBox(false);
+		treeQueryObject.setQueryAllLevel(false);
+		treeQueryObject.setValueField("oid");
+		treeQueryObject.setTextField("name");
+		treeQueryObject.setQueryAllRev(false);
+		TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(PARENT_CLASSIFY_VALUE_FIELD_NAME);
+		treeWrapperOptions.copyFromTreeQuery(treeQueryObject);
+		return revisionModelUtil.doList2Trees(valueVOs,treeWrapperOptions,(CodeClassifyValueVO s) ->{
+			//鍙互鍦ㄨ繖閲屽鐞嗘爲鑺傜偣鐨勬樉绀�
+			return s.getId() + " " + s.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equalsIgnoreCase(s
+				.getLcStatus()) ? (" 銆愬仠鐢ㄣ�� ") : "");
+		});
+	}*/
+
+	/**
+	 * 涓婄Щ
+	 *
+	 * @param oid 涓婚敭
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public boolean upOrderNum(String oid) {
+		CodeBasicSec secDO = selectByOid(oid);
+		boolean resUpBoolean = false;
+		boolean	resDownBoolean = false;
+		if(secDO.getOrderNum() >1){
+			//绛変簬1鐨勬椂鍊欎笉鑳戒笂绉讳簡
+			//鎵炬瘮鑷繁灏忕殑
+			List<CodeBasicSec> lastSecDOs = codeBasicSecMapper.selectList(Wrappers.<CodeBasicSec>query()
+				.lambda().eq(CodeBasicSec::getPkCodeRule,secDO.getPkCodeRule())
+				.eq(CodeBasicSec::getOrderNum,String.valueOf(secDO.getOrderNum()-1))
+			);
+			if(!CollectionUtils.isEmpty(lastSecDOs)){
+				CodeBasicSec lastSec = lastSecDOs.get(0);
+				resDownBoolean = codeBasicSecMapper.update(null, Wrappers.<CodeBasicSec>update()
+					.lambda().set(CodeBasicSec::getOrderNum, lastSec.getOrderNum() + 1)
+					.eq(CodeBasicSec::getOid, lastSec.getOid())
+				) > 0;
+			}
+			secDO.setOrderNum(secDO.getOrderNum()-1);
+			resUpBoolean = codeBasicSecMapper.update(null, Wrappers.<CodeBasicSec>update()
+				.lambda().set(CodeBasicSec::getOrderNum, secDO.getOrderNum() - 1)
+				.eq(CodeBasicSec::getOid, secDO.getOid())
+			) > 0;
+		}
+		return resDownBoolean && resUpBoolean;
+	}
+
+	/**
+	 * 涓嬬Щ
+	 *
+	 * @param oid 涓婚敭
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public boolean downOrderNum(String oid) {
+		CodeBasicSec secDO = selectByOid(oid);
+		boolean resUpBoolean = false;
+		boolean	resDownBoolean = false;
+		Long total = codeBasicSecMapper.selectCount(Wrappers.<CodeBasicSec>query()
+			.lambda().eq(CodeBasicSec::getPkCodeRule,secDO.getPkCodeRule())
+		);
+		if(secDO.getOrderNum()  < total){
+			//灏忎簬鎬绘暟鐨勬椂鍊欐墠涓嬬Щ
+			List<CodeBasicSec> lastSecDOs = codeBasicSecMapper.selectList(Wrappers.<CodeBasicSec>query()
+				.lambda().eq(CodeBasicSec::getOrderNum,String.valueOf(secDO.getOrderNum()+1))
+			);
+			if(!CollectionUtils.isEmpty(lastSecDOs)){
+				CodeBasicSec lastSec = lastSecDOs.get(0);
+				resUpBoolean = codeBasicSecMapper.update(null, Wrappers.<CodeBasicSec>update()
+					.lambda().set(CodeBasicSec::getOrderNum, lastSec.getOrderNum() - 1)
+					.eq(CodeBasicSec::getOid, lastSec.getOid())
+				) > 0;
+			}
+			resDownBoolean = codeBasicSecMapper.update(null, Wrappers.<CodeBasicSec>update()
+				.lambda().set(CodeBasicSec::getOrderNum, secDO.getOrderNum() + 1)
+				.eq(CodeBasicSec::getOid, secDO.getOid())
+			) > 0;
+		}
+		return resDownBoolean && resUpBoolean;
+	}
+
+	/**
+	 * 鏍戝舰缁撴瀯鏌ヨoid
+	 * @param codeClassifySecOid
+	 * @return
+	 */
+	@Override
+	public List<String> getOidByCodeclassifysecOid(String codeClassifySecOid) {
+		return codeBasicSecMapper.getOidByCodeclassifysecOid(codeClassifySecOid.trim());
+	}
+
+	/**
+	 * 鏍¢獙鏄惁琚紩鐢�
+	 *
+	 * @param codeRuleOid     缂栫爜瑙勫垯涓婚敭
+	 * @param codeBasicSecOid 缂栫爜鍩虹淇℃伅涓婚敭
+	 * @return true琛ㄧず宸茶寮曠敤锛宖alse琛ㄧず鏈寮曠敤
+	 * @throws VciBaseException 琚紩鐢ㄧ殑鏃跺�欎細鎶涘嚭寮傚父
+	 */
+	private boolean checkIsLinked(String codeRuleOid, String codeBasicSecOid) throws VciBaseException {
+		boolean flag = true;
+		if (StringUtils.isNotBlank(codeRuleOid)) {
+			boolean status = codeRuleService.checkEditDelStatus(codeRuleService.getObjectByOid(codeRuleOid).getLcStatus());
+			if (!status){
+				return true;
+			}
+			boolean alreadyInUse = codeRuleService.isAlreadyInUse(codeRuleOid);
+			if (!alreadyInUse){
+				flag = false;
+			}
+		} else {
+			boolean status = codeRuleService.checkEditDelStatus(codeRuleService.getObjectByOid(codeBasicSecMapper.selectById(codeBasicSecOid).getPkCodeRule()).getLcStatus());
+			if (!status){
+				return true;
+			}
+			boolean alreadyInUse = codeRuleService.isAlreadyInUse(codeBasicSecMapper.selectById(codeBasicSecOid).getPkCodeRule());
+			if (!alreadyInUse){
+				flag = false;
+			}
+		}
+		return flag;
+	}
+
+	/**
+	 * 浣跨敤涓婚敭闆嗗悎鏌ヨ鏁版嵁瀵硅薄
+	 *
+	 * @param oidCollections 涓婚敭鐨勯泦鍚�
+	 * @return 鏁版嵁瀵硅薄鍒楄〃
+	 */
+	private List<CodeBasicSec> listCodeBasicSecDOByOidCollections(Collection<String> oidCollections) {
+		List<CodeBasicSec> codeBasicSecDOList = new ArrayList<>();
+		if (!CollectionUtils.isEmpty(oidCollections)) {
+			Collection<Collection<String>> oidCollectionsList = VciBaseUtil.switchCollectionForOracleIn(oidCollections);
+			for (Collection<String> oids : oidCollectionsList) {
+				List<CodeBasicSec> tempDOList = codeBasicSecMapper.selectBatchIds(oids);
+				if (!CollectionUtils.isEmpty(tempDOList)) {
+					codeBasicSecDOList.addAll(tempDOList);
+				}
+			}
+		}
+		return codeBasicSecDOList;
+	}
+
+	/**
+	 * 涓婚敭鏌ヨ鏁版嵁瀵硅薄
+	 *
+	 * @param oid 涓婚敭
+	 * @return 鏁版嵁瀵硅薄
+	 * @throws VciBaseException 鍙傛暟涓虹┖锛屽苟涓旀暟鎹笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
+	 */
+	private CodeBasicSec selectByOid(String oid) throws VciBaseException {
+		VciBaseUtil.alertNotNull(oid, "涓婚敭");
+		CodeBasicSec codeBasicSecDO = codeBasicSecMapper.selectById(oid.trim());
+		if (codeBasicSecDO == null || StringUtils.isBlank(codeBasicSecDO.getOid())) {
+			throw new VciBaseException(DATA_OID_NOT_EXIST);
+		}
+		return codeBasicSecDO;
+	}
 
 }

--
Gitblit v1.9.3