ludc
2024-07-31 79120a1740872fbb20a79d0cde0a3fa9f55ec285
版本规则新增、修改接口上传。
已修改8个文件
329 ■■■■■ 文件已修改
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsRevisionRuleDTO.java 113 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsRevisionRuleVO.java 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsRevisionRuleServiceI.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java 108 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsRevisionRuleDTO.java
@@ -32,27 +32,27 @@
    /**
     * 跳跃字符
     */
    private String skipCode;
    private String jumpCharacter;
    /**
     * 初始值
     */
    private String startCode;
    private String initialValue;
    /**
     * 步长
     */
    private Integer serialStep;
    private String stepLength;
    /**
     * 前缀
     */
    private String prefixCode;
    private String prefixion;
    /**
     * 后缀
     */
    private String suffixCode;
    private String suffix;
    /**
     * 描述
@@ -63,6 +63,59 @@
     * 时间戳,格式是yyyy-MM-dd HH:mm:ss.SSS
     */
    private Date ts;
    /**
     * 创建人
     */
    private String creator;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 最后修改人
     */
    private String lastModifier;
    /**
     * 最后修改时间,格式是yyyy-MM-dd HH:mm:ss
     */
    private Date lastModifyTime;
    public void setCreator(String creator) {
        this.creator = creator;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public void setLastModifier(String lastModifier) {
        this.lastModifier = lastModifier;
    }
    public void setLastModifyTime(Date lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }
    public String getCreator() {
        return creator;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public String getLastModifier() {
        return lastModifier;
    }
    public Date getLastModifyTime() {
        return lastModifyTime;
    }
    public String getOid() {
        return oid;
@@ -88,44 +141,44 @@
        this.name = name;
    }
    public String getSkipCode() {
        return skipCode;
    public void setJumpCharacter(String jumpCharacter) {
        this.jumpCharacter = jumpCharacter;
    }
    public void setSkipCode(String skipCode) {
        this.skipCode = skipCode;
    public String getJumpCharacter() {
        return jumpCharacter;
    }
    public String getStartCode() {
        return startCode;
    public String getInitialValue() {
        return initialValue;
    }
    public void setStartCode(String startCode) {
        this.startCode = startCode;
    public void setInitialValue(String initialValue) {
        this.initialValue = initialValue;
    }
    public Integer getSerialStep() {
        return serialStep;
    public void setStepLength(String stepLength) {
        this.stepLength = stepLength;
    }
    public void setSerialStep(Integer serialStep) {
        this.serialStep = serialStep;
    public String getStepLength() {
        return stepLength;
    }
    public String getPrefixCode() {
        return prefixCode;
    public void setPrefixion(String prefixion) {
        this.prefixion = prefixion;
    }
    public void setPrefixCode(String prefixCode) {
        this.prefixCode = prefixCode;
    public String getPrefixion() {
        return prefixion;
    }
    public String getSuffixCode() {
        return suffixCode;
    public void setSuffix(String suffix) {
        this.suffix = suffix;
    }
    public void setSuffixCode(String suffixCode) {
        this.suffixCode = suffixCode;
    public String getSuffix() {
        return suffix;
    }
    public String getDescription() {
@@ -150,11 +203,11 @@
                "oid='" + oid + '\'' +
                ", id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", skipCode='" + skipCode + '\'' +
                ", startCode='" + startCode + '\'' +
                ", serialStep=" + serialStep +
                ", prefixCode='" + prefixCode + '\'' +
                ", suffixCode='" + suffixCode + '\'' +
                ", jumpCharacter='" + jumpCharacter + '\'' +
                ", initialValue='" + initialValue + '\'' +
                ", serialStep=" + stepLength +
                ", prefixion='" + prefixion + '\'' +
                ", suffix='" + suffix + '\'' +
                ", description='" + description + '\'' +
                ", ts=" + ts +
                '}';
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsRevisionRuleVO.java
@@ -32,27 +32,27 @@
    /**
     * 跳跃字符
     */
    private String skipCode;
    private String jumpCharacter;
    /**
     * 初始值
     */
    private String startCode;
    private String initialValue;
    /**
     * 步长
     */
    private Integer serialStep;
    private Integer stepLength;
    /**
     * 前缀
     */
    private String prefixCode;
    private String prefixion;
    /**
     * 后缀
     */
    private String suffixCode;
    private String suffix;
    /**
     * 描述
@@ -118,44 +118,44 @@
        this.name = name;
    }
    public String getSkipCode() {
        return skipCode;
    public void setJumpCharacter(String jumpCharacter) {
        this.jumpCharacter = jumpCharacter;
    }
    public void setSkipCode(String skipCode) {
        this.skipCode = skipCode;
    public String getJumpCharacter() {
        return jumpCharacter;
    }
    public String getStartCode() {
        return startCode;
    public void setInitialValue(String initialValue) {
        this.initialValue = initialValue;
    }
    public void setStartCode(String startCode) {
        this.startCode = startCode;
    public String getInitialValue() {
        return initialValue;
    }
    public Integer getSerialStep() {
        return serialStep;
    public Integer getStepLength() {
        return stepLength;
    }
    public void setSerialStep(Integer serialStep) {
        this.serialStep = serialStep;
    public void setStepLength(Integer stepLength) {
        this.stepLength = stepLength;
    }
    public String getPrefixCode() {
        return prefixCode;
    public void setPrefixion(String prefixion) {
        this.prefixion = prefixion;
    }
    public void setPrefixCode(String prefixCode) {
        this.prefixCode = prefixCode;
    public void setSuffix(String suffix) {
        this.suffix = suffix;
    }
    public String getSuffixCode() {
        return suffixCode;
    public String getSuffix() {
        return suffix;
    }
    public void setSuffixCode(String suffixCode) {
        this.suffixCode = suffixCode;
    public String getPrefixion() {
        return prefixion;
    }
    public String getDescription() {
@@ -228,11 +228,11 @@
                "oid='" + oid + '\'' +
                ", id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", skipCode='" + skipCode + '\'' +
                ", startCode='" + startCode + '\'' +
                ", serialStep=" + serialStep +
                ", prefixCode='" + prefixCode + '\'' +
                ", suffixCode='" + suffixCode + '\'' +
                ", jumpCharacter='" + jumpCharacter + '\'' +
                ", initialValue='" + initialValue + '\'' +
                ", stepLength=" + stepLength +
                ", prefixion='" + prefixion + '\'' +
                ", suffix='" + suffix + '\'' +
                ", description='" + description + '\'' +
                ", btmname='" + btmname + '\'' +
                ", owner='" + owner + '\'' +
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsRevisionRuleServiceI.java
@@ -40,7 +40,7 @@
     * @param osRevisionRuleDTO
     * @return
     */
    boolean updateVersionRule(OsRevisionRuleDTO osRevisionRuleDTO);
    boolean updateVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException;
    /**
     * 数据对象转换为显示对象
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
@@ -207,14 +207,10 @@
    public List<OsAttributeVO> getByAttributeNames(String[] attrNames) throws PLException {
        VciBaseUtil.alertNotNull(attrNames,"属性名");
        List<OsAttributeVO> osAttributeVOS = new ArrayList<>();
        for (int i = 0; i < attrNames.length; i++) {
            AttributeDef[] attributeDefs = platformClientUtil.getAttributeService().getAttributeDefs(attrNames[i].toLowerCase(Locale.ROOT),1,1);
            if(Func.isNotEmpty(attributeDefs)){
                Arrays.stream(attributeDefs).forEach(attributeDef -> {
                    osAttributeVOS.add(attributeDO2VO(attributeDef));
                });
            }
        }
        AttributeDef[] attributeDefs = platformClientUtil.getAttributeService().getAttributeDefsByNames(attrNames);
        Arrays.stream(attributeDefs).forEach(attr->{
            osAttributeVOS.add(attributeDO2VO(attr));
        });
        return osAttributeVOS;
    }
@@ -906,7 +902,11 @@
                excelDataList.add(new WriteExcelData(i+1,0, osAttributeVO.getId()));
                excelDataList.add(new WriteExcelData(i+1,1, osAttributeVO.getName()));
                excelDataList.add(new WriteExcelData(i+1,2, osAttributeVO.getDescription()));
                excelDataList.add(new WriteExcelData(i+1,3, osAttributeVO.getAttributeDataTypeText()+"("+osAttributeVO.getAttributeDataType()+")"));
                if(flag){
                    excelDataList.add(new WriteExcelData(i+1,3, osAttributeVO.getAttributeDataType()));
                }else{
                    excelDataList.add(new WriteExcelData(i+1,3, osAttributeVO.getAttributeDataType()+"("+osAttributeVO.getAttributeDataTypeText()+")"));
                }
                excelDataList.add(new WriteExcelData(i+1,4, osAttributeVO.isNullableFlag()));
                excelDataList.add(new WriteExcelData(i+1,5, osAttributeVO.getDefaultValue()));
                excelDataList.add(new WriteExcelData(i+1,6, osAttributeVO.getEnumId()));
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java
@@ -5,8 +5,10 @@
import com.vci.corba.omd.vrm.VersionRule;
import com.vci.dto.OsRevisionRuleDTO;
import com.vci.starter.web.annotation.log.VciUnLog;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.starter.web.util.VciDateUtil;
import com.vci.pagemodel.OsRevisionRuleVO;
import com.vci.starter.web.util.WebThreadLocalUtil;
import com.vci.web.service.OsRevisionRuleServiceI;
import com.vci.web.util.Func;
import com.vci.web.util.PlatformClientUtil;
@@ -17,7 +19,9 @@
import org.springframework.stereotype.Service;
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.stream.Collectors;
/**
@@ -73,20 +77,85 @@
     */
    @Override
    public boolean addVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException {
        //判空
        VciBaseUtil.alertNotNull(osRevisionRuleDTO,"版本规则对象",osRevisionRuleDTO.getId(),"版本规则名称");
        //版本规则合规检验
        this.checkVersionRule(osRevisionRuleDTO);
        //查重
        VersionRule vr = platformClientUtil.getVersionService().getVersionRule(osRevisionRuleDTO.getName());
        //name不为空
        if(Func.isNotEmpty(vr) && !"".equals(vr.name)){
            throw new PLException("500",new String[]{"名称重复请更换名称!"});
        }
        platformClientUtil.getVersionService().addVersionRule(this.dto2VersionRule(osRevisionRuleDTO));
        return false;
        return platformClientUtil.getVersionService().addVersionRule(this.dto2VersionRule(osRevisionRuleDTO));
    }
    /**
     * 修改版本规则
     * @param osRevisionRuleDTO
     * @return
     */
    @Override
    public boolean updateVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) {
    public boolean updateVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException {
        //判空
        VciBaseUtil.alertNotNull(osRevisionRuleDTO,"版本规则对象",osRevisionRuleDTO.getId(),"版本规则名称");
        //判断是否在系统中存在
        VersionRule vr = platformClientUtil.getVersionService().getVersionRule(osRevisionRuleDTO.getName());
        //版本规则合规检验
        this.checkVersionRule(osRevisionRuleDTO);
        //name不为空
        if(Func.isEmpty(vr) && !"".equals(vr.name)){
            throw new PLException("500",new String[]{"修改的版本规则在系统中不存在!"});
        }
        return platformClientUtil.getVersionService().modifyVersionRule(this.dto2VersionRule(osRevisionRuleDTO));
    }
        return false;
    /**
     * 检查版本规则设置的是否合理
     * @param dto
     */
    private void checkVersionRule(OsRevisionRuleDTO dto) throws PLException {
        //版本规则名称只能为英文字母
        String regex = "[a-z A-Z]*";
        if (!dto.getId().matches(regex)) {
            throw new PLException("500",new String[]{"名称只能为英文!"});
        }
        //跳跃字符只能为数字或者字母
        if(Func.isNotBlank(dto.getJumpCharacter()) && (!(dto.getJumpCharacter().matches(regex)))){
            throw new PLException("500",new String[]{"跳跃字符只能为数字或者字母!"});
        }
        //初始值不能为空且只能为数字或者字母或英文状态下的符号
        String regex1 = "[A-Za-z0-9!@#$%^&*()-_=+{}':|;,.?/]+$";
        if(Func.isBlank(dto.getInitialValue()) || !dto.getInitialValue().matches(regex1)){
            throw new PLException("500",new String[]{"初始值不能为空且只能为数字或者字母或英文状态下的符号!"});
        }
        if(dto.getInitialValue().length() + dto.getInitialValue().length() > 32) {
            throw new PLException("500",new String[]{"初始值不能超过32个字符!"});
        }
        //步长不能为空且必须为1-9的正整数
        String regex2 = "[1-9]";
        if(Func.isBlank(dto.getStepLength()) || (!dto.getStepLength().matches(regex2))){
            throw new PLException("500",new String[]{"步长不能为空且必须为1-9的正整数"});
        }
        //前缀相关判断
        String regex3 = "^\\s+.*";
        if(Func.isNotBlank(dto.getPrefixion()) && (dto.getPrefixion().matches(regex3))){
            throw new PLException("500",new String[]{"前缀不能以空格开头"});
        }
        if (dto.getPrefixion().length() + dto.getPrefixion().length() > 32) {
            throw new PLException("500",new String[]{"前缀不能超过32个字符"});
        }
        //后缀相关判断
        String regex4 = "^*.\\s+$";
        if(Func.isNotBlank(dto.getSuffix()) && (dto.getSuffix().matches(regex4))){
            throw new PLException("500",new String[]{"后缀不能以空格结尾"});
        }
        if (dto.getSuffix().length() + dto.getSuffix().length() > 32) {
            throw new PLException("500",new String[]{"后缀不能超过32个字符"});
        }
        if (dto.getId().length() > 255) {
            throw new PLException("500",new String[]{"名称不能超过255个字符"});
        }
    }
    /**
@@ -97,15 +166,18 @@
        VersionRule newVR = new VersionRule();
        newVR.name = osRevisionRuleDTO.getId();
        newVR.tag = osRevisionRuleDTO.getName();
        newVR.jumpCharacter = osRevisionRuleDTO.getPrefixCode();
        /*newVR.initialValue = jtf3.getText();
        newVR.stepLength = jtf4.getText();
        newVR.prefixion = jtf5.getText();
        newVR.suffix = jtf6.getText();
        newVR.description = jta.getText();*/
        String userName = ClientSessionUtility.getCurUserName();
        newVR.creator = userName;
        newVR.description = osRevisionRuleDTO.getDescription();
        newVR.jumpCharacter = osRevisionRuleDTO.getJumpCharacter();
        newVR.initialValue = osRevisionRuleDTO.getInitialValue();
        newVR.stepLength = osRevisionRuleDTO.getStepLength();
        newVR.prefixion = osRevisionRuleDTO.getPrefixion();
        newVR.suffix = osRevisionRuleDTO.getSuffix();
        String userName = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
        long timeMillis = System.currentTimeMillis();
        newVR.creator = Func.isBlank(osRevisionRuleDTO.getCreator()) ? userName:osRevisionRuleDTO.getCreator();
        newVR.createTime = Func.isEmpty(osRevisionRuleDTO.getCreateTime()) ? timeMillis:osRevisionRuleDTO.getCreateTime().getTime();
        newVR.modifier = userName;
        newVR.modifyTime = timeMillis;
        return newVR;
    }
@@ -148,11 +220,11 @@
            ruleVO.setDescription(versionRule.description);
            ruleVO.setId(versionRule.name);
            ruleVO.setName(versionRule.tag);
            ruleVO.setSerialStep(WebUtil.getInt(versionRule.stepLength));
            ruleVO.setSkipCode(versionRule.jumpCharacter);
            ruleVO.setPrefixCode(versionRule.prefixion);
            ruleVO.setSuffixCode(versionRule.suffix);
            ruleVO.setStartCode(versionRule.initialValue);
            ruleVO.setStepLength(WebUtil.getInt(versionRule.stepLength));
            ruleVO.setJumpCharacter(versionRule.jumpCharacter);
            ruleVO.setPrefixion(versionRule.prefixion);
            ruleVO.setSuffix(versionRule.suffix);
            ruleVO.setInitialValue(versionRule.initialValue);
            //associated暂时没有使用
        }
        return ruleVO;
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java
@@ -280,17 +280,19 @@
    public boolean addSave(OsStatusDTO statusDTO) throws Exception {
        VciBaseUtil.alertNotNull(
            statusDTO,"状态的信息",
            statusDTO.getId(),"状态的英文名称",
            statusDTO.getName(),"状态的中文名称"
            statusDTO.getId(),"状态的英文名称"
        );
        StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(statusDTO.getId());
        if (Func.isNotEmpty(dbStatePool) && Func.isNotBlank(dbStatePool.oid)) {
            throw new PLException("500",new String[]{"名称重复请更换名称!"});
        if (statusDTO.getId().length()>50) {
            throw new PLException("500",new String[]{"状态英文名称不能超过50个字符!"});
        }
        // 状态池名称只能为英文字母
        String regex = "[a-z A-Z]*";
        if ((!statusDTO.getId().matches(regex))) {
        if (!statusDTO.getId().matches(regex)) {
            throw new PLException("500",new String[]{"名称只能为英文!"});
        }
        StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(statusDTO.getId());
        if (Func.isNotEmpty(dbStatePool) && Func.isNotBlank(dbStatePool.oid)) {
            throw new PLException("500",new String[]{"名称重复请更换名称!"});
        }
        //虽然会自动生成oid,但是这儿设置主键,避免放入缓存的数据是没有oid的
        statusDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
@@ -351,21 +353,21 @@
        for(OsStatusDTO statusDTO : osStatusDTOS){
            //oid和ts判空
            String oid = statusDTO.getOid();
            //name主要用来对缓存数据删除
            String name = statusDTO.getName();
            //id主要用来对缓存数据删除
            String id = statusDTO.getId();
            //后台会用ts进行数据一致性校验
            Date ts = statusDTO.getTs();
            if(Func.isBlank(oid) || Func.isBlank(name) || Func.isEmpty(ts)){
            if(Func.isBlank(oid) || Func.isBlank(id) || Func.isEmpty(ts)){
                throw new PLException("500",new String[]{"待删除的状态列表中主键【oid】、调整时间【ts】、状态名称【name】不能为空!"});
            }
            StatePool statePool = new StatePool();
            statePool.oid = oid;
            statePool.name = name;
            statePool.name = id;
            statePool.ts = Func.format(ts,VciDateUtil.DateTimeMillFormat);
            statePoolList.add(statePool);
            boolean res = platformClientUtil.getStatePoolService().deleteStatePool(statePool);
            if(!res){
                throw new PLException("500",new String[]{"删除状态名称为【" + name + "】的数据时出现错误!"});
                throw new PLException("500",new String[]{"删除状态名称为【" + id + "】的数据时出现错误!"});
            }
        }
        //clearCache();
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java
@@ -2042,7 +2042,7 @@
                    if (ruleVO == null || StringUtils.isBlank(ruleVO.getOid())) {
                        throw new VciBaseException("{0}里的版本规则设置得不正确,在系统中没有找到{1}这个版本规则", new String[]{btmTypeVO.getName(), btmTypeVO.getRevisionRuleId()});
                    }
                    cbo.revisionValue = ruleVO.getStartCode();
                    cbo.revisionValue = ruleVO.getInitialValue();
                }
                if (StringUtils.isBlank(cbo.nameoid)) {
                    cbo.nameoid = VciBaseUtil.getPk();
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java
@@ -196,7 +196,7 @@
        bo.versionRule = String.valueOf(btmTypeVO.getVersionRule());
        if(StringUtils.isNotBlank(btmTypeVO.getRevisionRuleId())){
            OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionRuleId());
            bo.revisionValue = revisionRuleVO.getStartCode();
            bo.revisionValue = revisionRuleVO.getInitialValue();
        }
        bo.revisionSeq = (short) 1;