ludc
2023-05-17 b7a96fdc87ba86a100cd8fddbd03080f72703089
以及发布webservice接口功能搭建,将通通用接口移植过来
已修改12个文件
4363 ■■■■■ 文件已修改
Source/UBCS/ubcs-service/ubcs-code/pom.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeSyncUniversalController.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/DockingLogeMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/IDockingLogeService.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java 254 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/UniversalInterfaceI.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/DockingLogeServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java 3341 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java 534 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/util/gennerAttrMapUtil.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/DockingLogeWrapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/pom.xml
@@ -25,6 +25,11 @@
        </dependency>
        <dependency>
            <groupId>com.vci.ubcs</groupId>
            <artifactId>ubcs-webservice</artifactId>
            <version>3.0.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.vci.ubcs</groupId>
            <artifactId>ubcs-ddl</artifactId>
            <version>3.0.1.RELEASE</version>
        </dependency>
@@ -50,6 +55,12 @@
            <artifactId>mybatis-plus-join-boot-starter</artifactId>
            <version>${mybatisplus.join.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vci.ubcs</groupId>
            <artifactId>ubcs-webservice</artifactId>
            <version>3.0.1.RELEASE</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeSyncUniversalController.java
@@ -0,0 +1,49 @@
package com.vci.ubcs.code.controller;
import com.vci.ubcs.code.service.UniversalInterfaceI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * 主题库分类控制器
 *
 * @author xiejun
 * @date 2022-01-20
 */
@RestController
@RequestMapping("/codeSyncUniversalController")
public class CodeSyncUniversalController {
    /**
     * 日志
     */
    private Logger logger = LoggerFactory.getLogger(getClass());
    /**
     * 接口集成服务
     */
    @Autowired
    private UniversalInterfaceI universalInterfaceI;
    /****
     * 申请接口
     * @param dataString 属性信息
     * @param dataType 数据格式类型
     * @return
     * @throws Throwable
     */
    @PostMapping("/applyCode")
    public String applyCode(@RequestParam("dataString")String dataString, @RequestParam("dataType")String dataType)  {
        String result="";
        try {
            result = universalInterfaceI.applyCode(dataString, dataType);
        }catch (Throwable e){
            e.printStackTrace();
            logger.error("applyCode->"+e.getMessage());
        }
        return result;
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java
@@ -6,7 +6,6 @@
import com.vci.ubcs.code.dto.CodeOrderDTO;
import com.vci.ubcs.code.dto.CodeOrderSecDTO;
import com.vci.ubcs.code.dto.datapush.BaseModelDTO;
import com.vci.ubcs.code.service.MdmEngineService;
import com.vci.ubcs.code.service.MdmIOService;
import com.vci.ubcs.code.vo.pagemodel.CodeImProtRusultVO;
import com.vci.ubcs.code.vo.pagemodel.MdmUIInfoVO;
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/DockingLogeMapper.java
@@ -0,0 +1,14 @@
package com.vci.ubcs.code.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.vci.ubcs.code.entity.CodeWupinEntity;
import com.vci.ubcs.code.entity.DockingLog;
import com.vci.ubcs.code.vo.pagemodel.DockingLogeVO;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import java.util.Objects;
public interface DockingLogeMapper extends BaseMapper<DockingLog> {
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/IDockingLogeService.java
@@ -0,0 +1,27 @@
package com.vci.ubcs.code.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper;
import com.baomidou.mybatisplus.extension.kotlin.KtQueryChainWrapper;
import com.baomidou.mybatisplus.extension.kotlin.KtUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.vci.ubcs.code.entity.CodeWupinEntity;
import com.vci.ubcs.code.entity.DockingLog;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
/**
 * 主数据引擎服务
 * @author xiej
 * @date 2023-05-17
 */
public interface IDockingLogeService extends IService<DockingLog> {
    }
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java
@@ -1,126 +1,136 @@
package com.vci.ubcs.code.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.vci.ubcs.code.entity.CodeAllCode;
/**
 * 主数据引擎服务
 * @author weidy
 * @date 2022-2-21
 */
public interface MdmEngineService extends IService<CodeAllCode> {
//  /**
//   * 使用分类的主键获取可以使用的模板对象
//   * @param codeClassifyOid 分类的主键
//   * @return 模板的显示对象
//   */
//  CodeClstemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid);
//package com.vci.ubcs.code.service;
//
//  /**
//   * 使用分类的主键获取可以使用的模板对象
//   * @param codeClassifyOid 分类的主键
//   * @param hasAttr 包含属性
//   * @return 模板的显示对象
//   */
//  CodeClstemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid, boolean hasAttr);
//
//  /**
//   * 获取枚举的下拉选项
//   * @param attrVO 模板属性的对象
//   * @return 下拉选项
//   */
//  List<KeyValue> listComboboxItems(CodeClassifyTemplateAttrVO attrVO);
//import com.baomidou.mybatisplus.extension.service.IService;
//import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
//import com.vci.ubcs.code.dto.CodeOrderDTO;
//import com.vci.ubcs.code.dto.datapush.BaseModelDTO;
//import com.vci.ubcs.code.entity.CodeAllCode;
//import com.vci.ubcs.code.vo.CodeClstemplateVO;
//import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO;
//import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateVO;
//import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
//import com.vci.ubcs.starter.web.pagemodel.KeyValue;
//
//  /**
//   * 修改状态
//   * @param baseModelDTO 数据传输对象
//   */
//  void changeStatus(BaseModelDTO baseModelDTO);
//import java.util.List;
//
//  /**
//   * 申请单一编码
//   * @param orderDTO 申请的信息,需要包含属性的内容和码段相关的内容
//   * @return 返回编码的内容
//   */
//  String addSaveCode(CodeOrderDTO orderDTO);
//
//  /**
//   * 判断编码的码段是否输入或者选择了码值
//   * @param ruleVO 规则的显示对象
//   * @param orderDTO 编码申请的内容
//   */
//  void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO);
//
//  /**
//   * 封装关键属性的查询语句
//   *
//   * @param value        当前的值
//   * @param keyRuleVO    关键属性的控制规则,可以为空
//   * @param attrId       属性的编号
//   * @param trim         是否去除空格
//   * @param ignoreCase   是否不区分大小写
//   * @param ignoreWidth  是否忽略全半角
//   * @param trimAll      是否忽略全部空格
//   * @param conditionMap 查询条件
//   */
//  void wrapperKeyAttrConditionMap(String value, CodeKeyattrrepeatVO keyRuleVO, String attrId,
//                             boolean trim, boolean ignoreCase, boolean ignoreWidth,
//                             boolean trimAll, Map<String, String> conditionMap);
//  /**
//   * 初始化业务类型
//   * --创建人默认为当前用户,如果需要修改,可以在获取后自行处理
//   * @param btmName 业务类型的名称,会自动变成小写
//   * @return CodeWupinEntity
//   * @throws VciBaseException 初始化出错的是会抛出异常
//   */
//  CodeWupinEntity createCBOByBtmName(String btmName);
//
//  /**
//   * 保存可输可选的信息
//   *
//   * @param templateVO 模板的对象
//   * @param cboList    数据的内容
//   */
//  void batchSaveSelectChar(CodeClstemplateVO templateVO, /*List<ClientBusinessObject> cboList*/
//                           List<String> cboList);
//
//  /**
//   * 使用模板的主键获取表单的信息
//   * @param templateOid 模板的主键
//   * @param codeClassifyOid 使用模板的分类的主键
//   * @return ui相关的内容
//   */
//    MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid);
//
//  /**
//   * 模板属性转换为表单的字段
//   *
//   * @param attrVO  模板属性
//   * @param btmType 业务类型
//   * @return 表单的字段
//   */
//  UIFormItemVO templateAttr2FormField(CodeClstempattrVO attrVO, String btmType) ;
//
//  /**
//   * 模板属性转换为表格显示的配置
//   *
//   * @param attrVO 模板属性
//   * @param forEdit 是否是编辑所需
//   * @return 表格的字段
//   */
//  UITableFieldVO templateAttr2TableField(CodeClstempattrVO attrVO, boolean forEdit);
//
//  /**
//   * 相似项查询
//   * @param orderDTO 编码的相关信息
//   * @return 数据列表
//   */
//  DataGrid<Map<String, String>> resembleQuery(CodeOrderDTO orderDTO);
//
//  /**
//   * 修改主题库数据
//   * @param orderDTO 数据的内容,不用包含码段的内容了
//   */
//  void editSaveCode(CodeOrderDTO orderDTO);
}
///**
// * 主数据引擎服务
// * @author weidy
// * @date 2022-2-21
// */
//public interface MdmEngineService extends IService<CodeAllCode> {
////    /**
////     * 使用分类的主键获取可以使用的模板对象
////     * @param codeClassifyOid 分类的主键
////     * @return 模板的显示对象
////     */
////    CodeClstemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid);
////
////    /**
////     * 使用分类的主键获取可以使用的模板对象
////     * @param codeClassifyOid 分类的主键
////     * @param hasAttr 包含属性
////     * @return 模板的显示对象
////     */
////    CodeClstemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid, boolean hasAttr);
////
////    /**
////     * 获取枚举的下拉选项
////     * @param attrVO 模板属性的对象
////     * @return 下拉选项
////     */
////    List<KeyValue> listComboboxItems(CodeClassifyTemplateAttrVO attrVO);
////
////    /**
////     * 修改状态
////     * @param baseModelDTO 数据传输对象
////     */
////    void changeStatus(BaseModelDTO baseModelDTO);
////
////    /**
////     * 申请单一编码
////     * @param orderDTO 申请的信息,需要包含属性的内容和码段相关的内容
////     * @return 返回编码的内容
////     */
////    String addSaveCode(CodeOrderDTO orderDTO);
////
////    /**
////     * 判断编码的码段是否输入或者选择了码值
////     * @param ruleVO 规则的显示对象
////     * @param orderDTO 编码申请的内容
////     */
////    void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO);
////
////    /**
////     * 封装关键属性的查询语句
////     *
////     * @param value        当前的值
////     * @param keyRuleVO    关键属性的控制规则,可以为空
////     * @param attrId       属性的编号
////     * @param trim         是否去除空格
////     * @param ignoreCase   是否不区分大小写
////     * @param ignoreWidth  是否忽略全半角
////     * @param trimAll      是否忽略全部空格
////     * @param conditionMap 查询条件
////     */
////    void wrapperKeyAttrConditionMap(String value, CodeKeyattrrepeatVO keyRuleVO, String attrId,
////                               boolean trim, boolean ignoreCase, boolean ignoreWidth,
////                               boolean trimAll, Map<String, String> conditionMap);
////    /**
////     * 初始化业务类型
////     * --创建人默认为当前用户,如果需要修改,可以在获取后自行处理
////     * @param btmName 业务类型的名称,会自动变成小写
////     * @return CodeWupinEntity
////     * @throws VciBaseException 初始化出错的是会抛出异常
////     */
////    CodeWupinEntity createCBOByBtmName(String btmName);
////
////    /**
////     * 保存可输可选的信息
////     *
////     * @param templateVO 模板的对象
////     * @param cboList    数据的内容
////     */
////    void batchSaveSelectChar(CodeClstemplateVO templateVO, /*List<ClientBusinessObject> cboList*/
////                             List<String> cboList);
////
////    /**
////     * 使用模板的主键获取表单的信息
////     * @param templateOid 模板的主键
////     * @param codeClassifyOid 使用模板的分类的主键
////     * @return ui相关的内容
////     */
////    MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid);
////
////    /**
////     * 模板属性转换为表单的字段
////     *
////     * @param attrVO  模板属性
////     * @param btmType 业务类型
////     * @return 表单的字段
////     */
////    UIFormItemVO templateAttr2FormField(CodeClstempattrVO attrVO, String btmType) ;
////
////    /**
////     * 模板属性转换为表格显示的配置
////     *
////     * @param attrVO 模板属性
////     * @param forEdit 是否是编辑所需
////     * @return 表格的字段
////     */
////    UITableFieldVO templateAttr2TableField(CodeClstempattrVO attrVO, boolean forEdit);
////
////    /**
////     * 相似项查询
////     * @param orderDTO 编码的相关信息
////     * @return 数据列表
////     */
////    DataGrid<Map<String, String>> resembleQuery(CodeOrderDTO orderDTO);
////
////    /**
////     * 修改主题库数据
////     * @param orderDTO 数据的内容,不用包含码段的内容了
////     */
////    void editSaveCode(CodeOrderDTO orderDTO);
//}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/UniversalInterfaceI.java
@@ -0,0 +1,52 @@
package com.vci.ubcs.code.service;
import javax.jws.WebService;
/**
 * 统一接口
 *
 * @author xiejun
 * @date 2022-11-27
 */
@WebService(targetNamespace = "http://code.ubcs.vci.com/",name = "universalInterface")
public interface UniversalInterfaceI {
    /**
     *统一申请编码接口
     * @param data 传递的数据参数
     * @param dataType 标识data是xml格式还是json格式,接口返回数据也是按照这个格式,以下接口类同
     * @return xml格式/json格式
     * @throws Throwable
     */
    public String applyCode(String data,String dataType)throws Throwable;
    /***
     * 统一更新接口
     * @param data
     * @param dataType
     * @return
     * @throws Throwable
     */
    public String syncEditData(String data,String dataType)throws Throwable;
    /***
     * 查询分类口
     * @param data
     * @param dataType
     * @throws Throwable
     */
    public String  queryClassify(String data,String dataType)throws Throwable;
    /***
     * 查询数据
     * @param data
     * @param dataType
     * @throws Throwable
     */
    public String  queryData(String data,String dataType)throws Throwable;
    /***
     * 返回编码规则接口
     */
    public String queryClassifyRule(String data,String datatype)throws Throwable;
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/DockingLogeServiceImpl.java
@@ -0,0 +1,18 @@
package com.vci.ubcs.code.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vci.ubcs.code.entity.DockingLog;
import com.vci.ubcs.code.mapper.DockingLogeMapper;
import com.vci.ubcs.code.service.IDockingLogeService;
import org.springframework.stereotype.Service;
/**
    * 编码信息 服务实现类
    *
    * @author xiej
    * @since 2023-05-17
    */
@Service
public class DockingLogeServiceImpl extends ServiceImpl<DockingLogeMapper, DockingLog> implements IDockingLogeService {
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
@@ -1,57 +1,61 @@
package com.vci.ubcs.code.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vci.ubcs.code.entity.CodeAllCode;
import com.vci.ubcs.code.mapper.CodeAllCodeMapper;
import com.vci.ubcs.code.service.*;
import org.springframework.stereotype.Service;
/**
 * 主数据引擎服务
 *
 * @author weidy
 * @date 2022-2-22
 */
@Service
public class MdmEngineServiceImpl extends ServiceImpl<CodeAllCodeMapper, CodeAllCode> implements MdmEngineService {
//  /**
//   * 模板的服务
//   */
//  @Resource
//  private CodeClstemplateServiceImpl templateService;
//  /**
//   * 模板的服务
//   */
//  @Resource
//  private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
//  /**
//   * 生成编码的服务
//   */
//  @Resource
//  private MdmProductCodeService productCodeService;
//  /**
//   * 字典的服务
//   */
//  @Resource
//  IDictBizClient iDictBizClient;
//  /**
//   * 公式的服务
//   */
//  @Autowired
//  private FormulaServiceImpl formulaService;
//package com.vci.ubcs.code.service.impl;
//
//  /**
//   * 通用查询
//   */
//  @Resource
//  CommonsMapper commonsMapper;
//  /**
//   * 编码规则的服务
//   */
//  @Autowired
//  private ICodeRuleService ruleService;
//import com.alibaba.fastjson.JSONObject;
//import com.alibaba.nacos.common.utils.StringUtils;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.extension.service.IService;
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
//import com.sun.corba.se.impl.orbutil.ObjectUtility;
//import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
//import com.vci.ubcs.code.dto.CodeOrderDTO;
//import com.vci.ubcs.code.dto.datapush.BaseModelDTO;
//import com.vci.ubcs.code.entity.CodeAllCode;
//import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity;
//import com.vci.ubcs.code.entity.CodeRule;
//import com.vci.ubcs.code.entity.CodeWupinEntity;
//import com.vci.ubcs.code.enumpack.CodeDefaultLC;
//import com.vci.ubcs.code.enumpack.CodeLevelTypeEnum;
//import com.vci.ubcs.code.enumpack.CodeSecTypeEnum;
//import com.vci.ubcs.code.mapper.CodeAllCodeMapper;
//import com.vci.ubcs.code.mapper.CodeOsbtmtypeMapper;
//import com.vci.ubcs.code.mapper.CodeRuleMapper;
//import com.vci.ubcs.code.service.*;
//import com.vci.ubcs.code.vo.CodeClstemplateVO;
//import com.vci.ubcs.code.vo.CodeKeyattrrepeatVO;
//import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
//import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO;
//import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
//import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
//import com.vci.ubcs.omd.entity.Dict;
//import com.vci.ubcs.starter.exception.VciBaseException;
//import com.vci.ubcs.starter.revision.model.BaseModel;
//import com.vci.ubcs.starter.web.enumpck.UserSecretEnum;
//import com.vci.ubcs.starter.web.pagemodel.KeyValue;
//import com.vci.ubcs.starter.web.toolmodel.DateConverter;
//import com.vci.ubcs.starter.web.util.VciBaseUtil;
//import com.vci.ubcs.starter.web.util.VciDateUtil;
//import com.vci.ubcs.starter.web.util.VciQueryWrapperForDO;
//import com.vci.ubcs.starter.web.util.WebUtil;
//import com.vci.ubcs.system.entity.DictBiz;
//import com.vci.ubcs.system.feign.IDictBizClient;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springblade.core.mp.support.Query;
//import org.springblade.core.secure.utils.AuthUtil;
//import org.springblade.core.tool.api.R;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
///**
// * 主数据引擎服务
// *
// * @author weidy
// * @date 2022-2-22
// */
//@Service
//public class MdmEngineServiceImpl extends ServiceImpl<CodeAllCodeMapper, CodeAllCode> implements MdmEngineService {
//
//
//  /**
//   * 分类的服务
@@ -69,50 +73,8 @@
//   */
//  private Logger logger = LoggerFactory.getLogger(getClass());
//
//  /**
//   * 空格
//   */
//  public static final String SPACE = " ";
//
//  /**
//   * 密级的字段
//   */
//  public static final String SECRET_FILED = "secretgrade";
//  /**
//   * 用户新增数据的时候可以查看的密级
//   */
//  public static final String MY_DATA_SECRET = "myDataSecret";
//  /**
//   * 拷贝的版本
//   */
//  public static final String COPY_FROM_VERSION = "copyfromversion";
//  /**
//   * 只是sql
//   */
//  public static final String ONLY = "${vcionly}";
//
//  /**
//   * 默认的时间格式
//   */
//  private static final String DATETIME_FORMAT = "yyyy-mm-dd hh24:mi:ss";
//
//  /**
//   * 日期格式
//   */
//  private static final String DATE_FORMAT = "yyyy-mm-dd";
//
//  /**
//   * 必输
//   */
//  public static final String REQUIRED_CHAR = "*";
//  /**
//   * 替换字符
//   */
//  public static final String SPECIAL_CHAR  = "VCI";
////    @Autowired
////    private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
//
//
//  //  @Autowired
//  //  private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
//
//  /**
//   * 使用分类的主键获取可以使用的模板对象
@@ -190,14 +152,14 @@
//      List<CodeAllCode> codeCbos = baseMapper.selectList(allCodeWrapper);
////        List<ClientBusinessObject> codeCbos = boService.queryCBO(MdmBtmTypeConstant.CODE_ALL_CODE, conditionMap);
//      // 回收需要业务数据删除
//      if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) {
////            BatchCBO batchCBO = new BatchCBO();
////            batchCBO.getDeleteCbos().addAll(cboList);
//          codeOsbtmtypeMapper.deleteBatchIds(cboList);
////            boService.persistenceBatch(batchCBO);
//      } else {
////        if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) {
//////          BatchCBO batchCBO = new BatchCBO();
//////          batchCBO.getDeleteCbos().addAll(cboList);
////            codeOsbtmtypeMapper.deleteBatchIds(cboList);
//////          boService.persistenceBatch(batchCBO);
////        } else {
////            lifeCycleService.transCboStatus(cboList, baseModelDTO.getLcStatus());
//      }
////        }
////        lifeCycleService.transCboStatus(codeCbos, baseModelDTO.getLcStatus());
//  }
//
@@ -233,1598 +195,1597 @@
//      switchDateAttrOnOrder(templateVO, orderDTO);
//      //9.生成编码的信息
////        ClientBusinessObject cbo = boService.createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid());
//      CodeWupinEntity cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid());
////        //默认的属性都不用从前端拷贝
////        //设置编码需要的默认属性的内容
//      copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false);
////        //TODO:因为默认的属性都不拷贝,目前集团码叫name,并没有从DTO拷贝到cbo里。增加一个单独处理,以后再看要不要调整
//      cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName());
////        //end -- modify by lihang @20220407
//      List<CodeWupinEntity> cboList = new ArrayList<>();
//
//      //备注
//      cbo.setDescription(orderDTO.getDescription());
//      cboList.add(cbo);
////        CodeWupinEntity cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid());
//////      //默认的属性都不用从前端拷贝
//////      //设置编码需要的默认属性的内容
////        copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false);
//////      //TODO:因为默认的属性都不拷贝,目前集团码叫name,并没有从DTO拷贝到cbo里。增加一个单独处理,以后再看要不要调整
////        cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName());
//////      //end -- modify by lihang @20220407
////        List<CodeWupinEntity> cboList = new ArrayList<>();
////
////        //备注
////        cbo.setDescription(orderDTO.getDescription());
////
////        cboList.add(cbo);
//      List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList);
//
//
//      List<String> charList = new ArrayList<>();
//      for (CodeWupinEntity wupinEntity : cboList) {
//          charList.add(wupinEntity.getId());
//      }
//      batchSaveSelectChar(templateVO, charList);
//      return codeList.size() > 0 ? codeList.get(0) : "";
////        return null;
//  }
//
//  /**
//   * 处理分类注入的信息
//   *
//   * @param templateVO         模板的显示对象,必须要后模板的属性
//   * @param classifyFullInfoBO 分类的全路径
//   * @param orderDTO           编码申请的信息
//   */
//  private void switchClassifyLevelOnOrder(CodeClstemplateVO templateVO, CodeClassifyFullInfoBO classifyFullInfoBO, CodeOrderDTO orderDTO) {
//      Map<String,CodeClstempattrVO> classifyAttrVOMap = templateVO.getAttributes().stream().filter(
//          s -> StringUtils.isNotBlank(s.getClassifyinvokeattr()) && StringUtils.isNotBlank(s.getClassifyinvokelevel())
//      ).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
//      if (classifyFullInfoBO.getTopClassifyVO() == null) {
//          //需要重新查询一下,因为这个是指定的分类进来的
//
//      }
//      if (!CollectionUtils.isEmpty(classifyAttrVOMap)) {
//          classifyAttrVOMap.forEach((attrId, attrVO) -> {
//              //分类注入的编号或者名称,
//              //层级包含指定层和最小层
//              CodeClassifyVO classifyVO = null;
//              if (!CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(attrVO.getClassifyinvokelevel()) && !"min".equalsIgnoreCase(attrVO.getClassifyinvokelevel())) {
//                  //指定了层级的
//                  //注意,因为查询上级分类出来的层级是倒序的,即顶层节点是最大的值
//                  List<CodeClassifyVO> classifyVOS = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel()))).collect(Collectors.toList());
//                  int level = VciBaseUtil.getInt(attrVO.getClassifyinvokelevel());
//                  if (classifyVOS.size() >= level && level > 0) {
//                      classifyVO = classifyVOS.get(level - 1);
//                  }
//              } else {
//                  //当前的分类
//                  classifyVO = classifyFullInfoBO.getCurrentClassifyVO();
//              }
//              if (classifyVO == null) {
//                  //说明层级有误
//                  orderDTO.getData().put(attrId, "分类树上没有层级[" + attrVO.getClassifyinvokelevel() + "]");
//                  // classifyVO = classifyFullInfoBO.getCurrentClassifyVO();
//              } else {
//                  Map<String, String> classifyDataMap = VciBaseUtil.objectToMapString(classifyVO);
//                  String value = classifyDataMap.getOrDefault(attrVO.getClassifyinvokeattr(), "");
//                  orderDTO.getData().put(attrId, value);
//              }
//          });
//      }
//  }
//
//
//  /**
//   * 判断编码的码段是否输入或者选择了码值
//   *
//   * @param ruleVO   规则的显示对象
//   * @param orderDTO 编码申请的内容
//   */
//  @Override
//  public void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO) {
//      List<String> unSerialSecOidList = ruleVO.getSecVOList().stream().filter(
//          s -> !(CodeSecTypeEnum.CODE_SERIAL_SEC.getValue().equalsIgnoreCase(s.getSecType())
//              || CodeSecTypeEnum.CODE_ATTR_SEC.getValue().equalsIgnoreCase(s.getSecType())
//              || CodeSecTypeEnum.CODE_DATE_SEC.getValue().equalsIgnoreCase(s.getSecType())
//              || CodeSecTypeEnum.CODE_LEVEL_SEC.getValue().equalsIgnoreCase(s.getSecType())
//              || VciBaseUtil.getBoolean(s.getNullableFlag()))
//      ).map(CodeBasicSecVO::getOid).collect(Collectors.toList());
//      if (!CollectionUtils.isEmpty(unSerialSecOidList)) {
//          if (CollectionUtils.isEmpty(orderDTO.getSecDTOList())) {
//              throw new VciBaseException("非流水码段(或者必输码段)必须要输入(或选择)码值");
//          }
//          if (orderDTO.getSecDTOList().stream().anyMatch(s -> !unSerialSecOidList.contains(s.getSecOid())
//              && StringUtils.isBlank(s.getSecValue()))) {
//              throw new VciBaseException("非流水码段(或者必输码段)必须要输入(或选择)码值");
//          }
//      }
//  }
//
//  /**
//   * 校验属性是否为必输
//   *
//   * @param templateVO 模板的显示对象,需要包含模板属性
//   * @param orderDTO   编码申请的信息
//   */
//  private void checkRequiredAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
//      Map<String, CodeClstempattrVO> requiredAttrMap = templateVO.getAttributes().stream().filter(
//              s -> VciBaseUtil.getBoolean(s.getRequireflag()) && StringUtils.isBlank(s.getComponentrule())
//                  && StringUtils.isBlank(s.getClassifyinvokeattr()))
//          .collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
//      if (!CollectionUtils.isEmpty(requiredAttrMap)) {
//          requiredAttrMap.forEach((attrId, attrVO) -> {
//              //只有企业编码,状态,备注,模板主键,分类主键这几个是固定的,其余都是自行配置的
//              if (StringUtils.isBlank(getValueFromOrderDTO(orderDTO, attrId))) {
//                  throw new VciBaseException("属性【{0}】必须要输入(选择)内容", new String[]{attrVO.getName()});
//              }
//          });
//      }
//  }
//
//  /**
//   * 从编码申请信息对象上获取某个属性的值
//   *
//   * @param orderDTO 编码申请对象
//   * @param attrId   属性的编号
//   * @return 值
//   */
//  private String getValueFromOrderDTO(CodeOrderDTO orderDTO, String attrId) {
//      attrId = attrId.toLowerCase(Locale.ROOT);
//      String value = null;
//      if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) {
//          value = WebUtil.getStringValueFromObject(WebUtil.getValueFromField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO));
//      } else {
//          //说明是自行配置的
//          //前端必须要传递小写的属性
//          value = orderDTO.getData().getOrDefault(attrId, "");
//      }
//      return value;
//  }
//
//  /**
//   * 转换组合规则的值
//   *
//   * @param templateVO 模板的显示对象,需要包含模板属性
//   * @param orderDTO   编码申请的信息
//   */
//  private void switchComponentAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
//      Map<String, CodeClstempattrVO> compAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getComponentrule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
//      if (!CollectionUtils.isEmpty(compAttrVOMap)) {
//          Map<String, String> dataMap = WebUtil.objectToMapString(orderDTO);
//
//          Map<String, String> dataLowMap = new HashMap<>();
//          if (!CollectionUtils.isEmpty(dataMap)) {
//              dataMap.forEach((key, value) -> {
//                  dataLowMap.put(key.toLowerCase(Locale.ROOT), value);
//              });
//          }
//          dataLowMap.putAll(orderDTO.getData());
//          compAttrVOMap.forEach((attrId, attrVO) -> {
//              dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentrule()));
//          });
//          dataLowMap.forEach((key, value) -> {
//              setValueToOrderDTO(orderDTO, key, value);
//          });
//      }
//  }
//
//
//  /**
//   * 设置新的值到申请对象上
//   *
//   * @param orderDTO 编码申请对象
//   * @param attrId   属性的编号
//   * @param value    值
//   */
//  private void setValueToOrderDTO(CodeOrderDTO orderDTO, String attrId, String value) {
//      attrId = attrId.toLowerCase(Locale.ROOT);
//      if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) {
//          WebUtil.setValueToField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO, value);
//      } else {
//          orderDTO.getData().put(attrId, value);
//      }
//  }
//
//  /**
//   * 校验正则表达式是否正确
//   *
//   * @param templateVO 模板的信息,必须包含属性的内容
//   * @param orderDTO   编码申请的相关的信息
//   */
//  private void checkVerifyOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
//      Map<String, CodeClstempattrVO> verifyAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getVerifyrule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
//      if (!CollectionUtils.isEmpty(verifyAttrVOMap)) {
//          verifyAttrVOMap.forEach((attrId, attrVO) -> {
//              String value = getValueFromOrderDTO(orderDTO, attrId);
//              if (StringUtils.isNotBlank(value) && !value.matches(attrVO.getVerifyrule())) {
//                  //校验正则表达式
//                  throw new VciBaseException("属性[{0}]的值不符合校验规则的要求", new String[]{attrVO.getName()});
//              }
//          });
//      }
//  }
//
//  /**
//   * 校验关键属性
//   *
//   * @param classifyFullInfo 分类的全部信息
//   * @param templateVO       模板的内容,必须包含模板属性
//   * @param orderDTO         编码申请的相关的信息
//   */
//  private void checkKeyAttrOnOrder(CodeClassifyFullInfoBO classifyFullInfo, CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
//      //先获取关键属性的规则,也利用继承的方式
//      CodeKeyattrrepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo);
//      //注意的是keyRuleVO可能为空,表示不使用规则控制
//      //获取所有的关键属性
//      Map<String, CodeClstempattrVO> ketAttrMap = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getKeyattrflag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
//      Map<String, String> conditionMap = new HashMap<>();
//      boolean trimAll = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnoreallspaceflag());
//      //全部去空的优先级大于去空
//      boolean trim = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorespaceflag());
//      boolean ignoreCase = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorecaseflag());
//      boolean ignoreWidth = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorewidthflag());
//      ketAttrMap.forEach((attrId, attrVO) -> {
//          String value = getValueFromOrderDTO(orderDTO, attrId);
//          if (value == null) {
//              value = "";
//          }
//          wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap);
//      });
//
//      //没有限制分类,但是一个模板只可能在一个业务类型里面,所以直接查询这个业务类型即可
//
//      if (!CollectionUtils.isEmpty(conditionMap)) {
//          final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "};
//          conditionMap.forEach((key, value) -> {
//              sql[0] += " and " + key + " = " + value;
//          });
//          if (StringUtils.isNotBlank(orderDTO.getOid())) {
//              //修改的时候,需要排除自己
//              sql[0] += " and oid != '" + orderDTO.getOid() + "'";
//          } else if (StringUtils.isNotBlank(orderDTO.getCopyFromVersion())) {
//              sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'";
//          }
//          sql[0] += " and islastR = '1' and islastV = '1' ";
////            if (boService.queryCountBySql(sql[0], new HashMap<>()) > 0) {
//          if (Integer.parseInt(commonsMapper.selectById(sql[0]).get(0)) > 0) {
//              String ruleInfoMsg = keyRuleVO == null ? "" : "查询规则:去除空格--{0},忽略大小写--{1},忽略全半角--{2},忽略全部空格--{3}";
//              String[] objs = new String[]{trim ? "是" : "否", ignoreCase ? "是" : "否", ignoreWidth ? "是" : "否", trimAll ? "是" : "否"};
//              throw new VciBaseException("根据您填写的关键属性的内容,结合关键属性查询规则,发现这个数据已经在系统中存在了。请修正!。" + ruleInfoMsg, objs);
//          }
//      }
//  }
//
//  /**
//   * 封装关键属性的查询语句
//   *
//   * @param value        当前的值
//   * @param keyRuleVO    关键属性的控制规则,可以为空
//   * @param attrId       属性的编号
//   * @param trim         是否去除空格
//   * @param ignoreCase   是否不区分大小写
//   * @param ignoreWidth  是否忽略全半角
//   * @param trimAll      是否忽略全部空格
//   * @param conditionMap 查询条件
//   */
//  @Override
//  public void wrapperKeyAttrConditionMap(String value, CodeKeyattrrepeatVO keyRuleVO, String attrId,
//                                         boolean trim, boolean ignoreCase, boolean ignoreWidth,
//                                         boolean trimAll, Map<String, String> conditionMap) {
//      boolean ignoreSpace = trim || trimAll;
//      if (StringUtils.isBlank(value)) {
//          //为空的时候,不能用QueryOperation.ISNULL,平台不知道啥时候不处理这种了
//          conditionMap.put("t."+attrId, "null");
//      } else {
//          if (keyRuleVO != null) {
//              String queryKey = "";
//              String queryValue = "";
//
//              String temp = "";
//              if (ignoreCase && ignoreSpace && ignoreWidth) {
//                  //忽略大小写,且去空,忽略全半角
//                  temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte(%s)) " + (trimAll ? ",' ','')" : ")");
//              } else if (ignoreCase && ignoreSpace && !ignoreWidth) {
//                  //忽略大小写、去空、不忽略全半角
//                  temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")");
//              } else if (ignoreCase && !ignoreSpace && ignoreWidth) {
//                  //忽略大小写、不去空、忽略全半角
//                  temp = "UPPER(to_single_byte(%s))";
//              } else if (!ignoreCase && ignoreSpace && ignoreWidth) {
//                  //不忽略大小写、去空、忽略全半角
//                  temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte(%s) " + (trimAll ? ",' ','')" : ")");
//              } else if (ignoreCase && !ignoreSpace && !ignoreWidth) {
//                  //忽略大小写、不去空、不忽略全半角
//                  temp = "UPPER(%s)";
//              } else if (!ignoreCase && !ignoreCase && ignoreWidth) {
//                  //不忽略大小写、不去空、忽略全半角
//                  temp = "to_single_byte(%s)";
//              } else if (!ignoreCase && ignoreSpace && !ignoreWidth) {
//                  //不忽略大小写、去空、不忽略全半角
//                  temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")");
//              } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) {
//                  //不忽略大小写、不去空、不忽略全半角
//                  temp = "%s";
//              }
//              queryKey = String.format(temp, "t."+attrId);
//              queryValue = String.format(temp, "'" + (trim ? value.trim() : value) + "'");
//              conditionMap.put(queryKey, queryValue);
//          } else {
//              //为空的时候不代表不校验,只是不去除相关的信息
//              conditionMap.put("t."+attrId, value);
//          }
//      }
//  }
//
//  /**
//   * 校验枚举的内容
//   *
//   * @param templateVO 模板的显示对象,需要包含属性
//   * @param orderDTO   编码申请的信息
//   */
//  private void checkEnumOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
//      //如果枚举可以修改,则不需要校验是否符合枚举的选项
//
//      Map<String, CodeClstempattrVO> enumAttrVOMap = templateVO.getAttributes().stream().filter(s -> (StringUtils.isNotBlank(s.getEnumstring()) || StringUtils.isNotBlank(s.getEnumid())) && !VciBaseUtil.getBoolean(s.getEnumeditflag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
//      if (!CollectionUtils.isEmpty(enumAttrVOMap)) {
//          enumAttrVOMap.forEach((attrId, attrVO) -> {
//              String value = getValueFromOrderDTO(orderDTO, attrId);
//              if (StringUtils.isNotBlank(value)) {
//                  CodeClassifyTemplateAttrVO codeClassifyTemplateAttrVO = new CodeClassifyTemplateAttrVO();
//                  BeanUtils.copyProperties(attrVO,codeClassifyTemplateAttrVO);
//                  //有值才能校验
//                  List<KeyValue> comboboxKVs = listComboboxItems(codeClassifyTemplateAttrVO);
//                  if (!comboboxKVs.stream().anyMatch(s -> value.equalsIgnoreCase(s.getKey()))) {
//                      throw new VciBaseException("属性【{0}】的值不符合枚举的要求", new String[]{attrVO.getName()});
//                  }
//              }
//          });
//      }
//  }
//
//  /**
//   * 转换时间的格式
//   *
//   * @param templateVO 模板的显示对象,需要包含属性
//   * @param orderDTO   编码申请的信息
//   */
//  private void switchDateAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
//      Map<String, CodeClstempattrVO> dateAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getCodedateformat())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
//      if (!CollectionUtils.isEmpty(dateAttrVOMap)) {
//          dateAttrVOMap.forEach((attrId, attrVO) -> {
//              String value = getValueFromOrderDTO(orderDTO, attrId);
//              if (StringUtils.isNotBlank(value)) {
//                  DateConverter dateConverter = new DateConverter();
//                  dateConverter.setAsText(value);
//                  value = VciDateUtil.date2Str(dateConverter.getValue(), VciDateUtil.DateTimeMillFormat);
//                  setValueToOrderDTO(orderDTO, attrId, value);
//              }
//          });
//      }
//  }
//
//  /**
//   * 拷贝数据到cbo对象上
//   *
//   * @param classifyFullInfo 分类的全部信息
//   * @param cbo              业务数据
//   * @param orderDTO         编码申请的信息
//   * @param templateVO       模板的显示对象
//   * @param edit             是否为修改
//   */
//  private void copyValueToCBO(CodeClassifyFullInfoBO classifyFullInfo, CodeWupinEntity cbo,
//                              CodeOrderDTO orderDTO, CodeClstemplateVO templateVO,
//                              boolean edit) {
//      String fullPath = "";
//      if (!CollectionUtils.isEmpty(classifyFullInfo.getParentClassifyVOs())) {
//          fullPath = classifyFullInfo.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel())))
//              .map(CodeClassifyVO::getOid).collect(Collectors.joining("##"));
//      } else {
//          fullPath = classifyFullInfo.getCurrentClassifyVO().getOid();
//      }
//
////        BeanUtils.
//      BeanUtils.copyProperties(orderDTO.getData(),cbo);
//      cbo.setMaterialtype(Short.valueOf("1001"));
////        orderDTO.getData().forEach((key, value) -> {
////            if (!edit || (!checkUnAttrUnEdit(key) &&
////                !VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(key))) {
////                try {
////                    cbo.setAttributeValue(key, value);
////                } catch (Exception e) {
////                    logger.error("设置属性的值错误", e);
////                }
////            }
////        });
//      try {
//
//          cbo.setCodeclsfid(classifyFullInfo.getCurrentClassifyVO().getOid());
//          cbo.setCodetemplateoid(templateVO.getOid());
//          cbo.setCodeclsfpath(fullPath);
////            cbo.setMaterialclassify("model_type");
////            cbo.setMaterialname(orderDTO.getData().get("materialname"));
////            cbo.setShifoupihaoguanli("true");
////            cbo.setKucunwl("true");
////            cbo.setXiaoshouwl("false");
//          if (!edit && StringUtils.isBlank(orderDTO.getLcStatus())) {
//              //找生命周期的起始状态,插个点,看生命周期是否需要创建
//              if (StringUtils.isNotBlank(cbo.getLctid())) {
////                    OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(cbo.getLctid());
////                    if (lifeCycleVO != null) {
////                        cbo.setLcStatus("Editing");
//////                      cbo.setLcStatus(lifeCycleVO.getStartStatus());
////                    } else {
//                      cbo.setLcStatus(CodeDefaultLC.EDITING.getValue());
////        List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList);
////
////
////        List<String> charList = new ArrayList<>();
////        for (CodeWupinEntity wupinEntity : cboList) {
////            charList.add(wupinEntity.getId());
////        }
////        batchSaveSelectChar(templateVO, charList);
////        return codeList.size() > 0 ? codeList.get(0) : "";
//////      return null;
////    }
////
////    /**
////     * 处理分类注入的信息
////     *
////     * @param templateVO         模板的显示对象,必须要后模板的属性
////     * @param classifyFullInfoBO 分类的全路径
////     * @param orderDTO           编码申请的信息
////     */
////    private void switchClassifyLevelOnOrder(CodeClstemplateVO templateVO, CodeClassifyFullInfoBO classifyFullInfoBO, CodeOrderDTO orderDTO) {
////        Map<String,CodeClstempattrVO> classifyAttrVOMap = templateVO.getAttributes().stream().filter(
////            s -> StringUtils.isNotBlank(s.getClassifyinvokeattr()) && StringUtils.isNotBlank(s.getClassifyinvokelevel())
////        ).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
////        if (classifyFullInfoBO.getTopClassifyVO() == null) {
////            //需要重新查询一下,因为这个是指定的分类进来的
////
////        }
////        if (!CollectionUtils.isEmpty(classifyAttrVOMap)) {
////            classifyAttrVOMap.forEach((attrId, attrVO) -> {
////                //分类注入的编号或者名称,
////                //层级包含指定层和最小层
////                CodeClassifyVO classifyVO = null;
////                if (!CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(attrVO.getClassifyinvokelevel()) && !"min".equalsIgnoreCase(attrVO.getClassifyinvokelevel())) {
////                    //指定了层级的
////                    //注意,因为查询上级分类出来的层级是倒序的,即顶层节点是最大的值
////                    List<CodeClassifyVO> classifyVOS = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel()))).collect(Collectors.toList());
////                    int level = VciBaseUtil.getInt(attrVO.getClassifyinvokelevel());
////                    if (classifyVOS.size() >= level && level > 0) {
////                        classifyVO = classifyVOS.get(level - 1);
////                    }
//              } else {
//                  cbo.setLcStatus(CodeDefaultLC.EDITING.getValue());
//              }
//
//          }
//
//          int secret = VciBaseUtil.getInt(cbo.getSecretGrade().toString());
//          //插个点,后续看密级服务是否可用
////            if (secret == 0 || !secretService.checkDataSecret(secret)) {
//          if (secret == 0 ) {
//              Integer userSecret = VciBaseUtil.getCurrentUserSecret();
////                cbo.setAttributeValue(SECRET_FIELD, String.valueOf((userSecret == null || userSecret == 0) ? UserSecretEnum.NONE.getValue() : userSecret));
//              cbo.setSecretGrade(userSecret == null || userSecret == 0 ? UserSecretEnum.NONE.getValue() : userSecret);
//          }
//      } catch (Throwable e) {
//          logger.error("设置默认的属性的值错误", e);
//      }
//  }
//
//
//  /**
//   * 初始化业务类型
//   * --创建人默认为当前用户,如果需要修改,可以在获取后自行处理
//   * @param btmName 业务类型的名称,会自动变成小写
//   * @return CodeWupinEntity
//   * @throws VciBaseException 初始化出错的是会抛出异常
//   */
//  @Override
//  public CodeWupinEntity createCBOByBtmName(String btmName)
//      throws VciBaseException {
//      if(btmName!=null){
//          btmName = btmName.trim().toLowerCase();
//      }
//      String userid = AuthUtil.getUser().getUserName();
////        if(!hasCreatedCbos.containsKey(btmName)){
////            if(StringUtils.isEmpty(userid)){
////                throw new VciBaseException(msgCodePrefix +"noHasUserid");
////                } else {
////                    //当前的分类
////                    classifyVO = classifyFullInfoBO.getCurrentClassifyVO();
////                }
////                if (classifyVO == null) {
////                    //说明层级有误
////                    orderDTO.getData().put(attrId, "分类树上没有层级[" + attrVO.getClassifyinvokelevel() + "]");
////                    // classifyVO = classifyFullInfoBO.getCurrentClassifyVO();
////                } else {
////                    Map<String, String> classifyDataMap = VciBaseUtil.objectToMapString(classifyVO);
////                    String value = classifyDataMap.getOrDefault(attrVO.getClassifyinvokeattr(), "");
////                    orderDTO.getData().put(attrId, value);
////                }
////            });
////        }
////    }
////
////
////    /**
////     * 判断编码的码段是否输入或者选择了码值
////     *
////     * @param ruleVO   规则的显示对象
////     * @param orderDTO 编码申请的内容
////     */
////    @Override
////    public void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO) {
////        List<String> unSerialSecOidList = ruleVO.getSecVOList().stream().filter(
////            s -> !(CodeSecTypeEnum.CODE_SERIAL_SEC.getValue().equalsIgnoreCase(s.getSecType())
////                || CodeSecTypeEnum.CODE_ATTR_SEC.getValue().equalsIgnoreCase(s.getSecType())
////                || CodeSecTypeEnum.CODE_DATE_SEC.getValue().equalsIgnoreCase(s.getSecType())
////                || CodeSecTypeEnum.CODE_LEVEL_SEC.getValue().equalsIgnoreCase(s.getSecType())
////                || VciBaseUtil.getBoolean(s.getNullableFlag()))
////        ).map(CodeBasicSecVO::getOid).collect(Collectors.toList());
////        if (!CollectionUtils.isEmpty(unSerialSecOidList)) {
////            if (CollectionUtils.isEmpty(orderDTO.getSecDTOList())) {
////                throw new VciBaseException("非流水码段(或者必输码段)必须要输入(或选择)码值");
////            }
////            try {
////                hasCreatedCbos.put(btmName, createBusinessObject(btmName));
////            } catch (Exception e) {
////                logger.error("创建业务类型对象",e);
////                throw new VciBaseException(msgCodePrefix + "initBoError",new String[]{btmName});
////            if (orderDTO.getSecDTOList().stream().anyMatch(s -> !unSerialSecOidList.contains(s.getSecOid())
////                && StringUtils.isBlank(s.getSecValue()))) {
////                throw new VciBaseException("非流水码段(或者必输码段)必须要输入(或选择)码值");
////            }
////        }
////        ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName));
//
//      QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>();
//      btmWrapper.eq("ID",btmName);
//      CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper);
////        OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName);
//      String userName = AuthUtil.getUser().getUserName();
//      CodeWupinEntity wupinEntity = new CodeWupinEntity();
//      wupinEntity.setOid(null);
////        bo.setRevisionid((new ObjectUtility()).getNewObjectID36());
////        bo.setNameoid((new ObjectUtility()).getNewObjectID36());
//      wupinEntity.setBtmname(btmName);
//      wupinEntity.setLastR(String.valueOf(1));
//      wupinEntity.setFirstR(String.valueOf(1));
//      wupinEntity.setFirstV(String.valueOf(1));
//      wupinEntity.setLastV(String.valueOf(1));
//      wupinEntity.setCreator(userName);
//      wupinEntity.setCreateTime(new Date());
//      wupinEntity.setLastModifier(userName);
//      wupinEntity.setLastModifyTime(new Date());
//      wupinEntity.setRevisionRule(btmTypeVO.getRevisionruleid());
//      wupinEntity.setVersionRule(String.valueOf(btmTypeVO.getVersionRule()));
//      if(StringUtils.isNotBlank(btmTypeVO.getRevisionruleid())){
//          //插个点,需要问勇哥版本问题,展示默认为1
////            OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionruleid());
//          wupinEntity.setRevisionValue("1");
//      }
//
//      wupinEntity.setRevisionSeq(1);
//      wupinEntity.setVersionSeq(1);
//      //插个点,需要问勇哥版本问题,展示默认为1
//      wupinEntity.setVersionValue("1");
//      wupinEntity.setLctid("wupinLC");
//      wupinEntity.setLcStatus("Editing");
//      wupinEntity.setId("");
//      wupinEntity.setName("");
//      wupinEntity.setDescription("");
//      wupinEntity.setOwner(userName);
//      wupinEntity.setCheckinby(userName);
//      wupinEntity.setCopyFromVersion("");
//      wupinEntity.setMaterialtype((short) 1001);
//      wupinEntity.setCaigouwl("true");
//      wupinEntity.setShifoupihaoguanli("true");
//      wupinEntity.setKucunwl("true");
//      wupinEntity.setXiaoshouwl("false");
//      wupinEntity.setPassing("true");
//
////        this.initTypeAttributeValue(wupinEntity,btmTypeVO);
//      return wupinEntity;
//
//
////        return cbo;
//  }
//
//  /**
//   * 是否为修改忽略的属性
//   * @param attrName 属性的名字
//   * @return true 表示应该忽略
//   */
//  boolean checkUnAttrUnEdit(String attrName){
//      return  (VciQueryWrapperForDO.OID_FIELD.equalsIgnoreCase(attrName)
//          ||"ts".equalsIgnoreCase(attrName)
//          || "lastmodifier".equalsIgnoreCase(attrName)
//          || "lastmodifytime".equalsIgnoreCase(attrName)
//          || "createtime".equalsIgnoreCase(attrName)
//          || "checkintime".equalsIgnoreCase(attrName)
//          ||"checkouttime".equalsIgnoreCase(attrName));
//  }
//
//  /**
//   * 保存可输可选的信息
//   *
//   * @param templateVO 模板的对象
//   * @param cboList    数据的内容
//   */
//  @Override
//  public void batchSaveSelectChar(CodeClstemplateVO templateVO, /*List<ClientBusinessObject> cboList*/
//                                  List<String> cboList) {
//      if (templateVO != null && !CollectionUtils.isEmpty(cboList)) {
//          //是异步的,所以直接循环
//          List<CodeClstempattrVO> selectAttrVOs = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getLibraryidentification())).collect(Collectors.toList());
//
//          if (!CollectionUtils.isEmpty(selectAttrVOs)) {
////                SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
//              selectAttrVOs.parallelStream().forEach(attrVO -> {
//                  List<String> valuesList = cboList;
////                    cboList.parallelStream().forEach(cbo -> {
////                        String value = cbo.get.getAttributeValue(attrVO.getId());
////                        if (StringUtils.isNotBlank(value)) {
////                            valuesList.add(value);
////                        }
////                    });
//                  if (!CollectionUtils.isEmpty(valuesList)) {
//                      for (String s : valuesList) {
//                          DictBiz dictBiz = new DictBiz();
//                          dictBiz.setCode(templateVO.getBtmTypeId());
//                          dictBiz.setDictKey(s);
//                          dictBiz.setDictValue(s);
//                          //从原来的charService(可输可选)更改为调用omd中的接口来实现
//                          iDictBizClient.getCheck(dictBiz);
//                      }
////                        charService.saveBySameNamespaceAndFlag(templateVO.getBtmTypeId(), attrVO.getLibraryIdentification(), valuesList, sessionInfo);
//                  }
//              });
//          }
//      }
//  }
//
//    @Override
//    public MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid) {
//      CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid);
//      MdmUIInfoVO uiInfoVO = new MdmUIInfoVO();
//      uiInfoVO.setTemplateVO(templateVO);
//      uiInfoVO.setFormDefineVO(wrapperFormDefineByTemplate(templateVO, codeClassifyOid));
//      wrapperResemble(templateVO, uiInfoVO);
//      return uiInfoVO;
//    }
//
//
//  /**
//   * 模板属性转换为表单定义的信息
//   *
//   * @param templateVO      模板的显示对象
//   * @param codeClassifyOid 分类的主键,为空的时候,获取模板所属的分类主键.用于产生分类注入
//   * @return 表格的信息
//   */
//  private UIFormDefineVO wrapperFormDefineByTemplate(CodeClstemplateVO templateVO, String codeClassifyOid) {
//      UIFormDefineVO formDefineVO = new UIFormDefineVO();
//      formDefineVO.setOid(templateVO.getOid());
//      formDefineVO.setBtmType(templateVO.getBtmTypeId());
//      if (StringUtils.isBlank(codeClassifyOid)) {
//          codeClassifyOid = templateVO.getCodeClassifyOid();
//      }
//      CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid);
//
//      List<UIFormItemVO> itemVOS = new ArrayList<>();
//      Map<String, List<CodeClstempattrVO>> attrGroupMap = templateVO.getAttributes().stream().
//          filter(s -> StringUtils.isNotBlank(s.getAttributegroup())).collect(Collectors.groupingBy(s -> s.getAttributegroup()));
//
//      templateVO.getAttributes().forEach(attrVO -> {
//          UIFormItemVO formItemVO = templateAttr2FormField(attrVO, templateVO.getBtmTypeId());
//          itemVOS.add(formItemVO);
//      });
//      //处理属性分组
//      if (!CollectionUtils.isEmpty(attrGroupMap)) {
//          //按照分组的属性排列,找到每一个分组的第一个属性
//          for (String key : attrGroupMap.keySet()) {
//              List<CodeClstempattrVO> value = attrGroupMap.get(key);
//              //找到这个分组的属性的第一个
//              CodeClstempattrVO attrVO = value.stream().sorted(((o1, o2) -> o1.getOrdernum().compareTo(o2.getOrdernum()))).findFirst().get();
//              //我们找到这个属性在最终的itemVOs里的位置
//              UIFormItemVO lineVO = new UIFormItemVO();
//              lineVO.setField(attrVO.getId() + "_line");
//              lineVO.setType("line");
//              lineVO.setText(key);
//              //找位置
//              for (int i = 0; i < itemVOS.size(); i++) {
//                  UIFormItemVO record = itemVOS.get(i);
//                  if (record.getField().equalsIgnoreCase(attrVO.getId())) {
//                      itemVOS.add(i, lineVO);
//                      break;
//                  }
//              }
//          }
//      }
//
//      CodeOrderDTO orderDTO = new CodeOrderDTO();
//      switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
//      if (!CollectionUtils.isEmpty(orderDTO.getData())) {
//          orderDTO.getData().forEach((key, value) -> {
//              for (int i = 0; i < itemVOS.size(); i++) {
//                  UIFormItemVO itemVO = itemVOS.get(i);
//                  if (itemVO.getField().equalsIgnoreCase(key)) {
//                      itemVO.setDefaultValue(value);
//                      break;
//                  }
//              }
//          });
//      }
//      formDefineVO.setItems(itemVOS);
//      //查询是否有分类注入的
//      return formDefineVO;
//  }
//  /**
//   * 属性类型与js中的字段类型的映射
//   */
//  private static Map<String, String> vciFieldTypeMap = new HashMap<String, String>() {{
//      put(VciFieldTypeEnum.VTString.name(), "text");
//      put(VciFieldTypeEnum.VTInteger.name(), "text");
//      put(VciFieldTypeEnum.VTLong.name(), "text");
//      put(VciFieldTypeEnum.VTDouble.name(), "text");
//      put(VciFieldTypeEnum.VTClob.name(), "text");
//      put(VciFieldTypeEnum.VTBoolean.name(), "truefalse");
//      put(VciFieldTypeEnum.VTDateTime.name(), "datetime");
//      put(VciFieldTypeEnum.VTDate.name(), "datetime");
//      put(VciFieldTypeEnum.VTTime.name(), "datetime");
//      put(VciFieldTypeEnum.VTFilePath.name(), "file");
//  }};
//
//  /**
//   * 模板属性转换为表单的字段
//   *
//   * @param attrVO  模板属性
//   * @param btmType 业务类型
//   * @return 表单的字段
//   */
//  @Override
//  public UIFormItemVO templateAttr2FormField(CodeClstempattrVO attrVO, String btmType) {
//
//      UIFormItemVO itemVO = new UIFormItemVO();
//      if (SECRET_FILED.equalsIgnoreCase(attrVO.getId())) {
////            attrVO.setEnumid(OsEnumServiceImpl.MY_DATA_SECRET);
//          attrVO.setEnumid(MY_DATA_SECRET);
//      }
//      itemVO.setField(attrVO.getId());
//      itemVO.setText(attrVO.getName());
//      itemVO.setType(vciFieldTypeMap.getOrDefault(attrVO.getAttributedatatype(), "text"));
//      if (VciBaseUtil.getBoolean(attrVO.getTextareaflag())) {
//          itemVO.setType("textarea");
//      }
//      if (VciFieldTypeEnum.VTLong.name().equalsIgnoreCase(attrVO.getAttributedatatype())
//          || VciFieldTypeEnum.VTInteger.name().equalsIgnoreCase(attrVO.getAttributedatatype())
//          || VciFieldTypeEnum.VTDouble.name().equalsIgnoreCase(attrVO.getAttributedatatype())) {
//          itemVO.setVerify("number");
//      }
//      itemVO.setReadOnly(VciBaseUtil.getBoolean(attrVO.getReadonlyflag()));
//      itemVO.setKeyAttr(VciBaseUtil.getBoolean(attrVO.getKeyattrflag()));
//      itemVO.setRequired(VciBaseUtil.getBoolean(attrVO.getRequireflag()));
//      itemVO.setDefaultValue(attrVO.getDefaultvalue());
//      itemVO.setDateFormate(attrVO.getCodedateformat());
//      itemVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getFormdisplayflag()));
//      itemVO.setVerify(attrVO.getVerifyrule());
//      itemVO.setPrefix(attrVO.getPrefixvalue());
//      itemVO.setSuffix(attrVO.getSuffixvalue());
//      itemVO.setTooltips(attrVO.getExplain());
//      itemVO.setSelectLibFlag(attrVO.getLibraryidentification());
//      //看看是否有枚举
//      if ((StringUtils.isNotBlank(attrVO.getEnumstring())
//          && !"[]".equalsIgnoreCase(attrVO.getEnumstring())) ||
//          StringUtils.isNotBlank(attrVO.getEnumid())) {
//          itemVO.setType("combox");
//          itemVO.setComboxKey(attrVO.getEnumid());
//          if (StringUtils.isNotBlank(attrVO.getEnumstring())) {
//              //指定的下拉框内容
//              itemVO.setData(JSONObject.parseArray(attrVO.getEnumstring(), KeyValue.class));
//              if (StringUtils.isBlank(attrVO.getEnumid())) {
//                  itemVO.setComboxKey(itemVO.getField() + "_data");
//              }
//          }
//      }
//      //看是否有参照
//      if (StringUtils.isNotBlank(attrVO.getReferbtmid()) || StringUtils.isNotBlank(attrVO.getReferconfig())) {
//          itemVO.setType("refer");
//          itemVO.setShowField(itemVO.getField() + "name");
//          if (StringUtils.isNotBlank(attrVO.getReferconfig())) {
//              //配置的内容
//              itemVO.setReferConfig(JSONObject.parseObject(attrVO.getReferconfig(), UIFormReferVO.class));
//          } else {
//              UIFormReferVO formReferVO = new UIFormReferVO();
//              formReferVO.setType("default");
//              formReferVO.setReferType(attrVO.getReferbtmid());
//              itemVO.setReferConfig(formReferVO);
//          }
//      }
//
//      //如果是组合规则,分类注入的,显示为只读
//      if (StringUtils.isNotBlank(attrVO.getComponentrule())) {
//          itemVO.setReadOnly(true);
//          itemVO.setTooltips("本属性为组合规则");
//          itemVO.setRequired(false);
//      }
//      if (StringUtils.isNotBlank(attrVO.getClassifyinvokeattr())) {
//          itemVO.setReadOnly(!VciBaseUtil.getBoolean(attrVO.getClassifyinvokeeditflag()));
//          itemVO.setTooltips("本属性是分类注入");
//          itemVO.setRequired(false);
//      }
//
//      if (VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(itemVO.getField())) {
//          //是生命周期状态
//          itemVO.setType("combox");
//          itemVO.setComboxKey(btmType + LC_STATUS_SUBFIX);
//      }
//      return itemVO;
//  }
//
//
//  /**
//   * 封装相似项查询的列表
//   *
//   * @param templateVO 模板的显示对象
//   * @param uiInfoVO   页面的信息
//   */
//  private void wrapperResemble(CodeClstemplateVO templateVO, MdmUIInfoVO uiInfoVO) {
//      List<CodeClstempattrVO> resembleAttrList = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getSamerepeatattrflag())
//          || VciQueryWrapperForDO.ID_FIELD.equalsIgnoreCase(s.getId())).collect(Collectors.toList());
//      if (!CollectionUtils.isEmpty(resembleAttrList) && resembleAttrList.size() > 1) {
//          UITableDefineVO resembleTable = new UITableDefineVO();
//          resembleTable.setOid(templateVO.getOid());
//          resembleTable.setBtmType(templateVO.getBtmTypeId());
//          resembleTable.setDisplayQueryArea(false);
//          resembleTable.setPageVO(new UITablePageVO());
//          //处理所有的列,这个模板没有合并的表头的情况
//          List<UITableFieldVO> fieldVOList = new ArrayList<>();
//          resembleAttrList.forEach(attrVO -> {
//              UITableFieldVO tableFieldVO = templateAttr2TableField(attrVO,false);
//              tableFieldVO.setHidden(false);
//              fieldVOList.add(tableFieldVO);
//          });
//          List<List<UITableFieldVO>> cols = new ArrayList<>();
//          cols.add(fieldVOList);
//          resembleTable.setCols(cols);
//          uiInfoVO.setResembleTableVO(resembleTable);
//      }
//  }
//
//
//  /**
//   * 模板属性转换为表格显示的配置
//   *
//   * @param attrVO 模板属性
//   * @param forEdit 是否是编辑所需
//   * @return 表格的字段
//   */
//  @Override
//  public UITableFieldVO templateAttr2TableField(CodeClstempattrVO attrVO,boolean forEdit) {
//      UITableFieldVO fieldVO = new UITableFieldVO();
//      if (SECRET_FILED.equalsIgnoreCase(attrVO.getId())) {
//          attrVO.setEnumid(MY_DATA_SECRET);
//      }
//      fieldVO.setField(attrVO.getId());
//      fieldVO.setTitle(attrVO.getName());
//      fieldVO.setFieldType(vciFieldTypeMap.getOrDefault(attrVO.getAttributedatatype(), "text"));
//      fieldVO.setSort(true);
//      fieldVO.setSortField(fieldVO.getField());
//      fieldVO.setQueryField(fieldVO.getField());
//      if (forEdit){
//          fieldVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getFormdisplayflag()));
//      }else {
//          fieldVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getTabledisplayflag()));
//      }
//      if (attrVO.getAttrtablewidth() != null && attrVO.getAttrtablewidth() > 0) {
//          fieldVO.setMinWidth(Integer.valueOf(attrVO.getAttrtablewidth()));
//          fieldVO.setWidth(Integer.valueOf(attrVO.getAttrtablewidth()));
//      }
//      //看看是否有枚举
//      if ((StringUtils.isNotBlank(attrVO.getEnumstring())
//          && !"[]".equalsIgnoreCase(attrVO.getEnumstring())) ||
//          StringUtils.isNotBlank(attrVO.getEnumid())) {
//          fieldVO.setFieldType("combox");
//          fieldVO.setField(fieldVO.getField() + "Text");
//          fieldVO.setComboxKey(attrVO.getEnumid());
//          if (StringUtils.isNotBlank(attrVO.getEnumstring())) {
//              //指定的下拉框内容
//              fieldVO.setData(JSONObject.parseArray(attrVO.getEnumstring(), KeyValue.class));
//              if (StringUtils.isBlank(attrVO.getEnumid())) {
//                  fieldVO.setComboxKey(fieldVO.getField() + "_data");
//              }
//          }else {
//              List<KeyValue> osEnumItemVOList= enumService.getEnum(attrVO.getEnumid());
//              fieldVO.setData(osEnumItemVOList);
//          }
//      }
//      //看是否有参照
//      if (StringUtils.isNotBlank(attrVO.getReferbtmid()) || StringUtils.isNotBlank(attrVO.getReferconfig())) {
//          fieldVO.setFieldType("refer");
//          fieldVO.setQueryField(fieldVO.getField());
//          fieldVO.setField(fieldVO.getField() + "name");
//          fieldVO.setShowField(fieldVO.getField());
//          if (StringUtils.isNotBlank(attrVO.getReferconfig())) {
//              //配置的内容
//              fieldVO.setReferConfig(JSONObject.parseObject(attrVO.getReferconfig(), UIFormReferVO.class));
//          } else {
//              UIFormReferVO formReferVO = new UIFormReferVO();
//              formReferVO.setType("default");
//              formReferVO.setReferType(attrVO.getReferbtmid());
//              fieldVO.setReferConfig(formReferVO);
//          }
//      }
//      if (VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(fieldVO.getSortField())) {
//          fieldVO.setField("lcstatus_text");
//      }
//      Map<String, String> eventJsMap = new HashMap<>();
//      //超链接与模板是互斥
//      if (StringUtils.isNotBlank(attrVO.getTablehref())) {
//          String event = fieldVO.getSortField() + "_href";
//          eventJsMap.put(event, attrVO.getTablehref());
//          fieldVO.setTemplet("function(d){ return '<a class=\"layui-btn layui-btn-intable \" lay-event=\"" + event + "\">d." + fieldVO.getField() + "</a>';}");
//      }
//      if (StringUtils.isNotBlank(attrVO.getTabledisplayjs())) {
//          //直接写function(d){ return xxxxx;}
//          fieldVO.setTemplet(attrVO.getTabledisplayjs());
//      }
//      if (StringUtils.isBlank(fieldVO.getTemplet()) && VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(attrVO.getAttributedatatype())) {
//          fieldVO.setTemplet("function(d){return $webUtil.formateBoolean(d." + fieldVO.getField() + ");}");
//      }
//      fieldVO.setOptionJsMap(eventJsMap);
//      fieldVO.setStyle(attrVO.getTabledisplaystyle());
//      //列表里不允许直接编辑
//      fieldVO.setDateFormate(attrVO.getCodedateformat());
//      return fieldVO;
//  }
//
//
//  /**
//   * 相似项查询
//   *
//   * @param orderDTO 编码的相关信息
//   * @return 数据列表
//   */
//  @Override
//  public DataGrid<Map<String, String>> resembleQuery(CodeOrderDTO orderDTO) {
//      VciBaseUtil.alertNotNull(orderDTO, "申请的信息", orderDTO.getCodeClassifyOid(), "分类主键", orderDTO.getTemplateOid(), "模板主键");
//      CodeClassifyFullInfoBO fullInfoBO = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
//      CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
//      switchClassifyLevelOnOrder(templateVO, fullInfoBO, orderDTO);
//      switchDateAttrOnOrder(templateVO, orderDTO);
//      switchComponentAttrOnOrder(templateVO, orderDTO);
//      //需要获取是否有相似查询属性
//      Map<String, CodeClassifyTemplateAttrVO> attrVOs = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getSamerepeatattrflag())).collect(Collectors.toMap(s -> s.getId(), t -> t));
//      if (CollectionUtils.isEmpty(attrVOs)) {
//          //都没有属性,肯定不能查询了
//          return new DataGrid<>();
//      }
//      Map<String, String> conditionMap = new HashMap<>();
//      //我们首先获取有没有查询规则
//      CodeResembleRuleVO resembleRuleVO = Optional.ofNullable(getUseResembleRule(fullInfoBO, fullInfoBO.getCurrentClassifyVO())).orElseGet(() -> new CodeResembleRuleVO());
//      attrVOs.forEach((attrId, attrVO) -> {
//          String value = getValueFromOrderDTO(orderDTO, attrId);
//          if (value == null) {
//              value = "";
//          }
//          wrapperResembleConditionMap(value, resembleRuleVO, attrId, conditionMap);
//      });
//
//      //没有限制分类,但是一个模板只可能在一个业务类型里面,所以直接查询这个业务类型即可
//      if (!CollectionUtils.isEmpty(conditionMap)) {
//          Map<String, String> andConditionMap = new HashMap<>();
//          andConditionMap.put("islastr", "1");
//          andConditionMap.put("islastv", "1");
//          if (StringUtils.isNotBlank(orderDTO.getOid())) {
//              andConditionMap.put("oid", QueryOptionConstant.NOTEQUAL + orderDTO.getOid());
//          }
//          conditionMap.putAll(andConditionMap);
//          PageHelper pageHelper = new PageHelper(-1);
//          pageHelper.addDefaultDesc("id");
//          return queryGrid(fullInfoBO.getTopClassifyVO().getBtmtypeid(), templateVO, conditionMap, pageHelper);
//      }
//      return new DataGrid<>();
//  }
//
//  /**
//   * 获取使用的相似查询规则
//   *
//   * @param fullInfoBO        类全部信息
//   * @param currentClassifyVO 当前的分类
//   * @return 规则,如果不存在会返回Null
//   */
//  @Override
//  public CodeResembleRuleVO getUseResembleRule(CodeClassifyFullInfoBO fullInfoBO, CodeClassifyVO currentClassifyVO) {
//      if (currentClassifyVO == null) {
//          return null;
//      }
//      if (currentClassifyVO != null && StringUtils.isNotBlank(currentClassifyVO.getCodeResembleRuleOid())) {
//          //说明已经存在
//          return resembleRuleService.getObjectByOid(currentClassifyVO.getCodeResembleRuleOid());
//      }
//      if (StringUtils.isBlank(currentClassifyVO.getParentcodeclassifyoid())) {
//          return null;
//      }
//      Map<String, CodeClassifyVO> classifyVOMap = fullInfoBO.getParentClassifyVOs().stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
//      return getUseResembleRule(fullInfoBO, classifyVOMap.getOrDefault(currentClassifyVO.getParentcodeclassifyoid(), null));
//  }
//
//  /**
//   * 封装相似项查询的查询条件的映射
//   *
//   * @param value          值
//   * @param resembleRuleVO 相似项规则
//   * @param attrId         属性的编号
//   * @param conditionMap   查询条件
//   */
//  @Override
//  public void wrapperResembleConditionMap(String value, CodeResembleRuleVO resembleRuleVO, String attrId, Map<String, String> conditionMap) {
//      boolean ignoreSpace = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorespaceflag()) || VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag());
//      if (StringUtils.isBlank(value)) {
//          //为空的时候就不查询它就是
//      } else {
//          String queryKey = "";
//          String queryValue = "";
//          boolean ignoreCase = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorecaseflag());
//          boolean ignoreWidth = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorewidthflag());
//          boolean trimAll = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag());
//          boolean trim = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag());
//          String temp = "";
//          if (ignoreCase && ignoreSpace && ignoreWidth) {
//              //忽略大小写,且去空,忽略全半角
//              temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte('%s')) " + (trimAll ? ",' ','')" : ")");
//          } else if (ignoreCase && ignoreSpace && !ignoreWidth) {
//              //忽略大小写、去空、不忽略全半角
//              temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")");
//          } else if (ignoreCase && !ignoreSpace && ignoreWidth) {
//              //忽略大小写、不去空、忽略全半角
//              temp = "UPPER(to_single_byte('%s'))";
//          } else if (!ignoreCase && ignoreSpace && ignoreWidth) {
//              //不忽略大小写、去空、忽略全半角
//              temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte('%s') " + (trimAll ? ",' ','')" : ")");
//          } else if (ignoreCase && !ignoreSpace && !ignoreWidth) {
//              //忽略大小写、不去空、不忽略全半角
//              temp = "UPPER(%s)";
//          } else if (!ignoreCase && !ignoreCase && ignoreWidth) {
//              //不忽略大小写、不去空、忽略全半角
//              temp = "to_single_byte('%s')";
//          } else if (!ignoreCase && ignoreSpace && !ignoreWidth) {
//              //不忽略大小写、去空、不忽略全半角
//              temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")");
//          } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) {
//              //不忽略大小写、不去空、不忽略全半角
//              temp = "%s";
//          }
//          if (StringUtils.isNotBlank(resembleRuleVO.getLinkCharacter())) {
//              List<String> chars = VciBaseUtil.str2List(resembleRuleVO.getLinkCharacter());
//              for (int i = 0; i < chars.size(); i++) {
//                  String s = chars.get(i);
//                  temp = "replace(" + temp + ",'" + s + "','')";
//              }
//          }
//          queryValue = String.format(temp, (trim ? value.trim() : value));
//          temp = temp.replace("to_single_byte('%s')","to_single_byte(%s)");
//          queryKey = String.format(temp, "t."+attrId);
//          conditionMap.put(queryKey, QueryOptionConstant.OR + queryValue);
//      }
//  }
//
//
//  /**
//   * 查询编码数据的列表
//   *
//   * @param btmType      业务类型
//   * @param templateVO   模板的对象,需要包含模板的属性
//   * @param conditionMap 查询条件
//   * @param pageHelper   分页对象
//   * @return 数据列表
//   */
//  @Override
//  public DataGrid<Map<String, String>> queryGrid(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) {
//      CodeTemplateAttrSqlBO sqlBO = getSqlByTemplateVO(btmType, templateVO, conditionMap, pageHelper);
////        List<Map> maps = boService.queryByOnlySqlForMap(sqlBO.getSqlHasPage());
//      List<Map> maps = commonsMapper.selectBySql(sqlBO.getSqlHasPage());
//      DataGrid<Map<String, String>> dataGrid = new DataGrid<>();
//      List<Map<String, String>> dataList = new ArrayList<>();
//      if (!CollectionUtils.isEmpty(maps)) {
//          maps.stream().forEach(map -> {
//              Map<String, String> data = new HashMap<>();
//              map.forEach((key, value) -> {
//                  data.put(((String) key).toLowerCase(Locale.ROOT), (String) value);
//              });
//              dataList.add(data);
//          });
//      }
//      dataGrid.setData(dataList);
//      if (!CollectionUtils.isEmpty(dataList)) {
//          wrapperData(dataGrid.getData(), templateVO, sqlBO.getSelectFieldList(), false);
//          dataGrid.setTotal(Long.parseLong(commonsMapper.selectBySql(sqlBO.getSqlCount()).get(0).values().toArray()[0].toString()););
//      }
//      return dataGrid;
//  }
//
//
//  /**
//   * 封装查询出来的数据
//   *
//   * @param dataMap              数据的映射
//   * @param templateVO           模板的属性
//   * @param onlySelectAttrIdList 仅仅查询的属性字段
//   * @param form 表单里使用
//   */
//  @Override
//  public void wrapperData(List<Map<String, String>> dataMap, CodeClassifyTemplateVO templateVO,
//                          Collection<String> onlySelectAttrIdList, boolean form) {
//      if (onlySelectAttrIdList == null) {
//          onlySelectAttrIdList = new ArrayList<>();
//      }
//      //先转换一下时间格式
//      List<String> finalOnlySelectAttrIdList = onlySelectAttrIdList.stream().collect(Collectors.toList());
//      List<CodeClassifyTemplateAttrVO> dateFormatAttrVOs = templateVO.getAttributes().stream().filter(
//          s -> StringUtils.isNotBlank(s.getCodeDateFormat()) &&
//              (finalOnlySelectAttrIdList.size() == 0 || finalOnlySelectAttrIdList.contains(s.getId().toLowerCase(Locale.ROOT)))
//      ).collect(Collectors.toList());
//      //枚举的内容
//      List<CodeClassifyTemplateAttrVO> enumAttrVOs = templateVO.getAttributes().stream().filter(
//          s -> (StringUtils.isNotBlank(s.getEnumId()) || StringUtils.isNotBlank(s.getEnumString()))
//              &&
//              (finalOnlySelectAttrIdList.size() == 0 || finalOnlySelectAttrIdList.contains(s.getId().toLowerCase(Locale.ROOT)))
//      ).collect(Collectors.toList());
//
//      List<String> userIds = new ArrayList<>();
//      dataMap.stream().forEach(data -> {
//          //处理时间
//          if (!form) {
//              //表单的时候只能用统一的时间格式
//              wrapperDateFormat(dateFormatAttrVOs, data);
//          }
//          //处理枚举
//          wrapperEnum(enumAttrVOs, data);
//          String lcstatus = data.get(VciQueryWrapperForDO.LC_STATUS_FIELD);
//          String copyFromVersion = data.getOrDefault(COPY_FROM_VERSION,"");
//          if ((CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus) || CodeDefaultLC.AUDITING.getValue().equalsIgnoreCase(lcstatus))
//              && StringUtils.isBlank(copyFromVersion)
//          ) {
//              data.put(VciQueryWrapperForDO.ID_FIELD, "******");
//          }
//          data.put(VciQueryWrapperForDO.LC_STATUS_FIELD_TEXT.toLowerCase(Locale.ROOT), CodeDefaultLC.getTextByValue(lcstatus));
//          if(CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus)
//              && StringUtils.isNotBlank(copyFromVersion)){
//              data.put(VciQueryWrapperForDO.LC_STATUS_FIELD_TEXT.toLowerCase(Locale.ROOT), "修改中");
//          }
//          if (data.containsKey("creator")) {
//              userIds.add(data.get("creator"));
//          }
//          if (data.containsKey("lastmodifier")) {
//              userIds.add(data.get("lastmodifier"));
//          }
//      });
//      if (!CollectionUtils.isEmpty(userIds)) {
//          Map<String, SmUserVO> userVOMap = Optional.ofNullable(userQueryService.listUserByUserIds(userIds)).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
//          dataMap.stream().forEach(data -> {
//              String creator = data.getOrDefault("creator", null);
//              if (StringUtils.isNotBlank(creator) && userVOMap.containsKey(creator.toLowerCase(Locale.ROOT))) {
//                  data.put("creator", creator + "(" + userVOMap.get(creator.toLowerCase(Locale.ROOT)).getName() + ")");
//              }
//              String lastmodifier = data.getOrDefault("lastmodifier", null);
//              if (StringUtils.isNotBlank(lastmodifier) && userVOMap.containsKey(lastmodifier.toLowerCase(Locale.ROOT))) {
//                  data.put("lastmodifier", lastmodifier + "(" + userVOMap.get(lastmodifier.toLowerCase(Locale.ROOT)).getName() + ")");
//              }
//          });
//      }
//  }
//
//
//  /**
//   * 处理时间格式
//   *
//   * @param dateFormatAttrVOs 时间格式的属性
//   * @param data              当前行数据
//   */
//  private void wrapperDateFormat(Collection<CodeClassifyTemplateAttrVO> dateFormatAttrVOs, Map<String, String> data) {
//      if (!CollectionUtils.isEmpty(dateFormatAttrVOs)) {
//          dateFormatAttrVOs.stream().forEach(dateFormatAttrVO -> {
//              String attrId = dateFormatAttrVO.getId().toLowerCase(Locale.ROOT);
//              String oldValue = data.getOrDefault(attrId, null);
//              if (StringUtils.isNotBlank(oldValue)) {
//                  DateConverter dateConverter = new DateConverter();
//                  try {
//                      dateConverter.setAsText(oldValue);
//                      Date value = dateConverter.getValue();
//                      if (value != null) {
//                          data.put(attrId, VciDateUtil.date2Str(value, dateFormatAttrVO.getCodeDateFormat()));
//                      }
//                  } catch (Throwable e) {
//                      //转换可能有问题,这就使用原本存储的值
//                  }
//              }
//          });
//      }
//  }
//
//
//  /**
//   * 处理枚举的内容,如果不在枚举中,会返回原本的值
//   *
//   * @param enumAttrVOs 枚举属性
//   * @param data        当前行数据
//   */
//  private void wrapperEnum(Collection<CodeClassifyTemplateAttrVO> enumAttrVOs, Map<String, String> data) {
//      //处理枚举的内容,为了兼容以前的数据,如果数据不能使用枚举转换的话,那还是显示以前的值
//      if (!CollectionUtils.isEmpty(enumAttrVOs)) {
//          enumAttrVOs.stream().forEach(enumAttrVO -> {
//              String attrId = enumAttrVO.getId().toLowerCase(Locale.ROOT);
//              String oldValue = data.getOrDefault(attrId, null);
//              if (StringUtils.isNotBlank(oldValue)) {
//                  List<KeyValue> comboxKVs = listComboboxItems(enumAttrVO);
//                  String newValue = oldValue;
//                  KeyValue keyValue = Optional.ofNullable(comboxKVs).orElseGet(() -> new ArrayList<>()).stream().filter(s -> s.getKey().equalsIgnoreCase(oldValue)).findFirst().orElseGet(() -> null);
//                  if (keyValue != null) {
//                      newValue = keyValue.getValue();
//                  }
//                  data.put(attrId + "Text", newValue);
//              }
//          });
//      }
//  }
//
//
//  /**
//   * 根据模板属性生成相应的sql信息
//   *
//   * @param btmType      业务类型
//   * @param templateVO   模板显示对象,必须包含属性
//   * @param conditionMap 查询条件
//   * @param pageHelper   分页和排序对象
//   * @return sql的相关信息
//   */
//  @Override
//  public CodeTemplateAttrSqlBO getSqlByTemplateVO(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) {
//      //因为参照不一定是在平台的属性池里面设置,所以我们得需要自行处理
//      //参考VciQueryWrapper来处理
//      //1. 找到所有的字段,
//      Map<String, CodeClassifyTemplateAttrVO> attrVOMap = templateVO.getAttributes().stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
//      List<String> selectFieldList = attrVOMap.keySet().stream().collect(Collectors.toList());
//
//      //所有的参照的字段
//      Map<String/**属性字段**/, String> joinTableList = new ConcurrentHashMap<>();
//      List<CodeClassifyTemplateAttrVO> referAttrVOs = templateVO.getAttributes().stream().filter(
//          s -> StringUtils.isNotBlank(s.getReferBtmId()) || StringUtils.isNotBlank(s.getReferConfig())
//      ).collect(Collectors.toList());
//      Map<String/**参照的属性**/, String/**实际的字段**/> referFieldMap = new HashMap<>();
//      if (!CollectionUtils.isEmpty(referAttrVOs)) {
//          referAttrVOs.parallelStream().forEach(attrVO -> {
//              UIFormReferVO referVO = null;
//              if (StringUtils.isNotBlank(attrVO.getReferConfig())) {
//                  referVO = JSONObject.parseObject(attrVO.getReferConfig(), UIFormReferVO.class);
//              } else {
//                  referVO = new UIFormReferVO();
//                  referVO.setReferType(attrVO.getReferBtmId());
//                  referVO.setValueField(VciQueryWrapperForDO.OID_FIELD);
//                  referVO.setTextField("name");
//              }
//
//              String referTable = VciBaseUtil.getTableName(referVO.getReferType());
//              String referTableNick = attrVO.getId() + "0";
//              String left = " left join " + referTable + " " + referTableNick + " on " + referTableNick + "." + referVO.getValueField() + " =  t." + attrVO.getId();
//              joinTableList.put(attrVO.getId(), left);
//              String referShowField = attrVO.getId() + "Name";
//              List<String> textFields = VciBaseUtil.str2List(referVO.getTextField());
//              String showFieldInSource = "";
//              if (textFields.contains("name")) {
//                  showFieldInSource = "name";
//              } else {
//                  showFieldInSource = textFields.get(0);
//              }
//              referFieldMap.put(attrVO.getId(), referTableNick + "." + showFieldInSource);
//              selectFieldList.add(referTableNick + "." + showFieldInSource + " as " + referShowField);
//          });
//      }
//      Optional.ofNullable(attributeService.getDefaultAttributeVOMap()).orElseGet(() -> new HashMap<>()).keySet().stream().forEach(attrId -> {
//          if (!selectFieldList.contains(attrId) && !"secretgrade".equalsIgnoreCase(attrId)) {
//              selectFieldList.add(attrId);
//          }
//      });
//      if (!selectFieldList.contains(CODE_FIELD)) {
//          selectFieldList.add(CODE_FIELD);
//      }
//      if (!selectFieldList.contains(CODE_CLASSIFY_OID_FIELD)) {
//          selectFieldList.add(CODE_CLASSIFY_OID_FIELD);
//      }
//      if (!selectFieldList.contains(CODE_TEMPLATE_OID_FIELD)) {
//          selectFieldList.add(CODE_TEMPLATE_OID_FIELD);
//      }
//      if (!selectFieldList.contains(CODE_FULL_PATH_FILED)) {
//          selectFieldList.add(CODE_FULL_PATH_FILED);
//      }
//
//      //处理查询条件
//      //TODO 验证sql注入
//      List<String> andSql = new ArrayList<>();
//      List<String> orSql = new ArrayList<>();
//      if (!CollectionUtils.isEmpty(conditionMap)) {
//          Map<String, String> orConditionMap = new HashMap<>();
//          Map<String, String> andCondtionMap = new HashMap<>();
//          //先分离or的查询条件,另外当查询条件是空的时候也不查询
//          conditionMap.forEach((k, v) -> {
//              if (StringUtils.isNotBlank(v)) {
//                  if (v.startsWith(QueryOptionConstant.OR)) {
//                      orConditionMap.put(k, v.substring(QueryOptionConstant.OR.length()));
//                  } else {
//                      andCondtionMap.put(k, v);
//                  }
//              }
//          });
//
//          andCondtionMap.forEach((k, v) -> {
//              andSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, attrVOMap));
//          });
//          orConditionMap.forEach((k, v) -> {
//              orSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, attrVOMap));
//          });
//      }
//      //组合起来
//      StringBuilder andSb = new StringBuilder();
//      andSql.stream().forEach(s -> {
//          andSb.append(s).append(SPACE).append(QueryOptionConstant.AND).append(SPACE);
//      });
//
//      String andString = andSb.toString().trim();
//      String endWithSql = QueryOptionConstant.AND;
//      if (andString.endsWith(endWithSql)) {
//          andString = andString.substring(0, andString.length() - endWithSql.length());
//      }
//
//      String orString = orSql.stream().collect(Collectors.joining(" or "));
//      String whereSql = "";
//      if (StringUtils.isNotBlank(orString)) {
//          if (StringUtils.isBlank(andString)) {
//              andString = " 1 = 1 ";
//          }
//          whereSql = SPACE + "(" + SPACE + andString + SPACE + ") and (" + SPACE + orString + SPACE + ")" + SPACE;
//      } else {
//          whereSql = andString + SPACE;
//      }
//      if (attrVOMap.keySet().contains("secretgrade")) {
//          Integer userSecret = VciBaseUtil.getCurrentUserSecret();
//          if (userSecret == null || userSecret == 0) {
//              userSecret = secretService.getMinUserSecret();
//          }
//          whereSql += " and ( t.secretGrade <= " + userSecret + ") ";
//      }
//      String tableName = VciBaseUtil.getTableName(btmType);
//      String sql = "select " + selectFieldList.stream().map(s -> (s.contains(".") ? s : ("t." + s))).collect(Collectors.joining(","))
//          + " from " + tableName + SPACE + "t" + SPACE
//          + joinTableList.values().stream().collect(Collectors.joining(SPACE))
//          + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql;
//      if (pageHelper == null) {
//          pageHelper = new PageHelper(-1);
//      }
//      //看看排序
//      String orderSql = pageHelper.getOrderSql("t");
//      sql += (orderSql == null ? "" : orderSql);
//      String whereSubfixForPage = " ) A where rownum < " + (pageHelper.getLimit() * pageHelper.getPage() + 1) + ") where RN >= "
//          + (pageHelper.getLimit() * (pageHelper.getPage() - 1) + 1);
//      String sqlHasPage = pageHelper.getLimit() > 0 ? ("select * from (select A.*,rownum RN from (" + sql + whereSubfixForPage) : sql;
//      String sqlCount = "select count(1) from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE))
//          + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql;
//      CodeTemplateAttrSqlBO sqlBO = new CodeTemplateAttrSqlBO();
//      sqlBO.setTableName(tableName);
//      sqlBO.setJoinTable(joinTableList);
//      sqlBO.setNickName("t");
////        sqlBO.setPageHelper(pageHelper);
//      sqlBO.setSqlHasPage(sqlHasPage);
//      sqlBO.setSqlCount(sqlCount);
//      sqlBO.setSqlUnPage(sql);
//      return sqlBO;
//  }
//
//
//  /**
//   * 组合查询条件的sql
//   *
//   * @param key           字段
//   * @param value         名字
//   * @param referFieldMap 参照的字段
//   * @param attrVOMap     属性的映射
//   * @return Sql语句
//   */
//  private String getConditionSql(String key, String value, Map<String/**参照的属性**/, String/**实际的属性**/> referFieldMap, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) {
//      if (key.endsWith("_begin")) {
//          //说明是>=的。我们需要先获取一下
//          String field = (key.substring(0, key.length() - 6).toLowerCase().trim());
//          if (referFieldMap.containsKey(field)) {
//              //说明还是参照里面的,我们默认这种情况下都是字符串吧,因为参照的属性不一定用的平台的属性池里的,所以大部分情况下,显示的属性都是字符串吧
//              return referFieldMap.get(field) + SPACE + " >= '" + value + "'" + SPACE;
//          } else {
//              return (field.contains(".") ? "" : "t.") + field + SPACE + " >= " + getStringValueInWhere(value, field, attrVOMap);
//          }
//      } else if (key.endsWith("_end")) {
//          //说明是<=的。我们需要先获取一下
//          String field = (key.substring(0, key.length() - 6).toLowerCase().trim());
//          if (referFieldMap.containsKey(field)) {
//              //说明还是参照里面的,我们默认这种情况下都是字符串吧,因为参照的属性不一定用的平台的属性池里的,所以大部分情况下,显示的属性都是字符串吧
//              return referFieldMap.get(field) + SPACE + " <= '" + value + "'" + SPACE;
//          } else {
//              return (field.contains(".") ? "" : "t.") + field + SPACE + " <= " + getStringValueInWhere(field, value, attrVOMap);
//          }
//      } else {
//          if (referFieldMap.containsKey(key)) {
//              //说明是参照的,我们参照的查询都认为是字符串,如果是时间格式的查询肯定有问题,
//              String selectKey = referFieldMap.get(key);
//              return getSqlByValue(selectKey, value, null);
//          } else {
//              return getSqlByValue(key, value, attrVOMap);
//          }
//      }
//
//  }
//
//  /**
//   * 获取查询条件中的值的,处理不同的类型
//   *
//   * @param value 值
//   * @param field 字段名称
//   * @return 日期或者时间格式会包括to_date,字符串会加'
//   */
//  private String getStringValueInWhere(String field, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) {
//      if ((field.contains(".") && !field.toLowerCase(Locale.ROOT).startsWith("t.")) || attrVOMap == null
//          || !field.replace("t.", "").matches(RegExpConstant.LETTER) || value.startsWith(ONLY)) {
//          //说明可能是指定的某个条件,直接返回
//          if (value.startsWith(ONLY)) {
//              value = value.replace(ONLY, "");
//          }
//          if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) {
//              return value;
//          }
//          if (field.contains(".") && attrVOMap != null && attrVOMap.containsKey(field.split("\\.")[0].toLowerCase(Locale.ROOT))) {
//              //是参照
//              return "'" + value + "'";
//          } else {
//              return value;
//          }
//      } else {
//          //看看是不是这个对象里的属性
//          if (attrVOMap.containsKey(field)) {
//              VciFieldTypeEnum fieldTypeEnum = VciFieldTypeEnum.valueOf(attrVOMap.get(field).getAttributeDataType());
//              if ("ts".equalsIgnoreCase(field)) {
//                  return "to_timestamp('" + value + "', '" + DATETIME_FORMAT + ".ff')";
//              }
//              DateConverter dateConverter = new DateConverter();
//              if (VciFieldTypeEnum.VTDateTime.equals(fieldTypeEnum)) {
//                  //实际上,数据库都是timestamp的类型.
//                  dateConverter.setAsText(value);
//                  return "to_date('" + dateConverter.getAsText(VciDateUtil.DateTimeFormat) + "','" + DATETIME_FORMAT + "')";
//              } else if (VciFieldTypeEnum.VTDate.equals(fieldTypeEnum)) {
//                  dateConverter.setAsText(value);
//                  return "to_date('" + dateConverter.getAsText(VciDateUtil.DateFormat) + "','" + DATE_FORMAT + "')";
//              } else if (VciFieldTypeEnum.VTDouble.equals(fieldTypeEnum)
//                  || VciFieldTypeEnum.VTLong.equals(fieldTypeEnum)
//                  || VciFieldTypeEnum.VTInteger.equals(fieldTypeEnum)) {
//                  return value;
//              } else {
//                  return "'" + value + "'";
//              }
//          } else {
//              if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) {
//                  return value;
//              }
//              return "'" + value + "'";
//          }
//      }
//
//  }
//
//  /**
//   * 封装最终的sql语句中的值部分
//   *
//   * @param selectKey 查询的字段
//   * @param value     值
//   * @param attrVOMap 属性的显示对象映射
//   * @return sql里的值
//   */
//  private String getSqlByValue(String selectKey, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) {
//      StringBuilder sql = new StringBuilder();
//      if (!selectKey.contains(".") && (attrVOMap.containsKey(selectKey.toLowerCase(Locale.ROOT)) || attributeService.isDefaultAttr(selectKey) || selectKey.matches(RegExpConstant.LETTER))) {
//          sql.append("t.");
//      }
//      if (value.startsWith(QueryOptionConstant.IN)) {
//          sql.append(selectKey)
//              .append(SPACE)
//              .append("in")
//              .append(SPACE)
//              .append("(")
//              .append(value.replace(QueryOptionConstant.IN, ""))
//              .append(")");
//      } else if (value.startsWith(QueryOptionConstant.NOTIN)) {
//          sql.append(selectKey)
//              .append(SPACE)
//              .append("not in")
//              .append(SPACE)
//              .append("(")
//              .append(value.replace(QueryOptionConstant.NOTIN, ""))
//              .append(")");
//      } else if (value.startsWith(QueryOptionConstant.NOTEQUAL)) {
//          value = value.replace(QueryOptionConstant.NOTEQUAL, "");
//          value = getStringValueInWhere(selectKey, value, attrVOMap);
//          sql.append(selectKey)
//              .append(SPACE)
//              .append(QueryOptionConstant.NOTEQUAL)
//              .append(SPACE)
//              .append(value);
//      } else if (value.startsWith(QueryOptionConstant.MORETHAN)) {
//          value = value.replace(QueryOptionConstant.MORETHAN, "");
//          value = getStringValueInWhere(selectKey, value, attrVOMap);
//          sql.append(selectKey)
//              .append(SPACE)
//              .append(QueryOptionConstant.MORETHAN)
//              .append(SPACE)
//              .append(value);
//      } else if (value.startsWith(QueryOptionConstant.MORE)) {
//          value = value.replace(QueryOptionConstant.MORE, "");
//          value = getStringValueInWhere(selectKey, value, attrVOMap);
//          sql.append(selectKey)
//              .append(SPACE)
//              .append(QueryOptionConstant.MORE)
//              .append(SPACE)
//              .append(value);
//      } else if (value.startsWith(QueryOptionConstant.LESSTHAN)) {
//          value = value.replace(QueryOptionConstant.LESSTHAN, "");
//          value = getStringValueInWhere(selectKey, value, attrVOMap);
//
//          sql.append(selectKey)
//              .append(SPACE)
//              .append(QueryOptionConstant.LESSTHAN)
//              .append(SPACE)
//              .append(value);
//      } else if (value.startsWith(QueryOptionConstant.LESS)) {
//          value = value.replace(QueryOptionConstant.LESS, "");
//          value = getStringValueInWhere(selectKey, value, attrVOMap);
//
//          sql.append(selectKey)
//              .append(SPACE)
//              .append(QueryOptionConstant.LESS)
//              .append(SPACE)
//              .append(value);
//      } else if (value.startsWith(QueryOptionConstant.ISNOTNULL)) {
//          sql.append(selectKey)
//              .append(SPACE)
//              .append(" is not null");
//      } else if (value.startsWith(QueryOptionConstant.ISNULL)) {
//          sql.append(selectKey)
//              .append(SPACE)
//              .append(" is null");
//      } else if (value.contains("*")) {
//          //说明是like,或者lefe like ,right like
//          value = getStringValueInWhere(selectKey, value, attrVOMap);
//          sql.append(selectKey)
//              .append(SPACE)
//              .append("like")
//              .append(SPACE)
//              //   .append("'")
//              .append(value.replace("*", "%"))
//              //  .append("'")
//              .append(SPACE);
//      } else {
//          value= value.replace(SPECIAL_CHAR,REQUIRED_CHAR);
//          value = getStringValueInWhere(selectKey, value, attrVOMap);
//
//          sql.append(selectKey)
//              .append(SPACE)
//              .append(QueryOptionConstant.EQUAL)
//              .append(SPACE)
//              .append(value);
//      }
//      sql.append(SPACE);
//      return sql.toString();
//  }
//
//  /**
//   * 修改主题库数据
//   *
//   * @param orderDTO 数据的内容,不用包含码段的内容了
//   */
//  @Override
//  public void editSaveCode(CodeOrderDTO orderDTO) {
//      VciBaseUtil.alertNotNull(orderDTO, "编码申请相关的属性的内容都为空", orderDTO.getOid(), "数据主键",
//          orderDTO.getCodeClassifyOid(), "主题库分类的主键");
////        CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
//      CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
//      //找业务类型,然后使用主键去获取数据库里的数据
////        List<ClientBusinessObject> cbos = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), WebUtil.getOidQuery(orderDTO.getOid()));
//
//      QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>();
//      btmWrapper.eq("OID",orderDTO.getOid());
//      CodeWupinEntity cbo = codeOsbtmtypeMapper.selectOne(btmWrapper);
//
////        CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
////        CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid());
//
//      if (cbo != null) {
//          throw new VciBaseException(DATA_OID_NOT_EXIST);
//      }
////        ClientBusinessObject cbo = cbos.get(0);
//      if (!cbo.getTs().toString().contains(VciDateUtil.date2Str(orderDTO.getTs(), VciDateUtil.DateTimeFormat))) {
//          throw new VciBaseException("数据不是最新的,可能他人已经修改,请刷新后再试");
//      }
//      if (!CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(cbo.getLcStatus()) && !orderDTO.isEditInProcess()) {
//          throw new VciBaseException("数据不是{0}的状态,不允许修改", new String[]{CodeDefaultLC.EDITING.getText()});
//      }
//
//      //注意模板不能使用数据存储的时候的模板,因为可能会变化
//
//      //1. 判断必输项
//      CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
//      checkRequiredAttrOnOrder(templateVO, orderDTO);
//      //2.先注入,再组合,最后校验
//      switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
//      //3.处理组合规则。组合规则不能使用编码的属性,因为编码的生成可能是需要属性的
//      switchComponentAttrOnOrder(templateVO, orderDTO);
//      //4.校验规则
//      checkVerifyOnOrder(templateVO, orderDTO);
//      //5.判断关键属性
//      checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO);
//      //6.校验枚举的内容是否正确
//      checkEnumOnOrder(templateVO, orderDTO);
//      //7.处理时间格式,在数据库里面不论是字符串还是日期格式,都使用相同的格式存储
//      switchDateAttrOnOrder(templateVO, orderDTO);
//      //默认的内容不能变,所以只需要拷贝自定义的相关属性即可
//      copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true);
//      //企业码和集团码的不修改
//      cbo.setDescription(orderDTO.getDescription());
//      cbo.setName(orderDTO.getName());
//      try {
//          cbo.setDescription(orderDTO.getDescription());
//          cbo.setName(orderDTO.getName());
//////          cbo.setAttributeValueWithNoCheck("description", orderDTO.getDescription());
////            cbo.setAttributeValue("name", orderDTO.getName());
//      } catch (Exception e) {
//          e.printStackTrace();
//      }
//
//
//      List<CodeWupinEntity> cboList = new ArrayList<>();
//
//      //备注
//      cbo.setDescription(orderDTO.getDescription());
//      cboList.add(cbo);
////    }
////
////    /**
////     * 校验属性是否为必输
////     *
////     * @param templateVO 模板的显示对象,需要包含模板属性
////     * @param orderDTO   编码申请的信息
////     */
////    private void checkRequiredAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
////        Map<String, CodeClstempattrVO> requiredAttrMap = templateVO.getAttributes().stream().filter(
////                s -> VciBaseUtil.getBoolean(s.getRequireflag()) && StringUtils.isBlank(s.getComponentrule())
////                    && StringUtils.isBlank(s.getClassifyinvokeattr()))
////            .collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
////        if (!CollectionUtils.isEmpty(requiredAttrMap)) {
////            requiredAttrMap.forEach((attrId, attrVO) -> {
////                //只有企业编码,状态,备注,模板主键,分类主键这几个是固定的,其余都是自行配置的
////                if (StringUtils.isBlank(getValueFromOrderDTO(orderDTO, attrId))) {
////                    throw new VciBaseException("属性【{0}】必须要输入(选择)内容", new String[]{attrVO.getName()});
////                }
////            });
////        }
////    }
////
////    /**
////     * 从编码申请信息对象上获取某个属性的值
////     *
////     * @param orderDTO 编码申请对象
////     * @param attrId   属性的编号
////     * @return 值
////     */
////    private String getValueFromOrderDTO(CodeOrderDTO orderDTO, String attrId) {
////        attrId = attrId.toLowerCase(Locale.ROOT);
////        String value = null;
////        if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) {
////            value = WebUtil.getStringValueFromObject(WebUtil.getValueFromField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO));
////        } else {
////            //说明是自行配置的
////            //前端必须要传递小写的属性
////            value = orderDTO.getData().getOrDefault(attrId, "");
////        }
////        return value;
////    }
////
////    /**
////     * 转换组合规则的值
////     *
////     * @param templateVO 模板的显示对象,需要包含模板属性
////     * @param orderDTO   编码申请的信息
////     */
////    private void switchComponentAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
////        Map<String, CodeClstempattrVO> compAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getComponentrule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
////        if (!CollectionUtils.isEmpty(compAttrVOMap)) {
////            Map<String, String> dataMap = WebUtil.objectToMapString(orderDTO);
////
////            Map<String, String> dataLowMap = new HashMap<>();
////            if (!CollectionUtils.isEmpty(dataMap)) {
////                dataMap.forEach((key, value) -> {
////                    dataLowMap.put(key.toLowerCase(Locale.ROOT), value);
////                });
////            }
////            dataLowMap.putAll(orderDTO.getData());
////            compAttrVOMap.forEach((attrId, attrVO) -> {
////                dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentrule()));
////            });
////            dataLowMap.forEach((key, value) -> {
////                setValueToOrderDTO(orderDTO, key, value);
////            });
////        }
////    }
////
////
////    /**
////     * 设置新的值到申请对象上
////     *
////     * @param orderDTO 编码申请对象
////     * @param attrId   属性的编号
////     * @param value    值
////     */
////    private void setValueToOrderDTO(CodeOrderDTO orderDTO, String attrId, String value) {
////        attrId = attrId.toLowerCase(Locale.ROOT);
////        if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) {
////            WebUtil.setValueToField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO, value);
////        } else {
////            orderDTO.getData().put(attrId, value);
////        }
////    }
////
////    /**
////     * 校验正则表达式是否正确
////     *
////     * @param templateVO 模板的信息,必须包含属性的内容
////     * @param orderDTO   编码申请的相关的信息
////     */
////    private void checkVerifyOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
////        Map<String, CodeClstempattrVO> verifyAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getVerifyrule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
////        if (!CollectionUtils.isEmpty(verifyAttrVOMap)) {
////            verifyAttrVOMap.forEach((attrId, attrVO) -> {
////                String value = getValueFromOrderDTO(orderDTO, attrId);
////                if (StringUtils.isNotBlank(value) && !value.matches(attrVO.getVerifyrule())) {
////                    //校验正则表达式
////                    throw new VciBaseException("属性[{0}]的值不符合校验规则的要求", new String[]{attrVO.getName()});
////                }
////            });
////        }
////    }
////
////    /**
////     * 校验关键属性
////     *
////     * @param classifyFullInfo 分类的全部信息
////     * @param templateVO       模板的内容,必须包含模板属性
////     * @param orderDTO         编码申请的相关的信息
////     */
////    private void checkKeyAttrOnOrder(CodeClassifyFullInfoBO classifyFullInfo, CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
////        //先获取关键属性的规则,也利用继承的方式
////        CodeKeyattrrepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo);
////        //注意的是keyRuleVO可能为空,表示不使用规则控制
////        //获取所有的关键属性
////        Map<String, CodeClstempattrVO> ketAttrMap = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getKeyattrflag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
////        Map<String, String> conditionMap = new HashMap<>();
////        boolean trimAll = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnoreallspaceflag());
////        //全部去空的优先级大于去空
////        boolean trim = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorespaceflag());
////        boolean ignoreCase = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorecaseflag());
////        boolean ignoreWidth = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorewidthflag());
////        ketAttrMap.forEach((attrId, attrVO) -> {
////            String value = getValueFromOrderDTO(orderDTO, attrId);
////            if (value == null) {
////                value = "";
////            }
////            wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap);
////        });
////
////        //没有限制分类,但是一个模板只可能在一个业务类型里面,所以直接查询这个业务类型即可
////
////        if (!CollectionUtils.isEmpty(conditionMap)) {
////            final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "};
////            conditionMap.forEach((key, value) -> {
////                sql[0] += " and " + key + " = " + value;
////            });
////            if (StringUtils.isNotBlank(orderDTO.getOid())) {
////                //修改的时候,需要排除自己
////                sql[0] += " and oid != '" + orderDTO.getOid() + "'";
////            } else if (StringUtils.isNotBlank(orderDTO.getCopyFromVersion())) {
////                sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'";
////            }
////            sql[0] += " and islastR = '1' and islastV = '1' ";
//////          if (boService.queryCountBySql(sql[0], new HashMap<>()) > 0) {
////            if (Integer.parseInt(commonsMapper.selectById(sql[0]).get(0)) > 0) {
////                String ruleInfoMsg = keyRuleVO == null ? "" : "查询规则:去除空格--{0},忽略大小写--{1},忽略全半角--{2},忽略全部空格--{3}";
////                String[] objs = new String[]{trim ? "是" : "否", ignoreCase ? "是" : "否", ignoreWidth ? "是" : "否", trimAll ? "是" : "否"};
////                throw new VciBaseException("根据您填写的关键属性的内容,结合关键属性查询规则,发现这个数据已经在系统中存在了。请修正!。" + ruleInfoMsg, objs);
////            }
////        }
////    }
////
////    /**
////     * 封装关键属性的查询语句
////     *
////     * @param value        当前的值
////     * @param keyRuleVO    关键属性的控制规则,可以为空
////     * @param attrId       属性的编号
////     * @param trim         是否去除空格
////     * @param ignoreCase   是否不区分大小写
////     * @param ignoreWidth  是否忽略全半角
////     * @param trimAll      是否忽略全部空格
////     * @param conditionMap 查询条件
////     */
////    @Override
////    public void wrapperKeyAttrConditionMap(String value, CodeKeyattrrepeatVO keyRuleVO, String attrId,
////                                           boolean trim, boolean ignoreCase, boolean ignoreWidth,
////                                           boolean trimAll, Map<String, String> conditionMap) {
////        boolean ignoreSpace = trim || trimAll;
////        if (StringUtils.isBlank(value)) {
////            //为空的时候,不能用QueryOperation.ISNULL,平台不知道啥时候不处理这种了
////            conditionMap.put("t."+attrId, "null");
////        } else {
////            if (keyRuleVO != null) {
////                String queryKey = "";
////                String queryValue = "";
////
////                String temp = "";
////                if (ignoreCase && ignoreSpace && ignoreWidth) {
////                    //忽略大小写,且去空,忽略全半角
////                    temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte(%s)) " + (trimAll ? ",' ','')" : ")");
////                } else if (ignoreCase && ignoreSpace && !ignoreWidth) {
////                    //忽略大小写、去空、不忽略全半角
////                    temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")");
////                } else if (ignoreCase && !ignoreSpace && ignoreWidth) {
////                    //忽略大小写、不去空、忽略全半角
////                    temp = "UPPER(to_single_byte(%s))";
////                } else if (!ignoreCase && ignoreSpace && ignoreWidth) {
////                    //不忽略大小写、去空、忽略全半角
////                    temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte(%s) " + (trimAll ? ",' ','')" : ")");
////                } else if (ignoreCase && !ignoreSpace && !ignoreWidth) {
////                    //忽略大小写、不去空、不忽略全半角
////                    temp = "UPPER(%s)";
////                } else if (!ignoreCase && !ignoreCase && ignoreWidth) {
////                    //不忽略大小写、不去空、忽略全半角
////                    temp = "to_single_byte(%s)";
////                } else if (!ignoreCase && ignoreSpace && !ignoreWidth) {
////                    //不忽略大小写、去空、不忽略全半角
////                    temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")");
////                } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) {
////                    //不忽略大小写、不去空、不忽略全半角
////                    temp = "%s";
////                }
////                queryKey = String.format(temp, "t."+attrId);
////                queryValue = String.format(temp, "'" + (trim ? value.trim() : value) + "'");
////                conditionMap.put(queryKey, queryValue);
////            } else {
////                //为空的时候不代表不校验,只是不去除相关的信息
////                conditionMap.put("t."+attrId, value);
////            }
////        }
////    }
////
////    /**
////     * 校验枚举的内容
////     *
////     * @param templateVO 模板的显示对象,需要包含属性
////     * @param orderDTO   编码申请的信息
////     */
////    private void checkEnumOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
////        //如果枚举可以修改,则不需要校验是否符合枚举的选项
////
////        Map<String, CodeClstempattrVO> enumAttrVOMap = templateVO.getAttributes().stream().filter(s -> (StringUtils.isNotBlank(s.getEnumstring()) || StringUtils.isNotBlank(s.getEnumid())) && !VciBaseUtil.getBoolean(s.getEnumeditflag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
////        if (!CollectionUtils.isEmpty(enumAttrVOMap)) {
////            enumAttrVOMap.forEach((attrId, attrVO) -> {
////                String value = getValueFromOrderDTO(orderDTO, attrId);
////                if (StringUtils.isNotBlank(value)) {
////                    CodeClassifyTemplateAttrVO codeClassifyTemplateAttrVO = new CodeClassifyTemplateAttrVO();
////                    BeanUtils.copyProperties(attrVO,codeClassifyTemplateAttrVO);
////                    //有值才能校验
////                    List<KeyValue> comboboxKVs = listComboboxItems(codeClassifyTemplateAttrVO);
////                    if (!comboboxKVs.stream().anyMatch(s -> value.equalsIgnoreCase(s.getKey()))) {
////                        throw new VciBaseException("属性【{0}】的值不符合枚举的要求", new String[]{attrVO.getName()});
////                    }
////                }
////            });
////        }
////    }
////
////    /**
////     * 转换时间的格式
////     *
////     * @param templateVO 模板的显示对象,需要包含属性
////     * @param orderDTO   编码申请的信息
////     */
////    private void switchDateAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) {
////        Map<String, CodeClstempattrVO> dateAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getCodedateformat())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
////        if (!CollectionUtils.isEmpty(dateAttrVOMap)) {
////            dateAttrVOMap.forEach((attrId, attrVO) -> {
////                String value = getValueFromOrderDTO(orderDTO, attrId);
////                if (StringUtils.isNotBlank(value)) {
////                    DateConverter dateConverter = new DateConverter();
////                    dateConverter.setAsText(value);
////                    value = VciDateUtil.date2Str(dateConverter.getValue(), VciDateUtil.DateTimeMillFormat);
////                    setValueToOrderDTO(orderDTO, attrId, value);
////                }
////            });
////        }
////    }
////
////    /**
////     * 拷贝数据到cbo对象上
////     *
////     * @param classifyFullInfo 分类的全部信息
////     * @param cbo              业务数据
////     * @param orderDTO         编码申请的信息
////     * @param templateVO       模板的显示对象
////     * @param edit             是否为修改
////     */
////    private void copyValueToCBO(CodeClassifyFullInfoBO classifyFullInfo, CodeWupinEntity cbo,
////                                CodeOrderDTO orderDTO, CodeClstemplateVO templateVO,
////                                boolean edit) {
////        String fullPath = "";
////        if (!CollectionUtils.isEmpty(classifyFullInfo.getParentClassifyVOs())) {
////            fullPath = classifyFullInfo.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel())))
////                .map(CodeClassifyVO::getOid).collect(Collectors.joining("##"));
////        } else {
////            fullPath = classifyFullInfo.getCurrentClassifyVO().getOid();
////        }
////
//////      BeanUtils.
////        BeanUtils.copyProperties(orderDTO.getData(),cbo);
////        cbo.setMaterialtype(Short.valueOf("1001"));
//////      orderDTO.getData().forEach((key, value) -> {
//////          if (!edit || (!checkUnAttrUnEdit(key) &&
//////              !VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(key))) {
//////              try {
//////                  cbo.setAttributeValue(key, value);
//////              } catch (Exception e) {
//////                  logger.error("设置属性的值错误", e);
//////              }
//////          }
//////      });
////        try {
////
////            cbo.setCodeclsfid(classifyFullInfo.getCurrentClassifyVO().getOid());
////            cbo.setCodetemplateoid(templateVO.getOid());
////            cbo.setCodeclsfpath(fullPath);
//////          cbo.setMaterialclassify("model_type");
//////          cbo.setMaterialname(orderDTO.getData().get("materialname"));
//////          cbo.setShifoupihaoguanli("true");
//////          cbo.setKucunwl("true");
//////          cbo.setXiaoshouwl("false");
////            if (!edit && StringUtils.isBlank(orderDTO.getLcStatus())) {
////                //找生命周期的起始状态,插个点,看生命周期是否需要创建
////                if (StringUtils.isNotBlank(cbo.getLctid())) {
//////                  OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(cbo.getLctid());
//////                  if (lifeCycleVO != null) {
//////                      cbo.setLcStatus("Editing");
////////                        cbo.setLcStatus(lifeCycleVO.getStartStatus());
//////                  } else {
////                        cbo.setLcStatus(CodeDefaultLC.EDITING.getValue());
//////                  }
////                } else {
////                    cbo.setLcStatus(CodeDefaultLC.EDITING.getValue());
////                }
////
////            }
////
////            int secret = VciBaseUtil.getInt(cbo.getSecretGrade().toString());
////            //插个点,后续看密级服务是否可用
//////          if (secret == 0 || !secretService.checkDataSecret(secret)) {
////            if (secret == 0 ) {
////                Integer userSecret = VciBaseUtil.getCurrentUserSecret();
//////              cbo.setAttributeValue(SECRET_FIELD, String.valueOf((userSecret == null || userSecret == 0) ? UserSecretEnum.NONE.getValue() : userSecret));
////                cbo.setSecretGrade(userSecret == null || userSecret == 0 ? UserSecretEnum.NONE.getValue() : userSecret);
////            }
////        } catch (Throwable e) {
////            logger.error("设置默认的属性的值错误", e);
////        }
////    }
////
////
////    /**
////     * 初始化业务类型
////     * --创建人默认为当前用户,如果需要修改,可以在获取后自行处理
////     * @param btmName 业务类型的名称,会自动变成小写
////     * @return CodeWupinEntity
////     * @throws VciBaseException 初始化出错的是会抛出异常
////     */
////    @Override
////    public CodeWupinEntity createCBOByBtmName(String btmName)
////        throws VciBaseException {
////        if(btmName!=null){
////            btmName = btmName.trim().toLowerCase();
////        }
////        String userid = AuthUtil.getUser().getUserName();
//////      if(!hasCreatedCbos.containsKey(btmName)){
//////          if(StringUtils.isEmpty(userid)){
//////              throw new VciBaseException(msgCodePrefix +"noHasUserid");
//////          }
//////          try {
//////              hasCreatedCbos.put(btmName, createBusinessObject(btmName));
//////          } catch (Exception e) {
//////              logger.error("创建业务类型对象",e);
//////              throw new VciBaseException(msgCodePrefix + "initBoError",new String[]{btmName});
//////          }
//////      }
//////      ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName));
////
////        QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>();
////        btmWrapper.eq("ID",btmName);
////        CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper);
//////      OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName);
////        String userName = AuthUtil.getUser().getUserName();
////        CodeWupinEntity wupinEntity = new CodeWupinEntity();
////        wupinEntity.setOid(null);
//////      bo.setRevisionid((new ObjectUtility()).getNewObjectID36());
//////      bo.setNameoid((new ObjectUtility()).getNewObjectID36());
////        wupinEntity.setBtmname(btmName);
////        wupinEntity.setLastR(String.valueOf(1));
////        wupinEntity.setFirstR(String.valueOf(1));
////        wupinEntity.setFirstV(String.valueOf(1));
////        wupinEntity.setLastV(String.valueOf(1));
////        wupinEntity.setCreator(userName);
////        wupinEntity.setCreateTime(new Date());
////        wupinEntity.setLastModifier(userName);
////        wupinEntity.setLastModifyTime(new Date());
////        wupinEntity.setRevisionRule(btmTypeVO.getRevisionruleid());
////        wupinEntity.setVersionRule(String.valueOf(btmTypeVO.getVersionRule()));
////        if(StringUtils.isNotBlank(btmTypeVO.getRevisionruleid())){
////            //插个点,需要问勇哥版本问题,展示默认为1
//////          OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionruleid());
////            wupinEntity.setRevisionValue("1");
////        }
////
////        wupinEntity.setRevisionSeq(1);
////        wupinEntity.setVersionSeq(1);
////        //插个点,需要问勇哥版本问题,展示默认为1
////        wupinEntity.setVersionValue("1");
////        wupinEntity.setLctid("wupinLC");
////        wupinEntity.setLcStatus("Editing");
////        wupinEntity.setId("");
////        wupinEntity.setName("");
////        wupinEntity.setDescription("");
////        wupinEntity.setOwner(userName);
////        wupinEntity.setCheckinby(userName);
////        wupinEntity.setCopyFromVersion("");
////        wupinEntity.setMaterialtype((short) 1001);
////        wupinEntity.setCaigouwl("true");
////        wupinEntity.setShifoupihaoguanli("true");
////        wupinEntity.setKucunwl("true");
////        wupinEntity.setXiaoshouwl("false");
////        wupinEntity.setPassing("true");
////
//////      this.initTypeAttributeValue(wupinEntity,btmTypeVO);
////        return wupinEntity;
////
////
//////      return cbo;
////    }
////
////    /**
////     * 是否为修改忽略的属性
////     * @param attrName 属性的名字
////     * @return true 表示应该忽略
////     */
////    boolean checkUnAttrUnEdit(String attrName){
////        return  (VciQueryWrapperForDO.OID_FIELD.equalsIgnoreCase(attrName)
////            ||"ts".equalsIgnoreCase(attrName)
////            || "lastmodifier".equalsIgnoreCase(attrName)
////            || "lastmodifytime".equalsIgnoreCase(attrName)
////            || "createtime".equalsIgnoreCase(attrName)
////            || "checkintime".equalsIgnoreCase(attrName)
////            ||"checkouttime".equalsIgnoreCase(attrName));
////    }
////
////    /**
////     * 保存可输可选的信息
////     *
////     * @param templateVO 模板的对象
////     * @param cboList    数据的内容
////     */
////    @Override
////    public void batchSaveSelectChar(CodeClstemplateVO templateVO, /*List<ClientBusinessObject> cboList*/
////                                    List<String> cboList) {
////        if (templateVO != null && !CollectionUtils.isEmpty(cboList)) {
////            //是异步的,所以直接循环
////            List<CodeClstempattrVO> selectAttrVOs = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getLibraryidentification())).collect(Collectors.toList());
////
////            if (!CollectionUtils.isEmpty(selectAttrVOs)) {
//////              SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
////                selectAttrVOs.parallelStream().forEach(attrVO -> {
////                    List<String> valuesList = cboList;
//////                  cboList.parallelStream().forEach(cbo -> {
//////                      String value = cbo.get.getAttributeValue(attrVO.getId());
//////                      if (StringUtils.isNotBlank(value)) {
//////                          valuesList.add(value);
//////                      }
//////                  });
////                    if (!CollectionUtils.isEmpty(valuesList)) {
////                        for (String s : valuesList) {
////                            DictBiz dictBiz = new DictBiz();
////                            dictBiz.setCode(templateVO.getBtmTypeId());
////                            dictBiz.setDictKey(s);
////                            dictBiz.setDictValue(s);
////                            //从原来的charService(可输可选)更改为调用omd中的接口来实现
////                            iDictBizClient.getCheck(dictBiz);
////                        }
//////                      charService.saveBySameNamespaceAndFlag(templateVO.getBtmTypeId(), attrVO.getLibraryIdentification(), valuesList, sessionInfo);
////                    }
////                });
////            }
////        }
////    }
////
////    @Override
////    public MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid) {
////        CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid);
////        MdmUIInfoVO uiInfoVO = new MdmUIInfoVO();
////        uiInfoVO.setTemplateVO(templateVO);
////        uiInfoVO.setFormDefineVO(wrapperFormDefineByTemplate(templateVO, codeClassifyOid));
////        wrapperResemble(templateVO, uiInfoVO);
////        return uiInfoVO;
////    }
////
////
////    /**
////     * 模板属性转换为表单定义的信息
////     *
////     * @param templateVO      模板的显示对象
////     * @param codeClassifyOid 分类的主键,为空的时候,获取模板所属的分类主键.用于产生分类注入
////     * @return 表格的信息
////     */
////    private UIFormDefineVO wrapperFormDefineByTemplate(CodeClstemplateVO templateVO, String codeClassifyOid) {
////        UIFormDefineVO formDefineVO = new UIFormDefineVO();
////        formDefineVO.setOid(templateVO.getOid());
////        formDefineVO.setBtmType(templateVO.getBtmTypeId());
////        if (StringUtils.isBlank(codeClassifyOid)) {
////            codeClassifyOid = templateVO.getCodeClassifyOid();
////        }
////        CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid);
////
////        List<UIFormItemVO> itemVOS = new ArrayList<>();
////        Map<String, List<CodeClstempattrVO>> attrGroupMap = templateVO.getAttributes().stream().
////            filter(s -> StringUtils.isNotBlank(s.getAttributegroup())).collect(Collectors.groupingBy(s -> s.getAttributegroup()));
////
////        templateVO.getAttributes().forEach(attrVO -> {
////            UIFormItemVO formItemVO = templateAttr2FormField(attrVO, templateVO.getBtmTypeId());
////            itemVOS.add(formItemVO);
////        });
////        //处理属性分组
////        if (!CollectionUtils.isEmpty(attrGroupMap)) {
////            //按照分组的属性排列,找到每一个分组的第一个属性
////            for (String key : attrGroupMap.keySet()) {
////                List<CodeClstempattrVO> value = attrGroupMap.get(key);
////                //找到这个分组的属性的第一个
////                CodeClstempattrVO attrVO = value.stream().sorted(((o1, o2) -> o1.getOrdernum().compareTo(o2.getOrdernum()))).findFirst().get();
////                //我们找到这个属性在最终的itemVOs里的位置
////                UIFormItemVO lineVO = new UIFormItemVO();
////                lineVO.setField(attrVO.getId() + "_line");
////                lineVO.setType("line");
////                lineVO.setText(key);
////                //找位置
////                for (int i = 0; i < itemVOS.size(); i++) {
////                    UIFormItemVO record = itemVOS.get(i);
////                    if (record.getField().equalsIgnoreCase(attrVO.getId())) {
////                        itemVOS.add(i, lineVO);
////                        break;
////                    }
////                }
////            }
////        }
////
////        CodeOrderDTO orderDTO = new CodeOrderDTO();
////        switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
////        if (!CollectionUtils.isEmpty(orderDTO.getData())) {
////            orderDTO.getData().forEach((key, value) -> {
////                for (int i = 0; i < itemVOS.size(); i++) {
////                    UIFormItemVO itemVO = itemVOS.get(i);
////                    if (itemVO.getField().equalsIgnoreCase(key)) {
////                        itemVO.setDefaultValue(value);
////                        break;
////                    }
////                }
////            });
////        }
////        formDefineVO.setItems(itemVOS);
////        //查询是否有分类注入的
////        return formDefineVO;
////    }
////    /**
////     * 属性类型与js中的字段类型的映射
////     */
////    private static Map<String, String> vciFieldTypeMap = new HashMap<String, String>() {{
////        put(VciFieldTypeEnum.VTString.name(), "text");
////        put(VciFieldTypeEnum.VTInteger.name(), "text");
////        put(VciFieldTypeEnum.VTLong.name(), "text");
////        put(VciFieldTypeEnum.VTDouble.name(), "text");
////        put(VciFieldTypeEnum.VTClob.name(), "text");
////        put(VciFieldTypeEnum.VTBoolean.name(), "truefalse");
////        put(VciFieldTypeEnum.VTDateTime.name(), "datetime");
////        put(VciFieldTypeEnum.VTDate.name(), "datetime");
////        put(VciFieldTypeEnum.VTTime.name(), "datetime");
////        put(VciFieldTypeEnum.VTFilePath.name(), "file");
////    }};
////
////    /**
////     * 模板属性转换为表单的字段
////     *
////     * @param attrVO  模板属性
////     * @param btmType 业务类型
////     * @return 表单的字段
////     */
////    @Override
////    public UIFormItemVO templateAttr2FormField(CodeClstempattrVO attrVO, String btmType) {
////
////        UIFormItemVO itemVO = new UIFormItemVO();
////        if (SECRET_FILED.equalsIgnoreCase(attrVO.getId())) {
//////          attrVO.setEnumid(OsEnumServiceImpl.MY_DATA_SECRET);
////            attrVO.setEnumid(MY_DATA_SECRET);
////        }
////        itemVO.setField(attrVO.getId());
////        itemVO.setText(attrVO.getName());
////        itemVO.setType(vciFieldTypeMap.getOrDefault(attrVO.getAttributedatatype(), "text"));
////        if (VciBaseUtil.getBoolean(attrVO.getTextareaflag())) {
////            itemVO.setType("textarea");
////        }
////        if (VciFieldTypeEnum.VTLong.name().equalsIgnoreCase(attrVO.getAttributedatatype())
////            || VciFieldTypeEnum.VTInteger.name().equalsIgnoreCase(attrVO.getAttributedatatype())
////            || VciFieldTypeEnum.VTDouble.name().equalsIgnoreCase(attrVO.getAttributedatatype())) {
////            itemVO.setVerify("number");
////        }
////        itemVO.setReadOnly(VciBaseUtil.getBoolean(attrVO.getReadonlyflag()));
////        itemVO.setKeyAttr(VciBaseUtil.getBoolean(attrVO.getKeyattrflag()));
////        itemVO.setRequired(VciBaseUtil.getBoolean(attrVO.getRequireflag()));
////        itemVO.setDefaultValue(attrVO.getDefaultvalue());
////        itemVO.setDateFormate(attrVO.getCodedateformat());
////        itemVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getFormdisplayflag()));
////        itemVO.setVerify(attrVO.getVerifyrule());
////        itemVO.setPrefix(attrVO.getPrefixvalue());
////        itemVO.setSuffix(attrVO.getSuffixvalue());
////        itemVO.setTooltips(attrVO.getExplain());
////        itemVO.setSelectLibFlag(attrVO.getLibraryidentification());
////        //看看是否有枚举
////        if ((StringUtils.isNotBlank(attrVO.getEnumstring())
////            && !"[]".equalsIgnoreCase(attrVO.getEnumstring())) ||
////            StringUtils.isNotBlank(attrVO.getEnumid())) {
////            itemVO.setType("combox");
////            itemVO.setComboxKey(attrVO.getEnumid());
////            if (StringUtils.isNotBlank(attrVO.getEnumstring())) {
////                //指定的下拉框内容
////                itemVO.setData(JSONObject.parseArray(attrVO.getEnumstring(), KeyValue.class));
////                if (StringUtils.isBlank(attrVO.getEnumid())) {
////                    itemVO.setComboxKey(itemVO.getField() + "_data");
////                }
////            }
////        }
////        //看是否有参照
////        if (StringUtils.isNotBlank(attrVO.getReferbtmid()) || StringUtils.isNotBlank(attrVO.getReferconfig())) {
////            itemVO.setType("refer");
////            itemVO.setShowField(itemVO.getField() + "name");
////            if (StringUtils.isNotBlank(attrVO.getReferconfig())) {
////                //配置的内容
////                itemVO.setReferConfig(JSONObject.parseObject(attrVO.getReferconfig(), UIFormReferVO.class));
////            } else {
////                UIFormReferVO formReferVO = new UIFormReferVO();
////                formReferVO.setType("default");
////                formReferVO.setReferType(attrVO.getReferbtmid());
////                itemVO.setReferConfig(formReferVO);
////            }
////        }
////
////        //如果是组合规则,分类注入的,显示为只读
////        if (StringUtils.isNotBlank(attrVO.getComponentrule())) {
////            itemVO.setReadOnly(true);
////            itemVO.setTooltips("本属性为组合规则");
////            itemVO.setRequired(false);
////        }
////        if (StringUtils.isNotBlank(attrVO.getClassifyinvokeattr())) {
////            itemVO.setReadOnly(!VciBaseUtil.getBoolean(attrVO.getClassifyinvokeeditflag()));
////            itemVO.setTooltips("本属性是分类注入");
////            itemVO.setRequired(false);
////        }
////
////        if (VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(itemVO.getField())) {
////            //是生命周期状态
////            itemVO.setType("combox");
////            itemVO.setComboxKey(btmType + LC_STATUS_SUBFIX);
////        }
////        return itemVO;
////    }
////
////
////    /**
////     * 封装相似项查询的列表
////     *
////     * @param templateVO 模板的显示对象
////     * @param uiInfoVO   页面的信息
////     */
////    private void wrapperResemble(CodeClstemplateVO templateVO, MdmUIInfoVO uiInfoVO) {
////        List<CodeClstempattrVO> resembleAttrList = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getSamerepeatattrflag())
////            || VciQueryWrapperForDO.ID_FIELD.equalsIgnoreCase(s.getId())).collect(Collectors.toList());
////        if (!CollectionUtils.isEmpty(resembleAttrList) && resembleAttrList.size() > 1) {
////            UITableDefineVO resembleTable = new UITableDefineVO();
////            resembleTable.setOid(templateVO.getOid());
////            resembleTable.setBtmType(templateVO.getBtmTypeId());
////            resembleTable.setDisplayQueryArea(false);
////            resembleTable.setPageVO(new UITablePageVO());
////            //处理所有的列,这个模板没有合并的表头的情况
////            List<UITableFieldVO> fieldVOList = new ArrayList<>();
////            resembleAttrList.forEach(attrVO -> {
////                UITableFieldVO tableFieldVO = templateAttr2TableField(attrVO,false);
////                tableFieldVO.setHidden(false);
////                fieldVOList.add(tableFieldVO);
////            });
////            List<List<UITableFieldVO>> cols = new ArrayList<>();
////            cols.add(fieldVOList);
////            resembleTable.setCols(cols);
////            uiInfoVO.setResembleTableVO(resembleTable);
////        }
////    }
////
////
////    /**
////     * 模板属性转换为表格显示的配置
////     *
////     * @param attrVO 模板属性
////     * @param forEdit 是否是编辑所需
////     * @return 表格的字段
////     */
////    @Override
////    public UITableFieldVO templateAttr2TableField(CodeClstempattrVO attrVO,boolean forEdit) {
////        UITableFieldVO fieldVO = new UITableFieldVO();
////        if (SECRET_FILED.equalsIgnoreCase(attrVO.getId())) {
////            attrVO.setEnumid(MY_DATA_SECRET);
////        }
////        fieldVO.setField(attrVO.getId());
////        fieldVO.setTitle(attrVO.getName());
////        fieldVO.setFieldType(vciFieldTypeMap.getOrDefault(attrVO.getAttributedatatype(), "text"));
////        fieldVO.setSort(true);
////        fieldVO.setSortField(fieldVO.getField());
////        fieldVO.setQueryField(fieldVO.getField());
////        if (forEdit){
////            fieldVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getFormdisplayflag()));
////        }else {
////            fieldVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getTabledisplayflag()));
////        }
////        if (attrVO.getAttrtablewidth() != null && attrVO.getAttrtablewidth() > 0) {
////            fieldVO.setMinWidth(Integer.valueOf(attrVO.getAttrtablewidth()));
////            fieldVO.setWidth(Integer.valueOf(attrVO.getAttrtablewidth()));
////        }
////        //看看是否有枚举
////        if ((StringUtils.isNotBlank(attrVO.getEnumstring())
////            && !"[]".equalsIgnoreCase(attrVO.getEnumstring())) ||
////            StringUtils.isNotBlank(attrVO.getEnumid())) {
////            fieldVO.setFieldType("combox");
////            fieldVO.setField(fieldVO.getField() + "Text");
////            fieldVO.setComboxKey(attrVO.getEnumid());
////            if (StringUtils.isNotBlank(attrVO.getEnumstring())) {
////                //指定的下拉框内容
////                fieldVO.setData(JSONObject.parseArray(attrVO.getEnumstring(), KeyValue.class));
////                if (StringUtils.isBlank(attrVO.getEnumid())) {
////                    fieldVO.setComboxKey(fieldVO.getField() + "_data");
////                }
////            }else {
////                List<KeyValue> osEnumItemVOList= enumService.getEnum(attrVO.getEnumid());
////                fieldVO.setData(osEnumItemVOList);
////            }
////        }
////        //看是否有参照
////        if (StringUtils.isNotBlank(attrVO.getReferbtmid()) || StringUtils.isNotBlank(attrVO.getReferconfig())) {
////            fieldVO.setFieldType("refer");
////            fieldVO.setQueryField(fieldVO.getField());
////            fieldVO.setField(fieldVO.getField() + "name");
////            fieldVO.setShowField(fieldVO.getField());
////            if (StringUtils.isNotBlank(attrVO.getReferconfig())) {
////                //配置的内容
////                fieldVO.setReferConfig(JSONObject.parseObject(attrVO.getReferconfig(), UIFormReferVO.class));
////            } else {
////                UIFormReferVO formReferVO = new UIFormReferVO();
////                formReferVO.setType("default");
////                formReferVO.setReferType(attrVO.getReferbtmid());
////                fieldVO.setReferConfig(formReferVO);
////            }
////        }
////        if (VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(fieldVO.getSortField())) {
////            fieldVO.setField("lcstatus_text");
////        }
////        Map<String, String> eventJsMap = new HashMap<>();
////        //超链接与模板是互斥
////        if (StringUtils.isNotBlank(attrVO.getTablehref())) {
////            String event = fieldVO.getSortField() + "_href";
////            eventJsMap.put(event, attrVO.getTablehref());
////            fieldVO.setTemplet("function(d){ return '<a class=\"layui-btn layui-btn-intable \" lay-event=\"" + event + "\">d." + fieldVO.getField() + "</a>';}");
////        }
////        if (StringUtils.isNotBlank(attrVO.getTabledisplayjs())) {
////            //直接写function(d){ return xxxxx;}
////            fieldVO.setTemplet(attrVO.getTabledisplayjs());
////        }
////        if (StringUtils.isBlank(fieldVO.getTemplet()) && VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(attrVO.getAttributedatatype())) {
////            fieldVO.setTemplet("function(d){return $webUtil.formateBoolean(d." + fieldVO.getField() + ");}");
////        }
////        fieldVO.setOptionJsMap(eventJsMap);
////        fieldVO.setStyle(attrVO.getTabledisplaystyle());
////        //列表里不允许直接编辑
////        fieldVO.setDateFormate(attrVO.getCodedateformat());
////        return fieldVO;
////    }
////
////
////    /**
////     * 相似项查询
////     *
////     * @param orderDTO 编码的相关信息
////     * @return 数据列表
////     */
////    @Override
////    public DataGrid<Map<String, String>> resembleQuery(CodeOrderDTO orderDTO) {
////        VciBaseUtil.alertNotNull(orderDTO, "申请的信息", orderDTO.getCodeClassifyOid(), "分类主键", orderDTO.getTemplateOid(), "模板主键");
////        CodeClassifyFullInfoBO fullInfoBO = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
////        CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
////        switchClassifyLevelOnOrder(templateVO, fullInfoBO, orderDTO);
////        switchDateAttrOnOrder(templateVO, orderDTO);
////        switchComponentAttrOnOrder(templateVO, orderDTO);
////        //需要获取是否有相似查询属性
////        Map<String, CodeClassifyTemplateAttrVO> attrVOs = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getSamerepeatattrflag())).collect(Collectors.toMap(s -> s.getId(), t -> t));
////        if (CollectionUtils.isEmpty(attrVOs)) {
////            //都没有属性,肯定不能查询了
////            return new DataGrid<>();
////        }
////        Map<String, String> conditionMap = new HashMap<>();
////        //我们首先获取有没有查询规则
////        CodeResembleRuleVO resembleRuleVO = Optional.ofNullable(getUseResembleRule(fullInfoBO, fullInfoBO.getCurrentClassifyVO())).orElseGet(() -> new CodeResembleRuleVO());
////        attrVOs.forEach((attrId, attrVO) -> {
////            String value = getValueFromOrderDTO(orderDTO, attrId);
////            if (value == null) {
////                value = "";
////            }
////            wrapperResembleConditionMap(value, resembleRuleVO, attrId, conditionMap);
////        });
////
////        //没有限制分类,但是一个模板只可能在一个业务类型里面,所以直接查询这个业务类型即可
////        if (!CollectionUtils.isEmpty(conditionMap)) {
////            Map<String, String> andConditionMap = new HashMap<>();
////            andConditionMap.put("islastr", "1");
////            andConditionMap.put("islastv", "1");
////            if (StringUtils.isNotBlank(orderDTO.getOid())) {
////                andConditionMap.put("oid", QueryOptionConstant.NOTEQUAL + orderDTO.getOid());
////            }
////            conditionMap.putAll(andConditionMap);
////            PageHelper pageHelper = new PageHelper(-1);
////            pageHelper.addDefaultDesc("id");
////            return queryGrid(fullInfoBO.getTopClassifyVO().getBtmtypeid(), templateVO, conditionMap, pageHelper);
////        }
////        return new DataGrid<>();
////    }
////
////    /**
////     * 获取使用的相似查询规则
////     *
////     * @param fullInfoBO        类全部信息
////     * @param currentClassifyVO 当前的分类
////     * @return 规则,如果不存在会返回Null
////     */
////    @Override
////    public CodeResembleRuleVO getUseResembleRule(CodeClassifyFullInfoBO fullInfoBO, CodeClassifyVO currentClassifyVO) {
////        if (currentClassifyVO == null) {
////            return null;
////        }
////        if (currentClassifyVO != null && StringUtils.isNotBlank(currentClassifyVO.getCodeResembleRuleOid())) {
////            //说明已经存在
////            return resembleRuleService.getObjectByOid(currentClassifyVO.getCodeResembleRuleOid());
////        }
////        if (StringUtils.isBlank(currentClassifyVO.getParentcodeclassifyoid())) {
////            return null;
////        }
////        Map<String, CodeClassifyVO> classifyVOMap = fullInfoBO.getParentClassifyVOs().stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
////        return getUseResembleRule(fullInfoBO, classifyVOMap.getOrDefault(currentClassifyVO.getParentcodeclassifyoid(), null));
////    }
////
////    /**
////     * 封装相似项查询的查询条件的映射
////     *
////     * @param value          值
////     * @param resembleRuleVO 相似项规则
////     * @param attrId         属性的编号
////     * @param conditionMap   查询条件
////     */
////    @Override
////    public void wrapperResembleConditionMap(String value, CodeResembleRuleVO resembleRuleVO, String attrId, Map<String, String> conditionMap) {
////        boolean ignoreSpace = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorespaceflag()) || VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag());
////        if (StringUtils.isBlank(value)) {
////            //为空的时候就不查询它就是
////        } else {
////            String queryKey = "";
////            String queryValue = "";
////            boolean ignoreCase = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorecaseflag());
////            boolean ignoreWidth = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorewidthflag());
////            boolean trimAll = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag());
////            boolean trim = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag());
////            String temp = "";
////            if (ignoreCase && ignoreSpace && ignoreWidth) {
////                //忽略大小写,且去空,忽略全半角
////                temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte('%s')) " + (trimAll ? ",' ','')" : ")");
////            } else if (ignoreCase && ignoreSpace && !ignoreWidth) {
////                //忽略大小写、去空、不忽略全半角
////                temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")");
////            } else if (ignoreCase && !ignoreSpace && ignoreWidth) {
////                //忽略大小写、不去空、忽略全半角
////                temp = "UPPER(to_single_byte('%s'))";
////            } else if (!ignoreCase && ignoreSpace && ignoreWidth) {
////                //不忽略大小写、去空、忽略全半角
////                temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte('%s') " + (trimAll ? ",' ','')" : ")");
////            } else if (ignoreCase && !ignoreSpace && !ignoreWidth) {
////                //忽略大小写、不去空、不忽略全半角
////                temp = "UPPER(%s)";
////            } else if (!ignoreCase && !ignoreCase && ignoreWidth) {
////                //不忽略大小写、不去空、忽略全半角
////                temp = "to_single_byte('%s')";
////            } else if (!ignoreCase && ignoreSpace && !ignoreWidth) {
////                //不忽略大小写、去空、不忽略全半角
////                temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")");
////            } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) {
////                //不忽略大小写、不去空、不忽略全半角
////                temp = "%s";
////            }
////            if (StringUtils.isNotBlank(resembleRuleVO.getLinkCharacter())) {
////                List<String> chars = VciBaseUtil.str2List(resembleRuleVO.getLinkCharacter());
////                for (int i = 0; i < chars.size(); i++) {
////                    String s = chars.get(i);
////                    temp = "replace(" + temp + ",'" + s + "','')";
////                }
////            }
////            queryValue = String.format(temp, (trim ? value.trim() : value));
////            temp = temp.replace("to_single_byte('%s')","to_single_byte(%s)");
////            queryKey = String.format(temp, "t."+attrId);
////            conditionMap.put(queryKey, QueryOptionConstant.OR + queryValue);
////        }
////    }
////
////
////    /**
////     * 查询编码数据的列表
////     *
////     * @param btmType      业务类型
////     * @param templateVO   模板的对象,需要包含模板的属性
////     * @param conditionMap 查询条件
////     * @param pageHelper   分页对象
////     * @return 数据列表
////     */
////    @Override
////    public DataGrid<Map<String, String>> queryGrid(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) {
////        CodeTemplateAttrSqlBO sqlBO = getSqlByTemplateVO(btmType, templateVO, conditionMap, pageHelper);
//////      List<Map> maps = boService.queryByOnlySqlForMap(sqlBO.getSqlHasPage());
////        List<Map> maps = commonsMapper.selectBySql(sqlBO.getSqlHasPage());
////        DataGrid<Map<String, String>> dataGrid = new DataGrid<>();
////        List<Map<String, String>> dataList = new ArrayList<>();
////        if (!CollectionUtils.isEmpty(maps)) {
////            maps.stream().forEach(map -> {
////                Map<String, String> data = new HashMap<>();
////                map.forEach((key, value) -> {
////                    data.put(((String) key).toLowerCase(Locale.ROOT), (String) value);
////                });
////                dataList.add(data);
////            });
////        }
////        dataGrid.setData(dataList);
////        if (!CollectionUtils.isEmpty(dataList)) {
////            wrapperData(dataGrid.getData(), templateVO, sqlBO.getSelectFieldList(), false);
////            dataGrid.setTotal(Long.parseLong(commonsMapper.selectBySql(sqlBO.getSqlCount()).get(0).values().toArray()[0].toString()););
////        }
////        return dataGrid;
////    }
////
////
////    /**
////     * 封装查询出来的数据
////     *
////     * @param dataMap              数据的映射
////     * @param templateVO           模板的属性
////     * @param onlySelectAttrIdList 仅仅查询的属性字段
////     * @param form 表单里使用
////     */
////    @Override
////    public void wrapperData(List<Map<String, String>> dataMap, CodeClassifyTemplateVO templateVO,
////                            Collection<String> onlySelectAttrIdList, boolean form) {
////        if (onlySelectAttrIdList == null) {
////            onlySelectAttrIdList = new ArrayList<>();
////        }
////        //先转换一下时间格式
////        List<String> finalOnlySelectAttrIdList = onlySelectAttrIdList.stream().collect(Collectors.toList());
////        List<CodeClassifyTemplateAttrVO> dateFormatAttrVOs = templateVO.getAttributes().stream().filter(
////            s -> StringUtils.isNotBlank(s.getCodeDateFormat()) &&
////                (finalOnlySelectAttrIdList.size() == 0 || finalOnlySelectAttrIdList.contains(s.getId().toLowerCase(Locale.ROOT)))
////        ).collect(Collectors.toList());
////        //枚举的内容
////        List<CodeClassifyTemplateAttrVO> enumAttrVOs = templateVO.getAttributes().stream().filter(
////            s -> (StringUtils.isNotBlank(s.getEnumId()) || StringUtils.isNotBlank(s.getEnumString()))
////                &&
////                (finalOnlySelectAttrIdList.size() == 0 || finalOnlySelectAttrIdList.contains(s.getId().toLowerCase(Locale.ROOT)))
////        ).collect(Collectors.toList());
////
////        List<String> userIds = new ArrayList<>();
////        dataMap.stream().forEach(data -> {
////            //处理时间
////            if (!form) {
////                //表单的时候只能用统一的时间格式
////                wrapperDateFormat(dateFormatAttrVOs, data);
////            }
////            //处理枚举
////            wrapperEnum(enumAttrVOs, data);
////            String lcstatus = data.get(VciQueryWrapperForDO.LC_STATUS_FIELD);
////            String copyFromVersion = data.getOrDefault(COPY_FROM_VERSION,"");
////            if ((CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus) || CodeDefaultLC.AUDITING.getValue().equalsIgnoreCase(lcstatus))
////                && StringUtils.isBlank(copyFromVersion)
////            ) {
////                data.put(VciQueryWrapperForDO.ID_FIELD, "******");
////            }
////            data.put(VciQueryWrapperForDO.LC_STATUS_FIELD_TEXT.toLowerCase(Locale.ROOT), CodeDefaultLC.getTextByValue(lcstatus));
////            if(CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus)
////                && StringUtils.isNotBlank(copyFromVersion)){
////                data.put(VciQueryWrapperForDO.LC_STATUS_FIELD_TEXT.toLowerCase(Locale.ROOT), "修改中");
////            }
////            if (data.containsKey("creator")) {
////                userIds.add(data.get("creator"));
////            }
////            if (data.containsKey("lastmodifier")) {
////                userIds.add(data.get("lastmodifier"));
////            }
////        });
////        if (!CollectionUtils.isEmpty(userIds)) {
////            Map<String, SmUserVO> userVOMap = Optional.ofNullable(userQueryService.listUserByUserIds(userIds)).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
////            dataMap.stream().forEach(data -> {
////                String creator = data.getOrDefault("creator", null);
////                if (StringUtils.isNotBlank(creator) && userVOMap.containsKey(creator.toLowerCase(Locale.ROOT))) {
////                    data.put("creator", creator + "(" + userVOMap.get(creator.toLowerCase(Locale.ROOT)).getName() + ")");
////                }
////                String lastmodifier = data.getOrDefault("lastmodifier", null);
////                if (StringUtils.isNotBlank(lastmodifier) && userVOMap.containsKey(lastmodifier.toLowerCase(Locale.ROOT))) {
////                    data.put("lastmodifier", lastmodifier + "(" + userVOMap.get(lastmodifier.toLowerCase(Locale.ROOT)).getName() + ")");
////                }
////            });
////        }
////    }
////
////
////    /**
////     * 处理时间格式
////     *
////     * @param dateFormatAttrVOs 时间格式的属性
////     * @param data              当前行数据
////     */
////    private void wrapperDateFormat(Collection<CodeClassifyTemplateAttrVO> dateFormatAttrVOs, Map<String, String> data) {
////        if (!CollectionUtils.isEmpty(dateFormatAttrVOs)) {
////            dateFormatAttrVOs.stream().forEach(dateFormatAttrVO -> {
////                String attrId = dateFormatAttrVO.getId().toLowerCase(Locale.ROOT);
////                String oldValue = data.getOrDefault(attrId, null);
////                if (StringUtils.isNotBlank(oldValue)) {
////                    DateConverter dateConverter = new DateConverter();
////                    try {
////                        dateConverter.setAsText(oldValue);
////                        Date value = dateConverter.getValue();
////                        if (value != null) {
////                            data.put(attrId, VciDateUtil.date2Str(value, dateFormatAttrVO.getCodeDateFormat()));
////                        }
////                    } catch (Throwable e) {
////                        //转换可能有问题,这就使用原本存储的值
////                    }
////                }
////            });
////        }
////    }
////
////
////    /**
////     * 处理枚举的内容,如果不在枚举中,会返回原本的值
////     *
////     * @param enumAttrVOs 枚举属性
////     * @param data        当前行数据
////     */
////    private void wrapperEnum(Collection<CodeClassifyTemplateAttrVO> enumAttrVOs, Map<String, String> data) {
////        //处理枚举的内容,为了兼容以前的数据,如果数据不能使用枚举转换的话,那还是显示以前的值
////        if (!CollectionUtils.isEmpty(enumAttrVOs)) {
////            enumAttrVOs.stream().forEach(enumAttrVO -> {
////                String attrId = enumAttrVO.getId().toLowerCase(Locale.ROOT);
////                String oldValue = data.getOrDefault(attrId, null);
////                if (StringUtils.isNotBlank(oldValue)) {
////                    List<KeyValue> comboxKVs = listComboboxItems(enumAttrVO);
////                    String newValue = oldValue;
////                    KeyValue keyValue = Optional.ofNullable(comboxKVs).orElseGet(() -> new ArrayList<>()).stream().filter(s -> s.getKey().equalsIgnoreCase(oldValue)).findFirst().orElseGet(() -> null);
////                    if (keyValue != null) {
////                        newValue = keyValue.getValue();
////                    }
////                    data.put(attrId + "Text", newValue);
////                }
////            });
////        }
////    }
////
////
////    /**
////     * 根据模板属性生成相应的sql信息
////     *
////     * @param btmType      业务类型
////     * @param templateVO   模板显示对象,必须包含属性
////     * @param conditionMap 查询条件
////     * @param pageHelper   分页和排序对象
////     * @return sql的相关信息
////     */
////    @Override
////    public CodeTemplateAttrSqlBO getSqlByTemplateVO(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) {
////        //因为参照不一定是在平台的属性池里面设置,所以我们得需要自行处理
////        //参考VciQueryWrapper来处理
////        //1. 找到所有的字段,
////        Map<String, CodeClassifyTemplateAttrVO> attrVOMap = templateVO.getAttributes().stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
////        List<String> selectFieldList = attrVOMap.keySet().stream().collect(Collectors.toList());
////
////        //所有的参照的字段
////        Map<String/**属性字段**/, String> joinTableList = new ConcurrentHashMap<>();
////        List<CodeClassifyTemplateAttrVO> referAttrVOs = templateVO.getAttributes().stream().filter(
////            s -> StringUtils.isNotBlank(s.getReferBtmId()) || StringUtils.isNotBlank(s.getReferConfig())
////        ).collect(Collectors.toList());
////        Map<String/**参照的属性**/, String/**实际的字段**/> referFieldMap = new HashMap<>();
////        if (!CollectionUtils.isEmpty(referAttrVOs)) {
////            referAttrVOs.parallelStream().forEach(attrVO -> {
////                UIFormReferVO referVO = null;
////                if (StringUtils.isNotBlank(attrVO.getReferConfig())) {
////                    referVO = JSONObject.parseObject(attrVO.getReferConfig(), UIFormReferVO.class);
////                } else {
////                    referVO = new UIFormReferVO();
////                    referVO.setReferType(attrVO.getReferBtmId());
////                    referVO.setValueField(VciQueryWrapperForDO.OID_FIELD);
////                    referVO.setTextField("name");
////                }
////
////                String referTable = VciBaseUtil.getTableName(referVO.getReferType());
////                String referTableNick = attrVO.getId() + "0";
////                String left = " left join " + referTable + " " + referTableNick + " on " + referTableNick + "." + referVO.getValueField() + " =  t." + attrVO.getId();
////                joinTableList.put(attrVO.getId(), left);
////                String referShowField = attrVO.getId() + "Name";
////                List<String> textFields = VciBaseUtil.str2List(referVO.getTextField());
////                String showFieldInSource = "";
////                if (textFields.contains("name")) {
////                    showFieldInSource = "name";
////                } else {
////                    showFieldInSource = textFields.get(0);
////                }
////                referFieldMap.put(attrVO.getId(), referTableNick + "." + showFieldInSource);
////                selectFieldList.add(referTableNick + "." + showFieldInSource + " as " + referShowField);
////            });
////        }
////        Optional.ofNullable(attributeService.getDefaultAttributeVOMap()).orElseGet(() -> new HashMap<>()).keySet().stream().forEach(attrId -> {
////            if (!selectFieldList.contains(attrId) && !"secretgrade".equalsIgnoreCase(attrId)) {
////                selectFieldList.add(attrId);
////            }
////        });
////        if (!selectFieldList.contains(CODE_FIELD)) {
////            selectFieldList.add(CODE_FIELD);
////        }
////        if (!selectFieldList.contains(CODE_CLASSIFY_OID_FIELD)) {
////            selectFieldList.add(CODE_CLASSIFY_OID_FIELD);
////        }
////        if (!selectFieldList.contains(CODE_TEMPLATE_OID_FIELD)) {
////            selectFieldList.add(CODE_TEMPLATE_OID_FIELD);
////        }
////        if (!selectFieldList.contains(CODE_FULL_PATH_FILED)) {
////            selectFieldList.add(CODE_FULL_PATH_FILED);
////        }
////
////        //处理查询条件
////        //TODO 验证sql注入
////        List<String> andSql = new ArrayList<>();
////        List<String> orSql = new ArrayList<>();
////        if (!CollectionUtils.isEmpty(conditionMap)) {
////            Map<String, String> orConditionMap = new HashMap<>();
////            Map<String, String> andCondtionMap = new HashMap<>();
////            //先分离or的查询条件,另外当查询条件是空的时候也不查询
////            conditionMap.forEach((k, v) -> {
////                if (StringUtils.isNotBlank(v)) {
////                    if (v.startsWith(QueryOptionConstant.OR)) {
////                        orConditionMap.put(k, v.substring(QueryOptionConstant.OR.length()));
////                    } else {
////                        andCondtionMap.put(k, v);
////                    }
////                }
////            });
////
////            andCondtionMap.forEach((k, v) -> {
////                andSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, attrVOMap));
////            });
////            orConditionMap.forEach((k, v) -> {
////                orSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, attrVOMap));
////            });
////        }
////        //组合起来
////        StringBuilder andSb = new StringBuilder();
////        andSql.stream().forEach(s -> {
////            andSb.append(s).append(SPACE).append(QueryOptionConstant.AND).append(SPACE);
////        });
////
////        String andString = andSb.toString().trim();
////        String endWithSql = QueryOptionConstant.AND;
////        if (andString.endsWith(endWithSql)) {
////            andString = andString.substring(0, andString.length() - endWithSql.length());
////        }
////
////        String orString = orSql.stream().collect(Collectors.joining(" or "));
////        String whereSql = "";
////        if (StringUtils.isNotBlank(orString)) {
////            if (StringUtils.isBlank(andString)) {
////                andString = " 1 = 1 ";
////            }
////            whereSql = SPACE + "(" + SPACE + andString + SPACE + ") and (" + SPACE + orString + SPACE + ")" + SPACE;
////        } else {
////            whereSql = andString + SPACE;
////        }
////        if (attrVOMap.keySet().contains("secretgrade")) {
////            Integer userSecret = VciBaseUtil.getCurrentUserSecret();
////            if (userSecret == null || userSecret == 0) {
////                userSecret = secretService.getMinUserSecret();
////            }
////            whereSql += " and ( t.secretGrade <= " + userSecret + ") ";
////        }
////        String tableName = VciBaseUtil.getTableName(btmType);
////        String sql = "select " + selectFieldList.stream().map(s -> (s.contains(".") ? s : ("t." + s))).collect(Collectors.joining(","))
////            + " from " + tableName + SPACE + "t" + SPACE
////            + joinTableList.values().stream().collect(Collectors.joining(SPACE))
////            + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql;
////        if (pageHelper == null) {
////            pageHelper = new PageHelper(-1);
////        }
////        //看看排序
////        String orderSql = pageHelper.getOrderSql("t");
////        sql += (orderSql == null ? "" : orderSql);
////        String whereSubfixForPage = " ) A where rownum < " + (pageHelper.getLimit() * pageHelper.getPage() + 1) + ") where RN >= "
////            + (pageHelper.getLimit() * (pageHelper.getPage() - 1) + 1);
////        String sqlHasPage = pageHelper.getLimit() > 0 ? ("select * from (select A.*,rownum RN from (" + sql + whereSubfixForPage) : sql;
////        String sqlCount = "select count(1) from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE))
////            + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql;
////        CodeTemplateAttrSqlBO sqlBO = new CodeTemplateAttrSqlBO();
////        sqlBO.setTableName(tableName);
////        sqlBO.setJoinTable(joinTableList);
////        sqlBO.setNickName("t");
//////      sqlBO.setPageHelper(pageHelper);
////        sqlBO.setSqlHasPage(sqlHasPage);
////        sqlBO.setSqlCount(sqlCount);
////        sqlBO.setSqlUnPage(sql);
////        return sqlBO;
////    }
////
////
////    /**
////     * 组合查询条件的sql
////     *
////     * @param key           字段
////     * @param value         名字
////     * @param referFieldMap 参照的字段
////     * @param attrVOMap     属性的映射
////     * @return Sql语句
////     */
////    private String getConditionSql(String key, String value, Map<String/**参照的属性**/, String/**实际的属性**/> referFieldMap, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) {
////        if (key.endsWith("_begin")) {
////            //说明是>=的。我们需要先获取一下
////            String field = (key.substring(0, key.length() - 6).toLowerCase().trim());
////            if (referFieldMap.containsKey(field)) {
////                //说明还是参照里面的,我们默认这种情况下都是字符串吧,因为参照的属性不一定用的平台的属性池里的,所以大部分情况下,显示的属性都是字符串吧
////                return referFieldMap.get(field) + SPACE + " >= '" + value + "'" + SPACE;
////            } else {
////                return (field.contains(".") ? "" : "t.") + field + SPACE + " >= " + getStringValueInWhere(value, field, attrVOMap);
////            }
////        } else if (key.endsWith("_end")) {
////            //说明是<=的。我们需要先获取一下
////            String field = (key.substring(0, key.length() - 6).toLowerCase().trim());
////            if (referFieldMap.containsKey(field)) {
////                //说明还是参照里面的,我们默认这种情况下都是字符串吧,因为参照的属性不一定用的平台的属性池里的,所以大部分情况下,显示的属性都是字符串吧
////                return referFieldMap.get(field) + SPACE + " <= '" + value + "'" + SPACE;
////            } else {
////                return (field.contains(".") ? "" : "t.") + field + SPACE + " <= " + getStringValueInWhere(field, value, attrVOMap);
////            }
////        } else {
////            if (referFieldMap.containsKey(key)) {
////                //说明是参照的,我们参照的查询都认为是字符串,如果是时间格式的查询肯定有问题,
////                String selectKey = referFieldMap.get(key);
////                return getSqlByValue(selectKey, value, null);
////            } else {
////                return getSqlByValue(key, value, attrVOMap);
////            }
////        }
////
////    }
////
////    /**
////     * 获取查询条件中的值的,处理不同的类型
////     *
////     * @param value 值
////     * @param field 字段名称
////     * @return 日期或者时间格式会包括to_date,字符串会加'
////     */
////    private String getStringValueInWhere(String field, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) {
////        if ((field.contains(".") && !field.toLowerCase(Locale.ROOT).startsWith("t.")) || attrVOMap == null
////            || !field.replace("t.", "").matches(RegExpConstant.LETTER) || value.startsWith(ONLY)) {
////            //说明可能是指定的某个条件,直接返回
////            if (value.startsWith(ONLY)) {
////                value = value.replace(ONLY, "");
////            }
////            if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) {
////                return value;
////            }
////            if (field.contains(".") && attrVOMap != null && attrVOMap.containsKey(field.split("\\.")[0].toLowerCase(Locale.ROOT))) {
////                //是参照
////                return "'" + value + "'";
////            } else {
////                return value;
////            }
////        } else {
////            //看看是不是这个对象里的属性
////            if (attrVOMap.containsKey(field)) {
////                VciFieldTypeEnum fieldTypeEnum = VciFieldTypeEnum.valueOf(attrVOMap.get(field).getAttributeDataType());
////                if ("ts".equalsIgnoreCase(field)) {
////                    return "to_timestamp('" + value + "', '" + DATETIME_FORMAT + ".ff')";
////                }
////                DateConverter dateConverter = new DateConverter();
////                if (VciFieldTypeEnum.VTDateTime.equals(fieldTypeEnum)) {
////                    //实际上,数据库都是timestamp的类型.
////                    dateConverter.setAsText(value);
////                    return "to_date('" + dateConverter.getAsText(VciDateUtil.DateTimeFormat) + "','" + DATETIME_FORMAT + "')";
////                } else if (VciFieldTypeEnum.VTDate.equals(fieldTypeEnum)) {
////                    dateConverter.setAsText(value);
////                    return "to_date('" + dateConverter.getAsText(VciDateUtil.DateFormat) + "','" + DATE_FORMAT + "')";
////                } else if (VciFieldTypeEnum.VTDouble.equals(fieldTypeEnum)
////                    || VciFieldTypeEnum.VTLong.equals(fieldTypeEnum)
////                    || VciFieldTypeEnum.VTInteger.equals(fieldTypeEnum)) {
////                    return value;
////                } else {
////                    return "'" + value + "'";
////                }
////            } else {
////                if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) {
////                    return value;
////                }
////                return "'" + value + "'";
////            }
////        }
////
////    }
////
////    /**
////     * 封装最终的sql语句中的值部分
////     *
////     * @param selectKey 查询的字段
////     * @param value     值
////     * @param attrVOMap 属性的显示对象映射
////     * @return sql里的值
////     */
////    private String getSqlByValue(String selectKey, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) {
////        StringBuilder sql = new StringBuilder();
////        if (!selectKey.contains(".") && (attrVOMap.containsKey(selectKey.toLowerCase(Locale.ROOT)) || attributeService.isDefaultAttr(selectKey) || selectKey.matches(RegExpConstant.LETTER))) {
////            sql.append("t.");
////        }
////        if (value.startsWith(QueryOptionConstant.IN)) {
////            sql.append(selectKey)
////                .append(SPACE)
////                .append("in")
////                .append(SPACE)
////                .append("(")
////                .append(value.replace(QueryOptionConstant.IN, ""))
////                .append(")");
////        } else if (value.startsWith(QueryOptionConstant.NOTIN)) {
////            sql.append(selectKey)
////                .append(SPACE)
////                .append("not in")
////                .append(SPACE)
////                .append("(")
////                .append(value.replace(QueryOptionConstant.NOTIN, ""))
////                .append(")");
////        } else if (value.startsWith(QueryOptionConstant.NOTEQUAL)) {
////            value = value.replace(QueryOptionConstant.NOTEQUAL, "");
////            value = getStringValueInWhere(selectKey, value, attrVOMap);
////            sql.append(selectKey)
////                .append(SPACE)
////                .append(QueryOptionConstant.NOTEQUAL)
////                .append(SPACE)
////                .append(value);
////        } else if (value.startsWith(QueryOptionConstant.MORETHAN)) {
////            value = value.replace(QueryOptionConstant.MORETHAN, "");
////            value = getStringValueInWhere(selectKey, value, attrVOMap);
////            sql.append(selectKey)
////                .append(SPACE)
////                .append(QueryOptionConstant.MORETHAN)
////                .append(SPACE)
////                .append(value);
////        } else if (value.startsWith(QueryOptionConstant.MORE)) {
////            value = value.replace(QueryOptionConstant.MORE, "");
////            value = getStringValueInWhere(selectKey, value, attrVOMap);
////            sql.append(selectKey)
////                .append(SPACE)
////                .append(QueryOptionConstant.MORE)
////                .append(SPACE)
////                .append(value);
////        } else if (value.startsWith(QueryOptionConstant.LESSTHAN)) {
////            value = value.replace(QueryOptionConstant.LESSTHAN, "");
////            value = getStringValueInWhere(selectKey, value, attrVOMap);
////
////            sql.append(selectKey)
////                .append(SPACE)
////                .append(QueryOptionConstant.LESSTHAN)
////                .append(SPACE)
////                .append(value);
////        } else if (value.startsWith(QueryOptionConstant.LESS)) {
////            value = value.replace(QueryOptionConstant.LESS, "");
////            value = getStringValueInWhere(selectKey, value, attrVOMap);
////
////            sql.append(selectKey)
////                .append(SPACE)
////                .append(QueryOptionConstant.LESS)
////                .append(SPACE)
////                .append(value);
////        } else if (value.startsWith(QueryOptionConstant.ISNOTNULL)) {
////            sql.append(selectKey)
////                .append(SPACE)
////                .append(" is not null");
////        } else if (value.startsWith(QueryOptionConstant.ISNULL)) {
////            sql.append(selectKey)
////                .append(SPACE)
////                .append(" is null");
////        } else if (value.contains("*")) {
////            //说明是like,或者lefe like ,right like
////            value = getStringValueInWhere(selectKey, value, attrVOMap);
////            sql.append(selectKey)
////                .append(SPACE)
////                .append("like")
////                .append(SPACE)
////                //   .append("'")
////                .append(value.replace("*", "%"))
////                //  .append("'")
////                .append(SPACE);
////        } else {
////            value= value.replace(SPECIAL_CHAR,REQUIRED_CHAR);
////            value = getStringValueInWhere(selectKey, value, attrVOMap);
////
////            sql.append(selectKey)
////                .append(SPACE)
////                .append(QueryOptionConstant.EQUAL)
////                .append(SPACE)
////                .append(value);
////        }
////        sql.append(SPACE);
////        return sql.toString();
////    }
////
////    /**
////     * 修改主题库数据
////     *
////     * @param orderDTO 数据的内容,不用包含码段的内容了
////     */
////    @Override
////    public void editSaveCode(CodeOrderDTO orderDTO) {
////        VciBaseUtil.alertNotNull(orderDTO, "编码申请相关的属性的内容都为空", orderDTO.getOid(), "数据主键",
////            orderDTO.getCodeClassifyOid(), "主题库分类的主键");
//////      CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
////        CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
////        //找业务类型,然后使用主键去获取数据库里的数据
//////      List<ClientBusinessObject> cbos = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), WebUtil.getOidQuery(orderDTO.getOid()));
////
////        QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>();
////        btmWrapper.eq("OID",orderDTO.getOid());
////        CodeWupinEntity cbo = codeOsbtmtypeMapper.selectOne(btmWrapper);
////
//////      CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
//////      CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid());
////
////        if (cbo != null) {
////            throw new VciBaseException(DATA_OID_NOT_EXIST);
////        }
//////      ClientBusinessObject cbo = cbos.get(0);
////        if (!cbo.getTs().toString().contains(VciDateUtil.date2Str(orderDTO.getTs(), VciDateUtil.DateTimeFormat))) {
////            throw new VciBaseException("数据不是最新的,可能他人已经修改,请刷新后再试");
////        }
////        if (!CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(cbo.getLcStatus()) && !orderDTO.isEditInProcess()) {
////            throw new VciBaseException("数据不是{0}的状态,不允许修改", new String[]{CodeDefaultLC.EDITING.getText()});
////        }
////
////        //注意模板不能使用数据存储的时候的模板,因为可能会变化
////
////        //1. 判断必输项
////        CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
////        checkRequiredAttrOnOrder(templateVO, orderDTO);
////        //2.先注入,再组合,最后校验
////        switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
////        //3.处理组合规则。组合规则不能使用编码的属性,因为编码的生成可能是需要属性的
////        switchComponentAttrOnOrder(templateVO, orderDTO);
////        //4.校验规则
////        checkVerifyOnOrder(templateVO, orderDTO);
////        //5.判断关键属性
////        checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO);
////        //6.校验枚举的内容是否正确
////        checkEnumOnOrder(templateVO, orderDTO);
////        //7.处理时间格式,在数据库里面不论是字符串还是日期格式,都使用相同的格式存储
////        switchDateAttrOnOrder(templateVO, orderDTO);
////        //默认的内容不能变,所以只需要拷贝自定义的相关属性即可
////        copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true);
////        //企业码和集团码的不修改
////        cbo.setDescription(orderDTO.getDescription());
////        cbo.setName(orderDTO.getName());
////        try {
////            cbo.setDescription(orderDTO.getDescription());
////            cbo.setName(orderDTO.getName());
////////            cbo.setAttributeValueWithNoCheck("description", orderDTO.getDescription());
//////          cbo.setAttributeValue("name", orderDTO.getName());
////        } catch (Exception e) {
////            e.printStackTrace();
////        }
////
////
////        List<CodeWupinEntity> cboList = new ArrayList<>();
////
////        //备注
////        cbo.setDescription(orderDTO.getDescription());
////        cboList.add(cbo);
//      List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList);
//////
//////      cboList.add(cbo);
////        List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList);
////
////
////        List<String> charList = new ArrayList<>();
////        for (CodeWupinEntity wupinEntity : cboList) {
////            charList.add(wupinEntity.getId());
////        }
////        batchSaveSelectChar(templateVO, charList);
////        return codeList.size() > 0 ? codeList.get(0) : "";
////
////
////
////
////        //修改的时候,编码是不变的
//////      BatchCBO batchCBO = new BatchCBO();
//////      batchCBO.getUpdateCbos().add(cbo);
//////      List<ClientBusinessObject> cboList = new ArrayList<>();
//////      cboList.add(cbo);
//////      boService.persistenceBatch(batchCBO);
////        batchSaveSelectChar(templateVO, cboList);
////    }
//
//
//      List<String> charList = new ArrayList<>();
//      for (CodeWupinEntity wupinEntity : cboList) {
//          charList.add(wupinEntity.getId());
//      }
//      batchSaveSelectChar(templateVO, charList);
//      return codeList.size() > 0 ? codeList.get(0) : "";
//
//
//
//
//      //修改的时候,编码是不变的
////        BatchCBO batchCBO = new BatchCBO();
////        batchCBO.getUpdateCbos().add(cbo);
////        List<ClientBusinessObject> cboList = new ArrayList<>();
////        cboList.add(cbo);
////        boService.persistenceBatch(batchCBO);
//      batchSaveSelectChar(templateVO, cboList);
//  }
}
//}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java
@@ -0,0 +1,534 @@
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.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.dto.CodeOrderDTO;
import com.vci.ubcs.code.dto.CodeOrderSecDTO;
import com.vci.ubcs.code.entity.CodeBasicSec;
import com.vci.ubcs.code.entity.CodeClassify;
import com.vci.ubcs.code.entity.DockingLog;
import com.vci.ubcs.code.enumpack.CodeSecTypeEnum;
import com.vci.ubcs.code.service.*;
import com.vci.ubcs.code.util.gennerAttrMapUtil;
import com.vci.ubcs.code.vo.pagemodel.*;
import com.vci.ubcs.code.vo.webserviceModel.apply.*;
import com.vci.ubcs.code.vo.webserviceModel.attrmap.*;
import com.vci.ubcs.code.vo.webserviceModel.result.json.*;
import com.vci.ubcs.code.vo.webserviceModel.result.xml.XMLResultClassfyVO;
import com.vci.ubcs.code.vo.webserviceModel.result.xml.XMLResultDataObjectDetailDO;
import com.vci.ubcs.code.vo.webserviceModel.result.xml.XMLResultSystemVO;
import com.vci.ubcs.starter.web.pagemodel.SessionInfo;
import com.vci.ubcs.starter.web.util.BeanUtilForVCI;
import com.vci.ubcs.starter.web.util.VciBaseUtil;
import com.vci.ubcs.webservice.annotation.VciWebservice;
import com.vci.ubcs.webservice.config.AttributeMapConfig;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.jws.WebService;
import java.util.*;
import java.util.stream.Collectors;
import static com.vci.ubcs.code.constant.MdmEngineConstant.DEFAULT_SYNC_ATTR_LIST;
/***
 * 统一接口
 */
@Service
@Slf4j
@VciWebservice(path = "/universalInterface")
public class UniversalInterfaceImpl<IDockingLogeServiceing> implements UniversalInterfaceI {
    /**
     * 日志
     */
    private Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired(required = false)
    private AttributeMapConfig attributeMapConfig;
    /**
     * 缓存服务
     */
    //@Autowired
    //private RedisService redisService;
    /**
     * 主题库分类的服务
     */
    @Autowired(required = false)
    private ICodeClassifyService classifyService;
    /**
     * 主数据引擎的服务
     */
    //@Resource
    //private MdmEngineService engineService;
    /**
     * 密级的服务
     */
    @Resource
    private MdmIOService mdmIOService;
    /***
     * 集成接口日志服务的配置
     */
    @Resource
    private IDockingLogeService dockingLogeService;
    private  static String separator="##VCI##";
    private  String errorid="0";
    private String msg="成功";
    private  String objerrorCode="0";
    private String objerrorMsg="成功";
    /***
     * 申请编码接口
     * @param data 传递的数据参数
     * @param dataType 标识data是xml格式还是json格式,接口返回数据也是按照这个格式,以下接口类同
     * @return
     * @throws Throwable
     */
    @Override
    public String applyCode(String data, String dataType) throws Throwable {
        {
//          String resultStr = "";
//          String errorid="0";
//          msg="成功";
//          objerrorCode="0";
//          objerrorMsg="成功";
//          logger.info("申请编码的数据参数:->"+data);
//          logger.info("申请编码的数据类型:->"+dataType);
//          String systemId="";
//          List<XMLResultClassfyVO> resultClassfyVOList = new ArrayList<>();
//          try {
//              if(StringUtils.isBlank(data)) {
//                  errorid="101";
//                  throw new Throwable("接口参数:传递为空");
//              }
//              InterParameterVO interParameterVO  =new InterParameterVO();
//              //如果dataType是xml则,通过xml序列化成对象形式,如果是json则通过json转换成对象格式
//              try {
//                  if ("xml".equals(dataType)) {
//                      XStream xStream = new XStream(new DomDriver());
//                      xStream.processAnnotations(RootDataVO.class);
//                      xStream.autodetectAnnotations(true);
//                      RootDataVO rootDataVO = (RootDataVO) xStream.fromXML(data);
//                      interParameterVO.setData(rootDataVO);
//                  } else {
//                      interParameterVO = JSONObject.toJavaObject(JSONObject.parseObject(data), InterParameterVO.class);
//                  }
//              }catch (Throwable e){
//                  errorid="101";
//                  throw new Throwable("接口参数:传入数据参数解析失败");
//              }
//              ClassfysVO classfysVO = interParameterVO.getData().getClassifys();
//              systemId = interParameterVO.getData().getSystemId();
//              UserVO userVo = interParameterVO.getData().getUser();
//              List<ClassfyVO> classVOList = classfysVO.getClassify();
//              InterParameterVO finalInterParameterVO = interParameterVO;
//
//              //这是账号信息
//              SessionInfo sessionInfo = new SessionInfo();
//              sessionInfo.setUserId(userVo.getUserName());
//              sessionInfo.setUserName(userVo.getTrueName());
//              sessionInfo.setIp(userVo.getIp());
//              VciBaseUtil.setCurrentUserSessionInfo(sessionInfo);
//
//              String finalSystemId = systemId;
//              classVOList.stream().forEach(classVO -> {
//                  logger.info("参数:分类COde:" + classVO.getClassCode());
//                  LinkedList<XMLResultDataObjectDetailDO> resultDataObjectDetailDOs = new LinkedList<>();
//                  //获取分类信息
//                  try {
//                      String libray = classVO.getLibrary();
//                      CodeClassifyVO codeClassifyVO = getClassfy(classVO);
//                      logger.info("end:分类查询完毕");
//                      //获取分类模板信息
//                      if(codeClassifyVO==null || StringUtils.isBlank(codeClassifyVO.getOid())){
//                          objerrorCode="100";
//                          throw  new  Throwable ("根据传输的分类,未获取到分类信息");
//                      }
//                      CodeClstemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(codeClassifyVO.getOid());
//                      if(templateVO==null||StringUtils.isBlank(templateVO.getOid())){
//                          objerrorCode="1";
//                          throw  new  Throwable ("根据传输的分类,未获取MDM系统中对应模板");
//                      }
//                      logger.info("end:模板查询完毕");
//                      ApplyDatasVO applyDatasVO = classVO.getObjects();
//                      DataObjectVO dataObjectVO = new DataObjectVO();
//                      List<CodeClassifyTemplateAttrVO> attrVOS = templateVO.getAttributes().stream().filter(s -> !DEFAULT_SYNC_ATTR_LIST.contains(s.getId()) && VciBaseUtil.getBoolean(s.getFormDisplayFlag())
//                      ).collect(Collectors.toList());
//                      this.getConfigDatas(finalSystemId, libray, applyDatasVO, attrVOS, dataObjectVO);
//                      logger.info("end:数据组织完毕");
//                      //规则的主键需要去获取
//                      CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyVO.getOid());
//                      if(classifyFullInfo==null ||classifyFullInfo.getCurrentClassifyVO()==null || StringUtils.isBlank(classifyFullInfo.getCurrentClassifyVO().getOid())){
//                          objerrorCode="1";
//                          logger.info("classifyFullInfo:"+"根据传输的分类,未获取分类相关信息");
//                          throw  new  Throwable ("根据传输的分类,未获取分类相关信息");
//                      }
//                      CodeRuleVO ruleVO = engineService.getCodeRuleByClassifyFullInfo(classifyFullInfo);
//                      if(ruleVO==null|| StringUtils.isBlank(ruleVO.getOid())){
//                          objerrorCode="102";
//                          throw  new  Throwable ("根据传输的分类,未获取MDM系统中对应规则");
//                      }
//                      logger.info("end:规则获取完毕");
//                      List<CodeOrderSecDTO> codeOrderSecDTOList = getRuleCodeOrderSecDTOs(classVO.getSections().getSection(), ruleVO);
//                      logger.info("end:码段获取完毕");
//                      CodeOrderDTO orderDTO = new CodeOrderDTO();
//                      orderDTO.setCodeClassifyOid(codeClassifyVO.getOid());//分类主键
//                      orderDTO.setSecDTOList(codeOrderSecDTOList);//分类码段
//                      mdmIOService.batchSyncApplyCode(orderDTO, dataObjectVO, resultDataObjectDetailDOs);
//                      logger.info("end:申请获取完毕");
//                  } catch (Throwable e) {
//                      XMLResultDataObjectDetailDO xmlResultDataObjectDetailDO=new XMLResultDataObjectDetailDO();
//                      xmlResultDataObjectDetailDO.setCode("");
//                      xmlResultDataObjectDetailDO.setId("");
//                      xmlResultDataObjectDetailDO.setErrorid(objerrorCode);
//                      xmlResultDataObjectDetailDO.setMsg("编码申请失败:"+e.getMessage());
//                      resultDataObjectDetailDOs.add(xmlResultDataObjectDetailDO);
//                      e.printStackTrace();
//                  }finally {
//                      XMLResultClassfyVO resultClassfyVO = new XMLResultClassfyVO();
//                      resultClassfyVO.setClassCode(classVO.getClassCode());
//                      resultClassfyVO.setLibrary(classVO.getLibrary());
//                      resultClassfyVO.setFullclsfNamePath(classVO.getFullclsfNamePath());
//                      resultClassfyVO.setObjects(resultDataObjectDetailDOs);
//                      resultClassfyVOList.add(resultClassfyVO);
//                  }
//              });
//              XMLResultSystemVO xmlResultSystemVO=new XMLResultSystemVO();
//              xmlResultSystemVO.setClassifys(resultClassfyVOList);
//              xmlResultSystemVO.setMsg(msg);
//              xmlResultSystemVO.setErrorid(errorid);
//              resultStr= transferResultXMl(xmlResultSystemVO,dataType);
//          }catch (Throwable e){
//              e.printStackTrace();;
//              msg="申请编码失败:"+e.getMessage();
//          }finally {
//              XMLResultSystemVO xmlResultSystemVO=new XMLResultSystemVO();
//              xmlResultSystemVO.setClassifys(resultClassfyVOList);
//              xmlResultSystemVO.setMsg(msg);
//              xmlResultSystemVO.setErrorid(errorid);
//              resultStr= transferResultXMl(xmlResultSystemVO,dataType);
//              final boolean[] issucess = {true};
//              if(!errorid.equals("0")) {
//                  issucess[0] = false;
//              }else {
//                  if(!CollectionUtils.isEmpty(resultClassfyVOList)) {
//                      resultClassfyVOList.stream().forEach(xMLResultClassfyVO -> {
//                          xMLResultClassfyVO.getObjects().stream().forEach(objec -> {
//                              if (!(objec.getErrorid().equals("0") || objec.getErrorid().equals("204"))) {
//                                  issucess[0] = false;
//                                  msg=objec.getMsg();
//                              }
//                          });
//                      });
//                  }
//
//              }
//              try {
//                  //记录日志
//                  this.saveLogs(systemId, systemId, data, resultStr, issucess[0], msg, "applyCode");
//              }catch (Throwable e){
//                  e.printStackTrace();
//              }
//          }
//          logger.info("返回参数:"+resultStr);
            return "";
        }
    }
    /***
     * 统一更新接口(更改状态,更改属性信息)接口
     * @param data
     * @param dataType
     * @return
     * @throws Throwable
     */
    @Override
    public String syncEditData(String data, String dataType) throws Throwable {
        return null;
    }
    /***
     * 分类查询
     * @param data
     * @param dataType
     * @return
     * @throws Throwable
     */
    @Override
    public String queryClassify(String data, String dataType) throws Throwable {
        return null;
    }
    /***
     * 数据查询
     * @param data
     * @param dataType
     * @return
     * @throws Throwable
     */
    @Override
    public String queryData(String data, String dataType) throws Throwable {
        return null;
    }
    @Override
    public String queryClassifyRule(String data, String datatype) throws Throwable {
        return null;
    }
    /***
     * 查询校验分类信息
     * @param classfyVO
     */
    private  CodeClassifyVO getClassfy(ClassfyVO classfyVO) throws Throwable{
        CodeClassifyVO classifyVO = new CodeClassifyVO();
        try {
            String classCode = classfyVO.getClassCode();
            String className = classfyVO.getFullclsfNamePath();
            //根据分类代号查询分类信息
            if (StringUtils.isNotBlank(classfyVO.getClassCode())) {
                Map<String, String> conditionMap = new HashMap<>();
                List<CodeClassify> codeClassifyList = classifyService.selectByWrapper(Wrappers.<CodeClassify>query().lambda().eq(CodeClassify::getId, classCode));
                if (!CollectionUtils.isEmpty(codeClassifyList)) {
                    CodeClassify classifyDO = codeClassifyList.get(0);
                    //将DTO转换为DO
                    classifyVO = new CodeClassifyVO();
                    BeanUtilForVCI.copyPropertiesIgnoreCase(classifyDO, classifyVO);
                    if(StringUtils.isBlank(classifyVO.getOid())){
                        throw new  Throwable("根据分类代号未查询到相应的分类信息");
                    }
                }else{
                    throw new  Throwable("根据分类代号未查询到相应的分类信息");
                }
            } else {
                //classifyVO = classifyService.getObjectByClsfNamePath(className.replace(separator, "/"));
                //if(StringUtils.isBlank(classifyVO.getOid())){
                //  throw new  Throwable("根据分类名称路径未查询到相应的分类信息");
                //}
            }
        }catch (Throwable e){
            objerrorCode="100";
            new  Throwable("获取分类信息失败:"+e.getMessage());
        }
        return classifyVO;
    }
    /***
     * 根据穿入的参数信息校验码段规则
     */
    private List<CodeOrderSecDTO> getRuleCodeOrderSecDTOs(List<SectionVO> SectionVOList,CodeRuleVO ruleVO) throws Throwable{
        List<CodeBasicSecVO>  codeBasicSecVOS= ruleVO.getSecVOList();
        Map<String,String> sectionVOMap=new HashMap<>();
        SectionVOList.stream().forEach(SectionVO->{
            sectionVOMap.put(SectionVO.getName(),SectionVO.getValue());
        });
        List<CodeOrderSecDTO> codeOrderSecDTOList=new ArrayList<>();
        for(CodeBasicSecVO codeBasicSecVO: codeBasicSecVOS) {
            String sectype = codeBasicSecVO.getSecType();
            if (!sectype.equals(CodeSecTypeEnum.CODE_SERIAL_SEC.getValue())) {
                String name = codeBasicSecVO.getName();
                String sectypeText = codeBasicSecVO.getSecTypeText();
                logger.info("码段名称:"+name);
                logger.info("描述:"+sectypeText);
                CodeOrderSecDTO CodeOrderSecDTO = new CodeOrderSecDTO();
                if (sectionVOMap.containsKey(name)) {
                    CodeOrderSecDTO.setSecOid(codeBasicSecVO.getOid());
                    String sectypeValue = sectionVOMap.get(name);
                    logger.info("码段值:"+sectypeValue);
                    CodeOrderSecDTO.setSecValue(sectypeValue);
                    codeOrderSecDTOList.add(CodeOrderSecDTO);
                } else {
                    objerrorCode="101";
                    throw new Throwable("传入的码段规则缺少" + name + "码段");
                }
            }
        }
        return codeOrderSecDTOList;
    }
    /***
     * 根据属性映射转换编码所需字段
     */
    public void getConfigDatas(String systemId,String libray, ApplyDatasVO applyDatasVO,List<CodeClassifyTemplateAttrVO> codeClassifyTemplateAttrVOList,DataObjectVO dataObjectVO) throws Throwable {
        List<ApplyDataVO> applyDataVOList=applyDatasVO.getObject();
        LinkedHashMap<String,LinkedHashMap<String,String>> dataKeyValueMap=new LinkedHashMap<>();
        //如果将数据转换成所需要的数据对象
        Map<String, String> attrMapConfigMap=new HashMap<>();
        Map<String, String> propMaps=new HashMap<>();
        try {
            Map<String, String> stringStringMap=attributeMapConfig.getSystem_attrmap();
            //stringStringMap.put("RLM","D:\\RLM.xml");
            LibraryDO libraryDO= gennerAttrMapUtil.getNewInstance().gennerAttrMapBySystem(systemId,stringStringMap);
            List<LibraryClsfDO> libraryClsfDOList=libraryDO.getClsf();
            Map<String, List<ClsfAttrMappingDO>> libPropMaps = libraryClsfDOList.stream().collect(Collectors.toMap(LibraryClsfDO::getLibrary, LibraryClsfDO::getProp, (key1, key2) -> key2));
            if(libPropMaps.containsKey(libray)){
                List<ClsfAttrMappingDO> clsfAttrMappingDOList=libPropMaps.get(libray);
                propMaps = clsfAttrMappingDOList.stream().collect(Collectors.toMap(ClsfAttrMappingDO::getSourceKey, ClsfAttrMappingDO::getTargetKey, (key1, key2) -> key2));
            }
        }catch (Throwable e){
            objerrorCode="1";
            throw new Throwable("MDM集成属性配置文件读取失败");
        }
        LinkedList<String> rowNameList=new LinkedList<>();
        LinkedHashMap<String,Integer> filedIndexMap=new LinkedHashMap<>();
        //根据分类模板组织数据
        final int[] index = {0};
        try {
            codeClassifyTemplateAttrVOList.stream().forEach(codeClassifyTemplateAttrVO -> {
                String attrName = codeClassifyTemplateAttrVO.getName();
                String field = codeClassifyTemplateAttrVO.getId();
                rowNameList.add(attrName);
                filedIndexMap.put(field, index[0]++);
            });
            dataObjectVO.setColName(rowNameList);//放入属性
            attrMapConfigMap.putAll(propMaps);
            LinkedList<RowDatas> rowDataList = new LinkedList<>();
            //Map<String, List<ProppertyVO>> dataPropMap = applyDataVOList.stream().collect(Collectors.toMap(ApplyDataVO::getId, ApplyDataVO::getProp, (key1, key2) -> key2));
            final int[] rowIndex = {0};
            applyDataVOList.stream().forEach(applyDataVO -> {
                rowIndex[0]++;
                RowDatas rowDatas = new RowDatas();
                rowDatas.setOid(applyDataVO.getId());
                rowDatas.setCreator(applyDataVO.getCreator());
                rowDatas.setEditor(applyDataVO.getEditor());
                rowDatas.setCode(applyDataVO.getCode());
                rowDatas.setOperation(applyDataVO.getOperate());
                rowDatas.setStatus(applyDataVO.getStatus());
                rowDatas.setRowIndex(rowIndex[0] + "");
                List<ProppertyVO> proppertyVOList = applyDataVO.getProp();
                LinkedHashMap<Integer, String> integerValueMap = new LinkedHashMap<>();
                Map<String, String> filedValueMap = new HashMap<>();
                if (!CollectionUtils.isEmpty(proppertyVOList)) {
                    Map<String, String> sourceKeyValueMap = proppertyVOList.stream().collect(Collectors.toMap(ProppertyVO::getKey, ProppertyVO::getValue, (key1, key2) -> key2));
                    Map<String, String> keyValueMap = new HashMap<>();
                    //判断attrMapConfigMap是否有值,如果没有则说明基础默认的是编码系统字段
                    if (!CollectionUtils.isEmpty(attrMapConfigMap)) {
                        sourceKeyValueMap.keySet().forEach(sourceKey -> {
                            String dataValue = sourceKeyValueMap.get(sourceKey);
                            if (attrMapConfigMap.containsKey(sourceKey)) {
                                String targetKey = attrMapConfigMap.get(sourceKey);
                                keyValueMap.put(targetKey, StringUtils.isBlank(dataValue)?"":dataValue);
                            }
                        });
                    } else {
                        sourceKeyValueMap.forEach((filed,value)->{
                            keyValueMap.put(filed,StringUtils.isBlank(value)?"":value) ;
                        });
                    }
                    filedIndexMap.forEach((attrKey, column) -> {
                        String keyValue = "";
                        if (keyValueMap.containsKey(attrKey)) {
                            keyValue =StringUtils.isBlank(keyValueMap.get(attrKey))?"":keyValueMap.get(attrKey);
                        }
                        integerValueMap.put(column, keyValue);
                        filedValueMap.put(attrKey, keyValue);
                    });
                }
                rowDatas.setData(integerValueMap);
                rowDatas.setFiledValue(filedValueMap);
                rowDataList.add(rowDatas);
            });
            dataObjectVO.setRowData(rowDataList);
        }catch (Throwable e){
            objerrorCode="1";
            throw new   Throwable("组织数据映射值失败");
        }
    }
    /***
     * 记录日志信息
     * @param systemId
     * @param parmaData
     * @param result
     * @return
     */
    private  void saveLogs(String systemId,String systemName,String parmaData, String result,boolean isSucess,String msg,String operation){
        //记录日志信息
        DockingLog dockingLoge=new DockingLog();
        //String oid=redisService.getUUIDEveryDay();
        dockingLoge.setSystemCode(StringUtils.isBlank(systemId)?"-":systemId);//设置系统标识
        dockingLoge.setSystemName(StringUtils.isBlank(systemName)?"-":systemName);
        dockingLoge.setMsg(msg);//日志消息
        dockingLoge.setClassifyId("-");//分类编号
        dockingLoge.setClassifyName("-");//分类名称
        dockingLoge.setClassifyOid("-");//分类主键
        dockingLoge.setUniqueCode("-");//唯一标识
        dockingLoge.setSystemOid("-");//系统标识
//        dockingLogeDO.setName(operation);
        //dockingLogeDO.setOid(oid);//日志主键
        dockingLoge.setParamString(parmaData);//参数信息
        dockingLoge.setReturnString(result);//返回信息
        dockingLoge.setType(operation);//日志操作类型
        if(isSucess) {
            dockingLoge.setInterfaceStatus("true");//接口集成状态
        }else{
            dockingLoge.setInterfaceStatus("false");//接口集成状态
        }
        dockingLogeService.save(dockingLoge);
        logger.info("集成推送数据成功,systemId:"+systemId+",systemname:"+systemName+",operation:"+operation+",param:"+parmaData);
    }
    /***
     * 数据维护与编码申请返回
     * @param resultSystemVO
     * @param dataType
     * @return
     */
    private String transferResultXMl(XMLResultSystemVO resultSystemVO,String dataType){
        String resultStr="";
        if ("xml".equals(dataType)) {
            //组织返回接口信息
            XStream xStream = new XStream(new DomDriver());
            xStream.processAnnotations(XMLResultSystemVO.class);
            xStream.autodetectAnnotations(true);
            resultStr = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" + xStream.toXML(resultSystemVO);
        } else {
            List<XMLResultClassfyVO> resultClassfyVOList =resultSystemVO.getClassifys();
            JSONResultDataVO resultDataVO = new JSONResultDataVO();
            JSONResultSystemVO jsonResultSystemVO = new JSONResultSystemVO();
            JSONResultClassfysVO jsonResultClassfysVO = new JSONResultClassfysVO();
            List<JSONResultClassfyVO> jSONResultClassfyVOList = new ArrayList<>();
            resultClassfyVOList.stream().forEach(resultClassfyVO -> {
                List<XMLResultDataObjectDetailDO> xmlResultDataObjectDetailDOS = resultClassfyVO.getObjects();
                List<JSONResultDataObjectDetailDO> JSONResultDataObjectDetailDOList = new ArrayList<>();
                xmlResultDataObjectDetailDOS.stream().forEach(xmlResultDataObjectDetail -> {
                    JSONResultDataObjectDetailDO jsonResultDataObjectDetail = new JSONResultDataObjectDetailDO();
                    BeanUtilForVCI.copyPropertiesIgnoreCase(xmlResultDataObjectDetail, jsonResultDataObjectDetail);
                    JSONResultDataObjectDetailDOList.add(jsonResultDataObjectDetail);
                });
                JSONResultClassfyVO jsonResultClassfyVO = new JSONResultClassfyVO();
                jsonResultClassfyVO.setClassCode(resultClassfyVO.getClassCode());
                jsonResultClassfyVO.setLibrary(resultClassfyVO.getLibrary());
                jsonResultClassfyVO.setFullclsfNamePath(resultClassfyVO.getFullclsfNamePath());
                JSONResultDataObjectDO JSONResultDataObjectDO = new JSONResultDataObjectDO();
                JSONResultDataObjectDO.setObject(JSONResultDataObjectDetailDOList);
                jsonResultClassfyVO.setObjects(JSONResultDataObjectDO);
                jSONResultClassfyVOList.add(jsonResultClassfyVO);
            });
            jsonResultClassfysVO.setClassify(jSONResultClassfyVOList);
            jsonResultSystemVO.setClassifys(jsonResultClassfysVO);
            jsonResultSystemVO.setErrorid(resultSystemVO.getErrorid());
            jsonResultSystemVO.setMsg(resultSystemVO.getMsg());
            resultDataVO.setData(jsonResultSystemVO);
            Object object = JSONObject.toJSON(resultDataVO);
            resultStr = object.toString();
        }
        return resultStr;
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/util/gennerAttrMapUtil.java
@@ -0,0 +1,46 @@
package com.vci.ubcs.code.util;
import com.alibaba.cloud.commons.lang.StringUtils;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import com.vci.ubcs.code.vo.webserviceModel.attrmap.LibraryDO;
import com.vci.ubcs.starter.util.LocalFileUtil;
import com.vci.ubcs.webservice.config.AttributeMapConfig;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Map;
public class gennerAttrMapUtil {
    @Autowired(required = false)
    private AttributeMapConfig attributeMapConfig;
    private static  String fileName="";
    private static gennerAttrMapUtil newInstance=null;
    public static gennerAttrMapUtil getNewInstance() {
        if(newInstance==null){
            newInstance=new gennerAttrMapUtil();
        }
        return newInstance;
    }
    /****
     * 获取
     * @param systemId
     */
    public LibraryDO gennerAttrMapBySystem(String systemId, Map<String, String> system_attrmap) throws Throwable{
        if(StringUtils.isBlank(systemId)){
            throw new Throwable("系统标识为空");
        }
        LibraryDO rootDataVO=new LibraryDO();
        if(system_attrmap.containsKey(systemId)){
           String path=system_attrmap.get(systemId);
           String attributeMapData=  LocalFileUtil.readContentForFile(path);
           XStream xStream = new XStream(new DomDriver());
           xStream.processAnnotations(LibraryDO.class);
           xStream.autodetectAnnotations(true);
            rootDataVO = (LibraryDO) xStream.fromXML(attributeMapData);
        }
        return rootDataVO;
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/DockingLogeWrapper.java
@@ -0,0 +1,16 @@
package com.vci.ubcs.code.wrapper;
import com.vci.ubcs.code.entity.DockingLog;
import com.vci.ubcs.code.vo.pagemodel.DockingLogeVO;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import java.util.Objects;
public class DockingLogeWrapper extends BaseEntityWrapper<DockingLog, DockingLogeVO> {
    @Override
    public DockingLogeVO entityVO(DockingLog entity) {
        DockingLogeVO dockingLogeVO = Objects.requireNonNull(BeanUtil.copy(entity, DockingLogeVO.class));
        return dockingLogeVO;
    }
}