yuxc
2023-05-06 a6e6575bc3d668e14009ed0e931a376f1a4d86ff
编码管理代码上传
已修改16个文件
已添加22个文件
4053 ■■■■■ 文件已修改
Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeWupinDTO.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeWupinEntity.java 376 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeWupinVO.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/annotation/VciBusinessLog.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/constant/RegExpConstant.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciBaseUtil.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciQueryWrapperForDO.java 136 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeWupinController.java 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/enumpack/CodeDefaultLC.java 141 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/CodeWupinClient.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/ICodeWupinClient.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClstemplateMapper.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeSerialValueMapper.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeWupinMapper.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeBasicSecService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClstemplateService.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeKeyattrrepeatService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeWupinService.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmProductCodeService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java 220 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeKeyattrrepeatServiceImpl.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeWupinServiceImpl.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java 779 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java 419 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java 707 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeWupinWrapper.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeClstemplateMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeWupinMapper.xml 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeWupinDTO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
/*
 *      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)
 */
package com.vci.ubcs.code.dto;
import com.vci.ubcs.code.entity.CodeWupinEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * ç¼–码信息 æ•°æ®ä¼ è¾“对象实体类
 *
 * @author yuxc
 * @since 2023-05-05
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class CodeWupinDTO extends CodeWupinEntity {
    private static final long serialVersionUID = 1L;
}
Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeWupinEntity.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,376 @@
/*
 *      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)
 */
package com.vci.ubcs.code.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.vci.ubcs.starter.revision.model.BaseModel;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
 * ç¼–码信息 å®žä½“ç±»
 *
 * @author yuxc
 * @since 2023-05-05
 */
@Data
@TableName("PL_CODE_WUPIN")
@ApiModel(value = "CodeWupin对象", description = "编码信息")
@EqualsAndHashCode(callSuper = true)
public class CodeWupinEntity  extends BaseModel {
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String checkinby;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private Date checkintime;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String checkoutby;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private Date checkouttime;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String codeclsfid;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String codeclsfpath;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String codetemplateoid;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String materialclassify;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String materialid;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String tuhao;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String pinpai;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String morengongys;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String xieyijiage;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String hesuanpici;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String beizhushuoming;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private Short materialtype;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String materialname;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String ruanjianbanben;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String qitachicun;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String morencaigouy;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String yumaileixing;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String chuangjiangongsi;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String caigouwl;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String wuliaoxingzhi;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String xieyibianhao;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String caizhi;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String chukufangshi;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String shifoupihaoguanli;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String kucunwl;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String xinghaoguige;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String duiwaiguige;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String zhibaoqi;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String caigoutiqianqi;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String hesuanfenlei;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String xiaoshouwl;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String changjiaxinghao;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String zuixiaoqiding;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String jiliangdw;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String zhiliangbz;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String firstfl;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String secondfl;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String thrifl;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String oldcode;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String baozhuangguige;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String passing;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String xbj;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String xbxkxs;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String xfjjstj;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String xgzccdgcd;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String xxndj;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String xzjmc;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String zjxh;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String clph;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String bmcl;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String cpxs;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String xbzjbmc;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String xwlwwmc;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String jjzyq;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String jsbmc;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String jsbxh;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String jsccj;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String jssxt;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String jszgl;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String jzl;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String jzrxx;
    /**
     *
     */
    @ApiModelProperty(value = "")
    private String jzxzb;
    @ApiModelProperty(value = "")
    @TableField(exist = false)
    private String codeSecLengthField;
}
Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/CodeWupinVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
/*
 *      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)
 */
package com.vci.ubcs.code.vo;
import com.vci.ubcs.code.entity.CodeWupinEntity;
import org.springblade.core.tool.node.INode;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * ç¼–码信息 è§†å›¾å®žä½“ç±»
 *
 * @author yuxc
 * @since 2023-05-05
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class CodeWupinVO extends CodeWupinEntity {
    private static final long serialVersionUID = 1L;
}
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/annotation/VciBusinessLog.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
package com.vci.ubcs.starter.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface VciBusinessLog {
    String modelName() default "";
    String operateName() default "";
    VciLogType logType() default VciBusinessLog.VciLogType.Operate;
    String description() default "";
    boolean notStore() default false;
    public static enum VciLogType {
        Login,
        Operate,
        Audit;
        private VciLogType() {
        }
    }
}
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/constant/RegExpConstant.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
package com.vci.ubcs.starter.web.constant;
public class RegExpConstant {
    public static final String INCLUDE_CHINESE = "[Α-ï¿¥]";
    public static final String NUMBER = "^[0-9]*$";
    public static final String INT = "/^-?[1-9]+[0-9]*$/";
    public static final String LONG = "/^-?[1-9]+[0-9]*$/";
    public static final String DOUBLE = "[0-9]*(\\.[0-9]*|[eE][+-][0-9]*)$";
    public static final String LETTER = "^[A-Za-z]+$";
    public static final String LETTER_AND_NUMBER = "^[A-Za-z0-9]+$";
    public static final String UP_LETTER = "^[A-Z]+$";
    public static final String LOW_LETTER = "^[a-z]+$";
    public static final String SPECIAL_CHARACTER = "^[` ~!@#$%^&*()_\\-+=<>?:\"{}|,.\\/;'\\[\\]·~!@#ï¿¥%……&*()——\\-+={}|《》?:“”【】、;‘’,。、]+$";
    public static final String HAS_LETTER = ".*[a-z][A-Z]{1,}.*";
    public static final String HAS_UP_LETTER = ".*[A-Z]{1,}.*";
    public static final String HAS_LOW_LETTER = ".*[a-z]{1,}.*";
    public static final String HAS_NUMBER = ".*[0-9]{1,}.*";
    public static final String HAS_SPECIAL_CHARACTER = ".*[` ~!@#$%^&*()_\\-+=<>?:\"{}|,.\\/;'\\[\\]·~!@#ï¿¥%……&*()——\\-+={}|《》?:“”【】、;‘’,。、]{1,}.*";
    public RegExpConstant() {
    }
}
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciBaseUtil.java
@@ -10,6 +10,7 @@
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.vci.ubcs.starter.exception.VciBaseException;
import com.vci.ubcs.starter.web.enumpck.BooleanEnum;
import com.vci.ubcs.starter.web.enumpck.UserSecretEnum;
import com.vci.ubcs.starter.web.pagemodel.SessionInfo;
import com.vci.ubcs.starter.web.toolmodel.DateConverter;
import com.vci.ubcs.starter.web.wrapper.VciQueryWrapperForDO;
@@ -93,6 +94,11 @@
        }
    }
    public static Integer getCurrentUserSecret() {
        SessionInfo currentUserSession = getCurrentUserSessionInfoNotException();
        return currentUserSession != null ? getInt(currentUserSession.getUserSecret()) : UserSecretEnum.NONE.getValue();
    }
    public static float getFloat(String s) {
        float f = 0.0F;
        if (s == null) {
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/VciQueryWrapperForDO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,136 @@
package com.vci.ubcs.starter.web.util;
import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class VciQueryWrapperForDO {
    public static boolean USER_TABLE_COMPATIBILITY = false;
    public static String DATABASE_PLATFORM;
    public static Map<String, String> USER_TABLE_COMPATIBILITY_BTM_MAP;
    public static Map<String, String> USER_TABLE_COMPATIBILITY_FIELD_MAP;
    public static final String USER_TABLE_COMPATIBILITY_FIELD_SEP = "${vcicomplibitysep}";
    private Map<String, String> conditionMap;
    private Map<String, String> customerSqlMap;
    private String oidFieldName;
    private static final String SPACE = " ";
    public static final String QUERY_FIELD_SECRET = "${vciQuerySecret}";
    public static final Boolean DEFAULT_QUERY_SECRET;
    public static final Boolean DEFAULT_QUERY_DATARIGHT;
    public static final String QUERY_FIELD_DATARIGHT = "${vciQueryDataRight}";
//    private VciQueryWrapperOption queryWrapperOption;
    private Class<?> doClass;
//    private PageHelper pageHelper;
    private Map<String, String> allFieldNameMap;
    private List<String> xmlTypeFieldList;
    private boolean distinct;
    public static final Map<String, String> REVISION_MANAGE_FIELD_MAP;
    public static final Map<String, String> BASIC_FIELD_MAP;
    public static final Map<String, String> BASE_MODEL_COMPATIBILITY_MAP;
    public static final String OID_FIELD = "oid";
    public static final String ID_FIELD = "id";
    public static final String LC_STATUS_FIELD = "lcstatus";
    public static final String LC_STATUS_FIELD_TEXT = "lcStatus_text";
    public static final Map<String, String> LIFECYCLE_MANAGE_FIELD_MAP;
    public static final Map<String, String> SECRET_MANAGE_FIELD_MAP;
    public static final Map<String, String> LINK_TYPE_FIELD_MAP;
    private Map<String, VciFieldTypeEnum> allFieldTypeMap;
//    private List<VciReferFieldInfo> referFieldInfoList;
    private Map<String, String> useReferMap;
    private Map<String, String> enumFieldMap;
    private String linkTableSql;
    private String selectFieldSql;
    private String selectPrefixForPage;
    private String whereSql;
    private String orderSql;
    private String whereSubfixForPage;
    private Map<String, String> valuesMap;
    private String tableNick;
    private Map<String, String> extendFieldMap;
    private static final String DATETIME_FORMAT = "yyyy-mm-dd hh24:mi:ss";
    private static final String DATE_FORMAT = "yyyy-mm-dd";
    static {
//        DATABASE_PLATFORM = DataBaseEnum.ORACLE.getValue();
        USER_TABLE_COMPATIBILITY_BTM_MAP = new HashMap();
        USER_TABLE_COMPATIBILITY_FIELD_MAP = new HashMap();
        DEFAULT_QUERY_SECRET = true;
        DEFAULT_QUERY_DATARIGHT = false;
        REVISION_MANAGE_FIELD_MAP = new HashMap() {
            {
                this.put("nameoid", "对象主键");
                this.put("revisionoid", "版本主键");
                this.put("lastr", "是否最新版本");
                this.put("firstr", "是否最老版本");
                this.put("lastv", "是否最新版次");
                this.put("firstv", "是否最老版次");
                this.put("revisionrule", "版本规则");
                this.put("revisionseq", "版本排序号");
                this.put("revisionvalue", "版本值");
                this.put("versionrule", "版次规则");
                this.put("versionseq", "版次排序号");
                this.put("versionvalue", "版次值");
                this.put("checkinby", "签入人");
                this.put("checkintime", "签入时间");
                this.put("checkoutby", "签出人");
                this.put("checkouttime", "签出时间");
                this.put("copyfromversion", "拷贝版本来源");
            }
        };
        BASIC_FIELD_MAP = new HashMap() {
            {
                this.put("oid", "主键");
                this.put("btmname", "业务类型的名称");
                this.put("id", "编号");
                this.put("name", "名称");
                this.put("description", "描述");
                this.put("creator", "创建人");
                this.put("createtime", "创建时间");
                this.put("lastmodifier", "最后时间人");
                this.put("lastmodifytime", "最后修改时间");
                this.put("ts", "时间戳");
                this.put("owner", "拥有者");
            }
        };
        BASE_MODEL_COMPATIBILITY_MAP = new HashMap() {
            {
                this.put("lastr", "islastr");
                this.put("firstr", "isfirstr");
                this.put("lastv", "islastv");
                this.put("firstv", "isfirstv");
            }
        };
        LIFECYCLE_MANAGE_FIELD_MAP = new HashMap() {
            {
                this.put("lcstatus", "生命周期值");
            }
        };
        SECRET_MANAGE_FIELD_MAP = new HashMap() {
            {
                this.put("secretgrade", "密级值");
            }
        };
        LINK_TYPE_FIELD_MAP = new HashMap() {
            {
                this.put("oid", "主键");
                this.put("creator", "创建人");
                this.put("createtime", "创建时间");
                this.put("lastmodifier", "最后时间人");
                this.put("lastmodifytime", "最后修改时间");
                this.put("f_oid", "from端主键");
                this.put("f_revisionoid", "from端版本主键");
                this.put("f_nameoid", "from端对象主键");
                this.put("f_btmname", "from端业务类型");
                this.put("t_oid", "to端主键");
                this.put("t_revisionoid", "to端版本主键");
                this.put("t_nameoid", "to端对象主键");
                this.put("t_btmname", "to端业务类型");
                this.put("ts", "时间戳");
            }
        };
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeClassifyController.java
@@ -119,6 +119,7 @@
    /**
     * ä¸»é¢˜åº“定义表 æ–°å¢ž
     * @param
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
@@ -310,6 +311,16 @@
    public DataGrid<CodeOsattributeVO> listClassifyLinkAttr(BaseQueryObject baseQueryObject){
        return codeClassifyService.listClassifyLinkAttr(baseQueryObject);
    }
    /**
     * ä¸»é”®èŽ·å–ä¸»é¢˜åº“åˆ†ç±»
     * @param oid ä¸»é”®
     * @return ä¸»é¢˜åº“分类显示对象
     */
    @GetMapping("/getObjectByOid")
    public R<CodeClassifyVO> getObjectByOid(String oid){
        CodeClassifyVO codeClassifyVO = codeClassifyService.getObjectByOid(oid);
        return R.data(codeClassifyVO);
    }
    /**
     * ä½¿ç”¨ç¼–号的路径获取对象
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeWupinController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,126 @@
/*
 *      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)
 */
package com.vci.ubcs.code.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.vci.ubcs.code.entity.CodeWupinEntity;
import com.vci.ubcs.code.vo.CodeWupinVO;
import com.vci.ubcs.code.wrapper.CodeWupinWrapper;
import com.vci.ubcs.code.service.ICodeWupinService;
import org.springblade.core.boot.ctrl.BladeController;
/**
 * ç¼–码信息 æŽ§åˆ¶å™¨
 *
 * @author yuxc
 * @since 2023-05-05
 */
@RestController
@AllArgsConstructor
@RequestMapping("ubcs-code/codeWupin")
@Api(value = "编码信息", tags = "编码信息接口")
public class CodeWupinController extends BladeController {
    private final ICodeWupinService codeWupinService;
    /**
     * ç¼–码信息 è¯¦æƒ…
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入codeWupin")
    public R<CodeWupinVO> detail(CodeWupinEntity codeWupin) {
        CodeWupinEntity detail = codeWupinService.getOne(Condition.getQueryWrapper(codeWupin));
        return R.data(CodeWupinWrapper.build().entityVO(detail));
    }
    /**
     * ç¼–码信息 åˆ†é¡µ
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入codeWupin")
    public R<IPage<CodeWupinVO>> list(CodeWupinEntity codeWupin, Query query) {
        IPage<CodeWupinEntity> pages = codeWupinService.page(Condition.getPage(query), Condition.getQueryWrapper(codeWupin));
        return R.data(CodeWupinWrapper.build().pageVO(pages));
    }
    /**
     * ç¼–码信息 è‡ªå®šä¹‰åˆ†é¡µ
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入codeWupin")
    public R<IPage<CodeWupinVO>> page(CodeWupinVO codeWupin, Query query) {
        IPage<CodeWupinVO> pages = codeWupinService.selectCodeWupinPage(Condition.getPage(query), codeWupin);
        return R.data(pages);
    }
    /**
     * ç¼–码信息 æ–°å¢ž
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入codeWupin")
    public R save(@Valid @RequestBody CodeWupinEntity codeWupin) {
        return R.status(codeWupinService.save(codeWupin));
    }
    /**
     * ç¼–码信息 ä¿®æ”¹
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入codeWupin")
    public R update(@Valid @RequestBody CodeWupinEntity codeWupin) {
        return R.status(codeWupinService.updateById(codeWupin));
    }
    /**
     * ç¼–码信息 æ–°å¢žæˆ–修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入codeWupin")
    public R submit(@Valid @RequestBody CodeWupinEntity codeWupin) {
        return R.status(codeWupinService.saveOrUpdate(codeWupin));
    }
    /**
     * ç¼–码信息 åˆ é™¤
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "逻辑删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(codeWupinService.removeBatchByIds(Func.toLongList(ids)));
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,147 @@
package com.vci.ubcs.code.controller;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.common.utils.StringUtils;
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.starter.annotation.VciBusinessLog;
import com.vci.ubcs.starter.util.LocalFileUtil;
import com.vci.ubcs.starter.web.util.ControllerUtil;
import com.vci.ubcs.starter.web.util.LangBaseUtil;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
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.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
@RestController
//@AllArgsConstructor
@RequestMapping("/mdmEngineController")
@Api(value = "编码数据管理", tags = "编码数据管理")
public class MdmEngineController {
//    /**
//     * æ—¥å¿—
//     */
    private Logger logger = LoggerFactory.getLogger(getClass());
    /**
     * ä¸»æ•°æ®å¼•擎服务
     */
    @Autowired
    private MdmEngineService engineService;
    /**
     * ä¸»æ•°æ®å¯¼å…¥å¯¼å‡ºæœåŠ¡
     */
    @Autowired
    private MdmIOService mdmIOService;
    /**
     * ä¸‹è½½æ‰¹é‡ç”³è¯·çš„导入模板
     * @param codeClassifyOid åˆ†ç±»çš„主键
     * @param response å“åº”对象
     * @throws IOException æŠ›å‡ºå¼‚常
     */
    @GetMapping("/downloadImportExcel")
    @VciBusinessLog(operateName = "下载批量申请编码的导入模板")
    public void downloadImportExcel(String codeClassifyOid, HttpServletResponse response) throws IOException{
        String excelName = mdmIOService.createImportExcel(codeClassifyOid,false);
        try {
            ControllerUtil.writeFileToResponse(response,excelName);
        } catch (Throwable e) {
            //如果出错,把错误信息写到text
            String msg = LangBaseUtil.getErrorMsg(e);
            if(StringUtils.isBlank(msg)){
                msg = "未知错误";
            }
            ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null);
        }
    }
    /**
     * æ‰¹é‡ç”³è¯·ç¼–码的信息
     * @param secDTOList ç”³è¯·ç¼–码的信息,必须包含码段和分类主键的信息
     * @param file æ–‡ä»¶çš„内容
     */
    @VciBusinessLog(operateName = "批量申请编码的信息")
    @PostMapping("/batchImportCode")
    public R batchImportCode(String secDTOList, String codeClassifyOid, MultipartFile file, HttpServletResponse response) throws Throwable {
        CodeOrderDTO orderDTO = new CodeOrderDTO();
        orderDTO.setCodeClassifyOid(codeClassifyOid);
        if(StringUtils.isNotBlank(secDTOList)){
            List<CodeOrderSecDTO> secDTOS = JSONObject.parseArray(secDTOList, CodeOrderSecDTO.class);
            orderDTO.setSecDTOList(secDTOS);
        }
        String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
        File file1 = new File(excelFileName);
        try {
            file.transferTo(new File(excelFileName));
            CodeImProtRusultVO codeImProtRusultVO = mdmIOService.batchImportCode(orderDTO,file1);
            if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())||StringUtils.isNotBlank(codeImProtRusultVO.getRedisUuid())){
                //放到map里
                R result = R.fail("导入失败");
                if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())) {
                    String filedUUid = ControllerUtil.putErrorFile(codeImProtRusultVO.getFilePath());
                    codeImProtRusultVO.setFileOid(filedUUid);
                }
                result.setData(codeImProtRusultVO);
                return result;
            }else {
                return R.success("操作成功!");
            }
        }catch (Throwable e) {
            logger.error("导入错误",e);
            String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "错误.txt";
            LocalFileUtil.writeContentToFile( LangBaseUtil.getErrorMsg(e),errorFile);
            String uuid=ControllerUtil.putErrorFile(errorFile);
            CodeImProtRusultVO codeImProtRusultVO =new CodeImProtRusultVO();
            codeImProtRusultVO.setRedisUuid("");
            codeImProtRusultVO.setFileOid(uuid);
            codeImProtRusultVO.setFilePath(errorFile);
            R result = R.fail("导入失败");
            result.setData(codeImProtRusultVO);
//            result.setObj(codeImProtRusultVO);
            return result;
        }finally {
            file1.delete();
        }
    }
    /**
     * ä¿®æ”¹çŠ¶æ€
     * @param baseModelDTO æ•°æ®ä¼ è¾“对象
     * @return æ‰§è¡Œç»“æžœ
     */
    @PostMapping("changeStatus")
    public R changeStatus(BaseModelDTO baseModelDTO) {
        engineService.changeStatus(baseModelDTO);
        return R.success("操作成功!");
    }
    /**
     * ç”³è¯·ç¼–码保存
     * @param orderDTO ç¼–码申请相关的信息,需要有属性和码段相关的信息
     * @return æ‰§è¡Œç»“æžœ
     */
    @PostMapping("/addSaveCode")
    @VciBusinessLog(operateName = "申请单个编码")
    public R addSaveCode(@RequestBody CodeOrderDTO orderDTO){
        return R.success(engineService.addSaveCode(orderDTO));
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/enumpack/CodeDefaultLC.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,141 @@
package com.vci.ubcs.code.enumpack;
import com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant;
import com.vci.ubcs.starter.web.enumpck.BaseEnum;
/**
 * ä¸»é¢˜åº“数据的默认生命周期
 * @author weidy
 * @date 2022-3-2
 */
public enum CodeDefaultLC implements BaseEnum {
    /**
     * ç¼–辑中
     */
    EDITING(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_EDITING,"编辑中"),
    /**
     * å®¡æ‰¹ä¸­
     */
    AUDITING(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_AUDITING,"审批中"),
    /**
     * å·²å‘布
     */
    RELEASED(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_RELEASED,"已发布"),
    /**
     * ç å€¼å›žæ”¶
     */
    TASK_BACK(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_TAKEBACK,"码值回收"),
    /**
     * åœç”¨
     */
    DISABLE(FrameWorkDefaultValueConstant.FRAMEWORK_DATA_DISABLED,"停用");
    /**
     * æžšä¸¾çš„值
     */
    private String value;
    /**
     * æžšä¸¾æ˜¾ç¤ºæ–‡æœ¬
     */
    private String text;
    /**
     * èŽ·å–æžšä¸¾å€¼
     *
     * @return æžšä¸¾å€¼
     */
    @Override
    public String getValue() {
        return value;
    }
    /**
     * è®¾ç½®æžšä¸¾å€¼
     *
     * @param value æžšä¸¾å€¼
     */
    public void setValue(String value) {
        this.value = value;
    }
    /**
     * èŽ·å–æžšä¸¾æ˜¾ç¤ºæ–‡æœ¬
     *
     * @return æ˜¾ç¤ºæ–‡æœ¬
     */
    @Override
    public String getText() {
        return text;
    }
    /**
     * è®¾ç½®æ˜¾ç¤ºæ–‡æœ¬
     *
     * @param text æ˜¾ç¤ºæ–‡æœ¬
     */
    public void setText(String text) {
        this.text = text;
    }
    /**
     * æž„造函数
     *
     * @param value å€¼
     * @param text  æ˜¾ç¤ºæ–‡æœ¬
     */
    private CodeDefaultLC(String value, String text) {
        this.value = value;
        this.text = text;
    }
    /**
     * æ ¹æ®åç§°èŽ·å–å¯¹åº”çš„æžšä¸¾å€¼
     *
     * @param text åç§°
     * @return æžšä¸¾å€¼
     */
    public static String getValueByText(String text) {
        for (CodeDefaultLC wenum : CodeDefaultLC.values()) {
            if (wenum.getText().equalsIgnoreCase(text)) {
                return wenum.getValue();
            }
        }
        return "";
    }
    /**
     * æ ¹æ®æžšä¸¾å€¼èŽ·å–åç§°
     *
     * @param value æžšä¸¾å€¼
     * @return åç§°
     */
    public static String getTextByValue(String value) {
        for (CodeDefaultLC wenum : CodeDefaultLC.values()) {
            if (wenum.getValue().equalsIgnoreCase(value)) {
                return wenum.getText();
            }
        }
        return "";
    }
    /**
     * æ ¹æ®æžšä¸¾å€¼èŽ·å–æžšä¸¾å¯¹è±¡
     *
     * @param value æžšä¸¾å€¼
     * @return æžšä¸¾å¯¹è±¡ï¼Œä¸å­˜åœ¨æ—¶å€™è¿”回null
     */
    public static CodeDefaultLC forValue(String value) {
        for (CodeDefaultLC wenum : CodeDefaultLC.values()) {
            if (wenum.getValue().equalsIgnoreCase(value)) {
                return wenum;
            }
        }
        return null;
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/CodeWupinClient.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,55 @@
/*
 *      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)
 */
package com.vci.ubcs.code.feign;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.vci.ubcs.code.mapper.CodeWupinMapper;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import com.vci.ubcs.code.entity.CodeWupinEntity;
import com.vci.ubcs.code.service.ICodeWupinService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
/**
 * ç¼–码信息 Feign实现类
 *
 * @author yuxc
 * @since 2023-05-05
 */
@ApiIgnore()
@RestController
@AllArgsConstructor
public class CodeWupinClient implements ICodeWupinClient {
    private final CodeWupinMapper codeWupinMapper;
    @Override
    @GetMapping(TOP)
    public BladePage<CodeWupinEntity> top(Integer current, Integer size) {
        Query query = new Query();
        query.setCurrent(current);
        query.setSize(size);
        IPage<CodeWupinEntity> page = codeWupinMapper.selectPage(Condition.getPage(query), Wrappers.emptyWrapper());//service.page(Condition.getPage(query));
        return BladePage.of(page);
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/feign/ICodeWupinClient.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,49 @@
/*
 *      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)
 */
package com.vci.ubcs.code.feign;
import org.springblade.core.mp.support.BladePage;
import com.vci.ubcs.code.entity.CodeWupinEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * ç¼–码信息 Feign接口类
 *
 * @author yuxc
 * @since 2023-05-05
 */
@FeignClient(
    value = "ubcs-code"
)
public interface ICodeWupinClient {
    String API_PREFIX = "/wuPinClient";
    String TOP = API_PREFIX + "/top";
    /**
     * èŽ·å–ç¼–ç ä¿¡æ¯åˆ—è¡¨
     *
     * @param current   é¡µå·
     * @param size      é¡µæ•°
     * @return BladePage
     */
    @GetMapping(TOP)
    BladePage<CodeWupinEntity> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size);
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java
@@ -49,7 +49,7 @@
     * @param oid
     * @return
     */
    @MapKey("oid")
    @MapKey("OID")
    Map<String,String> selectAllLevelChildOid(@Param("oid") String oid);
    /**
@@ -78,14 +78,14 @@
    List<CodeClassify> selectAllLevelChildHasPath(@Param("oid") String oid);
    @MapKey("oid")
    @MapKey("OID")
    List<Map<String,Object>> selectAllLevelParentByOid(@Param("oid") String oid);
    @MapKey("oid")
    @MapKey("OID")
    List<Map<String,Object>> selectAllLevelParents(@Param("oid") String oid);
    @MapKey("oid")
    @MapKey("OID")
    List<Map<String,Object>> selectByFieldPath(@Param("fieldPath") String fieldPath);
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClstemplateMapper.java
@@ -65,11 +65,14 @@
     * @param nameoid
     * @return
     */
    @MapKey("REVISIONSEQ")
//    @MapKey("REVISIONSEQ")
    Map<String,Object> getNextRevision(@Param("nameoid") String nameoid);
    List<CodeClstemplateEntity> selectCodeClassifyTemplateDOByTree(@Param("codeclassifyoid") String codeclassifyoid,
                                                                   @Param("lcstatus") String lcstatus);
                                                          @Param("lcstatus") String lcstatus);
    List<Map<String,String>> selectChildHasReleaseTemplate(@Param("lcstatus") String lcstatus,
                                                              @Param("classifyoid") String classifyoid,
                                                              @Param("templatelcstatus") String templatelcstatus);
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeSerialValueMapper.java
@@ -1,6 +1,8 @@
package com.vci.ubcs.code.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.vci.ubcs.code.entity.CodeSerialValue;
import com.vci.ubcs.code.entity.CodeSynonymEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -11,7 +13,7 @@
 * @author ludc
 * @date 2022-03-01
 */
public interface CodeSerialValueMapper {
public interface CodeSerialValueMapper  extends BaseMapper<CodeSerialValue> {
    List<CodeSerialValue> selectByCodeRoleId(@Param("codeRuleOid") String codeRuleOid);
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeWupinMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,43 @@
/*
 *      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)
 */
package com.vci.ubcs.code.mapper;
import com.vci.ubcs.code.entity.CodeWupinEntity;
import com.vci.ubcs.code.vo.CodeWupinVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 * ç¼–码信息 Mapper æŽ¥å£
 *
 * @author yuxc
 * @since 2023-05-05
 */
public interface CodeWupinMapper extends BaseMapper<CodeWupinEntity> {
    /**
     * è‡ªå®šä¹‰åˆ†é¡µ
     *
     * @param page
     * @param codeWupin
     * @return
     */
    List<CodeWupinVO> selectCodeWupinPage(IPage page, CodeWupinVO codeWupin);
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeBasicSecService.java
@@ -143,5 +143,28 @@
     */
    List<String> getOidByCodeclassifysecOid(String codeClassifySecOid);
    /**
     * ä½¿ç”¨è§„则的主键获取对应的码段内容
     * @param oid è§„则的内容
     * @return ç æ®µçš„内容
     */
    List<CodeBasicSecVO> listCodeBasicSecByRuleOid(String oid);
    /**
     * æ‰¹é‡æ•°æ®å¯¹è±¡è½¬æ¢ä¸ºæ˜¾ç¤ºå¯¹è±¡
     *
     * @param codeBasicSecDOs æ•°æ®å¯¹è±¡åˆ—表
     * @param hasFixedValue æ˜¯å¦æœ‰å›ºå®šå€¼
     * @return æ˜¾ç¤ºå¯¹è±¡
     * @throws VciBaseException å‚数为空或者不存在的时候会抛出异常
     */
    List<CodeBasicSecVO> codeBasicSecDO2VOs(Collection<CodeBasicSec> codeBasicSecDOs, boolean hasFixedValue) throws VciBaseException;
    /**
     * æ•°æ®å¯¹è±¡è½¬æ¢ä¸ºæ˜¾ç¤ºå¯¹è±¡
     * @param  codeBasicSecDO æ•°æ®å¯¹è±¡
     * @return æ˜¾ç¤ºå¯¹è±¡
     * @throws VciBaseException æ‹·è´å±žæ€§å‡ºé”™çš„æ—¶å€™ä¼šæŠ›å‡ºå¼‚常
     */
    CodeBasicSecVO codeBasicSecDO2VO(CodeBasicSec codeBasicSecDO) throws VciBaseException;
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java
@@ -3,9 +3,11 @@
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.entity.CodeClassify;
import com.vci.ubcs.code.vo.CodeOsattributeVO;
import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
import com.vci.ubcs.starter.exception.VciBaseException;
import com.vci.ubcs.starter.revision.model.TreeQueryObject;
import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject;
import com.vci.ubcs.starter.web.pagemodel.DataGrid;
@@ -212,4 +214,18 @@
     * @return æŸ¥è¯¢ç»“æžœ
     */
    List<CodeClassify> selectAllLevelParents(String oid);
    /**
     * ä¸»é”®èŽ·å–ä¸»é¢˜åº“åˆ†ç±»
     * @param oid ä¸»é”®
     * @return ä¸»é¢˜åº“分类显示对象
     */
    CodeClassifyVO getObjectByOid(String oid) throws VciBaseException;
    /**
     * ä½¿ç”¨åˆ†ç±»ä¸»é”®èŽ·å–åˆ†ç±»ç›¸å…³çš„æ‰€æœ‰ä¿¡æ¯
     * @param codeClassifyOid åˆ†ç±»çš„主键
     * @return åˆ†ç±»ä¸Šçº§ï¼Œä¸‹çº§çš„信息
     */
    CodeClassifyFullInfoBO getClassifyFullInfo(String codeClassifyOid);
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClstemplateService.java
@@ -183,4 +183,36 @@
     * @return æ‰§è¡Œç»“æžœ
     */
    R<CodeClstemplateVO> editSave(CodeClstemplateDTO codeClassifyTemplateDTO);
    /**
     * èŽ·å–æ‰€æœ‰å­åˆ†ç±»æ¨¡æ¿
     * @param codeClassifyOid çˆ¶åˆ†ç±»çš„主键
     * @return true表示相同
     */
    List<CodeClstemplateVO> childTemplates(String codeClassifyOid);
    /**
     * ä½¿ç”¨ä¸»é¢˜åº“的分类主键,获取生效的模板
     * @param codeClassifyOid ä¸»é¢˜åº“分类主键
     * @param hasAttribute æ˜¯å¦åŒ…含属性
     * @return æ¨¡æ¿çš„信息
     */
    List<CodeClstemplateVO> listReleaseTemplateByClassifyOid(String codeClassifyOid,boolean hasAttribute);
    /**
     * ç”¨æ¨¡æ¿çš„版本来排序
     * @param templateVOList æ¨¡æ¿çš„æ˜¾ç¤ºå¯¹è±¡
     * @return æŽ’序后的列表
     */
    List<CodeClstemplateVO> sortTemplateByRevision(List<CodeClstemplateVO> templateVOList);
    /**
     * ä¸»é”®èŽ·å–åˆ†ç±»æ¨¡æ¿å¯¹è±¡(包含属性)
     * @param templateOid ä¸»é”®
     * @return åˆ†ç±»æ¨¡æ¿å¯¹è±¡æ˜¾ç¤ºå¯¹è±¡
     */
    CodeClstemplateVO getObjectHasAttrByOid(String templateOid);
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeKeyattrrepeatService.java
@@ -16,6 +16,7 @@
 */
package com.vci.ubcs.code.service;
import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.entity.CodeKeyattrrepeatEntity;
import com.vci.ubcs.code.vo.CodeKeyattrrepeatVO;
import com.vci.ubcs.code.vo.pagemodel.CodeKeyAttrRepeatRuleVO;
@@ -62,4 +63,18 @@
     * @return æ˜¾ç¤ºå¯¹è±¡
     */
    CodeKeyAttrRepeatRuleVO codeKeyAttrRepeatRuleDO2VO(CodeKeyattrrepeatEntity codeKeyattrrepeatEntity);
    /**
     * ä½¿ç”¨åˆ†ç±»çš„全部信息来获取关键属性判断规则的内容
     * @param classifyFullInfo ä¸»é¢˜åº“分类的全部信息
     * @return è§„则的显示对象
     */
    CodeKeyattrrepeatVO getRuleByClassifyFullInfo(CodeClassifyFullInfoBO classifyFullInfo);
    /**
     * ä¸»é”®èŽ·å–å…³é”®æ•°æ®æŸ¥é‡è§„åˆ™
     * @param oid ä¸»é”®
     * @return å…³é”®æ•°æ®æŸ¥é‡è§„则显示对象
     */
    CodeKeyAttrRepeatRuleVO getObjectByOid(String oid);
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleService.java
@@ -135,4 +135,11 @@
     */
    R clearAllCode(String oid);
    /**
     * ä½¿ç”¨ä¸»é”®èŽ·å–ç¼–ç è§„åˆ™çš„å†…å®¹
     * @param codeRuleOid ä¸»é”®
     * @return è§„则的显示对象
     */
    CodeRuleVO getObjectHasSecByOid(String codeRuleOid);
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeWupinService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,43 @@
/*
 *      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)
 */
package com.vci.ubcs.code.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.vci.ubcs.code.entity.CodeWupinEntity;
import com.vci.ubcs.code.vo.CodeWupinVO;
import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 * ç¼–码信息 æœåŠ¡ç±»
 *
 * @author yuxc
 * @since 2023-05-05
 */
public interface ICodeWupinService extends IService<CodeWupinEntity> {
    /**
     * è‡ªå®šä¹‰åˆ†é¡µ
     *
     * @param page
     * @param codeWupin
     * @return
     */
    IPage<CodeWupinVO> selectCodeWupinPage(IPage<CodeWupinVO> page, CodeWupinVO codeWupin);
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
package com.vci.ubcs.code.service;
import com.baomidou.mybatisplus.extension.service.IService;
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.CodeRule;
import com.vci.ubcs.code.vo.CodeClstempattrVO;
import com.vci.ubcs.code.vo.CodeClstemplateVO;
import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
import com.vci.ubcs.starter.web.pagemodel.KeyValue;
import java.util.List;
/**
 * ä¸»æ•°æ®å¼•擎服务
 * @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(CodeClstempattrVO attrVO);
    /**
     * ä¿®æ”¹çŠ¶æ€
     * @param baseModelDTO æ•°æ®ä¼ è¾“对象
     */
    void changeStatus(BaseModelDTO baseModelDTO);
    /**
     * ç”³è¯·å•一编码
     * @param orderDTO ç”³è¯·çš„信息,需要包含属性的内容和码段相关的内容
     * @return è¿”回编码的内容
     */
    String addSaveCode(CodeOrderDTO orderDTO);
    /**
     * åˆ¤æ–­ç¼–码的码段是否输入或者选择了码值
     * @param ruleVO è§„则的显示对象
     * @param orderDTO ç¼–码申请的内容
     */
    void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO);
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
package com.vci.ubcs.code.service;
import com.vci.ubcs.code.dto.CodeOrderDTO;
import com.vci.ubcs.code.vo.pagemodel.CodeImProtRusultVO;
import java.io.File;
public interface MdmIOService {
    /**
     * ç”Ÿæˆå¯¼å…¥çš„æ–‡ä»¶
     * @param codeClassifyOid åˆ†ç±»çš„主键
     * @param isHistory æ˜¯å¦åŽ†å²æ•°æ®å¯¼å…¥
     * @return excel的文件地址
     */
    String createImportExcel(String codeClassifyOid,boolean isHistory);
    /**
     * æ‰¹é‡ç”³è¯·ç¼–码数据
     * @param orderDTO ç¼–码申请信息,必须包含分类主键和码段的信息
     * @param file excel文件的信息
     * @return æœ‰é”™è¯¯ä¿¡æ¯çš„excel
     */
    CodeImProtRusultVO batchImportCode(CodeOrderDTO orderDTO, File file);
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmProductCodeService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
package com.vci.ubcs.code.service;
import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.dto.CodeOrderSecDTO;
import com.vci.ubcs.code.entity.CodeWupinEntity;
import com.vci.ubcs.code.vo.CodeClstemplateVO;
import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
import java.util.List;
public interface MdmProductCodeService {
    /**
     * ç”Ÿæˆç¼–码--并且保存数据-方法加锁,因此不能返回batchCBO
     * @param classifyFullInfoBO åˆ†ç±»çš„全部信息
     * @param templateVO æ¨¡æ¿çš„æ˜¾ç¤ºå¯¹è±¡
     * @param ruleVO ç¼–码规则的显示对象
     * @param secDTOList å„个码段的值
     * @param dataCBOList ä¸šåŠ¡æ•°æ®
     */
    List<String> productCodeAndSaveData(CodeClassifyFullInfoBO classifyFullInfoBO, CodeClstemplateVO templateVO,
                                        CodeRuleVO ruleVO, List<CodeOrderSecDTO> secDTOList, List<CodeWupinEntity> dataCBOList);
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java
@@ -2,6 +2,7 @@
import com.alibaba.cloud.commons.lang.StringUtils;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -17,8 +18,10 @@
import com.vci.ubcs.code.mapper.CodeFixedValueMapper;
import com.vci.ubcs.code.service.ICodeBasicSecService;
import com.vci.ubcs.code.service.ICodeClassifyValueService;
import com.vci.ubcs.code.service.ICodeFixedValueService;
import com.vci.ubcs.code.service.ICodeRuleService;
import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
import com.vci.ubcs.code.vo.pagemodel.CodeFixedValueVO;
import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
import com.vci.ubcs.code.wrapper.CodeBasicSecWrapper;
import com.vci.ubcs.starter.exception.VciBaseException;
@@ -34,6 +37,7 @@
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -81,6 +85,12 @@
    @Resource
    private IDictBizClient iDictBizClient;
    /**
     * å›ºå®šç æ®µçš„码值的服务
     */
    @Resource
    private ICodeFixedValueService fixedValueService;
    /**
     * ä¸Šå±‚分类码段的属性名称
@@ -672,4 +682,77 @@
        return codeBasicSecDO;
    }
    /**
     * ä½¿ç”¨è§„则的主键获取对应的码段内容
     *
     * @param ruleOid è§„则的内容
     * @return ç æ®µçš„内容
     */
    @Override
    public List<CodeBasicSecVO> listCodeBasicSecByRuleOid(String ruleOid) {
        if(StringUtils.isBlank(ruleOid)){
            return new ArrayList<>();
        }
        Map<String,String> conditionMap = new HashMap<>();
        conditionMap.put("pkCodeRule",ruleOid);
//        PageHelper pageHelper = new PageHelper(-1);
//        pageHelper.addDefaultAsc("ordernum");
        QueryWrapper<CodeBasicSec> wrapper = new QueryWrapper<>();
        wrapper.orderByAsc("ordernum");
        List<CodeBasicSec> secDOList = codeBasicSecMapper.selectList(wrapper);//.selectByCondition(conditionMap, pageHelper);
        return codeBasicSecDO2VOs(secDOList,true);
    }
    /**
     * æ‰¹é‡æ•°æ®å¯¹è±¡è½¬æ¢ä¸ºæ˜¾ç¤ºå¯¹è±¡
     *
     * @param codeBasicSecDOs æ•°æ®å¯¹è±¡åˆ—表
     * @param hasFixedValue æ˜¯å¦æœ‰å›ºå®šå€¼
     * @return æ˜¾ç¤ºå¯¹è±¡
     * @throws VciBaseException å‚数为空或者不存在的时候会抛出异常
     */
    @Override
    public List<CodeBasicSecVO> codeBasicSecDO2VOs(Collection<CodeBasicSec> codeBasicSecDOs, boolean hasFixedValue) throws VciBaseException {
        List<CodeBasicSecVO> voList = new ArrayList<CodeBasicSecVO>();
        if (!CollectionUtils.isEmpty(codeBasicSecDOs)) {
            for (CodeBasicSec s : codeBasicSecDOs) {
                CodeBasicSecVO vo = codeBasicSecDO2VO(s);
                if (vo != null) {
                    voList.add(vo);
                }
            }
        }
        if(hasFixedValue && !CollectionUtils.isEmpty(voList)){
            List<CodeBasicSecVO> fixedSecVOList = voList.stream().filter(s -> CodeSecTypeEnum.CODE_FIXED_SEC.getValue().equalsIgnoreCase(s.getSecType())).collect(Collectors.toList());
            if(!CollectionUtils.isEmpty(fixedSecVOList)){
                //查询固定码的码值
                Map<String, List<CodeFixedValueVO>> secValueMap = fixedValueService.listCodeFixedValueBySecOids(fixedSecVOList.stream().map(CodeBasicSecVO::getOid).collect(Collectors.toList()));
                voList.stream().forEach(vo->{
                    vo.setFixedValueVOList(secValueMap.getOrDefault(vo.getOid(),null));
                });
            }
        }
        return voList;
    }
    /**
     * æ•°æ®å¯¹è±¡è½¬æ¢ä¸ºæ˜¾ç¤ºå¯¹è±¡
     *
     * @param codeBasicSecDO æ•°æ®å¯¹è±¡
     * @return æ˜¾ç¤ºå¯¹è±¡
     * @throws VciBaseException æ‹·è´å±žæ€§å‡ºé”™çš„æ—¶å€™ä¼šæŠ›å‡ºå¼‚常
     */
    @Override
    public CodeBasicSecVO codeBasicSecDO2VO(CodeBasicSec codeBasicSecDO) throws VciBaseException {
        CodeBasicSecVO vo = new CodeBasicSecVO();
        if (codeBasicSecDO != null) {
            BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecDO, vo);
            //如果有lcstatus的类的话
            if (true) {
                //vo.setLcStatusText({lcStatusFullClassName}.getTextByValue(vo.getLcStatus()));
            }
        }
        return vo;
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.entity.CodeClassify;
import com.vci.ubcs.code.entity.CodeClstemplateEntity;
import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity;
@@ -74,6 +75,8 @@
    private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
    @Resource
    CodeOsbtmtypeattributeMapper codeOsbtmtypeattributeMapper;
    @Resource
    ICodeRuleService ICodeRuleService;
    /**
     * æ—¥å¿—
@@ -251,7 +254,7 @@
        if(StringUtils.isBlank(oid)){
            throw new ServiceException("oid不能为空!");
        }
        return codeClassifyMapper.checkHasChild(oid.trim());
        return !codeClassifyMapper.checkHasChild(oid.trim());
    }
@@ -297,7 +300,8 @@
                    //2、查询要删除的子类数据
                    List<CodeClassify>  codeClassifyDOList = codeClassifyMapper.selectBatchIds(s);
                    deletes.addAll(codeClassifyDOList);
                    codeClassifyMapper.deleteBatchIds(s);
//                    codeClassifyMapper.deleteBatchIds(s);
                    baseMapper.deleteBatchIds(s);
                }
            }
@@ -951,6 +955,17 @@
    }
    /**
     * ä¸»é”®èŽ·å–ä¸»é¢˜åº“åˆ†ç±»
     * @param oid ä¸»é”®
     * @return ä¸»é¢˜åº“分类显示对象
     * @throws VciBaseException å‚数为空,数据不存在时会抛出异常
     */
    @Override
    public  CodeClassifyVO getObjectByOid(String oid) throws VciBaseException{
        return codeClassifyDO2VO(selectByOid(oid));
    }
    /**
     * ä½¿ç”¨ç¼–号的路径获取对象
     *
     * @param idPath ç¼–号的路径,一定要从最顶层节点开始,格式为xxx/yyy/zz è¿™æ ·
@@ -1021,4 +1036,32 @@
        }
        return oidList;
    }
    /**
     * ä½¿ç”¨åˆ†ç±»ä¸»é”®èŽ·å–åˆ†ç±»ç›¸å…³çš„æ‰€æœ‰ä¿¡æ¯
     *
     * @param codeClassifyOid åˆ†ç±»çš„主键
     * @return åˆ†ç±»ä¸Šçº§ï¼Œä¸‹çº§çš„信息
     */
    @Override
    public CodeClassifyFullInfoBO getClassifyFullInfo(String codeClassifyOid) {
        VciBaseUtil.alertNotNull(codeClassifyOid,"分类的主键");
        CodeClassifyFullInfoBO fullInfo = new CodeClassifyFullInfoBO();
        CodeClassify classifyDO = selectByOid(codeClassifyOid);
        //查询上级
        fullInfo.setCurrentClassifyVO(codeClassifyDO2VO(classifyDO));
        List<Map<String, Object>> maps = codeClassifyMapper.selectAllLevelParentByOid(codeClassifyOid);
        List<CodeClassify> codeClassifyList = new ArrayList<>();
        for (Map<String, Object> map : maps) {
            CodeClassify codeClassify = new CodeClassify();
            codeClassify.setOid(String.valueOf(map.get("OID")));
            codeClassify.setOid(String.valueOf(map.get("LEVEL")));
            codeClassifyList.add(codeClassify);
        }
        fullInfo.setParentClassifyVOs(codeClassifyDO2VOs(codeClassifyList));
        if(!CollectionUtils.isEmpty(fullInfo.getParentClassifyVOs())){
            fullInfo.setTopClassifyVO(fullInfo.getParentClassifyVOs().stream().filter(s->StringUtils.isBlank(s.getParentcodeclassifyoid())).findFirst().orElseGet(()->null));
        }
        return fullInfo;
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java
@@ -17,8 +17,10 @@
package com.vci.ubcs.code.service.impl;
import com.alibaba.nacos.api.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant;
import com.vci.ubcs.code.dto.CodeClstemplateDTO;
import com.vci.ubcs.code.entity.*;
import com.vci.ubcs.code.enumpack.CodeClassifyTemplateLC;
@@ -87,11 +89,13 @@
    @Autowired(required = false)
    private CodeClsflowtempMapper codeClsflowtempMapper;
    @Autowired(required = false)
    private CodeTemplatePhaseMapper codeTempphaseMapper;
    private CodeTempphaseMapper codeTempphaseMapper;
    @Autowired(required = false)
    private CodeClassifyTemplateButtonMapper codeTempbuttonMapper;
    private CodeTempbuttonMapper codeTempbuttonMapper;
    @Autowired(required = false)
    private CodePhaseAttrMapper codePhaseattrMapper;
    private CodePhaseattrMapper codePhaseattrMapper;
    @Autowired(required = false)
    private CodeClassifyMapper codeClassifyMapper;
    @Autowired(required = false)
    private ICodeClassifyService codeClassifyService;
    @Autowired(required = false)
@@ -484,34 +488,34 @@
//            ClientBusinessObject clientBusinessObject_template_insert = null;
//        try {
//            clientBusinessObject_template_insert = clientBusinessObjectOperation.reviseBusinessObject(clientBusinessObject_template, "");
        codeCls_template_insert.setOid(VciBaseUtil.getPk());
        codeCls_template_insert.setRevisionOid(VciBaseUtil.getPk());
        codeCls_template_insert.setNameOid(codeCls_template.getNameOid());
        codeCls_template_insert.setBtmname(codeCls_template.getBtmname());
        codeCls_template_insert.setLastR(String.valueOf(1));
        codeCls_template_insert.setFirstR(String.valueOf(0));
        codeCls_template_insert.setFirstV(String.valueOf(1));
        codeCls_template_insert.setLastV(String.valueOf(1));
        codeCls_template_insert.setCreator(AuthUtil.getUser().getUserName());
        codeCls_template_insert.setCreateTime(new Date());
        codeCls_template_insert.setLastModifier(AuthUtil.getUser().getUserName());
        codeCls_template_insert.setLastModifyTime(new Date());
        codeCls_template_insert.setRevisionRule(codeCls_template.getRevisionRule());
        codeCls_template_insert.setVersionRule(codeCls_template.getVersionRule());
        Map rvObj = baseMapper.getNextRevision(codeCls_template.getNameOid());
        codeCls_template_insert.setRevisionSeq(Integer.parseInt(rvObj.get("REVISIONSEQ").toString()));
        codeCls_template_insert.setRevisionValue(rvObj.get("REVISIONVAL").toString());
            codeCls_template_insert.setOid(VciBaseUtil.getPk());
            codeCls_template_insert.setRevisionOid(VciBaseUtil.getPk());
            codeCls_template_insert.setNameOid(codeCls_template.getNameOid());
            codeCls_template_insert.setBtmname(codeCls_template.getBtmname());
            codeCls_template_insert.setLastR(String.valueOf(1));
            codeCls_template_insert.setFirstR(String.valueOf(0));
            codeCls_template_insert.setFirstV(String.valueOf(1));
            codeCls_template_insert.setLastV(String.valueOf(1));
            codeCls_template_insert.setCreator(AuthUtil.getUser().getUserName());
            codeCls_template_insert.setCreateTime(new Date());
            codeCls_template_insert.setLastModifier(AuthUtil.getUser().getUserName());
            codeCls_template_insert.setLastModifyTime(new Date());
            codeCls_template_insert.setRevisionRule(codeCls_template.getRevisionRule());
            codeCls_template_insert.setVersionRule(codeCls_template.getVersionRule());
            Map rvObj = baseMapper.getNextRevision(codeCls_template.getNameOid());
            codeCls_template_insert.setRevisionSeq(Integer.parseInt(rvObj.get("REVISIONSEQ").toString()));
            codeCls_template_insert.setRevisionValue(rvObj.get("REVISIONVAL").toString());
//            VersionValueObject versionObj = this.getVersionValue(item.verRuleName);
        codeCls_template_insert.setVersionSeq(Integer.parseInt(rvObj.get("VERSIONSEQ").toString()));
        codeCls_template_insert.setVersionValue(rvObj.get("VERSIONVAL").toString());
        codeCls_template_insert.setLctid(codeCls_template.getLctid());
        codeCls_template_insert.setLcStatus("Editing");
        codeCls_template_insert.setId(codeCls_template.getId());
        codeCls_template_insert.setName(codeCls_template.getName());
        codeCls_template_insert.setDescription(codeCls_template.getDescription());
        codeCls_template_insert.setOwner(AuthUtil.getUser().getUserName());
            codeCls_template_insert.setVersionSeq(Integer.parseInt(rvObj.get("VERSIONSEQ").toString()));
            codeCls_template_insert.setVersionValue(rvObj.get("VERSIONVAL").toString());
            codeCls_template_insert.setLctid(codeCls_template.getLctid());
            codeCls_template_insert.setLcStatus("Editing");
            codeCls_template_insert.setId(codeCls_template.getId());
            codeCls_template_insert.setName(codeCls_template.getName());
            codeCls_template_insert.setDescription(codeCls_template.getDescription());
            codeCls_template_insert.setOwner(AuthUtil.getUser().getUserName());
//            codeCls_template_insert.setCheckinBy(userName);
        codeCls_template_insert.setCopyFromVersion(codeCls_template.getOid());
            codeCls_template_insert.setCopyFromVersion(codeCls_template.getOid());
//        }catch (VCIError e){
//            e.printStackTrace();
//            logger.error("===============>分类模板-升版复制出错oid: "+templateOldOid+",mes"+e.error_message);
@@ -548,11 +552,11 @@
        //复制模板阶段,阶段属性
        Map phase_attrMap = copyTemplatePhase_attr(templateOldOid,templateNewOid);
        List<CodeTemplatePhase> codeClassifyPhaseDOList = (ArrayList<CodeTemplatePhase>)phase_attrMap.get("phase");//模板阶段
        List<CodePhaseAttr> codePhaseAttrDOList = (ArrayList<CodePhaseAttr>)phase_attrMap.get("phaseAttr");//阶段属性
        List<CodeTempphaseEntity> codeClassifyPhaseDOList = (ArrayList<CodeTempphaseEntity>)phase_attrMap.get("phase");//模板阶段
        List<CodePhaseattrEntity> codePhaseAttrDOList = (ArrayList<CodePhaseattrEntity>)phase_attrMap.get("phaseAttr");//阶段属性
        //复制模板按钮
        List<CodeClassifyTemplateButton> codeClassifyTemplateButtonDOList = copyTemplateButton(templateOldOid,templateNewOid);
        List<CodeTempbuttonEntity> codeClassifyTemplateButtonDOList = copyTemplateButton(templateOldOid,templateNewOid);
        //一起保存数据
//        WebUtil.setPersistence(false);//不执行保存
@@ -651,11 +655,11 @@
        //复制模板阶段,阶段属性
        Map  phase_attrMap = copyTemplatePhase_attr(oldOid,newOid);
        List<CodeTemplatePhase> codeClassifyPhaseDOList = (ArrayList<CodeTemplatePhase>)phase_attrMap.get("phase");//模板阶段
        List<CodePhaseAttr> codePhaseAttrDOList = (ArrayList<CodePhaseAttr>)phase_attrMap.get("phaseAttr");//阶段属性
        List<CodeTempphaseEntity> codeClassifyPhaseDOList = (ArrayList<CodeTempphaseEntity>)phase_attrMap.get("phase");//模板阶段
        List<CodePhaseattrEntity> codePhaseAttrDOList = (ArrayList<CodePhaseattrEntity>)phase_attrMap.get("phaseAttr");//阶段属性
        //复制模板按钮
        List<CodeClassifyTemplateButton> codeClassifyTemplateButtonDOList = copyTemplateButton(oldOid,newOid);
        List<CodeTempbuttonEntity> codeClassifyTemplateButtonDOList = copyTemplateButton(oldOid,newOid);
//        baseMapper.insert(codeClassifyTemplateDOList);
        this.saveBatch(codeClassifyTemplateDOList);
@@ -754,21 +758,21 @@
//        phaseWrapper.addQueryMap("codeClassifyTemplateOid",templateOldOid);
        Map<String,Object> condition = new HashMap<>(1);
        condition.put("codeclassifyTemplateOid",templateOldOid);
        List<CodeTemplatePhase> codeTempphaseEntities = codeTempphaseMapper.selectByMap(condition);
        List<CodeTempphaseEntity> codeTempphaseEntities = codeTempphaseMapper.selectByMap(condition);
//        List<CodeTemplatePhaseDO>  codeClassifyPhaseDOList = codeTemplatePhaseDaoI.selectByWrapper(phaseWrapper);//要保存的新的模板流程
        Map<String,String> phaseKeyMap = new HashMap<String,String>();//需要复制的模板阶段属性,key:value,模板阶段老oid:模板属性新oid
        List<String> phaseOidList = new ArrayList<String>();
        for (CodeTemplatePhase codeTemplatePhaseDO:codeTempphaseEntities){
        for (CodeTempphaseEntity codeTemplatePhaseDO:codeTempphaseEntities){
            String oldoid = codeTemplatePhaseDO.getOid();
            String newOid = VciBaseUtil.getPk();
            codeTemplatePhaseDO.setOid(newOid);
            codeTemplatePhaseDO.setCodeClassifyTemplateOid(templateNewOid);
            codeTemplatePhaseDO.setCodeclassifytemplateoid(templateNewOid);
            phaseKeyMap.put(oldoid,newOid);
            phaseOidList.add(oldoid);
        }
        //模板阶段的属性
        List<CodePhaseAttr> codePhaseAttrDOList = new ArrayList<CodePhaseAttr>();
        List<CodePhaseattrEntity> codePhaseAttrDOList = new ArrayList<CodePhaseattrEntity>();
        if(!CollectionUtils.isEmpty(phaseOidList)){//size()==0下边方法会报错
//            Map<String,String> conditionMap =  new HashMap<>();
@@ -776,11 +780,11 @@
//            codePhaseAttrDOList = codePhaseAttrDaoI.selectByCondition(conditionMap,new PageHelper(-1));
            codePhaseAttrDOList = codePhaseattrMapper.selectByPhaseaIds(VciBaseUtil.toInSql(phaseOidList.toArray(new String[0])));
        }
        for (CodePhaseAttr codePhaseAttrDO:codePhaseAttrDOList){
            String oldPhaseoid = codePhaseAttrDO.getCodePhaseOid();
        for (CodePhaseattrEntity codePhaseAttrDO:codePhaseAttrDOList){
            String oldPhaseoid = codePhaseAttrDO.getCodephaseoid();
//            String newOid = VciBaseUtil.getPk();
            codePhaseAttrDO.setOid(null);
            codePhaseAttrDO.setCodePhaseOid(phaseKeyMap.get(oldPhaseoid));
            codePhaseAttrDO.setCodephaseoid(phaseKeyMap.get(oldPhaseoid));
//            codePhaseattrMapper.insert(codePhaseAttrDO);
        }
        Map phaseMap = new HashMap();
@@ -792,15 +796,15 @@
    /**
     * å¤åˆ¶æ¨¡æ¿æŒ‰é’®
     */
    public List<CodeClassifyTemplateButton> copyTemplateButton(String templateOldOid,String templateNewOid){
    public List<CodeTempbuttonEntity> copyTemplateButton(String templateOldOid,String templateNewOid){
        Map<String,Object> condition = new HashMap<>(1);
        condition.put("classifyTemplateOid",templateOldOid);
//        VciQueryWrapperForDO buttonWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateButtonDO.class);
//        buttonWrapper.addQueryMap("classifyTemplateOid",templateOldOid);
        List<CodeClassifyTemplateButton> codeTempbuttonEntities = codeTempbuttonMapper.selectByMap(condition);
        List<CodeTempbuttonEntity> codeTempbuttonEntities = codeTempbuttonMapper.selectByMap(condition);
//        List<CodeClassifyTemplateButtonDO> codeClassifyTemplateButtonDOList = codeClassifyTemplateButtonDaoI.selectByWrapper(buttonWrapper);
        for (CodeClassifyTemplateButton codeClassifyTemplateButtonDO:codeTempbuttonEntities){
        for (CodeTempbuttonEntity codeClassifyTemplateButtonDO:codeTempbuttonEntities){
//            String newOid = VciBaseUtil.getPk();
            codeClassifyTemplateButtonDO.setOid(null);
            codeClassifyTemplateButtonDO.setClassifytemplateoid(templateNewOid);
@@ -817,11 +821,13 @@
//        VciQueryWrapperForDO codeClassifyTemplateAttrQuery = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class);
//        codeClassifyTemplateAttrQuery.addQueryMap("classifyTemplateOid",templateOldOid);
        Map<String,Object> condition = new HashMap<>(1);
        condition.put("classifyTemplateOid",templateOldOid);
//        Map<String,Object> condition = new HashMap<>(1);
//        condition.put("classifyTemplateOid",templateOldOid);
        QueryWrapper<CodeClstempattrEntity> wrapper=new QueryWrapper<>();
        wrapper.eq("classifyTemplateOid",templateOldOid);
//        List<CodeClstempattrEntity> codeClassifyTemplateAttrDOList = codeClassifyTemplateAttrDaoI.selectByWrapper(codeClassifyTemplateAttrQuery);
        List<CodeClstempattrEntity> codeClstempattrEntities = codeClstempattrMapper.selectByMap(condition);
        List<CodeClstempattrEntity> codeClstempattrEntities = codeClstempattrMapper.selectList(wrapper);
        for (CodeClstempattrEntity codeClassifyTemplateAttrDO :codeClstempattrEntities){
//            String attrOid = VciBaseUtil.getPk();
@@ -1003,7 +1009,7 @@
//            condition.put("ts",codeClassifyTemplateDOCopyFromDTO.getTs());
            CodeClstemplateEntity detail = baseMapper
                .selectById(codeClassifyTemplateDOCopyFromDTO.getOid());
            //        boolean tsBoolean = boService.checkTs(codeClassifyTemplateAttrDOListemplateDOCopyFromDTO);
    //        boolean tsBoolean = boService.checkTs(codeClassifyTemplateAttrDOListemplateDOCopyFromDTO);
            if(detail.getTs().compareTo(codeClassifyTemplateDOCopyFromDTO.getTs()) != 0){//不是最新的不让改
                return R.fail("当前数据不是最新,请刷新后再修改!");
            }
@@ -1029,4 +1035,120 @@
        return R.data(codeClassifyTemplateDO2VO(codeClassifyTemplateDO));
    }
    /**
     *根据父分类id去查找叶子节点的模板,如果没查到则认为模板在上层建立,则根据分类去查当前模板
     * @param codeClassifyOid çˆ¶åˆ†ç±»çš„主键
     * @return
     */
    @Override
    public List<CodeClstemplateVO> childTemplates(String codeClassifyOid){
        List<CodeClstemplateVO> codeClassifyTemplateVOList=new ArrayList<>();
//        Map<String/**模板的主键**/,String/**分类的主键**/> childHasTemplateMap =baseMapper
//            .selectChildHasReleaseTemplate(FrameWorkDefaultValueConstant.FRAMEWORK_DATA_ENABLED,
//                codeClassifyOid,CodeClassifyTemplateLC.RELEASED.getValue());
        List<Map<String,String>> childHasTemplateList =baseMapper
            .selectChildHasReleaseTemplate(FrameWorkDefaultValueConstant.FRAMEWORK_DATA_ENABLED,
                codeClassifyOid,CodeClassifyTemplateLC.RELEASED.getValue());
        Map<String/**模板的主键**/,String/**分类的主键**/> childHasTemplateMap = new HashMap<>();
        if(!CollectionUtils.isEmpty(childHasTemplateList)){
            childHasTemplateList.stream().forEach(cbo->{
                childHasTemplateMap.put(cbo.get("OID"),cbo.get("CLSOID"));
            });
        }
        Set<String> templateOid = childHasTemplateMap.keySet();
        List<CodeClstemplateEntity>  classifyTemplateDOS=new ArrayList<>();
        if(!CollectionUtils.isEmpty(templateOid)) {
            classifyTemplateDOS= this.listCodeClassifyTemplateDOByOidCollections(templateOid);
        }else{
            classifyTemplateDOS=selectOnlyTemplateByClassifyOid(codeClassifyOid);
        }
        List<CodeClstemplateVO> templateVOList = codeClassifyTemplateDO2VOs(classifyTemplateDOS, true);
        if(!CollectionUtils.isEmpty(templateVOList)){
            codeClassifyTemplateVOList.addAll(templateVOList);
        }
        return codeClassifyTemplateVOList;
    }
    /**
     * ä½¿ç”¨åˆ†ç±»ä¸»é”®é€’归查询
     * @param codeClassifyOid åˆ†ç±»çš„主键
     * @return æ¨¡æ¿çš„æ•°æ®å¯¹è±¡
     */
    private List<CodeClstemplateEntity> selectOnlyTemplateByClassifyOid(String codeClassifyOid){
        //1.直接查询,看看这个分类下面有没有发布状态的模板
        //2.如果没有,则往上找分类的内容,这个分类层级不会太多,所以直接递归即可
        //3.如果分类下面添加了模板,但是没有发布,则说明模板可能还在编辑的状态,依然使用上级分类
//        Map<String,String> conditionMap = new HashMap<>();
//        conditionMap.put("codeClassifyOid",codeClassifyOid);
//        conditionMap.put("lcstatus",CodeClassifyTemplateLC.RELEASED.getValue());
        QueryWrapper<CodeClstemplateEntity> wrapper=new QueryWrapper<>();
        wrapper.eq("codeClassifyOid",codeClassifyOid)
            .eq("lcstatus",CodeClassifyTemplateLC.RELEASED.getValue());
        List<CodeClstemplateEntity> templateDOS = baseMapper.selectList(wrapper);
        if(CollectionUtils.isEmpty(templateDOS)){
            //递归找上级的模板
            CodeClassify classifyDO = codeClassifyMapper.selectById(codeClassifyOid);
//                codeClassifyDaoI.selectByPrimaryKey(codeClassifyOid);
            if(StringUtils.isBlank(classifyDO.getParentCodeClassifyOid())){
                //说明已经是顶了,也没找到的话,那就返回了
                return null;
            }
            return selectOnlyTemplateByClassifyOid(classifyDO.getParentCodeClassifyOid());
        }else{
            return templateDOS;
        }
    }
    /**
     * ä½¿ç”¨ä¸»é¢˜åº“的分类主键,获取生效的模板
     *
     * @param codeClassifyOid ä¸»é¢˜åº“分类主键
     * @param hasAttribute    æ˜¯å¦åŒ…含属性
     * @return æ¨¡æ¿çš„信息
     */
    @Override
    public List<CodeClstemplateVO> listReleaseTemplateByClassifyOid(String codeClassifyOid, boolean hasAttribute) {
        VciBaseUtil.alertNotNull(codeClassifyOid,"主题库分类主键");
        List<CodeClstemplateEntity> templateDOS = selectOnlyTemplateByClassifyOid(codeClassifyOid);
        if(CollectionUtils.isEmpty(templateDOS)){
            throw new VciBaseException("当前分类,以及其上级分类都没有设置模板");
        }
        List<CodeClstemplateVO> templateVOList = codeClassifyTemplateDO2VOs(templateDOS, true);
        return sortTemplateByRevision(templateVOList);
    }
    /**
     * ç”¨æ¨¡æ¿çš„版本来排序
     * @param templateVOList æ¨¡æ¿çš„æ˜¾ç¤ºå¯¹è±¡
     * @return æŽ’序后的列表
     */
    @Override
    public List<CodeClstemplateVO> sortTemplateByRevision(List<CodeClstemplateVO> templateVOList){
        if(!CollectionUtils.isEmpty(templateVOList) && templateVOList.size() >1){
            //获取版本号最大的那个
            templateVOList = templateVOList.stream().sorted((o1,o2)->
                Integer.valueOf(o1.getRevisionSeq()).compareTo(Integer.valueOf(o2.getRevisionValue()))
            ).collect(Collectors.toList());
        }
        return templateVOList;
    }
    /**
     * ä¸»é”®èŽ·å–åˆ†ç±»æ¨¡æ¿å¯¹è±¡(包含属性)
     *
     * @param oid ä¸»é”®
     * @return åˆ†ç±»æ¨¡æ¿å¯¹è±¡æ˜¾ç¤ºå¯¹è±¡
     * @throws VciBaseException å‚数为空,数据不存在时会抛出异常
     */
    @Override
    public CodeClstemplateVO getObjectHasAttrByOid(String oid) throws VciBaseException {
        List<CodeClstemplateEntity> doList = new ArrayList<>();
        doList.add(selectByOid(oid));
        List<CodeClstemplateVO> templateVOS = codeClassifyTemplateDO2VOs(doList, true);
        return CollectionUtils.isEmpty(templateVOS)?null:templateVOS.get(0);
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeKeyattrrepeatServiceImpl.java
@@ -16,14 +16,19 @@
 */
package com.vci.ubcs.code.service.impl;
import com.alibaba.nacos.common.utils.StringUtils;
import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.entity.CodeKeyattrrepeatEntity;
import com.vci.ubcs.code.enumpack.FrameworkDataLCStatus;
import com.vci.ubcs.code.vo.CodeKeyattrrepeatVO;
import com.vci.ubcs.code.mapper.CodeKeyattrrepeatMapper;
import com.vci.ubcs.code.service.ICodeKeyattrrepeatService;
import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
import com.vci.ubcs.code.vo.pagemodel.CodeKeyAttrRepeatRuleVO;
import com.vci.ubcs.starter.exception.VciBaseException;
import com.vci.ubcs.starter.web.util.BeanUtilForVCI;
import com.vci.ubcs.starter.web.util.VciBaseUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -32,6 +37,9 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import static com.vci.ubcs.code.constant.FrameWorkLangCodeConstant.DATA_OID_NOT_EXIST;
/**
 * å…³é”®å±žæ€§æŸ¥é‡è§„则 æœåŠ¡å®žçŽ°ç±»
@@ -117,4 +125,68 @@
        }
        return vo;
    }
    /**
     * ä½¿ç”¨åˆ†ç±»çš„全部信息来获取关键属性判断规则的内容
     *
     * @param classifyFullInfo ä¸»é¢˜åº“分类的全部信息
     * @return è§„则的显示对象
     */
    @Override
    public CodeKeyattrrepeatVO getRuleByClassifyFullInfo(CodeClassifyFullInfoBO classifyFullInfo) {
        VciBaseUtil.alertNotNull(classifyFullInfo,"主题库分类的信息");
        String keyAttrRuleOid = classifyFullInfo.getCurrentClassifyVO().getCodekeyattrrepeatoid();
        if(StringUtils.isBlank(keyAttrRuleOid)){
            //我们根据上级的分类,按照层级倒序排列
            if(!CollectionUtils.isEmpty(classifyFullInfo.getParentClassifyVOs())){
                //有上级分类的情况下才去查询
                List<CodeClassifyVO> sortedClassifyVO = classifyFullInfo.getParentClassifyVOs().stream().sorted(((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel()))).collect(Collectors.toList());
                for(int i = sortedClassifyVO.size() -1;i>=0;i--){
                    CodeClassifyVO record = sortedClassifyVO.get(i);
                    if(StringUtils.isNotBlank(record.getCodekeyattrrepeatoid())){
                        keyAttrRuleOid = record.getCodekeyattrrepeatoid();
                        break;
                    }
                }
            }
        }
        if(StringUtils.isNotBlank(keyAttrRuleOid)){
            CodeKeyAttrRepeatRuleVO objectByOid = getObjectByOid(keyAttrRuleOid);
            CodeKeyattrrepeatVO codeKeyattrrepeatVO = new CodeKeyattrrepeatVO();
            BeanUtils.copyProperties(objectByOid,codeKeyattrrepeatVO);
            return codeKeyattrrepeatVO;
        }
        //关键属性的规则可以为空,为空的时候就代表不控制,
        return null;
    }
    /**
     * ä¸»é”®èŽ·å–å…³é”®æ•°æ®æŸ¥é‡è§„åˆ™
     * @param oid ä¸»é”®
     * @return å…³é”®æ•°æ®æŸ¥é‡è§„则显示对象
     */
    @Override
    public  CodeKeyAttrRepeatRuleVO getObjectByOid(String oid){
        CodeKeyAttrRepeatRuleVO codeKeyAttrRepeatRuleVO = codeKeyAttrRepeatRuleDO2VO(selectByOid(oid));
        CodeKeyattrrepeatVO codeKeyattrrepeatVO = new CodeKeyattrrepeatVO();
        BeanUtils.copyProperties(codeKeyAttrRepeatRuleVO,codeKeyattrrepeatVO);
        return codeKeyAttrRepeatRuleVO;
    }
    /**
     * ä¸»é”®æŸ¥è¯¢æ•°æ®å¯¹è±¡
     * @param oid ä¸»é”®
     * @return  æ•°æ®å¯¹è±¡
     * @throws VciBaseException å‚数为空,并且数据不存在的时候会抛出异常
     */
    private CodeKeyattrrepeatEntity selectByOid(String oid) {
        VciBaseUtil.alertNotNull(oid,"主键");
        CodeKeyattrrepeatEntity codeKeyAttrRepeatRuleDO = codeKeyattrrepeatMapper.selectById(oid.trim());
//            .selectByPrimaryKey(oid.trim());
        if(codeKeyAttrRepeatRuleDO == null || StringUtils.isBlank(codeKeyAttrRepeatRuleDO.getOid())){
            throw new VciBaseException(DATA_OID_NOT_EXIST);
        }
        return codeKeyAttrRepeatRuleDO;
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java
@@ -430,4 +430,38 @@
    }
    /**
     * ä½¿ç”¨ä¸»é”®èŽ·å–ç¼–ç è§„åˆ™çš„å†…å®¹
     *
     * @param oid ä¸»é”®
     * @return è§„则的显示对象
     */
    @Override
    public CodeRuleVO getObjectHasSecByOid(String oid) {
        CodeRule ruleDO = selectByOid(oid);
        return codeRuleDO2VO(ruleDO, true);
    }
    /**
     * æ•°æ®å¯¹è±¡è½¬æ¢ä¸ºæ˜¾ç¤ºå¯¹è±¡
     *
     * @param codeRuleDO è§„则的数据对象
     * @param hasSec     æ˜¯å¦æŸ¥è¯¢ç æ®µ
     * @return æ˜¾ç¤ºå¯¹è±¡
     * @throws VciBaseException æ‹·è´å±žæ€§å‡ºé”™çš„æ—¶å€™ä¼šæŠ›å‡ºå¼‚常
     */
    public CodeRuleVO codeRuleDO2VO(CodeRule codeRuleDO, boolean hasSec) throws VciBaseException {
        CodeRuleVO vo = new CodeRuleVO();
        if (codeRuleDO != null) {
            BeanUtilForVCI.copyPropertiesIgnoreCase(codeRuleDO, vo);
            //如果有lcstatus的类的话
            vo.setLcStatusText(CodeRuleLC.getTextByValue(vo.getLcStatus()));
            if (hasSec) {
                //查询码段
                vo.setSecVOList(codeBasicSecService.listCodeBasicSecByRuleOid(vo.getOid()));
            }
        }
        return vo;
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeWupinServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,42 @@
/*
 *      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)
 */
package com.vci.ubcs.code.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vci.ubcs.code.entity.CodeWupinEntity;
import com.vci.ubcs.code.vo.CodeWupinVO;
import com.vci.ubcs.code.mapper.CodeWupinMapper;
import com.vci.ubcs.code.service.ICodeWupinService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 * ç¼–码信息 æœåŠ¡å®žçŽ°ç±»
 *
 * @author yuxc
 * @since 2023-05-05
 */
@Service
public class CodeWupinServiceImpl extends ServiceImpl<CodeWupinMapper, CodeWupinEntity> implements ICodeWupinService {
    @Override
    public IPage<CodeWupinVO> selectCodeWupinPage(IPage<CodeWupinVO> page, CodeWupinVO codeWupin) {
        return page.setRecords(baseMapper.selectCodeWupinPage(page, codeWupin));
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,779 @@
package com.vci.ubcs.code.service.impl;
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.CodeClstempattrVO;
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.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;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
/**
 * ä¸»æ•°æ®å¼•擎服务
 *
 * @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 ICodeRuleService ruleService;
    /**
     * åˆ†ç±»çš„æœåŠ¡
     */
    @Resource
    private ICodeClassifyService classifyService;
    /**
     * å…³é”®å±žæ€§çš„配置
     */
    @Autowired
    private ICodeKeyattrrepeatService keyRuleService;
    /**
     * æ—¥å¿—
     */
    private Logger logger = LoggerFactory.getLogger(getClass());
//    @Autowired
//    private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
    /**
     * ä½¿ç”¨åˆ†ç±»çš„主键获取可以使用的模板对象
     *
     * @param codeClassifyOid åˆ†ç±»çš„主键
     * @return æ¨¡æ¿çš„æ˜¾ç¤ºå¯¹è±¡
     */
    @Override
    public CodeClstemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid) {
        return getUsedTemplateByClassifyOid(codeClassifyOid, true);
    }
    /**
     * ä½¿ç”¨åˆ†ç±»çš„主键获取可以使用的模板对象
     *
     * @param codeClassifyOid åˆ†ç±»çš„主键
     * @param hasAttr         åŒ…含属性
     * @return æ¨¡æ¿çš„æ˜¾ç¤ºå¯¹è±¡
     */
    @Override
    public CodeClstemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid, boolean hasAttr) {
        List<CodeClstemplateVO> templateVOs = templateService.listReleaseTemplateByClassifyOid(codeClassifyOid, hasAttr);
        return templateVOs.get(templateVOs.size() - 1);
    }
    /**
     * èŽ·å–æžšä¸¾çš„ä¸‹æ‹‰é€‰é¡¹
     *
     * @param attrVO æ¨¡æ¿å±žæ€§çš„对象
     * @return ä¸‹æ‹‰é€‰é¡¹
     */
    @Override
    public List<KeyValue> listComboboxItems(CodeClstempattrVO attrVO) {
        List<KeyValue> comboboxKVs = null;
        if (StringUtils.isNotBlank(attrVO.getEnumstring())) {
            comboboxKVs = JSONObject.parseArray(attrVO.getEnumstring(), KeyValue.class);
        } else {
//            comboboxKVs = enumService.getEnum(attrVO.getEnumid());
//             Dict dict = new Dict();
//            dict.setParentId(Long.valueOf(attrVO.getEnumid()));
            R<List<DictBiz>> list = iDictBizClient.getList(attrVO.getEnumid());
            if(list.isSuccess()){
                for (DictBiz datum : list.getData()) {
                    KeyValue keyValue = new KeyValue();
                    keyValue.setKey(datum.getDictKey());
                    keyValue.setValue(datum.getDictValue());
                    comboboxKVs.add(keyValue);
                }
            }
        }
        return comboboxKVs;
    }
    /**
     * ä¿®æ”¹çŠ¶æ€
     *
     * @param baseModelDTO æ•°æ®ä¼ è¾“对象
     */
    @Override
    public void changeStatus(BaseModelDTO baseModelDTO) {
        VciBaseUtil.alertNotNull(baseModelDTO, "数据信息", baseModelDTO.getOid(), "主键", baseModelDTO.getBtmname(), "业务类型", baseModelDTO.getLcStatus(), "目标状态");
        List<String> oids = VciBaseUtil.str2List(baseModelDTO.getOid());
//        List<ClientBusinessObject> cboList = boService.selectCBOByOidCollection(oids, baseModelDTO.getBtmname());
        //插个点 ä¸šåŠ¡ç±»åž‹å®ŒæˆåŽéœ€è¦ä¿®æ”¹
        QueryWrapper<CodeOsbtmtypeEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("BTMNAME",baseModelDTO.getBtmname());
        wrapper.in("OID",oids);
        List<CodeOsbtmtypeEntity> cboList = codeOsbtmtypeMapper.selectList(wrapper);
        //还需要修改allCode的生命周期
//        Map<String, String> conditionMap = new HashMap<>();
        QueryWrapper<CodeAllCode> allCodeWrapper = new QueryWrapper<>();
        allCodeWrapper.eq("createcodebtm",baseModelDTO.getBtmname());
        allCodeWrapper.in("createcodeoid",oids);
//        conditionMap.put("createcodeoid", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")");
//        conditionMap.put("createcodebtm", baseModelDTO.getBtmname());
        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 {
//            lifeCycleService.transCboStatus(cboList, baseModelDTO.getLcStatus());
//        }
//        lifeCycleService.transCboStatus(codeCbos, baseModelDTO.getLcStatus());
    }
    /**
     * ç”³è¯·å•一编码
     *
     * @param orderDTO ç”³è¯·çš„信息,需要包含属性的内容和码段相关的内容
     * @return è¿”回编码的内容
     */
    @Override
    public String addSaveCode(CodeOrderDTO orderDTO) {
        VciBaseUtil.alertNotNull(orderDTO, "编码申请相关的属性和码段的内容都为空", orderDTO.getCodeClassifyOid(), "主题库分类的主键",
            orderDTO.getTemplateOid(), "模板的主键", orderDTO.getCodeRuleOid(), "编码规则的主键");
        CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
        CodeClstemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
        CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid());
        //1.判断规则中除了流水码段,是否有其他码段
        checkSecValueOnOrder(ruleVO, orderDTO);
        //2.判断必输项
        checkRequiredAttrOnOrder(templateVO, orderDTO);
        //3.先注入,再组合,最后校验
        switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
        //4.处理组合规则。组合规则不能使用编码的属性,因为编码的生成可能是需要属性的
        switchComponentAttrOnOrder(templateVO, orderDTO);
        //5.校验规则
        checkVerifyOnOrder(templateVO, orderDTO);
        //6.关键属性
        checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO);
        //7.枚举转换
        checkEnumOnOrder(templateVO, orderDTO);
        //8.处理时间格式,在数据库里面不论是字符串还是日期格式,都使用相同的格式存储
        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);
//        List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList);
////        batchSaveSelectChar(templateVO, cboList);
//        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) {
//                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)) {
                    //有值才能校验
                    List<KeyValue> comboboxKVs = listComboboxItems(attrVO);
                    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) {
//        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 = new CopyOnWriteArrayList<>();
//                    cboList.parallelStream().forEach(cbo -> {
//                        String value = cbo.getAttributeValue(attrVO.getId());
//                        if (StringUtils.isNotBlank(value)) {
//                            valuesList.add(value);
//                        }
//                    });
//                    if (!CollectionUtils.isEmpty(valuesList)) {
//                        charService.saveBySameNamespaceAndFlag(templateVO.getBtmTypeId(), attrVO.getLibraryIdentification(), valuesList, sessionInfo);
//                    }
//                });
//            }
//        }
//    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,419 @@
package com.vci.ubcs.code.service.impl;
import com.alibaba.nacos.common.utils.StringUtils;
import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.dto.CodeOrderDTO;
import com.vci.ubcs.code.service.ICodeClassifyService;
import com.vci.ubcs.code.service.MdmEngineService;
import com.vci.ubcs.code.service.MdmIOService;
import com.vci.ubcs.code.vo.CodeClstempattrVO;
import com.vci.ubcs.code.vo.CodeClstemplateVO;
import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
import com.vci.ubcs.code.vo.pagemodel.CodeImProtRusultVO;
import com.vci.ubcs.starter.bo.WriteExcelData;
import com.vci.ubcs.starter.exception.VciBaseException;
import com.vci.ubcs.starter.poi.bo.ReadExcelOption;
import com.vci.ubcs.starter.poi.bo.SheetDataSet;
import com.vci.ubcs.starter.poi.bo.SheetRowData;
import com.vci.ubcs.starter.poi.bo.WriteExcelOption;
import com.vci.ubcs.starter.poi.util.ExcelUtil;
import com.vci.ubcs.starter.util.LocalFileUtil;
import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum;
import com.vci.ubcs.starter.web.pagemodel.KeyValue;
import com.vci.ubcs.starter.web.util.VciBaseUtil;
import com.vci.ubcs.starter.web.util.VciDateUtil;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.RichTextString;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.io.File;
import java.util.*;
import java.util.stream.Collectors;
import static com.alibaba.druid.util.FnvHash.Constants.LIMIT;
import static com.vci.ubcs.code.constant.MdmEngineConstant.CODE_FIELD;
import static com.vci.ubcs.code.constant.MdmEngineConstant.DEFAULT_ATTR_LIST;
import static com.vci.ubcs.starter.poi.util.ExcelUtil.KEY_ATTR_CHAR;
import static com.vci.ubcs.starter.poi.util.ExcelUtil.REQUIRED_CHAR;
@Service
public class MdmIOServiceImpl implements MdmIOService {
    /**
     * ä¸»é¢˜åº“分类的服务
     */
    @Resource
    private ICodeClassifyService classifyService;
    /**
     * æ¨¡æ¿çš„æœåŠ¡
     */
    @Resource
    private CodeClstemplateServiceImpl templateService;
    /**
     * ä¸»æ•°æ®å¼•擎的服务
     */
    @Resource
    private MdmEngineService engineService;
    /**
     * ç”Ÿæˆå¯¼å…¥çš„æ–‡ä»¶
     *
     * @param codeClassifyOid åˆ†ç±»çš„主键
     * @param isHistory æ˜¯å¦åŽ†å²æ•°æ®å¯¼å…¥
     * @return excel的文件地址
     */
    @Override
    public String createImportExcel(String codeClassifyOid, boolean isHistory) {
        List<CodeClstemplateVO> templateVOList=new ArrayList<>();
        VciBaseUtil.alertNotNull("导出模板","导出的配置",codeClassifyOid,"主题库分类的主键");
        CodeClassifyVO codeClassifyVO = classifyService.getObjectByOid(codeClassifyOid);
        if(isHistory){
            templateVOList= templateService.childTemplates(codeClassifyOid);
        }else{
            //找模板
            CodeClstemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(codeClassifyOid);
            templateVOList.add(templateVO);
        }
        WriteExcelOption eo = new WriteExcelOption();
        eo.setAppend(true);
        //增加模板的信息导入
        LinkedList<WriteExcelData> tempEDList = new LinkedList<>();
        tempEDList.add(new WriteExcelData(0,0,"模板主键"));
        tempEDList.add(new WriteExcelData(0,1,"模板代号"));
        tempEDList.add(new WriteExcelData(0,2,"模板名称"));
        for(int j=0;j<templateVOList.size();j++){
            CodeClstemplateVO  templateVO=templateVOList.get(j);
            //组合格式的不导入,
            // æžšä¸¾çš„æä¾›åºåˆ—的选择
            //时间全部统一为yyyy-MM-dd HH:mm:ss
            //参照的自行输入名称
            //分类注入的不用,都是导入后自动处理的
            //编码,状态等字段不导入
            List<CodeClstempattrVO> templateAttrVOS = templateVO.getAttributes().stream().filter(s ->
                !DEFAULT_ATTR_LIST.contains(s.getId())
                    && StringUtils.isBlank(s.getComponentrule())
                    && StringUtils.isBlank(s.getClassifyinvokeattr())
                    && (isHistory || VciBaseUtil.getBoolean(s.getFormdisplayflag()))
            ).collect(Collectors.toList());
            if(CollectionUtils.isEmpty(templateAttrVOS)){
                throw new VciBaseException("模板没有配置任何【表单显示】为【是】的属性");
            }
            List<CodeClstempattrVO> idAttrVOList = templateVO.getAttributes().stream().filter(s -> s.getId().equalsIgnoreCase(CODE_FIELD)).collect(Collectors.toList());
            LinkedList<WriteExcelData> excelDataList = new LinkedList<>();
            Workbook workbook = new HSSFWorkbook();
            if(isHistory){
                excelDataList.add(new WriteExcelData(0,0,"分类路径"));
                excelDataList.add(new WriteExcelData(0,1,"码段宽度"));
                excelDataList.add(new WriteExcelData(0,2,!CollectionUtils.isEmpty(idAttrVOList)?idAttrVOList.get(0).getName():"企业编码"));
            }
            for (int i = 0; i < templateAttrVOS.size(); i++) {
                CodeClstempattrVO attrVO = templateAttrVOS.get(i);
                Object text = attrVO.getName();
                text = exportKeyAndRequired(workbook,attrVO,text);
                int colIndex = (isHistory?3:0) + i;
                WriteExcelData excelData = new WriteExcelData(0, colIndex, text);
                if(StringUtils.isNotBlank(attrVO.getCodedateformat())
                    || VciFieldTypeEnum.VTDateTime.name().equalsIgnoreCase(attrVO.getAttributedatatype())
                    || VciFieldTypeEnum.VTDate.name().equalsIgnoreCase(attrVO.getAttributedatatype())
                    ||VciFieldTypeEnum.VTTime.name().equalsIgnoreCase(attrVO.getAttributedatatype())){
                    excelData.setDateFormat(VciDateUtil.DateTimeFormat);
                }
                if(text instanceof RichTextString){
                    excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex()));
                }
                excelDataList.add(excelData);
                if(StringUtils.isNotBlank(attrVO.getEnumstring()) || StringUtils.isNotBlank(attrVO.getEnumid())){
                    //添加数据有效性
                    List<String> enumValueList = new ArrayList<>();
                    enumValueList.add("");
                    List<KeyValue> valueList = engineService.listComboboxItems(attrVO);
                    if(!CollectionUtils.isEmpty(valueList)){
                        valueList.stream().forEach(kv->{
                            enumValueList.add(kv.getValue());
                        });
                    }
                    //默认加1万条
                    WriteExcelData ed = new WriteExcelData(1,colIndex,"");
                    ed.setRowTo(100);
                    ed.setColTo(colIndex);
                    ed.setValidation(true);
                    ed.setValidationDataList(enumValueList);
                    ed.setValidationErrorMsg("请在序列中选择正确的值");
                    excelDataList.add(ed);
                }
                if(VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(attrVO.getAttributedatatype())){
                    List<String> booleanList = new ArrayList<>();
                    booleanList.add("是");
                    booleanList.add("否");
                    //默认加1万条
                    WriteExcelData ed = new WriteExcelData(1,colIndex,"");
                    ed.setRowTo(100);
                    ed.setColTo(colIndex);
                    ed.setValidation(true);
                    ed.setValidationDataList(booleanList);
                    ed.setValidationErrorMsg("请在序列中选择正确的值");
                    excelDataList.add(ed);
                }
            }
            eo.addSheetDataList(j+templateVO.getName(),excelDataList);
            tempEDList.add(new WriteExcelData(j+1,0,templateVO.getOid()));
            tempEDList.add(new WriteExcelData(j+1,1,templateVO.getId()));
            tempEDList.add(new WriteExcelData(j+1,2,templateVO.getName()));
        }
        String excelName = LocalFileUtil.getDefaultTempFolder() + File.separator + codeClassifyVO.getName() + (isHistory?"_历史数据导入模板.xls": "_导入模板.xls");
        eo.addSheetDataList(templateVOList.size()+"模板信息【请勿删除或移动】",tempEDList);
        ExcelUtil.writeDataToFile(excelName,eo);
        return excelName;
    }
    /**
     * å¯¼å‡ºçš„æ—¶å€™å°è£…必输和关键属性
     * @param attrVO å±žæ€§çš„æ˜¾ç¤ºå¯¹è±¡
     * @param text å•元格的值
     */
    private Object exportKeyAndRequired(Workbook workbook,CodeClstempattrVO attrVO,Object text){
        //必输加*,关键属性为蓝色
        if (VciBaseUtil.getBoolean(attrVO.getRequireflag()) || VciBaseUtil.getBoolean(attrVO.getKeyattrflag())) {
            String value = text.toString();
            if(VciBaseUtil.getBoolean(attrVO.getRequireflag())) {
                value += REQUIRED_CHAR;
            }
            if(VciBaseUtil.getBoolean(attrVO.getKeyattrflag())){
                value += KEY_ATTR_CHAR;
            }
            RichTextString ts = new HSSFRichTextString(value);
            if(VciBaseUtil.getBoolean(attrVO.getRequireflag())){
                Font font =  workbook.createFont();
                font.setColor(HSSFColor.HSSFColorPredefined.RED.getIndex());
                ts.applyFont(font);
            }
            if(VciBaseUtil.getBoolean(attrVO.getKeyattrflag())){
                Font font =  workbook.createFont();
                font.setColor(HSSFColor.HSSFColorPredefined.BLUE.getIndex());
                ts.applyFont(font);
            }
            return ts;
        }
        return text;
    }
    /**
     * æ‰¹é‡ç”³è¯·ç¼–码数据
     *
     * @param orderDTO ç¼–码申请信息,必须包含分类主键和码段的信息
     * @param file     excel文件的信息
     * @return  æœ‰é”™è¯¯ä¿¡æ¯çš„excel的文件
     */
    @Override
    public CodeImProtRusultVO batchImportCode(CodeOrderDTO orderDTO, File file) {
        VciBaseUtil.alertNotNull(orderDTO,"编码申请相关的数据",orderDTO.getCodeClassifyOid(),"主题库分类主键");
        ReadExcelOption reo = new ReadExcelOption();
        reo.setReadAllSheet(true);
        List<SheetDataSet> sheetDataSetList = ExcelUtil.readDataObjectFromExcel(file,null,reo);
        if(CollectionUtils.isEmpty(sheetDataSetList) || CollectionUtils.isEmpty(sheetDataSetList.get(0).getRowData())
            ||sheetDataSetList.get(0).getRowData().size()<1){
            throw new VciBaseException("没有读取到任何的数据");
        }
        if(sheetDataSetList.size()>LIMIT+1){
            throw new VciBaseException("为了保证系统的稳定性,请一次不要导入超过1万条的数据");
        }
        //先找到每一行的标题,然后根据标题来获取对应的属性
        SheetDataSet dataSet = sheetDataSetList.get(0);
        //找第一行,为了找标题
        CodeClstemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(orderDTO.getCodeClassifyOid());
        //校验模板是不是最新的
        checkTemplateSync(sheetDataSetList,templateVO,0);
        //先不用管属性是否都存在,先转换一下数据
        Map<String,String> errorMap = new HashMap<>();
        String redisUUid=batchImportCodes(orderDTO,templateVO,dataSet,errorMap,true);
        CodeImProtRusultVO codeImProtRusultVO = new CodeImProtRusultVO();
        List<String> needRowIndexList = new ArrayList<>();
//        String filePath = returnErrorToExcel(dataSet.getRowData(), errorMap, needRowIndexList, dataSet.getColName());
//        if(StringUtils.isNotBlank(filePath)) {
//            codeImProtRusultVO.setFilePath(filePath);
//        }
//        if(StringUtils.isNotBlank(redisUUid)){
//            codeImProtRusultVO.setRedisUuid(redisUUid);
//        }
        return null;
//        return codeImProtRusultVO;
    }
    /**
     * æ ¡éªŒæ¨¡æ¿æ˜¯å¦ä¸ºåŒæ­¥çš„
     * @param sheetDataSetList excel里的内容
     * @param templateVO æ¨¡æ¿çš„信息
     */
    private void checkTemplateSync(List<SheetDataSet> sheetDataSetList,CodeClstemplateVO templateVO,int i){
        String templateOidInExcel = "";
        String templateName="";
        if(!CollectionUtils.isEmpty(sheetDataSetList)
            && sheetDataSetList.size()>1 && !CollectionUtils.isEmpty(sheetDataSetList.get(sheetDataSetList.size()-1).getColName())){
            List<SheetRowData>  rowData=  sheetDataSetList.get(sheetDataSetList.size()-1).getRowData();
            templateName=rowData.get(i).getData().get(2);
            templateOidInExcel=rowData.get(i).getData().get(0);
            //templateOidInExcel = sheetDataSetList.get(sheetDataSetList.size()-1).getColName().get(sheetDataSetList.size()-i);
        }
       /* if(!CollectionUtils.isEmpty(sheetDataSetList)
                && sheetDataSetList.size()>1 && !CollectionUtils.isEmpty(sheetDataSetList.get(sheetDataSetList.size()-1).getColName())){
            List<SheetRowData>  rowData=  sheetDataSetList.get(sheetDataSetList.size()-1).getRowData();
            templateOidInExcel=rowData.get(i).getData().get(0);
           //templateOidInExcel = sheetDataSetList.get(sheetDataSetList.size()-1).getColName().get(sheetDataSetList.size()-i);
        }*/
        if(StringUtils.isBlank(templateOidInExcel) || !templateOidInExcel.equalsIgnoreCase(templateVO.getOid())){
            throw new VciBaseException("模板【"+templateName+"】中的数据获取的模版信息与当前模板不匹配,请确保excel文件里有【模板信息-请勿移动或删除】的工作表,且确保每次导入都是先下载的导入模板后添加的数据");
        }
    }
    /***
     * æ‰¹é‡å¤„理申请数据
     * @param orderDTO
     * @param templateVO
     * @param dataSet
     * @return
     */
    private String batchImportCodes(CodeOrderDTO orderDTO,CodeClstemplateVO templateVO,SheetDataSet dataSet,Map<String,String> errorMap,boolean isEnumType){
        List<String> codeList=new ArrayList<>();
//        CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
        //规则的主键需要去获取
//        CodeRuleVO ruleVO = engineService.getCodeRuleByClassifyFullInfo(classifyFullInfo);
//        //1.判断规则中除了流水码段,是否有其他码段
//        engineService.checkSecValueOnOrder(ruleVO,orderDTO);
//        List<SheetRowData> rowDataList = dataSet.getRowData();
//
//        //除去默认的属性.还有只有表单显示的字段才导入
//        List<CodeClassifyTemplateAttrVO> attrVOS = templateVO.getAttributes().stream().filter(s ->
//            !DEFAULT_ATTR_LIST.contains(s.getId()) && VciBaseUtil.getBoolean(s.getFormdisplayflag())
//        ).collect(Collectors.toList());
//        Map<Integer/**列号**/,String/**字段的名称**/> fieldIndexMap = new HashMap<>();
//        List<String> titleRowData = dataSet.getColName();
//        Map<String/**中文名称**/, String/**英文名称**/> attrNameIdMap = attrVOS.stream().collect(Collectors.toMap(s -> s.getName(), t -> t.getId().toLowerCase(Locale.ROOT),(o1, o2)->o2));
//        getFieldIndexMap(titleRowData,attrNameIdMap,fieldIndexMap);
//
//        //需要判断是否所有的属性都在模板上了
//        List<CodeClassifyTemplateAttrVO> unExistAttrVOs = attrVOS.stream().filter(s -> !fieldIndexMap.containsValue(s.getId().toLowerCase(Locale.ROOT))
//            && StringUtils.isBlank(s.getComponentrule()) && StringUtils.isBlank(s.getClassifyinvokeattr())//组合规则和分类注入确实没给用户导出去
//        ).collect(Collectors.toList());
//        if(!CollectionUtils.isEmpty(unExistAttrVOs)){
//            throw new VciBaseException("【" + unExistAttrVOs.stream().map(CodeClassifyTemplateAttrVO::getName) + "】这些属性在列表中没有找到");
//        }
//        List<ClientBusinessObject> cboList = new ArrayList<>();
//        String fullPath = getFullPath(classifyFullInfo);
//        excelToCbo(classifyFullInfo,fieldIndexMap,rowDataList,templateVO,cboList,fullPath,true);
//
//        //都转换完了。需要批量检查
//        //如果出错了,我们依然执行有效的数据,无效的数据写回到excel中
//        //2.判断必输项。。需要全部的属性,如果是必输,但是表单里面不显示的,只能是分类注入或者组合规则
//        batchCheckRequiredAttrOnOrder(templateVO,cboList,errorMap);
//        //3.判断关键属性
//        CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList);
//        Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList();
//        Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList();
//        if(!CollectionUtils.isEmpty(selfRepeatRowIndexList)){
//            selfRepeatRowIndexList.stream().forEach(rowIndex->{
//                errorMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";在当前处理的数据文件中关键属性重复" );
//            });
//        }
//        if(!CollectionUtils.isEmpty(keyAttrRepeatRowIndexList)){
//            keyAttrRepeatRowIndexList.stream().forEach(rowIndex->{
//                errorMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";关键属性与系统中的重复" );
//            });
//        }
//        //分类注入
//        batchSwitchClassifyAttrOnOrder(attrVOS,cboList,classifyFullInfo,false);
//        //boolean
//        reSwitchBooleanAttrOnOrder(attrVOS,cboList);
//        //4.校验规则
//        batchCheckVerifyOnOrder(attrVOS, cboList,errorMap);
//        if(isEnumType) {//是否需要校验枚举/参照
//            //5.校验枚举是否正确
//            batchSwitchEnumAttrOnOrder(attrVOS, cboList, errorMap);
//            //7.处理参照的情况
//            batchSwitchReferAttrOnOrder(attrVOS,cboList,errorMap);
//        }
//        //6.时间格式的验证
//        //6.时间的,必须统一为yyyy-MM-dd HH:mm:ss
//        batchSwitchDateAttrOnOrder(attrVOS,cboList,errorMap);
//        //最后弄组合规则
//        batchSwitchComponentAttrOnOrder(attrVOS,cboList);
//        String uuid=redisService.getUUIDEveryDay();
//        Map<String, ClientBusinessObject> rowIndexCboMap = cboList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getAttributeValue((IMPORT_ROW_INDEX)), t -> t));
//
//        if(errorMap.size()>0) {
//            createRedisDatas(uuid + "-error",templateVO, rowIndexCboMap, dataSet, fieldIndexMap, errorMap,false);
//        }
//        boolean isCreateUUid=false;
//        List<ClientBusinessObject> needSaveCboList = cboList.stream().filter(cbo -> {
//            String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX);
//            return !errorMap.containsKey(rowIndex);
//        }).collect(Collectors.toList());
//        //相似校验
//        Map<String,String>resembleMap=new HashMap<>();
//        List<DataResembleVO> dataResembleVOS=new ArrayList<>();
//        String btmtypeid= classifyFullInfo.getTopClassifyVO().getBtmtypeid();
//        bathcResembleQuery(orderDTO.getCodeClassifyOid(),templateVO,needSaveCboList,resembleMap,btmtypeid,dataResembleVOS);
//        if(resembleMap.size()>0) {
//            isCreateUUid=true;
//            if(!CollectionUtils.isEmpty(dataResembleVOS)) {
//                redisService.setCacheList(uuid + "-resemble-data", dataResembleVOS);
//                createRedisDatas(uuid + "-resemble",templateVO, rowIndexCboMap, dataSet, fieldIndexMap, resembleMap, false);
//            }
//        }
//        //排除错误的,剩下正确的
//        Map<String,String> newErrorMap=new HashMap<>();
//        newErrorMap.putAll(resembleMap);
//        newErrorMap.putAll(errorMap);
//        needSaveCboList = cboList.stream().filter(cbo -> {
//            String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX);
//            return !newErrorMap.containsKey(rowIndex);
//        }).collect(Collectors.toList());
//        if((errorMap.size()>0&&needSaveCboList.size()>0)||resembleMap.size()>0){
//            isCreateUUid=true;
//        }
//        createRedisByCodeClassify(uuid + "-class",templateVO,dataSet,fieldIndexMap,false);
//        if(newErrorMap.size()>0) {
//            createRedisDatas(uuid + "-ok",templateVO, rowIndexCboMap, dataSet, fieldIndexMap, newErrorMap,true);
//        }else {
//            uuid="";
//            //要把以上的错误的都抛出后,再继续处理时间和组合规则
//            needSaveCboList = cboList.stream().filter(cbo -> {
//                String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX);
//                return !newErrorMap.containsKey(rowIndex);
//            }).collect(Collectors.toList());
//            if (!CollectionUtils.isEmpty(needSaveCboList)) {
//                //9.我们处理业务数据
//                //生成编码的内容
//                codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(), needSaveCboList);
//                //如果是编码生成失败,则直接就失败了,其他的判断出来有错误的我们都统一返回到excel里面
//                engineService.batchSaveSelectChar(templateVO, needSaveCboList);
//            }
//        }
//        if(!isCreateUUid){
//            return uuid="";
//        }
//        return uuid;
        return null;
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,707 @@
package com.vci.ubcs.code.service.impl;
import com.alibaba.nacos.common.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
import com.vci.ubcs.code.dto.CodeOrderSecDTO;
import com.vci.ubcs.code.entity.CodeAllCode;
import com.vci.ubcs.code.entity.CodeSerialValue;
import com.vci.ubcs.code.entity.CodeWupinEntity;
import com.vci.ubcs.code.enumpack.CodeCutTypeEnum;
import com.vci.ubcs.code.enumpack.CodeGetValueTypeEnum;
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.CodeSerialValueMapper;
import com.vci.ubcs.code.service.ICodeWupinService;
import com.vci.ubcs.code.service.MdmProductCodeService;
import com.vci.ubcs.code.vo.CodeClstemplateVO;
import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
import com.vci.ubcs.starter.exception.VciBaseException;
import com.vci.ubcs.starter.web.constant.QueryOptionConstant;
import com.vci.ubcs.starter.web.constant.RegExpConstant;
import com.vci.ubcs.starter.web.enumpck.OsCodeFillTypeEnum;
import com.vci.ubcs.starter.web.pagemodel.PageHelper;
import com.vci.ubcs.starter.web.util.VciBaseUtil;
import com.vci.ubcs.starter.web.util.VciDateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import static com.vci.ubcs.code.constant.MdmEngineConstant.*;
public class MdmProductCodeServiceImpl  implements MdmProductCodeService {
    /**
     * æµæ°´å·çš„相关的信息
     */
    @Resource
    private CodeSerialValueMapper serialValueMapper;
    /**
     * æ‰€æœ‰çš„编码的内容
     */
    @Resource
    private CodeAllCodeServiceImpl codeAllCodeService;
    /**
     * æ‰€æœ‰çš„编码的内容
     */
    @Resource
    private ICodeWupinService iCodeWupinService;
    @Override
    public List<String> productCodeAndSaveData(CodeClassifyFullInfoBO classifyFullInfoBO, CodeClstemplateVO templateVO, CodeRuleVO ruleVO, List<CodeOrderSecDTO> secDTOList, List<CodeWupinEntity> dataCBOList) {
//        BatchCBO batchCBO = new BatchCBO();
//        WebUtil.setPersistence(false);
//        dataCBOList = dataCBOList.stream().sorted(((o1, o2) -> o1.getCreateTime().compareTo(o2.getCreateTime()))).collect(Collectors.toList());
//        batchCBO.getCreateCbos().addAll(dataCBOList);
        List<String> codeList = new ArrayList<>();
        /*****
         * ä¿è¯å¹¶å‘的时候,最大流水号都对的,但是这种加锁有弊端
         *
         */
        if(dataCBOList.stream().anyMatch(cbo-> StringUtils.isNotBlank(cbo.getId()))
//            && StringUtils.isNotBlank(cbo.getAttributeValue(CODE_SEC_LENGTH_FIELD))
            ){
            //是历史数据导入
            //历史数据执行的时候,这个系统会很卡
            //主要是为了录入最大流水号和allcode
//            SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
            List<CodeAllCode> allCodeDOList = new ArrayList<>();
            Map<String/**流水依据**/, Map<String/**码段的主键**/,Double/**最大流水号**/>> maxSerialMap = new HashMap<>();
            dataCBOList.parallelStream().forEach(cbo->{
//                VciBaseUtil.setCurrentUserSessionInfo(sessionInfo);
                String code = cbo.getId();
                List<String> serialUnitList = new ArrayList<>();
                String[] secLengths = cbo.getCodeSecLengthField().split("#");
                List<CodeBasicSecVO> secVOList = ruleVO.getSecVOList().stream().sorted(((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum()))).collect(Collectors.toList());
                Map<String/**码段的主键**/,String/**码段的值**/> serialValueMap = new HashMap<>();
                Map<String, CodeBasicSecVO> secVOMap = secVOList.stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
                for (int i = 0; i < secLengths.length; i++) {
                    CodeBasicSecVO secVO = secVOList.get(i);
                    String thisSecValue  = "";
                    if(i == 0){
                        thisSecValue = code.contains("#")?code.substring(0,code.indexOf("#")):code;
                    } else if(i == secLengths.length-1){
                        //最后
                        thisSecValue =  code.contains("#")?code.substring(code.lastIndexOf("#")):code;
                    }else {
                        int start = 0;
                        for (int j = 0; j < i; j++) {
                            start += VciBaseUtil.getInt(secLengths[j]) + 1;
                        }
                        thisSecValue = code.substring(start,start+VciBaseUtil.getInt(secLengths[1]));
                    }
                    if(VciBaseUtil.getBoolean(secVO.getSerialDependFlag())){
                        serialUnitList.add(thisSecValue);
                    }
                    if(CodeSecTypeEnum.CODE_SERIAL_SEC.getValue().equalsIgnoreCase(secVO.getSecType())){
                        serialValueMap.put(secVO.getOid(),thisSecValue);
                    }
                }
                String serialUnitString = serialUnitList.size() == 0 ? EMPTY_SERIAL_UNIT : serialUnitList.stream().collect(Collectors.joining(SERIAL_UNIT_SPACE));
                List<String> serialUnFileStringList = new ArrayList<>();
                if(!CollectionUtils.isEmpty(serialValueMap)){
                    serialValueMap.forEach((secOid,secValue)->{
                        //要看是不是补位的
                        CodeBasicSecVO secVO = secVOMap.get(secOid);
                        Double serialDb = null;
                        if(OsCodeFillTypeEnum.NONE.getValue().equalsIgnoreCase(secVO.getCodeFillType())){
                            //不补码
                            //把所有不是数字的去掉,因为可能会是老数据,新规则
                            serialDb = VciBaseUtil.getDouble(killUnNumberChar(secValue));
                        }else {
                            //左右填充的,我们需要
                            serialDb = VciBaseUtil.getDouble(killUnNumberChar(killFillChar(secValue,secVO.getCodeFillSeparator(),
                                OsCodeFillTypeEnum.LEFT.getValue().equalsIgnoreCase(secVO.getCodeFillType()))));
                        }
                        Map<String, Double> thisUnitMaxMap = maxSerialMap.getOrDefault(serialUnitString, new HashMap<>());
                        thisUnitMaxMap.put(secOid,serialDb);
                        maxSerialMap.put(serialUnitString,thisUnitMaxMap);
                        serialUnFileStringList.add(String.valueOf(serialDb));
                    });
                }
                CodeAllCode allCodeDO = new CodeAllCode();
                allCodeDO.setCodeClassifyOid(classifyFullInfoBO.getCurrentClassifyVO().getOid());
                allCodeDO.setCodeRuleOid(ruleVO.getOid());
                allCodeDO.setId(cbo.getId());
                allCodeDO.setCodeClassifyTemplateOid(templateVO.getOid());
                allCodeDO.setCreateCodeBtm(cbo.getBtmname());
                allCodeDO.setCreateCodeOid(cbo.getOid());
                allCodeDO.setSerialUnit(serialUnitString);
                allCodeDO.setUnFillSerial(serialUnFileStringList.stream().collect(Collectors.joining(SERIAL_VALUE_SPACE)));
                allCodeDO.setLcStatus(cbo.getLcStatus());
                allCodeDOList.add(allCodeDO);
            });
            //处理最大的流水号
            List<CodeSerialValue> addSerialValueList = new ArrayList<>();
            List<CodeSerialValue> editSerialValueList = new ArrayList<>();
            maxSerialMap.forEach((serialUnit,secOidMaxMap)->{
                secOidMaxMap.forEach((secOid,maxSerial)->{
//                    Map<String, String> conditionMap = new HashMap<>();
//                    conditionMap.put("codeRuleOid", ruleVO.getOid());
//                    conditionMap.put("serialUnit", serialUnit);
//                    //这个字段是为了解决多个流水的问题
//                    conditionMap.put("codeSecOid", secOid);
                    QueryWrapper<CodeSerialValue> queryWrapper = new QueryWrapper<>();
                    queryWrapper.eq("codeRuleOid", ruleVO.getOid());
                    queryWrapper.eq("serialUnit", serialUnit);
                    queryWrapper.eq("codeSecOid", secOid);
                    List<CodeSerialValue> serialValueDOS = serialValueMapper.selectList(queryWrapper);
//                    .selectByCondition(conditionMap, new PageHelper(-1));
                    if (!CollectionUtils.isEmpty(serialValueDOS)) {
                        CodeSerialValue serialValueDO = serialValueDOS.get(0);
                        if(VciBaseUtil.getDouble(serialValueDO.getMaxSerial())<maxSerial){
                            serialValueDO.setMaxSerial(String.valueOf(maxSerial));
                            editSerialValueList.add(serialValueDO);
                        }
                    }else{
                        //没有
                        CodeSerialValue serialValueDO = new CodeSerialValue();
                        serialValueDO.setCodeRuleOid(ruleVO.getOid());
                        serialValueDO.setSerialUnit(serialUnit);
                        serialValueDO.setCodeSecOid(secOid);
                        serialValueDO.setMaxSerial(maxSerial.toString());
                        addSerialValueList.add(serialValueDO);
                    }
                });
            });
            if(!CollectionUtils.isEmpty(addSerialValueList)){
//                batchCBO.copyFromOther(serialValueMapper.batchInsert(addSerialValueList));
                for (CodeSerialValue codeSerialValue : addSerialValueList) {
                    serialValueMapper.insert(codeSerialValue);
                }
//                serialValueMapper.ba
            }
            if(!CollectionUtils.isEmpty(editSerialValueList)){
                for (CodeSerialValue codeSerialValue : editSerialValueList) {
                    serialValueMapper.updateById(codeSerialValue);
                }
//                batchCBO.copyFromOther(serialValueMapper.batchUpdate(editSerialValueList));
            }
            //处理allCode
            if(!CollectionUtils.isEmpty(allCodeDOList)){
                Map<String, List<CodeAllCode>> ruleGroup = allCodeDOList.stream().collect(Collectors.groupingBy(s -> s.getCodeRuleOid()));
                Map<String, CodeAllCode> codeDOMap = allCodeDOList.stream().collect(Collectors.toMap(s -> s.getCodeRuleOid() + "${SEP}" + s.getId(), t -> t));
                List<CodeAllCode> addCodeDOs = new ArrayList<>();
                List<CodeAllCode> editCodeDOs = new ArrayList<>();
                ruleGroup.forEach((ruleOid,allCodeDOS)->{
                    VciBaseUtil.switchCollectionForOracleIn(allCodeDOS).stream().forEach(codeDOs->{
//                        Map<String,String> conditionMap = new HashMap<>();
//                        conditionMap.put("coderuleoid",ruleOid);
//                        conditionMap.put("id",QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(codeDOs.stream().map(s->s.getId()).collect(Collectors.toList()).toArray(new String[0])) + ")");
                        QueryWrapper<CodeAllCode> allCodeWrapper = new QueryWrapper<>();
                        allCodeWrapper.eq("coderuleoid",ruleOid);
                        allCodeWrapper.in("id", QueryOptionConstant.IN + "(" +
                            VciBaseUtil.toInSql(codeDOs.stream().map(s->s.getId()).collect(Collectors.toList()).toArray(new String[0])) + ")");
                        List<CodeAllCode> existCodes = codeAllCodeService.selectByWrapper(allCodeWrapper);
                        if(!CollectionUtils.isEmpty(existCodes)){
                            existCodes.stream().forEach(existCode->{
                                String rule_id = existCode.getCodeRuleOid() + "${SEP}" + existCode.getId();
                                if(codeDOMap.containsKey(rule_id)){
                                    CodeAllCode newCodeDO = codeDOMap.get(rule_id);
                                    existCode.setCreateCodeOid(newCodeDO.getOid());
                                    existCode.setCreateCodeBtm(newCodeDO.getCreateCodeBtm());
                                    existCode.setCodeClassifyTemplateOid(newCodeDO.getCodeClassifyTemplateOid());
                                    existCode.setCodeClassifyOid(newCodeDO.getCodeClassifyOid());
                                    existCode.setLcStatus(newCodeDO.getLcStatus());
                                    editCodeDOs.add(existCode);
                                }
                            });
                        }
                    });
                });
                if(!CollectionUtils.isEmpty(editCodeDOs)){
                    Set<String> exitIds = editCodeDOs.stream().map(s -> s.getCodeRuleOid() + "${SEP}" + s.getId()).collect(Collectors.toSet());
                    addCodeDOs = allCodeDOList.stream().filter(s -> !exitIds.contains(s.getCodeRuleOid() + "${SEP}" + s.getId())).collect(Collectors.toList());
                }else{
                    addCodeDOs = allCodeDOList;
                }
                if(!CollectionUtils.isEmpty(editCodeDOs)){
//                    batchCBO.copyFromOther(allCodeMapper.batchUpdate(editCodeDOs));
                    codeAllCodeService.updateBatchById(editCodeDOs);
                }
                if(!CollectionUtils.isEmpty(addCodeDOs)){
//                    batchCBO.copyFromOther(allCodeMapper.batchInsert(addCodeDOs));
                    Map<String, String> statusMap = addCodeDOs.stream().collect(Collectors.toMap(s -> s.getOid(), s -> s.getLcStatus()));
                    addCodeDOs.stream().filter(s -> StringUtils.equalsIgnoreCase("codeallcode",s.getBtmname())).forEach(s -> {
                        s.setLcStatus(statusMap.get(s.getOid()));
                    });
                    codeAllCodeService.saveBatch(addCodeDOs);
                }
            }
//            WebUtil.setPersistence(true);
//            boService.persistenceBatch(batchCBO);
            return codeList;
        }else {
            List<CodeBasicSecVO> secVOList = ruleVO.getSecVOList().stream().sorted(((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum()))).collect(Collectors.toList());
            List<String> serialUnitList = new LinkedList<>();
            List<String> secValueList = new ArrayList<>();
            Map<String, String> secValueMap = secDTOList.stream().collect(Collectors.toMap(s -> s.getSecOid(), s -> s.getSecValue()));
            List<CodeBasicSecVO> serialSecVOList = new ArrayList<>();
            List<CodeBasicSecVO> attrSecVOList = new ArrayList<>();
            for (int i = 0; i < secVOList.size(); i++) {
                CodeBasicSecVO secVO = secVOList.get(i);
                switchSecValue(secVO, secValueMap, classifyFullInfoBO, serialSecVOList, attrSecVOList, serialUnitList, secValueList);
            }
            //处理属性码段和流水码段
            Map<String/**流水码段的主键**/, Map<String/**流水依据**/, Double>> lastMaxSerialValueMap = new HashMap<>();
            List<CodeAllCode> allCodeDOList = new ArrayList<>();
            //已经存储的最大流水号的内容
            Map<String/**码段的主键**/, Map<String, CodeSerialValue>> maxSerialValueMap = new HashMap<>();
            for (int i = 0; i < dataCBOList.size(); i++) {
                CodeWupinEntity cbo = dataCBOList.get(i);
                List<String> thisSecValueList = new LinkedList<>();
                for (int j = 0; j < secValueList.size(); j++) {
                    thisSecValueList.add(secValueList.get(j));
                }
                List<String> thisSerialUnitList = new LinkedList<>();
                //因为流水依据每次可能不一样,所以每次都拷贝一份
                for (int j = 0; j < serialUnitList.size(); j++) {
                    thisSerialUnitList.add(serialUnitList.get(j));
                }
                //先看看有没有属性的码段
                boolean attrSevIsSerialDepend = CollectionUtils.isEmpty(attrSecVOList) ? false : (attrSecVOList.stream().anyMatch(s -> VciBaseUtil.getBoolean(s.getSerialDependFlag())));
                switchAttrSecValue(attrSecVOList, cbo, thisSecValueList, attrSevIsSerialDepend, thisSerialUnitList);
                String serialUnitString = thisSerialUnitList.size() == 0 ? EMPTY_SERIAL_UNIT : thisSerialUnitList.stream().collect(Collectors.joining(SERIAL_UNIT_SPACE));
                switchSerialSecValue(serialSecVOList, attrSevIsSerialDepend, ruleVO, serialUnitString, maxSerialValueMap, thisSecValueList, lastMaxSerialValueMap, i == 0);
                //组装编码的值
                cbo.setId(thisSecValueList.stream().collect(Collectors.joining()));
                codeList.add(cbo.getId());
                StringBuilder sb = new StringBuilder();
                //把码段里面都找一下流水号
                for (int j = 0; j < serialSecVOList.size(); j++) {
                    CodeBasicSecVO secVO = serialSecVOList.get(j);
                    Double serialValue = lastMaxSerialValueMap.getOrDefault(secVO.getOid(), new HashMap<>()).getOrDefault(serialUnitString, 0d);
                    if (serialValue != null) {
                        sb.append(String.valueOf(serialValue.longValue())).append(SERIAL_VALUE_SPACE);
                    }
                }
                //要存储最后的全部allcode
                wrapperAllCode(classifyFullInfoBO, ruleVO, cbo, templateVO, allCodeDOList, serialUnitString, sb.toString());
            }
            saveSerialValue( ruleVO, lastMaxSerialValueMap, maxSerialValueMap);
            Map<String, String> statusMap = allCodeDOList.stream().collect(Collectors.toMap(s -> s.getOid(), s -> s.getLcStatus()));
            allCodeDOList.stream().filter(s -> StringUtils.equalsIgnoreCase("codeallcode",s.getBtmname())).forEach(s -> {
                s.setLcStatus(statusMap.get(s.getOid()));
            });
            codeAllCodeService.saveBatch(allCodeDOList);
            iCodeWupinService.saveBatch(dataCBOList);
//            batchCBO.getCreateCbos().stream().filter(s -> StringUtils.equalsIgnoreCase("codeallcode",s.getBtmName())).forEach(s -> {
//                s.setLcStatus(statusMap.get(s.getOid()));
//                try {
//                    s.setAttributeValue("lcstatus",statusMap.get(s.getOid()));
//                } catch (VCIError e) {
//                    e.printStackTrace();
//                }
//            });
        }
//        WebUtil.setPersistence(true);
//        boService.persistenceBatch(batchCBO);
        return codeList;
    }
    /**
     * è½¬æ¢å±žæ€§ç æ®µçš„值
     * @param attrSecVOList å±žæ€§ç æ®µçš„æ˜¾ç¤ºå¯¹è±¡
     * @param cbo ä¸šåŠ¡æ•°æ®ï¼Œç”¨äºŽèŽ·å–ç æ®µçš„å€¼
     * @param thisSecValueList ç å€¼çš„列表
     * @param attrSevIsSerialDepend æ˜¯å¦æœ‰ä½œä¸ºæµæ°´ä¾æ®
     * @param serialUnitList æµæ°´ä¾æ®çš„内容
     *                       è¿˜éœ€è¦åŽç»­çš„一个移植将会涉及到其他的服务
     */
    private void switchAttrSecValue(List<CodeBasicSecVO> attrSecVOList,CodeWupinEntity cbo,
                                    List<String> thisSecValueList,boolean attrSevIsSerialDepend,
                                    List<String> serialUnitList){
        if (!CollectionUtils.isEmpty(attrSecVOList)) {
            attrSecVOList.stream().forEach(attrSevVO -> {
                String value = "";
                if (StringUtils.isNotBlank(attrSevVO.getGetValueClass())) {
                    //使用组合规则来处理的
//                    value = getValueByFormulaForCBO(cbo, attrSevVO.getGetValueClass());
                } else {
//                    value = cbo.getAttributeValue(attrSevVO.getReferAttributeId());
                }
                if (value == null) {
                    value = "";
                }
                //替换secValueList里面的内容
                for (int j = 0; j < thisSecValueList.size(); j++) {
                    String secValue = thisSecValueList.get(j);
                    if (secValue.equalsIgnoreCase("${attr_" + attrSevVO.getOid() + "}")) {
                        thisSecValueList.set(j, value);
                    }
                }
                if (attrSevIsSerialDepend) {
                    //是流水依赖的话,需要去替换一下
                    for (int j = 0; j < serialUnitList.size(); j++) {
                        String secValue = serialUnitList.get(j);
                        if (secValue.equalsIgnoreCase("${attr_" + attrSevVO.getOid() + "}")) {
                            serialUnitList.set(j, value);
                        }
                    }
                }
            });
        }
    }
    /**
     * è½¬æ¢æµæ°´ç æ®µçš„值
     * @param serialSecVOList æµæ°´ç æ®µ
     * @param attrSevIsSerialDepend æ˜¯å¦æœ‰å±žæ€§ç æ®µå‚与流水
     * @param ruleVO è§„则的内容
     * @param serialUnitString æµæ°´ä¾æ®
     * @param maxSerialValueMap æœ€å¤§çš„æµæ°´å·
     * @param thisSecValueList æœ¬æ¬¡çš„码值
     * @param lastMaxSerialValueMap å°è£…后
     * @param firstData æ˜¯å¦ä¸ºç¬¬ä¸€æ¡æ•°æ®
     */
    private void switchSerialSecValue(List<CodeBasicSecVO> serialSecVOList,boolean attrSevIsSerialDepend,
                                      CodeRuleVO ruleVO,String serialUnitString,
                                      Map<String/**码段的主键**/,Map<String/**流水依据**/,CodeSerialValue>> maxSerialValueMap,List<String> thisSecValueList,
                                      Map<String/**码段的主键**/,Map<String/**流水依据**/, Double>> lastMaxSerialValueMap,boolean firstData){
        if (!CollectionUtils.isEmpty(serialSecVOList)) {
            for (int j = 0; j < serialSecVOList.size(); j++) {
                CodeBasicSecVO secVO = serialSecVOList.get(j);
                if (attrSevIsSerialDepend || firstData) {
                    //如果属性码段也是依赖,则每次都要查询,如果属性码段不是依赖,则只查询一次
//                    Map<String, String> conditionMap = new HashMap<>();
//                    conditionMap.put("codeRuleOid", ruleVO.getOid());
//                    conditionMap.put("serialUnit", serialUnitString);
//                    //这个字段是为了解决多个流水的问题
//                    conditionMap.put("codeSecOid", secVO.getOid());
                    QueryWrapper<CodeSerialValue> codeSerialWrapper = new QueryWrapper<>();
                    codeSerialWrapper.eq("codeRuleOid", ruleVO.getOid());
                    codeSerialWrapper.eq("serialUnit", serialUnitString);
                    codeSerialWrapper.eq("codeSecOid", secVO.getOid());
                    List<CodeSerialValue> serialValueDOS = serialValueMapper.selectList(codeSerialWrapper);
                    if (!CollectionUtils.isEmpty(serialValueDOS)) {
                        Map<String, CodeSerialValue> unitSerialMap = maxSerialValueMap.getOrDefault(secVO.getOid(), new HashMap<>());
                        CodeSerialValue serialValueDO = serialValueDOS.get(0);
                        unitSerialMap.put(serialValueDO.getSerialUnit(),serialValueDO);
                        maxSerialValueMap.put(secVO.getOid(), unitSerialMap);
                    }
                }
                Double startValue = null;
                if(maxSerialValueMap.containsKey(secVO.getOid()) && maxSerialValueMap.get(secVO.getOid()).containsKey(serialUnitString)){
                    startValue = VciBaseUtil.getDouble(maxSerialValueMap.get(secVO.getOid()).get(serialUnitString).getMaxSerial());
                }
                if(lastMaxSerialValueMap.containsKey(secVO.getOid()) && lastMaxSerialValueMap.get(secVO.getOid()).containsKey(serialUnitString)){
                    //说明多个申请,之前已经加了流水号了
                    startValue = lastMaxSerialValueMap.get(secVO.getOid()).get(serialUnitString);
                }
                Double thisSerialValue = 0d;
                if (startValue == null) {
                    //第一个编码
                    thisSerialValue = VciBaseUtil.getDouble(secVO.getSerialStart());
                } else {
                    //流水号肯定是数字
                    thisSerialValue = startValue + (j + 1) * secVO.getSerialStep();
                }
                //要看是否超过最大的流水值
                if (thisSerialValue >= secVO.getCodeFillLimit()) {
                    throw new VciBaseException("流水号已经超过允许的最大流水值{0}",new String[]{secVO.getCodeFillLimit().toString()});
                }
                //要看补位的内容
                Integer fillLength = VciBaseUtil.getInt(secVO.getCodeFillLength());
                if (fillLength == 0 || fillLength > VciBaseUtil.getInt(secVO.getCodeSecLength())) {
                    //防止在添加的地方没有控制正确
                    fillLength = VciBaseUtil.getInt(secVO.getCodeSecLength());
                }
                String serialString = String.valueOf(thisSerialValue.longValue());
                serialString = fillString(fillLength, OsCodeFillTypeEnum.forValue(secVO.getCodeFillType()), serialString, secVO.getCodeFillSeparator());
                for (int z = 0; z < thisSecValueList.size(); z++) {
                    String secValue = thisSecValueList.get(z);
                    if (secValue.equalsIgnoreCase("${" + secVO.getOid() + "}")) {
                        thisSecValueList.set(z, serialString);
                    }
                }
                Map<String, Double> unitSerialMap = lastMaxSerialValueMap.getOrDefault(secVO.getOid(), new HashMap<>());
                unitSerialMap.put(serialUnitString, thisSerialValue);
                lastMaxSerialValueMap.put(secVO.getOid(),unitSerialMap);
            }
        }
    }
    /**
     * è½¬æ¢ç å€¼çš„内容
     * @param secVO ç æ®µçš„内容
     * @param secValueMap ç å€¼çš„内容,key是码段的主键,value是码值
     * @param classifyFullInfoBO åˆ†ç±»çš„全部信息
     * @param serialSecVOList æµæ°´ç æ®µ
     * @param attrSecVOList å±žæ€§ç æ®µ
     * @param serialUnitList æµæ°´ä¾æ®
     * @param secValueList ç å€¼åˆ—表
     */
    private void switchSecValue(CodeBasicSecVO secVO,Map<String,String> secValueMap,
                                CodeClassifyFullInfoBO classifyFullInfoBO,List<CodeBasicSecVO> serialSecVOList,
                                List<CodeBasicSecVO> attrSecVOList, List<String> serialUnitList,
                                List<String> secValueList ){
        CodeSecTypeEnum secType = CodeSecTypeEnum.forValue(secVO.getSecType());
        String secValue = secValueMap.getOrDefault(secVO.getOid(), "");
        switch (secType) {
            case CODE_FIXED_SEC:
                //固定码段的,直接用码值,不论码值的长度是多少,因为可变长度和固定长度是控制在码段管理里面的码值定义的
                break;
            case CODE_DATE_SEC:
                //时间码段,需要将当前时间依据时间格式进行转换.
                //时间码段不涉及到是否补位
                secValue = VciDateUtil.date2Str(new Date(), secVO.getCodeDateFormatStr());
                break;
            case CODE_CLASSIFY_SEC:
                //分类码段的,也是从前端选择了码值即可,不论码值的长度是多少
                break;
            case CODE_LEVEL_SEC:
                //层级码段,需要从分类上获取相应的信息
                if (CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(secVO.getCodeLevelType())) {
                    //最小层,因为我们只能在叶子节点上申请编码,所以这个就是当前分类的
                    if (CodeGetValueTypeEnum.CURRENT.getValue().equalsIgnoreCase(secVO.getCodeGetValueType()) || CollectionUtils.isEmpty(classifyFullInfoBO.getParentClassifyVOs())) {
                        //就是当前分类的
                        secValue = classifyFullInfoBO.getCurrentClassifyVO().getId();
                    } else {
                        //我们需要从顶层开始找到当前分类为止
                        secValue = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel()))).map(CodeClassifyVO::getId).collect(Collectors.joining()) + classifyFullInfoBO.getCurrentClassifyVO().getId();
                    }
                } else {
                    //指定层,我们需要通过上级的来获取
                    if (CollectionUtils.isEmpty(classifyFullInfoBO.getParentClassifyVOs())) {
                        //说明当前已经是最高的了
                        secValue = classifyFullInfoBO.getCurrentClassifyVO().getId();
                    } else {
                        //这个我们需要看看,层级是不是大于了最大层级的数
                        List<CodeClassifyVO> parentClassifyVOList = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel()))).collect(Collectors.toList());
                        if (secVO.getCodeLevelValue() > (parentClassifyVOList.size() + 1)) {
                            //指定的层级比当前的层级还大了,所以只能获取当前层级了
                            if (CodeGetValueTypeEnum.CURRENT.getValue().equalsIgnoreCase(secVO.getCodeGetValueType())) {
                                secValue = classifyFullInfoBO.getCurrentClassifyVO().getId();
                            } else {
                                secValue = parentClassifyVOList.stream().map(CodeClassifyVO::getId).collect(Collectors.joining()) + classifyFullInfoBO.getCurrentClassifyVO().getId();
                            }
                        } else {
                            //我们获取其中指定层的内容
                            if (CodeGetValueTypeEnum.CURRENT.getValue().equalsIgnoreCase(secVO.getCodeGetValueType())) {
                                CodeClassifyVO classifyVO = parentClassifyVOList.stream().filter(s -> s.getDataLevel().intValue() == secVO.getCodeLevelValue().intValue()).findFirst().orElseGet(() -> null);
                                if (classifyVO != null) {
                                    secValue = classifyVO.getId();
                                }
                            } else {
                                //小于等于的全部拿出来
                                secValue = parentClassifyVOList.stream().filter(s -> s.getDataLevel().intValue() <= secVO.getCodeLevelValue().intValue()).sorted(((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel()))).map(CodeClassifyVO::getId).collect(Collectors.joining());
                            }
                        }
                    }
                }
                //看看长度是否需要截断
                if (!CodeCutTypeEnum.NONE.getValue().equalsIgnoreCase(secVO.getValueCutType()) &&
                    secVO.getValueCutLength() != null && secVO.getValueCutLength() > 0 && secValue.length() > secVO.getValueCutLength()) {
                    if (CodeCutTypeEnum.RIGHT.getValue().equalsIgnoreCase(secVO.getValueCutType())) {
                        //左截取是从左边剪掉,右截取是从右边剪掉--保留左边
                        secValue = secValue.substring(0, secVO.getValueCutLength());
                    } else {
                        secValue = secValue.substring(secValue.length() - secVO.getValueCutLength());
                    }
                }
                break;
            case CODE_REFER_SEC:
                //引用的在页面上已经选择了,所以直接使用前端上传递的值
                //引用就是参照,可能是其他的分类(业务类型)下的数据,所以只在页面上选择
                break;
            case CODE_ATTR_SEC:
                //属性与引用的区别是,属性是当前数据里的属性,而引用可能是引用其他的分类的(业务类型)
                //因为可能是批量的数据的操作,所以我们这里不能直接处理属性,需要后边一边处理
                secValue = "${attr_" + secVO.getOid() + "}";
                attrSecVOList.add(secVO);
                break;
            case CODE_VARIABLE_SEC:
                //可变码段,是在页面上输入内容
                if (secValue.length() > VciBaseUtil.getInt(secVO.getCodeSecLength())) {
                    throw new VciBaseException("【{0}】这个码段是可变码段,但是现在输入的码值的长度({1})超过了规定的长度{2}", new String[]{secVO.getName(), String.valueOf(secValue.length()), secVO.getCodeSecLength()});
                }
                OsCodeFillTypeEnum fillTypeEnum = OsCodeFillTypeEnum.forValue(secVO.getCodeFillType());
                secValue = fillString(VciBaseUtil.getInt(secVO.getCodeSecLength()), fillTypeEnum, secValue, secVO.getCodeFillSeparator());
                break;
            case CODE_SERIAL_SEC:
                //流水码段
                serialSecVOList.add(secVO);
                secValue = "${" + secVO.getOid() + "}";
            default:
                break;
        }
        if (VciBaseUtil.getBoolean(secVO.getSerialDependFlag())) {
            serialUnitList.add(secValue);
        }
        secValueList.add(secValue);
    }
    /**
     * è¡¥ä½
     * @param totalLength æ€»é•¿åº¦
     * @param fillTypeEnum è¡¥ä½æ–¹å¼
     * @param text å½“前的内容
     * @param fillChar è¡¥ä½çš„字符
     * @return ä¸å¡«å……位置和长度已经达到/超过的时候不会填充
     */
    private String fillString(int totalLength,OsCodeFillTypeEnum fillTypeEnum,String text,String fillChar){
        if(text.length() >= totalLength || OsCodeFillTypeEnum.NONE.equals(fillTypeEnum)){
            //不用补位了
            return  text;
        }
        int balance = totalLength - text.length();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < balance; i++) {
            sb.append(fillChar);
        }
        if(OsCodeFillTypeEnum.LEFT.equals(fillTypeEnum)) {
            text = sb.toString() + text;
        }else {
            text = text + sb.toString();
        }
        return  text;
    }
    /**
     * å°è£…存储码值的对象
     * @param classifyFullInfoBO åˆ†ç±»å…¨éƒ¨çš„信息
     * @param ruleVO è§„则的内容
     * @param cbo ä¸šåŠ¡æ•°æ®
     * @param templateVO æ¨¡æ¿çš„信息
     * @param allCodeDOList æ‰€æœ‰çš„码值的对象列表
     */
    private void wrapperAllCode(CodeClassifyFullInfoBO classifyFullInfoBO,CodeRuleVO ruleVO,
                                CodeWupinEntity cbo,CodeClstemplateVO templateVO,
                                List<CodeAllCode> allCodeDOList,String serialUnitString,String serialValueString){
        CodeAllCode allCodeDO = new CodeAllCode();
        allCodeDO.setCodeClassifyOid(classifyFullInfoBO.getCurrentClassifyVO().getOid());
        allCodeDO.setCodeRuleOid(ruleVO.getOid());
        allCodeDO.setId(cbo.getId());
        allCodeDO.setCodeClassifyTemplateOid(templateVO.getOid());
        allCodeDO.setCreateCodeBtm(cbo.getBtmname());
        allCodeDO.setCreateCodeOid(cbo.getOid());
        allCodeDO.setSerialUnit(serialUnitString);
        allCodeDO.setUnFillSerial(serialValueString);
        allCodeDO.setLcStatus(cbo.getLcStatus());
        allCodeDOList.add(allCodeDO);
    }
    /**
     * ä¿å­˜æµæ°´çš„信息
     * @param ruleVO è§„则的显示对象
     * @param lastMaxSerialValueMap æœ€å¤§çš„æµæ°´å€¼æ˜ å°„
     * @param maxSerialValueMap ä¾æ®å­˜å‚¨çš„æœ€å¤§æµæ°´çš„内容
     */
    private void saveSerialValue(CodeRuleVO ruleVO,
                                 Map<String/**码段的主键**/,Map<String, Double>> lastMaxSerialValueMap,
                                 Map<String/**码段的主键**/,Map<String, CodeSerialValue>> maxSerialValueMap){
        List<CodeSerialValue> editSerialValueDOList = new ArrayList<>();
        List<CodeSerialValue> addSerialValueDOList = new ArrayList<>();
        //存储最大流水号
        lastMaxSerialValueMap.forEach((secOid,maxSerialMap)->{
            maxSerialMap.forEach((unit,maxSerial)->{
                CodeSerialValue serialValueDO = null;
                if(maxSerialValueMap.containsKey(secOid) && maxSerialValueMap.get(secOid).containsKey(unit)){
                    //说明有
                    serialValueDO = maxSerialValueMap.get(secOid).get(unit);
                    serialValueDO.setMaxSerial(maxSerial.toString());
                    editSerialValueDOList.add(serialValueDO);
                }else{
                    serialValueDO = new CodeSerialValue();
                    serialValueDO.setCodeRuleOid(ruleVO.getOid());
                    serialValueDO.setSerialUnit(unit);
                    serialValueDO.setCodeSecOid(secOid);
                    serialValueDO.setMaxSerial(maxSerial.toString());
                    addSerialValueDOList.add(serialValueDO);
                }
            });
        });
        if(!CollectionUtils.isEmpty(editSerialValueDOList)){
//            batchCBO.copyFromOther(serialValueMapper.batchUpdate(editSerialValueDOList));
            for (CodeSerialValue codeSerialValue : editSerialValueDOList) {
                serialValueMapper.updateById(codeSerialValue);
            }
        }
        if(!CollectionUtils.isEmpty(addSerialValueDOList)){
            for (CodeSerialValue codeSerialValue : addSerialValueDOList) {
                serialValueMapper.insert(codeSerialValue);
            }
//            batchCBO.copyFromOther(serialValueMapper.batchInsert(addSerialValueDOList));
        }
    }
    /**
     * åŽ»æŽ‰ä¸æ˜¯æ•°å­—çš„å­—ç¬¦
     * @param s å­—符
     * @return æ›¿æ¢åŽçš„值
     */
    private String killUnNumberChar(String s){
        Integer lastUnNumberIndex = 0;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if(!(new String(new char[]{c})).matches(RegExpConstant.NUMBER)){
                lastUnNumberIndex = i;
            }
        }
        String value = s;
        if(lastUnNumberIndex >0){
            value = value.substring(lastUnNumberIndex);
        }
        return value;
    }
    /**
     * åŽ»é™¤è¡¥ä½å­—ç¬¦
     * @param s å­—符
     * @param fillString è¡¥ä½å­—符
     * @param left æ˜¯å¦å·¦è¡¥ä½
     * @return æ›¿æ¢åŽçš„值
     */
    private String killFillChar(String s, String fillString,boolean left){
        Integer index = 0;
        String value = s;
        if(left){
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if((new String(new char[]{c})).equalsIgnoreCase(fillString)){
                    index = i;
                }
            }
            if(index >0){
                value = value.substring(index);
            }
        }else{
            //从右往左找
            for (int i = s.length()-1; i >=0; i++) {
                char c = s.charAt(i);
                if((new String(new char[]{c})).equalsIgnoreCase(fillString)){
                    index = i;
                }
            }
            if(index >0){
                value = value.substring(0,index);
            }
        }
        return value;
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/wrapper/CodeWupinWrapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,50 @@
/*
 *      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)
 */
package com.vci.ubcs.code.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import com.vci.ubcs.code.entity.CodeWupinEntity;
import com.vci.ubcs.code.vo.CodeWupinVO;
import java.util.Objects;
/**
 * ç¼–码信息 åŒ…装类,返回视图层所需的字段
 *
 * @author yuxc
 * @since 2023-05-05
 */
public class CodeWupinWrapper extends BaseEntityWrapper<CodeWupinEntity, CodeWupinVO>  {
    public static CodeWupinWrapper build() {
        return new CodeWupinWrapper();
     }
    @Override
    public CodeWupinVO entityVO(CodeWupinEntity codeWupin) {
        CodeWupinVO codeWupinVO = Objects.requireNonNull(BeanUtil.copy(codeWupin, CodeWupinVO.class));
        //User createUser = UserCache.getUser(codeWupin.getCreateUser());
        //User updateUser = UserCache.getUser(codeWupin.getUpdateUser());
        //codeWupinVO.setCreateUserName(createUser.getName());
        //codeWupinVO.setUpdateUserName(updateUser.getName());
        return codeWupinVO;
    }
}
Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeClstemplateMapper.xml
@@ -100,4 +100,17 @@
    <select id="selectChildHasReleaseTemplate" resultType="list">
        select t.oid as oid, cls.oid as clsoid
        from platformbtm_codeclstemplate t
                 left join (select oid
                            from platformbtm_codeclassify
                            where lcstatus = #{lcstatus}
                                start with oid = #{classifyoid}
                            connect by prior oid = parentcodeclassifyoid) cls
                           on t.codeclassifyoid = cls.oid
        where t.lcstatus = #{templatelcstatus}
          and cls.oid is not null
    </select>
</mapper>
Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeWupinMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.vci.ubcs.code.mapper.CodeWupinMapper">
    <!-- é€šç”¨æŸ¥è¯¢æ˜ å°„结果 -->
    <resultMap id="codeWupinResultMap" type="com.vci.ubcs.code.entity.CodeWupinEntity">
        <result column="OID" property="oid"/>
        <result column="REVISIONOID" property="revisionOid"/>
        <result column="NAMEOID" property="nameOid"/>
        <result column="BTMNAME" property="btmname"/>
        <result column="ISLASTR" property="lastR"/>
        <result column="ISFIRSTR" property="firstR"/>
        <result column="ISLASTV" property="lastV"/>
        <result column="ISFIRSTV" property="firstV"/>
        <result column="CREATOR" property="creator"/>
        <result column="CREATETIME" property="createTime"/>
        <result column="LASTMODIFIER" property="lastModifier"/>
        <result column="LASTMODIFYTIME" property="lastModifyTime"/>
        <result column="REVISIONRULE" property="revisionRule"/>
        <result column="VERSIONRULE" property="versionRule"/>
        <result column="REVISIONSEQ" property="revisionSeq"/>
        <result column="REVISIONVALUE" property="revisionValue"/>
        <result column="VERSIONSEQ" property="versionSeq"/>
        <result column="VERSIONVALUE" property="versionValue"/>
        <result column="LCTID" property="lctid"/>
        <result column="LCSTATUS" property="lcStatus"/>
        <result column="TS" property="ts"/>
        <result column="ID" property="id"/>
        <result column="NAME" property="name"/>
        <result column="DESCRIPTION" property="description"/>
        <result column="OWNER" property="owner"/>
        <result column="CHECKINBY" property="checkinby"/>
        <result column="CHECKINTIME" property="checkintime"/>
        <result column="CHECKOUTBY" property="checkoutby"/>
        <result column="CHECKOUTTIME" property="checkouttime"/>
        <result column="COPYFROMVERSION" property="copyFromVersion"/>
        <result column="CODECLSFID" property="codeclsfid"/>
        <result column="CODECLSFPATH" property="codeclsfpath"/>
        <result column="CODETEMPLATEOID" property="codetemplateoid"/>
        <result column="MATERIALCLASSIFY" property="materialclassify"/>
        <result column="MATERIALID" property="materialid"/>
        <result column="TUHAO" property="tuhao"/>
        <result column="PINPAI" property="pinpai"/>
        <result column="MORENGONGYS" property="morengongys"/>
        <result column="XIEYIJIAGE" property="xieyijiage"/>
        <result column="HESUANPICI" property="hesuanpici"/>
        <result column="BEIZHUSHUOMING" property="beizhushuoming"/>
        <result column="MATERIALTYPE" property="materialtype"/>
        <result column="MATERIALNAME" property="materialname"/>
        <result column="RUANJIANBANBEN" property="ruanjianbanben"/>
        <result column="QITACHICUN" property="qitachicun"/>
        <result column="MORENCAIGOUY" property="morencaigouy"/>
        <result column="YUMAILEIXING" property="yumaileixing"/>
        <result column="CHUANGJIANGONGSI" property="chuangjiangongsi"/>
        <result column="CAIGOUWL" property="caigouwl"/>
        <result column="WULIAOXINGZHI" property="wuliaoxingzhi"/>
        <result column="XIEYIBIANHAO" property="xieyibianhao"/>
        <result column="CAIZHI" property="caizhi"/>
        <result column="CHUKUFANGSHI" property="chukufangshi"/>
        <result column="SHIFOUPIHAOGUANLI" property="shifoupihaoguanli"/>
        <result column="KUCUNWL" property="kucunwl"/>
        <result column="XINGHAOGUIGE" property="xinghaoguige"/>
        <result column="DUIWAIGUIGE" property="duiwaiguige"/>
        <result column="ZHIBAOQI" property="zhibaoqi"/>
        <result column="CAIGOUTIQIANQI" property="caigoutiqianqi"/>
        <result column="HESUANFENLEI" property="hesuanfenlei"/>
        <result column="XIAOSHOUWL" property="xiaoshouwl"/>
        <result column="CHANGJIAXINGHAO" property="changjiaxinghao"/>
        <result column="ZUIXIAOQIDING" property="zuixiaoqiding"/>
        <result column="JILIANGDW" property="jiliangdw"/>
        <result column="ZHILIANGBZ" property="zhiliangbz"/>
        <result column="FIRSTFL" property="firstfl"/>
        <result column="SECONDFL" property="secondfl"/>
        <result column="THRIFL" property="thrifl"/>
        <result column="OLDCODE" property="oldcode"/>
        <result column="SECRETGRADE" property="secretGrade"/>
        <result column="BAOZHUANGGUIGE" property="baozhuangguige"/>
        <result column="PASSING" property="passing"/>
        <result column="XBJ" property="xbj"/>
        <result column="XBXKXS" property="xbxkxs"/>
        <result column="XFJJSTJ" property="xfjjstj"/>
        <result column="XGZCCDGCD" property="xgzccdgcd"/>
        <result column="XXNDJ" property="xxndj"/>
        <result column="XZJMC" property="xzjmc"/>
        <result column="ZJXH" property="zjxh"/>
        <result column="CLPH" property="clph"/>
        <result column="BMCL" property="bmcl"/>
        <result column="CPXS" property="cpxs"/>
        <result column="XBZJBMC" property="xbzjbmc"/>
        <result column="XWLWWMC" property="xwlwwmc"/>
        <result column="JJZYQ" property="jjzyq"/>
        <result column="JSBMC" property="jsbmc"/>
        <result column="JSBXH" property="jsbxh"/>
        <result column="JSCCJ" property="jsccj"/>
        <result column="JSSXT" property="jssxt"/>
        <result column="JSZGL" property="jszgl"/>
        <result column="JZL" property="jzl"/>
        <result column="JZRXX" property="jzrxx"/>
        <result column="JZXZB" property="jzxzb"/>
    </resultMap>
    <select id="selectCodeWupinPage" resultMap="codeWupinResultMap">
        select * from PL_CODE_WUPIN where is_deleted = 0
    </select>
</mapper>