1、对操作类型返回增加图标信息。
2、增加导出用户信息excel接口。
已修改4个文件
142 ■■■■■ 文件已修改
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/controller/SmUserQueryController.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/SmUserQueryServiceI.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/SmUserQueryServiceImpl.java 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/SmFunctionQueryServicePlatformImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/controller/SmUserQueryController.java
@@ -370,6 +370,26 @@
    }
    /**
     * 导出人员
     * @param response
     */
    @RequestMapping(value = "/expUser",method = RequestMethod.GET)
    public void expUser(HttpServletResponse response){
        try {
            String excelPath = userQueryService.expUser();
            ControllerUtil.writeFileToResponse(response,excelPath);
        } catch (Exception e) {
            String msg = "导出用户时出现错误,原因:" + LangBaseUtil.getErrorMsg(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 treeQueryObject 树形数据的查询对象,包括查询条件,上级主键,是否多选等,即允许使用SmUserVO里的所有属性作为查询条件,也可以使用pkRole.xxx,pkDepartment.xxx,pkDuty.xxx这样来查询
     * @return 普通用户(不包含三员,也不包含停用的)的树形数据,已经转换过上下级关系,请获取其中的treeData属性
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/SmUserQueryServiceI.java
@@ -277,4 +277,10 @@
     * @throws VciBaseException
     */
    List<SmUserVO> listUserByUserType(Integer type) throws PLException;
    /**
     * 导出用户列表三员账号除外
     * @return
     */
    String expUser() throws PLException;
}
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/SmUserQueryServiceImpl.java
@@ -4,10 +4,7 @@
import com.vci.common.utility.ObjectUtility;
import com.vci.corba.common.PLException;
import com.vci.corba.common.data.UserEntityInfo;
import com.vci.corba.framework.data.DeptInfo;
import com.vci.corba.framework.data.RoleInfo;
import com.vci.corba.framework.data.UserInfo;
import com.vci.corba.framework.data.UserLogonInfo;
import com.vci.corba.framework.data.*;
import com.vci.corba.omd.data.BusinessObject;
import com.vci.corba.omd.etm.EnumItem;
import com.vci.corba.omd.etm.EnumType;
@@ -1681,5 +1678,115 @@
            throw new VciBaseException("登录时,获取用户信息失败:"+e.getMessage());
        }
    }
    /**
     * 导出用户列表三员账号除外
     * @return
     */
    @Override
    public String expUser() throws PLException {
        // 设置表单列名
        List<String> columns = new ArrayList<>(Arrays.asList("姓名, 账号, 状态, 密码策略, 锁定状态, 所属部门, 专业, 角色, 电子邮件, 描述, 部门领导, 密级".split(",")));
        //设置必填列
        ColumnNameisRed.clear();
        ColumnNameisRed.add(0);
        ColumnNameisRed.add(1);
        ColumnNameisRed.add(2);
        //写excel
        String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + "userList.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)));
            }
        }
        UserInfo[] userInfos = platformClientUtil.getFrameworkService().fetchUserInfoWithOutSanYuan();
        //部门信息集合
        Hashtable<String, String> deptHashTable = new Hashtable<String, String>();
        for(int index = 1; index <= userInfos.length; index++){
            UserInfo userInfo = userInfos[index-1];
            excelDataList.add(new WriteExcelData(index,0, userInfo.trueName));
            excelDataList.add(new WriteExcelData(index,1, userInfo.userName));
            excelDataList.add(new WriteExcelData(index,2, userInfo.status==1 ? "停用":"启用"));
            /**密码策略**/
            PasswordStrategyInfo pwsObj = platformClientUtil.getFrameworkService().fetchPasswordStrategyByUserId(userInfo.id);
            excelDataList.add(new WriteExcelData(index,3, pwsObj.name));
            /**锁定状态**/
            UserLogonInfo lockObj = platformClientUtil.getFrameworkService().fetchUserLogonObj(userInfo.id);
            if (pwsObj != null)
                excelDataList.add(new WriteExcelData(index,4, (pwsObj.retryTime > 0 && lockObj.plWrongNum >= pwsObj.retryTime) ? "锁定" : "未锁定"));
            else
                excelDataList.add(new WriteExcelData(index,4, "未锁定"));
            DeptInfo obj = null;
            RoleInfo[] roles = null;
            String deptName = "";
            obj = platformClientUtil.getFrameworkService().fetchDeptByUserId(userInfo.id);
            if (obj != null){
                if(!deptHashTable.containsKey((obj.id))){
                    deptName = getDeptObjectAllByDeptId(obj);
                    deptHashTable.put(obj.id, deptName);
                }else{
                    deptName = deptHashTable.get(obj.id);
                }
            }
            roles = platformClientUtil.getFrameworkService().fetchRoleInfoByUserId(userInfo.id);
            excelDataList.add(new WriteExcelData(index,5, deptName));
            excelDataList.add(new WriteExcelData(index,6, userInfo.specialties));
            String roleNames = "";
            if (roles.length != 0){
                for(int j = 0 ; j < roles.length ; j ++){
                    if (j < roles.length -1){
                        roleNames += roles[j].name + ",";
                    }else {
                        roleNames +=  roles[j].name;
                    }
                }
            }
            excelDataList.add(new WriteExcelData(index,7, roleNames));
            excelDataList.add(new WriteExcelData(index,8, userInfo.email));
            excelDataList.add(new WriteExcelData(index,9, userInfo.desc));
            excelDataList.add(new WriteExcelData(index,10, userInfo.isDeptLeader.equals("1") ? "是" : "否"));
            String secretGrade = String.valueOf(userInfo.secretGrade);
            try {
                EnumType item = platformClientUtil.getEnumService().getEnumTypeByName(ENUM_USERSECURITYENUM);
                EnumItem[] children = item.items;
                String securityShowName = "";
                for(EnumItem child: children){
                    if(child.value.equals(secretGrade)){
                        securityShowName = child.name;
                        break;
                    }
                }
                excelDataList.add(new WriteExcelData(index,11, securityShowName));
            } catch (PLException e) {
                e.printStackTrace();
            }
        }
        WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
        ExcelUtil.writeDataToFile(excelPath, excelOption);
        return excelPath;
    }
    //根据子部门查询所属的父类部门,并拼接成字符串形式,返回
    public String getDeptObjectAllByDeptId(DeptInfo obj) throws PLException {
        String fetchDepName = "";
        DeptInfo[] depObjectAll = platformClientUtil.getFrameworkService().fetchDepartmentInfosBySonId(obj.id);
        for(int i=depObjectAll.length-1;i>=0; i--){
            fetchDepName += depObjectAll[i].name+"/";
        }
        if(fetchDepName.length() != 0){
            fetchDepName = fetchDepName.substring(0, fetchDepName.length() - 1);
        }
        return fetchDepName;
    }
}
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/SmFunctionQueryServicePlatformImpl.java
@@ -488,6 +488,7 @@
                                    menuVO.setHasChildren(false);
                                    menuVO.setCategory(1);
                                    menuVO.setFunctionType(3);
                                    menuVO.setSource(info.image);
                                    menuVOList.add(menuVO);
                                }
                            }