ludc
2023-07-04 1f238ae264c0dfca87bba9ea9da5456153991eaa
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java
@@ -9,10 +9,7 @@
import com.github.yulichang.wrapper.MPJLambdaWrapper;
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.CodeClassify;
import com.vci.ubcs.code.entity.CodeClassifyValue;
import com.vci.ubcs.code.entity.CodeFixedValue;
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;
@@ -34,9 +31,7 @@
import com.vci.ubcs.starter.util.UBCSSqlKeyword;
import com.vci.ubcs.starter.web.enumpck.NewAppConstantEnum;
import com.vci.ubcs.starter.web.enumpck.OsCodeFillTypeEnum;
import com.vci.ubcs.starter.web.pagemodel.BladeQueryObject;
import com.vci.ubcs.starter.web.pagemodel.KeyValue;
import com.vci.ubcs.starter.web.pagemodel.UIFormReferVO;
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.WebUtil;
@@ -46,6 +41,7 @@
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
@@ -261,17 +257,18 @@
      //引用码段的时候,需要判断参照的信息是否正确
      if(CodeSecTypeEnum.CODE_REFER_SEC.getValue().equalsIgnoreCase(codeBasicSecDO.getSecType())){
         if(StringUtils.isBlank(codeBasicSecDO.getReferConfig())){
            throw new VciBaseException("引用码段的时候,需要填写 参照配置 的内容");
            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);
         }
         if(codeReferConfigVO.getIsPersistence()=="true"){
            // 判断是否为引用码段,如果是应用码段的话,为了适配前端组件,这里要对表进行处理一下,按照以前的参照格式进行转换
            codeBasicSecDO.setReferValueInfo(referConfigTOUIUiTable(codeReferConfigVO));
            codeReferConfigService.insert(codeReferConfigVO);
         }
      }
@@ -279,14 +276,59 @@
      //SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
      if(StringUtils.isNotBlank(codeBasicSecDO.getCodeFillSeparator())){
         DictBiz dictBiz = new DictBiz();
         dictBiz.setCode(MdmBtmTypeConstant.CODE_BASIC_SEC);
         dictBiz.setDictKey("codefileseparator");
         dictBiz.setCode("codeFillSeparator");
         dictBiz.setDictKey(codeBasicSecDO.getCodeFillSeparator());
         dictBiz.setDictValue(codeBasicSecDO.getCodeFillSeparator());
         //从原来的charService(可输可选)更改为调用omd中的接口来实现
         iDictBizClient.getCheck(dictBiz);
         //charService.save(MdmBtmTypeConstant.CODE_BASIC_SEC,"codefileseparator",codeBasicSecDO.getCodeFillSeparator(),sessionInfo);
      }
      return resBoolean;
   }
   /**
    * 将referconfig转换为JSON格式的UIFormReferVO
    * @param codeReferConfig
    * @return
    */
   private String referConfigTOUIUiTable(CodeReferConfigVO codeReferConfig){
      // 拷贝为以前的老对象
      UIReferConfigFormVO uiFormReferVO = new UIReferConfigFormVO();
      BeanUtil.copy(codeReferConfig,uiFormReferVO);
      // 表格的自定义定义
      UITableConfigVO uiTableConfigVO = new UITableConfigVO();
      uiTableConfigVO.setPage(new UITablePageVO(codeReferConfig.getLimit(),1));
      // 列表的列的信息转换
      List<TableColVO> uiTableFieldVOs = new ArrayList<>();
      // 快速查询列
      List<TableColVO> queryColumns = new ArrayList<>();
      if(!codeReferConfig.getCodeShowFieldConfigVOS().isEmpty()){
         codeReferConfig.getCodeShowFieldConfigVOS().stream().forEach(showField ->{
            TableColVO tableColVO = new TableColVO();
            BeanUtil.copy(showField,tableColVO);
            tableColVO.setSortField(showField.getAttrSortField());
            uiTableFieldVOs.add(tableColVO);
            if(showField.getIsQuery().equals("true")){
               queryColumns.add(tableColVO);
            }
         });
      }
      // 显示的列
      uiTableConfigVO.setCols(uiTableFieldVOs);
      // 快速查询列
      uiTableConfigVO.setQueryColumns(queryColumns);
      //set给表格配置属性
      uiFormReferVO.setTableConfig(uiTableConfigVO);
      // 筛选条件
      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);
   }
   /**
@@ -334,10 +376,9 @@
         resBoolean = codeBasicSecMapper.updateById(codeBasicSecDO)>0;
         //SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
         if(StringUtils.isNotBlank(codeBasicSecDO.getCodeFillSeparator())){
            //这儿目前需要改 2023/4/24
            DictBiz dictBiz = new DictBiz();
            dictBiz.setCode(MdmBtmTypeConstant.CODE_BASIC_SEC);
            dictBiz.setDictKey("codefileseparator");
            dictBiz.setCode("codeFillSeparator");
            dictBiz.setDictKey(codeBasicSecDO.getCodeFillSeparator());
            dictBiz.setDictValue(codeBasicSecDO.getCodeFillSeparator());
            //从原来的charService(可输可选)更改为调用omd中的接口来实现
            iDictBizClient.getCheck(dictBiz);
@@ -792,12 +833,22 @@
   public CodeBasicSecVO codeBasicSecDO2VO(CodeBasicSec codeBasicSecDO) throws VciBaseException {
      CodeBasicSecVO codeBasicSecVO = new CodeBasicSecVO();
      if (codeBasicSecDO != null) {
         BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecVO, codeBasicSecVO);
         codeBasicSecVO.setSecTypeText(CodeSecTypeEnum.getTextByValue(codeBasicSecVO.getSecType()));
         codeBasicSecVO.setCodeLevelTypeText(CodeLevelTypeEnum.getTextByValue(codeBasicSecVO.getCodeLevelType()));
         codeBasicSecVO.setCodeSecLengthTypeText(CodeSecLengthTypeEnum.getTextByValue(codeBasicSecVO.getCodeSecLengthType()));
         codeBasicSecVO.setValueCutTypeText(CodeCutTypeEnum.getValueByText(codeBasicSecVO.getValueCutType()));
         codeBasicSecVO.setCodeGetValueTypeText(CodeGetValueTypeEnum.getValueByText(codeBasicSecVO.getCodeGetValueType()));
         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()