用户管理界面,增加部门查询、角色下拉查询、分配密码策略接口,联调修改代码上传
已修改11个文件
242 ■■■■ 文件已修改
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/revision/bo/TreeWrapperOptions.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/pagemodel/BaseResult.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmPwdStrategyQueryServiceI.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmPwdStrategyQueryServiceImpl.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmPwdStrategyQueryController.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmRoleQueryController.java 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/SmPasswordStrategyForPlatform1.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/pagemodel/SmPasswordStrategyVO.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/revision/bo/TreeWrapperOptions.java
@@ -22,6 +22,7 @@
     * 多个显示文本的属性时的分隔符(最终显示的值的分隔符)
     */
    private String textValueSep = " ";
    /**
     * 上级数据的属性名称
     */
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/pagemodel/BaseResult.java
@@ -8,6 +8,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
 * 统一的数据返回对象,保证feign、restTemplate或者其他rest请求客户端可以统一处理
@@ -84,7 +85,7 @@
    /**
     * 数据,easyui使用的rows, extjs和layui默认为data;easyui也可以修改为data,因此均使用data
     */
    private Collection<T> data ;
    private Collection<T> data;
    /**
     * 树的数据
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmPwdStrategyQueryServiceI.java
@@ -30,13 +30,15 @@
     * @param pageHelper
     * @return
     */
    DataGrid<SmPasswordStrategyVO> refDataGrid(Map<String, String> conditionMap, PageHelper pageHelper);
    DataGrid<SmPasswordStrategyVO> refDataGrid(Map<String, String> conditionMap, PageHelper pageHelper) throws PLException;
    /**
     * 查询所有密码安全策略
     * @return
     * 查询密码安全策略,下拉使用的接口
     * @param conditionMap
     * @return key为密码策略name,value为密码策略的oid
     * @throws VciBaseException
     */
    //List<SmPasswordStrategyVO> listPasswordStrategyVO(Map<String, String> conditionMap);
    List<Map<String,String>> selectPwdStrategyMap(Map<String, String> conditionMap) throws PLException;
    /**
     * 保存用户关联密码策略
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java
@@ -387,8 +387,9 @@
            VciQueryWrapperForDO queryWrapperForDO = new VciQueryWrapperForDO(conditionMap,OrgDeptForPlatform1.class);
            orgDepartmentVOList = deptDO2VOs(boService.selectByQueryWrapper(queryWrapperForDO,OrgDeptForPlatform1.class));
        }
        TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions("pkFatherDepartment");
        TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions();
        BeanUtil.convert(treeQueryObject,treeWrapperOptions);
        treeWrapperOptions.setParentFieldName("pkFatherDepartment");
        return revisionModelUtil.doList2Trees(orgDepartmentVOList,treeWrapperOptions,dept->{
            return dept.getId() + " " + dept.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equals(dept.getLcStatus())?"【停用】":"");
        });
@@ -458,6 +459,5 @@
        }
        return true;
    }
}
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmPwdStrategyQueryServiceImpl.java
@@ -2,11 +2,18 @@
import com.vci.corba.common.PLException;
import com.vci.corba.common.data.UserEntityInfo;
import com.vci.corba.framework.data.PasswordStrategyInfo;
import com.vci.corba.omd.data.BusinessObject;
import com.vci.frameworkcore.compatibility.SmPwdStrategyQueryServiceI;
import com.vci.frameworkcore.compatibility.SmUserQueryServiceI;
import com.vci.frameworkcore.constant.FrameWorkBtmTypeConstant;
import com.vci.frameworkcore.enumpck.RoleClassifyEnum;
import com.vci.frameworkcore.enumpck.RoleControlAreaEnum;
import com.vci.frameworkcore.model.SmPasswordStrategyDO;
import com.vci.frameworkcore.model.SmPasswordStrategyForPlatform1;
import com.vci.frameworkcore.model.SmRoleForPlatform1;
import com.vci.frameworkcore.pagemodel.SmPasswordStrategyVO;
import com.vci.frameworkcore.pagemodel.SmRoleVO;
import com.vci.omd.utils.ObjectTool;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.DataGrid;
@@ -79,8 +86,89 @@
     * @return
     */
    @Override
    public DataGrid<SmPasswordStrategyVO> refDataGrid(Map<String, String> conditionMap, PageHelper pageHelper) {
        return null;
    public DataGrid<SmPasswordStrategyVO> refDataGrid(Map<String, String> conditionMap, PageHelper pageHelper) throws PLException {
        if(pageHelper == null){
            pageHelper = new PageHelper(-1);
        }
        pageHelper.addDefaultAsc("pname");
        VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(conditionMap, SmPasswordStrategyDO.class,pageHelper);
        //queryWrapper.eq("pltype","2");
        platformClientUtil.getFrameworkService().fetchAllPasswordStrategy();
        //platformClientUtil.getFrameworkService().fetchpassword();
        List<SmPasswordStrategyForPlatform1> smPasswordStrategyForPlatform1s = boService.selectByQueryWrapper(queryWrapper, SmPasswordStrategyForPlatform1.class);
        DataGrid<SmPasswordStrategyVO> dataGrid = new DataGrid<>();
        if(!CollectionUtils.isEmpty(smPasswordStrategyForPlatform1s)){
            dataGrid.setData(pltPwdStrategy2SmPwdStrategyVOs(smPasswordStrategyForPlatform1s));
            dataGrid.setTotal(boService.countByQueryWrapper(queryWrapper,SmPasswordStrategyForPlatform1.class));
        }
        return dataGrid;
    }
    /**
     * 查询密码安全策略,下拉使用的接口
     * @param conditionMap
     * @return key为密码策略name,value为密码策略的oid
     * @throws VciBaseException
     */
    @Override
    public List<Map<String,String>> selectPwdStrategyMap(Map<String, String> conditionMap) throws PLException {
        PageHelper pageHelper = new PageHelper(-1);
        pageHelper.addDefaultAsc("plname");
        PasswordStrategyInfo[] passwordStrategyInfos = platformClientUtil.getFrameworkService().fetchAllPasswordStrategy();
        List<Map<String,String>> mapArrayList = new ArrayList<>();
        if(Func.isEmpty(passwordStrategyInfos)){
            return mapArrayList;
        }
        Arrays.stream(passwordStrategyInfos).forEach(item->{
            Map<String, String> map = new HashMap<>();
            map.put("name",item.name);
            map.put("id",item.id);
            mapArrayList.add(map);
        });
        return mapArrayList;
    }
    /**
     * 原平台密码策略转SmPasswordStrategyVOS对象
     * @param smPasswordStrategyForPlatform1s 原平台的密码策略
     * @return
     */
    private List<SmPasswordStrategyVO> pltPwdStrategy2SmPwdStrategyVOs(List<SmPasswordStrategyForPlatform1> smPasswordStrategyForPlatform1s){
        List<SmPasswordStrategyVO> smPasswordStrategyVOList = new ArrayList<>();
        if(!CollectionUtils.isEmpty(smPasswordStrategyForPlatform1s)){
            smPasswordStrategyForPlatform1s.stream().forEach(s -> {
                smPasswordStrategyVOList.add(pltPwdStrategy2SmPwdStrategyVO(s));
            });
        }
        return smPasswordStrategyVOList;
    }
    /**
     * 原平台密码策略转SmPasswordStrategyVO对象
     * @param strategyForPlatform1 原平台的密码策略
     * @return 新的密码策略对象
     */
    private SmPasswordStrategyVO pltPwdStrategy2SmPwdStrategyVO(SmPasswordStrategyForPlatform1 strategyForPlatform1){
        SmPasswordStrategyVO strategyVO = new SmPasswordStrategyVO();
        strategyVO.setOid(strategyForPlatform1.getPluid());
        strategyVO.setId("");
        strategyVO.setName(strategyForPlatform1.getPname());
        strategyVO.setMaxLength(strategyForPlatform1.getPlmaxlength());
        strategyVO.setMinLength(strategyForPlatform1.getPlength());
        strategyVO.setValidDay(strategyForPlatform1.getPremindday());
        strategyVO.setRemindDay(strategyForPlatform1.getPremindday());
        strategyVO.setRetryTime(strategyForPlatform1.getPretrytime());
        strategyVO.setLockTime(strategyForPlatform1.getPlocktime());
        strategyVO.setDefaultFlag(strategyForPlatform1.getPlisdefault() == 1);
        strategyVO.setDescription(strategyForPlatform1.getPldesc());
        strategyVO.setCreateTime(strategyForPlatform1.getPlcreatetime());
        strategyVO.setCreator(strategyForPlatform1.getPlcreateuser());
        strategyVO.setLastModifyTime(strategyForPlatform1.getPlupdatetime());
        strategyVO.setLastModifier(strategyForPlatform1.getPlupdateuser());
        strategyVO.getRequireCharType(strategyForPlatform1.getPcharspecies());
        strategyVO.setLicensors(strategyForPlatform1.getPllicensors());
        strategyVO.setRequireCharCount(strategyForPlatform1.getPlrequiredtype());
        return strategyVO;
    }
    /**
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java
@@ -105,15 +105,13 @@
     * @throws VciBaseException 参数为空的时候会抛出异常
     */
    @Override
    public DataGrid<SmRoleVO> gridRoles(Map<String, String> queryMap,
                                        PageHelper pageHelper) throws VciBaseException {
    public DataGrid<SmRoleVO> gridRoles(Map<String, String> queryMap, PageHelper pageHelper) throws VciBaseException {
        if(pageHelper == null){
            pageHelper = new PageHelper(-1);
        }
        pageHelper.addDefaultAsc("plname");
        VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(queryMap,SmRoleForPlatform1.class,pageHelper);
        //我们不能显示三员和管理员的角色
        queryWrapper.eq("pltype","2");
        //queryWrapper.eq("pltype","2");
        List<SmRoleForPlatform1> roleForPlatform1s = boService.selectByQueryWrapper(queryWrapper, SmRoleForPlatform1.class);
        DataGrid<SmRoleVO> dataGrid = new DataGrid<>();
        if(!CollectionUtils.isEmpty(roleForPlatform1s)){
@@ -522,25 +520,6 @@
    public boolean saveRights(String userOid, String[] roleIds) throws PLException {
        VciBaseUtil.alertNotNull(userOid,"用户主键");
        //roleIds允许为空,为空时清空当前用户的权限
        //先查重
        if(Func.isNotEmpty(roleIds)){
            List<String> repeatRoleOidList = new ArrayList<>();
            //循环进行查重,避免in大于1000
            WebUtil.switchCollectionForOracleIn(Arrays.asList(roleIds)).stream().forEach(deptoids->{
                String sql = "select pluseruid,plroleuid from pluserrole where pluseruid = '" + userOid
                        + "' and " + "plroleuid in ("+WebUtil.toInSql(deptoids.toArray(new String[0]))+")";
                List<BusinessObject> cbos = boService.queryBySql(sql, null);
                if(!CollectionUtils.isEmpty(cbos)){
                    cbos.stream().forEach(cbo->{
                        repeatRoleOidList.add(ObjectTool.getNewBOAttributeValue(cbo,"plroleuid"));
                    });
                }
            });
            //移除重复的
            List<String> tempList = new ArrayList<>(Arrays.asList(roleIds));
            tempList.removeAll(repeatRoleOidList);
            roleIds = tempList.toArray(new String[tempList.size()]);
        }
        return platformClientUtil.getFrameworkService().saveRights(roleIds,new String[]{userOid},new UserEntityInfo());
    }
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java
@@ -1,17 +1,15 @@
package com.vci.frameworkcore.controller;
import com.vci.corba.common.PLException;
import com.vci.frameworkcore.compatibility.OrgDeptQueryServiceI;
import com.vci.frameworkcore.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.VciBaseUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@@ -39,6 +37,7 @@
     * @throws VciBaseException 查询出错的时候会抛出异常,如果是老的项目里不抛出异常
     */
    @RequestMapping(value = "/refTree",method = RequestMethod.GET)
    //@VciUnCheckRight
    public BaseResult<Tree> refTree(TreeQueryObject treeQueryObject) throws VciBaseException{
        List<Tree> deptTreeList = deptQueryService.refTreeDept(treeQueryObject);
        return  BaseResult.tree(deptTreeList);
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmPwdStrategyQueryController.java
@@ -3,6 +3,7 @@
import com.vci.frameworkcore.compatibility.SmPwdStrategyQueryServiceI;
import com.vci.frameworkcore.pagemodel.SmPasswordStrategyVO;
import com.vci.frameworkcore.pagemodel.SmUserVO;
import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseQueryObject;
import com.vci.starter.web.pagemodel.BaseResult;
@@ -15,6 +16,8 @@
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
 * @author ludc
@@ -32,12 +35,13 @@
    private SmPwdStrategyQueryServiceI pwdStrategyQueryService;
    /**
     * 用户的列表参照,
     * @param queryObject 查询对象,包含了查询条件,分页,排序等,即允许使用SmUserVO里的所有属性作为查询条件,也可以使用pkRole.xxx,pkDepartment.xxx,pkDuty.xxx这样来查询
     * @return 普通用户(不包含三员,也不包含停用的)的显示对象列表数据,请获取其中的data属性
     * 密码安全策略的列表参照查询
     * @param queryObject 查询条件
     * @return
     * @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());
@@ -50,6 +54,26 @@
        }
    }
    /**
     * 查询密码安全策略,下拉使用的接口
     * @param queryObject
     * @return key为密码策略name,value为密码策略的oid
     * @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());
            return BaseResult.dataList(pwdStrategyVODataGrid);
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
            log.error("密码安全策略下拉列表查询时出现错误,原因:" + exceptionMessage);
            return BaseResult.fail("密码安全策略下拉列表查询时出现错误,原因:" + e.getMessage());
        }
    }
    @RequestMapping(value = "/saveUserPasswordStrateg",method = RequestMethod.POST)
    public BaseResult saveUserPasswordStrateg(String[] userIds, String passwordStrategId){
        try {
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmRoleQueryController.java
@@ -2,6 +2,7 @@
import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI;
import com.vci.frameworkcore.pagemodel.SmRoleVO;
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.VciBaseUtil;
@@ -39,14 +40,42 @@
     * @throws VciBaseException 查询出错的时候会抛出异常,如果是老的项目里不抛出异常
     */
    @RequestMapping(value = "/refDataGrid",method = RequestMethod.GET)
    public BaseResult<SmRoleVO> refDataGrid(BaseQueryObject queryObject) throws VciBaseException {
        if(queryObject == null){
            queryObject = new BaseQueryObject();
    public BaseResult<SmRoleVO> refDataGrid(BaseQueryObject queryObject) {
        try {
            if(queryObject == null){
                queryObject = new BaseQueryObject();
            }
            DataGrid<SmRoleVO> roleVODataGrid = roleQueryService.refGridRoles(queryObject.getConditionMap(),queryObject.getPageHelper());
            return BaseResult.dataGrid(roleVODataGrid);
        }catch (Exception e){
            e.printStackTrace();
            String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
            log.error("查询角色列表时出现错误,原因:" + exceptionMessage);
            return BaseResult.fail("查询角色列表时出现错误,原因" + exceptionMessage);
        }
        DataGrid<SmRoleVO> roleVODataGrid =  roleQueryService.refGridRoles(queryObject.getConditionMap(),queryObject.getPageHelper());
        return BaseResult.dataGrid(roleVODataGrid);
        //如果是老的项目,应该在refGridRoles上添加try,catch,然后catch里应该使用下面的代码
        //BaseResult.fail("这里返回前端的错误信息");
    }
    /**
     * 角色的列表查询:用于下拉,还有列表等全查询场景
     * @param queryObject 查询对象,包含了查询条件,分页,排序等,即允许使用SmRoleVO里的所有属性作为查询条件
     * @return 包含三员的角色 的显示对象列表数据,请获取其中的data属性
     * @throws VciBaseException 查询出错的时候会抛出异常,如果是老的项目里不抛出异常
     */
    @RequestMapping(value = "/gridRoles",method = RequestMethod.GET)
    //@VciUnCheckRight
    public BaseResult<SmRoleVO> gridRoles(BaseQueryObject queryObject) {
        try {
            if(queryObject == null){
                queryObject = new BaseQueryObject();
            }
            DataGrid<SmRoleVO> roleVOData = roleQueryService.gridRoles(queryObject.getConditionMap(),queryObject.getPageHelper());
            return BaseResult.dataGrid(roleVOData);
        }catch (Exception e){
            e.printStackTrace();
            String exceptionMessage = VciBaseUtil.getExceptionMessage(e);
            log.error("查询角色列表时出现错误,原因:" + exceptionMessage);
            return BaseResult.fail("查询角色列表时出现错误,原因:"+exceptionMessage);
        }
    }
    /**
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/model/SmPasswordStrategyForPlatform1.java
@@ -1,10 +1,15 @@
package com.vci.frameworkcore.model;
import com.vci.frameworkcore.constant.FrameWorkBtmTypeConstant;
import com.vci.starter.web.annotation.VciBtmType;
import com.vci.starter.web.constant.FrameWorkLcStatusConstant;
import java.util.Date;
/**
 * 原平台的密码安全策略
 */
@VciBtmType(name = FrameWorkBtmTypeConstant.SM_PASSWORD_STRATEGY,tableName = "plpasswordstrategy",lifeCycle = FrameWorkLcStatusConstant.EMTYPE_LIFE_CYCLE)
public class SmPasswordStrategyForPlatform1 {
    /**
     * 主键
@@ -22,7 +27,7 @@
    private Integer plength;
    /**
     *
     * 有效天数
     */
    private Integer poverdueday;
@@ -77,7 +82,7 @@
    private Integer pcharspecies;
    /**
     * 许可
     * 授权者
     */
    private String pllicensors;
@@ -87,7 +92,7 @@
    private Integer plmaxlength;
    /**
     * 需要的类型
     * 需要的类型(必填种类字段)
     */
    private Integer plrequiredtype;
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/pagemodel/SmPasswordStrategyVO.java
@@ -59,6 +59,22 @@
     */
    private Integer requireCharCount;
    /**
     * 授权者
     */
    private String licensors;
    public void setLicensors(String licensors) {
        this.licensors = licensors;
    }
    public String getLicensors() {
        return licensors;
    }
    public String getRequireCharType() {
        return requireCharType;
    }
    public Integer getRequireCharCount() {
        return requireCharCount;
@@ -124,7 +140,7 @@
        this.maxLength = maxLength;
    }
    public String getRequireCharType() {
    public String getRequireCharType(Integer plrequiredtype) {
        return requireCharType;
    }