From 69e08028598ee1fd1e4874c2197f778b2110e8c4 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期一, 18 九月 2023 15:47:33 +0800
Subject: [PATCH] 代码提交

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java | 1803 +++++++++++++++++++++++++++++++++------------------------
 1 files changed, 1,033 insertions(+), 770 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 e12b48c..a6f678f 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
@@ -1,840 +1,1103 @@
 package com.vci.ubcs.code.service.impl;
 
-
+import com.alibaba.cloud.commons.lang.StringUtils;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.vci.frameworkcore.lcstatuspck.FrameworkDataLCStatus;
-import com.vci.starter.revision.bo.TreeWrapperOptions;
-import com.vci.starter.revision.service.RevisionModelUtil;
-import com.vci.starter.web.constant.QueryOptionConstant;
-import com.vci.starter.web.exception.VciBaseException;
-import com.vci.starter.web.pagemodel.*;
-import com.vci.starter.web.util.BeanUtilForVCI;
-import com.vci.starter.web.util.VciBaseUtil;
-import com.vci.starter.web.wrapper.VciParentQueryOption;
-import com.vci.starter.web.wrapper.VciQueryWrapperForDO;
-import com.vci.ubcs.code.constant.MdmBtmTypeConstant;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+
 import com.vci.ubcs.code.dto.CodeBasicSecDTO;
-import com.vci.ubcs.code.entity.CodeBasicSecDO;
-import com.vci.ubcs.code.entity.CodeClassifyValueDO;
-import com.vci.ubcs.code.entity.CodeFixedValueDO;
-import com.vci.ubcs.code.enumpack.CodeSecTypeEnum;
+import com.vci.ubcs.code.dto.CodeOrderDTO;
+import com.vci.ubcs.code.dto.CodeOrderSecDTO;
+import com.vci.ubcs.code.entity.*;
+import com.vci.ubcs.code.enumpack.*;
 import com.vci.ubcs.code.lifecycle.CodeRuleLC;
 import com.vci.ubcs.code.mapper.CodeBasicSecMapper;
 import com.vci.ubcs.code.mapper.CodeClassifyValueMapper;
 import com.vci.ubcs.code.mapper.CodeFixedValueMapper;
-import com.vci.ubcs.code.service.CodeBasicSecServiceI;
-import com.vci.ubcs.code.service.CodeClassifyValueServiceI;
-import com.vci.ubcs.code.service.CodeFixedValueServiceI;
-import com.vci.ubcs.code.service.CodeRuleServiceI;
-import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
-import com.vci.ubcs.code.vo.pagemodel.CodeClassifyValueVO;
-import com.vci.ubcs.code.vo.pagemodel.CodeFixedValueVO;
-import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
-import com.vci.web.enumpck.OsCodeFillTypeEnum;
-import com.vci.web.pageModel.BatchCBO;
-import com.vci.web.pageModel.UIFormReferVO;
-import com.vci.web.service.BdSelectInputCharServiceI;
-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.mapper.CodeSerialValueMapper;
+import com.vci.ubcs.code.service.*;
+import com.vci.ubcs.code.vo.CodeReferConfigVO;
+import com.vci.ubcs.code.vo.pagemodel.*;
+import com.vci.ubcs.code.wrapper.CodeBasicSecWrapper;
+import com.vci.ubcs.omd.cache.EnumCache;
+import com.vci.ubcs.omd.enums.EnumEnum;
+import com.vci.ubcs.starter.enumpack.CodeTableNameEnum;
+import com.vci.ubcs.starter.exception.VciBaseException;
+import com.vci.ubcs.starter.revision.model.BaseModel;
+import com.vci.ubcs.starter.revision.service.RevisionModelUtil;
+import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil;
+import com.vci.ubcs.starter.util.MdmBtmTypeConstant;
+import com.vci.ubcs.starter.util.UBCSCondition;
+import com.vci.ubcs.starter.util.UBCSSqlKeyword;
+import com.vci.ubcs.starter.web.enumpck.OsCodeFillTypeEnum;
+import com.vci.ubcs.starter.web.pagemodel.*;
+import com.vci.ubcs.starter.web.util.BeanUtilForVCI;
+import com.vci.ubcs.starter.web.util.VciBaseUtil;
+import com.vci.ubcs.starter.web.util.VciDateUtil;
+import com.vci.ubcs.starter.web.util.WebUtil;
+import com.vci.ubcs.system.entity.DictBiz;
+import com.vci.ubcs.system.feign.IDictBizClient;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.Func;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
-import plm.bs.bom.clientobject.ClientBusinessObject;
 
 import javax.annotation.Resource;
+import java.rmi.ServerException;
 import java.util.*;
-import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.stream.Collectors;
 
-import static com.vci.frameworkcore.constant.FrameWorkLangCodeConstant.*;
+import static com.vci.ubcs.code.constant.FrameWorkLangCodeConstant.*;
+import static com.vci.ubcs.code.constant.MdmEngineConstant.EMPTY_SERIAL_UNIT;
+import static com.vci.ubcs.code.constant.MdmEngineConstant.SERIAL_UNIT_SPACE;
 
 /**
- * 鐮佹鍩虹淇℃伅鏈嶅姟
+ * 鐮佹鍩虹淇℃伅鏈嶅姟鎺ュ彛
  *
  * @author weidy
  * @date 2022-01-24
  */
 @Service
-public class CodeBasicSecServiceImpl implements CodeBasicSecServiceI {
+public class CodeBasicSecServiceImpl extends ServiceImpl<CodeBasicSecMapper, CodeBasicSec> implements ICodeBasicSecService {
 
-    /**
-     * 鏃ュ織
-     */
-    private Logger logger = LoggerFactory.getLogger(getClass());
+	@Resource
+	private CodeBasicSecMapper codeBasicSecMapper;
 
-    /**
-     * 鏁版嵁鎿嶄綔灞�
-     */
-    @Resource
-    private CodeBasicSecMapper codeBasicSecMapper;
+	/**
+	 * 鍥哄畾鐮佹鐨勭爜鍊兼暟鎹搷浣滃眰
+	 */
+	@Resource
+	private CodeFixedValueMapper fixedValueMapper;
 
-    /**
-     * 涓氬姟绫诲瀷鎿嶄綔鐨勬湇鍔�
-     */
-    @Autowired
+	/**
+	 * 鍒嗙被鐮佹鐨勭爜鍊兼暟鎹搷浣滃眰
+	 */
+	@Resource
+	private CodeClassifyValueMapper codeClassifyValueMapper;
+
+	@Resource
+	private RevisionModelUtil revisionModelUtil;
+
+	@Resource
 	@Lazy
-	private WebBoServiceI boService;
+	private ICodeRuleService codeRuleService;
 
-    /**
-     * 瀵硅薄鐨勬搷浣�
-     */
-    @Autowired
-    private RevisionModelUtil revisionModelUtil;
+	@Resource
+	private ICodeClassifyValueService codeClassifyValueService;
 
-    /**
-     * 涓绘暟鎹紪鐮佽鍒欐湇鍔�
-     */
-    @Autowired
-	@Lazy
-    private CodeRuleServiceI codeRuleService;
+	@Resource
+	private ICodeReferConfigService codeReferConfigService;
 
-    /**
-     * 鍒嗙被鐮佹鐨勭爜鍊兼湇鍔�
-     */
-    @Autowired
-    private CodeClassifyValueServiceI codeClassifyValueService;
+	@Resource
+	private IDictBizClient iDictBizClient;
 
-    /**
-     * 鍒嗙被鐮佹鐨勭爜鍊兼暟鎹搷浣滃眰
-     */
-    @Resource
-    private CodeClassifyValueMapper codeClassifyValueMapper;
+	/**
+	 * 鍥哄畾鐮佹鐨勭爜鍊肩殑鏈嶅姟
+	 */
+	@Resource
+	private ICodeFixedValueService fixedValueService;
 
-    /**
-     * 鍥哄畾鐮佹鐨勭爜鍊肩殑鏈嶅姟
-     */
-    @Autowired
-    private CodeFixedValueServiceI fixedValueService;
+	/**
+	 * 娴佹按鍙风殑鐩稿叧鐨勪俊鎭�
+	 */
+	@Resource
+	private CodeSerialValueMapper serialValueMapper;
 
-    /**
-     * 鍥哄畾鐮佹鐨勭爜鍊兼暟鎹搷浣滃眰
-     */
-    @Resource
-    private CodeFixedValueMapper fixedValueMapper;
+	/**
+	 * 涓婂眰鍒嗙被鐮佹鐨勫睘鎬у悕绉�
+	 */
+	private static  final String PARENT_FIELD_NAME = "parentClassifySecOid";
 
-    /**
-     * 涓婂眰鍒嗙被鐮佹鐨勫睘鎬у悕绉�
-     */
-    private static final String PARENT_FIELD_NAME = "parentclassifysecoid";
+	/**
+	 * 涓婄骇鍒嗙被鐮佸�肩殑灞炴�у悕绉�
+	 */
+	private static final String PARENT_CLASSIFY_VALUE_FIELD_NAME = "parentClassifyValueOid";
 
-    /**
-     * 涓婄骇鍒嗙被鐮佸�肩殑灞炴�у悕绉�
-     */
-    private static final String PARENT_CLASSIFY_VALUE_FIELD_NAME = "parentClassifyValueOid";
+	/**
+	 * 鏌ヨ鎵�鏈夌殑鐮佹鍩虹淇℃伅
+	 * @param conditionMap 鏌ヨ鏉′欢
+	 * @param query 鍒嗛〉瀵硅薄
+	 * @return 鎵ц缁撴灉
+	 * @throws VciBaseException 鏌ヨ鏉′欢鍜屽垎椤靛嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
+	 */
+	@Override
+	public IPage<CodeBasicSecVO> gridCodeBasicSec(Query query, Map<String,Object> conditionMap) throws ServiceException {
+		if(Func.isEmpty(Func.isEmpty(conditionMap.get(CodeTableNameEnum.PL_CODE_BASICSEC.getText()+".pkCodeRule")))){
+			return null;
+		}
+		// 鑱旇〃鏌ヨ ,璁剧疆琛ㄥ埆鍚嶏紝琛ㄥ埆鍚嶉粯璁ゅ氨閲囩敤琛ㄥ悕灏忓啓锛岄厤缃珮绾ф煡璇㈢殑鏃跺�欏氨闇�瑕佹牴鎹繖涓潵瀵箇here鏉′欢杩涜閰嶇疆
+		MPJLambdaWrapper<CodeBasicSec> mpjLambdaWrapper = new MPJLambdaWrapper<>(CodeBasicSec.class, CodeTableNameEnum.PL_CODE_BASICSEC.getText())
+			.selectAll(CodeBasicSec.class)
+			.selectAs(CodeClassify::getName, CodeBasicSec::getReferCodeClassifyOidName)
+			.leftJoin(CodeClassify.class, CodeTableNameEnum.PL_CODE_CLASSIFY.getText(), CodeClassify::getOid, CodeBasicSec::getReferCodeClassifyOid)
+			.leftJoin(CodeBasicSec.class,CodeTableNameEnum.PL_CODE_BASICSEC.getText()+1,CodeBasicSec::getOid,CodeBasicSec::getParentClassifySecOid
+				,ext->ext.selectAs(CodeBasicSec::getName,CodeBasicSec::getParentClassifySecText));
+		// 娣诲姞where鏉′欢
+		UBCSSqlKeyword.buildConditionByAs(conditionMap,mpjLambdaWrapper,CodeTableNameEnum.PL_CODE_BASICSEC.getText());
+		IPage<CodeBasicSec> codeBasicSecIPage = codeBasicSecMapper.selectPage(UBCSCondition.getPage(query), mpjLambdaWrapper);
+		return CodeBasicSecWrapper.build().pageVO(codeBasicSecIPage);
+	}
 
-    /**
-     * 鍙�夊彲杈撴湇鍔�
-     */
-    @Autowired
-    private BdSelectInputCharServiceI charService;
+	/**
+	 * 鏍规嵁缂栫爜瑙勫垯鎵归噺鍒犻櫎鐮佹鍩烘湰淇℃伅
+	 * @param codeRuleOid 缂栫爜瑙勫垯涓婚敭
+	 * @return 鎵ц缁撴灉
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public boolean batchDeleteSecByCodeRuleOid(String codeRuleOid) throws ServiceException {
+		VciBaseUtil.alertNotNull(codeRuleOid,"缂栫爜瑙勫垯涓婚敭");
+		// 1銆侀�氳繃pkcoderule浣滀负鏉′欢锛屽厛鏌ヨ瑕佸垹闄ゅ熀纭�鐮佹
+		List<CodeBasicSec> deleteList = this.codeBasicSecMapper.selectList(Wrappers.<CodeBasicSec>query().eq("pkcoderule", codeRuleOid));
+		if (CollectionUtils.isEmpty(deleteList)){
+			return true;
+		}
+		// 2銆佸啀鍒犻櫎鍩虹鐮佹
+		boolean deletFlag = codeBasicSecMapper.deleteBatchIds(deleteList.stream().map(CodeBasicSec::getOid).collect(Collectors.toSet())) > 0;
+		// 3銆佸啀鏍规嵁鍒犻櫎鍥哄畾鐮佹锛屼笡鏌ヨ鍑烘潵鐨勫熀纭�鐮佹涓繃婊ゅ嚭鍖呭惈鍥哄畾鐮佹鐨勮褰�
+		List<CodeBasicSec> fixedSecList = deleteList.stream().filter(sec -> {
+			return CodeSecTypeEnum.CODE_FIXED_SEC.getValue().equals(sec.getSecType());
+		}).collect(Collectors.toList());
+		if (!CollectionUtils.isEmpty(fixedSecList)){
+			// 灏嗚浣滀负鍒犻櫎鏉′欢鐨勫�兼斁鍦ㄤ竴涓泦鍚堥噷闈�
+			Set<String> fixedSecOidSet = fixedSecList.stream().map(CodeBasicSec::getOid).collect(Collectors.toSet());
+			// 閫氳繃澶栭敭杩涜鏌ヨ
+			List<CodeFixedValue> fixedValues = fixedValueMapper.selectList(Wrappers.<CodeFixedValue>query().lambda().in(CodeFixedValue::getCodeFixedSecOid,fixedSecOidSet));
+			if(!fixedValues.isEmpty()){
+				// 鏍规嵁鏌ヨ鍑烘潵鐨刬d鎵ц鍥哄畾鐮佹鎵ц鍒犻櫎
+				deletFlag = fixedValueMapper.deleteBatchIds(fixedValues.stream().map(CodeFixedValue::getOid).collect(Collectors.toSet()))>0;
+			}
+		}
+		// 4銆佸啀鍒犻櫎鍒嗙被鐮佹
+		List<CodeBasicSec> classifySecList = deleteList.stream().filter(sec -> {
+			return CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue().equals(sec.getSecType());
+		}).collect(Collectors.toList());
+		if (!CollectionUtils.isEmpty(classifySecList)){
+			// 灏嗚浣滀负鍒犻櫎鏉′欢鐨勫�兼斁鍦ㄤ竴涓泦鍚堥噷闈�
+			Set<String> classifySecOidSet = classifySecList.stream().map(CodeBasicSec::getOid).collect(Collectors.toSet());
+			// 閫氳繃澶栭敭杩涜鏌ヨ
+			List<CodeClassifyValue> codeClassifyValues = codeClassifyValueMapper.selectList(Wrappers.<CodeClassifyValue>query().lambda().in(CodeClassifyValue::getCodeClassifySecOid,classifySecOidSet));
+			if(!codeClassifyValues.isEmpty()){
+				// 鏍规嵁鏌ヨ鍑烘潵鐨勪富閿甶d鎵ц鍥哄畾鐮佹鎵ц鍒犻櫎
+				deletFlag = codeClassifyValueMapper.deleteBatchIds(codeClassifyValues.stream().map(CodeClassifyValue::getOid).collect(Collectors.toSet()))>0;
+			}
+		}
+		return deletFlag;
+	}
 
-    /**
-     * 鏌ヨ鎵�鏈夌殑鐮佹鍩虹淇℃伅
-     *
-     * @param conditionMap 鏌ヨ鏉′欢
-     * @param pageHelper   鍒嗛〉鍜屾帓搴�
-     * @return 鎵ц缁撴灉
-     * @throws VciBaseException 鏌ヨ鏉′欢鍜屽垎椤靛嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
-     */
-    @Override
-    public DataGrid<CodeBasicSecVO> gridCodeBasicSec(Map<String, String> conditionMap, PageHelper pageHelper) throws VciBaseException {
-        if (pageHelper == null) {
-            pageHelper = new PageHelper(-1);
-        }
-        pageHelper.addDefaultAsc("ordernum");
-        if(!conditionMap.containsKey("pkCodeRule") || StringUtils.isBlank(conditionMap.get("pkCodeRule"))){
-            return new DataGrid<>();
-        }
-        List<CodeBasicSecDO> doList = codeBasicSecMapper.selectByCondition(conditionMap, pageHelper);
-        DataGrid<CodeBasicSecVO> dataGrid = new DataGrid<CodeBasicSecVO>();
-        if (!CollectionUtils.isEmpty(doList)) {
-            dataGrid.setData(codeBasicSecDO2VOs(doList));
-            dataGrid.setTotal(VciBaseUtil.getInt(String.valueOf(codeBasicSecMapper.countByCondition(conditionMap))));
-        }
-        return dataGrid;
-    }
+	/**
+	 * 鏍规嵁鐮佹鍒嗙被鐨勭被鍨嬪垽鏂睘鎬ф槸鍚︽槸绌虹殑
+	 *
+	 * @param codeBasicSecDTO 鐮佹鍩虹淇℃伅鏁版嵁浼犺緭瀵硅薄
+	 * @return 鏈夌┖鐨勫垯浼爇ey-灞炴�у悕 value-瀛楁鍚箟锛屾病鏈夌┖鐨勫垯浼� key-success value-true
+	 */
+	@Override
+	public KeyValue checkAttrNullableBySecType(CodeBasicSecDTO codeBasicSecDTO) throws ServiceException {
+		VciBaseUtil.alertNotNull(codeBasicSecDTO.getSecType(), "鐮佹鍒嗙被");
+		String secType = codeBasicSecDTO.getSecType();
+		HashMap<String, String> attrMap = JSONObject.parseObject(JSONObject.toJSONString(codeBasicSecDTO), HashMap.class);
+		Map<String, String> notNullableAttr = getNotNullableAttr(secType);
+		if (notNullableAttr == null) {
+			throw new VciBaseException("鐮佹鍒嗙被濉啓鍑洪敊锛岃鏌ラ獙鍚庨噸璇�");
+		}
+		for (String key : notNullableAttr.keySet()) {
+			if (StringUtils.isBlank(WebUtil.getStringValueFromObject(attrMap.get(key)))) {
+				KeyValue kv = new KeyValue();
+				kv.setKey(key);
+				kv.setValue(notNullableAttr.get(key));
+				return kv;
+			}
+		}
+		KeyValue kv = new KeyValue();
+		kv.setKey("success");
+		kv.setValue("true");
+		return kv;
+	}
 
-    /**
-     * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
-     *
-     * @param codeBasicSecDOs 鏁版嵁瀵硅薄鍒楄〃
-     * @return 鏄剧ず瀵硅薄
-     * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
-     */
-    @Override
-    public List<CodeBasicSecVO> codeBasicSecDO2VOs(Collection<CodeBasicSecDO> codeBasicSecDOs) throws VciBaseException {
-        List<CodeBasicSecVO> voList = new ArrayList<CodeBasicSecVO>();
-        if (!CollectionUtils.isEmpty(codeBasicSecDOs)) {
-            for (CodeBasicSecDO s : codeBasicSecDOs) {
-                CodeBasicSecVO vo = codeBasicSecDO2VO(s);
-                if (vo != null) {
-                    voList.add(vo);
-                }
-            }
-        }
-        return voList;
-    }
+	/**
+	 * 澧炲姞鐮佹鍩虹淇℃伅
+	 *
+	 * @param codeBasicSecDTO 鐮佹鍩虹淇℃伅鏁版嵁浼犺緭瀵硅薄
+	 * @return 鎵ц缁撴灉
+	 * @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());
+		if(!CodeRuleLC.EDITING.getValue().equalsIgnoreCase(ruleVO.getLcStatus())){
+			throw new VciBaseException("缂栫爜瑙勫垯鐨勭姸鎬佷笉鏄��" + CodeRuleLC.EDITING.getText() + "銆戯紒涓嶅厑璁镐慨鏀�");
+		}
+		KeyValue attrKv = checkAttrNullableBySecType(codeBasicSecDTO);
+		if (! "success".equals(attrKv.getKey())){
+			throw new VciBaseException(attrKv.getValue() + "涓嶈兘涓虹┖");
+		}
+		//灏咲TO杞崲涓篋O
+		CodeBasicSec codeBasicSecDO = new CodeBasicSec();
+		BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecDTO, codeBasicSecDO);
+		//text杞崲
+		codeBasicSecDO.setSecTypeText(EnumCache.getValue(EnumEnum.CODE_SEC_TYPE,codeBasicSecDTO.getSecType()));
+		codeBasicSecDO.setCodeLevelTypeText(EnumCache.getValue(EnumEnum.CODE_LEVEL_TYPE,codeBasicSecDTO.getCodeLevelType()));
+		codeBasicSecDO.setCodeSecLengthTypeText(EnumCache.getValue(EnumEnum.CODE_SEC_LENGTH,codeBasicSecDTO.getCodeSecLengthType()));
+		codeBasicSecDO.setValueCutTypeText(EnumCache.getValue(EnumEnum.CODE_CUT_TYPE,codeBasicSecDTO.getValueCutType()));
+		codeBasicSecDO.setCodeGetValueTypeText(EnumCache.getValue(EnumEnum.CODE_GET_VALUE_TYPE,codeBasicSecDTO.getCodeGetValueType()));
+		//濉厖涓�浜涢粯璁ゅ��
+		DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeBasicSecDO, MdmBtmTypeConstant.CODE_BASIC_SEC);
+		//鎺掑簭鍙凤紝榛樿绛変簬褰撳墠宸叉湁鐨勬暟閲忓姞1
+		Long total = codeBasicSecMapper.selectCount(Wrappers.<CodeBasicSec>query()
+			.lambda()
+			.eq(CodeBasicSec::getPkCodeRule,codeBasicSecDTO.getPkCodeRule()));
+		if(total == null){
+			total = 0L;
+		}
+		codeBasicSecDO.setOrderNum(total.intValue() + 1);
 
-    /**
-     * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
-     *
-     * @param codeBasicSecDOs 鏁版嵁瀵硅薄鍒楄〃
-     * @param hasFixedValue 鏄惁鏈夊浐瀹氬��
-     * @return 鏄剧ず瀵硅薄
-     * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
-     */
-    @Override
-    public List<CodeBasicSecVO> codeBasicSecDO2VOs(Collection<CodeBasicSecDO> codeBasicSecDOs, boolean hasFixedValue) throws VciBaseException {
-        List<CodeBasicSecVO> voList = new ArrayList<CodeBasicSecVO>();
-        if (!CollectionUtils.isEmpty(codeBasicSecDOs)) {
-            for (CodeBasicSecDO s : codeBasicSecDOs) {
-                CodeBasicSecVO vo = codeBasicSecDO2VO(s);
-                if (vo != null) {
-                    voList.add(vo);
-                }
-            }
-        }
-        if(hasFixedValue && !CollectionUtils.isEmpty(voList)){
-            List<CodeBasicSecVO> fixedSecVOList = voList.stream().filter(s -> CodeSecTypeEnum.CODE_FIXED_SEC.getValue().equalsIgnoreCase(s.getSectype())).collect(Collectors.toList());
-            if(!CollectionUtils.isEmpty(fixedSecVOList)){
-                //鏌ヨ鍥哄畾鐮佺殑鐮佸��
-                Map<String, List<CodeFixedValueVO>> secValueMap = fixedValueService.listCodeFixedValueBySecOids(fixedSecVOList.stream().map(CodeBasicSecVO::getOid).collect(Collectors.toList()));
-                voList.stream().forEach(vo->{
-                    vo.setFixedValueVOList(secValueMap.getOrDefault(vo.getOid(),null));
-                });
-            }
-        }
-        return voList;
-    }
+		//琛ヤ綅鐨勬椂鍊欙紝瑕佹帶鍒惰ˉ浣嶅瓧绗�
+		if((OsCodeFillTypeEnum.LEFT.getValue().equalsIgnoreCase(codeBasicSecDO.getCodeFillType())
+			|| OsCodeFillTypeEnum.RIGHT.getValue().equalsIgnoreCase(codeBasicSecDO.getCodeFillType()))
+			&& StringUtils.isBlank(codeBasicSecDO.getCodeFillSeparator())){
+			throw new VciBaseException("褰撹ˉ浣嶆柟寮忎负宸﹁ˉ浣嶆垨鑰呭彸琛ヤ綅鐨勬椂鍊欙紝琛ヤ綅瀛楃涓嶈兘涓虹┖");
+		}
+		CodeReferConfigVO codeReferConfigVO = null;
+		//寮曠敤鐮佹鐨勬椂鍊欙紝闇�瑕佸垽鏂弬鐓х殑淇℃伅鏄惁姝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);
+				codeReferConfigVO = JSONObject.parseObject(codeBasicSecDO.getReferConfig(), CodeReferConfigVO.class);
+				// 灏嗗弬鐓ч厤缃繘琛屾寔涔呭寲锛岀粰鐢ㄦ埛鎻愪緵鍙彲閫夋嫨鍙傜収閰嶇疆鐨勬柟寮�
+			}catch (Throwable e){
+				throw new VciBaseException("寮曠敤鐮佹鐨勬椂鍊欙紝鍙傜収閰嶇疆鐨勫唴瀹圭殑鏍煎紡涓嶆纭�,",new String[0],e);
+			}
+			// 鍒ゆ柇鏄惁涓哄紩鐢ㄧ爜娈碉紝濡傛灉鏄簲鐢ㄧ爜娈电殑璇濓紝涓轰簡閫傞厤鍓嶇缁勪欢锛岃繖閲岃瀵硅〃杩涜澶勭悊涓�涓嬶紝鎸夌収浠ュ墠鐨勫弬鐓ф牸寮忚繘琛岃浆鎹�
+			codeBasicSecDO.setReferValueInfo(referConfigToUIUiTable(codeReferConfigVO));
+			if(Func.toBoolean(codeReferConfigVO.getIsPersistence())){
+				codeReferConfigService.insert(codeReferConfigVO);
+			}
+		}
+		boolean resBoolean = codeBasicSecMapper.insert(codeBasicSecDO) > 0;
+		//SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
+		if(StringUtils.isNotBlank(codeBasicSecDO.getCodeFillSeparator())){
+			DictBiz dictBiz = new DictBiz();
+			dictBiz.setCode("codeFillSeparator");
+			dictBiz.setDictKey(codeBasicSecDO.getCodeFillSeparator());
+			dictBiz.setDictValue(codeBasicSecDO.getCodeFillSeparator());
+			//浠庡師鏉ョ殑charService锛堝彲杈撳彲閫夛級鏇存敼涓鸿皟鐢╫md涓殑鎺ュ彛鏉ュ疄鐜�
+			iDictBizClient.getCheck(dictBiz);
+			//charService.save(MdmBtmTypeConstant.CODE_BASIC_SEC,"codefileseparator",codeBasicSecDO.getCodeFillSeparator(),sessionInfo);
+		}
+		return resBoolean;
+	}
 
-    /**
-     * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
-     *
-     * @param codeBasicSecDO 鏁版嵁瀵硅薄
-     * @return 鏄剧ず瀵硅薄
-     * @throws VciBaseException 鎷疯礉灞炴�у嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
-     */
-    @Override
-    public CodeBasicSecVO codeBasicSecDO2VO(CodeBasicSecDO codeBasicSecDO) throws VciBaseException {
-        CodeBasicSecVO vo = new CodeBasicSecVO();
-        if (codeBasicSecDO != null) {
-            BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecDO, vo);
-            //濡傛灉鏈塴cstatus鐨勭被鐨勮瘽
-            if (true) {
-                //vo.setLcStatusText({lcStatusFullClassName}.getTextByValue(vo.getLcStatus()));
-            }
-        }
-        return vo;
-    }
+	/**
+	 * 灏唕eferconfig杞崲涓篔SON鏍煎紡鐨刄IFormReferVO
+	 * @param codeReferConfig
+	 * @return
+	 */
+	private String referConfigToUIUiTable(CodeReferConfigVO codeReferConfig){
+		// 鎷疯礉涓轰互鍓嶇殑鑰佸璞�
+		UIReferConfigFormVO uiFormReferVO = new UIReferConfigFormVO();
+		BeanUtil.copy(codeReferConfig,uiFormReferVO);
 
-    /**
-     * 澧炲姞鐮佹鍩虹淇℃伅
-     *
-     * @param codeBasicSecDTO 鐮佹鍩虹淇℃伅鏁版嵁浼犺緭瀵硅薄
-     * @return 鎵ц缁撴灉
-     * @throws VciBaseException 鍙傛暟涓虹┖锛屽敮涓�椤癸紝蹇呰緭椤逛笉閫氳繃鏃朵細鎶涘嚭寮傚父
-     */
-    @Override
-    public CodeBasicSecVO addSave(CodeBasicSecDTO codeBasicSecDTO) throws VciBaseException {
-        VciBaseUtil.alertNotNull(codeBasicSecDTO, "闇�瑕佹坊鍔犵殑鏁版嵁瀵硅薄",codeBasicSecDTO.getPkCodeRule(),"缂栫爜瑙勫垯鐨勪富閿�");
-        CodeRuleVO ruleVO = codeRuleService.getObjectByOid(codeBasicSecDTO.getPkCodeRule());
-        if(!CodeRuleLC.EDITING.getValue().equalsIgnoreCase(ruleVO.getLcStatus())){
-            throw new VciBaseException("缂栫爜瑙勫垯鐨勭姸鎬佷笉鏄��" + CodeRuleLC.EDITING.getText() + "銆戯紒涓嶅厑璁镐慨鏀�");
-        }
-        KeyValue attrKv = checkAttrNullableBySecType(codeBasicSecDTO);
-        if (! "success".equals(attrKv.getKey())){
-            throw new VciBaseException(attrKv.getValue() + "涓嶈兘涓虹┖");
-        }
+		// 琛ㄦ牸鐨勮嚜瀹氫箟瀹氫箟
+		UITableConfigVO uiTableConfigVO = new UITableConfigVO();
+		uiTableConfigVO.setPage(new UITablePageVO(codeReferConfig.getLimit(),1));
+		// 鍒楄〃鐨勫垪鐨勪俊鎭浆鎹�
+		List<TableColVO> uiTableFieldVOs = new ArrayList<>();
+		// 蹇�熸煡璇㈠垪
+		List<TableColVO> queryColumns = new ArrayList<>();
+		if(!CollectionUtils.isEmpty(codeReferConfig.getCodeShowFieldConfigVOS())){
+			codeReferConfig.getCodeShowFieldConfigVOS().stream().forEach(showField ->{
+				TableColVO tableColVO = new TableColVO();
+				BeanUtil.copy(showField,tableColVO);
+				tableColVO.setSortField(showField.getAttrSortField());
+				uiTableFieldVOs.add(tableColVO);
+				if(Func.toBoolean(showField.getIsQuery())){
+					TableColVO tableQueryColumns = new TableColVO();
+					BeanUtil.copy(showField,tableQueryColumns);
+					tableColVO.setSortField(showField.getAttrSortField());
+					queryColumns.add(tableQueryColumns);
+				}
+			});
+		}
+		// 鏄剧ず鐨勫垪
+		uiTableConfigVO.setCols(uiTableFieldVOs);
+		// 蹇�熸煡璇㈠垪
+		uiTableConfigVO.setQueryColumns(queryColumns);
+		//set缁欒〃鏍奸厤缃睘鎬�
+		uiFormReferVO.setTableConfig(uiTableConfigVO);
+		//瀛楁鍚嶄笉涓�鑷达紝闇�瑕佹墜鍔╯et
+		uiFormReferVO.setMuti(Func.toBoolean(codeReferConfig.getIsMuti()));
+		uiFormReferVO.setInitSort(new UIFieldSortVO(codeReferConfig.getSortType(),codeReferConfig.getSortField()));
+		// 绛涢�夋潯浠�
+		HashMap<String, String> whereMap = new HashMap<>();
+		if(!codeReferConfig.getCodeSrchCondConfigVOS().isEmpty()){
+			codeReferConfig.getCodeSrchCondConfigVOS().stream().forEach(srch->{
+				whereMap.put(srch.getFilterField()+srch.getFilterType(),srch.getFilterValue());
+			});
+		}
+		uiFormReferVO.setWhere(whereMap);
+		return JSONObject.toJSONString(uiFormReferVO);
+	}
 
+	/**
+	 * 淇敼鐮佹鍩虹淇℃伅
+	 *
+	 * @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());
+		DefaultAttrAssimtUtil.updateDefaultAttrAssimt(codeBasicSecDO);
+		boolean status = codeRuleService.checkEditDelStatus(codeRuleService.getObjectByOid(codeBasicSecDO.getPkCodeRule()).getLcStatus());
+		boolean resBoolean;
+		CodeReferConfigVO codeReferConfigVO = null;
+		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(codeBasicSecDTO.getReferConfig())){
+					throw new VciBaseException("寮曠敤鐮佹鐨勬椂鍊欙紝闇�瑕佸~鍐欏弬鐓ч厤缃殑鍐呭");
+				}
+				try{
+					// JSONObject.parseObject(codeBasicSecDO.getReferConfig(), UIFormReferVO.class);
+					codeReferConfigVO = JSONObject.parseObject(codeBasicSecDTO.getReferConfig(), CodeReferConfigVO.class);
+				}catch (Throwable e){
+					throw new VciBaseException("寮曠敤鐮佹鐨勬椂鍊欙紝鍙傜収閰嶇疆鐨勫唴瀹圭殑鏍煎紡涓嶆纭�,",new String[0],e);
+				}
+				// 鍒ゆ柇鏄惁涓哄紩鐢ㄧ爜娈碉紝濡傛灉鏄紩鐢ㄧ爜娈电殑璇濓紝涓轰簡閫傞厤鍓嶇缁勪欢锛岃繖閲岃瀵硅〃杩涜澶勭悊涓�涓嬶紝鎸夌収浠ュ墠鐨勫弬鐓ф牸寮忚繘琛岃浆鎹�
+				codeBasicSecDO.setReferValueInfo(referConfigToUIUiTable(codeReferConfigVO));
+				if(codeReferConfigVO.getIsPersistence()=="true"){
+					codeReferConfigService.insert(codeReferConfigVO);
+				}
+			}
 
+//			revisionModelUtil.copyFromDTOIgnore(codeBasicSecDTO, codeBasicSecDO);//姝ゅ鐨勬嫹璐濅細鎶妑eferValueInfo鐨勫�肩粰瑕嗙洊鎺夛紝闇�瑕侀噸鏂拌祴鍊�
+			BaseModel tempModel = new BaseModel();
+			BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecDO, tempModel);
+			BeanUtil.copyProperties(codeBasicSecDTO, codeBasicSecDO,"referValueInfo");
+			BeanUtilForVCI.copyPropertiesIgnoreCase(tempModel, codeBasicSecDO);
+			codeBasicSecDO.setId(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getValueFromField("id", codeBasicSecDTO)));
+			codeBasicSecDO.setName(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getValueFromField("name", codeBasicSecDTO)));
+			codeBasicSecDO.setDescription(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getValueFromField("description", codeBasicSecDTO)));
 
-        //灏咲TO杞崲涓篋O
-        CodeBasicSecDO codeBasicSecDO = new CodeBasicSecDO();
-        BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecDTO, codeBasicSecDO);
-        //鎺掑簭鍙凤紝榛樿绛変簬褰撳墠宸叉湁鐨勬暟閲忓姞1
-        Map<String,String> conditionMap = new HashMap<>();
-        conditionMap.put("pkCodeRule",ruleVO.getOid());
-        Long total = codeBasicSecMapper.countByCondition(conditionMap);
-        if(total == null){
-            total = 0L;
-        }
-        codeBasicSecDO.setOrderNum(total.intValue() + 1);
+			resBoolean = codeBasicSecMapper.updateById(codeBasicSecDO)>0;
+			//SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
+			if(StringUtils.isNotBlank(codeBasicSecDO.getCodeFillSeparator())){
+				DictBiz dictBiz = new DictBiz();
+				dictBiz.setCode("codeFillSeparator");
+				dictBiz.setDictKey(codeBasicSecDO.getCodeFillSeparator());
+				dictBiz.setDictValue(codeBasicSecDO.getCodeFillSeparator());
+				//浠庡師鏉ョ殑charService锛堝彲杈撳彲閫夛級鏇存敼涓鸿皟鐢╫md涓殑鎺ュ彛鏉ュ疄鐜�
+				iDictBizClient.getCheck(dictBiz);
+				//charService.save(MdmBtmTypeConstant.CODE_BASIC_SEC,"codefileseparator",codeBasicSecDO.getCodeFillSeparator(),sessionInfo);
+			}
+		}
+		return resBoolean;
+	}
 
-        //琛ヤ綅鐨勬椂鍊欙紝瑕佹帶鍒惰ˉ浣嶅瓧绗�
-        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);
-            }
-        }
-        codeBasicSecMapper.insert(codeBasicSecDO);
-        SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
-        if(StringUtils.isNotBlank(codeBasicSecDO.getCodeFillSeparator())){
-            charService.save(MdmBtmTypeConstant.CODE_BASIC_SEC,"codefileseparator",codeBasicSecDO.getCodeFillSeparator(),sessionInfo);
-        }
-        return codeBasicSecDO2VO(codeBasicSecDO);
-    }
+	/**
+	 * 鏍规嵁鐮佹绫诲瀷鑾峰彇涓嶅彲涓虹┖鐨勫瓧娈�
+	 *
+	 * @param secType 鐮佹绫诲瀷
+	 * @return 涓嶅彲涓虹┖鐨勫瓧娈甸泦鍚�
+	 */
+	private Map<String, String> getNotNullableAttr(String secType) throws ServiceException {
+		Map<String, String> attrMap = new HashMap<>();
+		if (CodeSecTypeEnum.CODE_ATTR_SEC.getValue().equalsIgnoreCase(secType)) {
+			attrMap.put("name", "灞炴�х爜娈靛悕绉�");
+		} else if (CodeSecTypeEnum.CODE_DATE_SEC.getValue().equalsIgnoreCase(secType)) {
+			attrMap.put("name", "鏃ユ湡鐮佹鍚嶇О");
+			attrMap.put("codeDateFormatStr", "鏃ユ湡鏍煎紡");
+		} else if (CodeSecTypeEnum.CODE_FIXED_SEC.getValue().equalsIgnoreCase(secType)) {
+			attrMap.put("name", "鍥哄畾鐮佹鍚嶇О");
+			attrMap.put("codeSecLengthType", "鐮佹闀垮害绫诲瀷");
+			attrMap.put("codeSecLength", "鐮佹鐨勯暱搴�");
+		} else if (CodeSecTypeEnum.CODE_LEVEL_SEC.getValue().equalsIgnoreCase(secType)) {
+			attrMap.put("name", "灞傜骇鐮佹鍚嶇О");
+			attrMap.put("codeLevelType", "灞傜骇绫诲瀷");
+			attrMap.put("valueCutType", "瀛楃鎴彇绫诲瀷");
+		} else if (CodeSecTypeEnum.CODE_REFER_SEC.getValue().equalsIgnoreCase(secType)) {
+			attrMap.put("name", "寮曠敤鐮佹鍚嶇О");
+		} else if (CodeSecTypeEnum.CODE_SERIAL_SEC.getValue().equalsIgnoreCase(secType)) {
+			attrMap.put("name", "娴佹按鐮佹鍚嶇О");
+			attrMap.put("codeSecLength", "鐮佹鐨勯暱搴�");
+			attrMap.put("codeFillType", "缂栫爜琛ヤ綅鏂瑰紡");
+			attrMap.put("codeFillLength", "濉厖闀垮害");
+			attrMap.put("codeFillLimit", "娴佹按涓婇檺");
+			attrMap.put("codeFillFlag", "娴佹按鏄惁琛ョ爜");
+		} else if (CodeSecTypeEnum.CODE_VARIABLE_SEC.getValue().equalsIgnoreCase(secType)) {
+			attrMap.put("name", "鍙彉鐮佹鍚嶇О");
+			attrMap.put("codeSecLength", "鐮佹鐨勯暱搴�");
+			attrMap.put("codeFillType", "缂栫爜琛ヤ綅鏂瑰紡");
+		} else if (CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue().equalsIgnoreCase(secType)) {
+			attrMap.put("name", "鍒嗙被鐮佹鍚嶇О");
+			attrMap.put("codeSecLengthType", "鐮佹闀垮害绫诲瀷");
+			attrMap.put("codeSecLength", "鐮佹鐨勯暱搴�");
+		} else {
+			attrMap = null;
+		}
+		return attrMap;
+	}
 
-    /**
-     * 淇敼鐮佹鍩虹淇℃伅
-     *
-     * @param codeBasicSecDTO 鐮佹鍩虹淇℃伅鏁版嵁浼犺緭瀵硅薄
-     * @return 鎵ц缁撴灉
-     * @throws VciBaseException 鍙傛暟涓虹┖锛屽敮涓�椤癸紝蹇呰緭椤逛笉閫氳繃鏃朵細鎶涘嚭寮傚父
-     */
-    @Override
-    public CodeBasicSecVO editSave(CodeBasicSecDTO codeBasicSecDTO) throws VciBaseException {
-        VciBaseUtil.alertNotNull(codeBasicSecDTO, "闇�瑕佹坊鍔犵殑鏁版嵁瀵硅薄");
-        KeyValue attrKv = checkAttrNullableBySecType(codeBasicSecDTO);
-        if (! "success".equals(attrKv.getKey())){
-            throw new VciBaseException(attrKv.getValue() + "涓嶈兘涓虹┖");
-        }
-        //灏咲TO杞崲涓篋O
-        CodeBasicSecDO codeBasicSecDO = selectByOid(codeBasicSecDTO.getOid());
-        boolean status = codeRuleService.checkEditDelStatus(codeRuleService.getObjectByOid(codeBasicSecDO.getPkCodeRule()).getLcStatus());
-        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);
-            codeBasicSecMapper.updateByPrimaryKey(codeBasicSecDO);
-            SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
-            if(StringUtils.isNotBlank(codeBasicSecDO.getCodeFillSeparator())){
-                charService.save(MdmBtmTypeConstant.CODE_BASIC_SEC,"codefileseparator",codeBasicSecDO.getCodeFillSeparator(),sessionInfo);
-            }
-        }
-        return codeBasicSecDO2VO(codeBasicSecDO);
-    }
+	/**
+	 * 鍒犻櫎鐮佹鍩虹淇℃伅
+	 * @param codeBasicSecDTO 鐮佹鍩虹淇℃伅鏁版嵁浼犺緭瀵硅薄锛宱id鍜宼s闇�瑕佷紶杈�
+	 * @return 鍒犻櫎缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐�
+	 * @throws VciBaseException 鍙傛暟涓虹┖锛岃寮曠敤鏃舵姏鍑哄紓甯�
+	 */
+	@Override
+	public R deleteCodeBasicSec(CodeBasicSecDTO codeBasicSecDTO) throws VciBaseException {
+		VciBaseUtil.alertNotNull(codeBasicSecDTO, "鐮佹鍩虹淇℃伅鏁版嵁瀵硅薄", codeBasicSecDTO.getOid(), "鐮佹鍩虹淇℃伅鐨勪富閿�");
+		return this.deleteCodeBasicSecByPrimaryKey(codeBasicSecDTO.getOid());
+	}
 
+	/**
+	 * 涓婚敭鍒犻櫎鐮佹鍩虹淇℃伅
+	 *
+	 * @param oid 鐮佹鍩虹淇℃伅涓婚敭
+	 * @return 鍒犻櫎缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐�
+	 * @throws VciBaseException 鍙傛暟涓虹┖锛岃寮曠敤鏃舵姏鍑哄紓甯�
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R deleteCodeBasicSecByPrimaryKey(String oid) throws VciBaseException {
+		CodeBasicSec codeBasicSecDO = selectByOid(oid);
+		boolean isLinked = checkIsLinked(codeBasicSecDO.getPkCodeRule(), oid);
+		if (isLinked) {
+			return R.fail("缂栫爜瑙勫垯宸茶寮曠敤锛屼笉鍏佽缂栬緫鎴栧垹闄�");
+		}
+		//鎵ц鍒犻櫎鎿嶄綔
+		boolean eftDeleteBasic = codeBasicSecMapper.deleteById(oid) > 0;
+		if (CodeSecTypeEnum.CODE_FIXED_SEC.getValue().equals(codeBasicSecDO.getSecType())){
+			List<CodeFixedValue> fixedValueDOS = fixedValueMapper.selectList(Wrappers.<CodeFixedValue>query()
+				.lambda().eq(CodeFixedValue::getCodeFixedSecOid,codeBasicSecDO.getOid())
+			);
+			if(!CollectionUtils.isEmpty(fixedValueDOS)){
+				fixedValueMapper.deleteBatchIds(fixedValueDOS.stream().map(CodeFixedValue::getOid).collect(Collectors.toSet()));
+			}
+		}
+		if (CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue().equals(codeBasicSecDO.getSecType())){
+			List<CodeClassifyValue> classifyValueDOS = codeClassifyValueMapper.selectList(Wrappers.<CodeClassifyValue>query()
+				.lambda().eq(CodeClassifyValue::getCodeClassifySecOid,codeBasicSecDO.getOid())
+			);
+			if(!CollectionUtils.isEmpty(classifyValueDOS)) {
+				codeClassifyValueMapper.deleteBatchIds(classifyValueDOS.stream().map(CodeClassifyValue::getOid).collect(Collectors.toSet()));
+			}
+		}
 
-    /**
-     * 鏍¢獙鏄惁鍙互鍒犻櫎锛屽鏋滃瓨鍦ㄤ笅绾э紝骞朵笖涓嬬骇鏈夋暟鎹紩鐢ㄥ垯涓嶈兘鍒犻櫎
-     *
-     * @param codeBasicSecDTO 鏁版嵁浼犺緭瀵硅薄
-     * @param codeBasicSecDO  鏁版嵁搴撲腑鐨勬暟鎹璞�
-     * @return success涓簍rue涓哄彲浠ュ垹闄わ紝false琛ㄧず鏈夋暟鎹紩鐢紝obj涓簍rue琛ㄧず鏈変笅绾�
-     */
-    private BaseResult checkIsCanDeleteForDO(CodeBasicSecDTO codeBasicSecDTO, CodeBasicSecDO codeBasicSecDO) {
-        boService.checkTs(codeBasicSecDTO);
-        if (!checkIsLinked(null, codeBasicSecDO.getOid())) {
-            return BaseResult.success();
-        } else {
-            return BaseResult.fail(DATA_LINKED_NOT_DELETE, new String[]{""});
-        }
-    }
+		return eftDeleteBasic ? R.success(DELETE_SUCCESS) : R.fail(DELETE_FAIL);
+	}
 
-    /**
-     * 鏍¢獙鏄惁琚紩鐢�
-     *
-     * @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.selectByPrimaryKey(codeBasicSecOid).getPkCodeRule()).getLcStatus());
-            if (!status){
-                return true;
-            }
-            boolean alreadyInUse = codeRuleService.isAlreadyInUse(codeBasicSecMapper.selectByPrimaryKey(codeBasicSecOid).getPkCodeRule());
-            if (!alreadyInUse){
-                flag = false;
-            }
-        }
-        return flag;
-    }
+	/**
+	 * 涓婚敭鑾峰彇鐮佹鍩虹淇℃伅
+	 *
+	 * @param oid 涓婚敭
+	 * @return 鐮佹鍩虹淇℃伅鏄剧ず瀵硅薄
+	 * @throws VciBaseException 鍙傛暟涓虹┖锛屾暟鎹笉瀛樺湪鏃朵細鎶涘嚭寮傚父
+	 */
+	@Override
+	public CodeBasicSecVO getObjectByOid(String oid) throws VciBaseException {
+		return CodeBasicSecWrapper.build().entityVO(selectByOid(oid));
+	}
 
-    /**
-     * 鍒犻櫎鐮佹鍩虹淇℃伅
-     *
-     * @param codeBasicSecDTO 鐮佹鍩虹淇℃伅鏁版嵁浼犺緭瀵硅薄锛宱id鍜宼s闇�瑕佷紶杈�
-     * @return 鍒犻櫎缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐�
-     * @throws VciBaseException 鍙傛暟涓虹┖锛岃寮曠敤鏃舵姏鍑哄紓甯�
-     */
-    @Override
-    public BaseResult deleteCodeBasicSec(CodeBasicSecDTO codeBasicSecDTO) throws VciBaseException {
-        VciBaseUtil.alertNotNull(codeBasicSecDTO, "鐮佹鍩虹淇℃伅鏁版嵁瀵硅薄", codeBasicSecDTO.getOid(), "鐮佹鍩虹淇℃伅鐨勪富閿�");
-        return deleteCodeBasicSecByPrimaryKey(codeBasicSecDTO.getOid());
-    }
+	/**
+	 * 涓婚敭鎵归噺鑾峰彇鐮佹鍩虹淇℃伅
+	 *
+	 * @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 oid 鐮佹鍩虹淇℃伅涓婚敭
-     * @return 鍒犻櫎缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐�
-     * @throws VciBaseException 鍙傛暟涓虹┖锛岃寮曠敤鏃舵姏鍑哄紓甯�
-     */
-    @Override
-    public BaseResult deleteCodeBasicSecByPrimaryKey(String oid) throws VciBaseException {
-        CodeBasicSecDO codeBasicSecDO = selectByOid(oid);
-        boolean isLinked = checkIsLinked(codeBasicSecDO.getPkCodeRule(), oid);
-        if (isLinked) {
-            return BaseResult.fail("缂栫爜瑙勫垯宸茶寮曠敤锛屼笉鍏佽缂栬緫鎴栧垹闄�");
-        }
-        Map<String,String> conditionMap = new HashMap<>();
-        //鎵ц鍒犻櫎鎿嶄綔
-        WebUtil.setPersistence(false);
-        BatchCBO batchCBO = codeBasicSecMapper.deleteByPrimaryKey(oid);
-        Set<ClientBusinessObject> deleteSet = new HashSet<>();
-        deleteSet.addAll(batchCBO.getDeleteCbos());
-        if (CodeSecTypeEnum.CODE_FIXED_SEC.getValue().equals(codeBasicSecDO.getSecType())){
-            conditionMap.put("codefixedsecoid",codeBasicSecDO.getOid());
-            VciQueryWrapperForDO wrapper = new VciQueryWrapperForDO(conditionMap, CodeFixedValueDO.class);
-            List<CodeFixedValueDO> fixedValueDOS = fixedValueMapper.selectByWrapper(wrapper);
-            BatchCBO valueCBO = fixedValueMapper.batchDeleteByOids(fixedValueDOS.stream().map(CodeFixedValueDO::getOid).collect(Collectors.toSet()));
-            deleteSet.addAll(valueCBO.getDeleteCbos());
-        }
-        if (CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue().equals(codeBasicSecDO.getSecType())){
-            conditionMap.put("codeclassifysecoid",codeBasicSecDO.getOid());
-            VciQueryWrapperForDO wrapper = new VciQueryWrapperForDO(conditionMap, CodeClassifyValueDO.class);
-            List<CodeClassifyValueDO> classifyValueDOS = codeClassifyValueMapper.selectByWrapper(wrapper);
-            if(!CollectionUtils.isEmpty(classifyValueDOS)) {
-                BatchCBO valueCBO = codeClassifyValueMapper.batchDeleteByOids(classifyValueDOS.stream().map(CodeClassifyValueDO::getOid).collect(Collectors.toSet()));
-                deleteSet.addAll(valueCBO.getDeleteCbos());
-            }
-        }
-        batchCBO.setDeleteCbos(deleteSet);
-        WebUtil.setPersistence(true);
-        boService.persistenceBatch(batchCBO);
-        return (batchCBO != null && batchCBO.getDeleteCbos() != null && batchCBO.getDeleteCbos().size() > 0) ? BaseResult.successMsg(DELETE_SUCCESS) : BaseResult.fail(DELETE_FAIL);
-    }
+	/**
+	 * 鍙傜収鐮佹鍩虹淇℃伅鍒楄〃
+	 *
+	 * @param conditionMap 鏌ヨ鏉′欢
+	 * @param query 鍒嗛〉鍜屾帓搴�
+	 * @return 鐮佹鍩虹淇℃伅鏄剧ず瀵硅薄鍒楄〃锛岀敓鏁堢殑鍐呭
+	 * @throws VciBaseException 鏌ヨ鏉′欢鍜屽垎椤靛嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
+	 */
+	@Override
+	public IPage<CodeBasicSecVO> refDataGridCodeBasicSec(Query query ,Map<String,Object> conditionMap) throws VciBaseException {
+		return gridCodeBasicSec(query,conditionMap);
+	}
 
-    /**
-     * 涓婚敭鑾峰彇鐮佹鍩虹淇℃伅
-     *
-     * @param oid 涓婚敭
-     * @return 鐮佹鍩虹淇℃伅鏄剧ず瀵硅薄
-     * @throws VciBaseException 鍙傛暟涓虹┖锛屾暟鎹笉瀛樺湪鏃朵細鎶涘嚭寮傚父
-     */
-    @Override
-    public CodeBasicSecVO getObjectByOid(String oid) throws VciBaseException {
-        return codeBasicSecDO2VO(selectByOid(oid));
-    }
+	/**
+	 * 鍙傜収鍒嗙被鐨勭爜娈�
+	 * @param conditionMap 鏌ヨ鏉′欢
+	 * @param query 鍒嗛〉鍜屾帓搴�
+	 * @return 鐮佹鐨勫唴瀹�
+	 */
+	@Override
+	public IPage<CodeBasicSecVO> refDataGridClassifySec(Query query ,Map<String,Object> conditionMap) throws VciBaseException {
+		if(Func.isEmpty(conditionMap.get("pkCodeRule"))){
+			return null;
+		}
+		conditionMap.put("secType",(CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue()));
+		return refDataGridCodeBasicSec(query.setAscs("orderNum"),conditionMap);
+	}
 
-    /**
-     * 涓婚敭鏌ヨ鏁版嵁瀵硅薄
-     *
-     * @param oid 涓婚敭
-     * @return 鏁版嵁瀵硅薄
-     * @throws VciBaseException 鍙傛暟涓虹┖锛屽苟涓旀暟鎹笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
-     */
-    private CodeBasicSecDO selectByOid(String oid) throws VciBaseException {
-        VciBaseUtil.alertNotNull(oid, "涓婚敭");
-        CodeBasicSecDO codeBasicSecDO = codeBasicSecMapper.selectByPrimaryKey(oid.trim());
-        if (codeBasicSecDO == null || StringUtils.isBlank(codeBasicSecDO.getOid())) {
-            throw new VciBaseException(DATA_OID_NOT_EXIST);
-        }
-        return codeBasicSecDO;
-    }
+	/**
+	 * 鍏嬮殕鐮佹淇℃伅
+	 *
+	 * @param oidList 婧愮爜娈典俊鎭富閿泦鍚�
+	 * @param pkCodeRule 鐩爣缂栫爜瑙勫垯
+	 * @return 鍏嬮殕缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐�
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R cloneCodeBasicSec(List<String> oidList, String pkCodeRule) throws ServiceException, ServerException {
+		boolean isLinked = checkIsLinked(pkCodeRule,null);
+		if (isLinked) {
+			return R.fail("缂栫爜瑙勫垯宸茶寮曠敤锛屼笉鍏佽缂栬緫鎴栧垹闄�");
+		}
+		List<CodeBasicSec> createList = new ArrayList<>();
+		List<CodeBasicSec> basicSecDOS = codeBasicSecMapper.selectBatchIds(oidList);
+		if(basicSecDOS.isEmpty()){
+			return R.fail("鍏嬮殕鐨勭爜娈典俊鎭笉瀛樺湪锛�");
+		}
+		List<CodeBasicSec> codeClassifySec = new ArrayList<>();
+		Map<String,List<CodeFixedValue>> codeFixedValueMaps = new HashMap<>();
+		for (CodeBasicSec sec : basicSecDOS) {
+			CodeBasicSec newSecDO = new CodeBasicSec();
+			BeanUtilForVCI.copyPropertiesIgnoreCase(sec,newSecDO);
+			String oldBasicOid = newSecDO.getOid();
+			newSecDO.setId(newSecDO.getId());
+			newSecDO.setName(newSecDO.getName());
+			newSecDO.setPkCodeRule(pkCodeRule);
+			// 鍒ゆ柇鏄惁鏄垎绫荤爜娈�,涓氬姟閫昏緫绋嶅井澶嶆潅涓�鐐规墍浠ラ渶瑕佸厛鎻愬嚭鏉ュ崟鐙鐞�
+			if(newSecDO.getSecType().equals(CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue())){
+				// 瀛樺偍鏃х殑鐮佹oid鍜屾柊鐨勭爜娈电殑oid鐨勫叧鑱斿叧绯�
+				codeClassifySec.add(newSecDO);
+				continue;
+			}
+			// 鏇存敼鍒涘缓鏃堕棿锛屼慨鏀规椂闂寸瓑榛樿鍊�
+			DefaultAttrAssimtUtil.addDefaultAttrAssimt(newSecDO,MdmBtmTypeConstant.CODE_BASIC_SEC);
+			//鍥哄畾鐮佹
+			if(newSecDO.getSecType().equals(CodeSecTypeEnum.CODE_FIXED_SEC.getValue())){
+				// 鍥哄畾鐮佹瀛樺偍濂給id鍜岀爜鍊肩殑鍏宠仈鍏崇郴
+				codeFixedValueMaps.put(newSecDO.getOid(),fixedValueService.list(Wrappers.<CodeFixedValue>query()
+					.lambda().eq(CodeFixedValue::getCodeFixedSecOid, oldBasicOid)
+				));
+			}
+			createList.add(newSecDO);
+		}
+		// 澶勭悊鍒嗙被鐮佹鐨刼id锛屽洜涓簅id鍏宠仈parentClassifyOid锛屼笌鐮佸�糲odeClassifyOid锛岀爜鍊煎張闇�瑕侀�氳繃鏃х殑鐮佹oid鏉ユ煡璇紝鎵�浠ヤ笉鑳界洿鎺ユ敼鍙榦id
+		boolean resChangeAssn = changeParentOidAssnOid(codeClassifySec);
+		// 灏嗗鐞嗚繃鐨勫垎绫荤爜娈典篃娣诲姞杩涜鍋氭柊澧炲鐞嗙殑鐮佹闆嗗悎涓�
+		createList.addAll(codeClassifySec);
+		boolean resBoolean = saveBatch(createList);
+		// 鏈�缁堣瀛樺叆鐮佸�艰〃涓殑锛岀爜鍊煎璞�
+		List<CodeFixedValue> codeFixedDOValues = new ArrayList<>();
+		// 鏋勯�犵爜鍊煎璞★紝涓庣爜娈典富閿叧鑱斿叧绯伙紝浠ュ強鏀瑰彉鍥哄畾鐮佸�肩殑oid
+		codeFixedValueMaps.forEach((key, value) -> {
+			value.stream().forEach(item -> {
+				item.setOid("");
+				item.setCodeFixedSecOid(key);
+				DefaultAttrAssimtUtil.updateDefaultAttrAssimt(item);
+				codeFixedDOValues.add(item);
+			});
+		});
+		// 鍏嬮殕鍥哄畾鐮佸��
+		boolean resFixed = fixedValueService.saveBatch(codeFixedDOValues);
+		return (resBoolean&&resFixed&&resChangeAssn) ? R.data(resBoolean,"鍏嬮殕鐮佹淇℃伅鎴愬姛"):R.fail("鍏嬮殕鐮佹淇℃伅澶辫触锛�");
+	}
 
-    /**
-     * 涓婚敭鎵归噺鑾峰彇鐮佹鍩虹淇℃伅
-     *
-     * @param oidCollections 涓婚敭闆嗗悎锛屼絾鏄彈鎬ц兘褰卞搷锛屽缓璁竴娆℃煡璇笉瓒呰繃10000涓�
-     * @return 鐮佹鍩虹淇℃伅鏄剧ず瀵硅薄
-     * @throws VciBaseException 鏌ヨ鍑虹幇寮傚父鏃朵細鎶涘嚭
-     */
-    @Override
-    public Collection<CodeBasicSecVO> listCodeBasicSecByOids(Collection<String> oidCollections) throws VciBaseException {
-        VciBaseUtil.alertNotNull(oidCollections, "鏁版嵁瀵硅薄涓婚敭闆嗗悎");
-        List<CodeBasicSecDO> codeBasicSecDOList = listCodeBasicSecDOByOidCollections(oidCollections);
-        return codeBasicSecDO2VOs(codeBasicSecDOList);
-    }
+	/**
+	 * 鏀瑰彉鐮佹涓埗鍒嗙被鐮佹鍜屽瓙鍒嗙被鐮佹涔嬮棿鐨勫叧鑱攐id涓烘柊鐨刼id,骞朵笖涓嶇牬鍧忓垎绫荤爜鍊肩殑鍏宠仈鍏崇郴
+	 * @param basicSecs
+	 * @return
+	 * @throws ServerException
+	 */
+	@Override
+	public boolean changeParentOidAssnOid(List<CodeBasicSec> basicSecs) throws ServerException {
+		Map<String, List<CodeClassifyValue>> codeClassValues = new HashMap<>();
+		List<CodeClassifyValue> codeClassifyDOValues = new ArrayList<>();
+		HashMap<String, String> oidMap = new HashMap<>();
+		boolean resClone = false;
+		try {
+			// 閬嶅巻瀵硅薄鏁扮粍锛屼负姣忎釜瀵硅薄鐢熸垚鏂扮殑oid锛屽苟灏嗗師濮媜id鍜屾柊oid鐨勬槧灏勫叧绯诲瓨鍌ㄥ埌Map涓�
+			for (CodeBasicSec obj : basicSecs) {
+				String originalOid = obj.getOid();
+				String newOid = VciBaseUtil.getPk();
+				oidMap.put(originalOid, newOid);
+			}
+			// 閬嶅巻瀵硅薄鏁扮粍锛屾洿鏂版瘡涓璞$殑oid鍜宑odeClassifySecOid灞炴�у��
+			for (CodeBasicSec obj : basicSecs) {
+				String originalOid = obj.getOid();
+				String newOid = oidMap.get(originalOid);
+				// 鏂扮殑oid鍏宠仈瑕佸厠闅嗙爜鍊�
+				codeClassValues.put(newOid,codeClassifyValueService.list(Wrappers.<CodeClassifyValue>query()
+					.lambda().eq(CodeClassifyValue::getCodeClassifySecOid, originalOid)));
+				obj.setOid(newOid);
+				String originalParentClassifyValueOid = obj.getParentClassifySecOid();
+				String newParentClassifyValueOid = oidMap.get(originalParentClassifyValueOid);
+				obj.setParentClassifySecOid(newParentClassifyValueOid);
+			}
+			codeClassValues.forEach((key, value) -> {
+				value.stream().forEach(item -> {
+					DefaultAttrAssimtUtil.updateDefaultAttrAssimt(item);
+					item.setCodeClassifySecOid(key);
+					codeClassifyDOValues.add(item);
+				});
+			});
+			resClone = codeClassifyValueService.cloneCodeClassifyVaue(codeClassifyDOValues);
+		}catch (Exception e){
+			throw new ServerException("鐖跺垎绫荤爜娈靛拰瀛愬垎绫荤爜娈礳lone杞崲oid鏃跺嚭閿欙細"+e.getCause());
+		}
+		return resClone;
+	}
 
-    /**
-     * 浣跨敤涓婚敭闆嗗悎鏌ヨ鏁版嵁瀵硅薄
-     *
-     * @param oidCollections 涓婚敭鐨勯泦鍚�
-     * @return 鏁版嵁瀵硅薄鍒楄〃
-     */
-    private List<CodeBasicSecDO> listCodeBasicSecDOByOidCollections(Collection<String> oidCollections) {
-        List<CodeBasicSecDO> codeBasicSecDOList = new ArrayList<CodeBasicSecDO>();
-        if (!CollectionUtils.isEmpty(oidCollections)) {
-            Collection<Collection<String>> oidCollectionsList = VciBaseUtil.switchCollectionForOracleIn(oidCollections);
-            for (Collection<String> oids : oidCollectionsList) {
-                List<CodeBasicSecDO> tempDOList = codeBasicSecMapper.selectByPrimaryKeyCollection(oids);
-                if (!CollectionUtils.isEmpty(tempDOList)) {
-                    codeBasicSecDOList.addAll(tempDOList);
-                }
-            }
-        }
-        return codeBasicSecDOList;
-    }
+	/**
+	 * 鏌ヨ鐩爣鍒嗙被鐮佹鎵�鍦ㄧ殑鏍戠粨鏋�
+	 *
+	 * @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) throws ServiceException{
+		CodeBasicSec secDO = selectByOid(oid);
+		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);
+				codeBasicSecMapper.update(null, Wrappers.<CodeBasicSec>update()
+					.lambda().set(CodeBasicSec::getOrderNum, lastSec.getOrderNum() + 1)
+					.eq(CodeBasicSec::getOid, lastSec.getOid())
+				);
+			}
+			codeBasicSecMapper.update(null, Wrappers.<CodeBasicSec>update()
+				.lambda().set(CodeBasicSec::getOrderNum, secDO.getOrderNum() - 1)
+				.eq(CodeBasicSec::getOid, secDO.getOid())
+			);
+		}
+		return true;
+	}
 
-    /**
-     * 鍙傜収鐮佹鍩虹淇℃伅鍒楄〃
-     *
-     * @param conditionMap 鏌ヨ鏉′欢
-     * @param pageHelper   鍒嗛〉鍜屾帓搴�
-     * @return 鐮佹鍩虹淇℃伅鏄剧ず瀵硅薄鍒楄〃锛岀敓鏁堢殑鍐呭
-     * @throws VciBaseException 鏌ヨ鏉′欢鍜屽垎椤靛嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
-     */
-    @Override
-    public DataGrid<CodeBasicSecVO> refDataGridCodeBasicSec(Map<String, String> conditionMap, PageHelper pageHelper) throws VciBaseException {
-        if (conditionMap == null) {
-            conditionMap = new HashMap<String, String>();
-        }
-        return gridCodeBasicSec(conditionMap, pageHelper);
-    }
+	/**
+	 * 涓嬬Щ
+	 *
+	 * @param oid 涓婚敭
+	 */
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public boolean downOrderNum(String oid) throws ServiceException {
+		CodeBasicSec secDO = selectByOid(oid);
+		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,secDO.getOrderNum()+1)
+				.eq(CodeBasicSec::getPkCodeRule,secDO.getPkCodeRule())
+			);
+			if(!CollectionUtils.isEmpty(lastSecDOs)){
+				CodeBasicSec lastSec = lastSecDOs.get(0);
+				codeBasicSecMapper.update(null, Wrappers.<CodeBasicSec>update()
+					.lambda().set(CodeBasicSec::getOrderNum, lastSec.getOrderNum() - 1)
+					.eq(CodeBasicSec::getOid, lastSec.getOid())
+				);
+			}
+			codeBasicSecMapper.update(null, Wrappers.<CodeBasicSec>update()
+				.lambda().set(CodeBasicSec::getOrderNum, secDO.getOrderNum() + 1)
+				.eq(CodeBasicSec::getOid, secDO.getOid())
+			);
+		}
+		return true;
+	}
 
-    /**
-     * 鍏嬮殕鐮佹淇℃伅
-     *
-     * @param oidList 婧愮爜娈典俊鎭富閿泦鍚�
-     * @param pkCodeRule 鐩爣缂栫爜瑙勫垯
-     * @return 鍏嬮殕缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐�
-     */
-    @Override
-    public BaseResult cloneCodeBasicSec(List<String> oidList, String pkCodeRule) {
-        boolean isLinked = checkIsLinked(pkCodeRule,null);
-        if (isLinked) {
-            return BaseResult.fail("缂栫爜瑙勫垯宸茶寮曠敤锛屼笉鍏佽缂栬緫鎴栧垹闄�");
-        }
-        List<CodeBasicSecDO> createList = new ArrayList<>();
-        List<CodeBasicSecDO> basicSecDOS = codeBasicSecMapper.selectByPrimaryKeyCollection(oidList);
-        basicSecDOS.forEach(sec -> {
-            CodeBasicSecDO newSecDO = new CodeBasicSecDO();
-            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);
-        });
-        codeBasicSecMapper.batchInsert(createList);
-        return BaseResult.success();
-    }
+	/**
+	 * 鏍戝舰缁撴瀯鏌ヨoid
+	 * @param codeClassifySecOid
+	 * @return
+	 */
+	@Override
+	public List<String> getOidByCodeclassifysecOid(String codeClassifySecOid)throws ServiceException {
+		return codeBasicSecMapper.getOidByCodeclassifysecOid(codeClassifySecOid.trim());
+	}
 
-    /**
-     * 鏍规嵁鐮佹鍒嗙被鐨勭被鍨嬪垽鏂睘鎬ф槸鍚︽槸绌虹殑
-     *
-     * @param codeBasicSecDTO 鐮佹鍩虹淇℃伅鏁版嵁浼犺緭瀵硅薄
-     * @return 鏈夌┖鐨勫垯浼爇ey-灞炴�у悕 value-瀛楁鍚箟锛屾病鏈夌┖鐨勫垯浼� key-success value-true
-     */
-    @Override
-    public KeyValue checkAttrNullableBySecType(CodeBasicSecDTO codeBasicSecDTO) {
-        VciBaseUtil.alertNotNull(codeBasicSecDTO.getSectype(), "鐮佹鍒嗙被");
-        String secType = codeBasicSecDTO.getSectype();
-        HashMap<String, String> attrMap = JSONObject.parseObject(JSONObject.toJSONString(codeBasicSecDTO), HashMap.class);
-        Map<String, String> notNullableAttr = getNotNullableAttr(secType);
-        if (notNullableAttr == null) {
-            throw new VciBaseException("鐮佹鍒嗙被濉啓鍑洪敊锛岃鏌ラ獙鍚庨噸璇�");
-        }
-        for (String key : notNullableAttr.keySet()) {
-            if (StringUtils.isBlank(WebUtil.getStringValueFromObject(attrMap.get(key)))) {
-                KeyValue kv = new KeyValue();
-                kv.setKey(key);
-                kv.setValue(notNullableAttr.get(key));
-                return kv;
-            }
-        }
-        KeyValue kv = new KeyValue();
-        kv.setKey("success");
-        kv.setValue("true");
-        return kv;
-    }
+	/**
+	 * 鏍¢獙鏄惁琚紩鐢�
+	 *
+	 * @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 ruleOid 瑙勫垯鐨勫唴瀹�
-     * @return 鐮佹鐨勫唴瀹�
-     */
-    @Override
-    public List<CodeBasicSecVO> listCodeBasicSecByRuleOid(String ruleOid) {
-        if(StringUtils.isBlank(ruleOid)){
-            return new ArrayList<>();
-        }
-        Map<String,String> conditionMap = new HashMap<>();
-        conditionMap.put("pkCodeRule",ruleOid);
-        PageHelper pageHelper = new PageHelper(-1);
-        pageHelper.addDefaultAsc("ordernum");
-        List<CodeBasicSecDO> secDOList = codeBasicSecMapper.selectByCondition(conditionMap, pageHelper);
-        return codeBasicSecDO2VOs(secDOList,true);
-    }
+	/**
+	 * 浣跨敤涓婚敭闆嗗悎鏌ヨ鏁版嵁瀵硅薄
+	 *
+	 * @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 ruleCollection 瑙勫垯涓婚敭闆嗗悎
-     * @return 鐮佹鐨勫唴瀹�
-     */
-    @Override
-    public List<CodeBasicSecVO> listCodeBasicSecByRuleOids(Collection<String> ruleCollection) {
-        if(CollectionUtils.isEmpty(ruleCollection)){
-            return new ArrayList<>();
-        }
-        List<CodeBasicSecDO> secDOList = new CopyOnWriteArrayList<>();
-        SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
-        VciBaseUtil.switchCollectionForOracleIn(ruleCollection).parallelStream().forEach(ruleOids->{
-            WebUtil.setCurrentUserSessionInfo(sessionInfo);
-            Map<String,String> conditionMap = new HashMap<>();
-            conditionMap.put("pkcoderule", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(ruleOids.toArray(new String[0])) + ")");
-            PageHelper pageHelper = new PageHelper(-1);
-            pageHelper.addDefaultAsc("ordernum");
-            List<CodeBasicSecDO> tempSecDOs = codeBasicSecMapper.selectByCondition(conditionMap, pageHelper);
-            if(!CollectionUtils.isEmpty(tempSecDOs)){
-                secDOList.addAll(tempSecDOs);
-            }
-        });
-        return codeBasicSecDO2VOs(secDOList);
-    }
+	/**
+	 * 涓婚敭鏌ヨ鏁版嵁瀵硅薄
+	 *
+	 * @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;
+	}
 
-    /**
-     * 鍙傜収鍒嗙被鐨勭爜娈�
-     *
-     * @param conditionMap 鏌ヨ鏉′欢锛屽繀椤昏鏈塸kCodeRule
-     * @param pageHelper   鍒嗛〉鐨勫璞�
-     * @return 鐮佹鐨勫唴瀹�
-     */
-    @Override
-    public DataGrid<CodeBasicSecVO> refDataGridClassifySec(Map<String, String> conditionMap, PageHelper pageHelper) {
-        if(CollectionUtils.isEmpty(conditionMap) || !conditionMap.containsKey("pkCodeRule")){
-            return new DataGrid<>();
-        }
-        conditionMap.put("secType",CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue());
-        return refDataGridCodeBasicSec(conditionMap,pageHelper);
-    }
+	/**
+	 * 浣跨敤瑙勫垯鐨勪富閿幏鍙栧搴旂殑鐮佹鍐呭
+	 *
+	 * @param ruleOid 瑙勫垯鐨勫唴瀹�
+	 * @return 鐮佹鐨勫唴瀹�
+	 */
+	@Override
+	public List<CodeBasicSecVO> listCodeBasicSecByRuleOid(String ruleOid)throws ServiceException {
+		if(StringUtils.isBlank(ruleOid)){
+			return new ArrayList<>();
+		}
+		LambdaQueryWrapper<CodeBasicSec> wrapper = Wrappers.<CodeBasicSec>query().lambda()
+			.eq(CodeBasicSec::getPkCodeRule, ruleOid)
+			.orderByAsc(CodeBasicSec::getOrderNum);
+		List<CodeBasicSec> secDOList = baseMapper.selectList(wrapper);//
+		return codeBasicSecDO2VOs(secDOList,true);
+	}
 
-    /**
-     * 鏍规嵁鐮佹绫诲瀷鑾峰彇涓嶅彲涓虹┖鐨勫瓧娈�
-     *
-     * @param secType 鐮佹绫诲瀷
-     * @return 涓嶅彲涓虹┖鐨勫瓧娈甸泦鍚�
-     */
-    private Map<String, String> getNotNullableAttr(String secType) {
-        Map<String, String> attrMap = new HashMap<>();
-        if (CodeSecTypeEnum.CODE_ATTR_SEC.getValue().equalsIgnoreCase(secType)) {
-            attrMap.put("name", "灞炴�х爜娈靛悕绉�");
-        } else if (CodeSecTypeEnum.CODE_DATE_SEC.getValue().equalsIgnoreCase(secType)) {
-            attrMap.put("name", "鏃ユ湡鐮佹鍚嶇О");
-            attrMap.put("codeDateFormatStr", "鏃ユ湡鏍煎紡");
-        } else if (CodeSecTypeEnum.CODE_FIXED_SEC.getValue().equalsIgnoreCase(secType)) {
-            attrMap.put("name", "鍥哄畾鐮佹鍚嶇О");
-            attrMap.put("codeSecLengthType", "鐮佹闀垮害绫诲瀷");
-            attrMap.put("codeSecLength", "鐮佹鐨勯暱搴�");
-        } else if (CodeSecTypeEnum.CODE_LEVEL_SEC.getValue().equalsIgnoreCase(secType)) {
-            attrMap.put("name", "灞傜骇鐮佹鍚嶇О");
-            attrMap.put("codeLevelType", "灞傜骇绫诲瀷");
-            attrMap.put("valueCutType", "瀛楃鎴彇绫诲瀷");
-        } else if (CodeSecTypeEnum.CODE_REFER_SEC.getValue().equalsIgnoreCase(secType)) {
-            attrMap.put("name", "寮曠敤鐮佹鍚嶇О");
-        } else if (CodeSecTypeEnum.CODE_SERIAL_SEC.getValue().equalsIgnoreCase(secType)) {
-            attrMap.put("name", "娴佹按鐮佹鍚嶇О");
-            attrMap.put("codeSecLength", "鐮佹鐨勯暱搴�");
-            attrMap.put("codeFillType", "缂栫爜琛ヤ綅鏂瑰紡");
-            attrMap.put("codeFillLength", "濉厖闀垮害");
-            attrMap.put("codeFillLimit", "娴佹按涓婇檺");
-            attrMap.put("codeFillFlag", "娴佹按鏄惁琛ョ爜");
-        } else if (CodeSecTypeEnum.CODE_VARIABLE_SEC.getValue().equalsIgnoreCase(secType)) {
-            attrMap.put("name", "鍙彉鐮佹鍚嶇О");
-            attrMap.put("codeSecLength", "鐮佹鐨勯暱搴�");
-            attrMap.put("codeFillType", "缂栫爜琛ヤ綅鏂瑰紡");
-        } else if (CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue().equalsIgnoreCase(secType)) {
-            attrMap.put("name", "鍒嗙被鐮佹鍚嶇О");
-            attrMap.put("codeSecLengthType", "鐮佹闀垮害绫诲瀷");
-            attrMap.put("codeSecLength", "鐮佹鐨勯暱搴�");
-        } else {
-            attrMap = null;
-        }
-        return attrMap;
-    }
+	/**
+	 * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
+	 *
+	 * @param codeBasicSecDOs 鏁版嵁瀵硅薄鍒楄〃
+	 * @param hasFixedValue 鏄惁鏈夊浐瀹氬��
+	 * @return 鏄剧ず瀵硅薄
+	 * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
+	 */
+	@Override
+	public List<CodeBasicSecVO> codeBasicSecDO2VOs(Collection<CodeBasicSec> codeBasicSecDOs, boolean hasFixedValue) throws VciBaseException {
+		List<CodeBasicSecVO> voList = new ArrayList<CodeBasicSecVO>();
+		if (!CollectionUtils.isEmpty(codeBasicSecDOs)) {
+			for (CodeBasicSec s : codeBasicSecDOs) {
+				CodeBasicSecVO vo = codeBasicSecDO2VO(s);
+				if (vo != null) {
+					voList.add(vo);
+				}
+			}
+		}
+		if(hasFixedValue && !CollectionUtils.isEmpty(voList)){
+			List<CodeBasicSecVO> fixedSecVOList = voList.stream().filter(s -> CodeSecTypeEnum.CODE_FIXED_SEC.getValue().equalsIgnoreCase(s.getSecType())).collect(Collectors.toList());
+			if(!CollectionUtils.isEmpty(fixedSecVOList)){
+				//鏌ヨ鍥哄畾鐮佺殑鐮佸��
+				Map<String, List<CodeFixedValueVO>> secValueMap = fixedValueService.listCodeFixedValueBySecOids(fixedSecVOList.stream().map(CodeBasicSecVO::getOid).collect(Collectors.toList()));
+				voList.stream().forEach(vo->{
+					vo.setFixedValueVOList(secValueMap.getOrDefault(vo.getOid(),null));
+				});
+			}
+		}
+		return voList;
+	}
 
-    /**
-     * 鏌ヨ鐩爣鍒嗙被鐮佹鎵�鍦ㄧ殑鏍戠粨鏋�
-     *
-     * @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(CodeBasicSecDO.class);
-        wrapper.childQueryParent(queryOption);
-        List<CodeBasicSecDO> 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 codeBasicSecDOs 鏁版嵁瀵硅薄鍒楄〃
+	 * @return 鏄剧ず瀵硅薄
+	 * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
+	 */
+	@Override
+	public List<CodeBasicSecVO> codeBasicSecDO2VOs(Collection<CodeBasicSec> codeBasicSecDOs) throws VciBaseException {
+		List<CodeBasicSecVO> voList = new ArrayList<CodeBasicSecVO>();
+		if (!CollectionUtils.isEmpty(codeBasicSecDOs)) {
+			for (CodeBasicSec s : codeBasicSecDOs) {
+				CodeBasicSecVO vo = codeBasicSecDO2VO(s);
+				if (vo != null) {
+					voList.add(vo);
+				}
+			}
+		}
+		return voList;
+	}
 
-    /**
-     * 鏍规嵁缂栫爜瑙勫垯鎵归噺鍒犻櫎鐮佹鍩烘湰淇℃伅
-     * @param codeRuleOid 缂栫爜瑙勫垯涓婚敭
-     * @return 鎵ц缁撴灉
-     */
-    @Override
-    public BatchCBO batchDeleteSecByCodeRuleOid(String codeRuleOid) {
-        VciBaseUtil.alertNotNull(codeRuleOid,"缂栫爜瑙勫垯涓婚敭");
-        Map<String,String> conditionMap = new HashMap<>();
-        conditionMap.put("pkcoderule",codeRuleOid);
-        VciQueryWrapperForDO wrapper = new VciQueryWrapperForDO(conditionMap,CodeBasicSecDO.class);
-        List<CodeBasicSecDO> deleteList = codeBasicSecMapper.selectByWrapper(wrapper);
-        if (CollectionUtils.isEmpty(deleteList)){
-            return new BatchCBO();
-        }
-        BatchCBO batchCBO = codeBasicSecMapper.batchDeleteByOids(deleteList.stream().map(CodeBasicSecDO::getOid).collect(Collectors.toSet()));
-        Set<ClientBusinessObject> deleteSet = new HashSet<>();
-        deleteSet.addAll(batchCBO.getDeleteCbos());
-        List<CodeBasicSecDO> fixedSecList = deleteList.stream().filter(sec -> {
-            return CodeSecTypeEnum.CODE_FIXED_SEC.getValue().equals(sec.getSecType());
-        }).collect(Collectors.toList());
-        List<CodeBasicSecDO> classifySecList = deleteList.stream().filter(sec -> {
-            return CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue().equals(sec.getSecType());
-        }).collect(Collectors.toList());
-        Set<String> fixedSecOidSet = fixedSecList.stream().map(CodeBasicSecDO::getOid).collect(Collectors.toSet());
-        Set<String> classifySecOidSet = classifySecList.stream().map(CodeBasicSecDO::getOid).collect(Collectors.toSet());
-        if (!CollectionUtils.isEmpty(fixedSecOidSet)){
-            StringBuilder sb = new StringBuilder();
-            fixedSecOidSet.stream().forEach(oid -> {
-                sb.append("'").append(oid).append("',");
-            });
-            String inSql = sb.toString().substring(0,sb.toString().length()-1);
-            VciQueryWrapperForDO wrapperForValue = new VciQueryWrapperForDO(null,CodeFixedValueDO.class);
-            PageHelper ph = new PageHelper();
-            ph.setLimit(-1);
-            wrapperForValue.in("codefixedsecoid",inSql);
-            List<CodeFixedValueDO> fixedValueDOS = fixedValueMapper.selectByWrapper(wrapperForValue);
-            BatchCBO fixedCBO = fixedValueMapper.batchDeleteByOids(fixedValueDOS.stream().map(CodeFixedValueDO::getOid).collect(Collectors.toSet()));
-            deleteSet.addAll(fixedCBO.getDeleteCbos());
-        }
-        if (!CollectionUtils.isEmpty(classifySecOidSet)){
-            StringBuilder sb = new StringBuilder();
-            classifySecOidSet.stream().forEach(oid -> {
-                sb.append("'").append(oid).append("',");
-            });
-            String inSql = sb.toString().substring(0,sb.toString().length()-1);
-            VciQueryWrapperForDO wrapperForValue = new VciQueryWrapperForDO(null,CodeClassifyValueDO.class);
-            PageHelper ph = new PageHelper();
-            ph.setLimit(-1);
-            wrapperForValue.in("codeclassifysecoid",inSql);
-            List<CodeClassifyValueDO> classifyValueDOS = codeClassifyValueMapper.selectByWrapper(wrapperForValue);
-            BatchCBO fixedCBO = codeClassifyValueMapper.batchDeleteByOids(classifyValueDOS.stream().map(CodeClassifyValueDO::getOid).collect(Collectors.toSet()));
-            deleteSet.addAll(fixedCBO.getDeleteCbos());
-        }
-        batchCBO.setDeleteCbos(deleteSet);
-        return batchCBO;
-    }
+	/**
+	 * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
+	 *
+	 * @param codeBasicSecDO 鏁版嵁瀵硅薄
+	 * @return 鏄剧ず瀵硅薄
+	 * @throws VciBaseException 鎷疯礉灞炴�у嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
+	 */
+	@Override
+	public CodeBasicSecVO codeBasicSecDO2VO(CodeBasicSec codeBasicSecDO) throws VciBaseException {
+		CodeBasicSecVO codeBasicSecVO = new CodeBasicSecVO();
+		if (codeBasicSecDO != null) {
+			BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecDO, codeBasicSecVO);
+			if(StringUtils.isNotBlank(codeBasicSecDO.getSecType())){
+				codeBasicSecVO.setSecTypeText(EnumCache.getValue(EnumEnum.CODE_SEC_TYPE,codeBasicSecDO.getSecType()));
+			}
+			if(StringUtils.isNotBlank(codeBasicSecDO.getCodeLevelType())){
+				codeBasicSecVO.setCodeLevelTypeText(EnumCache.getValue(EnumEnum.CODE_LEVEL_TYPE,codeBasicSecDO.getCodeLevelType()));
+			}
+			if(StringUtils.isNotBlank(codeBasicSecDO.getCodeSecLengthType())){
+				codeBasicSecVO.setCodeSecLengthTypeText(EnumCache.getValue(EnumEnum.CODE_SEC_LENGTH,codeBasicSecDO.getCodeSecLengthType()));
+			}
+			if(StringUtils.isNotBlank(codeBasicSecDO.getValueCutType())){
+				codeBasicSecVO.setValueCutTypeText(EnumCache.getValue(EnumEnum.CODE_CUT_TYPE,codeBasicSecDO.getValueCutType()));
+			}
+			if(StringUtils.isNotBlank(codeBasicSecDO.getCodeGetValueType())){
+				codeBasicSecVO.setCodeGetValueTypeText(EnumCache.getValue(EnumEnum.CODE_GET_VALUE_TYPE,codeBasicSecDO.getCodeGetValueType()));
+			}
+			// 濡傛灉鏄垎绫荤爜娈甸渶瑕佹煡璇㈡墍灞炲垎绫荤殑涓枃鍚嶇О
+			if(codeBasicSecDO.getSecType().equals("codeclassifysec") && Func.isNotEmpty(codeBasicSecDO.getParentClassifySecOid())){
+				CodeBasicSec codeBasicSec = codeBasicSecMapper.selectOne(Wrappers.<CodeBasicSec>query().lambda()
+					.eq(CodeBasicSec::getOid, codeBasicSecDO.getParentClassifySecOid())
+					.eq(CodeBasicSec::getSecType, codeBasicSecDO.getSecType()));
+				if(Func.isNotEmpty(codeBasicSec)){
+					codeBasicSecVO.setParentClassifySecOid(codeBasicSec.getOid());
+					codeBasicSecVO.setParentClassifySecText(codeBasicSec.getName());
+				}
+			}
+			//濡傛灉鏈塴cstatus鐨勭被鐨勮瘽
+			if (true) {
+				//vo.setLcStatusText({lcStatusFullClassName}.getTextByValue(vo.getLcStatus()));
+			}
+		}
+		return codeBasicSecVO;
+	}
 
-    /**
-     * 涓婄Щ
-     *
-     * @param oid 涓婚敭
-     */
-    @Override
-    public void upOrderNum(String oid) {
-        CodeBasicSecDO secDO = selectByOid(oid);
-        BatchCBO batchCBO = new BatchCBO();
-        WebUtil.setPersistence(false);
-        if(secDO.getOrderNum() >1){
-            //绛変簬1鐨勬椂鍊欎笉鑳戒笂绉讳簡
-            //鎵炬瘮鑷繁灏忕殑
-            Map<String,String> conditionMap = new HashMap<>();
-            conditionMap.put("pkCodeRule",secDO.getPkCodeRule());
-            conditionMap.put("ordernum",String.valueOf(secDO.getOrderNum()-1));
-            List<CodeBasicSecDO> lastSecDOs = codeBasicSecMapper.selectByCondition(conditionMap,new PageHelper(-1));
-            if(!CollectionUtils.isEmpty(lastSecDOs)){
-                CodeBasicSecDO lastSec = lastSecDOs.get(0);
-                lastSec.setOrderNum(lastSec.getOrderNum()+1);
-                batchCBO.copyFromOther(codeBasicSecMapper.updateByPrimaryKey(lastSec));
-            }
-            secDO.setOrderNum(secDO.getOrderNum()-1);
-            batchCBO.copyFromOther(codeBasicSecMapper.updateByPrimaryKey(secDO));
-        }
-        WebUtil.setPersistence(true);
-        boService.persistenceBatch(batchCBO);
-    }
+	/**
+	 * 鏍规嵁缂栫爜瑙勫垯涓婚敭鑾峰彇缂栫爜涓嬬殑娴佹按渚濊禆鐮佹
+	 *
+	 * @param oid 缂栫爜瑙勫垯涓婚敭
+	 * @return
+	 * @throws VciBaseException
+	 */
+	@Override
+	public CodeRuleVO getSerialNumberDepend(String oid) throws VciBaseException {
+		VciBaseUtil.alertNotNull(oid,"缂栫爜瑙勫垯涓婚敭");
+		CodeRuleVO codeRuleVO = codeRuleService.getObjectByOid(oid);
+		if (codeRuleVO != null) {
+			//濡傛灉鏈塴cstatus鐨勭被鐨勮瘽
+			codeRuleVO.setLcStatusText(CodeRuleLC.getTextByValue(codeRuleVO.getLcStatus()));
 
-    /**
-     * 涓嬬Щ
-     *
-     * @param oid 涓婚敭
-     */
-    @Override
-    public void downOrderNum(String oid) {
-        CodeBasicSecDO secDO = selectByOid(oid);
-        BatchCBO batchCBO = new BatchCBO();
-        WebUtil.setPersistence(false);
-        Map<String,String> conditionMap = new HashMap<>();
-        conditionMap.put("pkCodeRule",secDO.getPkCodeRule());
-        Long total = codeBasicSecMapper.countByCondition(conditionMap);
-        if(secDO.getOrderNum()  < total){
-            //灏忎簬鎬绘暟鐨勬椂鍊欐墠涓嬬Щ
-            conditionMap.put("ordernum",String.valueOf(secDO.getOrderNum()+1));
-            List<CodeBasicSecDO> lastSecDOs = codeBasicSecMapper.selectByCondition(conditionMap,new PageHelper(-1));
-            if(!CollectionUtils.isEmpty(lastSecDOs)){
-                CodeBasicSecDO lastSec = lastSecDOs.get(0);
-                lastSec.setOrderNum(lastSec.getOrderNum()-1);
-                batchCBO.copyFromOther(codeBasicSecMapper.updateByPrimaryKey(lastSec));
-            }
-            secDO.setOrderNum(secDO.getOrderNum()+1);
-            batchCBO.copyFromOther(codeBasicSecMapper.updateByPrimaryKey(secDO));
-        }
-        WebUtil.setPersistence(true);
-        boService.persistenceBatch(batchCBO);
-    }
+			LambdaQueryWrapper<CodeBasicSec> wrapper = Wrappers.<CodeBasicSec>query().lambda()
+				.eq(CodeBasicSec::getPkCodeRule, codeRuleVO.getOid())
+				.eq(CodeBasicSec::getSecType,CodeSecTypeEnum.CODE_SERIAL_SEC.getValue());
+			CodeBasicSec codeBasicSec = this.getOne(wrapper);
+			if(codeBasicSec != null && VciBaseUtil.isNotNull(codeBasicSec.getOid())){
+				wrapper = Wrappers.<CodeBasicSec>query().lambda()
+					.eq(CodeBasicSec::getPkCodeRule,codeRuleVO.getOid())
+					.eq(CodeBasicSec::getSerialDependFlag,"true")
+					.orderByAsc(CodeBasicSec::getSerialDependOrder);
+				List<CodeBasicSec> codeBasicSecList = this.list(wrapper);
+				if(!CollectionUtils.isEmpty(codeBasicSecList)){
+					List<CodeBasicSecVO> codeBasicSecVOS = codeBasicSecDO2VOs(codeBasicSecList);
+					//鏌ヨ鍥哄畾鐮佺殑鐮佸��
+					Map<String, List<CodeFixedValueVO>> secValueMap = fixedValueService.listCodeFixedValueBySecOids(codeBasicSecList.stream().map(CodeBasicSec::getOid).collect(Collectors.toList()));
+					codeBasicSecVOS.stream().forEach(vo->{
+						vo.setFixedValueVOList(secValueMap.getOrDefault(vo.getOid(),null));
+					});
+					codeRuleVO.setSecVOList(codeBasicSecVOS);
+				}
+			}else{
+				throw new VciBaseException(codeRuleVO.getName()+"缂栫爜瑙勫垯涓嬫棤娴佹按鐮佹锛屾棤娉曡缃渶澶ф祦姘村彿锛�");
+			}
+		}
+		return codeRuleVO;
+	}
+
+	/**
+	 * 璁剧疆鏈�澶ф祦姘村彿
+	 *
+	 * @param codeOrderDTO 缂栫爜鐢宠浼犺緭瀵硅薄
+	 * @return
+	 * @throws VciBaseException
+	 */
+	@Override
+	public String setMaxSerialNumberForCodeRule(CodeOrderDTO codeOrderDTO) throws VciBaseException {
+		VciBaseUtil.alertNotNull(codeOrderDTO.getCodeRuleOid(),"缂栫爜瑙勫垯涓婚敭",codeOrderDTO.getMaxSecNum(),"鏈�澶ф祦姘村彿");
+		List<CodeOrderSecDTO> codeOrderSecDTOList = codeOrderDTO.getSecDTOList();
+		if(CollectionUtils.isEmpty(codeOrderSecDTOList)){
+			throw new VciBaseException("鏈�澶ф祦姘村彿鐨勬祦姘翠緷璧栦笉鑳戒负绌猴紒");
+		}
+
+		String codeRuleOid = codeOrderDTO.getCodeRuleOid();
+		int maxSecNum = codeOrderDTO.getMaxSecNum();
+
+		Map<String/**鐮佹涓婚敭*/,CodeOrderSecDTO/**鐮佹鐩稿叧淇℃伅*/> codeOrderSecDTOMap = codeOrderSecDTOList.stream().collect(Collectors.toMap(s -> s.getSecOid(), t -> t));
+		List<String> codeBasicSecOidList = codeOrderSecDTOList.stream().map(s->s.getSecOid()).collect(Collectors.toList());//娴佹按渚濊禆鐮佹鐨勪富閿泦鍚�
+
+		//鑾峰彇娴佹按渚濊禆鐮佹
+		LambdaQueryWrapper<CodeBasicSec> wrapper = Wrappers.<CodeBasicSec>query().lambda()
+			.eq(CodeBasicSec::getPkCodeRule,codeRuleOid)
+			.in(CodeBasicSec::getOid,codeBasicSecOidList)
+			.eq(CodeBasicSec::getSerialDependFlag,"true")
+			.orderByAsc(CodeBasicSec::getSerialDependOrder);
+		List<CodeBasicSec> codeBasicSecList = this.list(wrapper);
+
+		//鎸夋祦姘翠緷璧栭『搴忥紝澶勭悊娴佹按渚濊禆鐮佹鐨勫��
+		List<String> serialDependValueList = new ArrayList<>();
+		codeBasicSecList.stream().forEach(s->{
+			CodeOrderSecDTO codeOrderSecDTO = codeOrderSecDTOMap.get(s.getOid());
+			String serialDependValue = codeOrderSecDTO.getSecValue();
+			if(s.getSecType().equals(CodeSecTypeEnum.CODE_DATE_SEC.getValue())){
+				try {
+					Date date = VciDateUtil.str2Date(codeOrderSecDTO.getSecValue(),s.getCodeDateFormatStr());
+					serialDependValue = VciDateUtil.date2Str(date,s.getCodeDateFormatStr());
+				} catch (Exception e) {
+					throw new RuntimeException(e);
+				}
+			}
+			serialDependValueList.add(serialDependValue);
+		});
+
+		//鑾峰彇娴佹按鐮佹
+		wrapper = Wrappers.<CodeBasicSec>query().lambda()
+			.eq(CodeBasicSec::getPkCodeRule,codeRuleOid)
+			.eq(CodeBasicSec::getSecType,CodeSecTypeEnum.CODE_SERIAL_SEC.getValue())
+			.orderByAsc(CodeBasicSec::getSerialDependOrder);
+		CodeBasicSec codeBasicSec = this.getOne(wrapper);
+
+		//鏍规嵁缂栫爜瑙勫垯鍜屾祦姘翠緷璧栵紝鑾峰彇鏈�澶ф祦姘村彿
+		String serialUnitString = serialDependValueList.size() == 0 ? EMPTY_SERIAL_UNIT : serialDependValueList.stream().collect(Collectors.joining(SERIAL_UNIT_SPACE));
+		LambdaQueryWrapper<CodeSerialValue> codeSerialWrapper = new LambdaQueryWrapper<>();
+		codeSerialWrapper.eq(CodeSerialValue::getCodeRuleOid, codeRuleOid);
+		codeSerialWrapper.eq(CodeSerialValue::getSerialUnit, serialUnitString);
+		codeSerialWrapper.eq(CodeSerialValue::getCodeSecOid,codeBasicSec.getOid());
+		codeSerialWrapper.orderByDesc(CodeSerialValue::getCreateTime);
+		List<CodeSerialValue> codeSerialValueList = serialValueMapper.selectList(codeSerialWrapper);
+
+		//濡傛灉鏈�澶ф祦姘村彿涓嶄负绌猴紝璇存槑宸叉湁鏈�濂芥祦姘村彿锛屾洿鏂版渶澶ф祦姘村彿
+		if(!CollectionUtils.isEmpty(codeSerialValueList)){
+			CodeSerialValue codeSerialValue = codeSerialValueList.get(0);
+			int maxSerial = Double.valueOf(codeSerialValue.getMaxSerial()).intValue();
+			//宸叉湁鐨勬渶澶ф祦姘村彿锛屽皬浜庤缃殑鏈�澶ф祦姘村彿锛屾洿鏂版渶澶ф祦姘村彿
+			if(maxSerial < maxSecNum){
+				codeSerialValue.setMaxSerial(String.valueOf(maxSecNum));
+				serialValueMapper.updateById(codeSerialValue);
+			}else{
+				maxSecNum = maxSerial;
+			}
+		}else{
+			//濡傛灉鏈�澶ф祦姘村彿涓嶄负绌猴紝璇存槑鏃犳渶濂芥祦姘村彿锛屾柊澧炴渶澶ф祦姘村彿
+			CodeSerialValue codeSerialValue = new CodeSerialValue();
+			DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeSerialValue, MdmBtmTypeConstant.CODE_SERIAL_VALUE);
+			codeSerialValue.setCodeRuleOid(codeRuleOid);
+			codeSerialValue.setSerialUnit(serialUnitString);
+			codeSerialValue.setCodeSecOid(codeBasicSec.getOid());
+			codeSerialValue.setMaxSerial(String.valueOf(maxSecNum));
+			serialValueMapper.insert(codeSerialValue);
+		}
+		return String.valueOf(maxSecNum);
+	}
 }
-

--
Gitblit v1.9.3