田源
2024-07-26 889842eb8b64a0b72c449ce23ff21e4e8c935cae
Merge remote-tracking branch 'origin/master'
已修改32个文件
已重命名1个文件
已添加4个文件
2819 ■■■■ 文件已修改
Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/bo/WriteExcelData.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsAttributeDTO.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/OsAttributeDO.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OrgDepartmentVO.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsAttributeVO.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OrgDeptPO.java 10 ●●●● 补丁 | 查看 | 原始文档 | 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-api/src/main/java/com/vci/po/OsEnumPO.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/SmUserPO.java 2 ●●● 补丁 | 查看 | 原始文档 | 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-base/src/main/java/com/vci/starter/web/wrapper/VciQueryWrapperForDO.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/OrgDeptQueryServiceI.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java 206 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmPwdStrategyQueryController.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/properties/ConfigCorbaReader.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java 205 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/properties/UsedNames.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBaseServiceI.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsEnumServiceI.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java 720 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java 351 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java 162 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/usedNames.properties 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/api/system/menu.js 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/api/treeMyMenu.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/api/user.js 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/bo/WriteExcelData.java
@@ -1,8 +1,5 @@
package com.vci.starter.poi.bo;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import java.util.List;
/**
@@ -107,7 +104,6 @@
     */
    private Integer width;
    public String getFontColor() {
        return fontColor;
    }
@@ -145,6 +141,37 @@
    }
    /**
     * æž„造方法-是否居中
     * @param row è¡Œ
     * @param col åˆ—
     * @param obj å€¼
     */
    public WriteExcelData(int row, int col, boolean center, Object obj){
        this.row = row;
        this.col = col;
        this.center = center;
        this.obj = obj;
    }
    /**
     * æž„造方法-合并,居中参数
     * @param row è¡Œ
     * @param rowTo åˆå¹¶è¡Œ
     * @param merged æ˜¯å¦åˆå¹¶å•元格
     * @param center æ˜¯å¦å±…中
     * @param col åˆ—
     * @param obj å€¼
     */
    public WriteExcelData(int row,int rowTo,boolean merged,boolean center, int col, Object obj){
        this.row = row;
        this.rowTo = rowTo;
        this.merged = merged;
        this.center = center;
        this.col = col;
        this.obj = obj;
    }
    /**
     * å†™å…¬å¼
     * @param row è¡Œå· ä»Ž0 å¼€å§‹
     * @param col åˆ—号从0开始
Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java
@@ -1,5 +1,6 @@
package com.vci.starter.poi.util;
import cn.hutool.core.collection.CollUtil;
import com.vci.starter.poi.annotation.ExcelColumn;
import com.vci.starter.poi.annotation.ExcelTitle;
import com.vci.starter.poi.bo.*;
@@ -630,6 +631,8 @@
                    //写值
                    setCellValue(cell, value);
                }
                //设置自适应列宽
                sheet.autoSizeColumn(ed.getCol());
                if(ed.getWidth()!=null && ed.getWidth()>0){
                    sheet.setColumnWidth(cell.getColumnIndex(),(int)(ed.getWidth() + 0.72)*256);
                }
@@ -855,6 +858,7 @@
                if (ed.getColTo() < ed.getCol()) {
                    ed.setColTo(ed.getCol());
                }
                List<CellRangeAddress> cellRangeAddressList = sheet.getMergedRegions();
                sheet.addMergedRegion(new CellRangeAddress(ed.getRow(), ed.getRowTo(), ed.getCol(), ed.getColTo()));
            });
        }
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsAttributeDTO.java
@@ -49,7 +49,6 @@
     */
    private String defaultValue;
    /**
     * ä½¿ç”¨æžšä¸¾è‹±æ–‡åç§°
     */
@@ -71,6 +70,16 @@
    private String btmTypeName;
    /**
     * å‚照的链接类型名称
     */
    private String linkTypeName;
    /**
     * é€‰æ‹©äº†é“¾æŽ¥ç±»åž‹æ—¶é€‰æ‹©çš„版本
     */
    private Integer version;
    /**
     * å±žæ€§çš„长度
     */
    private Integer attrLength;
@@ -85,7 +94,6 @@
     */
    private Integer scaleLength;
    /**
     * å–值范围
     */
@@ -96,6 +104,74 @@
     */
    private Date ts;
    /**
     * åˆ›å»ºäºº
     */
    private String creator;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    private Date createTime;
    /**
     * æœ€åŽä¿®æ”¹äºº
     */
    private String lastModifier;
    /**
     * æœ€åŽä¿®æ”¹æ—¶é—´ï¼Œæ ¼å¼æ˜¯yyyy-MM-dd HH:mm:ss
     */
    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;
    }
    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;
    }
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/OsAttributeDO.java
@@ -40,21 +40,25 @@
    /**
     * æè¿°
     */
    @Column(name = "description")
    private String description;
    /**
     * æ—¶é—´æˆ³
     */
    @Column(name = "ts")
    private Date ts;
    /**
     * åˆ›å»ºäºº
     */
    @Column(name = "creator")
    private String creator;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    @Column(name = "createtime")
    private Date createTime;
    /**
@@ -73,6 +77,7 @@
     * å†…容
     */
    @XmlType
    @Column(name = "content")
    private String content;
    public String getOid() {
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OrgDepartmentVO.java
@@ -22,7 +22,7 @@
    /**
     * é™¤éƒ¨é—¨ä¸»é”®å¤–的唯一标识,长度为8位,可通过该参数反推回部门主键;主要用于导入部门时使用
     */
    private String uniqueId;
    //private String uniqueId;
    /**
     * éƒ¨é—¨åç§°
@@ -99,7 +99,34 @@
     */
    private String tel;
    /**
     * éƒ¨é—¨åç§°ç»„成的全路径:dept1/dept2/dept3
     */
    private String fullDeptNamePath;
    /**
     * éƒ¨é—¨å±‚级
     */
    private int treelevel;
    public OrgDepartmentVO() {
    }
    public OrgDepartmentVO(String id, String name, Short status, String fullDeptNamePath, int treelevel) {
        this.id = id;
        this.name = name;
        this.status = status;
        this.fullDeptNamePath = fullDeptNamePath;
        this.treelevel = treelevel;
    }
    public String getFullDeptNamePath() {
        return fullDeptNamePath;
    }
    public void setFullDeptNamePath(String fullDeptNamePath) {
        this.fullDeptNamePath = fullDeptNamePath;
    }
    public String getCode() {
        return code;
@@ -133,13 +160,13 @@
        return statusText;
    }
    public String getUniqueId() {
    /*public String getUniqueId() {
        return uniqueId;
    }
    }*/
    public void setUniqueId(String uniqueId) {
    /*public void setUniqueId(String uniqueId) {
        this.uniqueId = uniqueId;
    }
    }*/
    @Override
    public String getId() {
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsAttributeVO.java
@@ -64,7 +64,6 @@
     */
    private String enumName;
    /**
     * å‚照的业务类型编号
     */
@@ -74,6 +73,16 @@
     * å‚照的业务类型名称
     */
    private String btmTypeName;
    /**
     * å‚照的链接类型名称
     */
    private String linkTypeName;
    /**
     * é€‰æ‹©äº†é“¾æŽ¥ç±»åž‹æ—¶é€‰æ‹©çš„版本
     */
    private Integer version;
    /**
     * å±žæ€§çš„长度
@@ -96,7 +105,12 @@
    private String range;
    /**
     * ä¸šåŠ¡ç±»åž‹åç§°,是值这条数据的业务类型,不是属性所属的业务类型
     * å­—段为参照时参照的相关属性
     */
    private String other;
    /**
     * ä¸šåŠ¡ç±»åž‹åç§°,是值这条数据的业务类型,不是属性所属的业务类型,应该是业务类型为属性池
     */
    private String btmname;
@@ -129,6 +143,14 @@
     * æ—¶é—´æˆ³ï¼Œæ ¼å¼æ˜¯yyyy-MM-dd HH:mm:ss.SSS
     */
    private Date ts;
    public String getOther() {
        return other;
    }
    public void setOther(String other) {
        this.other = other;
    }
    public String getOid() {
        return oid;
@@ -226,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/OrgDeptPO.java
@@ -28,12 +28,6 @@
    private String rowIndex;
    /**
     * ä¸»é”®
     */
    @ExcelColumn(value="ID")
    private String id;
    /**
     * éƒ¨é—¨åç§°
     */
    @ExcelColumn(value="名称",nullable = false)
@@ -60,8 +54,8 @@
    /**
     * çˆ¶id
     */
    @ExcelColumn(value="父ID(部门唯一标识ID)")
    private String parentId;
    @ExcelColumn(value="父部门名称全路径(/间隔)")
    private String parentFullNamePath;
    /**
     * æè¿°
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-api/src/main/java/com/vci/po/OsEnumPO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,81 @@
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 OsEnumPO 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="返回类型",nullable = false)
    private String enumValueDataType;
    /**
     * é•¿åº¦
     */
    @ExcelColumn(value="长度",nullable = false)
    private Integer length;
    /**
     * æžšä¸¾é¡¹å
     */
    @ExcelColumn(value="枚举项名称(当前枚举下有枚举项时必填)",nullable = false)
    private String enumItemName;
    /**
     * æžšä¸¾å€¼
     */
    @ExcelColumn(value="枚举值(当前枚举下有枚举项时必填)",nullable = false)
    private String value;
    /**
     * æè¿°
     */
    @ExcelColumn(value="描述")
    private String description;
    /**
     * ç”¨äºŽæ•´ç†æˆ1对多关系时使用,不针对导入使用
     */
    private List<OsEnumItemDTO> items = new ArrayList<>();
}
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/SmUserPO.java
@@ -7,7 +7,7 @@
import lombok.NoArgsConstructor;
/**
 * ç”¨æˆ·çš„导入导出对象
 * ç”¨æˆ·çš„导入对象
 * @author ludc
 * @date 2024/7/1 16:53
 */
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-base/src/main/java/com/vci/starter/web/wrapper/VciQueryWrapperForDO.java
@@ -54,7 +54,6 @@
     */
    public static final String USER_TABLE_COMPATIBILITY_FIELD_SEP = "${vcicomplibitysep}";
    /**
     * æŸ¥è¯¢æ¡ä»¶
     */
@@ -111,7 +110,7 @@
    private PageHelper pageHelper;
    /**
     * æ‰€æœ‰çš„字段名称,key是对象属性中的字段,value是数据库里的字段
     * æ‰€æœ‰çš„字段名称,key是数据库里的字段,value是对象属性中的字段
     */
    private Map<String,String> allFieldNameMap;
@@ -1428,9 +1427,10 @@
    public Map<String,String> switchConditionMap(){
        Map<String,String> queryMap = new HashMap<>();
        if(!CollectionUtils.isEmpty(this.conditionMap)){
            this.conditionMap.forEach((key,value)->{
            //TODO: è½¬æ¢å‰çš„字段和转换后的字段不应该同时存在,应该都统一使用转换后的字段做查询条件
            /*this.conditionMap.forEach((key,value)->{
                queryMap.put(key,value);
            });
            });*/
            //我们转换一下,直接set,如果还有重复的就只能自行解决
            this.allFieldNameMap.forEach((dbField,field)->{
                if(conditionMap.containsKey(field)){
@@ -1452,7 +1452,6 @@
    public void setLinkTableSql(String linkTableSql) {
        this.linkTableSql = linkTableSql;
    }
    /**
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/OrgDeptQueryServiceI.java
@@ -27,13 +27,20 @@
    OrgDepartmentVO getDeptByDeptOid(String deptOid) throws VciBaseException;
    /**
     * æ ¹æ®çˆ¶éƒ¨é—¨ä¸»é”®èŽ·å–å’Œéƒ¨é—¨åç§°éƒ¨é—¨çš„ä¿¡æ¯
     * æ ¹æ®çˆ¶éƒ¨é—¨ä¸»é”®èŽ·å–å’Œéƒ¨é—¨åç§°éƒ¨é—¨çš„ä¿¡æ¯ï¼ˆä¸»è¦ç”¨äºŽæ–°å¢žå’Œä¿®æ”¹æŸ¥é‡ï¼‰
     * @param parentDeptOid çˆ¶éƒ¨é—¨ä¸»é”®
     * @param conditionMap æŸ¥è¯¢æ¡ä»¶
     * @return éƒ¨é—¨çš„æ˜¾ç¤ºå¯¹è±¡ï¼Œå¦‚果部门不存在则返回null,不会抛出异常
     * @throws VciBaseException å‚数为空或者数据库存在问题的时候会抛出异常
     */
    List<OrgDepartmentVO> getDeptByDeptPOidAndCondition(String parentDeptOid,Map<String,String> conditionMap) throws VciBaseException;
    List<OrgDepartmentVO> getDeptByDeptpOidAndCondition(String parentDeptOid,Map<String,String> conditionMap) throws VciBaseException;
    /**
     * æ ¹æ®çˆ¶éƒ¨é—¨åç§°è·¯å¾„获取和部门名称部门的信息(主要用于导入时根据部门命令全路径和名称或编号查重)
     * @return éƒ¨é—¨çš„æ˜¾ç¤ºå¯¹è±¡ï¼Œå¦‚果部门不存在则返回null,不会抛出异常
     * @throws VciBaseException å‚数为空或者数据库存在问题的时候会抛出异常
     */
    List<OrgDepartmentVO> getDeptAllFullName() throws VciBaseException;
    /**
     * æ‰¹é‡èŽ·å–éƒ¨é—¨çš„ä¿¡æ¯ ï¼ˆæ ¹æ®éƒ¨é—¨ä¸»é”®ï¼‰
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>();
    /**
     * æ—¥å¿—
@@ -99,14 +99,14 @@
    }
    /**
     * æ ¹æ®çˆ¶éƒ¨é—¨ä¸»é”®èŽ·å–å’Œéƒ¨é—¨åç§°éƒ¨é—¨çš„ä¿¡æ¯
     * æ ¹æ®çˆ¶éƒ¨é—¨ä¸»é”®èŽ·å–éƒ¨é—¨åç§°éƒ¨é—¨çš„ä¿¡æ¯
     * @param parentDeptOid çˆ¶éƒ¨é—¨ä¸»é”®
     * @param conditionMap éƒ¨é—¨åç§°
     * @return éƒ¨é—¨çš„æ˜¾ç¤ºå¯¹è±¡ï¼Œå¦‚果部门不存在则返回null,不会抛出异常
     * @throws VciBaseException å‚数为空或者数据库存在问题的时候会抛出异常
     */
    @Override
    public List<OrgDepartmentVO> getDeptByDeptPOidAndCondition(String parentDeptOid,Map<String,String> conditionMap) throws VciBaseException {
    public List<OrgDepartmentVO> getDeptByDeptpOidAndCondition(String parentDeptOid,Map<String,String> conditionMap) throws VciBaseException {
        if(Func.isEmpty(conditionMap)){
            conditionMap = new HashMap();
        }
@@ -122,6 +122,42 @@
            return null;
        }
        return deptDO2VOs(roleForPlatform1s);
    }
    /**
     * æ ¹æ®çˆ¶éƒ¨é—¨åç§°è·¯å¾„获取和部门名称部门的信息(主要用于导入时根据部门命令全路径和名称或编号查重)
     * @return éƒ¨é—¨çš„æ˜¾ç¤ºå¯¹è±¡ï¼Œå¦‚果部门不存在则返回null,不会抛出异常
     * @throws VciBaseException å‚数为空或者数据库存在问题的时候会抛出异常
     */
    @Override
    public List<OrgDepartmentVO> getDeptAllFullName() throws VciBaseException {
        //查询部门信息,主要查询部门名称组成全路径
        String sql = "SELECT  PLUID, PLNAME, PLNUM, PLSTATUS, level, substr(sys_connect_by_path(PLNAME, '/'), 2) AS FULL_NAME_PATH " +
                "FROM PLDEPT " +
                "START WITH PLPARENTUID IS NULL " +
                "CONNECT BY PRIOR PLUID = PLPARENTUID";
        List<BusinessObject> cbos = boService.queryByOnlySql(sql);
        List<OrgDepartmentVO> departmentVOList = new ArrayList<>();
        if(!CollectionUtils.isEmpty(cbos)){
            cbos.stream().forEach(cbo->{
                //部门主键
                String deptOid = ObjectTool.getNewBOAttributeValue(cbo,"PLUID");
                //部门名称
                String deptName = ObjectTool.getNewBOAttributeValue(cbo, "PLNAME");
                //部门编号
                String deptNum = ObjectTool.getNewBOAttributeValue(cbo, "PLNUM");
                //部门层级
                String deptLevel = ObjectTool.getNewBOAttributeValue(cbo, "level");
                //部门名称全路径
                String fullDeptNamePath = ObjectTool.getNewBOAttributeValue(cbo, "FULL_NAME_PATH");
                //部门状态
                String deptStatus = ObjectTool.getNewBOAttributeValue(cbo, "PLSTATUS");
                OrgDepartmentVO orgDepartmentVO = new OrgDepartmentVO(deptNum,deptName,Short.valueOf(deptStatus),fullDeptNamePath,Integer.valueOf(deptLevel));
                orgDepartmentVO.setOid(deptOid);
                departmentVOList.add(orgDepartmentVO);
            });
        }
        return departmentVOList;
    }
    /**
@@ -147,7 +183,7 @@
        if(deptForPlatform1!=null){
            departmentVO.setOid(deptForPlatform1.getPluid());
            // é™¤éƒ¨é—¨ä¸»é”®å¤–的唯一标识,长度为Dept:+8位可通过该参数反推回部门主键的hash编码
            departmentVO.setUniqueId("Dept:"+Func.oidEnHash(deptForPlatform1.getPluid()));
            //departmentVO.setUniqueId("Dept:"+Func.oidEnHash(deptForPlatform1.getPluid()));
            departmentVO.setId(deptForPlatform1.getPlnum());
            departmentVO.setName(deptForPlatform1.getPlname());
            departmentVO.setStatus(deptForPlatform1.getPlstatus());
@@ -552,7 +588,7 @@
    }
    /**
     * ä¿å­˜éƒ¨é—¨è§’色关联信息,带查重功能
     * ä¿å­˜éƒ¨é—¨ç”¨æˆ·å…³è”信息,带查重功能
     * @param userOIds ç”¨æˆ·id
     * @param deptId éƒ¨é—¨id
     * @return
@@ -602,7 +638,7 @@
        if(Func.isNotBlank(orgDepartmentDTO.getId())){
            conditionMap.put("plnum",QueryOptionConstant.OR + orgDepartmentDTO.getId());
        }
        List<OrgDepartmentVO> departmentVOS = getDeptByDeptPOidAndCondition(orgDepartmentDTO.getPkFatherDepartment(), conditionMap);
        List<OrgDepartmentVO> departmentVOS = getDeptByDeptpOidAndCondition(orgDepartmentDTO.getPkFatherDepartment(), conditionMap);
        if(Func.isNotEmpty(departmentVOS)){
            throw new VciBaseException("同一父节点下该部门名称或编号已经存在,请修改!");
        }
@@ -647,7 +683,7 @@
        if(Func.isNotBlank(orgDepartmentDTO.getId())){
            conditionMap.put("plnum",QueryOptionConstant.OR + orgDepartmentDTO.getId());
        }
        List<OrgDepartmentVO> repeatDepartmentVOS = getDeptByDeptPOidAndCondition(orgDepartmentDTO.getPkFatherDepartment(), conditionMap);
        List<OrgDepartmentVO> repeatDepartmentVOS = getDeptByDeptpOidAndCondition(orgDepartmentDTO.getPkFatherDepartment(), conditionMap);
        repeatDepartmentVOS = repeatDepartmentVOS.stream().filter(item -> {
            if((item.getName().equals(orgDepartmentDTO.getName()) || item.getId().equals(orgDepartmentDTO.getId())) &&
                    !item.getOid().equals(orgDepartmentDTO.getOid())){
@@ -703,22 +739,12 @@
    @Override
    public boolean deleteDept(String[] ids) throws PLException {
        VciBaseUtil.alertNotNull(ids,"要删除的部门主键");
        //TODO: åº”该是不具备连带删除的功能,策略删除后用户关联的无用部门还在,考虑后期是否需要做,数据量不大可以不做连带删除
        //TODO:考虑是否需要添加删除前判断部门下是否配置有用户,这种情况应该不允许删除
        //TODO: åº”该是不具备连带删除的功能,部门删除后用户关联的无用部门还在,考虑后期是否需要做,数据量不大可以不做连带删除
        return platformClientUtil.getFrameworkService().deleteDepartment(
                ids,
                new UserEntityInfo("developer"/*WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId()*/, null)
                new UserEntityInfo(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(), null)
        );
    }
    /**
     * èŽ·å–æ‰€æœ‰éƒ¨é—¨çš„ä¿¡æ¯
     * @return key:部门由名称组成的路径(/间隔),value对应最小层级的部门信息
     */
    @Override
    public Map<String, OrgDepartmentVO> getDeptAllTreeMap() {
        List<OrgDepartmentVO> orgDepartmentVOList = listAllLevelChildrenDeptByParentOid(null, null);
        Map<String, OrgDepartmentVO> stringOrgDepartmentVOMap = convertToMap(orgDepartmentVOList);
        return stringOrgDepartmentVOMap;
    }
    /**
@@ -731,10 +757,10 @@
        //界面没传名称,使用默认名称
        downloadFileName = Func.isBlank(downloadFileName) ?  "部门导入模板_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):downloadFileName;
        // è®¾ç½®è¡¨å•列名
        List<String> columns = new ArrayList<>(Arrays.asList("ID", "名称", "编号", "代号", "专业", "父ID(部门唯一标识ID)", "描述"));
        List<String> columns = new ArrayList<>(Arrays.asList("名称", "编号", "代号", "专业", "父部门名称全路径(/间隔)", "描述"));
        //设置必填列
        ColumnNameisRed.clear();
        //ColumnNameisRed.add(0);
        ColumnNameisRed.add(0);
        ColumnNameisRed.add(1);
        //写excel
        String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + downloadFileName +  ".xls";
@@ -784,53 +810,56 @@
            if(CollectionUtils.isEmpty(poList)){
                return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{});
            }
            /*部门导入几个比较重要的情景:
                1、当前导入的数据是一个部门树结构(要判断用户手输的ID是否存在重复,输了就要判断是否在当前表格中重复,
                    å¹¶ä¸”保存时不能使用用户手输的ID,要根据手输ID和实际存储OID做对应映射,
                    å¹¶ä¸”不破坏表格中部门树结构,如果没手输ID就只需要关注parentId这个属性,
                    å¹¶ä¸”需要注意如果有的ID有,有的没有那就需要注意,既存在和系统中,
                    å…³è”的部门树,又存在和当前表格中关联的部门树)。
                2、当前导入的数据父id关联了已存在的部门oid(要查询父id这个部门是否存在,)
            è§£å†³æ€è·¯ï¼šæœ€å¥½æ˜¯å°†è¡¨æ ¼ä¸­å¯èƒ½æ˜¯éƒ¨é—¨æ ‘的给遍历成树,然后再做查重啥的处理
            */
            //2、必填判空、判重(数据库判重和excel中判重),组装成保存用的数据对象
            List<DeptInfo> deptInfoList = new ArrayList<>();
            //2.1、用以存储excel中重复的数据,三个不可重复的字段)(Name不能为空,Name、Code同一父部门下唯一)
            List<String> repeatIdList = new ArrayList<>();
            //2.1、用以存储excel中重复的数据,两个不可重复的字段)(Name不能为空,Name、Code同一父部门下唯一)
            Map<String,String> repeatNameMap = new HashMap<>();
            Map<String,String> repeatNumMap = new HashMap<>();
            Map<String,String> indexMap = new HashMap<>();
            //2.2、存储用户手输的oid和实际存储oid的映射关系
            Map<String, String> oidMap = new HashMap<>();
            //查询系统中部门,其中包含了部门名称树属性
            List<OrgDepartmentVO> dbOrgDepartmentVOList = this.getDeptAllFullName();
            //遍历成map对象:key为DeptName的全路径:value为Dept对象(用户处理部门父组件)
            Map<String, String> dbOrgDepartFullNameOidMap = dbOrgDepartmentVOList.stream().collect(Collectors.toMap(OrgDepartmentVO::getFullDeptNamePath, OrgDepartmentVO::getOid));
            //用来判断处parentName既不在库中存在,又不在poNames存在的情况
            List<String> poNames = poList.stream().map(OrgDeptPO::getName).collect(Collectors.toList());
            poList.stream().forEach(po->{
                String parentId = Func.isBlank(po.getParentId()) ? "":po.getParentId();
                String parentFullNamePath = Func.isBlank(po.getParentFullNamePath()) ? "":po.getParentFullNamePath();
                //部门名称判空,通常通过po中的注解就可实现
                if(Func.isEmpty(po.getName())){
                if(Func.isBlank(po.getName())){
                    throw new VciBaseException("第【"+po.getRowIndex()+"】行,depterror,Reason:Name cannot be empty");
                }else if(parentId.equals(repeatNameMap.getOrDefault(po.getName(), null))/*excel中同一部门下Name相等*/){
                }else if(parentFullNamePath.equals(repeatNameMap.getOrDefault(po.getName(), null))/*excel中同一部门下Name相等*/){
                    //同一部门下名称判重
                    throw new VciBaseException("第【"+po.getRowIndex()+"】行,deptnameerror,Reason: Names under the same department cannot be duplicated");
                }else if(Func.isNotEmpty(po.getId()) && repeatIdList.equals(po.getId())){
                    throw new VciBaseException("第【"+po.getRowIndex()+"】行,deptiderror,Reason: The primary key cannot be duplicated");
                }else if(Func.isNotEmpty(po.getNum()) && parentId.equals(repeatNumMap.getOrDefault(po.getNum(),null))/*excel中同一部门下编号存在 */){
                }else if(Func.isNotBlank(po.getNum()) && parentFullNamePath.equals(repeatNumMap.getOrDefault(po.getNum(),null))/*excel中同一部门下编号存在 */){
                    throw new VciBaseException("第【"+po.getRowIndex()+"】行,deptnumerror,Reason: The number cannot be duplicated");
                }else{
                    //2.2、查询数据库中的数据(查重ID和NUM),比较麻烦需要根据ParentID查询(所有只能单条查询进行判重)
                    //组装查重条件:同一部门下(parentId相等),name或者num相等
                    HashMap<String, String> conditionMap = new HashMap<>();
                    conditionMap.put("plname",QueryOptionConstant.OR + po.getName());
                    conditionMap.put("plnum",QueryOptionConstant.OR + po.getNum());
                    String pId = Func.isBlank(po.getParentId()) ? null:po.getParentId();
                    List<OrgDepartmentVO> repeatOrgDept = this.getDeptByDeptPOidAndCondition(pId, conditionMap);
                    //2.2、查询数据库中的数据(查重ID和NUM),比较麻烦需要根据ParentName全路径查询(所有只能单条查询进行判重)
                    //同一部门下(parentName相等),name或者num相等
                    List<OrgDepartmentVO> repeatOrgDept = dbOrgDepartmentVOList.stream().filter(item -> {
                        //同一部门名称全路径下,部门名称相等、部门编号不为空并且和系统中存在相等的编号
                        boolean isNameOrNumRepeat = po.getName().equals(item.getName()) || (Func.isNotBlank(po.getNum()) && po.getNum().equals(item.getId()));
                        /*当parentFullNamePath为""时item.getFullDeptNamePath().contains(parentFullNamePath)永远为true,
                        æ‰€ä»¥éœ€è¦ç‰¹æ®Šå¤„理直接判断顶层的部门是否存在重复*/
                        if(((Func.isBlank(parentFullNamePath) && item.getTreelevel() == 1)
                            || (Func.isNotBlank(parentFullNamePath) && item.getFullDeptNamePath().contains(parentFullNamePath)))
                            && isNameOrNumRepeat) {
                            return true;
                        }
                        return false;
                    }).collect(Collectors.toList());
                    //只要不为空就说明当前行数据在系统中重复
                    if(Func.isNotEmpty(repeatOrgDept)){
                        throw new VciBaseException("第【"+po.getRowIndex()+"】行,deptname or deptnum error,Reason: The name or number already exists in the system");
                    }
                }
                //存储校验通过的数据,以便后续excel查重
                repeatNameMap.put(po.getName(),Func.isBlank(po.getParentId()) ? "":po.getParentId());
                repeatIdList.add(po.getId());
                repeatNumMap.put(po.getNum(),po.getParentId());
                repeatNameMap.put(po.getName(),parentFullNamePath);
                if(Func.isNotBlank(po.getNum())){
                    repeatNumMap.put(po.getNum(),parentFullNamePath);
                }
                indexMap.put(po.getName(),po.getRowIndex());
                //校验数据就该组装成DTO数据对象了
                OrgDepartmentDTO dto = new OrgDepartmentDTO();
@@ -839,48 +868,51 @@
                dto.setId(po.getNum());
                dto.setDescription(po.getDesc());
                dto.setSpecialties(po.getSpecialties());
                dto.setPkFatherDepartment(po.getParentId());
                dto.setCreateTime(new Date());
                dto.setCreator(loginUserId);
                dto.setLastModifier(loginUserId);
                dto.setStatus((short) 0);
                //2.2、过程中处理主键转换问题最好是一条一条的处理ID是否存在还有ParentID是否存在的问题
                //先判断是已存在的部门ID,还是不存在的部门ID,已存在系统中的ID就是为Dept:开头的
                String pId = Func.isBlank(dto.getPkFatherDepartment()) ? "":dto.getPkFatherDepartment();
                //是已存在系统中的部门id
                if(pId.contains("Dept:")){
                    //解析出真实的oid
                    String deParentId = Func.oidDeHash(pId.replace("Dept:", "").trim());
                    //解析出来的deParentId必须得在库中存在
                    if(Func.isBlank(deParentId) || Func.isEmpty(this.getDeptByDeptOid(deParentId))){
                        throw new VciBaseException("第【"+ po.getRowIndex() +"】行,deptparentiderror,Reason:Parent ID resolution error or does not exist in the system");
                //给导入的数据设置的主键
                String oid = VciBaseUtil.getPk().toUpperCase(Locale.ROOT);
                dto.setOid(oid);
                /*处理部门名称全路径转换为PkFatherDepartment(部门主键):
                  æƒ…况1、直属父部门是系统中已存在(判断方式:部门名称全路径在dbOrgDepartmentVOList中存在,fullDeptNamePath全等于parentFullNamePath)。
                  æƒ…况2、直属父部门不是系统中已存在的,但是直属父部门的的上级部门是系统中已存在的(涉及到oid和parentoid对应关系处理比较麻烦)。
                  æƒ…况3、直属父部门和其上级部门都是excel中新构建的。(涉及到oid和parentoid对应关系处理比较麻烦)*/
                String dbDeptoid = dbOrgDepartFullNameOidMap.getOrDefault(parentFullNamePath, null);
                //情况1可以直接设置parentOid。
                if(Func.isNotEmpty(dbDeptoid) || "".equals(parentFullNamePath)){
                    //设置父部门主键
                    dto.setPkFatherDepartment(dbDeptoid);
                }else{
                    //处理父路径名既不存在于数据库又不存在于当前excel
                    String lastParentFullName = parentFullNamePath.substring(parentFullNamePath.lastIndexOf("/") + 1);//父路径名的最后一个部门名称
                    if(Func.isBlank(dbOrgDepartFullNameOidMap.getOrDefault(parentFullNamePath,null))
                        && !poNames.contains(lastParentFullName)
                    ){
                        throw new VciBaseException("当前导入的部门数据中,第【" + indexMap.get(po.getName()) + "】行,父部门设置存在问题!");
                    }
                    //替换掉临时使用的部门唯一标识,但是为了方便后续判断,还是需要加上Dept:标识
                    dto.setPkFatherDepartment("Dept:"+deParentId);
                    //情况2和3需要通过映射关系设置parentoid,所以这里先标记后续再做处理。
                    dto.setPkFatherDepartment("Pending:" + parentFullNamePath);
                }
                //用户手输了部门oid,但是避免oid不规范需要,用规范oid进行替换,如果没输入保存时会自动生成oid
                String excelOid = dto.getOid();
                if(Func.isNotBlank(excelOid)){
                    String pkOid = VciBaseUtil.getPk().toUpperCase(Locale.ROOT);
                    dto.setOid(pkOid);
                    //oid映射关系,后续用来更新parentId
                    oidMap.put(excelOid,pkOid);
                }
                //存储parentOid:oid映射关系
                String key = Func.isBlank(parentFullNamePath) ? po.getName():parentFullNamePath + "/"+po.getName();
                oidMap.put(key,oid);
                DeptInfo deptInfo = this.changeOrgDeptDTOToDeptInfo(dto);
                deptInfoList.add(deptInfo);
            });
            //3、处理id和parentId的映射关系:将用户手输的父ID转换成实际存储的ID并保存进库
            //3、处理oid和parentOid的映射关系:针对新加的数据是父部门
            deptInfoList.stream().forEach(info -> {
                //3.1、对最终处理好的部门数据保存
                try {
                    //parentId不为空并且没有Dept:相关的字符串,说明是用户手输的ParentId(导入的数据就是一个树结构)
                    if (Func.isNotBlank(info.parentId) && !info.parentId.contains("Dept:")) {
                        //转换ParentId为实际要存储的部门ID
                        info.parentId = oidMap.get(info.parentId);
                    }else if(info.parentId.contains("Dept:")){
                    //parentId不为空并且没有Pending:相关的字符串,说明是需要处理oid映射parentOid的
                    if (info.parentId.contains("Pending:")){
                        //系统中已存在的父部门OID,需要移除掉Dept:标识
                        info.parentId = info.parentId.replace("Dept:","");
                        String key = info.parentId.replace("Pending:","");
                        String parentId = oidMap.get(key);
                        info.parentId = parentId;
                    }
                    //4、保存操作
                    platformClientUtil.getFrameworkService().saveDepartment(
                            info,
                            userEntityInfo
@@ -900,7 +932,23 @@
        return BaseResult.success("部门导入成功!");
    }
    public Map<String, OrgDepartmentVO> convertToMap(List<OrgDepartmentVO> orgDepartmentVOList) {
    /**
     * èŽ·å–æ‰€æœ‰éƒ¨é—¨çš„ä¿¡æ¯
     * @return key:部门由名称组成的路径(/间隔),value对应最小层级的部门信息
     */
    @Override
    public Map<String, OrgDepartmentVO> getDeptAllTreeMap() {
        List<OrgDepartmentVO> orgDepartmentVOList = listAllLevelChildrenDeptByParentOid(null, null);
        Map<String, OrgDepartmentVO> stringOrgDepartmentVOMap = convertToMap(orgDepartmentVOList);
        return stringOrgDepartmentVOMap;
    }
    /**
     * èŽ·å–éƒ¨é—¨ç”±åç§°ç»„æˆçš„è·¯å¾„ï¼ˆ/间隔),value对应最小层级的部门信息
     * @param orgDepartmentVOList
     * @return
     */
    private Map<String, OrgDepartmentVO> convertToMap(List<OrgDepartmentVO> orgDepartmentVOList) {
        Map<String, OrgDepartmentVO> map = new HashMap<>();
        for (OrgDepartmentVO orgDepartmentVO : orgDepartmentVOList) {
            String key = buildKey(orgDepartmentVO, orgDepartmentVOList);
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java
@@ -8,9 +8,11 @@
import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI;
import com.vci.constant.FrameWorkBtmTypeConstant;
import com.vci.dto.SmRoleDTO;
import com.vci.frameworkcore.compatibility.SmUserQueryServiceI;
import com.vci.frameworkcore.enumpck.RoleClassifyEnum;
import com.vci.frameworkcore.enumpck.RoleControlAreaEnum;
import com.vci.model.SmRoleForPlatform1;
import com.vci.pagemodel.SmUserVO;
import com.vci.po.SmRolePO;
import com.vci.pagemodel.SmRoleVO;
import com.vci.omd.utils.ObjectTool;
@@ -34,6 +36,7 @@
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;
@@ -56,6 +59,13 @@
     */
    @Autowired
    private WebBoServiceI boService;
    /**
     * ç”¨æˆ·æŸ¥è¯¢æœåŠ¡
     */
    @Autowired
    @Lazy
    private SmUserQueryServiceI smUserQueryServiceI;
    /**
     * å¹³å°è°ƒç”¨å®¢æˆ·ç«¯
@@ -679,11 +689,31 @@
    @Override
    public boolean deleteRole(String[] ids) throws PLException {
        VciBaseUtil.alertNotNull(ids,"要删除的角色主键");
        //使用主键判断角色是否被用户引用
        for (int i = 0; i < ids.length; i++) {
            String roleName = this.checkIsUsed(ids[i]);
            if(Func.isNotBlank(roleName)){
                throw new PLException("500",new String[]{"当前选中要删除的角色中存在【"+roleName+"】被引用!"});
            }
        }
        //具备连带删除的功能,如角色菜单授权表里面的授权信息
        return platformClientUtil.getFrameworkService().deleteRole(
                ids,
                new UserEntityInfo(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(), null)
        );
    }
    /**
     * æ£€æŸ¥è§’色是否有在引用
     * @param roleOid
     * @return
     */
    private String checkIsUsed(String roleOid){
        List<SmUserVO> smUserVOS = smUserQueryServiceI.listUserByRoleOid(roleOid, null);
        if (Func.isNotEmpty(smUserVOS)) {
            return this.getRoleNameByRoleOid(roleOid);
        }
        return null;
    }
    /**
@@ -733,8 +763,8 @@
                try {
                    SmRoleDTO smRoleDTO = new SmRoleDTO();
                    BeanUtil.copy(smRolePO,smRoleDTO);
                    //SessionInfo loginUser = WebThreadLocalUtil.getCurrentUserSessionInfoInThread();
                    String userId = "developer";//loginUser.getUserId();
                    SessionInfo loginUser = WebThreadLocalUtil.getCurrentUserSessionInfoInThread();
                    String userId = loginUser.getUserId();
                    //角色类型,这里设置了会在changeRoleObjectToRoleInfo中转换
                    if(UserTypeEnum.SUPPER_ADMIN.getValue().equals("0")){
                        smRoleDTO.setRoleClassify(RoleClassifyEnum.MANAGE.getValue());
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java
@@ -16,7 +16,7 @@
import com.vci.pagemodel.OrgDepartmentVO;
import com.vci.pagemodel.SmPasswordStrategyVO;
import com.vci.pagemodel.SmRoleVO;
import com.vci.frameworkcore.properties.ConfigReader;
import com.vci.frameworkcore.properties.ConfigCorbaReader;
import com.vci.omd.utils.ObjectTool;
import com.vci.starter.poi.bo.ReadExcelOption;
import com.vci.starter.poi.bo.WriteExcelData;
@@ -1322,7 +1322,7 @@
        // è®¾ç½®è¡¨å•列名
        List<String> columns = new ArrayList<>(Arrays.asList("账号", "密码", "姓名", "电子邮箱", "专业", "描述", "部门(上下级部门之间以反斜杠隔开(/))"));
        //获取是否导出密级配置项
        String flag = ConfigReader.getConfigValue("exportSecretGrade");
        String flag = ConfigCorbaReader.getConfigValue("exportSecretGrade");
        if (flag != null && flag.equalsIgnoreCase("true")) {
            columns = new ArrayList<>(Arrays.asList("账号", "密码", "姓名", "电子邮箱", "专业", "描述", "部门(上下级部门之间以反斜杠隔开(/))" ,"密级"));
        }
@@ -1374,7 +1374,7 @@
            String loginUserId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
            UserEntityInfo userEntityInfo = new UserEntityInfo(loginUserId,null);
            //是否导入密级配置
            boolean exportSecretGrade = Boolean.parseBoolean(ConfigReader.getConfigValue("exportSecretGrade"));
            boolean exportSecretGrade = Boolean.parseBoolean(ConfigCorbaReader.getConfigValue("exportSecretGrade"));
            List<SmUserPO> poList = ExcelUtil.readDataObjectFromExcel(file, SmUserPO.class,excelOption,(value, po, fieldName)->{
                Integer secretValue = UserSecretEnum.getSecretValueByText(po.getSecretGradeText());
                //是否必须导入密级
@@ -1398,7 +1398,9 @@
            //当前excel中是否重复用的判重Map:(key:账号,value:行号)
            Map<String, String> excelReapeat = new HashMap<>();
            //先获取全部部门名称的父子对应关系:key为部门子父级名称路径,value为部门信息
            Map<String,OrgDepartmentVO> deptVOMap = orgDeptQueryService.getDeptAllTreeMap();
            List<OrgDepartmentVO> orgDepartmentVOList = orgDeptQueryService.getDeptAllFullName();
            Map<String, OrgDepartmentVO> deptVOMap = orgDepartmentVOList.stream().collect(Collectors.toMap(OrgDepartmentVO::getFullDeptNamePath, s->s));
            //Map<String,OrgDepartmentVO> deptVOMap = orgDeptQueryService.getDeptAllTreeMap();
            //判断必填属性是否为空,用户是否已存在,以及部门是否填错等校验逻辑
            List<String> finalRepeatUserId = repeatUserId;
            poList.stream().forEach(smUserPO -> {
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java
@@ -4,6 +4,7 @@
import com.vci.frameworkcore.compatibility.OrgDeptQueryServiceI;
import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.pagemodel.OrgDepartmentVO;
import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.*;
import com.vci.starter.web.util.ControllerUtil;
@@ -177,6 +178,7 @@
     * @return
     */
    @RequestMapping(value = "/importDept",method = RequestMethod.POST)
    @VciUnCheckRight
    public BaseResult importUser(MultipartFile file){
        String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
        File file1 = new File(excelFileName);
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmPwdStrategyQueryController.java
@@ -46,7 +46,6 @@
     * @throws VciBaseException æŸ¥è¯¢å‡ºé”™çš„æ—¶å€™ä¼šæŠ›å‡ºå¼‚常,如果是老的项目里不抛出异常
     */
    @RequestMapping(value = "/refDataGrid",method = RequestMethod.GET)
    @VciUnCheckRight
    public BaseResult<SmPasswordStrategyVO> refDataGrid(BaseQueryObject queryObject) throws VciBaseException {
        try {
            DataGrid<SmPasswordStrategyVO> pwdStrategyVODataGrid = pwdStrategyQueryService.refDataGrid(queryObject.getConditionMap(),queryObject.getPageHelper());
@@ -66,7 +65,6 @@
     * @throws VciBaseException
     */
    @RequestMapping(value = "/selectPwdStrategyMap",method = RequestMethod.GET)
    @VciUnCheckRight
    public BaseResult<List<Map<String,String>>> selectPwdStrategyMap(BaseQueryObject queryObject) throws VciBaseException {
        try {
            List<Map<String,String>> pwdStrategyVODataGrid = pwdStrategyQueryService.selectPwdStrategyMap(queryObject.getConditionMap());
@@ -140,7 +138,6 @@
     * @return
     */
    @RequestMapping(value = "/delPasswordStrateg",method = RequestMethod.DELETE)
    @VciUnCheckRight
    public BaseResult delPasswordStrateg(String[] pwdIds){
        try {
            return pwdStrategyQueryService.delPasswordStrateg(pwdIds)
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/properties/ConfigCorbaReader.java
ÎļþÃû´Ó Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/properties/ConfigReader.java ÐÞ¸Ä
@@ -9,13 +9,13 @@
 * @author ludc
 * @date 2024/6/28 23:11
 */
public class ConfigReader {
public class ConfigCorbaReader {
    private static Properties properties;
    static {
        properties = new Properties();
        try (InputStream input = ConfigReader.class.getClassLoader().getResourceAsStream("properties/corba.properties")) {
        try (InputStream input = ConfigCorbaReader.class.getClassLoader().getResourceAsStream("properties/corba.properties")) {
            if (input == null) {
                System.err.println("Unable to find corba.properties");
            } else {
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java
@@ -1,13 +1,30 @@
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.DataGrid;
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;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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;
/**
 * å±žæ€§æŽ§åˆ¶å™¨
@@ -25,12 +42,188 @@
    private OsAttributeServiceI attributeService;
    /**
     * æ—¥å¿—
     */
    private Logger logger = LoggerFactory.getLogger(getClass());
    /**
     * å±žæ€§åˆ—表
     * @param baseQueryObject æŸ¥è¯¢å¯¹è±¡
     * @return å±žæ€§çš„æ˜¾ç¤ºå¯¹è±¡
     */
    @GetMapping("/gridAttribute")
    public DataGrid<OsAttributeVO> gridAttribute(BaseQueryObject baseQueryObject){
       return attributeService.gridAttribute(baseQueryObject);
    @VciUnCheckRight
    public BaseResult<OsAttributeVO> gridAttribute(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataGrid(attributeService.gridAttribute(baseQueryObject));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "属性管理列表查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
    }
}
    /**
     * æ ¹æ®å¤šä¸ªå±žæ€§åç§°æŸ¥è¯¢å±žæ€§
     * @param attrNames
     * @return
     */
    @GetMapping("/getByAttributeNames")
    @VciBusinessLog(operateName = "根据多个属性名称查询属性")
    public BaseResult getByAttributeNames(String[] attrNames){
        try {
            return BaseResult.dataList(attributeService.getByAttributeNames(attrNames));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "属性名查询属性时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * æ·»åŠ å•æ¡å±žæ€§åˆ°å±žæ€§æ± 
     * @param osAttributeDTO
     * @return åˆ—表的内容
     */
    @PostMapping( "/addAttribute")
    @VciBusinessLog(operateName = "添加属性")
    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);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * ä¿®æ”¹å•条属性
     * @param osAttributeDTO
     * @return åˆ—表的内容
     */
    @PutMapping( "/updateAttribute")
    @VciBusinessLog(operateName = "修改属性")
    @VciUnCheckRight
    public BaseResult updateAttribute(@RequestBody OsAttributeDTO osAttributeDTO) {
        try {
            return attributeService.updateAttribute(osAttributeDTO) ? BaseResult.success("属性修改成功!"):BaseResult.fail("属性修改失败!");
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "修改属性时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * åˆ é™¤å±žæ€§
     * @param osAttributeDTOS
     * @return åˆ—表的内容
     */
    @DeleteMapping( "/deleteAttributes")
    @VciBusinessLog(operateName = "删除属性")
    public BaseResult deleteAttributes(@RequestBody List<OsAttributeDTO> osAttributeDTOS) {
        try {
            return attributeService.deleteAttributes(osAttributeDTOS) ? BaseResult.success("属性删除成功!"):BaseResult.fail("属性删除失败!");
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "删除属性时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * æŸ¥çœ‹å±žæ€§çš„使用范围
     * @param attributeName å±žæ€§åç§°
     * @return map对象
     */
    @GetMapping( "/getUsedAttributeList")
    @VciBusinessLog(operateName = "查看属性的使用范围")
    public BaseResult getUsedAttributeList(String attributeName) {
        try {
            return BaseResult.dataList(attributeService.getUsedAttributeList(attributeName));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "获取属性的使用范围时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * å¯¼å‡ºé€‰ä¸­çš„属性
     * @param exportFileName å¯¼å‡ºçš„æ–‡ä»¶å
     * @param attrNames éœ€è¦å¯¼å‡ºçš„属性英文名称
     * @param response
     */
    @GetMapping( "/exportAttributes")
    @VciBusinessLog(operateName = "导出属性")
    public void exportAttributes(String exportFileName,String attrNames, HttpServletResponse response){
        try {
            String excelPath = attributeService.exportAttributes(exportFileName,attrNames);
            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 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/OsLinkTypeController.java
@@ -1,20 +1,24 @@
package com.vci.web.controller;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.ltm.LinkType;
import com.vci.pagemodel.OsBtmTypeAttributeVO;
import com.vci.pagemodel.OsLinkTypeAttributeVO;
import com.vci.pagemodel.OsLinkTypeVO;
import com.vci.starter.web.annotation.controller.VciUnCheckRight;
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.VciBaseUtil;
import com.vci.web.service.OsLinkTypeServiceI;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -34,6 +38,11 @@
    private OsLinkTypeServiceI linkTypeService;
    /**
     * æ—¥å¿—
     */
    private Logger logger = LoggerFactory.getLogger(getClass());
    /**
     * é“¾æŽ¥ç±»åž‹çš„列表
     * @param baseQueryObject æŸ¥è¯¢å¯¹è±¡
     * @return é“¾æŽ¥ç±»åž‹çš„æ˜¾ç¤ºå¯¹è±¡
@@ -41,6 +50,23 @@
    @GetMapping("/gridLinkType")
    public DataGrid<OsLinkTypeVO> gridLinkType(BaseQueryObject baseQueryObject){
        return linkTypeService.gridLinkType(baseQueryObject);
    }
    /**
     * æŸ¥è¯¢æ‰€æœ‰çš„链接类型名称,可用于属性池的连接类型选择时的对话框
     * @return é“¾æŽ¥ç±»åž‹çš„æ˜¾ç¤ºå¯¹è±¡
     */
    @GetMapping("/getAllLtName")
    @VciUnCheckRight
    public BaseResult getAllLtName(){
        try {
            return BaseResult.dataList(linkTypeService.getAllLtName());
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "链接类型列表查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
@@ -93,4 +119,40 @@
            return BaseResult.success();
        }
    }
    /**
     * é“¾æŽ¥ç±»åž‹çš„列表
     *
     * @return é“¾æŽ¥ç±»åž‹çš„æ˜¾ç¤ºå¯¹è±¡
     */
    @GetMapping("/gridLink")
    public BaseResult<List<LinkType>> gridLink(){
        try {
            return linkTypeService.gridLink();
        } catch (PLException e) {
            BaseResult objectBaseResult = new BaseResult<>();
            objectBaseResult.setCode(Integer.parseInt(e.code));
            objectBaseResult.setMsg(Arrays.toString(e.messages));
            return objectBaseResult;
        }
    }
    /**
     * é“¾æŽ¥ç±»åž‹ä¿å­˜
     * linkType é“¾æŽ¥ç±»åž‹çš„保存对象
     * addFlag æ˜¯å¦ä¸ºæ–°å¢ž true新增,false修改
     * @return ä¿å­˜ç»“æžœ
     */
    @GetMapping("/addAndEditLink")
    public BaseResult addAndEditLink(@RequestBody LinkType linkType, Boolean addFlag){
        try {
            return linkTypeService.addAndEditLink(linkType, addFlag);
        } catch (PLException e) {
            BaseResult objectBaseResult = new BaseResult<>();
            objectBaseResult.setCode(Integer.parseInt(e.code));
            objectBaseResult.setMsg(Arrays.toString(e.messages));
            return objectBaseResult;
        }
    }
}
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java
@@ -1,5 +1,7 @@
package com.vci.web.controller;
import com.vci.corba.common.PLException;
import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.annotation.log.VciBusinessLog;
import com.vci.starter.web.enumpck.BooleanEnum;
import com.vci.starter.web.exception.VciBaseException;
@@ -17,6 +19,8 @@
import com.vci.web.service.OsBtmServiceI;
import com.vci.web.service.WebBtmIOServiceI;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;
@@ -26,6 +30,7 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -40,6 +45,11 @@
@VciBusinessLog(modelName="业务类型")
@RestController
public class WebBtmTypeController {
    /**
     * æ—¥å¿—
     */
    private Logger logger = LoggerFactory.getLogger(getClass());
    /**
     * ä¸šåŠ¡ç±»åž‹çš„æœåŠ¡
@@ -71,6 +81,24 @@
        return btmService.referDataGrid(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper());
    }
    /**
     * èŽ·å–åå­—ä»¥filter开始的业务类型(for æŸ¥è¯¢),主要用于属性池的业务类型选择对话框
     * @param btmName æŸ¥è¯¢æ¡ä»¶
     * @return åˆ—表的内容
     */
    @GetMapping( "/getBizTypes")
    @VciBusinessLog(operateName = "业务类型列表(主要用于对话框使用)")
    @VciUnCheckRight
    public BaseResult getBizTypes(String btmName){
        try {
            return BaseResult.dataList(Arrays.asList(btmService.getBizTypes(btmName)));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "获取业务类型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * å‚照的业务类型
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java
@@ -1,22 +1,35 @@
package com.vci.web.controller;
import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.dto.OsEnumDTO;
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.starter.web.pagemodel.DataGrid;
import com.vci.pagemodel.KeyValue;
import com.vci.pagemodel.OsEnumItemVO;
import com.vci.pagemodel.OsEnumVO;
import com.vci.starter.web.util.ControllerUtil;
import com.vci.starter.web.util.LangBaseUtil;
import com.vci.starter.web.util.LocalFileUtil;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.service.OsEnumServiceI;
import com.vci.web.util.Func;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
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;
import java.util.Map;
/**
@@ -46,7 +59,6 @@
     * @return æžšä¸¾çš„下拉值
     */
    @VciBusinessLog(notStore=true,operateName="获取枚举")
    @VciUnCheckRight
    @GetMapping("/getEnum")
    public BaseResult<List<KeyValue>> getEnum(String comboxKey){
        return BaseResult.success(enumService.getEnum(comboxKey));
@@ -87,13 +99,30 @@
    }
    /**
     * æ ¹æ®æžšä¸¾ç±»åž‹èŽ·å–æžšä¸¾
     * @param enumType æŸ¥è¯¢æ¡ä»¶name
     * @return åˆ—表的内容
     */
    @GetMapping( "/getEnumMapByType")
    @VciBusinessLog(operateName = "枚举列表")
    public BaseResult getEnumMapByType(String enumType) {
        try {
            return BaseResult.dataList(enumService.getEnumMapByType(enumType));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "枚举管理列表查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * æžšä¸¾åˆ—表
     * @param enumName æŸ¥è¯¢æ¡ä»¶name
     * @return åˆ—表的内容
     */
    @GetMapping( "/getEnumTypeList")
    @VciBusinessLog(operateName = "枚举列表")
    @VciUnCheckRight
    public BaseResult<List<OsEnumVO>> getEnumTypeList(String enumName) {
        try {
            return BaseResult.dataList(enumService.getEnumTypeList(enumName));
@@ -112,7 +141,6 @@
     */
    @PostMapping( "/addEnumType")
    @VciBusinessLog(operateName = "添加枚举")
    @VciUnCheckRight
    public BaseResult addEnumType(@RequestBody OsEnumDTO osEnumDTO) {
        try {
            return enumService.addEnumType(osEnumDTO) ? BaseResult.success("枚举类型添加成功!"):BaseResult.fail("枚举类型添加失败!");
@@ -131,7 +159,6 @@
     */
    @PutMapping( "/updateEnumType")
    @VciBusinessLog(operateName = "修改枚举")
    @VciUnCheckRight
    public BaseResult updateEnumType(@RequestBody OsEnumDTO osEnumDTO) {
        try {
            return enumService.updateEnumType(osEnumDTO) ? BaseResult.success("枚举类型修改成功!"):BaseResult.fail("枚举类型修改失败!");
@@ -150,7 +177,6 @@
     */
    @DeleteMapping( "/deleteEnumTypes")
    @VciBusinessLog(operateName = "删除枚举")
    @VciUnCheckRight
    public BaseResult deleteEnumTypes(@RequestBody List<OsEnumDTO> osEnumDTOS) {
        try {
            return enumService.deleteEnumTypes(osEnumDTOS) ? BaseResult.success("枚举类型删除成功!"):BaseResult.fail("枚举类型删除失败!");
@@ -164,12 +190,11 @@
    /**
     * æŸ¥çœ‹æžšä¸¾çš„使用范围
     * @param enumName
     * @return åˆ—表的内容
     * @param enumName æžšä¸¾åç§°
     * @return map对象
     */
    @GetMapping( "/getUsedEnumList")
    @VciBusinessLog(operateName = "查看枚举的使用范围")
    @VciUnCheckRight
    public BaseResult getUsedEnumList(String enumName) {
        try {
            return BaseResult.dataList(enumService.getUsedEnumList(enumName));
@@ -181,4 +206,74 @@
        }
    }
    /**
     * å¯¼å‡ºé€‰ä¸­çš„æžšä¸¾ç±»åž‹
     * @param exportFileName å¯¼å‡ºçš„æ–‡ä»¶å
     * @param enumNames éœ€è¦å¯¼å‡ºçš„æžšä¸¾åç§°
     * @param response
     */
    @GetMapping( "/exportEnumTypes")
    @VciBusinessLog(operateName = "导出枚举类型")
    public void exportEnumTypes(String exportFileName,String enumNames, HttpServletResponse response){
        try {
            String excelPath = enumService.exportEnumTypes(exportFileName,enumNames);
            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 exportFileName
     * @param response
     */
    @GetMapping( "/downloadEnumTemplate")
    @VciBusinessLog(operateName = "导出枚举类型")
    public void downloadEnumTemplate(String exportFileName, HttpServletResponse response){
        try {
            String excelPath = enumService.downloadEnumTemplate(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
     */
    @RequestMapping(value = "/importEnumTypes",method = RequestMethod.POST)
    public BaseResult importEnumTypes(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 enumService.importEnumTypes(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/properties/UsedNames.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,38 @@
package com.vci.web.properties;
import java.io.IOException;
import java.io.InputStream;
import java.util.PropertyResourceBundle;
import com.vci.client.common.ClientLog4j;
public class UsedNames {
    private static PropertyResourceBundle resourceBundle = null;
    static{
        try{
            if(resourceBundle == null){
                InputStream ins = UsedNames.class.getClassLoader().getResourceAsStream("properties/usedNames.properties");
                if(ins != null){
                    resourceBundle = new PropertyResourceBundle(ins);
                }
            }
        }catch(IOException e){
            //e.printStackTrace();
            ClientLog4j.logger.error(e);
        }catch(Exception e){
            //e.printStackTrace();
            ClientLog4j.logger.error(e);
        }
    }
    public static String getProperty(String strKey){
        try{
            return resourceBundle.getString(strKey);
        }catch(Exception e){
            //e.printStackTrace();
            ClientLog4j.logger.error(e);
            return "";
        }
    }
}
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java
@@ -1,10 +1,15 @@
package com.vci.web.service;
import com.vci.corba.common.PLException;
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;
@@ -15,6 +20,7 @@
 * @date 2021-2-15
 */
public interface OsAttributeServiceI extends OsBaseServiceI{
    /**
     * èŽ·å–é»˜è®¤çš„å±žæ€§
     * @return é»˜è®¤çš„属性列表
@@ -32,6 +38,7 @@
     * @return é»˜è®¤çš„属性映射
     */
    Map<String, OsAttributeVO> getDefaultAttributeVOMap();
    /**
     * è®¾ç½®é»˜è®¤çš„属性的映射
     * @param defaultAttributeVOMap é»˜è®¤çš„属性映射
@@ -49,6 +56,13 @@
     * @return key是属性的英文名称小写,value是属性的显示对象
     */
    Map<String,OsAttributeVO> selectAllAttributeMap();
    /**
     * æ ¹æ®å¤šä¸ªå±žæ€§åç§°æŸ¥è¯¢å±žæ€§
     * @param attrNames
     * @return
     */
    List<OsAttributeVO> getByAttributeNames(String[] attrNames) throws PLException;
    /**
     * å±žæ€§çš„æ•°æ®å¯¹è±¡è½¬æ¢ä¸ºæ˜¾ç¤ºå¯¹è±¡
@@ -104,6 +118,56 @@
     */
    DataGrid<OsAttributeVO> gridAttribute(BaseQueryObject baseQueryObject);
    /**
     * æ·»åŠ å•æ¡å±žæ€§
     * @param osAttributeDTO
     * @return true成功,false失败
     */
    boolean addAttribute(OsAttributeDTO osAttributeDTO) throws PLException;
    /**
     * ä¿®æ”¹å•条属性
     * @param osAttributeDTO
     * @return true成功,false失败
     */
    boolean updateAttribute(OsAttributeDTO osAttributeDTO) throws PLException;
    /**
     * åˆ é™¤å±žæ€§
     * @param osAttributeDTOS
     * @return true成功,false失败
     */
    boolean deleteAttributes(List<OsAttributeDTO> osAttributeDTOS) throws PLException;
    /**
     * æŸ¥çœ‹å±žæ€§çš„使用范围
     * @param attributeName
     * @return key:属性 ï¼Œvalue使用该属性的业务类型
     */
    List<Map<String,String>> getUsedAttributeList(String attributeName) throws PLException;
    /**
     * å¯¼å‡ºé€‰ä¸­çš„属性
     * @param exportFileName å¯¼å‡ºçš„æ–‡ä»¶å
     * @param attrNames éœ€è¦å¯¼å‡ºçš„属性名称
     * @return
     */
    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;
    /**
     * æ˜¯å¦é»˜è®¤çš„属性
@@ -111,4 +175,5 @@
     * @return true表示是默认属性
     */
    boolean isDefaultAttr(String attr);
}
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBaseServiceI.java
@@ -1,5 +1,6 @@
package com.vci.web.service;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.data.BusinessObject;
import com.vci.starter.web.pagemodel.BaseQueryObject;
import com.vci.starter.web.pagemodel.DataGrid;
@@ -142,6 +143,5 @@
        }
        return dataGrid;
    }
}
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java
@@ -1,5 +1,6 @@
package com.vci.web.service;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.btm.BizType;
import com.vci.pagemodel.OsBtmTypeAttributeVO;
import com.vci.pagemodel.OsBtmTypeVO;
@@ -20,12 +21,37 @@
public interface OsBtmServiceI extends OsBaseServiceI{
    /**
     * ä¿®æ”¹ä¸šåŠ¡ç±»åž‹ä¸­å¯¹åº”å±žæ€§åçš„å±žæ€§
     * @param apName
     * @return
     * @throws PLException
     */
    boolean alterAp(String apName) throws PLException;
    /**
     * åˆ¤æ–­è¯¥å±žæ€§æ˜¯å¦å·²ç»åœ¨ä¸šåŠ¡ç±»åž‹ä¸­äº§ç”Ÿäº†æ•°æ®
     * @param abName
     * @return
     * @throws PLException
     */
    boolean hasInstance(String abName) throws PLException;
    /**
     * æŸ¥è¯¢æ‰€æœ‰çš„业务类型
     * @return ä¸šåŠ¡ç±»åž‹å¯¹è±¡
     */
    List<OsBtmTypeVO> selectAllBtm();
    /**
     * èŽ·å–åå­—ä»¥filter开始的业务类型(for æŸ¥è¯¢),主要用于属性池的业务类型选择对话框
     * èŽ·å–å…¨éƒ¨ä¸šåŠ¡ç±»åž‹ï¼Œä¼ å‚filter为""
     * @param btmName
     * @return
     * @throws PLException
     */
    BizType[] getBizTypes(String btmName) throws PLException;
    /**
     * æŸ¥è¯¢æ‰€æœ‰çš„业务类型映射
     * @return key æ˜¯ä¸šåŠ¡çš„è‹±æ–‡åç§°çš„å°å†™
     */
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsEnumServiceI.java
@@ -3,12 +3,15 @@
import com.vci.corba.omd.etm.EnumType;
import com.vci.dto.OsEnumDTO;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.pagemodel.PageHelper;
import com.vci.pagemodel.KeyValue;
import com.vci.pagemodel.OsEnumItemVO;
import com.vci.pagemodel.OsEnumVO;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -69,11 +72,11 @@
    /**
     * æŸ¥çœ‹æžšä¸¾çš„使用范围
     * @param enumName
     * @param enumName æžšä¸¾åç§°
     * @return
     * @throws PLException
     */
    List<OsEnumVO> getUsedEnumList(String enumName) throws PLException;
    List<Map<String,String>> getUsedEnumList(String enumName) throws PLException;
    /**
     * æ ¹æ®æžšä¸¾è‹±æ–‡åç§°èŽ·å–æžšä¸¾ç±»åž‹
@@ -102,6 +105,29 @@
     * @return
     */
    boolean deleteEnumTypes(List<OsEnumDTO> osEnumDTOS) throws PLException;
    /**
     * å¯¼å‡ºæžšä¸¾ç±»åž‹
     * @param exportFileName å¯¼å‡ºçš„æ–‡ä»¶å
     * @param enumNames éœ€è¦å¯¼å‡ºçš„æžšä¸¾åç§°
     * @return
     */
    String exportEnumTypes(String exportFileName,String enumNames) throws PLException;
    /**
     * å¯¼å…¥æžšä¸¾
     * @param file
     * @return
     * @throws Exception
     */
    BaseResult importEnumTypes(File file) throws Exception;
    /**
     * ä¸‹è½½å¯¼å…¥æ¨¡æ¿
     * @param exportFileName
     * @return
     */
    String downloadEnumTemplate(String exportFileName);
    /**
     * æŸ¥è¯¢æ‰€æœ‰çš„æžšä¸¾æ˜ å°„
@@ -178,4 +204,12 @@
     * @return æžšä¸¾é€‰é¡¹
     */
    DataGrid<OsEnumItemVO> gridEnumItemByOid(String pkEnum);
    /**
     * æ ¹æ®æžšä¸¾ç±»åž‹æŸ¥è¯¢æžšä¸¾ï¼šæžšä¸¾å , æžšä¸¾
     * @param enumType:String, Integer
     * @return
     */
    List<Map<String,List<String>>> getEnumMapByType(String enumType);
}
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java
@@ -1,7 +1,9 @@
package com.vci.web.service;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.ltm.LinkType;
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.OsBtmTypeAttributeVO;
import com.vci.pagemodel.OsLinkTypeAttributeVO;
@@ -17,6 +19,28 @@
 * @date 2021-2-15
 */
public interface OsLinkTypeServiceI extends OsBaseServiceI{
    /**
     * ä¿®æ”¹ä¸šåŠ¡ç±»åž‹ä¸­å¯¹åº”å±žæ€§åçš„å±žæ€§
     * @param apName
     * @return
     * @throws PLException
     */
    boolean alterAp(String apName) throws PLException;
    /**
     * åˆ¤æ–­è¯¥å±žæ€§æ˜¯å¦å·²ç»åœ¨é“¾æŽ¥ç±»åž‹ä¸­äº§ç”Ÿäº†æ•°æ®
     * @param abName
     * @return
     * @throws PLException
     */
    boolean hasInstance(String abName) throws PLException;
    /**
     * èŽ·å–è¿žæŽ¥ç±»åž‹åç§°é›†åˆ
     * @return
     */
    List<String> getAllLtName() throws PLException;
    /**
     * æŸ¥è¯¢æ‰€æœ‰çš„链接类型
@@ -85,4 +109,17 @@
     * @return æœ‰é”™è¯¯çš„属性
     */
    List<OsBtmTypeAttributeVO> checkAttributeTypeDifferent(String linkTypeOid);
    /**
     * é“¾æŽ¥ç±»åž‹çš„列表
     *
     * @return é“¾æŽ¥ç±»åž‹çš„æ˜¾ç¤ºå¯¹è±¡
     */
    BaseResult<List<LinkType>> gridLink() throws PLException;
    /**
     * é“¾æŽ¥ç±»åž‹ä¿å­˜
     * linkType é“¾æŽ¥ç±»åž‹çš„保存对象
     * addFlag æ˜¯å¦ä¸ºæ–°å¢ž true新增,false修改
     * @return ä¿å­˜ç»“æžœ
     */
    BaseResult addAndEditLink(LinkType linkType, Boolean addFlag) throws PLException;
}
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
@@ -1,27 +1,57 @@
package com.vci.web.service.impl;
import com.vci.client.common.datatype.VTDouble;
import com.vci.client.common.datatype.VTInteger;
import com.vci.client.common.datatype.VTLong;
import com.vci.client.common.datatype.VTString;
import com.vci.client.mw.ClientSessionUtility;
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.VciBaseUtil;
import com.vci.starter.web.util.VciDateUtil;
import com.vci.starter.web.util.*;
import com.vci.model.OsAttributeDO;
import com.vci.pagemodel.OsAttributeVO;
import com.vci.web.properties.UsedNames;
import com.vci.web.service.OsAttributeServiceI;
import com.vci.web.service.OsBaseServiceI;
import com.vci.web.service.OsLinkTypeServiceI;
import com.vci.web.util.Func;
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.*;
import java.io.File;
import java.util.*;
import java.util.List;
import java.util.stream.Collectors;
//import static com.vci.client.omd.attribpool.ui.VTDataTypePanel.*;
@@ -52,6 +82,40 @@
    @Autowired(required = false)
    @Lazy
    private OsAttributeServiceI self;
    /**
     * å±žæ€§åç§°æœ€å¤§é•¿åº¦
     */
    private Integer NAME_MAX_LENGTH = 28;
    /**
     * ç³»ç»Ÿä¸­å˜é‡é…ç½®æ–‡ä»¶ä¸­é…ç½®çš„key
     */
    private final String SYSUSEDNAMES = "sysUsedNames";
    /**
     * æ•°æ®åº“中关键字配置文件中配置的key
     */
    private final String DATABASEUSEDNAMES = "dataBaseUsedNames";
    /**
     * é“¾æŽ¥ç±»åž‹æœåŠ¡
     */
    @Autowired(required = false)
    @Lazy
    private OsLinkTypeServiceI osLinkTypeServiceI;
    /**
     * ä¸šåŠ¡ç±»åž‹æœåŠ¡
     */
    @Autowired(required = false)
    @Lazy
    private OsBtmServiceImpl osBtmService;
    /**
     *  å¿…填列
     */
    private List<Integer> ColumnNameisRed = new ArrayList<Integer>();
    /**
     * é»˜è®¤çš„属性
@@ -126,6 +190,26 @@
    }
    /**
     * æ ¹æ®å¤šä¸ªå±žæ€§åç§°æŸ¥è¯¢å±žæ€§
     * @param attrNames
     * @return
     */
    @Override
    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));
                });
            }
        }
        return osAttributeVOS;
    }
    /**
     * å±žæ€§çš„æ•°æ®å¯¹è±¡è½¬æ¢ä¸ºæ˜¾ç¤ºå¯¹è±¡
     *
     * @param attribItems æ•°æ®å¯¹è±¡
@@ -154,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){
@@ -166,7 +250,13 @@
            attributeVO.setAttributeDataType(attribItem.vtDataType);
            attributeVO.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(attribItem.vtDataType));
            attributeVO.setDefaultValue(attribItem.defValue);
            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)) {
                if (isReferAttr(attribItem.other)) {
                    //说明这个的确是参照字段
@@ -176,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()));
                        }
                    }
                }
                //必输和长度
@@ -364,6 +460,605 @@
    }
    /**
     * æ·»åŠ å•æ¡å±žæ€§
     * @param osAttributeDTO
     * @return true成功,false失败
     */
    @Override
    public boolean addAttribute(OsAttributeDTO osAttributeDTO) throws PLException {
        //判空
        VciBaseUtil.alertNotNull(
        osAttributeDTO,"创建的属性对象",
            osAttributeDTO.getId(),"属性名称",
            osAttributeDTO.getAttributeDataType(),"属性类型"
        );
        //属性英文名称校验(判空、系统中判重、是否关键字、是否合规等)
        checkName(osAttributeDTO.getId());
        //检查默认值与属性类型是否匹配
        checkDefValue(osAttributeDTO);
        //dto对象转换为存储所需对象
        osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
        AttributeDef attributeDef = this.osAttributeDTO2AttributeDef(osAttributeDTO);
        return platformClientUtil.getAttributeService().addAttributeDef(attributeDef);
    }
    /**
     * ä¿®æ”¹å•条属性
     * @param osAttributeDTO
     * @return true成功,false失败
     */
    @Override
    public boolean updateAttribute(OsAttributeDTO osAttributeDTO) throws PLException {
        //判空
        VciBaseUtil.alertNotNull(
                osAttributeDTO,"修改的属性对象",
                osAttributeDTO.getId(),"属性名称",
                osAttributeDTO.getTs(),"事务TS",
                osAttributeDTO.getAttributeDataType(),"属性类型"
        );
        //名称不允许修改所以不用查重
        //但是需要检查属性是否存在
        OsAttributeVO osAttributeVO = getByAttributeNames(new String[]{osAttributeDTO.getId()}).get(0);
        if(Func.isEmpty(osAttributeVO) || Func.isBlank(osAttributeVO.getOid())){
            throw new PLException("500",new String[]{"属性在系统中不存在,请刷新后重试!"});
        }
        //检查默认值与属性类型是否匹配
        checkDefValue(osAttributeDTO);
        boolean compatible = isCompatible(osAttributeVO,osAttributeDTO);
        boolean hasInstance = hasInstance(osAttributeDTO.getName());
        //产生数据, å¹¶ä¸”不兼容
        if(hasInstance && !compatible){
            throw new PLException("500",new String[]{"无效变更, ä¸å…¼å®¹å·²äº§ç”Ÿçš„æ•°æ®ï¼"});
        }
        String userId = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
        osAttributeDTO.setLastModifier(userId);
        osAttributeDTO.setCreator(osAttributeVO.getCreator());
        osAttributeDTO.setCreateTime(osAttributeVO.getCreateTime());
        osAttributeDTO.setLastModifyTime(new Date());
        try {
            AttributeDef attributeDef = this.osAttributeDTO2AttributeDef(osAttributeDTO);
            boolean mdSuccess = platformClientUtil.getAttributeService().modifyAttributeDef(attributeDef);
            if(!mdSuccess){
                return false;
            }
            //属性修改成功,修改业务类型, é“¾æŽ¥ç±»åž‹ä¸­è¯¥å±žæ€§å­—段
            boolean alterApBoolean = this.alterAp(attributeDef.name);
            if(!alterApBoolean){
                logger.error("属性修改完成,但在调整业务类型或链接类型中对应属性名的属性时出现错误!");
                throw new PLException("500",new String[]{"属性修改完成,但在调整业务类型或链接类型中对应属性名的属性时出现错误!"});
            }
            return true;
        } catch (PLException e1) {
            e1.printStackTrace();
        }
        return false;
    }
    /**
     * DTO对象转实际存储所需的AttributeDef对象
     * @param osAttributeDTO
     * @return
     */
    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();
        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 = "developer";//Func.isBlank(osAttributeDTO.getLastModifier()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getLastModifier();
        attributeDef.modifyTime = System.currentTimeMillis();
        //other需要自行处理
        StringBuffer sb = new StringBuffer();
        sb.append(ALLOWNULL).append(" = ").append(osAttributeDTO.isNullableFlag() ? "yes" : "no").append(";");
        VciFieldTypeEnum fieldTypeEnum = VciFieldTypeEnum.valueOf(osAttributeDTO.getAttributeDataType());
        String[] otherInfos = attributeDef.other.split(";");
        int length = 0;
        if(otherInfos!=null&& otherInfos.length > 0){
            for(String s : otherInfos){
                if(s.contains(LENGTH+" =") || s.contains(LENGTH+"=")){
                    length = VciBaseUtil.getInt(s.split("=")[1]);
                    break;
                }
            }
        }
        switch (fieldTypeEnum) {
            case VTDouble:
                if(osAttributeDTO.getAttrLength() == null){
                    osAttributeDTO.setAttrLength(20);
                }
                if(osAttributeDTO.getPrecisionLength() == null){
                    osAttributeDTO.setPrecisionLength(2);
                }
                sb.append(ACCURACY).append(" = ").append(osAttributeDTO.getPrecisionLength()).append(";");
                sb.append(LENGTH).append(" = ").append(length > osAttributeDTO.getAttrLength()?length:osAttributeDTO.getAttrLength()).append(";");
                break;
            case VTInteger:
                if (StringUtils.isNotBlank(osAttributeDTO.getEnumId())) {
                    sb.append(ENUMNAME).append(" = ").append(osAttributeDTO.getEnumId()).append(";");
                }
                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())) {
                    sb.append(ENUMNAME).append(" = ").append(osAttributeDTO.getEnumId()).append(";");
                }
                break;
            default:
                //不需要处理
                break;
        }
        attributeDef.other = sb.toString();
        if (attributeDef.other.endsWith(";")) {
            attributeDef.other = attributeDef.other.substring(0, attributeDef.other.length() - 1);
        }
        return attributeDef;
    }
    /**
     * ä¿®æ”¹å±žæ€§æ—¶, åˆ¤æ–­å½“前输入的属性是否能兼容之前的属性
     * @param osAttributeVO æ•°æ®åº“中存储的
     * @param osAttributeDTO ä¿®æ”¹åŽçš„内容
     * @return
     */
    private boolean isCompatible(OsAttributeVO osAttributeVO/*数据库中存储的*/,OsAttributeDTO osAttributeDTO/*修改后的内容*/){
        String dataType = osAttributeVO.getAttributeDataType();
        //String other = osAttributeVO.getOther();
        //String newOther = abItem.other == null ? "" : abItem.other;
        String newType = osAttributeDTO.getAttributeDataType();
        if(newType.equals(VTDataType.VTSTRING)){
            if(dataType.equals(VTDataType.VTINTEGER) || dataType.equals(VTDataType.VTLONG)){
                return true;
            }
            if(dataType.equals(VTDataType.VTSTRING)){
                int length = osAttributeVO.getAttrLength();//Integer.valueOf(getOtherValueByType(other, "length"));
                int newLen = osAttributeDTO.getAttrLength();//Integer.valueOf(getOtherValueByType(newOther, "length"));
                if(length <= newLen){
                    return true;
                }else{
                    return false;
                }
            }
        }
        if(newType.equals(dataType)){
            return true;
        }
        return false;
    }
    /**
     * åˆ¤æ–­è¯¥å±žæ€§æ˜¯å¦å·²ç»åœ¨ä¸šåŠ¡ç±»åž‹ä¸­, æˆ–者链接类型中产生了数据
     * @param abName
     * @return
     */
    private boolean hasInstance(String abName) throws PLException {
        return osBtmService.hasInstance(abName) && osLinkTypeServiceI.hasInstance(abName);
    }
    /**
     * æ£€æŸ¥å±žæ€§åç§°æ˜¯å¦ç¬¦åˆè§„范
     * @param attributeName
     * @return æ²¡æœ‰è¿”回值,存在问题直接抛出错误
     */
    private void checkName(String attributeName) throws PLException {
        if(attributeName.equals("")){
            throw new PLException("500",new String[]{"注意,属性名不能为空!"});
        }
        if(!attributeName.matches("[a-z A-Z]*")){
            throw new PLException("500",new String[]{"注意:属性名只能为英文字母!"});
        }
        int length = attributeName.length();
        if(length > NAME_MAX_LENGTH){
            throw new PLException("500",new String[]{"属性名过长,属性名长度不能超过"+ NAME_MAX_LENGTH});
        }
        String abName = attributeName.toLowerCase();
        //检查属性名是否是为系统基础属性,如createTime,ts,oid等
        if(usedBySystem(abName)){
            throw new PLException("500",new String[]{"属性名无效,原因:属性名已被系统属性使用!"});
        }
        //检查属性名是否是关键字
        if(usedByDataBase(abName)){
            throw new PLException("500",new String[]{"属性名无效,原因:属性名是数据库关键字!"});
        }
        //检查属性名是否已存在与系统中
        if(platformClientUtil.getAttributeService().checkRowIsExists(abName)){
            throw new PLException("500",new String[]{"属性名称在系统中已存在!"});
        }
    }
    /**
     * æ£€æŸ¥é»˜è®¤å€¼ä¸Žå±žæ€§ç±»åž‹æ˜¯å¦åŒ¹é…
     * @param osAttributeDTO
     * @return
     */
    private void checkDefValue(OsAttributeDTO osAttributeDTO) throws PLException {
        String defValue = osAttributeDTO.getDefaultValue();
        String vtType = osAttributeDTO.getAttributeDataType();
        String rages = osAttributeDTO.getRange();
        if(defValue != null && !defValue.equals("")){
            if(vtType.equals(VTDataType.VTSTRING)){
                try{
                    String.valueOf(defValue);
                }catch(Exception e){
                    throw new PLException("500",new String[]{"请输入String类型的默认值!"});
                }
                if(rages == null || rages.equals("")){
                    return;
                }
                VTString obj = new VTString(String.valueOf(defValue));
                boolean flag = obj.checkRageValueByRage(rages);
                if(!flag){
                    throw new PLException("500",new String[]{"默认值与值域冲突!"});
                }
            }else if(vtType.equals(VTDataType.VTINTEGER)){
                try{
                    Integer.valueOf(defValue);
                }catch(Exception e){
                    throw new PLException("500",new String[]{"请输入Integer类型的默认值!"});
                }
                if(rages == null || rages.equals("")){
                    return;
                }
                VTInteger obj = new VTInteger(Integer.valueOf(defValue));
                boolean flag = obj.checkRageValueByRage(rages);
                if(!flag){
                    throw new PLException("500",new String[]{"默认值与值域冲突!"});
                }
            }else if(vtType.equals(VTDataType.VTLONG)){
                try{
                    Long.valueOf(defValue);
                }catch(Exception e){
                    throw new PLException("500",new String[]{"请输入Long类型的默认值!"});
                }
                if(rages == null || rages.equals("")){
                    return;
                }
                VTLong obj = new VTLong(Long.valueOf(defValue));
                boolean flag = obj.checkRageValueByRage(rages);
                if(!flag){
                    throw new PLException("500",new String[]{"默认值与值域冲突!"});
                }
            }else if(vtType.equals(VTDataType.VTDOUBLE)){
                try{
                    Double.valueOf(defValue);
                }catch(Exception e){
                    throw new PLException("500",new String[]{"请输入Double类型的默认值!"});
                }
                if(rages == null || rages.equals("")){
                    return;
                }
                VTDouble obj = new VTDouble(Double.valueOf(defValue));
                boolean flag = obj.checkRageValueByRage(rages);
                if(!flag){
                    throw new PLException("500",new String[]{"默认值与值域冲突!"});
                }
            }
        }
    }
    /**
     * æ£€æŸ¥è¯¥å±žæ€§åæ˜¯å¦è¢«ç³»ç»Ÿå±žæ€§ä½¿ç”¨
     * @param abName
     * @return
     */
    private boolean usedBySystem(String abName) {
        boolean flag = false;
        String[] names = UsedNames.getProperty(SYSUSEDNAMES).toUpperCase().split(",");
        List<String> nameList = Arrays.asList(names);
        if(nameList.contains(abName.toUpperCase())){
            flag = true;
        }
        return flag;
    }
    /**
     * æ£€æŸ¥è¯¥å±žæ€§åæ˜¯å¦å±žäºŽæ•°æ®åº“关键字
     * @param abName
     * @return
     */
    private boolean usedByDataBase(String abName){
        boolean flag = false;
        String[] names = UsedNames.getProperty(DATABASEUSEDNAMES).toUpperCase().split(",");
        List<String> nameList = Arrays.asList(names);
        if(nameList.contains(abName.toUpperCase())){
            flag = true;
        }
        return flag;
    }
    /**
     * åˆ é™¤å±žæ€§
     * @param osAttributeDTOS
     * @return true成功,false失败
     */
    @Override
    public boolean deleteAttributes(List<OsAttributeDTO> osAttributeDTOS) throws PLException {
        VciBaseUtil.alertNotNull(osAttributeDTOS,"待删除的属性列表");
        //平台的deleteEnumTypes方法必传三个参数,oid、name和ts
        List<AttributeDef> attributeDefs = new ArrayList<>();
        for(OsAttributeDTO osAttributeDTO : osAttributeDTOS){
            //oid和ts判空
            String oid = osAttributeDTO.getOid();
            //name主要用来对缓存数据删除
            String name = osAttributeDTO.getName();
            Date ts = osAttributeDTO.getTs();
            if(Func.isBlank(oid) || Func.isBlank(name) || Func.isEmpty(ts)){
                throw new PLException("500",new String[]{"待删除的属性列表中主键【oid】、调整时间【ts】、属性名【name】不能为空!"});
            }
            //判断枚举是否有被引用
            List<Map<String, String>> usedAttrList = this.getUsedAttributeList(name);
            if(Func.isNotEmpty(usedAttrList)){
                throw new PLException("500",new String[]{"删除的属性中,属性名称为:【" + name + "】,已被引用!"});
            }
            AttributeDef attributeDef = new AttributeDef();
            attributeDef.oid = oid;
            attributeDef.name = name;
            attributeDef.ts = Func.format(ts,VciDateUtil.DateTimeMillFormat);
            attributeDefs.add(attributeDef);
        }
        if(Func.isEmpty(attributeDefs)){
            return false;
        }
        return platformClientUtil.getAttributeService().deleteAttributeDefs(attributeDefs.toArray(new AttributeDef[attributeDefs.size()]));
    }
    /**
     * æŸ¥çœ‹å±žæ€§çš„使用范围
     * @param attributeName
     * @return key:属性 ï¼Œvalue使用该属性的业务类型
     */
    @Override
    public List<Map<String, String>> getUsedAttributeList(String attributeName) throws PLException {
        if(Func.isBlank(attributeName)){
            throw new PLException("500",new String[]{"请选择要查询应用范围的属性!"});
        }
        String[] btNames = platformClientUtil.getBtmService().getBTNamesByAPName(attributeName);
        if(Func.isEmpty(btNames)){
            return new ArrayList<>();
        }
        List<Map<String,String>> btmNameMapList = new ArrayList<>();
        Arrays.stream(btNames).forEach(btName->{
            Map<String, String> itemMap = new HashMap<>();
            itemMap.put("attributeName",attributeName);
            itemMap.put("source",btName);
            btmNameMapList.add(itemMap);
        });
        return btmNameMapList;
    }
    /**
     * å¯¼å‡ºé€‰ä¸­çš„属性
     * @param exportFileName å¯¼å‡ºçš„æ–‡ä»¶å
     * @param attrNames éœ€è¦å¯¼å‡ºçš„属性名称
     * @return
     */
    @Override
    public String exportAttributes(String exportFileName, String attrNames) throws PLException {
        if(Func.isBlank(attrNames)){
            throw new PLException("500",new String[]{"请勾选要导出的属性!"});
        }
        //界面没传名称,使用默认导出名称
        exportFileName = Func.isBlank(exportFileName) ?  "属性池中属性导出_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
        //设置列名
        List<String> columns = new ArrayList<>(
                Arrays.asList("属性名", "标签", "描述",
                        "属性类型", "允许为空", "默认值", "使用的枚举英文名称(枚举名)",
                        "使用的枚举中文名称(标签)", "参照的业务类型编号", "参照的业务类型名称",
                        "参照的链接类型名称","版本版次","属性长度", "小数精度位数","小数刻度位数","取值范围","创建时间")
        );
        //写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++) {
            excelDataList.add(new WriteExcelData(0,index, columns.get(index)));
        }
        //按照属性名查询属性,然后处理属性导出
        List<String> enumNameList = Func.toStrList(attrNames);
        List<OsAttributeVO> osAttributeVOS = this.listAttrByIds(enumNameList);
        if(Func.isEmpty(osAttributeVOS)){
            excelDataList.add(new WriteExcelData(1,1, "根据属性名称未查询到属性信息,请刷新后尝试重新导出!"));
        }else{
            //先按照属性类型排序,不同属性类型导出的数据乱的效果
            osAttributeVOS.sort(Comparator.comparing(OsAttributeVO::getAttributeDataType));
            for (int i = 0; i < osAttributeVOS.size(); i++) {
                OsAttributeVO osAttributeVO = osAttributeVOS.get(i);
                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,4, osAttributeVO.isNullableFlag()));
                excelDataList.add(new WriteExcelData(i+1,5, osAttributeVO.getDefaultValue()));
                excelDataList.add(new WriteExcelData(i+1,6, osAttributeVO.getEnumId()));
                excelDataList.add(new WriteExcelData(i+1,7, osAttributeVO.getEnumName()));
                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.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("枚举导入成功!");
    }
    /**
     * æ˜¯å¦é»˜è®¤çš„属性
     *
     * @param attr å±žæ€§ç¼–号
@@ -384,18 +1079,17 @@
     */
    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;
                }
            }
        }
        return false;
    }
    /**
     * æ˜¯å¦ä¸ºæžšä¸¾çš„属性
@@ -416,7 +1110,6 @@
        return false;
    }
    /**
     * æ¸…除缓存
     */
@@ -424,4 +1117,15 @@
    public void clearCache() {
    }
    /**
     * è°ƒç”¨ä¿®æ”¹ä¸šåŠ¡ç±»åž‹å’Œè¿žæŽ¥ç±»åž‹ä¸­å¯¹åº”å±žæ€§åçš„å±žæ€§
     * @param apName
     * @return
     * @throws PLException
     */
    private boolean alterAp(String apName) throws PLException {
        return osBtmService.alterAp(apName) && osLinkTypeServiceI.alterAp(apName);
    }
}
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
@@ -1,7 +1,9 @@
package com.vci.web.service.impl;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.atm.AttributeDef;
import com.vci.corba.omd.btm.BizType;
import com.vci.corba.omd.ltm.LinkType;
import com.vci.pagemodel.*;
import com.vci.starter.web.annotation.log.VciUnLog;
import com.vci.starter.web.enumpck.BooleanEnum;
@@ -336,6 +338,88 @@
    }
    /**
     * ä¿®æ”¹ä¸šåŠ¡ç±»åž‹ä¸­å¯¹åº”å±žæ€§åçš„å±žæ€§
     * @param apName
     * @return
     * @throws PLException
     */
    @Override
    public boolean alterAp(String apName) throws PLException {
        String[] btmNames = null;
        List<String> btmNameList = new ArrayList<String>();
        AttributeDef abItem = null;
        try {
            abItem = platformClientUtil.getAttributeService().getAttributeDefByName(apName);
        } catch (PLException e1) {
            e1.printStackTrace();
        }
        if(abItem == null || abItem.equals("")){
            return true;
        }
        try {
            btmNames = platformClientUtil.getBtmService().getBTNamesByAPName(apName);
        } catch (PLException e) {
            e.printStackTrace();
        }
        if(btmNames == null || btmNames.length <= 0){
            return true;
        }
        btmNameList = Arrays.asList(btmNames);
        for(Iterator<String> i = btmNameList.iterator(); i.hasNext();){
            String btmName = i.next();
            try {
                platformClientUtil.getBtmService().modifyBTAttribute(btmName, apName);
            } catch (PLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                String erreMsg = "调整业务类型中【"+apName+"】属性时出现错误,原因:"+e.getMessage();
                logger.error(erreMsg);
                throw new PLException("500",new String[]{erreMsg});
            }
        }
        return false;
    }
    /**
     * åˆ¤æ–­è¯¥å±žæ€§æ˜¯å¦å·²ç»åœ¨ä¸šåŠ¡ç±»åž‹ä¸­äº§ç”Ÿäº†æ•°æ®
     * @param abName
     * @return
     * @throws PLException
     */
    @Override
    public boolean hasInstance(String abName) throws PLException {
        String[] btmNames = platformClientUtil.getBtmService().getBTNamesByAPName(abName);
        if(btmNames == null || btmNames.length == 0){
            return false;
        }
        for(int i = 0; i < btmNames.length; i++){
            String btmName = btmNames[i];
            boolean flag;
            flag = platformClientUtil.getBtmService().hasData(btmName);
            if(flag){
                return flag;
            }
        }
        return false;
    }
    /**
     * èŽ·å–åå­—ä»¥filter开始的业务类型(for æŸ¥è¯¢),主要用于属性池的业务类型选择对话框
     * èŽ·å–å…¨éƒ¨ä¸šåŠ¡ç±»åž‹ï¼Œä¼ å‚filter为""
     * @param btmName
     * @return
     * @throws PLException
     */
    @Override
    public BizType[] getBizTypes(String btmName) throws PLException {
        if(null == btmName){
            btmName = "";
        }
        return platformClientUtil.getBtmService().getBizTypes(btmName);
    }
    /**
     * å‚照业务类型
     *
     * @param conditionMap æŸ¥è¯¢æ¡ä»¶
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java
@@ -1,5 +1,6 @@
package com.vci.web.service.impl;
import com.alibaba.fastjson.JSON;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.data.BusinessObject;
import com.vci.corba.omd.etm.EnumItem;
@@ -7,19 +8,21 @@
import com.vci.dto.OsEnumDTO;
import com.vci.dto.OsEnumItemDTO;
import com.vci.omd.utils.ObjectTool;
import com.vci.pagemodel.*;
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.UserSecretEnum;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.pagemodel.PageHelper;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.starter.web.util.VciDateUtil;
import com.vci.starter.web.util.*;
import com.vci.constant.EnumIdConstant;
import com.vci.pagemodel.KeyValue;
import com.vci.pagemodel.OsEnumItemVO;
import com.vci.pagemodel.OsEnumVO;
import com.vci.pagemodel.OsStatusVO;
import com.vci.starter.web.util.WebThreadLocalUtil;
import com.vci.web.service.OsEnumServiceI;
import com.vci.web.service.OsLifeCycleServiceI;
import com.vci.web.service.WebBoServiceI;
@@ -27,6 +30,7 @@
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;
@@ -35,6 +39,7 @@
import org.springframework.util.CollectionUtils;
import org.springframework.web.util.HtmlUtils;
import java.io.File;
import java.util.*;
import java.util.stream.Collectors;
@@ -72,16 +77,21 @@
    private WebBoServiceI boService;
    /**
     * æ—¥å¿—
     */
    private Logger logger = LoggerFactory.getLogger(getClass());
    /**
     * åŠ è½½è‡ªèº«
     */
    @Autowired(required = false)
    @Lazy
    private OsEnumServiceI self;
    /**
     * å¿…填列
     */
    private List<Integer> ColumnNameisRed = new ArrayList<Integer>();
    /**
     * æ—¥å¿—
     */
    private Logger logger = LoggerFactory.getLogger(getClass());
    /**
     * ä½¿ç”¨ç¼–号获取枚举明细
@@ -231,13 +241,27 @@
    /**
     * æŸ¥çœ‹æžšä¸¾çš„使用范围
     * @param enumName
     * @param enumName æžšä¸¾åç§°
     * @return
     * @throws PLException
     */
    @Override
    public List<OsEnumVO> getUsedEnumList(String enumName) throws PLException {
        return null;
    public List<Map<String,String>> getUsedEnumList(String enumName) throws PLException {
        if(Func.isBlank(enumName)){
            throw new PLException("500",new String[]{"请选择要查询应用范围的枚举!"});
        }
        String[] attrubuteNames = platformClientUtil.getAttributeService().getAttrubyteNamesByEMName(enumName);
        if(Func.isEmpty(attrubuteNames)){
            return new ArrayList<>();
        }
        List<Map<String,String>> attrubuteMapList = new ArrayList<>();
        Arrays.stream(attrubuteNames).forEach(attrName->{
            Map<String, String> itemMap = new HashMap<>();
            itemMap.put("enumName",enumName);
            itemMap.put("source",attrName);
            attrubuteMapList.add(itemMap);
        });
        return attrubuteMapList;
    }
    /**
@@ -279,8 +303,10 @@
        //枚举项名称判重等操作
        checkOsEnumItem(osEnumDTO);
        //默认值处理
        String userId = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
        String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
        osEnumDTO.setCreator(userId);
        //手动设置主键,否则平台直接用没有主键的枚举放进了缓存中,导致后续查询的数据没有oid
        osEnumDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
        osEnumDTO.setLastModifier(userId);
        return platformClientUtil.getEnumService().addEnumType(this.osEnumDTO2EnumType(osEnumDTO));
    }
@@ -308,7 +334,7 @@
        //3、枚举项判重,和长度等校验
        checkOsEnumItem(osEnumDTO);
        //将osEnumVO中的默认值赋值给osEnumDTO对象
        String userId = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
        String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
        osEnumDTO.setLastModifier(userId);
        osEnumDTO.setCreator(osEnumVO.getCreator());
        osEnumDTO.setCreateTime(osEnumVO.getCreateTime());
@@ -333,7 +359,12 @@
            String name = osEnumDTO.getName();
            Date ts = osEnumDTO.getTs();
            if(Func.isBlank(oid) || Func.isBlank(name) || Func.isEmpty(ts)){
                throw new PLException("500",new String[]{"待删除的枚举列表中主键【oid】和调整时间【ts】不能为空!"});
                throw new PLException("500",new String[]{"待删除的枚举列表中主键【oid】、调整时间【ts】、属性名【name】不能为空!"});
            }
            //判断枚举是否有被引用
            List<Map<String, String>> usedEnumList = this.getUsedEnumList(name);
            if(Func.isNotEmpty(usedEnumList)){
                throw new PLException("500",new String[]{"删除的枚举中,枚举名称为:【" + name + "】,已被引用!"});
            }
            EnumType enumType = new EnumType();
            enumType.oid = oid;
@@ -348,6 +379,252 @@
    }
    /**
     * å¯¼å‡ºæžšä¸¾ç±»åž‹
     * @param exportFileName å¯¼å‡ºçš„æ–‡ä»¶å
     * @param enumNames éœ€è¦å¯¼å‡ºçš„æžšä¸¾åç§°
     * @return
     */
    @Override
    public String exportEnumTypes(String exportFileName,String enumNames) throws PLException {
        if(Func.isBlank(enumNames)){
            throw new PLException("500",new String[]{"请勾选要导出的枚举!"});
        }
        //界面没传名称,使用默认导出名称
        exportFileName = Func.isBlank(exportFileName) ?  "枚举类型导出_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
        //设置列名
        List<String> columns = new ArrayList<>(Arrays.asList("枚举名称", "标签", "返回类型", "长度", "枚举项名称", "枚举值", "描述"));
        //写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++) {
            excelDataList.add(new WriteExcelData(0,index, columns.get(index)));
        }
        //按照枚举名查询枚举,然后处理枚举导出
        List<String> enumNameList = Func.toStrList(enumNames);
        int startRow = 1;
        for (int i = 0; i < enumNameList.size(); i++) {
            //根据枚举名称查询枚举和枚举项
            OsEnumVO osEnumVO = this.getEnumTypeById(enumNameList.get(i));
            //OsEnumVO osEnumVO = getTestJson(i);
            //查询结果不应该为空
            if(Func.isEmpty(osEnumVO) && Func.isBlank(osEnumVO.getOid())){
                throw new PLException("500",new String[]{"未查询到枚举名为【" + enumNameList.get(i) + "】的枚举,请刷新后重新导出!"});
            }
            //枚举项不为空时需要考虑合并行问题
            List<OsEnumItemVO> enumVOItems = osEnumVO.getItems();
            //枚举项不为空时需要进行合并行处理
            if(Func.isNotEmpty(enumVOItems) || enumVOItems.size() > 1){
                //excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,0, osEnumVO.getOid()));
                excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,0, osEnumVO.getId()));
                excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,1, osEnumVO.getName()));
                excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,2, osEnumVO.getEnumValueDataType()+"("+osEnumVO.getEnumValueDataTypeText()+")"));
                excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,3, osEnumVO.getLength()));
                //excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,5, osEnumVO.getCreator()));
                excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,4, Func.format(osEnumVO.getCreateTime(),"yyyyå¹´MM月dd日 hh:mm:ss")));
                //处理枚举项写入
                for (int j = 0; j < enumVOItems.size(); j++) {
                    OsEnumItemVO osEnumItemVO = enumVOItems.get(j);
                    excelDataList.add(new WriteExcelData(startRow+j,7, true,osEnumItemVO.getName()));
                    excelDataList.add(new WriteExcelData(startRow+j,8, true, osEnumItemVO.getValue()));
                    excelDataList.add(new WriteExcelData(startRow+j,9, true, osEnumItemVO.getDescription()));
                }
                startRow += enumVOItems.size();
            }else{
                //枚举项为空时就不需要合并行
                //excelDataList.add(new WriteExcelData(startRow,0, true,osEnumVO.getOid()));
                excelDataList.add(new WriteExcelData(startRow,0, true, osEnumVO.getId()));
                excelDataList.add(new WriteExcelData(startRow,1, true, osEnumVO.getName()));
                excelDataList.add(new WriteExcelData(startRow,1, true, osEnumVO.getEnumValueDataType()+"("+osEnumVO.getEnumValueDataTypeText()+")"));
                excelDataList.add(new WriteExcelData(startRow,3, true, osEnumVO.getLength()));
                //excelDataList.add(new WriteExcelData(startRow,5, true, osEnumVO.getCreator()));
                excelDataList.add(new WriteExcelData(startRow,4, true, Func.format(osEnumVO.getCreateTime(),"yyyyå¹´MM月dd日 hh:mm:ss")));
            }
            //记录下上一组数据结束时的行号,方便用做合并行的起始行
            startRow += 1;
        }
        WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
        ExcelUtil.writeDataToFile(excelPath, excelOption);
        return excelPath;
    }
    /**
     * ä¸‹è½½å¯¼å…¥æ¨¡æ¿
     * @param exportFileName
     * @return
     */
    @Override
    public String downloadEnumTemplate(String exportFileName) {
        //界面没传名称,使用默认导出名称
        exportFileName = Func.isBlank(exportFileName) ?  "枚举导入模板_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
        //设置列名
        List<String> columns = new ArrayList<>(Arrays.asList("枚举名称", "标签", "返回类型", "长度", "枚举项名称(当前枚举下有枚举项时必填)", "枚举值(当前枚举下有枚举项时必填)", "描述","*注意*:第二行开始的数据为示例数据,导入前请将其删除,当导入的枚举下具备多个枚举项时,应按照示例enum2的写法"));
        //写excel
        String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName +  ".xls";
        //设置必填列
        ColumnNameisRed.clear();
        ColumnNameisRed.add(0);
        ColumnNameisRed.add(2);
        ColumnNameisRed.add(3);
        ColumnNameisRed.add(4);
        ColumnNameisRed.add(5);
        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)));
            }
        }
        List<OsEnumVO> exportEnumTempExample = this.getExportEnumTempExample();
        for (int i = 0; i < exportEnumTempExample.size(); i++) {
            OsEnumVO osEnumVO = exportEnumTempExample.get(i);
            List<OsEnumItemVO> enumVOItems = osEnumVO.getItems();
            for (int j = 0; j < enumVOItems.size(); j++) {
                OsEnumItemVO osEnumItemVO = enumVOItems.get(j);
                excelDataList.add(new WriteExcelData(i+j+1,0, osEnumVO.getId()));
                excelDataList.add(new WriteExcelData(i+j+1,1, osEnumVO.getName()));
                excelDataList.add(new WriteExcelData(i+j+1,2, osEnumVO.getEnumValueDataType()));
                excelDataList.add(new WriteExcelData(i+j+1,3, osEnumVO.getLength()));
                excelDataList.add(new WriteExcelData(i+j+1,4,osEnumItemVO.getName()));
                excelDataList.add(new WriteExcelData(i+j+1,5, osEnumItemVO.getValue()));
                excelDataList.add(new WriteExcelData(i+j+1,6, osEnumItemVO.getDescription()));
            }
        }
        WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
        ExcelUtil.writeDataToFile(excelPath, excelOption);
        return excelPath;
    }
    /**
     * å¯¼å…¥æžšä¸¾
     * @param file
     * @return
     * @throws Exception
     */
    @Override
    public BaseResult importEnumTypes(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<OsEnumPO> poList = ExcelUtil.readDataObjectFromExcel(file, OsEnumPO.class,excelOption,(value, po, fieldName)->{});
            //去除都是空的情况
            if(CollectionUtils.isEmpty(poList)){
                return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{});
            }
            //将枚举和枚举项处理成一对多关系的对象
            Map<String, OsEnumPO> groupPOMap = new HashMap<>();
            for (OsEnumPO po : poList) {
                //拼接用来作为分组的key
                String key = po.getId() + "_" + po.getName() + "_" + po.getEnumValueDataType() + "_" + po.getLength();
                OsEnumPO group = groupPOMap.get(key);
                if (group == null) {
                    group = new OsEnumPO();
                    //拿出现的首行做后续的提示行
                    group.setRowIndex(po.getRowIndex());
                    group.setId(po.getId());
                    group.setName(po.getName());
                    group.setEnumValueDataType(po.getEnumValueDataType());
                    group.setLength(po.getLength());
                    groupPOMap.put(key, group);
                }
                OsEnumItemDTO itemDTO = new OsEnumItemDTO();
                itemDTO.setName(po.getEnumItemName());
                itemDTO.setValue(po.getValue());
                itemDTO.setDescription(po.getDescription());
                group.getItems().add(itemDTO);
            }
            Collection<OsEnumPO> newPOList = groupPOMap.values();
            //数据库查询是否有已存在的枚举名,方便后续做判重处理
            List<OsEnumVO> osEnumVOList = this.listEnumByIdCollection(poList.stream().map(OsEnumPO::getId).collect(Collectors.toSet()));
            List<String> repeatEnumId = new ArrayList<>();
            if(Func.isNotEmpty(osEnumVOList)){
                repeatEnumId = osEnumVOList.stream().map(OsEnumVO::getId).collect(Collectors.toList());
            }
            //当前excel中是否重复用的判重Map:(key:判重属性,value:行号)
            Map<String, String> excelReapeat = new HashMap<>();
            //判断必填属性是否为空,用户是否已存在,以及部门是否填错等校验逻辑
            List<String> finalRepeatEnumId = repeatEnumId;
            newPOList.stream().forEach(osEnumPO -> {
                if(Func.isBlank(osEnumPO.getId())){//枚举名
                    throw new VciBaseException("第【"+osEnumPO.getRowIndex()+"】行,enumnameerror");
                }else if(Func.isBlank(osEnumPO.getEnumValueDataType())){
                    throw new VciBaseException("第【"+osEnumPO.getRowIndex()+"】行,typeerror");
                }else if(Func.isEmpty(osEnumPO.getLength())){
                    throw new VciBaseException("第【"+osEnumPO.getRowIndex()+"】行,lengtherror");
                }else if(!osEnumPO.getId().matches("^[A-Za-z]+$")){
                    throw new VciBaseException("第【"+osEnumPO.getRowIndex()+"】行数据,枚举名称只能为英文字母");
                }else if(excelReapeat.containsKey(osEnumPO.getId())){//枚举名表格中判重
                    throw new VciBaseException("第【"+excelReapeat.get(osEnumPO.getId())+"】行和第【"+osEnumPO.getRowIndex()+"】行数据,枚举名重复");
                }else if (Func.isNotEmpty(osEnumVOList) && finalRepeatEnumId.contains(osEnumPO.getId())){//2、判断枚举名是否与系统中重复
                    throw new VciBaseException("第【"+osEnumPO.getRowIndex()+"】行,枚举名在系统中已经存在,请修改!");
                }
                //先对枚举名excel中需要判重处理
                excelReapeat.put(osEnumPO.getId(),osEnumPO.getRowIndex());
            });
            //保存逻辑
            for (OsEnumPO osEnumPO : newPOList) {
                OsEnumDTO osEnumDTO = new OsEnumDTO();
                //生成存储的DTO对象
                osEnumDTO.setId(osEnumPO.getId());
                osEnumDTO.setName(osEnumPO.getName());
                osEnumDTO.setEnumValueDataType(osEnumPO.getEnumValueDataType());
                osEnumDTO.setLength(osEnumPO.getLength());
                osEnumDTO.setItems(osEnumPO.getItems());
                //调用新增枚举方法
                boolean addBoolean = this.addEnumType(osEnumDTO);
                if(!addBoolean){
                    throw new PLException("500",new String[]{"保存枚举名为【" + osEnumDTO.getId() + "】的数据时出现错误!"});
                }
            }
        }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("枚举导入成功!");
    }
    /**
     * èŽ·å–å¯¼å…¥æ¨¡æ¿çš„ç¤ºä¾‹æ•°æ®
     * @return
     */
    private List<OsEnumVO> getExportEnumTempExample(){
        String testJosn = "[{\"enumValueDataType\":\"String\",\"id\":\"enum1\",\"items\":[{\"description\":\"enumitem1.1\",\"name\":\"enumitem1.1\",\"value\":\"1\"},{\"description\":\"enumitem1.2\",\"name\":\"enumitem1.2\",\"value\":\"2\"}],\"length\":2,\"name\":\"enum1\"},{\"enumValueDataType\":\"String\",\"id\":\"enum2\",\"items\":[{\"description\":\"enumitem2.1\",\"name\":\"enumitem2.1\",\"value\":\"1\"},{\"description\":\"enumitem2.2\",\"name\":\"enumitem2.2\",\"value\":\"2\"},{\"description\":\"enumitem2.3\",\"name\":\"enumitem2.3\",\"value\":\"3\"}],\"length\":6,\"name\":\"enum2\"}]";
        List<OsEnumVO> OsEnumVOs = JSON.parseArray(testJosn,OsEnumVO.class);
        return OsEnumVOs;
    }
    /**
     * æžšä¸¾é¡¹æ ¡éªŒ
     * @param osEnumDTO
     * @return æ ¡éªŒå¤±è´¥ç›´æŽ¥æŠ›å‡ºå¼‚常,否则不会做任何返回
@@ -356,7 +633,7 @@
        List<OsEnumItemDTO> items = osEnumDTO.getItems();
        if (Func.isNotEmpty(items)) {
            //获取正则,主要是针对Integer类型的时候
            String regular = "Integer".equals(osEnumDTO.getEnumValueDataType()) ? "^[0-9]+$" : "";
            String regular = "Integer".equals(osEnumDTO.getEnumValueDataType()) ? "^-?\\d+$" : "";
            //利用set的add返回值进行name判重
            Set<String> uniqueNames = new HashSet<>();
            for (OsEnumItemDTO item : items) {
@@ -385,7 +662,8 @@
    private EnumType osEnumDTO2EnumType(OsEnumDTO osEnumDTO){
        EnumType enumType = new EnumType();
        enumType.oid = osEnumDTO.getOid();
        enumType.name = osEnumDTO.getId();
        //枚举名统一转成小写,避免后期出现其他问题
        enumType.name = osEnumDTO.getId().toLowerCase(Locale.ROOT);
        enumType.label = osEnumDTO.getName();
        enumType.length = osEnumDTO.getLength();
        enumType.creator = osEnumDTO.getCreator();
@@ -651,6 +929,39 @@
    }
    /**
     * æ ¹æ®æžšä¸¾ç±»åž‹æŸ¥è¯¢æžšä¸¾ï¼šæžšä¸¾å , æžšä¸¾
     * @param enumType:String, Integer
     * @return
     */
    public List<Map<String,List<String>>> getEnumMapByType(String enumType){
        List<Map<String,List<String>>> enumMapList = new ArrayList<>();
        EnumType[] emArray = null;
        try {
            emArray = platformClientUtil.getEnumService().getEnumTypesByType(enumType);
        } catch (PLException e) {
            e.printStackTrace();
        }
        if(emArray == null || emArray.length == 0){
            return null;
        }
        EnumType emItem;
        for(int i = 0; i < emArray.length; i++){
            emItem = emArray[i];
            EnumItem[] emChildren = emItem.items;
            ArrayList<String> valueList = new ArrayList<String>();
            for(int k = 0; k < emChildren.length; k++){
                EnumItem emChild = emChildren[k];
                String value = emChild.value;
                valueList.add(value);
            }
            Map<String, List<String>> enumMap = new HashMap<>();
            enumMap.put(emItem.name, valueList);
            enumMapList.add(enumMap);
        }
        return enumMapList;
    }
    /**
     * æ¸…除缓存
     */
    @Override
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
@@ -1,6 +1,7 @@
package com.vci.web.service.impl;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.atm.AttributeDef;
import com.vci.corba.omd.data.BusinessObject;
import com.vci.corba.omd.ltm.LinkType;
import com.vci.omd.utils.ObjectTool;
@@ -8,6 +9,7 @@
import com.vci.starter.web.annotation.log.VciUnLog;
import com.vci.starter.web.enumpck.VciFieldTypeEnum;
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.BeanUtil;
import com.vci.starter.web.util.VciBaseUtil;
@@ -321,10 +323,170 @@
    }
    /**
     * é“¾æŽ¥ç±»åž‹çš„列表
     *
     * @return é“¾æŽ¥ç±»åž‹çš„æ˜¾ç¤ºå¯¹è±¡
     */
    @Override
    public BaseResult<List<LinkType>> gridLink() throws PLException {
        LinkType[] linkTypes = platformClientUtil.getLinkTypeService().getLinkTypes();
        return BaseResult.dataList(Arrays.asList(linkTypes));
    }
    /**
     * é“¾æŽ¥ç±»åž‹ä¿å­˜
     * linkType é“¾æŽ¥ç±»åž‹çš„保存对象
     * addFlag æ˜¯å¦ä¸ºæ–°å¢ž true新增,false修改
     * @return ä¿å­˜ç»“æžœ
     */
    @Override
    public BaseResult addAndEditLink(LinkType linkType, Boolean addFlag) throws PLException {
        VciBaseUtil.alertNotNull(linkType.name,"请输入链接类型名称",linkType.btmItemsFrom,"From端业务类型不能为空!",
                linkType.btmItemsTo,"To端类型均不能为空!");
        int maxLength = platformClientUtil.getLinkTypeService().getLTNameMaxLength();
        if(linkType.name.length() > maxLength){
            throw new PLException("500",new String[] {"链接类型名长度不能超过" + maxLength});
        }
        if(!linkType.name.matches("^[A-Za-z]+$")){
            throw new PLException("500",new String[] {"链接类型名称只能为英文字母"});
        }
        LinkType historyLink = platformClientUtil.getLinkTypeService().getLinkType(linkType.name);
        if(historyLink != null && !historyLink.name.equals("") && addFlag){
            throw new PLException("500",new String[] {"该链接类型名称已经存在"});
        }
        linkType.modifier = WebUtil.getCurrentUserId();
        if(addFlag){
            linkType.creator = WebUtil.getCurrentUserId();
            platformClientUtil.getLinkTypeService().addLinkType(linkType);
            return BaseResult.success(null,"保存成功!");
        }
        ArrayList<String> removeAbList = getRemovedApList(historyLink, linkType);
        if(removeAbList.size() > 0 && platformClientUtil.getLinkTypeService().hasData(linkType.name)){
            linkType.attributes = historyLink.attributes;
            platformClientUtil.getLinkTypeService().modifyLinkType(linkType);
            throw new PLException("500",new String[] {"类型已有实例, ä¸è¿›è¡Œç§»é™¤æ“ä½œ"});
        }
        platformClientUtil.getLinkTypeService().modifyLinkType(linkType);
        return BaseResult.success(null,"保存成功!");
    }
    /**
     * èŽ·å–ä¿®æ”¹é“¾æŽ¥ç±»åž‹æ—¶ å‡å°‘的属性
     * @param oldLt
     * @param newLt
     * @return
     */
    private ArrayList<String> getRemovedApList(LinkType oldLt,
                                               LinkType newLt) {
        String[] oldAbInfo = oldLt.attributes;
        ArrayList<String> oldNameList = new ArrayList<String>();
        for(int i = 0; i < oldAbInfo.length; i++){
            oldNameList.add(oldAbInfo[i]);
        }
        String[] newAbInfo = newLt.attributes;
        ArrayList<String> newNameList = new ArrayList<String>();
        for(int i = 0; i < newAbInfo.length; i++){
            newNameList.add(newAbInfo[i]);
        }
        ArrayList<String> removedApList = new ArrayList<String>();
        for(Iterator<String> iterator = oldNameList.iterator(); iterator.hasNext();){
            String oldName = iterator.next();
            if(!newNameList.contains(oldName)){
                removedApList.add(oldName);
            }
        }
        return removedApList;
    }
    /**
     * æ¸…除缓存
     */
    @Override
    public void clearCache() {
    }
    /**
     * ä¿®æ”¹é“¾æŽ¥ç±»åž‹ä¸­å¯¹åº”属性名的属性
     * @param apName
     * @return
     * @throws PLException
     */
    @Override
    public boolean alterAp(String apName) throws PLException {
        String[] linkNames = null;
        List<String> linkNameList = new ArrayList<String>();
        AttributeDef abItem = null;
        try {
            abItem = platformClientUtil.getAttributeService().getAttributeDefByName(apName);
        } catch (PLException e1) {
            e1.printStackTrace();
        }
        if(abItem == null || abItem.equals("")){
            return true;
        }
        try {
            linkNames = platformClientUtil.getLinkTypeService().getLTNamesByAPName(apName);
        } catch (PLException e) {
            e.printStackTrace();
        }
        if(linkNames == null || linkNames.length <= 0){
            return true;
        }
        linkNameList = Arrays.asList(linkNames);
        for(Iterator<String> i = linkNameList.iterator(); i.hasNext();){
            String linkName = i.next();
            try {
                platformClientUtil.getLinkTypeService().modifyLTAttribute(linkName, apName);
            } catch (PLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                String erreMsg = "调整链接类型中【"+apName+"】属性时出现错误,原因:"+e.getMessage();
                logger.error(erreMsg);
                throw new PLException("500",new String[]{erreMsg});
            }
        }
        return false;
    }
    /**
     * åˆ¤æ–­è¯¥å±žæ€§æ˜¯å¦å·²ç»åœ¨é“¾æŽ¥ç±»åž‹ä¸­äº§ç”Ÿäº†æ•°æ®
     * @param abName
     * @return
     * @throws PLException
     */
    @Override
    public boolean hasInstance(String abName) throws PLException {
        String[] btmNames = platformClientUtil.getLinkTypeService().getLTNamesByAPName(abName);
        if(btmNames == null || btmNames.length == 0){
            return false;
        }
        for(int i = 0; i < btmNames.length; i++){
            String btmName = btmNames[i];
            boolean flag;
            flag = platformClientUtil.getLinkTypeService().hasData(btmName);
            if(flag){
                return flag;
            }
        }
        return false;
    }
    /**
     * èŽ·å–è¿žæŽ¥ç±»åž‹åç§°é›†åˆ
     * @return
     */
    @Override
    public List<String> getAllLtName() throws PLException {
        LinkType[] linkTypes = platformClientUtil.getLinkTypeService().getLinkTypes();
        if(null != linkTypes && linkTypes.length > 0){
            return Arrays.stream(linkTypes).map(linkType -> linkType.name).collect(Collectors.toList());
        }
        return null;
    }
}
Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/usedNames.properties
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,2 @@
sysUsedNames = OID,REVISIONOID,NAMEOID,BtmName,ISLastR,ISFirstR,ISLastV,ISFirstV,Creator,CreateTime,LastModifier,LastModifyTime,RevisionRule,VersionRule,RevisionSeq,RevisionValue,VersionSeq,VersionValue,LCTID,LCStatus,TS,ID,NAME,DESCRIPTION,OWNER,CHECKINBY,CHECKINTIME,CHECKOUTBY,CHECKOUTTIME,COPYFROMVERSION,NEWOID,NEWREVISIONOID
dataBaseUsedNames = ACCESS,ADD,ALL,ALTER,AND,ANY,AS,ASC,AUDIT,BETWEEN,BY,CHAR,CHECK,CLUSTER,COLUMN,COMMENT,COMPRESS,CONNECT,CREATE,CURRENT,DATE,DECIMAL,DEFAULT,DELETE,DESC,DISTINCT,DROP,ELSE,EXCLUSIVE,EXISTS,FILE,FLOAT,FOR,FROM,GRANT,GROUP,HAVING,IDENTIFIED,IMMEDIATE,IN,INCREMENT,INDEX,INITIAL,INSERT,INTEGER,INTERSECT,INTO,IS,LEVEL,LIKE,LOCK,LONG,MAXEXTENTS,MINUS,MLSLABEL,MODE,MODIFY,NOAUDIT,NOCOMPRESS,NOT,NOWAIT,NULL,NUMBER,OF,OFFLINE,ON,ONLINE,OPTION,OR,ORDER,P,CTFREE,PRIOR,PRIVILEGES,PUBLIC,RAW,RENAME,RESOURCE,REVOKE,ROW,ROWID,ROWNUM,ROWS,SELECT,SESSION,SET,SHARE,SIZE,SMALLINT,START,SUCCESSFUL,SYNONYM,SYSDATE,TABLE,THEN,TO,TRIGGER,UID,UNION,UNIQUE,UPDATE,USER,VALIDATE,VALUES,VARCHAR,VARCHAR2,VIEW,WHENEVER,WHERE,WITH
Source/plt-web/plt-web-ui/src/api/system/menu.js
@@ -1,97 +1,5 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
  return request({
    url: '/api/blade-system/menu/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const getLazyList = (parentId, params) => {
  return request({
    url: '/api/blade-system/menu/lazy-list',
    method: 'get',
    params: {
      ...params,
      parentId
    }
  })
}
export const getLazyMenuList = (parentId, params) => {
  return request({
    url: '/api/blade-system/menu/lazy-menu-list',
    method: 'get',
    params: {
      ...params,
      parentId
    }
  })
}
export const getMenuList = (current, size, params) => {
  return request({
    url: '/api/blade-system/menu/menu-list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const getMenuTree = (tenantId) => {
  return request({
    url: '/api/blade-system/menu/tree',
    method: 'get',
    params: {
      tenantId,
    }
  })
}
export const remove = (ids) => {
  return request({
    url: '/api/blade-system/menu/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}
export const add = (row) => {
  return request({
    url: '/api/blade-system/menu/submit',
    method: 'post',
    data: row
  })
}
export const update = (row) => {
  return request({
    url: '/api/blade-system/menu/submit',
    method: 'post',
    data: row
  })
}
export const getMenu = (id) => {
  return request({
    url: '/api/blade-system/menu/detail',
    method: 'get',
    params: {
      id,
    }
  })
}
export const getTopMenu = () => request({
  url: '/api/smFunctionController/top-menu',
  method: 'get'
Source/plt-web/plt-web-ui/src/api/treeMyMenu.js
@@ -5,7 +5,7 @@
 */
export const treeMenu = (parentOid) => {
  return request({
    url: 'api/smFunctionController/treeMyMenu',
    url: '/api/smFunctionController/treeMyMenu',
    method: 'get',
    params:{
      parentOid
Source/plt-web/plt-web-ui/src/api/user.js
@@ -19,100 +19,9 @@
  }
});
export const loginBySocial = (tenantId, source, state) => request({
  url: '/api/blade-auth/oauth/token',
  method: 'post',
  headers: {
    'Tenant-Id': tenantId
  },
  params: {
    tenantId,
    source,
    state,
    grant_type: "social",
    scope: "all",
  }
})
export const loginBySso = (state) => request({
  url: '/api/blade-auth/oauth/token',
  method: 'post',
  headers: {
    'Tenant-Id': state
  },
  params: {
    tenantId: state,
    grant_type: "authorization_code",
    scope: "all",
    redirect_uri: website.redirectUri,
  }
})
export const refreshToken = (refresh_token, tenantId, deptId, roleId) => request({
  url: '/api/blade-auth/oauth/token',
  method: 'post',
  headers: {
    'Tenant-Id': tenantId,
    'Dept-Id': (website.switchMode ? deptId : ''),
    'Role-Id': (website.switchMode ? roleId : '')
  },
  params: {
    tenantId,
    refresh_token,
    grant_type: "refresh_token",
    scope: "all",
  }
});
export const registerGuest = (form, oauthId) => request({
  url: '/api/blade-user/register-guest',
  method: 'post',
  params: {
    tenantId: form.tenantId,
    name: form.name,
    account: form.account,
    password: form.password,
    oauthId
  }
});
export const getButtons = () => request({
  url: '/api/blade-system/menu/buttons',
  method: 'get'
});
export const getCaptcha = () => request({
  url: '/api/blade-auth/oauth/captcha',
  method: 'get',
  authorization: false
});
export const logout = () => request({
  url: '/api/blade-auth/oauth/logout',
  method: 'get',
  authorization: false
});
export const getUserInfo = () => request({
  url: '/api/framework/loginController/getSessionInfo',
  method: 'post'
});
export const sendLogs = (list) => request({
  url: '/api/blade-auth/oauth/logout',
  method: 'post',
  data: list
});
export const clearCache = () => request({
  url: '/api/blade-auth/oauth/clear-cache',
  method: 'get',
  authorization: false
});
export const selcetList = () => request({
  url: '/api/blade-system/tenant/tenant-map',
  method: 'get',
});
// ä¿®æ”¹å¯†ç 