ludc
2024-01-16 02e7ca80d849ad8a99974bd08f9e68a78f36d601
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
@@ -1,5 +1,6 @@
package com.vci.ubcs.code.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -24,7 +25,6 @@
import com.vci.ubcs.code.vo.pagemodel.UITablePageVO;
import com.vci.ubcs.code.vo.pagemodel.*;
import com.vci.ubcs.code.wrapper.BaseMdodelWrapper;
import com.vci.ubcs.code.wrapper.CodeAllcodeWrapper;
import com.vci.ubcs.flow.core.dto.FlowStatusDTO;
import com.vci.ubcs.flow.core.feign.IMDMIFlowAttrClient;
import com.vci.ubcs.flow.core.vo.ProcessStageAttrVO;
@@ -41,8 +41,7 @@
import com.vci.ubcs.starter.revision.model.TreeQueryObject;
import com.vci.ubcs.starter.revision.model.TreeWrapperOptions;
import com.vci.ubcs.starter.revision.service.RevisionModelUtil;
import com.vci.ubcs.starter.util.MdmBtmTypeConstant;
import com.vci.ubcs.starter.util.UBCSSqlKeyword;
import com.vci.ubcs.starter.util.*;
import com.vci.ubcs.starter.web.constant.QueryOptionConstant;
import com.vci.ubcs.starter.web.constant.RegExpConstant;
import com.vci.ubcs.starter.web.enumpck.BooleanEnum;
@@ -59,15 +58,18 @@
import com.vci.ubcs.system.user.feign.IUserClient;
import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
import oracle.sql.TIMESTAMP;
import org.hibernate.validator.constraints.NotEmpty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.Cache;
@@ -297,6 +299,7 @@
     * 空格
     */
    public static final String SPACE = " ";
    /**
     * 缓存key
     */
@@ -346,8 +349,15 @@
    */
   @Autowired
   private IMDMIFlowAttrClient imdmiFlowAttrClient;
//   @Autowired
//   private CodeOsbtmtypeMapper codeOsbtmtypeMapper;----
   //   @Autowired
   //   private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
   /**
    * 日志保存工具类
    */
   @Autowired
   private SaveLogUtil saveLogUtil;
    /**
@@ -410,39 +420,58 @@
    @Transactional
    @Override
    public void changeStatus(BaseModelDTO baseModelDTO) {
        VciBaseUtil.alertNotNull(baseModelDTO, "数据信息", baseModelDTO.getOid(), "主键", baseModelDTO.getBtmname(), "业务类型", baseModelDTO.getLcStatus(), "目标状态");
        List<String> oids = VciBaseUtil.str2List(baseModelDTO.getOid());
        List<BaseModel> baseModels = new ArrayList<>();
        baseModels = selectByTypeAndOid(baseModelDTO.getBtmname(), baseModelDTO.getOid());
        if (baseModels.size() == 0) {
            throw new VciBaseException("未查询到相关数据。");
        }
        //还需要修改allCode的生命周期
        QueryWrapper<CodeAllCode> allCodeWrapper = new QueryWrapper<>();
        allCodeWrapper.eq("createcodebtm", baseModelDTO.getBtmname());
        allCodeWrapper.in("createcodeoid", oids);
        List<CodeAllCode> codeCbos = codeAllCodeService.selectByWrapper(allCodeWrapper);// 回收需要业务数据删除
        if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) {
            R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(baseModelDTO.getBtmname()));
            if (!listR.isSuccess() || listR.getData().size() == 0) {
                throw new VciBaseException("传入业务类型未查询到相应表单,请检查!");
            }
         // 直接删除,不给状态
         commonsMapper.deleteByTaleAndOid(listR.getData().get(0).getTableName(), VciBaseUtil.toInSql(baseModelDTO.getOid()));
         // commonsMapper.updateByTaleAndOid(listR.getData().get(0).getTableName(), VciBaseUtil.toInSql(baseModelDTO.getOid()),CodeDefaultLC.TASK_BACK.getValue());
        } else {
            for (BaseModel baseModel : baseModels) {
                baseModel.setLcStatus(baseModelDTO.getLcStatus());
            }
         R r = updateBatchByBaseModel(baseModelDTO.getBtmname(), baseModels);
         if(!r.isSuccess()){
            throw new VciBaseException("更新数据出错,重试!"+r.getMsg());
      try {
         VciBaseUtil.alertNotNull(baseModelDTO, "数据信息", baseModelDTO.getOid(), "主键", baseModelDTO.getBtmname(), "业务类型", baseModelDTO.getLcStatus(), "目标状态");
         List<String> oids = VciBaseUtil.str2List(baseModelDTO.getOid());
         List<BaseModel> baseModels = new ArrayList<>();
         baseModels = selectByTypeAndOid(baseModelDTO.getBtmname(), baseModelDTO.getOid());
         if (baseModels.size() == 0) {
            throw new VciBaseException("未查询到相关数据。");
         }
         //还需要修改allCode的生命周期
         QueryWrapper<CodeAllCode> allCodeWrapper = new QueryWrapper<>();
         allCodeWrapper.eq("createcodebtm", baseModelDTO.getBtmname());
         allCodeWrapper.in("createcodeoid", oids);
         List<CodeAllCode> codeCbos = codeAllCodeService.selectByWrapper(allCodeWrapper);// 回收需要业务数据删除
         if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) {
            R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(baseModelDTO.getBtmname()));
            if (!listR.isSuccess() || listR.getData().size() == 0) {
               throw new VciBaseException("传入业务类型未查询到相应表单,请检查!");
            }
            // 直接删除,不给状态
            commonsMapper.deleteByTaleAndOid(listR.getData().get(0).getTableName(), VciBaseUtil.toInSql(baseModelDTO.getOid()));
            // commonsMapper.updateByTaleAndOid(listR.getData().get(0).getTableName(), VciBaseUtil.toInSql(baseModelDTO.getOid()),CodeDefaultLC.TASK_BACK.getValue());
         } else {
            for (BaseModel baseModel : baseModels) {
               baseModel.setLcStatus(baseModelDTO.getLcStatus());
            }
            R r = updateBatchByBaseModel(baseModelDTO.getBtmname(), baseModels);
            if(!r.isSuccess()){
               throw new VciBaseException("更新数据出错,重试!"+r.getMsg());
            }
         }
         // 刚好顺序是一致的,所以直接按照codeallcode的顺序来拿业务数据
         int i = -1;
         for (CodeAllCode codeCbo : codeCbos) {
            codeCbo.setLcStatus(baseModelDTO.getLcStatus());
            // 如果是回收,就需要将业务数据存储到码值表中
            if(baseModelDTO.getLcStatus().equals(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_TAKEBACK)){
               codeCbo.setBusinessData(JSON.toJSONString(baseModels.get(++i)));
            }
         }
         codeAllCodeService.updateBatchById(codeCbos);
         //记录日志信息
         saveLogUtil.operateLog(
            CodeDefaultLC.getTextByValue(baseModelDTO.getLcStatus()),
            false,
            JSON.toJSONString(baseModels)
         );
      }catch (Exception e){
         // 插入更改日志记录
         saveLogUtil.operateLog(CodeDefaultLC.getTextByValue(baseModelDTO.getLcStatus()),true,e.toString());
         throw e;
      }
        for (CodeAllCode codeCbo : codeCbos) {
            codeCbo.setLcStatus(baseModelDTO.getLcStatus());
        }
        codeAllCodeService.updateBatchById(codeCbos);
    }
   /**
@@ -479,6 +508,7 @@
        CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
        CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
        CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid());
      final BladeUser user = AuthUtil.getUser();
        //1.判断规则中除了流水码段,是否有其他码段
        checkSecValueOnOrder(ruleVO, orderDTO);
        //2.判断必输项
@@ -509,13 +539,13 @@
      //cbo.setCreator(String.valueOf(AuthUtil.getUser().getUserId()));、
      if(authUser) {
         // 要求显示账号,所以做了更改
         cbo.setCreator(String.valueOf(AuthUtil.getUser().getAccount()));
         cbo.setLastModifier(String.valueOf(AuthUtil.getUser().getAccount()));
         cbo.setCreator(String.valueOf(user.getAccount()));
         cbo.setLastModifier(String.valueOf(user.getAccount()));
      }else{
         cbo.setCreator(orderDTO.getCreator());
         cbo.setLastModifier(orderDTO.getLastModifier());
      }
      cbo.setTenantId(AuthUtil.getTenantId());
      cbo.setTenantId(user.getTenantId());
      if(StringUtils.isNotBlank(orderDTO.getLcStatus())||StringUtils.isNotBlank(orderDTO.getData().get("lcStatus"))){
         cbo.setLcStatus(StringUtils.isNotBlank(orderDTO.getLcStatus())?orderDTO.getLcStatus():orderDTO.getData().get("lcStatus"));
      }
@@ -528,7 +558,7 @@
        cbo.setDescription(orderDTO.getDescription());
        cboList.add(cbo);
        List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(), cboList);
        List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(), cboList,user);
        batchSaveSelectChar(templateVO, cboList);
        return codeList.size() > 0 ? codeList.get(0) : "";
@@ -678,7 +708,6 @@
        }
    }
    /**
     * 设置新的值到申请对象上
     *
@@ -767,6 +796,7 @@
                sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'";
            }
            sql[0] += " and lastR = '1' and lastV = '1' ";
         // 获取不参与校验的分类oid
         String isParticipateCheckOids = classifyService.selectLeafByParentClassifyOid(classifyFullInfo.getTopClassifyVO().getOid(), classifyFullInfo.getCurrentClassifyVO().getOid());
         if(Func.isNotEmpty(isParticipateCheckOids)){
            sql[0] += " and codeclsfid not in(" + isParticipateCheckOids + ")";
@@ -886,7 +916,7 @@
    * @param authUser
    * @return
    */
   private String addSaveBZCode(CodeBZApplyDTO codeBZApplyDTO, boolean authUser) throws Exception {
   public String addSaveBZCode(CodeBZApplyDTO codeBZApplyDTO, boolean authUser) throws Exception {
      String code="";
      VciBaseUtil.alertNotNull(codeBZApplyDTO.getCodeClassifyOid(), "主题库分类的主键",
         codeBZApplyDTO.getTemplateOid(), "模板的主键", codeBZApplyDTO.getCodeRuleOid(), "编码规则的主键");
@@ -961,14 +991,14 @@
      LinkedList<CodeOrderSecDTO> newSecDTOList=new LinkedList<>();
      changeCodeOrderSecDTO(ruleVO,secDTOS,oldCode,newSecDTOList);//根据要求重新算码段码值
      if(!codeBZApplyDTO.isEditSeries()){//变更为标准
         if(!codeBZApplyDTO.isSeries()){//如果是表准,则需要将系列好流水置为null
         //if(!codeBZApplyDTO.isSeries()){//如果是表准,则需要将系列好流水置为null
            //因为是标准则控制码段中的系列流水码段值为空
            newSecDTOList.stream().forEach(codeOrderSecDTO -> {
               if(codeCodeBasicSecMap.containsKey(codeOrderSecDTO.getSecOid())&&codeCodeBasicSecMap.get(codeOrderSecDTO.getSecOid()).getName().equals(secName)){
                  codeOrderSecDTO.setSecValue("");
               }
            });
         }
         //}
         orderDTO.setSecDTOList(newSecDTOList);
         return createDataBZ(orderDTO,ruleVO,authUser);
      }else{//变更为系列.则按照逻辑去处理
@@ -1112,8 +1142,79 @@
    * @return
    * @throws Exception
    */
   @Override
   public String addSaveBZCodeNotauthUser(CodeBZApplyDTO codeBZApplyDTO, boolean authUser) throws Exception {
      return   addSaveBZCode(codeBZApplyDTO,authUser);
   }
   /**
    * 获取统计分析数据
    * @param btmNames 业务类型
    * @return 数据集
    */
   @Override
   public R getStatisticAnalysis(String btmNames) {
      //查询业务类型对应的数据库表
      R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Arrays.asList(btmNames.split(",")));
      if (!listR.isSuccess() || listR.getData().size() == 0) {
         throw new ServiceException("传入业务类型未查询到相应表单,请检查!");
      }
      List tableData = new ArrayList();
      for (BtmTypeVO datum : listR.getData()) {
         String sql = "select count(*) countNum, to_char(CREATETIME, 'mm') countDate\n" +
                     "from "+ datum.getTableName() +"\n" +
                     "where CREATETIME >= to_date(EXTRACT(YEAR FROM SYSDATE) || '-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss') AND LASTV = '1'\n" +
                     "group by to_char(CREATETIME, 'mm')\n" +
                     "order by to_char(CREATETIME, 'mm')";
         //查询出需要处理的数据
         List<Map> maps = commonsMapper.selectBySql(sql);
         //当年每月月份之前之和
         List<Integer> monthCount = new ArrayList<>(12);
         //当年每月的月份数据
         List<Integer> month = new ArrayList<>();
         //获取当前月的数字
         Calendar instance = Calendar.getInstance();
         int nowmonth = instance.get(Calendar.MONTH) + 1;
         if(maps.size() == 0){
            nowmonth = 0;
         }
         //从1到12月进行处理
         for (Integer i = 1; i <= 12; i++) {
            //当前月后所有数据设置为0
            if(i>nowmonth){
               monthCount.add(0);
               month.add(0);
               continue;
            }
            //当前月份之前之和
            Integer count = 0;
            //当前月份数据
            Integer sameMonth = 0;
            //对数据库查的数据进行处理,对当前月份进行累加
            for (Map map : maps) {
               Integer mounDate = Integer.parseInt(String.valueOf(map.get("COUNTDATE")));
               if(mounDate <= i){
                  count += Integer.parseInt(String.valueOf(map.get("COUNTNUM")));
               }
               if (mounDate == i) {
                  sameMonth = Integer.parseInt(String.valueOf(map.get("COUNTNUM")));
               }
            }
            monthCount.add(count);
            month.add(sameMonth);
         }
         //对数据进行整合
         HashMap<String,Object> menuData = new HashMap<>();
         menuData.put("menuName",datum.getName());
         menuData.put("codeType",null);
         ArrayList monthData = new ArrayList();
         monthData.add(monthCount);
         monthData.add(month);
         menuData.put("menuData",monthData);
         tableData.add(menuData);
      }
      return R.data(tableData);
   }
   /**
@@ -1168,12 +1269,12 @@
                    temp = "%s";
                }
                queryKey = String.format(temp, "nvl("+ "t." + attrId +",'/')");
                queryValue = String.format(temp, "'" + (trim ? value.trim() : value) + "'");
                queryValue = String.format(temp, "'" + (trim ? SpecialCharacterConverter.escapeSpecialCharacters(value.trim()):SpecialCharacterConverter.escapeSpecialCharacters(value)) + "'");
                conditionMap.put(queryKey, queryValue);
            } else {
            if(StringUtils.isNotBlank(value)) {
               //为空的时候不代表不校验,只是不去除相关的信息
               conditionMap.put("nvl("+ "t." + attrId+",'/')", "'" + value + "'");
               conditionMap.put("nvl("+ "t." + attrId+",'/')", "'" + SpecialCharacterConverter.escapeSpecialCharacters(value) + "'");
            }else{
               conditionMap.put("t." + attrId, QueryOptionConstant.ISNULL);
            }
@@ -2408,7 +2509,14 @@
                } else {
                    return (field.contains(".") ? "" : "t.") + field + SPACE + "= " + getStringValueInWhere(field, value, attrVOMap) + "" + SPACE;
                }
            } else {
            } else if(key.endsWith("_in")){
            String field = UBCSSqlKeyword.getColumn(key, "_in");
            if (referFieldMap.containsKey(field)) {
               return VciBaseUtil.toInSql(referFieldMap.get(field),value);  //referFieldMap.get(field) + SPACE + "= '" + value + "'" + SPACE;
            } else {
               return (field.contains(".") ? "" : "t.") + field + SPACE + "= " + getStringValueInWhere(field, value, attrVOMap) + "" + SPACE;
            }
         }else {
//                if (referFieldMap.containsKey(key)) {
//                    //说明是参照的,我们参照的查询都认为是字符串,如果是时间格式的查询肯定有问题,
//                    String selectKey = referFieldMap.get(key);
@@ -2447,7 +2555,6 @@
            return getSqlByValue(key, value, attrVOMap,btmType);
         }
      }*/
    }
    /**
@@ -2482,12 +2589,24 @@
                }
                DateConverter dateConverter = new DateConverter();
                if (VciFieldTypeEnum.VTDateTime.equals(fieldTypeEnum)) {
                    //实际上,数据库都是timestamp的类型.
                    dateConverter.setAsText(value);
                    return "to_date('" + dateConverter.getAsText(VciDateUtil.DateTimeFormat) + "','" + DATETIME_FORMAT + "')";
                    //实际上,数据库都是timestamp的类型. TODO:虽然没能解决查询日期的问题,但是能暂时解决报错问题
               if(value.contains("*")){
                  value = value.replace("*","%");
                  return "'" + value + "'";
               }else{
                  value = value.replace("*","");
                  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 + "')";
               if(value.contains("*")){
                  value = value.replace("*","%");
                  return "'" + value + "'";
               }else {
                  value = value.replace("*","");
                  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)) {
@@ -2704,6 +2823,7 @@
        cbo.setLastModifyTime(new Date());
        cbo.setLastModifier(String.valueOf(AuthUtil.getUser().getAccount()));
      R r = updateBatchByBaseModel(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), Collections.singletonList(cbo));
      if(!r.isSuccess()){
         throw new ServiceException(r.getMsg());
      }
@@ -2853,7 +2973,17 @@
        }
        conditionMap.put("t.lastr", "1");
        conditionMap.put("t.lastv", "1");
        return queryGrid(btmTypeId, templateVO, conditionMap, pageHelper);
      DataGrid<Map<String, String>> mapDataGrid = queryGrid(btmTypeId, templateVO, conditionMap, pageHelper);
      //处理返回数据与模板数据配置的字段不一样问题
      templateVO.getAttributes().stream().forEach(e->{
         for (Map<String, String> datum : mapDataGrid.getData()) {
            if(datum.containsKey(e.getId().toLowerCase()) && !datum.containsKey(e.getId())){
               datum.put(e.getId(),datum.get(e.getId().toLowerCase()));
               datum.remove(e.getId().toLowerCase());
            }
         }
      });
      return mapDataGrid;
//        List<String> selectFieldList = templateVO.getAttributes().stream().map(CodeClassifyTemplateAttrVO::getId).collect(Collectors.toList());
//        //参照让平台直接查询就行
//        List<String> finalSelectFieldList = selectFieldList;
@@ -3078,11 +3208,27 @@
      oldCbo.setLastModifier(String.valueOf(AuthUtil.getUser().getAccount()));
      oldCbo.setLastModifyTime(new Date());
        try {
         // 修改版次号
         updateBatchByBaseModel(oldCbo.getBtmname(), Collections.singletonList(oldCbo));
         // 插入新的数据
            insertBatchByType(cbo.getBtmname(), Collections.singletonList(cbo));
        } catch (Exception vciError) {
            throw new VciBaseException("数据更改保存出错了", new String[0], vciError);
        }
         //处理码值表,对码值表进行处理替换创建数据的oid
         QueryWrapper<CodeAllCode> wrapper = new QueryWrapper<>();
         wrapper.eq("CREATECODEOID",orderDTO.getCopyFromVersion());
         CodeAllCode codeAllCode = codeAllCodeService.getOne(wrapper);
         codeAllCode.setCreateCodeOid(cbo.getOid());
         codeAllCode.setLastModifyTime(new Date());
         codeAllCode.setTs(new Date());
         codeAllCode.setLastModifier(AuthUtil.getUser().getUserName());
         codeAllCodeService.updateById(codeAllCode);
         // 记录数据更改日志
         saveLogUtil.operateLog("数据更改",false, StringUtil.format("{}\n修改为:\n{}",JSON.toJSONString(Collections.singletonList(oldCbo)),JSON.toJSONString(Collections.singletonList(cbo))));
      } catch (Exception vciError) {
         // 记录数据更改报错时的日志
         saveLogUtil.operateLog("数据更改",true,vciError.toString());
         throw new VciBaseException("数据更改保存出错了", new String[0], vciError);
      }
        batchSaveSelectChar(templateVO, Collections.singletonList(cbo));
    }
@@ -3280,6 +3426,16 @@
        dataList.add(cbo);
        wrapperData(dataList, templateVO, sqlBO.getSelectFieldList(), true);
        R<List<Map<String, String>>> result = R.data(Collections.singletonList(cbo));
      //处理返回数据与模板数据配置的字段不一样问题
      templateVO.getAttributes().stream().forEach(e->{
         for (Map<String, String> datum : result.getData()) {
            if(datum.containsKey(e.getId().toLowerCase()) && !datum.containsKey(e.getId())){
               datum.put(e.getId(),datum.get(e.getId().toLowerCase()));
               datum.remove(e.getId().toLowerCase());
            }
         }
      });
        //我们要看是否不是升版的,升版的话,需要对比不相等的属性
/*        String copy = cbo.get("copyfromversion");
//      if (StringUtils.isBlank(copy)) {
@@ -3740,11 +3896,10 @@
    @Override
    public MdmUIInfoVO getUIInfoByClassifyOid(String codeClassifyOid, String functionId) {
        VciBaseUtil.alertNotNull(codeClassifyOid, "主题库分类主键");
        MdmUIInfoVO uiInfoVO = getTableDefineByTemplateVO(getUsedTemplateByClassifyOid(codeClassifyOid));
        uiInfoVO.setLeaf(classifyService.countChildrenByClassifyOid(codeClassifyOid) == 0);
        if (StringUtils.isNotBlank(functionId) && !"~".equalsIgnoreCase(functionId)) {
            List<Menu> buttonVOS = iSysClient.getMenuButtonByType(uiInfoVO.getTemplateVO().getBtmTypeId()).getData();
            List<Menu> buttonVOS = iSysClient.getMenuButtonByType(codeClassifyOid,uiInfoVO.getTemplateVO().getBtmTypeId(),"data_auth").getData();
            //         List<SmOperationVO> operationVOS = operationService.listButtonByFunctionId(functionId);
            //         if (operationVOS == null) {
            //            operationVOS = new ArrayList<>();
@@ -4054,7 +4209,7 @@
        bo.setFirstV("1");
        bo.setLastV("1");
        bo.setRevisionRule(listR.getData().get(0).getRevisionRuleId());
        bo.setVersionRule("".equals(listR.getData().get(0).getVersionRule())?"0":listR.getData().get(0).getVersionRule());
        bo.setVersionRule("".equals(listR.getData().get(0).getVersionRule())?"1":listR.getData().get(0).getVersionRule());
        if (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId())) {
            R<List<RevisionRuleVO>> revisionRuleVO = revisionRuleClient
                    .selectByIdCollection(Collections.singletonList(listR.getData().get(0).getRevisionRuleId().toLowerCase()));
@@ -4075,7 +4230,7 @@
        bo.setId("");
        bo.setName("");
        bo.setDescription("");
        bo.setOwner("1");
        bo.setOwner(AuthUtil.getUser().getUserId().toString());
//      bo.setCheckinby(userName);
        bo.setCopyFromVersion("");
//      this.initTypeAttributeValue(bo,btmTypeVO);
@@ -4241,37 +4396,38 @@
            throw new VciBaseException("传入业务类型未查询到相应表单,请检查!");
        }
      // TODO:参照配置的模糊查询过滤条件暂未处理
        String namesql = "";
        if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("name"))) {
            String s = baseQueryObject.getConditionMap().get("name");
            s = "%" + s + "%";
            namesql = "and name like" + VciBaseUtil.toInSql(s);
        }
      /*        String namesql = "";
            if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("name"))) {
               String s = baseQueryObject.getConditionMap().get("name");
               s = "%" + s + "%";
               namesql = "and name like" + VciBaseUtil.toInSql(s);
            }
        String codesql = "";
        if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("id"))) {
            String s = baseQueryObject.getConditionMap().get("id");
            s = "%" + s + "%";
            codesql = "and id like" + VciBaseUtil.toInSql(s);
        }
            String codesql = "";
            if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("id"))) {
               String s = baseQueryObject.getConditionMap().get("id");
               s = "%" + s + "%";
               codesql = "and id like" + VciBaseUtil.toInSql(s);
            }
        String lcstatusSql = "";
        if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("lcstatus"))) {
            lcstatusSql = "and lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus"));
        }
//        String where = "";
            String lcstatusSql = "";
            if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("lcstatus"))) {
               lcstatusSql = "and lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus"));
            }*/
      //        String where = "";
//        if (StringUtils.isNotBlank(codesql) || StringUtils.isNotBlank(lcstatusSql) || StringUtils.isNotBlank(namesql)) {
//            where = "where ";
//        }
      //        if (StringUtils.isNotBlank(codesql) || StringUtils.isNotBlank(lcstatusSql) || StringUtils.isNotBlank(namesql)) {
      //            where = "where ";
      //        }
      String whereSqlByMap = UBCSCondition.getWhereSqlByMap(baseQueryObject.getConditionMap());
        String num1 = baseQueryObject.getPage() * baseQueryObject.getLimit() + "";
      String num1 = baseQueryObject.getPage() * baseQueryObject.getLimit() + "";
        String num2 = ((baseQueryObject.getPage()) - 1) * baseQueryObject.getLimit() + 1 + "";
        List<Map> maps = commonsMapper.selectBySql("select * from ( select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName() + SPACE
        List<Map> maps = commonsMapper.selectBySql("select * from (select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName() + SPACE
                + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
                + " and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 "
                + lcstatusSql + namesql + codesql + ") t "+ (baseQueryObject.getLimit()==-1?")": ("where rownum <=" + num1 + ") where rn >=" + num2)
                + (Func.isNotBlank(whereSqlByMap) ? "and "+whereSqlByMap:"") + ") t "+ (baseQueryObject.getLimit()==-1?")": ("where rownum <=" + num1 + ") where rn >=" + num2)
      ));
        List<BaseModel> baseModels = new ArrayList<>();
        //将查询到的数据转换为basemodel,使用的反射方式来进行创建的
@@ -4320,7 +4476,7 @@
        int total = commonsMapper.queryCountBySql("select count(*) from " + listR.getData().get(0).getTableName() + SPACE
                + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
                + "and lastv = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 "
                + lcstatusSql + namesql + codesql
            + (Func.isNotBlank(whereSqlByMap) ? "and "+whereSqlByMap:"")
        );
        IPage<BaseModelVO> objectDataGrid = new Page<>();
        objectDataGrid.setPages(baseQueryObject.getPage());