修改密码,登录接口增加密码解密逻辑(前端传递的密码加密传输);枚举和枚举项:查询、增加、修改、删除接口上传。
已修改14个文件
已添加1个文件
644 ■■■■ 文件已修改
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsEnumDTO.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsEnumItemDTO.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsEnumItemVO.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java 22 ●●●● 补丁 | 查看 | 原始文档 | 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 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmUserQueryController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java 129 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBaseServiceI.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsEnumServiceI.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LoginServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java 244 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/DigestUtil.java 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/Func.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsEnumDTO.java
@@ -1,6 +1,10 @@
package com.vci.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.vci.starter.web.util.VciDateUtil;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
@@ -8,7 +12,7 @@
 * @author weidy
 * @date 2019/10/14 17:25
 */
public class OsEnumDTO implements java.io.Serializable{
public class OsEnumDTO implements java.io.Serializable {
    /**
     * ç¦æ­¢ä¿®æ”¹è¿™ä¸ªå€¼
@@ -48,7 +52,28 @@
    /**
     * æ—¶é—´æˆ³ï¼Œæ ¼å¼æ˜¯yyyy-MM-dd HH:mm:ss.SSS
     */
    @JsonFormat(pattern = VciDateUtil.DateTimeMillFormat)
    private Date ts;
    /**
     * åˆ›å»ºäºº
     */
    private String creator;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    private Date createTime;
    /**
     * æœ€åŽä¿®æ”¹äºº
     */
    private String lastModifier;
    /**
     * æœ€åŽä¿®æ”¹æ—¶é—´ï¼Œæ ¼å¼æ˜¯yyyy-MM-dd HH:mm:ss
     */
    private Date lastModifyTime;
    /**
     * ç±»çš„全路径
@@ -65,6 +90,51 @@
     */
    private Map<String,String> itemOidMaps;
    /**
     * æžšä¸¾é¡¹
     */
    private List<OsEnumItemDTO> items;
    public String getCreator() {
        return creator;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public String getLastModifier() {
        return lastModifier;
    }
    public Date getLastModifyTime() {
        return lastModifyTime;
    }
    public void setCreator(String creator) {
        this.creator = creator;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public void setLastModifier(String lastModifier) {
        this.lastModifier = lastModifier;
    }
    public void setLastModifyTime(Date lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }
    public void setItems(List<OsEnumItemDTO> items) {
        this.items = items;
    }
    public List<OsEnumItemDTO> getItems() {
        return items;
    }
    public String getOid() {
        return oid;
    }
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsEnumItemDTO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,43 @@
package com.vci.dto;
/**
 * æžšä¸¾é¡¹æ•°æ®ä¼ è¾“对象
 * @author ludc
 * @date 2024/7/17 14:23
 */
public class OsEnumItemDTO implements java.io.Serializable{
    private static final long serialVersionUID = -900528102L;
    private String name;
    private String value;
    private String description;
    public void setName(String name) {
        this.name = name;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getName() {
        return name;
    }
    public String getValue() {
        return value;
    }
    public String getDescription() {
        return description;
    }
}
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsEnumItemVO.java
@@ -31,7 +31,7 @@
    /**
     * æžšä¸¾å€¼
     */
    private String id;
    private String value;
    /**
     * æžšä¸¾æ˜¾ç¤ºåç§°
@@ -95,12 +95,12 @@
        this.pkEnum = pkEnum;
    }
    public String getId() {
        return id;
    public String getValue() {
        return value;
    }
    public void setId(String id) {
        this.id = id;
    public void setValue(String id) {
        this.value = id;
    }
    public String getName() {
@@ -181,7 +181,7 @@
        return "OsEnumItemVO{" +
                "oid='" + oid + '\'' +
                ", pkEnum='" + pkEnum + '\'' +
                ", id='" + id + '\'' +
                ", value='" + value + '\'' +
                ", name='" + name + '\'' +
                ", description='" + description + '\'' +
                ", btmname='" + btmname + '\'' +
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java
@@ -195,7 +195,7 @@
     * @param password æ–°çš„密码
     * @param confirmPassword ç¡®è®¤å¯†ç 
     */
    boolean changePassword(String userOid,String oldPassword, String password, String confirmPassword) throws PLException;
    boolean changePassword(String userOid,String oldPassword, String password, String confirmPassword) throws Exception;
    /**
     * æ›´æ–°ç”¨æˆ·çš„密码错误次数
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java
@@ -1028,15 +1028,18 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean changePassword(String userOid,String oldPassword, String password,
            String confirmPassword) throws PLException {
            String confirmPassword) throws Exception {
        WebUtil.alertNotNull(userOid,"用户主键",oldPassword,"登录密码",password,"密码",confirmPassword,"确认密码");
        if(!password.equals(confirmPassword)){
            throw new VciBaseException("密码和确认密码不相等");
        }
        //对旧密码和密码进行解密,便于比对密码用
        oldPassword = Func.decryptAes(oldPassword,"daliantan0v0vcip");
        password = Func.decryptAes(password,"daliantan0v0vcip");
        //对比旧密码
        boolean b = this.checkPasswordEqual(oldPassword, userOid);
        if(!b){
            throw new PLException("500", new String[] { "您输入的密码与登录密码不一致,请重新输入!"});
        }
        if(!password.equals(confirmPassword)){
            throw new VciBaseException("密码和确认密码不相等");
        }
        SmUserVO smUserVO = getUserByUserOid(userOid);
        if(Func.isEmpty(smUserVO)){
@@ -1047,12 +1050,21 @@
        if (!StringUtils.isBlank(error)) {
            throw new VciBaseException("当前设置的密码,密码策略校验未通过!");
        }
        //TODO:考虑是否需要将修改方式改成直接调用平台的接口,因为现在的修改方式没能正确的更新缓存
        /*UserInfo userInfo = new UserInfo();
        userInfo.id = userOid.trim();
        userInfo.pwd = password;
        userInfo.pwdUpdateTime = System.currentTimeMillis();
        boolean updateBoolean = platformClientUtil.getFrameworkService().updateUser(userInfo, new UserEntityInfo(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(), null));
        return updateBoolean;*/
        ThreeDES des = new ThreeDES();// å®žä¾‹åŒ–一个对�?
        des.getKey("daliantan0v0");// ç”Ÿæˆå¯†åŒ™
        String encPassword = des.getEncString(password);
        //修改密码的同时需要将密码修改时间也更新
        String sql = "update pluser set plpassword = '" + encPassword + "', plpwdupdatetime = TO_DATE('"
                + Func.format(new Date(),"yyyy-MM-dd HH:mm:ss") +"','yyyy-MM-dd hh24:mi:ssxff') where pluid = '" + userOid.trim() + "'";
                + Func.format(new Date(),"yyyy-MM-dd HH:mm:ss") +"','yyyy-MM-dd hh24:mi:ss') where pluid = '" + userOid.trim() + "'";
        try {
            return platformClientUtil.getBOFactoryService().executeUpdateSql(sql);
        } catch (PLException vciError) {
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java
@@ -62,7 +62,7 @@
            e.printStackTrace();
            String exceptionMessage = "部门树查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(e.getMessage());
            return BaseResult.fail(exceptionMessage);
        }
    }
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmPwdStrategyQueryController.java
@@ -55,7 +55,7 @@
            e.printStackTrace();
            String exceptionMessage = "密码安全策略列表查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(e.getMessage());
            return BaseResult.fail(exceptionMessage);
        }
    }
@@ -75,7 +75,7 @@
            e.printStackTrace();
            String exceptionMessage = "密码安全策略下拉列表查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(e.getMessage());
            return BaseResult.fail(exceptionMessage);
        }
    }
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmUserQueryController.java
@@ -206,7 +206,7 @@
    @RequestMapping(value = "/changePassword",method = RequestMethod.POST)
    public BaseResult changePassword(String userOid,String oldPassword, String password, String confirmPassword) throws PLException {
        try {
            return BaseResult.success(userQueryService.changePassword(userOid, oldPassword, password, confirmPassword) ? "修改密码成功!":"修改密码失败!");
            return userQueryService.changePassword(userOid, oldPassword, password, confirmPassword) ? BaseResult.success("用户修改成功!"):BaseResult.fail("用户修改失败!");
        }catch (Exception e){
            e.printStackTrace();
            String exceptionMessage = "修改密码时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
@@ -230,7 +230,7 @@
            e.printStackTrace();
            String exceptionMessage = "用户管理列表查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(e.getMessage());
            return BaseResult.fail(exceptionMessage);
        }
    }
@@ -259,7 +259,7 @@
    @RequestMapping(value = "/updateUser",method = RequestMethod.PUT)
    public BaseResult updateUser(@RequestBody SmUserDTO smUserDTO){
        try {
            return BaseResult.success(userQueryService.updateUser(smUserDTO) ? "用户修改成功!":"用户修改失败!");
            return userQueryService.updateUser(smUserDTO) ? BaseResult.success("用户修改成功!"):BaseResult.fail("用户修改失败!");
        }catch (Exception e){
            e.printStackTrace();
            String exceptionMessage = "修改用户时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java
@@ -1,5 +1,6 @@
package com.vci.web.controller;
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.pagemodel.BaseQueryObject;
@@ -8,11 +9,12 @@
import com.vci.pagemodel.KeyValue;
import com.vci.pagemodel.OsEnumItemVO;
import com.vci.pagemodel.OsEnumVO;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.service.OsEnumServiceI;
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 java.util.List;
@@ -34,6 +36,11 @@
    private OsEnumServiceI enumService;
    /**
     * æ—¥å¿—
     */
    private Logger logger = LoggerFactory.getLogger(getClass());
    /**
     * èŽ·å–æžšä¸¾çš„ä¸‹æ‹‰æ¡†
     * @param comboxKey æžšä¸¾çš„名称
     * @return æžšä¸¾çš„下拉值
@@ -45,6 +52,27 @@
        return BaseResult.success(enumService.getEnum(comboxKey));
    }
    /**
     * å‚照枚举列表
     * @param baseQueryObject æŸ¥è¯¢æ¡ä»¶
     * @return åˆ—表的内容
     */
    @GetMapping( "/referDataGrid")
    @VciBusinessLog(operateName = "参照枚举列表")
    public DataGrid<OsEnumVO> referDataGrid(BaseQueryObject baseQueryObject){
        return enumService.referDataGrid(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper());
    }
    /**
     * èŽ·å–æžšä¸¾çš„æ˜Žç»†
     * @param pkEnum æžšä¸¾çš„主键
     * @return æžšä¸¾çš„选项
     */
    @GetMapping("/gridEnumItemByOid")
    @VciBusinessLog(operateName = "获取枚举的明细")
    public DataGrid<OsEnumItemVO> gridEnumItemByOid(String pkEnum){
        return enumService.gridEnumItemByOid(pkEnum);
    }
    /**
     * èŽ·å–æ•°æ®çš„å¯†çº§
@@ -60,24 +88,97 @@
    /**
     * æžšä¸¾åˆ—表
     * @param baseQueryObject æŸ¥è¯¢æ¡ä»¶
     * @param enumName æŸ¥è¯¢æ¡ä»¶name
     * @return åˆ—表的内容
     */
    @GetMapping( "/gridEnum")
    @GetMapping( "/getEnumTypeList")
    @VciBusinessLog(operateName = "枚举列表")
    public DataGrid<OsEnumVO> gridEnum(BaseQueryObject baseQueryObject){
        return enumService.referDataGrid(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper());
    @VciUnCheckRight
    public BaseResult<List<OsEnumVO>> getEnumTypeList(String enumName) {
        try {
            return BaseResult.dataList(enumService.getEnumTypeList(enumName));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "枚举管理列表查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * èŽ·å–æžšä¸¾çš„æ˜Žç»†
     * @param pkEnum æžšä¸¾çš„主键
     * @return æžšä¸¾çš„选项
     * æ·»åŠ å•æ¡æžšä¸¾
     * @param osEnumDTO
     * @return åˆ—表的内容
     */
    @GetMapping("/gridEnumItemByOid")
    @VciBusinessLog(operateName = "获取枚举的明细")
    public DataGrid<OsEnumItemVO> gridEnumItemByOid(String pkEnum){
        return enumService.gridEnumItemByOid(pkEnum);
    @PostMapping( "/addEnumType")
    @VciBusinessLog(operateName = "添加枚举")
    @VciUnCheckRight
    public BaseResult addEnumType(@RequestBody OsEnumDTO osEnumDTO) {
        try {
            return enumService.addEnumType(osEnumDTO) ? BaseResult.success("枚举类型添加成功!"):BaseResult.fail("枚举类型添加失败!");
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "增加枚举类型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * ä¿®æ”¹å•条枚举(带修改枚举项功能)
     * @param osEnumDTO
     * @return åˆ—表的内容
     */
    @PutMapping( "/updateEnumType")
    @VciBusinessLog(operateName = "修改枚举")
    @VciUnCheckRight
    public BaseResult updateEnumType(@RequestBody OsEnumDTO osEnumDTO) {
        try {
            return enumService.updateEnumType(osEnumDTO) ? BaseResult.success("枚举类型修改成功!"):BaseResult.fail("枚举类型修改失败!");
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "修改枚举类型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * åˆ é™¤æžšä¸¾
     * @param osEnumDTOS
     * @return åˆ—表的内容
     */
    @DeleteMapping( "/deleteEnumTypes")
    @VciBusinessLog(operateName = "删除枚举")
    @VciUnCheckRight
    public BaseResult deleteEnumTypes(@RequestBody List<OsEnumDTO> osEnumDTOS) {
        try {
            return enumService.deleteEnumTypes(osEnumDTOS) ? BaseResult.success("枚举类型删除成功!"):BaseResult.fail("枚举类型删除失败!");
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "删除枚举类型时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * æŸ¥çœ‹æžšä¸¾çš„使用范围
     * @param enumName
     * @return åˆ—表的内容
     */
    @GetMapping( "/getUsedEnumList")
    @VciBusinessLog(operateName = "查看枚举的使用范围")
    @VciUnCheckRight
    public BaseResult getUsedEnumList(String enumName) {
        try {
            return BaseResult.dataList(enumService.getUsedEnumList(enumName));
        }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/service/OsBaseServiceI.java
@@ -63,7 +63,7 @@
            }
        }
        String baseSql  = "select oid,to_char(ts,'yyyy-mm-dd hh24:mi:ss') as ts,creator,to_char(createTime,'yyyy-mm-dd hh24:mi:ss') as createTime,modifier,to_char(modifyTime,'yyyy-mm-dd hh24:mi:ss') as modifyTime,name,label," +
                ("plenum".equalsIgnoreCase(tableName)?" '' as " :"") + "description from  " + tableName
                ("plenumtype".equalsIgnoreCase(tableName)?" '' as " :"") + "description from  " + tableName
                + (StringUtils.isNotBlank(whereSql)?(" where " + whereSql):"");
        baseSql += " order by lower(name) asc ";
        String sql = (StringUtils.isNotBlank(pageSql)?" select oid,ts,creator,createTime,modifier,modifyTime,name,label,description  from (select A.* , rownum RN from (":"")
@@ -99,7 +99,7 @@
                dataList.add(obj);
            });
            dataGrid.setData(dataList);
            List<Map> maps = boService.queryBySqlForMap("select count(oid) as total from plbtmtype " + (StringUtils.isNotBlank(whereSql)?(" where " + whereSql):""), null);
            List<Map> maps = boService.queryBySqlForMap("select count(*) as total from "+ tableName + (StringUtils.isNotBlank(whereSql)?(" where " + whereSql):""), null);
            dataGrid.setTotal(VciBaseUtil.getInt(maps.get(0).get("total").toString()));
        }
        return dataGrid;
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsEnumServiceI.java
@@ -1,5 +1,7 @@
package com.vci.web.service;
import com.vci.corba.common.PLException;
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.DataGrid;
import com.vci.starter.web.pagemodel.PageHelper;
@@ -59,6 +61,49 @@
    List<OsEnumVO> selectAllEnum();
    /**
     * æžšä¸¾å®šä¹‰åˆ—表查询(带查询条件)
     * @param enumName
     * @return æžšä¸¾çš„æ˜¾ç¤ºå¯¹è±¡
     */
    List<OsEnumVO> getEnumTypeList(String enumName) throws PLException;
    /**
     * æŸ¥çœ‹æžšä¸¾çš„使用范围
     * @param enumName
     * @return
     * @throws PLException
     */
    List<OsEnumVO> getUsedEnumList(String enumName) throws PLException;
    /**
     * æ ¹æ®æžšä¸¾è‹±æ–‡åç§°èŽ·å–æžšä¸¾ç±»åž‹
     * @param id
     * @return
     */
    OsEnumVO getEnumTypeById(String id) throws PLException;
    /**
     * æ–°å¢žæžšä¸¾ç±»åž‹
     * @param osEnumDTO
     * @return
     */
    boolean addEnumType(OsEnumDTO osEnumDTO) throws PLException ;
    /**
     * ä¿®æ”¹æžšä¸¾ç±»åž‹
     * @param osEnumDTO
     * @return
     */
    boolean updateEnumType(OsEnumDTO osEnumDTO) throws PLException ;
    /**
     * åˆ é™¤æžšä¸¾ç±»åž‹
     * @param osEnumDTOS
     * @return
     */
    boolean deleteEnumTypes(List<OsEnumDTO> osEnumDTOS) throws PLException;
    /**
     * æŸ¥è¯¢æ‰€æœ‰çš„æžšä¸¾æ˜ å°„
     * @return key是枚举的英文名称
     */
@@ -73,10 +118,10 @@
    /**
     * æžšä¸¾çš„æ•°æ®å¯¹è±¡è½¬æ¢ä¸ºæ˜¾ç¤ºå¯¹è±¡
     * @param enumItem æ•°æ®å¯¹è±¡
     * @param enumType æ•°æ®å¯¹è±¡
     * @return æ˜¾ç¤ºå¯¹è±¡
     */
    OsEnumVO enumDO2VO(EnumType enumItem);
    OsEnumVO enumDO2VO(EnumType enumType);
    /**
     * æžšä¸¾æ˜Žç»†è½¬æ¢ä¸ºKV
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LoginServiceImpl.java
@@ -195,9 +195,8 @@
        machine.machine = clientInfo.getMachine();
        String token = null;
        try {
            /*ThreeDES des = new ThreeDES();// å®žä¾‹åŒ–一个对�?
            des.getKey("daliantan0v0");// ç”Ÿæˆå¯†åŒ™
            String encPassword = des.getDesString(userDTO.getPassword());*/
            //前端传过来的密码是经过加密传输的,所以需要按照约定解密,再传给平台进行比对
            userDTO.setPassword(Func.decryptAes(userDTO.getPassword(),"daliantan0v0vcip"));
            LoginResult chkRes = platformClientUtil.getFrameworkService().checkLogin(userDTO.getUserId(),userDTO.getPassword(), machine);
            loginResult.setFailCode(getErrorCode(chkRes));
            //loginResult.setFailMsgArray(new String[]{userDTO.getUserId(), String.valueOf(chkRes.auxInfo)});
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java
@@ -4,6 +4,8 @@
import com.vci.corba.omd.data.BusinessObject;
import com.vci.corba.omd.etm.EnumItem;
import com.vci.corba.omd.etm.EnumType;
import com.vci.dto.OsEnumDTO;
import com.vci.dto.OsEnumItemDTO;
import com.vci.omd.utils.ObjectTool;
import com.vci.starter.web.annotation.log.VciUnLog;
import com.vci.starter.web.enumpck.UserSecretEnum;
@@ -17,9 +19,11 @@
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;
import com.vci.web.util.Func;
import com.vci.web.util.PlatformClientUtil;
import com.vci.web.util.WebUtil;
import org.apache.commons.lang3.StringUtils;
@@ -72,14 +76,12 @@
     */
    private Logger logger = LoggerFactory.getLogger(getClass());
    /**
     * åŠ è½½è‡ªèº«
     */
    @Autowired(required = false)
    @Lazy
    private OsEnumServiceI self;
    /**
     * ä½¿ç”¨ç¼–号获取枚举明细
@@ -98,13 +100,14 @@
            int userSecret = WebUtil.getInt(WebUtil.getCurrentUserSessionInfoNotException().getUserSecret());
            List<OsEnumItemVO> itemVOS = new ArrayList<>();
            if(enumVO!=null && !CollectionUtils.isEmpty(enumVO.getItems())){
                itemVOS = enumVO.getItems().stream().filter(item->WebUtil.getInt(item.getId()) <= userSecret).collect(Collectors.toList());
                itemVOS = enumVO.getItems().stream().filter(item->WebUtil.getInt(item.getValue()) <= userSecret).collect(Collectors.toList());
            }
            return itemVOS;
        }else{
            return enumVOMap.getOrDefault(enumCode.toLowerCase(),new OsEnumVO()).getItems();
        }
    }
    /**
     * èŽ·å–æžšä¸¾çš„å†…å®¹
     * @param enumCode æžšä¸¾çš„编号(英文名称)
@@ -217,6 +220,197 @@
    }
    /**
     * æžšä¸¾å®šä¹‰åˆ—表查询(缓存里面找且带name查询条件)
     * @param enumName
     * @return æžšä¸¾çš„æ˜¾ç¤ºå¯¹è±¡
     */
    @Override
    public List<OsEnumVO> getEnumTypeList(String enumName) throws PLException {
        return enumDO2VOs(Arrays.stream(platformClientUtil.getEnumService().getEnumTypes(enumName,1,1)).collect(Collectors.toList()));
    }
    /**
     * æŸ¥çœ‹æžšä¸¾çš„使用范围
     * @param enumName
     * @return
     * @throws PLException
     */
    @Override
    public List<OsEnumVO> getUsedEnumList(String enumName) throws PLException {
        return null;
    }
    /**
     * æ ¹æ®æžšä¸¾è‹±æ–‡åç§°èŽ·å–æžšä¸¾ç±»åž‹
     * @param id
     * @return
     */
    @Override
    public OsEnumVO getEnumTypeById(String id) throws PLException {
        if (Func.isBlank(id)) {
            return null;
        }
        EnumType enumType = platformClientUtil.getEnumService().getEnumTypeByName(id);
        return enumDO2VO(enumType);
    }
    /**
     * æ–°å¢žæžšä¸¾ç±»åž‹
     * @param osEnumDTO
     * @return
     */
    @Override
    public boolean addEnumType(OsEnumDTO osEnumDTO) throws PLException {
        //1、枚举值判空
        VciBaseUtil.alertNotNull(
        osEnumDTO,"枚举类型对象",
            osEnumDTO.getId(),"枚举名称",
            osEnumDTO.getEnumValueDataType(),"枚举的类型",
            osEnumDTO.getLength(),"枚举长度"
        );
        //2、枚举类型名称正则校验和查重
        if(!osEnumDTO.getId().matches("^[A-Za-z]+$")){
            throw new PLException("500", new String[] { "枚举名称只能为英文字母!"});
        }
        OsEnumVO osEnumVO = this.getEnumTypeById(osEnumDTO.getId());
        if(Func.isNotEmpty(osEnumVO) && Func.isNotBlank(osEnumVO.getOid())){
            throw new PLException("500", new String[] { "枚举名称已存在,请修改枚举名称!"});
        }
        //枚举项名称判重等操作
        checkOsEnumItem(osEnumDTO);
        //默认值处理
        String userId = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
        osEnumDTO.setCreator(userId);
        osEnumDTO.setLastModifier(userId);
        return platformClientUtil.getEnumService().addEnumType(this.osEnumDTO2EnumType(osEnumDTO));
    }
    /**
     * ä¿®æ”¹æžšä¸¾ç±»åž‹
     * @param osEnumDTO
     * @return
     */
    @Override
    public boolean updateEnumType(OsEnumDTO osEnumDTO) throws PLException {
        //1、枚举值判空
        VciBaseUtil.alertNotNull(
                osEnumDTO,"枚举类型对象",
                osEnumDTO.getOid(),"枚举的主键",
                osEnumDTO.getId(),"枚举名称",
                osEnumDTO.getEnumValueDataType(),"枚举的类型",
                osEnumDTO.getLength(),"枚举长度"
        );
        //2、枚举类型名称(名称不允许修改)所以可以用名称查询是否存在
        OsEnumVO osEnumVO = this.getEnumTypeById(osEnumDTO.getId());
        if(Func.isEmpty(osEnumVO) || Func.isBlank(osEnumVO.getOid())){
            throw new PLException("500", new String[] { "当前修改枚举对象不存在,请刷新后重试!"});
        }
        //3、枚举项判重,和长度等校验
        checkOsEnumItem(osEnumDTO);
        //将osEnumVO中的默认值赋值给osEnumDTO对象
        String userId = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
        osEnumDTO.setLastModifier(userId);
        osEnumDTO.setCreator(osEnumVO.getCreator());
        osEnumDTO.setCreateTime(osEnumVO.getCreateTime());
        //修改和删除时ts参数为前端必传参数
        return platformClientUtil.getEnumService().modifyEnumType(osEnumDTO2EnumType(osEnumDTO));
    }
    /**
     * åˆ é™¤æžšä¸¾ç±»åž‹(包含删除枚举项功能)
     * @param osEnumDTOS
     * @return
     */
    @Override
    public boolean deleteEnumTypes(List<OsEnumDTO> osEnumDTOS) throws PLException {
        VciBaseUtil.alertNotNull(osEnumDTOS,"待删除的枚举列表");
        //平台的deleteEnumTypes方法必传三个参数,oid、name和ts
        List<EnumType> enumTypes = new ArrayList<>();
        for(OsEnumDTO osEnumDTO : osEnumDTOS){
            //oid和ts判空
            String oid = osEnumDTO.getOid();
            //name主要用来对缓存数据删除
            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】不能为空!"});
            }
            EnumType enumType = new EnumType();
            enumType.oid = oid;
            enumType.name = name;
            enumType.ts = Func.format(ts,VciDateUtil.DateTimeMillFormat);
            enumTypes.add(enumType);
        }
        if(Func.isEmpty(enumTypes)){
            return false;
        }
        return platformClientUtil.getEnumService().deleteEnumTypes(enumTypes.toArray(new EnumType[enumTypes.size()]));
    }
    /**
     * æžšä¸¾é¡¹æ ¡éªŒ
     * @param osEnumDTO
     * @return æ ¡éªŒå¤±è´¥ç›´æŽ¥æŠ›å‡ºå¼‚常,否则不会做任何返回
     */
    private void checkOsEnumItem(OsEnumDTO osEnumDTO) throws PLException {
        List<OsEnumItemDTO> items = osEnumDTO.getItems();
        if (Func.isNotEmpty(items)) {
            //获取正则,主要是针对Integer类型的时候
            String regular = "Integer".equals(osEnumDTO.getEnumValueDataType()) ? "^[0-9]+$" : "";
            //利用set的add返回值进行name判重
            Set<String> uniqueNames = new HashSet<>();
            for (OsEnumItemDTO item : items) {
                // åˆ¤æ–­name属性是否有重复的值
                if (!uniqueNames.add(item.getName())) {
                    throw new PLException("500", new String[] {"以下枚举项名称: ã€" + item.getName()+ "】重复,请修改枚举项名后重试!"});
                }
                //判断枚举值是否超过设定长度
                if (item.getValue().length() > osEnumDTO.getLength()) {
                    throw new PLException("500", new String[] {"枚举项名称为:【" + item.getName() + "】的枚举值长度,超过限定长度【" + osEnumDTO.getLength() + "】"});
                }
                //枚举类型正则校验
                if(Func.isNotBlank(regular) && !item.getValue().matches(regular)){
                    throw new PLException("500", new String[] { "枚举值只能为【" +
                            ("String".equals(osEnumDTO.getEnumValueDataType()) ? "字符串":"整型") + "】类型!"});
                }
            }
        }
    }
    /**
     * æ–°å¹³å°æžšä¸¾DTO对象转平台EnumType对象
     * @param osEnumDTO
     * @return
     */
    private EnumType osEnumDTO2EnumType(OsEnumDTO osEnumDTO){
        EnumType enumType = new EnumType();
        enumType.oid = osEnumDTO.getOid();
        enumType.name = osEnumDTO.getId();
        enumType.label = osEnumDTO.getName();
        enumType.length = osEnumDTO.getLength();
        enumType.creator = osEnumDTO.getCreator();
        enumType.ts = Func.format((Func.isNotEmpty(osEnumDTO.getTs()) ? osEnumDTO.getTs():new Date()),VciDateUtil.DateTimeMillFormat);
        enumType.createTime = Func.isNotEmpty(osEnumDTO.getCreateTime()) ? osEnumDTO.getCreateTime().getTime():System.currentTimeMillis();
        enumType.modifier = osEnumDTO.getLastModifier();
        enumType.modifyTime = System.currentTimeMillis();
        enumType.type = osEnumDTO.getEnumValueDataType();
        //处理枚举项
        List<EnumItem> enumItems = new ArrayList<>();
        List<OsEnumItemDTO> items = osEnumDTO.getItems();
        if(Func.isNotEmpty(items)){
            items.stream().forEach(item->{
                EnumItem enumItem = new EnumItem();
                enumItem.name = item.getName();
                enumItem.value = item.getValue();
                enumItem.description = item.getDescription();
                enumItems.add(enumItem);
            });
        }
        enumType.items = enumItems.toArray(new EnumItem[enumItems.size()]);
        return enumType;
    }
    /**
     * æŸ¥è¯¢æ‰€æœ‰çš„æžšä¸¾æ˜ å°„
     *
     * @return key是枚举的英文名称
@@ -246,43 +440,45 @@
    /**
     * æžšä¸¾çš„æ•°æ®å¯¹è±¡è½¬æ¢ä¸ºæ˜¾ç¤ºå¯¹è±¡
     *
     * @param enumItem æ•°æ®å¯¹è±¡
     * @param enumType æ•°æ®å¯¹è±¡
     * @return æ˜¾ç¤ºå¯¹è±¡
     */
    @Override
    public OsEnumVO enumDO2VO(EnumType enumItem) {
    public OsEnumVO enumDO2VO(EnumType enumType) {
        OsEnumVO enumVO = new OsEnumVO();
        if(enumItem!=null){
            enumVO.setOid(enumItem.oid);
            enumVO.setCreator(enumItem.creator);
            enumVO.setLastModifier(enumItem.modifier);
            enumVO.setId(enumItem.name);
            enumVO.setName(enumItem.label);
            enumVO.setEnumValueDataType(enumItem.type);
            enumVO.setLength((int) enumItem.length);
        if(enumType!=null){
            enumVO.setOid(enumType.oid);
            enumVO.setCreator(enumType.creator);
            enumVO.setLastModifier(enumType.modifier);
            enumVO.setId(enumType.name);
            enumVO.setName(enumType.label);
            enumVO.setEnumValueDataType(enumType.type);
            enumVO.setEnumValueDataTypeText("String".equalsIgnoreCase(enumType.type) ? "字符串":"整型");
            enumVO.setLength((int) enumType.length);
            try {
                enumVO.setLastModifyTime(new Date(enumItem.createTime));
                enumVO.setLastModifyTime(new Date(enumType.createTime));
            } catch (Exception e) {
                e.printStackTrace();
            }
            try {
                enumVO.setCreateTime(new Date(enumItem.createTime));
                enumVO.setCreateTime(new Date(enumType.createTime));
            } catch (Exception e) {
                e.printStackTrace();
            }
            try {
                enumVO.setTs(VciDateUtil.str2Date(enumItem.ts,VciDateUtil.DateTimeMillFormat));
                enumVO.setTs(VciDateUtil.str2Date(enumType.ts,VciDateUtil.DateTimeMillFormat));
            } catch (Exception e) {
                e.printStackTrace();
            }
            //枚举项处理
            List<OsEnumItemVO> itemVOS = new ArrayList<>();
            Map<String,String> itemVOMap = new HashMap<>();
            if(enumItem.items!=null && enumItem.items.length > 0){
                for(int i = 0 ; i < enumItem.items.length ; i ++){
            if(enumType.items!=null && enumType.items.length > 0){
                for(int i = 0 ; i < enumType.items.length ; i ++){
                    OsEnumItemVO enumItemVO = new OsEnumItemVO();
                    EnumItem enumChild = enumItem.items[i];
                    enumItemVO.setId(enumChild.value);
                    EnumItem enumChild = enumType.items[i];
                    enumItemVO.setValue(enumChild.value);
                    enumItemVO.setName(enumChild.name);
                    enumItemVO.setDescription(enumChild.description);
                    itemVOS.add(enumItemVO);
@@ -307,7 +503,7 @@
        if(!CollectionUtils.isEmpty(enumItemVO)){
            enumItemVO.forEach(itemVO->{
                KeyValue keyValue = new KeyValue();
                keyValue.setKey(itemVO.getId());
                keyValue.setKey(itemVO.getValue());
                keyValue.setValue(itemVO.getName());
                keyValueList.add(keyValue);
            });
@@ -421,7 +617,7 @@
    }
    /**
     * å‚照枚举的信息
     * å‚照枚举的信息 ä¸å»ºè®®ä½¿ç”¨è¿™ä¸ªæ–¹æ³•,因为是sql拼接做的查询
     *
     * @param conditionMap æŸ¥è¯¢æ¡ä»¶
     * @param pageHelper   åˆ†é¡µ
@@ -429,7 +625,7 @@
     */
    @Override
    public DataGrid<OsEnumVO> referDataGrid(Map<String, String> conditionMap, PageHelper pageHelper) {
        DataGrid<OsEnumVO> dataGrid = queryObjectServiceInfoBySql(conditionMap, pageHelper, "plenum",OsEnumVO.class,null);
        DataGrid<OsEnumVO> dataGrid = queryObjectServiceInfoBySql(conditionMap, pageHelper, "plenumtype",OsEnumVO.class,null);
        return dataGrid;
    }
@@ -454,7 +650,6 @@
        return dataGrid;
    }
    /**
     * æ¸…除缓存
     */
@@ -462,4 +657,5 @@
    public void clearCache() {
    }
}
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/DigestUtil.java
@@ -1,14 +1,18 @@
package com.vci.web.util;
import com.vci.corba.common.PLException;
import com.vci.starter.web.exception.VciBaseException;
import org.apache.commons.codec.binary.Hex;
import org.springframework.lang.Nullable;
import org.springframework.util.DigestUtils;
import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.*;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.*;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Base64;
/**
 * åŠ å¯†ç›¸å…³å·¥å…·ç±»ç›´æŽ¥ä½¿ç”¨Spring util封装,减少jar依赖
@@ -327,6 +331,32 @@
    }
    /**
     * aes解密
     * @param secretKey ç§˜é’¥
     * @param encryptedData     Data
     * @return digest as a hex string
     */
    public static String decryptAes(String encryptedData, String secretKey) throws Exception {
        // AES å¯†é’¥é•¿åº¦éœ€è¦æ˜¯ 128, 192, æˆ– 256 ä½ï¼ˆ16, 24, æˆ– 32 å­—节)
        byte[] keyBytes = secretKey.getBytes("UTF-8");
        SecretKeySpec key = new SecretKeySpec(keyBytes, "AES");
        // åˆå§‹åŒ–向量 IV ä¹Ÿéœ€è¦æ˜¯ 128 ä½ï¼ˆ16 å­—节)
        byte[] ivBytes = secretKey.substring(0, 16).getBytes("UTF-8");
        IvParameterSpec iv = new IvParameterSpec(ivBytes);
        // è§£å¯†
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
        cipher.init(Cipher.DECRYPT_MODE, key, iv);
        // è§£å¯†çš„æ•°æ®éœ€è¦æ˜¯ Base64 ç¼–码的,因为 JavaScript çš„ CryptoJS é»˜è®¤è¿”回 Base64 ç¼–码的字符串
        byte[] decodedValue = Base64.getDecoder().decode(encryptedData);
        byte[] decryptedBytes = cipher.doFinal(decodedValue);
        return new String(decryptedBytes, "UTF-8");
    }
    /**
     * digest HMac
     *
     * @param algorithm ç®—法
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/Func.java
@@ -1232,6 +1232,16 @@
    }
    /**
     * AES è§£å¯†
     * @param encryptedData
     * @param secretKey
     * @return
     */
    public static String decryptAes(String encryptedData, String secretKey) throws Exception {
        return DigestUtil.decryptAes(encryptedData, secretKey);
    }
    /**
     * hmacMd5 Hex
     *
     * @param bytes Data to digest