From 7a171b5193feef1d201b7d273b64ba2aebaddcda Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期三, 26 六月 2024 18:22:01 +0800
Subject: [PATCH] 成员管理:分配角色、分配部门、分配部门界面查询、角色角色界面查询等接口添加

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java |   67 +++++++++++++++++----------------
 1 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java
index 9c3d497..dc1e27b 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java
@@ -135,7 +135,7 @@
 	@Override
 	public boolean checkUserExist(String userName, String oid) throws PLException {
 		if(Func.isEmpty(userName) && Func.isEmpty(oid)){
-			throw new PLException("妫�鏌ョ敤鎴锋槸鍚﹀瓨鍦ㄦ椂锛屼紶閫掔殑鍙傛暟鐢ㄦ埛鍚嶅拰鐢ㄦ埛oid閮戒负绌猴紒",new String[0]);
+			throw new PLException("500", new String[] { "妫�鏌ョ敤鎴锋槸鍚﹀瓨鍦ㄦ椂锛屼紶閫掔殑鍙傛暟鐢ㄦ埛鍚嶅拰鐢ㄦ埛oid閮戒负绌猴紒"});
 		}
 		UserInfo userInfo = null;
 		if(Func.isNotEmpty(userName)) {
@@ -304,6 +304,8 @@
 		smUserVO.setUserTypeText(UserTypeEnum.getTextByValue(smUserVO.getUserType()));
 		smUserVO.setDescription(userInfo.desc);
 		smUserVO.setEmail(userInfo.email);
+		smUserVO.setStatus(userInfo.status);
+		smUserVO.setPassword(userInfo.pwd);
 		//鐢ㄦ埛鎵�灞為儴闂ㄧ殑鏌ヨ璁剧疆
 		List<OrgDepartmentVO> orgDepartmentVOList;
 		//鏌ョ湅鍏ㄥ眬鍙橀噺涓槸鍚﹀瓨鍦ㄩ儴闂ㄤ俊鎭紝瀛樺湪鐨勬儏鍐垫渶涓昏鏄拡瀵瑰鏉$敤鎴锋煡璇㈢殑鏃跺�欓伩鍏嶉噸澶嶆煡璇㈢殑
@@ -521,9 +523,9 @@
 		//鍒嗛〉鏌ヨ
 		UserInfo[] userInfos = platformClientUtil.getFrameworkService().fetchUserInfoByCondition(
 				conditionMap.get("name"),
-				conditionMap.get("userName"),
-				conditionMap.get("deptId"),
-				conditionMap.get("roleId"),
+				conditionMap.get("id"),
+				conditionMap.get("pkDepartment"),
+				conditionMap.get("pkPerson"),
 				"developer",  //褰撳墠鐧诲綍鐨勭敤鎴峰悕
 				pageHelper.getPage(),
 				pageHelper.getLimit()
@@ -538,9 +540,9 @@
 			dataGrid.setTotal(
 					platformClientUtil.getFrameworkService().getUserTotalByCondition(
 						conditionMap.get("name"),
-						conditionMap.get("userName"),
-						conditionMap.get("deptId"),
-						conditionMap.get("roleId"),
+						conditionMap.get("id"),
+						conditionMap.get("pkDepartment"),
+						conditionMap.get("pkPerson"),
 						"developer"  //褰撳墠鐧诲綍鐨勭敤鎴峰悕
 					)
 			);
@@ -1062,14 +1064,16 @@
 		smUserDTO.setCreator("developer");
 		//userObject.setUpdateUser(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserName());
 		smUserDTO.setLastModifier("developer");
-		UserInfo userInfo = changeUserObjectToUserInfo(smUserDTO);
+		UserInfo userInfo = changeSmUserDTOToUserInfo(smUserDTO);
 		UserEntityInfo userEntityInfo = new UserEntityInfo("developer", "");
 		String oid = platformClientUtil.getFrameworkService().saveUser(userInfo, userEntityInfo);
 		if (Func.isEmpty(oid)) {
 			return false;
 		}
 		if(Func.isNotBlank(smUserDTO.getPkDepartment())){
-			platformClientUtil.getFrameworkService().saveUserDept(new String[]{oid}, smUserDTO.getPkDepartment(), userEntityInfo);
+			//鎵ц淇濆瓨鐢ㄦ埛閮ㄩ棬鍏宠仈鍏崇郴
+			orgDeptQueryService.saveUsersDept(new String[]{oid},smUserDTO.getPkDepartment());
+			//platformClientUtil.getFrameworkService().saveUserDept(new String[]{oid}, smUserDTO.getPkDepartment(), userEntityInfo);
 		}
 		return true;
 	}
@@ -1094,28 +1098,21 @@
 		//鏍¢獙
 		check(smUserDTO,false);
 		//鏌ヨ鏁版嵁搴撲腑鐨�
-		SmUserVO dbSmUserVO = getUserByUserId(smUserDTO.getId());
-		//鏍规嵁鐢ㄦ埛鍚嶆煡璇㈠埌浜嗙敤鎴凤紝浣嗘槸oid涓嶆槸褰撳墠淇敼鐨勭敤鎴风殑oid锛岃鏄庝慨鏀圭殑鐢ㄦ埛鍚嶉噸澶�
-		if(Func.isNotEmpty(dbSmUserVO)
-			&& !dbSmUserVO.getOid().equals(smUserDTO.getOid())
-		){
-			throw new PLException("鐢ㄦ埛鍚嶅凡瀛樺湪锛屼笉鑳藉皢褰撳墠鐢ㄦ埛鐨勭敤鎴峰悕淇敼涓�" + dbSmUserVO.getId(),new String[0]);
+		SmUserVO dbSmUserVO = getUserByUserOid(smUserDTO.getOid());
+		//鏍规嵁涓婚敭娌℃煡璇㈠埌浜嗙敤鎴�
+		if(Func.isEmpty(dbSmUserVO) || Func.isBlank(dbSmUserVO.getOid())){
+			throw new PLException("500", new String[] { "褰撳墠淇敼鐨勭敤鎴蜂笉瀛樺湪"});
 		}
+
 		smUserDTO.setLastModifyTime(new Date());
 		//userObject.setUpdateUser(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserName());
 		smUserDTO.setLastModifier("developer");
-		UserInfo userInfo = changeUserObjectToUserInfo(smUserDTO);
+		UserInfo userInfo = changeSmUserDTOToUserInfo(smUserDTO);
 		boolean updateBoolean = platformClientUtil.getFrameworkService().updateUser(userInfo, new UserEntityInfo("developer", null));
-		//鐢ㄦ埛鍏宠仈閮ㄩ棬鏈夋墍鏇存敼
-		if(Func.isNotEmpty(smUserDTO.getPkDepartment()) && !smUserDTO.getPkDepartment().equals(dbSmUserVO.getPkDepartment())){
-			//鐣岄潰浼犻�掕繃鏉ョ殑宸插叧鑱旂殑閮ㄩ棬oid
-			List<String> updatePkDept = Func.toStrList(smUserDTO.getPkDepartment(), ",");
-			//鐢ㄦ埛宸插叧鑱旂殑閮ㄩ棬oid
-			List<String> associatedPkDept = Func.toStrList(dbSmUserVO.getPkDepartment(), ",");
-			//绉婚櫎
-			updatePkDept.removeAll(associatedPkDept);
+		//淇敼鎴愬姛锛屽苟涓旂敤鎴峰叧鑱旈儴闂ㄦ湁鎵�鏇存敼
+		if(updateBoolean && Func.isNotEmpty(smUserDTO.getPkDepartment()) && !smUserDTO.getPkDepartment().equals(dbSmUserVO.getPkDepartment())){
 			//鎵ц淇濆瓨鐢ㄦ埛閮ㄩ棬鍏宠仈鍏崇郴
-			orgDeptQueryService.saveUserDepts(dbSmUserVO.getOid(),updatePkDept);
+			orgDeptQueryService.saveUsersDept(new String[]{dbSmUserVO.getOid()},smUserDTO.getPkDepartment());
 		}
 		return updateBoolean;
 	}
@@ -1147,13 +1144,13 @@
 		if (Func.isNotBlank(smUserDTO.getDescription()) && smUserDTO.getDescription().getBytes().length > 255 ){
 			throw new VciBaseException("鎻忚堪闀垮害瓒呰繃涓婇檺");
 		}
-		if (!smUserDTO.getName().matches("^[A-Za-z0-9_]+$")) {
+		if (!smUserDTO.getId().matches("^[A-Za-z0-9_]+$")) {
 			throw new VciBaseException("鐢ㄦ埛鍚嶅繀椤绘槸鐢盇-Z a-z 0-9 _缁勬垚");
 		}
 		if (Func.isNotBlank(smUserDTO.getEmail()) && !smUserDTO.getEmail().matches("^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$")){
 			throw new VciBaseException("鐢靛瓙閭鏍煎紡閿欒");
 		}
-		//鏄柊澧炴墠鍋氱敤鎴峰悕鏌ラ噸澶勭悊
+		//鏄柊澧炴墠鍋氱敤鎴峰悕鏌ラ噸澶勭悊锛屽洜涓虹敤鎴峰悕涓�缁忓垱寤猴紝涓嶅厑璁镐慨鏀�
 		if(isAdd){
 			//鏍规嵁鐢ㄦ埛鍚嶏紙璐﹀彿锛夋煡閲�
 			SmUserVO dbSmUserVO = getUserByUserId(smUserDTO.getId());
@@ -1177,14 +1174,12 @@
 		}
 	}
 
-
-
 	/***
 	 * 鐢ㄦ埛浠嶥TO瀵硅薄鍒癱orba瀵硅薄
 	 * @param user
 	 * @return
 	 */
-	public UserInfo changeUserObjectToUserInfo(SmUserDTO user) {
+	public UserInfo changeSmUserDTOToUserInfo(SmUserDTO user) {
 		UserInfo userInfo = new UserInfo();
 		userInfo.id = user.getOid() == null ? "" : user.getOid();
 		userInfo.userName = user.getId() == null ? "" : user.getId();
@@ -1240,7 +1235,10 @@
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public boolean deleteUser(String[] ids) throws PLException {
-		VciBaseUtil.alertNotNull(ids,"寰呭垹闄ょ殑鐢ㄦ埛id鍒楄〃涓嶈兘涓虹┖锛�");
+		if(Func.isEmpty(ids)){
+			throw new VciBaseException("寰呭垹闄ょ殑鐢ㄦ埛id鍒楄〃涓嶈兘涓虹┖锛�");
+		}
+		//璋冪敤platformClientUtil鐨勫垹闄ょ敤鎴风殑鏂规硶锛屼細涓�璧峰垹闄ゆ帀鍏峰鍏宠仈鍏崇郴鐨勪竴浜涗俊鎭紝濡傞儴闂�
 		return platformClientUtil.getFrameworkService().deleteUser(ids, null);
 	}
 
@@ -1252,9 +1250,14 @@
 	 */
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public boolean disableOrEnableUsers(String[] ids, boolean flag) throws PLException {
+	public boolean stopUsers(String[] ids, boolean flag) throws PLException {
 		VciBaseUtil.alertNotNull(ids,"鍋滅敤/鍚敤鐨勭敤鎴穒d鍒楄〃");
 		return platformClientUtil.getFrameworkService().stopUsers(ids, flag,null);
 	}
 
+	@Override
+	public void downloadImportTemplate() {
+
+	}
+
 }

--
Gitblit v1.9.3