ludc
2023-07-17 58e84408a3cdcd57a349fcd7faadf832361965ff
代码提交
已修改6个文件
121 ■■■■ 文件已修改
Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/code/code.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeRule.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/enumpack/CodeSecTypeEnum.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java 83 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeBasicSecWrapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue
@@ -1211,7 +1211,7 @@
                }else{
                    // 选择显示字段
                    data.selectedArrary.forEach(item => {
                        console.log(item);
                        // console.log(item);
                        this.codeShowFieldConfigVOS.push(
                            {
                                field: item.id,
Source/UBCS-WEB/src/views/code/code.vue
@@ -1330,12 +1330,13 @@
            this.$message.warning("请选择一条数据!");
            return false;
          }
          const attr = this.selectAttrParams.selectionChangeAttrList[0];
          //调用子组件并传递当前选中的参数值,实现回显
          this.form = Object.assign({}, this.form, {
            referAttributeId:this.selectAttrParams.selectionChangeAttrList[0].id,
            referAttributeName:this.selectAttrParams.selectionChangeAttrList[0].name,
            referCodeClassifyOid: this.currentSelectTreeData.key,
            referCodeClassifyOidName: this.currentSelectTreeData.title,
            referAttributeId: attr.id || '',
            referAttributeName: attr.name || attr.id,
            referCodeClassifyOid: this.currentSelectTreeData.key || '',
            referCodeClassifyOidName: this.currentSelectTreeData.title || '',
          })
          this.isShowSelectAttrOption = false;
        },
@@ -2541,6 +2542,7 @@
        openAttrSelectOrGetValue(condition){
          if(condition === 'attr'){
            this.isShowSelectAttrOption = true;
            this.loadlistClassifyLinkAttr();
          }else if(condition === 'value'){
            //打开公式编辑框,第二层嵌套对话框
            //this.$refs.formulaEditor.isShowformulaEdit = true;
Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeRule.java
@@ -66,4 +66,9 @@
    @NotBlank(message = "规则依据不能为空")
    private String accordingTo;
    /**
     * 基础码段的码段类型顺序拼接而成的字符串
     */
    private String basicSecTypes;
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/enumpack/CodeSecTypeEnum.java
@@ -22,18 +22,22 @@
     * 可变码段
     */
    CODE_VARIABLE_SEC("codevariablesec","可变码段"),
    /**
     * 日期码段
     */
    CODE_DATE_SEC("codedatesec","日期码段"),
    /**
     * 分类码段
     */
    CODE_CLASSIFY_SEC("codeclassifysec","分类码段"),
    /**
     * 属性码段
     */
    CODE_ATTR_SEC("codeattrsec","属性码段"),
    /**
     * 流水码段
     */
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java
@@ -22,6 +22,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant;
import com.vci.ubcs.code.constant.MdmBtmTypeConstant;
import com.vci.ubcs.code.dto.CodeBasicSecDTO;
import com.vci.ubcs.code.dto.CodeRuleDTO;
@@ -40,6 +41,8 @@
import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
import com.vci.ubcs.code.wrapper.CodeClassifyWrapper;
import com.vci.ubcs.code.wrapper.CodeRuleWrapper;
import com.vci.ubcs.omd.cache.EnumCache;
import com.vci.ubcs.omd.enums.EnumEnum;
import com.vci.ubcs.starter.exception.VciBaseException;
import com.vci.ubcs.starter.revision.service.RevisionModelUtil;
import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil;
@@ -64,6 +67,7 @@
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_EDITING;
import static com.vci.ubcs.code.constant.FrameWorkLangCodeConstant.DATA_OID_NOT_EXIST;
@@ -437,6 +441,9 @@
            if (!CodeRuleLC.EDITING.getValue().equals(codeRuleDO.getLcStatus())) {
                return R.fail("非编辑状态的编码规则无法发布");
            }
            // 发布时将码段类型按照字符串分隔的形式拼接并存储
            String secTypeStr = codeBasicSecService.listCodeBasicSecByRuleOid(codeRuleDO.getOid()).stream().map(CodeBasicSecVO::getSecType).collect(Collectors.joining(","));
            codeRuleDO.setBasicSecTypes(secTypeStr);
            count = codeRuleMapper.update(null,wrapper.set(CodeRule::getLcStatus, CodeRuleLC.RELEASED.getValue()));
        } else {
            return R.fail("暂不支持的操作类型");
@@ -501,27 +508,77 @@
    public R checkLikeCodeRule(String oid) throws VciBaseException {
        // 1、查询出当前要发布的规则
        CodeRuleVO codeRuleVO = getObjectHasSecByOid(oid);
        // 2、找出与当前发布的规则码段顺序一致的规则
        if(Func.isNotEmpty(codeRuleVO.getSecVOList())){
            String secType = codeRuleVO.getSecVOList().stream().map(CodeBasicSecVO::getSecType).collect(Collectors.joining(","));
        // 当前发布的规则不存在码段信息
        if(Func.isEmpty(codeRuleVO.getSecVOList())){
            return R.data(null);
        }
        // 2、找出与当前发布的规则码段顺序一致的规则
        String secTypes = codeRuleVO.getSecVOList().stream().map(CodeBasicSecVO::getSecType).collect(Collectors.joining(","));
        //先查询出所有已发布的编码规则
        List<CodeRule> codeRuleList = codeRuleMapper.selectList(Wrappers.<CodeRule>query().lambda().eq(CodeRule::getLcStatus, FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_RELEASED));
        List<CodeRuleVO> codeRuleVOS = codeRuleDO2VOs(codeRuleList, true);
        // 满足码段类型顺序一致的要求的编码规则,可以进入下一步比较规则
        List<CodeRuleVO> codeRuleVOStream = codeRuleVOS.parallelStream().filter(item -> {
            // 对BasicSec使用orderNum排序(查询的时候其实已经排过一次序了),并将secType用逗号分隔拼接成一个字符串
            String itemSecTypes = item.getSecVOList().parallelStream().sorted(Comparator.comparing(CodeBasicSecVO::getOrderNum)).map(CodeBasicSecVO::getSecType).collect(Collectors.joining(","));
            if (secTypes.equals(itemSecTypes)) {
                return true;
            }
            return false;
        }).collect(Collectors.toList());
        // 3、各类码段分别进行比对
        codeRuleVOStream.parallelStream().filter(item->{
            item.getSecVOList().stream().filter(basicSec->{
                switch (basicSec.getSecType()){
                    // 属性码段,比对属性和属性所在分类(referCodeClassifyOid)
                    case "codeattrsec":
                        List<CodeBasicSecVO> codeattrsec = this.getBasicSecBySecType("codeattrsec", codeRuleVO);
        // TODO 待完善
                        break;
                    // 可变码段,比对码段长度,编码补位方式和补位时的字符
                    case "codevariablesec":
                        break;
                    // 固定码段比对按升序排序的码值,
                    case "codefixedsec":
                        break;
                    // 分类码段比对按升序排序码值
                    case "codeclassifysec":
                        break;
                    // 日期码段比对日期格式
                    case "codedatesec":
                        break;
                    // 引用码段,比对参照应用的业务类型
                    case "coderefersec":
                        break;
                    // 层级码段,比对层级类型、层级的值、字符截取类型、取值类型
                    case "codelevelsec":
                        break;
                    case "codeserialsec":
                    // 流水码段比对码段的长度
        // 2、在1、的基础上再比对码段类型的顺序一致的编码跪着
        // 3、在2、的基础上比较码段码值长度,对比出长度相同的编码规则
        // 4、在3、的基础上比较码值是否相同
                        break;
                    default:
                        return false;
                }
                return false;
            });
            return false;
        });
        // 最后将结果进行返回
        return null;
    }
    private List<CodeBasicSecVO> getBasicSecBySecType(String secType,CodeRuleVO codeRuleVO){
        List<CodeBasicSecVO> codeBasicSecVOList = codeRuleVO.getSecVOList().parallelStream().filter(item -> {
            if (item.getSecType().equals(secType)) {
                return true;
            }
            return false;
        }).collect(Collectors.toList());
        return codeBasicSecVOList;
    }
    /**
     * 批量数据对象转换为显示对象
     *
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeBasicSecWrapper.java
@@ -1,22 +1,5 @@
package com.vci.ubcs.code.wrapper;
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.vci.ubcs.code.entity.CodeBasicSec;
import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;