ludc
2024-07-26 887824662344ef267e171dbfae2b8ef2145a61c6
属性池所有接口完善上传(待联调)
已修改9个文件
已添加1个文件
475 ■■■■■ 文件已修改
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsAttributeDTO.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsAttributeVO.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/VciBaseUtil.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java 216 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsAttributeDTO.java
@@ -70,6 +70,16 @@
    private String btmTypeName;
    /**
     * å‚照的链接类型名称
     */
    private String linkTypeName;
    /**
     * é€‰æ‹©äº†é“¾æŽ¥ç±»åž‹æ—¶é€‰æ‹©çš„版本
     */
    private Integer version;
    /**
     * å±žæ€§çš„长度
     */
    private Integer attrLength;
@@ -114,6 +124,22 @@
     */
    private Date lastModifyTime;
    public String getLinkTypeName() {
        return linkTypeName;
    }
    public void setLinkTypeName(String linkTypeName) {
        this.linkTypeName = linkTypeName;
    }
    public void setVersion(Integer version) {
        this.version = version;
    }
    public Integer getVersion() {
        return version;
    }
    public void setCreator(String creator) {
        this.creator = creator;
    }
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsAttributeVO.java
@@ -75,6 +75,16 @@
    private String btmTypeName;
    /**
     * å‚照的链接类型名称
     */
    private String linkTypeName;
    /**
     * é€‰æ‹©äº†é“¾æŽ¥ç±»åž‹æ—¶é€‰æ‹©çš„版本
     */
    private Integer version;
    /**
     * å±žæ€§çš„长度
     */
    private Integer attrLength;
@@ -238,6 +248,22 @@
        this.btmTypeName = btmTypeName;
    }
    public String getLinkTypeName() {
        return linkTypeName;
    }
    public void setLinkTypeName(String linkTypeName) {
        this.linkTypeName = linkTypeName;
    }
    public Integer getVersion() {
        return version;
    }
    public void setVersion(Integer version) {
        this.version = version;
    }
    public Integer getAttrLength() {
        return attrLength;
    }
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,118 @@
package com.vci.po;
import com.vci.dto.OsEnumItemDTO;
import com.vci.starter.poi.annotation.ExcelColumn;
import com.vci.starter.web.pagemodel.BaseModelVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;
/**
 * å±žæ€§æ± å¯¼å…¥å¯¹è±¡
 * @author ludc
 * @date 2024/7/19 11:11
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OsAttributePO extends BaseModelVO {
    /**
     * ç¦æ­¢ä¿®æ”¹è¿™ä¸ªå€¼
     */
    private static final long serialVersionUID = -2239512786206928201L;
    /**
     * æ‰€åœ¨æ•°æ®è¡Œ
     */
    @ExcelColumn(rowIndexColumn = true,value = "")
    private String rowIndex;
    /**
     * å±žæ€§è‹±æ–‡åç§°
     */
    @ExcelColumn(value="属性名",nullable = false)
    private String id;
    /**
     * æ ‡ç­¾
     */
    @ExcelColumn(value="标签")
    private String name;
    /**
     * æè¿°
     */
    @ExcelColumn(value="描述")
    private String description;
    /**
     * å±žæ€§ç±»åž‹
     */
    @ExcelColumn(value="属性类型",nullable = false)
    private String attributeDataType;
    /**
     * å…è®¸ä¸ºç©º
     */
    @ExcelColumn(value="允许为空(是/否)")
    private String nullableFlag;
    /**
     * é»˜è®¤å€¼
     */
    @ExcelColumn(value="默认值")
    private String defaultValue;
    /**
     * æžšä¸¾å
     */
    @ExcelColumn(value="使用的枚举英文名称")
    private String enumId;
    /**
     * å‚照的业务类型编号
     */
    @ExcelColumn(value="参照的业务类型编号")
    private String btmTypeId;
    /**
     * å‚照的链接类型编号
     */
    @ExcelColumn(value="参照的链接类型编号")
    private String linkTypeName;
    /**
     * ç‰ˆæœ¬
     */
    @ExcelColumn(value="版本版次")
    private Integer version;
    /**
     * å±žæ€§é•¿åº¦
     */
    @ExcelColumn(value="属性长度")
    private Integer attrLength;
    /**
     * å°æ•°è¿›åº¦ä½æ•°
     */
    @ExcelColumn(value="小数精度位数")
    private Integer precisionLength;
    /**
     * å±žæ€§é•¿åº¦
     */
    @ExcelColumn(value="小数刻度位数")
    private Integer scaleLength;
    /**
     * å±žæ€§é•¿åº¦
     */
    @ExcelColumn(value="取值范围")
    private String range;
}
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/VciBaseUtil.java
@@ -57,7 +57,7 @@
     * @param e
     * @return
     */
    public static String getExceptionMessage(Exception e){
    public static String getExceptionMessage(Throwable e){
        String exceptionStr = VciExceptionTool.getExceptionStr(e);
        if(exceptionStr.contains("VciBaseException")){
            return e.getMessage();
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java
@@ -70,7 +70,7 @@
    /**
     * å¿…填列
     */
    private ArrayList<Integer> ColumnNameisRed = new ArrayList<Integer>();
    private List<Integer> ColumnNameisRed = new ArrayList<Integer>();
    /**
     * æ—¥å¿—
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java
@@ -1,12 +1,15 @@
package com.vci.web.controller;
import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.dto.OsAttributeDTO;
import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.annotation.log.VciBusinessLog;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseQueryObject;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.pagemodel.OsAttributeVO;
import com.vci.starter.web.util.ControllerUtil;
import com.vci.starter.web.util.LocalFileUtil;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.service.OsAttributeServiceI;
import com.vci.web.util.Func;
@@ -15,8 +18,10 @@
import org.slf4j.LoggerFactory;
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.util.Date;
import java.util.List;
@@ -65,6 +70,7 @@
     * @return
     */
    @GetMapping("/getByAttributeNames")
    @VciBusinessLog(operateName = "根据多个属性名称查询属性")
    public BaseResult getByAttributeNames(String[] attrNames){
        try {
            return BaseResult.dataList(attributeService.getByAttributeNames(attrNames));
@@ -83,13 +89,12 @@
     */
    @PostMapping( "/addAttribute")
    @VciBusinessLog(operateName = "添加属性")
    @VciUnCheckRight
    public BaseResult addAttribute(@RequestBody OsAttributeDTO osAttributeDTO) {
        try {
            return attributeService.addAttribute(osAttributeDTO) ? BaseResult.success("属性添加成功!"):BaseResult.fail("属性添加失败!");
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "增加属性型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            String exceptionMessage = "增加属性时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
@@ -102,6 +107,7 @@
     */
    @PutMapping( "/updateAttribute")
    @VciBusinessLog(operateName = "修改属性")
    @VciUnCheckRight
    public BaseResult updateAttribute(@RequestBody OsAttributeDTO osAttributeDTO) {
        try {
            return attributeService.updateAttribute(osAttributeDTO) ? BaseResult.success("属性修改成功!"):BaseResult.fail("属性修改失败!");
@@ -156,8 +162,7 @@
     * @param response
     */
    @GetMapping( "/exportAttributes")
    @VciBusinessLog(operateName = "导出枚举类型")
    @VciUnCheckRight
    @VciBusinessLog(operateName = "导出属性")
    public void exportAttributes(String exportFileName,String attrNames, HttpServletResponse response){
        try {
            String excelPath = attributeService.exportAttributes(exportFileName,attrNames);
@@ -174,5 +179,51 @@
        }
    }
    /**
     * ä¸‹è½½å±žæ€§å¯¼å…¥æ¨¡æ¿
     * @param exportFileName
     * @param response
     */
    @GetMapping( "/downloadAttributeTemplate")
    @VciBusinessLog(operateName = "导出属性")
    public void downloadAttributeTemplate(String exportFileName, HttpServletResponse response){
        try {
            String excelPath = attributeService.downloadAttributeTemplate(exportFileName);
            ControllerUtil.writeFileToResponse(response,excelPath);
        } catch (Exception e) {
            String msg = "下载枚举导入模板时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            try {
                //出错时
                e.printStackTrace();
                ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null);
            } catch (IOException ioException) {
                ioException.printStackTrace();
            }
        }
    }
    /**
     * å¯¼å…¥å±žæ€§
     * @param file
     * @return
     */
    @PostMapping("/importAttributes")
    @VciUnCheckRight
    public BaseResult importAttributes(MultipartFile file){
        String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
        File file1 = new File(excelFileName);
        try {
            file.transferTo(new File(excelFileName));
            if (file != null) {
                return attributeService.importAttributes(file1);
            } else {
                return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"无导入的文件"});
            }
        }catch (Throwable e) {
            throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
        }finally {
            file1.delete();
        }
    }
}
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java
@@ -270,7 +270,7 @@
                return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"无导入的文件"});
            }
        }catch (Throwable e) {
            throw new VciBaseException(e.getMessage(),new String[0],e);
            throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
        }finally {
            file1.delete();
        }
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java
@@ -4,9 +4,12 @@
import com.vci.corba.omd.atm.AttributeDef;
import com.vci.dto.OsAttributeDTO;
import com.vci.starter.web.pagemodel.BaseQueryObject;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.pagemodel.OsAttributeVO;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -152,6 +155,21 @@
    String exportAttributes(String exportFileName,String attrNames) throws PLException;
    /**
     * ä¸‹è½½å±žæ€§å¯¼å…¥æ¨¡æ¿
     * @param exportFileName
     * @return
     * @throws PLException
     */
    String downloadAttributeTemplate(String exportFileName) throws Exception;
    /**
     * å¯¼å…¥å±žæ€§
     * @param file
     * @return
     */
    BaseResult importAttributes(File file) throws Exception;
    /**
     * æ˜¯å¦é»˜è®¤çš„属性
     * @param attr å±žæ€§ç¼–号
     * @return true表示是默认属性
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
@@ -8,17 +8,24 @@
import com.vci.corba.common.PLException;
import com.vci.corba.omd.atm.AttributeDef;
import com.vci.dto.OsAttributeDTO;
import com.vci.dto.OsEnumDTO;
import com.vci.dto.OsEnumItemDTO;
import com.vci.omd.dataType.VTDataType;
import com.vci.pagemodel.OsEnumItemVO;
import com.vci.pagemodel.OsEnumVO;
import com.vci.pagemodel.OsUsedAttributeVO;
import com.vci.po.OsAttributePO;
import com.vci.po.OsEnumPO;
import com.vci.starter.poi.bo.ReadExcelOption;
import com.vci.starter.poi.bo.WriteExcelData;
import com.vci.starter.poi.bo.WriteExcelOption;
import com.vci.starter.poi.constant.ExcelLangCodeConstant;
import com.vci.starter.poi.util.ExcelUtil;
import com.vci.starter.web.annotation.log.VciUnLog;
import com.vci.starter.web.enumpck.VciFieldTypeEnum;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseQueryObject;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.util.*;
import com.vci.model.OsAttributeDO;
@@ -31,12 +38,14 @@
import com.vci.web.util.PlatformClientUtil;
import com.vci.web.util.WebUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.util.HSSFColor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.swing.*;
import java.awt.*;
@@ -102,6 +111,11 @@
    @Autowired(required = false)
    @Lazy
    private OsBtmServiceImpl osBtmService;
    /**
     *  å¿…填列
     */
    private List<Integer> ColumnNameisRed = new ArrayList<Integer>();
    /**
     * é»˜è®¤çš„属性
@@ -185,7 +199,7 @@
        VciBaseUtil.alertNotNull(attrNames,"属性名");
        List<OsAttributeVO> osAttributeVOS = new ArrayList<>();
        for (int i = 0; i < attrNames.length; i++) {
            AttributeDef[] attributeDefs = platformClientUtil.getAttributeService().getAttributeDefs(attrNames[i],1,1);
            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));
@@ -224,8 +238,8 @@
            attributeVO.setId(attribItem.name);
            attributeVO.setCreator(attribItem.creator);
            try {
                attributeVO.setCreateTime(VciDateUtil.str2Date(String.valueOf(attribItem.createTime),VciDateUtil.DateTimeFormat));
                attributeVO.setLastModifyTime(VciDateUtil.str2Date(String.valueOf(attribItem.modifyTime),VciDateUtil.DateTimeFormat));
                attributeVO.setCreateTime(new Date(attribItem.createTime));
                attributeVO.setLastModifyTime(new Date(attribItem.modifyTime));
                attributeVO.setTs(VciDateUtil.str2Date(attribItem.ts,VciDateUtil.DateTimeMillFormat));
            }catch (Throwable e){
@@ -236,7 +250,11 @@
            attributeVO.setAttributeDataType(attribItem.vtDataType);
            attributeVO.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(attribItem.vtDataType));
            attributeVO.setDefaultValue(attribItem.defValue);
            attributeVO.setRange(attribItem.rage);
            if(Func.isNotBlank(attribItem.rage)){
                attributeVO.setRange(attribItem.rage.replace("&lt;","<"));
            }else{
                attributeVO.setRange(attribItem.rage);
            }
            attributeVO.setOther(attribItem.other);
            //处理参照相关属性
            if(StringUtils.isNotBlank(attribItem.other)) {
@@ -248,6 +266,12 @@
                            attributeVO.setBtmTypeId(s.split("=")[1].trim());
                        }
                        //链接类型不支持
                        if (s.toLowerCase().contains("link") && s.split("=").length > 1) {//必须要判断长度,因为枚举的时候也是包含这个btm的
                            attributeVO.setLinkTypeName(s.split("=")[1].trim());
                        }
                        if (s.toLowerCase().contains("version") && s.split("=").length > 1) {//必须要判断长度,因为枚举的时候也是包含这个btm的
                            attributeVO.setVersion(WebUtil.getInt(s.split("=")[1].trim()));
                        }
                    }
                }
                //必输和长度
@@ -453,6 +477,7 @@
        //检查默认值与属性类型是否匹配
        checkDefValue(osAttributeDTO);
        //dto对象转换为存储所需对象
        osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
        AttributeDef attributeDef = this.osAttributeDTO2AttributeDef(osAttributeDTO);
        return platformClientUtil.getAttributeService().addAttributeDef(attributeDef);
    }
@@ -486,7 +511,7 @@
        if(hasInstance && !compatible){
            throw new PLException("500",new String[]{"无效变更, ä¸å…¼å®¹å·²äº§ç”Ÿçš„æ•°æ®ï¼"});
        }
        String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
        String userId = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
        osAttributeDTO.setLastModifier(userId);
        osAttributeDTO.setCreator(osAttributeVO.getCreator());
        osAttributeDTO.setCreateTime(osAttributeVO.getCreateTime());
@@ -519,16 +544,22 @@
     */
    private AttributeDef osAttributeDTO2AttributeDef(OsAttributeDTO osAttributeDTO) {
        AttributeDef attributeDef = new AttributeDef();
        attributeDef.oid = osAttributeDTO.getOid();
        attributeDef.name = osAttributeDTO.getId().toLowerCase().replaceAll(" ", "");
        attributeDef.label = osAttributeDTO.getName();
        attributeDef.description = osAttributeDTO.getDescription();
        attributeDef.vtDataType = (String)osAttributeDTO.getAttributeDataType();
        attributeDef.defValue = Func.isBlank(osAttributeDTO.getDefaultValue()) ? "" : osAttributeDTO.getDefaultValue();
        attributeDef.rage = Func.isBlank(osAttributeDTO.getRange()) ? "" : osAttributeDTO.getRange();
        attributeDef.creator = Func.isBlank(osAttributeDTO.getCreator()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getCreator();
        if(Func.isBlank(osAttributeDTO.getRange())){
            attributeDef.rage = "";
        }else{
            //特殊字符处理,直接存储<会报错
            attributeDef.rage = osAttributeDTO.getRange().replace("<","&lt;");
        }
        attributeDef.ts = Func.format((Func.isNotEmpty(osAttributeDTO.getTs()) ? osAttributeDTO.getTs():new Date()),VciDateUtil.DateTimeMillFormat);
        attributeDef.creator = "developer";//Func.isBlank(osAttributeDTO.getCreator()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getCreator();
        attributeDef.createTime = Func.isEmpty(osAttributeDTO.getCreateTime()) ? System.currentTimeMillis():osAttributeDTO.getCreateTime().getTime();
        attributeDef.modifier = Func.isBlank(osAttributeDTO.getLastModifier()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getLastModifier();
        attributeDef.modifier = "developer";//Func.isBlank(osAttributeDTO.getLastModifier()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getLastModifier();
        attributeDef.modifyTime = System.currentTimeMillis();
        //other需要自行处理
        StringBuffer sb = new StringBuffer();
@@ -563,9 +594,12 @@
                break;
            case VTString:
                if (StringUtils.isNotBlank(osAttributeDTO.getBtmTypeId())) {
                    //参照
                    //参照业务类型
                    sb.append(BTM).append(" = ").append(osAttributeDTO.getBtmTypeId()).append(";");
                    //链接类型暂时不支持
                }
                if(StringUtils.isNotBlank(osAttributeDTO.getLinkTypeName())){
                    //参照链接类型
                    sb.append(LINKTYPENAME).append(" = ").append(osAttributeDTO.getLinkTypeName()).append(";");
                }
                sb.append(LENGTH).append(" = ").append(length > osAttributeDTO.getAttrLength()?length:osAttributeDTO.getAttrLength()).append(";");
                if (StringUtils.isNotBlank(osAttributeDTO.getEnumId())) {
@@ -636,12 +670,12 @@
        }
        if(!attributeName.matches("[a-z A-Z]*")){
            throw new PLException("500",new String[]{"注意:属性名只能为英文字母!"+ NAME_MAX_LENGTH});
            throw new PLException("500",new String[]{"注意:属性名只能为英文字母!"});
        }
        int length = attributeName.length();
        if(length > NAME_MAX_LENGTH){
            throw new PLException("500",new String[]{"属性名过长,属性名长度不能超过!"+ NAME_MAX_LENGTH});
            throw new PLException("500",new String[]{"属性名过长,属性名长度不能超过"+ NAME_MAX_LENGTH});
        }
        String abName = attributeName.toLowerCase();
@@ -692,7 +726,6 @@
                if(rages == null || rages.equals("")){
                    return;
                }
                VTInteger obj = new VTInteger(Integer.valueOf(defValue));
                boolean flag = obj.checkRageValueByRage(rages);
                if(!flag){
@@ -707,7 +740,6 @@
                if(rages == null || rages.equals("")){
                    return;
                }
                VTLong obj = new VTLong(Long.valueOf(defValue));
                boolean flag = obj.checkRageValueByRage(rages);
                if(!flag){
@@ -727,7 +759,6 @@
                if(!flag){
                    throw new PLException("500",new String[]{"默认值与值域冲突!"});
                }
            }
        }
    }
@@ -840,7 +871,7 @@
                Arrays.asList("属性名", "标签", "描述",
                        "属性类型", "允许为空", "默认值", "使用的枚举英文名称(枚举名)",
                        "使用的枚举中文名称(标签)", "参照的业务类型编号", "参照的业务类型名称",
                        "属性长度", "小数精度位数","小数刻度位数","取值范围","创建时间")
                        "参照的链接类型名称","版本版次","属性长度", "小数精度位数","小数刻度位数","取值范围","创建时间")
        );
        //写excel
@@ -869,7 +900,7 @@
                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())));
                excelDataList.add(new WriteExcelData(i+1,3, osAttributeVO.getAttributeDataTypeText()+"("+osAttributeVO.getAttributeDataType()+")"));
                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()));
@@ -877,15 +908,154 @@
                excelDataList.add(new WriteExcelData(i+1,8, osAttributeVO.getBtmTypeId()));
                excelDataList.add(new WriteExcelData(i+1,9, osAttributeVO.getBtmTypeName()));
                excelDataList.add(new WriteExcelData(i+1,10, osAttributeVO.getAttrLength()));
                excelDataList.add(new WriteExcelData(i+1,11, osAttributeVO.getPrecisionLength()));
                excelDataList.add(new WriteExcelData(i+1,12, osAttributeVO.getScaleLength()));
                excelDataList.add(new WriteExcelData(i+1,13, osAttributeVO.getRange()));
                excelDataList.add(new WriteExcelData(i+1,14, osAttributeVO.getCreateTime()));
                excelDataList.add(new WriteExcelData(i+1,11, osAttributeVO.getLinkTypeName()));
                excelDataList.add(new WriteExcelData(i+1,12, osAttributeVO.getVersion()));
                excelDataList.add(new WriteExcelData(i+1,13, osAttributeVO.getPrecisionLength()));
                excelDataList.add(new WriteExcelData(i+1,14, osAttributeVO.getScaleLength()));
                excelDataList.add(new WriteExcelData(i+1,15, osAttributeVO.getRange()));
                excelDataList.add(new WriteExcelData(i+1,16, osAttributeVO.getCreateTime()));
            }
        }
        WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
        ExcelUtil.writeDataToFile(excelPath, excelOption);
        return excelPath;
    }
    /**
     * ä¸‹è½½å±žæ€§å¯¼å…¥æ¨¡æ¿
     * @param exportFileName
     * @return
     * @throws PLException
     */
    @Override
    public String downloadAttributeTemplate(String exportFileName) throws Exception {
        //界面没传名称,使用默认导出名称
        exportFileName = Func.isBlank(exportFileName) ?  "属性池导入模板_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
        //设置列名
        List<String> columns = new ArrayList<>(
                Arrays.asList("属性名", "标签", "描述",
                        "属性类型", "允许为空(是/否)", "默认值", "使用的枚举英文名称", "参照的业务类型编号",
                        "参照的链接类型编号","版本版次","属性长度", "小数精度位数","小数刻度位数","取值范围")
        );
        //设置必填列
        ColumnNameisRed.clear();
        ColumnNameisRed.add(0);
        ColumnNameisRed.add(3);
        ColumnNameisRed.add(10);
        //写excel
        String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName +  ".xls";
        try {
            new File(excelPath).createNewFile();
        } catch (Throwable e) {
            throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e);
        }
        //设置列
        List<WriteExcelData> excelDataList = new ArrayList<>();
        //设置列头
        for (int index = 0; index < columns.size(); index++) {
            //判断是否为必填列,给必填列设置颜色
            if(ColumnNameisRed.contains(index)){
                WriteExcelData excelData = new WriteExcelData(0, index, columns.get(index));
                excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex()));
                excelDataList.add(excelData);
            }else{
                excelDataList.add(new WriteExcelData(0,index, columns.get(index)));
            }
        }
        WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
        ExcelUtil.writeDataToFile(excelPath, excelOption);
        return excelPath;
    }
    /**
     * å¯¼å…¥å±žæ€§
     * @param file
     * @return
     */
    @Override
    public BaseResult importAttributes(File file) throws Exception{
        VciBaseUtil.alertNotNull(file,"excel文件");
        if(!file.exists()){
            throw new VciBaseException("导入的excel文件不存在,{0}",new String[]{file.getPath()});
        }
        try{
            //1、读取excel中的数据,组成对象
            ReadExcelOption excelOption = new ReadExcelOption();
            List<OsAttributePO> poList = ExcelUtil.readDataObjectFromExcel(file, OsAttributePO.class,excelOption,(value, po, fieldName)->{});
            //去除都是空的情况
            if(CollectionUtils.isEmpty(poList)){
                return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{});
            }
            //excel判重,数据校验,dto对象转换,存储对象转换,执行保存
            List<OsAttributeDTO> dtoList = new ArrayList<>();
            //当前excel中是否重复用的判重Map:(key:判重属性,value:行号)
            Map<String, String> excelReapeat = new HashMap<>();
            //判断必填属性是否为空,用户是否已存在,以及部门是否填错等校验逻辑
            poList.stream().forEach(osAttributePO -> {
                if(Func.isBlank(osAttributePO.getId())){//属性名判空
                    throw new VciBaseException("第【"+osAttributePO.getRowIndex()+"】行,enumnameerror");
                }else if(Func.isBlank(osAttributePO.getAttributeDataType())){
                    throw new VciBaseException("第【"+osAttributePO.getRowIndex()+"】行,typeerror");
                }else if(excelReapeat.containsKey(osAttributePO.getId())){//属性名表格中判重
                    throw new VciBaseException("第【"+excelReapeat.get(osAttributePO.getId())+"】行和第【"+osAttributePO.getRowIndex()+"】行数据,属性名重复");
                }
                //属性名校验
                try {
                    checkName(osAttributePO.getId());
                } catch (PLException e) {
                    e.printStackTrace();
                    throw new VciBaseException(VciBaseUtil.getExceptionMessage(e));
                }
                //属性名excel中判重处理
                excelReapeat.put(osAttributePO.getId(),osAttributePO.getRowIndex());
                OsAttributeDTO osAttributeDTO = new OsAttributeDTO();
                osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
                osAttributeDTO.setId(osAttributePO.getId());
                osAttributeDTO.setName(osAttributePO.getName());
                osAttributeDTO.setDescription(osAttributePO.getDescription());
                osAttributeDTO.setDefaultValue(osAttributePO.getDefaultValue());
                osAttributeDTO.setAttrLength(osAttributePO.getAttrLength());
                osAttributeDTO.setAttributeDataType(osAttributePO.getAttributeDataType());
                osAttributeDTO.setBtmTypeId(osAttributePO.getBtmTypeId());
                //osAttributeDTO.setBtmTypeName(osAttributePO.getBtmname());
                osAttributeDTO.setLinkTypeName(osAttributePO.getLinkTypeName());
                osAttributeDTO.setVersion(osAttributePO.getVersion());
                osAttributeDTO.setEnumId(osAttributePO.getEnumId());
                //osAttributeDTO.setEnumName(osAttributePO.getEnumId());
                osAttributeDTO.setPrecisionLength(osAttributePO.getPrecisionLength());
                osAttributeDTO.setScaleLength(osAttributePO.getScaleLength());
                osAttributeDTO.setRange(osAttributePO.getRange());
                osAttributeDTO.setNullableFlag("是".equals(osAttributePO.getNullableFlag()) ? true:false);
                try {
                    //检查默认值与属性类型是否匹配
                    checkDefValue(osAttributeDTO);
                } catch (PLException e) {
                    e.printStackTrace();
                    throw new VciBaseException(e.getMessage());
                }
                dtoList.add(osAttributeDTO);
            });
            //执行保存操作
            dtoList.stream().forEach(dto->{
                try {
                    boolean b = platformClientUtil.getAttributeService().addAttributeDef(osAttributeDTO2AttributeDef(dto));
                    if(!b){
                        throw new VciBaseException("save and return false");
                    }
                } catch (PLException e) {
                    e.printStackTrace();
                    throw new VciBaseException("执行保存时出现错误,错误属性对象名为:【" + dto.getId() + "】,原因:"+e.getMessage());
                }
            });
        }catch (Exception e){
            if(logger.isErrorEnabled()){
                logger.error("读取excel内容时或保存用户信息时出现了错误,具体原因:",VciBaseUtil.getExceptionMessage(e));
            }
            e.printStackTrace();
            return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e);
        }
        return BaseResult.success("枚举导入成功!");
    }
    /**
@@ -909,11 +1079,11 @@
     */
    private boolean isReferAttr(String other){
        if(StringUtils.isNotBlank(other)
                && (other.toLowerCase().contains("btm") || other.toLowerCase().contains("ltm"))){
                && (other.toLowerCase().contains("btm") || other.toLowerCase().contains("link"))){
            //还不能确定,因为枚举的时候也会设置btm
            String[] temp = other.split(";");
            for(String s : temp){
                if((s.contains("btm") || s.contains("ltm")) && s.split("=").length>1){
                if((s.contains("btm") || s.contains("link")) && s.split("=").length>1){
                    return true;
                }
            }
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java
@@ -86,7 +86,7 @@
    /**
     * å¿…填列
     */
    private ArrayList<Integer> ColumnNameisRed = new ArrayList<Integer>();
    private List<Integer> ColumnNameisRed = new ArrayList<Integer>();
    /**
     * æ—¥å¿—
@@ -567,7 +567,7 @@
            if(Func.isNotEmpty(osEnumVOList)){
                repeatEnumId = osEnumVOList.stream().map(OsEnumVO::getId).collect(Collectors.toList());
            }
            //当前excel中是否重复用的判重Map:(key:账号,value:行号)
            //当前excel中是否重复用的判重Map:(key:判重属性,value:行号)
            Map<String, String> excelReapeat = new HashMap<>();
            //判断必填属性是否为空,用户是否已存在,以及部门是否填错等校验逻辑
            List<String> finalRepeatEnumId = repeatEnumId;
@@ -585,7 +585,7 @@
                }else if (Func.isNotEmpty(osEnumVOList) && finalRepeatEnumId.contains(osEnumPO.getId())){//2、判断枚举名是否与系统中重复
                    throw new VciBaseException("第【"+osEnumPO.getRowIndex()+"】行,枚举名在系统中已经存在,请修改!");
                }
                //先对必填属性判空处理
                //先对枚举名excel中需要判重处理
                excelReapeat.put(osEnumPO.getId(),osEnumPO.getRowIndex());
            });
            //保存逻辑