From b8e9171376dc9d43a48ee09a29e9142e77b2e303 Mon Sep 17 00:00:00 2001 From: yuxc <yuxc@vci-tech.com> Date: 星期一, 06 一月 2025 16:22:56 +0800 Subject: [PATCH] 1、对操作类型返回增加图标信息。 2、增加导出用户信息excel接口。 --- Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/SmUserQueryServiceImpl.java | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 111 insertions(+), 4 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/SmUserQueryServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/SmUserQueryServiceImpl.java index 6d3928c..9c24c4f 100644 --- a/Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/SmUserQueryServiceImpl.java +++ b/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); + //鍐檈xcel + 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; + } } -- Gitblit v1.9.3