From ca2d9c7e8746f81ad9a0f19e2a1ca6515c7ac931 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期二, 25 六月 2024 10:20:39 +0800
Subject: [PATCH] 用户管理:停用、启用、修改、删除
---
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java | 57 ++++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java | 432 +++++++++++++++++++++++++++++++--------
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java | 22 +
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/pagemodel/SmUserVO.java | 29 ++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmUserQueryController.java | 100 +++++++++
5 files changed, 535 insertions(+), 105 deletions(-)
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java
index 22c3431..9290c23 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java
@@ -1,5 +1,7 @@
package com.vci.frameworkcore.compatibility;
+import com.vci.corba.common.PLException;
+import com.vci.frameworkcore.dto.SmUserDTO;
import com.vci.frameworkcore.pagemodel.SmPasswordStrategyVO;
import com.vci.frameworkcore.pagemodel.SmUserVO;
import com.vci.starter.web.exception.VciBaseException;
@@ -7,6 +9,7 @@
import com.vci.starter.web.pagemodel.PageHelper;
import com.vci.starter.web.pagemodel.Tree;
import com.vci.starter.web.pagemodel.TreeQueryObject;
+import com.vci.web.model.SmUserDO;
import java.util.Collection;
import java.util.List;
@@ -20,6 +23,14 @@
* @date 2020/3/1
*/
public interface SmUserQueryServiceI{
+
+ /**
+ * 妫�鏌ョ敤鎴锋槸鍚﹀瓨鍦紝鍙互鏍规嵁鐢ㄦ埛鍚嶏紝涔熷彲浠ユ牴鎹敤鎴穙id
+ * @param userName 浼爊ull锛屽嵆鐢╫id浣滀负妫�鏌ユ潯浠�
+ * @param oid 浼爊ull锛屽嵆鐢╱serName浣滀负妫�鏌ユ潯浠�
+ * @return true瀛樺湪锛宖alse涓嶅瓨鍦�
+ */
+ boolean checkUserExist(String userName,String oid) throws PLException;
/**
* 鏍规嵁鐢ㄦ埛鍚嶈幏鍙栫敤鎴风殑瀵硅薄锛屼笉鍖哄垎澶у皬鍐�
@@ -61,6 +72,14 @@
* @throws VciBaseException 鍙傛暟涓虹┖鐨勬椂鍊欎細鎶涘嚭寮傚父
*/
DataGrid<SmUserVO> gridUsers(Map<String, String> queryMap, PageHelper pageHelper) throws VciBaseException;
+
+ /**
+ * 鐢ㄦ埛绠$悊鐣岄潰鍒嗛〉鏌ヨ
+ * @param conditionMap 鏌ヨ鏉′欢
+ * @param pageHelper 鍒嗛〉鍙傛暟
+ * @return
+ */
+ DataGrid<SmUserVO> getDataGridUsers(Map<String, String> conditionMap, PageHelper pageHelper) throws PLException;
/**
* 鏍规嵁鐢ㄦ埛鍚嶈幏鍙栫敤鎴风殑濮撳悕
@@ -184,6 +203,7 @@
* @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父
*/
List<Tree> refTreeUsers(TreeQueryObject treeQueryObject) throws VciBaseException;
+
/**
* 鏍¢獙瀵嗙爜鏄惁鐩稿悓锛屽湪鏂板钩鍙颁腑瀛樺偍鐨勫瘑鐮佹槸涓ゆmd5
* @param userOid 鐢ㄦ埛涓婚敭
@@ -199,14 +219,6 @@
* @return true琛ㄧず宸茬粡閿佸畾
*/
boolean checkUserLock(SmUserVO smUserVO, Integer wrongCount);
-
- /**
- * 鏍规嵁鐢ㄦ埛鐨勪富閿紝鑾峰彇鐢ㄦ埛鐨勫瘑鐮佸畨鍏ㄧ瓥鐣�
- * @param userOid 鐢ㄦ埛鐨勪富閿�
- * @return 瀵嗙爜瀹夊叏绛栫暐鐨勬樉绀哄璞★紝濡傛灉涓嶅瓨鍦ㄥ垯浼氳繑鍥濶ull
- * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呮暟鎹簱鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父
- */
- SmPasswordStrategyVO getPasswordStrategyVOByUserOid(String userOid) throws VciBaseException;
/**
* 璁剧疆鏌愪釜鐢ㄦ埛鏄攣瀹氱姸鎬�
@@ -243,4 +255,33 @@
*/
void updateUserLoginTime(String userOid) throws VciBaseException;
+ /**
+ * 娣诲姞鐢ㄦ埛
+ * @param smUserDTO
+ * @return
+ */
+ boolean addUser(SmUserDTO smUserDTO) throws PLException;
+
+ /**
+ * 淇敼鐢ㄦ埛
+ * @param smUserDTO
+ * @return
+ */
+ boolean updateUser(SmUserDTO smUserDTO) throws PLException;
+
+ /**
+ * 鍒犻櫎鐢ㄦ埛
+ * @param ids
+ * @return
+ */
+ boolean deleteUser(String[] ids) throws PLException;
+
+ /**
+ * 鐢ㄦ埛鍋滅敤/鍚敤
+ * @param ids
+ * @param flag
+ * @return
+ */
+ boolean disableOrEnableUsers(String[] ids,boolean flag) throws PLException;
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java
index 6ad8bf9..0f3131a 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java
@@ -6,6 +6,7 @@
import com.vci.frameworkcore.enumpck.RoleClassifyEnum;
import com.vci.frameworkcore.enumpck.RoleControlAreaEnum;
import com.vci.frameworkcore.model.SmRoleForPlatform1;
+import com.vci.frameworkcore.pagemodel.OrgDepartmentVO;
import com.vci.frameworkcore.pagemodel.SmRoleVO;
import com.vci.omd.utils.ObjectTool;
import com.vci.starter.web.constant.QueryOptionConstant;
@@ -26,6 +27,7 @@
import org.springframework.util.CollectionUtils;
import java.util.*;
+import java.util.function.Function;
import java.util.stream.Collectors;
import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST;
@@ -61,6 +63,7 @@
}
return platformRole2SmRoleVO(role);
}
+
/**
* 鎵归噺鑾峰彇瑙掕壊鐨勪俊鎭� 锛堟牴鎹鑹蹭富閿級
* @param roleOidCollections 瑙掕壊涓婚敭鐨勯泦鍚堬紝鍙互瓒呰繃1000涓�
@@ -84,6 +87,7 @@
});
return platformRole2SmRoleVOs(roles);
}
+
/**
* 鑾峰彇瑙掕壊鐨勫垪琛紝榛樿浼氫互瑙掕壊鍚嶅崌搴忔帓鍒楋紝瑙掕壊鐨勭紪杈戦〉闈㈠垪琛ㄤ笉瑕佷娇鐢ㄨ繖涓帴鍙�
* @param queryMap 鏌ヨ鏉′欢
@@ -109,6 +113,7 @@
}
return dataGrid;
}
+
/**
* 鏍规嵁瑙掕壊涓婚敭鑾峰彇瑙掕壊鐨勫鍚�
* @param roleOid 瑙掕壊涓婚敭
@@ -119,6 +124,7 @@
WebUtil.alertNotNull(roleOid,"瑙掕壊涓婚敭");
return getRoleByRoleOid(roleOid).getName();
}
+
/**
* 鏍规嵁鐢ㄦ埛涓婚敭鑾峰彇鍏宠仈鐨勮鑹�
* @param userOid 鐢ㄦ埛涓婚敭
@@ -170,6 +176,7 @@
}
return platformRole2SmRoleVOs(roles);
}
+
/**
* 鏍规嵁鐢ㄦ埛涓婚敭鑾峰彇鍏宠仈鐨勮鑹�
* @param userOid 鐢ㄦ埛涓婚敭
@@ -210,6 +217,7 @@
}
return gridRoles(queryMap,pageHelper);
}
+
/**
* 鑾峰彇鏈叧鑱旀煇涓敤鎴风殑瑙掕壊
* @param userOid 鐢ㄦ埛涓婚敭
@@ -221,6 +229,7 @@
Map<String, String> queryMap) {
return listRoleByUserOid(userOid,queryMap,true);
}
+
/**
* 鑾峰彇鏈叧鑱旀煇涓敤鎴风殑瑙掕壊
* @param userOid 鐢ㄦ埛涓婚敭
@@ -233,6 +242,7 @@
Map<String, String> queryMap, PageHelper pageHelper) {
return gridRoleByUserOid(userOid,queryMap,pageHelper,true);
}
+
/**
* 鎵归噺鏍规嵁鐢ㄦ埛鐨勪富閿潵鑾峰彇瑙掕壊
* @param userOidCollection 鐢ㄦ埛涓婚敭闆嗗悎
@@ -255,16 +265,19 @@
List<BusinessObject> cbos = boService.queryBySql(sql, null);
if(!CollectionUtils.isEmpty(cbos)){
cbos.stream().forEach(cbo->{
- String userOid = ObjectTool.getBOAttributeValue(cbo,"pluseruid");
+ String userOid = ObjectTool.getNewBOAttributeValue(cbo,"pluseruid");
List<String> roleOids = userRoleOidMap.getOrDefault(userOid,new ArrayList<>());
- roleOids.add(ObjectTool.getBOAttributeValue(cbo,"plroleuid"));
+ roleOids.add(ObjectTool.getNewBOAttributeValue(cbo,"plroleuid"));
userRoleOidMap.put(userOid,roleOids);
});
}
}
});
if(!CollectionUtils.isEmpty(roleVOList)){
- Map<String, SmRoleVO> roleVOMap = roleVOList.stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
+ //杩欏効搴旇瀵箁oleVOList鍋氫竴娆″幓閲嶅鐞嗭紝鍥犱负鑲畾浼氭湁閲嶅鐨勮鑹茶鏌ュ嚭鏉�
+ Map<String, SmRoleVO> roleVOMap = roleVOList.stream()
+ .collect(Collectors.toMap(SmRoleVO::getOid, Function.identity(), (existing, replacement) -> existing));
+ //Map<String, SmRoleVO> roleVOMap = roleVOList.stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
Map<String, List<SmRoleVO>> userRoleVOMap = new HashMap<>();
userRoleOidMap.forEach((userOid,roleOids)->{
List<SmRoleVO> roleVOS = new ArrayList<>();
@@ -279,6 +292,7 @@
}
return new HashMap<>();
}
+
/**
* 鏍规嵁鏉冮檺涓婚敭鑾峰彇鍏宠仈鐨勮鑹�
* @param functionOid 鏉冮檺涓婚敭
@@ -444,6 +458,7 @@
}
return new HashMap<>();
}
+
/**
* 鍙傜収瑙掕壊鐨勫垪琛紝涓夊憳绠$悊鐨勪笁涓鑹蹭笉浼氭樉绀�
* @param queryMap 鏌ヨ鏉′欢
@@ -457,6 +472,7 @@
//鑰佸钩鍙版病鏈夌敓鏁堢姸鎬�
return gridRoles(queryMap, pageHelper);
}
+
/**
* 瑙掕壊鐨勬爲褰㈠睍绀猴紝甯哥敤浜庤鑹查�夋嫨鐢ㄦ埛鐨勯〉闈娇鐢�
* @param treeQueryObject 鏍戞煡璇㈠璞�
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 60555d1..2f5a410 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
@@ -1,11 +1,19 @@
package com.vci.frameworkcore.compatibility.impl;
+import com.vci.client.common.objects.UserObject;
+import com.vci.client.common.providers.ClientServiceProvider;
import com.vci.common.util.ThreeDES;
import com.vci.corba.common.PLException;
import com.vci.corba.framework.data.UserInfo;
import com.vci.corba.omd.data.BusinessObject;
+import com.vci.frameworkcore.compatibility.OrgDeptQueryServiceI;
+import com.vci.frameworkcore.compatibility.SmPwdStrategyQueryServiceI;
+import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI;
import com.vci.frameworkcore.compatibility.SmUserQueryServiceI;
+import com.vci.frameworkcore.dto.SmUserDTO;
+import com.vci.frameworkcore.pagemodel.OrgDepartmentVO;
import com.vci.frameworkcore.pagemodel.SmPasswordStrategyVO;
+import com.vci.frameworkcore.pagemodel.SmRoleVO;
import com.vci.frameworkcore.pagemodel.SmUserVO;
import com.vci.omd.utils.ObjectTool;
import com.vci.starter.web.enumpck.BooleanEnum;
@@ -18,11 +26,13 @@
import com.vci.starter.web.util.BeanUtil;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.starter.web.util.VciDateUtil;
+import com.vci.starter.web.util.WebThreadLocalUtil;
import com.vci.starter.web.wrapper.VciQueryWrapperForDO;
import com.vci.web.enumpck.UserTypeEnum;
import com.vci.web.model.SmPasswordStrategyDO;
import com.vci.web.model.SmUserDO;
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;
@@ -59,6 +69,24 @@
private WebBoServiceI boService;
/**
+ * 閮ㄩ棬鏈嶅姟
+ */
+ @Autowired
+ private OrgDeptQueryServiceI orgDeptQueryService;
+
+ /**
+ * 瑙掕壊鏈嶅姟
+ */
+ @Autowired
+ private SmRoleQueryServiceI smRoleQueryService;
+
+ /**
+ * 瀵嗙爜绛栫暐鏌ヨ鏈嶅姟
+ */
+ @Autowired
+ private SmPwdStrategyQueryServiceI smPwdStrategyQueryService;
+
+ /**
* 浣跨敤瑙掕壊鐨勫睘鎬ф煡璇㈢敤鎴锋椂
*/
private final static String QUERY_BY_ROLE_KEY_PREFIX = "pkrole.";
@@ -84,6 +112,41 @@
public static final String QUERY_FIELD_ROLE = "roleUser.plroleuid";
/**
+ * 鐢ㄦ埛鍒嗛〉鏌ヨ鏃惰幏鍙栭儴闂ㄦ斁鍒拌繖閲岄伩鍏嶉噸澶嶆煡璇�
+ */
+ private Map<String,List<OrgDepartmentVO>> orgDepartmentVOMap;
+
+ /**
+ * 鐢ㄦ埛鍒嗛〉鏌ヨ鏃惰幏鍙栬鑹叉斁鍒拌繖閲岄伩鍏嶉噸澶嶆煡璇�
+ */
+ private Map<String,List<SmRoleVO>> smRoleVOMap;
+
+ /**
+ * 鐢ㄦ埛鍒嗛〉鏌ヨ鏃惰幏鍙栧瘑鐮佺瓥鐣ユ斁鍒拌繖閲岄伩鍏嶅娆℃煡璇�
+ */
+ private Map<String,SmPasswordStrategyVO> smPwdStrategyVOMap;
+
+ /**
+ * 妫�鏌ョ敤鎴锋槸鍚﹀瓨鍦紝鍙互鏍规嵁鐢ㄦ埛鍚嶏紝涔熷彲浠ユ牴鎹敤鎴穙id
+ * @param userName 浼爊ull锛屽嵆鐢╫id浣滀负妫�鏌ユ潯浠�
+ * @param oid 浼爊ull锛屽嵆鐢╱serName浣滀负妫�鏌ユ潯浠�
+ * @return true瀛樺湪锛宖alse涓嶅瓨鍦�
+ */
+ @Override
+ public boolean checkUserExist(String userName, String oid) throws PLException {
+ if(Func.isEmpty(userName) && Func.isEmpty(oid)){
+ throw new PLException("妫�鏌ョ敤鎴锋槸鍚﹀瓨鍦ㄦ椂锛屼紶閫掔殑鍙傛暟鐢ㄦ埛鍚嶅拰鐢ㄦ埛oid閮戒负绌猴紒",new String[0]);
+ }
+ UserInfo userInfo = null;
+ if(Func.isNotEmpty(userName)) {
+ userInfo = platformClientUtil.getFrameworkService().getUserObjectByUserName(userName);
+ }else{
+ userInfo = platformClientUtil.getFrameworkService().getUserObjectByoid(oid);
+ }
+ return Func.isNotEmpty(userInfo);
+ }
+
+ /**
* 鏍规嵁鐢ㄦ埛鍚嶈幏鍙栫敤鎴风殑瀵硅薄锛屼笉鍖哄垎澶у皬鍐�
* @param userId 鐢ㄦ埛鍚�
* @return 鐢ㄦ埛鐨勬樉绀哄璞★紝濡傛灉鐢ㄦ埛涓嶅瓨鍦ㄥ垯杩斿洖null锛屼笉浼氭姏鍑哄紓甯�
@@ -98,35 +161,6 @@
} catch (PLException e) {
throw new VciBaseException("鐧诲綍鏃讹紝鑾峰彇鐢ㄦ埛淇℃伅澶辫触锛�"+e.getMessage());
}
- }
-
- /**
- * 涓氬姟鏁版嵁杞崲涓烘樉绀哄璞�
- * @param userInfo 骞冲彴杩斿洖鐨勪笟鍔℃暟鎹�
- * @return 鐢ㄦ埛鏄剧ず瀵硅薄
- */
- private SmUserVO userInfo2VO(UserInfo userInfo) {
- SmUserVO smUserVO = new SmUserVO();
- smUserVO.setOid(userInfo.id);
- smUserVO.setId(userInfo.userName);
- smUserVO.setName(userInfo.trueName);
- smUserVO.setSecretGrade(userInfo.secretGrade);
- smUserVO.setSecretGradeText(UserSecretEnum.getSecretText(smUserVO.getSecretGrade()));
- smUserVO.setUserType(String.valueOf(userInfo.userType));
- smUserVO.setUserTypeText(UserTypeEnum.getTextByValue(smUserVO.getUserType()));
- smUserVO.setDescription(userInfo.desc);
- smUserVO.setEmail(userInfo.email);
- if(userInfo.status == 0){
- smUserVO.setLockFlag(false);
- }else{
- smUserVO.setLockFlag(true);
- }
- smUserVO.setCreator(userInfo.createUser);
- smUserVO.setCreateTime(VciDateUtil.long2Date(userInfo.createTime));
- smUserVO.setLastModifier(userInfo.updateUser);
- smUserVO.setLastLoginTime(VciDateUtil.long2Date(userInfo.updateTime));
- smUserVO.setLastModifyPasswordTime(VciDateUtil.long2Date(userInfo.pwdUpdateTime));
- return smUserVO;
}
/**
@@ -220,6 +254,7 @@
throw new VciBaseException("鑾峰彇鐢ㄦ埛澶辫触锛�"+e.getMessage());
}
}
+
/**
* 鎵归噺鑾峰彇鐢ㄦ埛鐨勪俊鎭� 锛堟牴鎹敤鎴蜂富閿級
* @param userOidCollections 鐢ㄦ埛涓婚敭鐨勯泦鍚堬紝鍙互瓒呰繃1000涓�
@@ -227,8 +262,7 @@
* @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呮暟鎹簱瀛樺湪闂鐨勬椂鍊欎細鎶涘嚭寮傚父
*/
@Override
- public List<SmUserVO> listUserByUserOids(
- Collection<String> userOidCollections) throws VciBaseException {
+ public List<SmUserVO> listUserByUserOids(Collection<String> userOidCollections) throws VciBaseException {
WebUtil.alertNotNull(userOidCollections,"鐢ㄦ埛涓婚敭闆嗗悎");
try {
UserInfo[] userInfoArr = platformClientUtil.getFrameworkService().getUserObjectByoids(VciBaseUtil.collection2StrArr(userOidCollections));
@@ -252,6 +286,63 @@
}
/**
+ * 涓氬姟鏁版嵁杞崲涓烘樉绀哄璞�
+ * @param userInfo 骞冲彴杩斿洖鐨勪笟鍔℃暟鎹�
+ * @return 鐢ㄦ埛鏄剧ず瀵硅薄
+ */
+ private SmUserVO userInfo2VO(UserInfo userInfo) {
+ SmUserVO smUserVO = new SmUserVO();
+ smUserVO.setOid(userInfo.id);
+ smUserVO.setId(userInfo.userName);
+ smUserVO.setName(userInfo.trueName);
+ smUserVO.setSecretGrade(userInfo.secretGrade);
+ smUserVO.setSecretGradeText(UserSecretEnum.getSecretText(smUserVO.getSecretGrade()));
+ smUserVO.setUserType(String.valueOf(userInfo.userType));
+ smUserVO.setUserTypeText(UserTypeEnum.getTextByValue(smUserVO.getUserType()));
+ smUserVO.setDescription(userInfo.desc);
+ smUserVO.setEmail(userInfo.email);
+ //鐢ㄦ埛鎵�灞為儴闂ㄧ殑鏌ヨ璁剧疆
+ List<OrgDepartmentVO> orgDepartmentVOList = orgDepartmentVOMap.get(userInfo.id);
+ smUserVO.setPkDepartment(
+ Func.isEmpty(orgDepartmentVOList) ?
+ null:orgDepartmentVOList.stream().map(OrgDepartmentVO::getOid).collect(Collectors.joining(","))
+ );
+ smUserVO.setPkDepartmentName(
+ Func.isEmpty(orgDepartmentVOList) ?
+ null:orgDepartmentVOList.stream().map(OrgDepartmentVO::getName).collect(Collectors.joining(","))
+ );
+ //瀵嗙爜绛栫暐鏌ヨ璁剧疆
+ SmPasswordStrategyVO smPasswordStrategyVO = smPwdStrategyVOMap.getOrDefault(userInfo.id,new SmPasswordStrategyVO());
+ smUserVO.setPkPasswordStrategy(smPasswordStrategyVO.getOid());
+ smUserVO.setPkPasswordStrategyName(smPasswordStrategyVO.getName());
+ //瑙掕壊鏌ヨ璁剧疆
+ List<SmRoleVO> smRoleVOList = smRoleVOMap.get(userInfo.id);
+ smUserVO.setPkPerson(
+ Func.isEmpty(smRoleVOList) ?
+ null:smRoleVOList.stream().map(SmRoleVO::getOid).collect(Collectors.joining(","))
+ );
+ smUserVO.setPkPersonName(
+ Func.isEmpty(smRoleVOList) ?
+ null:smRoleVOList.stream().map(SmRoleVO::getName).collect(Collectors.joining(","))
+ );
+ //鏄惁閮ㄩ棬棰嗗
+ smUserVO.setIsDeptLeader(userInfo.isDeptLeader.equals("0") ? "涓嶆槸":"鏄�");
+ //涓撲笟
+ smUserVO.setSpecialties(userInfo.specialties);
+ if(userInfo.status == 0){
+ smUserVO.setLockFlag(false);
+ }else{
+ smUserVO.setLockFlag(true);
+ }
+ smUserVO.setCreator(userInfo.createUser);
+ smUserVO.setCreateTime(VciDateUtil.long2Date(userInfo.createTime));
+ smUserVO.setLastModifier(userInfo.updateUser);
+ smUserVO.setLastLoginTime(VciDateUtil.long2Date(userInfo.updateTime));
+ smUserVO.setLastModifyPasswordTime(VciDateUtil.long2Date(userInfo.pwdUpdateTime));
+ return smUserVO;
+ }
+
+ /**
* 鐢ㄦ埛鐨勬暟鎹璞¤浆鎹负鏄剧ず瀵硅薄
* @param userDOS 鐢ㄦ埛
* @return 鏄剧ず瀵硅薄
@@ -259,11 +350,20 @@
private List<SmUserVO> smUserDO2VOs(List<SmUserDO> userDOS){
List<SmUserVO> userVOList = new ArrayList<>();
Optional.ofNullable(userDOS).orElseGet(()->new ArrayList<>()).stream().forEach(userDO->{
- SmUserVO userVO = new SmUserVO();
- BeanUtil.convert(userDO,userVO);
- userVOList.add(userVO);
+ userVOList.add(smUserDO2VO(userDO));
});
return userVOList;
+ }
+
+ /**
+ * 鐢ㄦ埛鐨勬暟鎹璞¤浆鎹负鏄剧ず瀵硅薄
+ * @param smUserDO
+ * @return
+ */
+ private SmUserVO smUserDO2VO(SmUserDO smUserDO){
+ SmUserVO smUserVO = new SmUserVO();
+ BeanUtil.convert(smUserDO,smUserVO);
+ return smUserVO;
}
/**
@@ -324,9 +424,9 @@
* @return 鐢ㄦ埛鐨勬樉绀哄璞$殑鍒楄〃
*/
private DataGrid<SmUserVO> gridUserByQueryField(String queryField,String queryValue, Map<String, String> queryMap, PageHelper pageHelper,boolean notIn){
- if(StringUtils.isBlank(queryValue)){
+ /*if(StringUtils.isBlank(queryValue)){
return new DataGrid<>();
- }
+ }*/
PageHelper newPageHelper = new PageHelper(-1);
newPageHelper.setSort(pageHelper.getSort());
newPageHelper.setOrder(pageHelper.getOrder());
@@ -369,6 +469,7 @@
}
return dataGrid;
}
+
/**
* 鑾峰彇鐢ㄦ埛鐨勫垪琛紝榛樿浼氫互鐢ㄦ埛鍚嶅崌搴忔帓鍒楋紝鐢ㄦ埛鐨勭紪杈戦〉闈㈠垪琛ㄤ笉瑕佷娇鐢ㄨ繖涓帴鍙�
* @param queryMap 鏌ヨ鏉′欢
@@ -380,6 +481,49 @@
public DataGrid<SmUserVO> gridUsers(Map<String, String> queryMap,
PageHelper pageHelper) throws VciBaseException {
return gridUserByQueryField(null,null,queryMap,pageHelper,false);
+ }
+
+ /**
+ * 鐢ㄦ埛绠$悊鐣岄潰鍒嗛〉鏌ヨ
+ * @param conditionMap 鏌ヨ鏉′欢
+ * @param pageHelper 鍒嗛〉鍙傛暟
+ * @return
+ */
+ @Override
+ public DataGrid<SmUserVO> getDataGridUsers(Map<String, String> conditionMap, PageHelper pageHelper) throws PLException {
+ if(pageHelper == null){
+ pageHelper = new PageHelper(-1);
+ }
+ pageHelper.addDefaultAsc("PLTRUENAME");
+ //String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserName();
+ //鍒嗛〉鏌ヨ
+ UserInfo[] userInfos = platformClientUtil.getFrameworkService().fetchUserInfoByCondition(
+ conditionMap.get("name"),
+ conditionMap.get("userName"),
+ conditionMap.get("deptId"),
+ conditionMap.get("roleId"),
+ "developer", //褰撳墠鐧诲綍鐨勭敤鎴峰悕
+ pageHelper.getPage(),
+ pageHelper.getLimit()
+ );
+ DataGrid<SmUserVO> dataGrid = new DataGrid<>();
+ if(Func.isNotEmpty(userInfos)){
+ List<String> idList = Arrays.stream(userInfos).map(item -> item.id).collect(Collectors.toList());
+ orgDepartmentVOMap = orgDeptQueryService.batchListDeptByUserOids(idList, null);
+ smRoleVOMap = smRoleQueryService.batchListRoleByUserOids(idList,null);
+ smPwdStrategyVOMap = smPwdStrategyQueryService.batchSmPwdStrategyByUserOids(idList);
+ dataGrid.setData(userInfoArr2VO(userInfos));
+ dataGrid.setTotal(
+ platformClientUtil.getFrameworkService().getUserTotalByCondition(
+ conditionMap.get("name"),
+ conditionMap.get("userName"),
+ conditionMap.get("deptId"),
+ conditionMap.get("roleId"),
+ "developer" //褰撳墠鐧诲綍鐨勭敤鎴峰悕
+ )
+ );
+ }
+ return dataGrid;
}
/**
@@ -424,8 +568,6 @@
return userVO.getName();
}
-
-
/**
* 鏌ヨ鏌愪釜閮ㄩ棬涓嬬殑鐢ㄦ埛瀵硅薄
* @param deptOid 閮ㄩ棬鐨勪富閿�
@@ -443,7 +585,7 @@
}
/**
- * 鑾峰彇
+ * 鑾峰彇鏌ヨ灏佽鍣紝榛樿鍙煡浜唒lstatus=0鍜宲lusertype=2锛屾帓搴忛粯璁lusername
* @param queryField 鏌ヨ灞炴��
* @param queryValue 鏌ヨ鐨勫��
* @param queryMap 鏌ヨ鏉′欢锛屽鏋滄槸瑙掕壊鐨勫睘鎬э紝闇�瑕佷娇鐢╬krole.xxx
@@ -478,6 +620,43 @@
queryWrapperForDO.setDistinct(true);
return queryWrapperForDO;
}
+
+ /**
+ * 鑾峰彇鏌ヨ灏佽鍣紝榛樿鍙煡plusertype!=1鐨�
+ * @param queryField 鏌ヨ灞炴��
+ * @param queryValue 鏌ヨ鐨勫��
+ * @param queryMap 鏌ヨ鏉′欢锛屽鏋滄槸瑙掕壊鐨勫睘鎬э紝闇�瑕佷娇鐢╬krole.xxx
+ * @param pageHelper 鍒嗛〉瀵硅薄
+ * @param notIn 鏄惁涓轰笉鍖呭惈
+ * @return 鏌ヨ灏佽鍣�
+ */
+ private VciQueryWrapperForDO getQueryWrapper2(String queryField,String queryValue,Map<String,String> queryMap,PageHelper pageHelper,boolean notIn){
+ if(pageHelper == null){
+ pageHelper = new PageHelper(-1);
+ }
+ pageHelper.addDefaultAsc("plusername");
+ VciQueryWrapperForDO queryWrapperForDO = new VciQueryWrapperForDO(queryMap,SmUserDO.class,pageHelper);
+ if(StringUtils.isNotBlank(queryField)) {
+ if (queryValue.contains(",")) {
+ if (notIn) {
+ queryWrapperForDO.notIn(queryField, VciBaseUtil.toInSql(VciBaseUtil.str2List(queryValue).toArray(new String[0])));
+ } else {
+ queryWrapperForDO.in(queryField, VciBaseUtil.toInSql(VciBaseUtil.str2List(queryValue).toArray(new String[0])));
+ }
+ } else {
+ if (notIn) {
+ queryWrapperForDO.neq(queryField, queryValue);
+ } else {
+ queryWrapperForDO.eq(queryField, queryValue);
+ }
+ }
+ }
+ addRoleQuerySql(queryMap,queryWrapperForDO);
+ queryWrapperForDO.neq("plusertype", "2");
+ queryWrapperForDO.setDistinct(true);
+ return queryWrapperForDO;
+ }
+
/**
* 鏌ヨ鏌愪釜閮ㄩ棬涓嬬殑鐢ㄦ埛瀵硅薄鍒楄〃
* @param deptOid 閮ㄩ棬鐨勪富閿�
@@ -492,6 +671,7 @@
throws VciBaseException {
return gridUserByQueryField(QUERY_FIELD_DEPARTMENT,deptOid,queryMap,pageHelper,false);
}
+
/**
* 鎵归噺鏍规嵁閮ㄩ棬鐨勪富閿幏鍙栫敤鎴�
* @param deptOidCollection 閮ㄩ棬鐨勪富閿泦鍚�
@@ -510,6 +690,7 @@
}
return new HashMap<>();
}
+
/**
* 鏌ヨ涓嶅湪鏌愪釜閮ㄩ棬涓嬬殑鐢ㄦ埛瀵硅薄鍒楄〃
* @param deptOid 閮ㄩ棬鐨勪富閿�
@@ -525,6 +706,7 @@
}
return listUserByQueryField(QUERY_FIELD_DEPARTMENT,deptOid,queryMap,true);
}
+
/**
* 鏌ヨ涓嶅湪鏌愪釜閮ㄩ棬涓嬬殑鐢ㄦ埛瀵硅薄鍒楄〃
* @param deptOid 閮ㄩ棬鐨勪富閿�
@@ -539,6 +721,7 @@
throws VciBaseException {
return gridUserByQueryField(QUERY_FIELD_DEPARTMENT,deptOid,queryMap,pageHelper,true);
}
+
/**
* 鏌ヨ鏌愪釜瑙掕壊涓嬬殑鐢ㄦ埛瀵硅薄
* @param roleOid 瑙掕壊鐨勪富閿�
@@ -555,6 +738,7 @@
return listUserByQueryField(QUERY_FIELD_ROLE,roleOid,queryMap,false);
}
+
/**
* 鏌ヨ鏌愪釜瑙掕壊涓嬬殑鐢ㄦ埛瀵硅薄鍒楄〃
* @param roleOid 瑙掕壊鐨勪富閿�
@@ -569,6 +753,7 @@
throws VciBaseException {
return gridUserByQueryField(QUERY_FIELD_ROLE,roleOid,queryMap,pageHelper,false);
}
+
/**
* 鏌ヨ涓嶅湪鏌愪釜瑙掕壊涓嬬殑鐢ㄦ埛瀵硅薄鍒楄〃
* @param roleOid 瑙掕壊鐨勪富閿�
@@ -584,6 +769,7 @@
}
return listUserByQueryField(QUERY_FIELD_ROLE,roleOid,queryMap,true);
}
+
/**
* 鏌ヨ涓嶅湪鏌愪釜瑙掕壊涓嬬殑鐢ㄦ埛瀵硅薄鍒楄〃
* @param roleOid 瑙掕壊鐨勪富閿�
@@ -598,6 +784,7 @@
throws VciBaseException {
return gridUserByQueryField(QUERY_FIELD_ROLE,roleOid,queryMap,pageHelper,true);
}
+
/**
* 鎵归噺鏍规嵁瑙掕壊鐨勪富閿幏鍙栫敤鎴�
* @param roleOidCollection 瑙掕壊鐨勪富閿泦鍚�
@@ -655,6 +842,7 @@
PageHelper pageHelper) throws VciBaseException {
return gridUserByQueryField(null,null,queryMap,pageHelper,false);
}
+
/**
* 鍙傜収鐢ㄦ埛鐨勬爲褰㈡樉绀�
* @param treeQueryObject 鏍戝瀷鎺ュ彛鏌ヨ瀵硅薄
@@ -687,6 +875,7 @@
}
return treeList;
}
+
/**
* 鏍¢獙瀵嗙爜鏄惁鐩稿悓锛屽湪鏂板钩鍙颁腑瀛樺偍鐨勫瘑鐮佹槸涓ゆmd5
* @param userOid 鐢ㄦ埛涓婚敭
@@ -714,6 +903,7 @@
}
return false;
}
+
/**
* 鏍¢獙鐢ㄦ埛鏄惁閿佸畾
* @param smUserVO 鐢ㄦ埛瀵硅薄
@@ -726,7 +916,9 @@
return smUserVO.isLockFlag();
}
//鏌ヨ瀵嗙爜绛栫暐
- SmPasswordStrategyVO passwordStrategyVO = getPasswordStrategyVOByOid(smUserVO.getPkPasswordStrategy());
+ SmPasswordStrategyVO passwordStrategyVO = smPwdStrategyQueryService.getPasswordStrategyVOByOid(
+ smUserVO.getPkPasswordStrategy()
+ );
if(passwordStrategyVO == null){
throw new VciBaseException("绯荤粺閲屾病鏈夊瘑鐮佸畨鍏ㄧ瓥鐣�");
}
@@ -736,57 +928,6 @@
return false;
}
- /**
- * 浣跨敤涓婚敭鑾峰彇瀵嗙爜绛栫暐
- * @param oid 涓婚敭
- * @return 瀵嗙爜绛栫暐鏄剧ず瀵硅薄
- */
- public SmPasswordStrategyVO getPasswordStrategyVOByOid(String oid){
- VciQueryWrapperForDO queryWrapperForDO = new VciQueryWrapperForDO(null, SmPasswordStrategyDO.class);
- queryWrapperForDO.eq("oid",oid.trim());
- List<BusinessObject> cboList = boService.queryBySql(queryWrapperForDO.getSelectFieldSql() + " from plpasswordstrategy " +
- queryWrapperForDO.getTableNick() + queryWrapperForDO.getLinkTableSql() +
- (StringUtils.isBlank(queryWrapperForDO.getWhereSql()) ? "" : (" where " + queryWrapperForDO.getWhereSql())), null);
- if(!CollectionUtils.isEmpty(cboList)){
- SmPasswordStrategyDO passwordStrategyDO = new SmPasswordStrategyDO();
- WebUtil.copyValueToObjectFromCbos(cboList.get(0),passwordStrategyDO);
- SmPasswordStrategyVO passwordStrategyVO = new SmPasswordStrategyVO();
- BeanUtil.convert(passwordStrategyDO,passwordStrategyVO);
- return passwordStrategyVO;
- }else{
- //鑾峰彇榛樿鐨�
- queryWrapperForDO = new VciQueryWrapperForDO(null, SmPasswordStrategyDO.class);
- queryWrapperForDO.eq("plisdefault","1");
- cboList = boService.queryBySql(queryWrapperForDO.getSelectFieldSql() + " from plpasswordstrategy " +
- queryWrapperForDO.getTableNick() + queryWrapperForDO.getLinkTableSql() +
- (StringUtils.isBlank(queryWrapperForDO.getWhereSql()) ? "" : (" where " + queryWrapperForDO.getWhereSql())), null);
- if(!CollectionUtils.isEmpty(cboList)){
- SmPasswordStrategyDO passwordStrategyDO = new SmPasswordStrategyDO();
- WebUtil.copyValueToObjectFromCbos(cboList.get(0),passwordStrategyDO);
- SmPasswordStrategyVO passwordStrategyVO = new SmPasswordStrategyVO();
- BeanUtil.convert(passwordStrategyDO,passwordStrategyVO);
- return passwordStrategyVO;
- }
- }
- return null;
- }
-
- /**
- * 鏍规嵁鐢ㄦ埛鐨勪富閿紝鑾峰彇鐢ㄦ埛鐨勫瘑鐮佸畨鍏ㄧ瓥鐣�
- * @param userOid 鐢ㄦ埛鐨勪富閿�
- * @return 瀵嗙爜瀹夊叏绛栫暐鐨勬樉绀哄璞★紝濡傛灉涓嶅瓨鍦ㄥ垯浼氳繑鍥濶ull
- * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呮暟鎹簱鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父
- */
- @Override
- public SmPasswordStrategyVO getPasswordStrategyVOByUserOid(String userOid)
- throws VciBaseException {
- WebUtil.alertNotNull(userOid,"鐢ㄦ埛鐨勪富閿�");
- SmUserVO userVO = getUserByUserOid(userOid);
- if(userVO == null || StringUtils.isBlank(userVO.getOid())){
- throw new VciBaseException(DATA_OID_NOT_EXIST);
- }
- return getPasswordStrategyVOByOid(userVO.getPkPasswordStrategy());
- }
/**
* 璁剧疆鏌愪釜鐢ㄦ埛鏄攣瀹氱姸鎬�
@@ -796,6 +937,7 @@
public void lockUser(String userId) {
//鑰佺殑杩欎釜骞冲彴锛屾槸渚濋潬閿佸畾娆℃暟鏉ュ垽鏂殑锛屾墍浠ヨ繖閲屾病鍔炴硶鐩存帴璁剧疆
}
+
/**
* 璁剧疆鏌愪釜鐢ㄦ埛涓嶆槸閿佸畾鐘舵��
* @param userId 鐢ㄦ埛鍚�
@@ -810,6 +952,7 @@
throw WebUtil.getVciBaseException(vciError);
}
}
+
/**
* 淇敼瀵嗙爜
* @param userOid 鐢ㄦ埛涓婚敭
@@ -833,6 +976,7 @@
throw WebUtil.getVciBaseException(vciError);
}
}
+
/**
* 鏇存柊鐢ㄦ埛鐨勫瘑鐮侀敊璇鏁�
* @param userOid 鐢ㄦ埛鐨勪富閿�
@@ -850,6 +994,7 @@
throw WebUtil.getVciBaseException(vciError);
}
}
+
/**
* 鏇存柊鐢ㄦ埛鐨勬渶鍚庣櫥褰曟椂闂�
* @param userOid 鐢ㄦ埛鐨勪富閿�
@@ -865,4 +1010,109 @@
throw WebUtil.getVciBaseException(vciError);
}
}
+
+ /**
+ * 娣诲姞鐢ㄦ埛
+ * @param smUserDTO
+ * @return
+ */
+ @Override
+ public boolean addUser(SmUserDTO smUserDTO) throws PLException {
+ VciBaseUtil.alertNotNull(
+ smUserDTO,"娣诲姞鐨勭敤鎴峰璞�",
+ smUserDTO.getId(),"璐﹀彿",
+ smUserDTO.getPassword(),"瀵嗙爜",
+ smUserDTO.getConfirmPassword(),"纭瀵嗙爜",
+ smUserDTO.getName(),"濮撳悕"
+ );
+ //纭瀵嗙爜
+ String confirmPassword = smUserDTO.getConfirmPassword();
+ //姣斿瀵嗙爜鏄槸鍚︿竴鑷�
+ if(!smUserDTO.getPassword().equals(confirmPassword)){
+ throw new VciBaseException("涓ゆ瀵嗙爜涓嶄竴鑷达紝璇烽噸鏂板~鍐�!");
+ }
+ //鍏堢敤鎴峰悕锛堣处鍙凤級鏌ラ噸
+ SmUserVO dbSmUserVO = getUserByUserId(smUserDTO.getId());
+ if(Func.isNotEmpty(dbSmUserVO) && Func.isNotBlank(dbSmUserVO.getOid())){
+ throw new VciBaseException("璇ョ敤鎴峰悕鍦ㄧ郴缁熶腑宸茬粡瀛樺湪,璇蜂慨鏀�!");
+ }
+ //瀵嗙爜鍔犲瘑
+ ThreeDES des = new ThreeDES();
+ des.getKey("daliantan0v0");// 鐢熸垚瀵嗗寵
+ //绗簩娆D5鍔犲瘑
+ String md5Password2 = des.getEncString(smUserDTO.getPassword());
+ //鐢熸垚瀛樺偍鐨凞O瀵硅薄
+ smUserDTO.setOid(VciBaseUtil.getPk());
+ smUserDTO.setPassword(md5Password2);
+ smUserDTO.setLockFlag("0");
+ BusinessObject user = ClientServiceProvider.getBOFService().initBusinessObject("user");
+ SmUserDO smUserDO = new SmUserDO();
+ BeanUtil.convert(user,smUserDO);
+ UserInfo userInfo = new UserInfo();
+ BeanUtil.convert(smUserDO,userInfo);
+ return platformClientUtil.getFrameworkService().saveOrUpdateUser(userInfo, null);
+ }
+
+ /**
+ * 淇敼鐢ㄦ埛
+ * @param smUserDTO
+ * @return
+ */
+ @Override
+ public boolean updateUser(SmUserDTO smUserDTO) throws PLException {
+ UserInfo userInfo = new UserInfo();
+ BeanUtil.convert(smUserDTO,userInfo);
+ return platformClientUtil.getFrameworkService().updateUser(userInfo, null);
+ }
+
+ /***
+ * 鐢ㄦ埛浠庡鎴风瀵硅薄鍒癱orba瀵硅薄
+ *
+ * @param user
+ * @return
+ */
+ public UserInfo changeUserObjectToUserInfo(UserObject user) {
+ UserInfo userInfo = new UserInfo();
+ userInfo.id = user.getId() == null ? "" : user.getId();
+ userInfo.userName = user.getUserName() == null ? "" : user.getUserName();
+ userInfo.pwd = user.getPwd() == null ? "" : user.getPwd();
+ userInfo.trueName = user.getTrueName() == null ? "" : user.getTrueName();
+ userInfo.specialties = user.getSpecialties() == null ? "" : user.getSpecialties();
+ userInfo.email = user.getEmail() == null ? "" : user.getEmail();
+ userInfo.desc = user.getDesc() == null ? "" : user.getDesc();
+ userInfo.userType = user.getUserType();
+ userInfo.status = user.getStatus();
+ userInfo.createTime = user.getCreateTime();
+ userInfo.createUser = user.getCreateUser() == null ? "" : user.getCreateUser();
+ userInfo.updateTime = user.getUpdateTime();
+ userInfo.updateUser = user.getUpdateUser() == null ? "" : user.getUpdateUser();
+ userInfo.pwdUpdateTime = user.getPwdUpdateTime();
+ userInfo.grantor = user.getGrantor() == null ? "" : user.getGrantor();
+ userInfo.isDeptLeader = user.getIsDeptLeader() == null ? "0" : user.getIsDeptLeader();
+ return userInfo;
+ }
+
+ /**
+ * 鍒犻櫎鐢ㄦ埛
+ * @param ids
+ * @return
+ */
+ @Override
+ public boolean deleteUser(String[] ids) throws PLException {
+ VciBaseUtil.alertNotNull(ids,"寰呭垹闄ょ殑鐢ㄦ埛id鍒楄〃涓嶈兘涓虹┖锛�");
+ return platformClientUtil.getFrameworkService().deleteUser(ids, null);
+ }
+
+ /**
+ * 鐢ㄦ埛鍋滅敤/鍚敤
+ * @param ids
+ * @param flag
+ * @return
+ */
+ @Override
+ public boolean disableOrEnableUsers(String[] ids, boolean flag) throws PLException {
+ VciBaseUtil.alertNotNull(ids,"鍋滅敤/鍚敤鐨勭敤鎴穒d鍒楄〃");
+ return platformClientUtil.getFrameworkService().stopUsers(ids, flag,null);
+ }
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmUserQueryController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmUserQueryController.java
index 570a070..bf29cdb 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmUserQueryController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmUserQueryController.java
@@ -1,11 +1,17 @@
package com.vci.frameworkcore.controller;
import com.vci.frameworkcore.compatibility.SmUserQueryServiceI;
+import com.vci.frameworkcore.dto.SmUserDTO;
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.*;
+import com.vci.web.model.SmUserDO;
+import com.zeroc.IceInternal.Ex;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -19,6 +25,7 @@
*/
@Controller
@RequestMapping("/userQueryController")
+@Slf4j
public class SmUserQueryController {
/**
@@ -75,7 +82,7 @@
queryObject = new BaseQueryObject();
}
DataGrid<SmUserVO> userVODataGrid = userQueryService.gridUserByDeptOid(pkDepartment, queryObject.getConditionMap(), queryObject.getPageHelper());
- return BaseResult.dataGrid(userVODataGrid);
+ return BaseResult.dataGrid(userVODataGrid);
//濡傛灉鏄�佺殑椤圭洰锛屽簲璇ュ湪gridUserByDeptOid涓婃坊鍔爐ry锛宑atch锛岀劧鍚巆atch閲屽簲璇ヤ娇鐢ㄤ笅闈㈢殑浠g爜
//BaseResult.fail("杩欓噷杩斿洖鍓嶇鐨勯敊璇俊鎭�");
}
@@ -112,8 +119,99 @@
return BaseResult.success("淇敼瀵嗙爜鎴愬姛");
}
+ /**
+ * 鐢ㄦ埛绠$悊鍒楄〃鍒嗛〉鏌ヨ锛屽钩鍙版槸涓嶆煡plusertype=0鐨勬垚鍛橈紝涔熷氨鏄痙eveloper鍜宎dmin
+ * @param queryObject 鏌ヨ瀵硅薄锛屽寘鍚簡鏌ヨ鏉′欢锛屽垎椤碉紝鎺掑簭绛�,鍗冲厑璁镐娇鐢⊿mUserVO閲岀殑鎵�鏈夊睘鎬т綔涓烘煡璇㈡潯浠讹紝涔熷彲浠ヤ娇鐢╬kRole.xxx锛宲kDepartment.xxx,pkDuty.xxx杩欐牱鏉ユ煡璇�
+ * @return 鍏ㄩ儴鐢ㄦ埛鏄剧ず瀵硅薄鍒楄〃鏁版嵁锛岃鑾峰彇鍏朵腑鐨刣ata灞炴��
+ * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父锛屽鏋滄槸鑰佺殑椤圭洰閲屼笉鎶涘嚭寮傚父
+ */
+ @RequestMapping(value = "/getDataGridUsers",method = RequestMethod.GET)
+ @ResponseBody
+ @VciUnCheckRight
+ public BaseResult<SmUserVO> getDataGridUsers(BaseQueryObject queryObject) throws VciBaseException {
+ try {
+ DataGrid<SmUserVO> userVODataGrid = userQueryService.getDataGridUsers(queryObject.getConditionMap(),queryObject.getPageHelper());
+ return BaseResult.dataGrid(userVODataGrid);
+ }catch (Exception e) {
+ e.printStackTrace();
+ log.error("鐢ㄦ埛绠$悊鍒楄〃鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + e.getMessage());
+ return BaseResult.fail("鐢ㄦ埛绠$悊鍒楄〃鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + e.getMessage());
+ }
+ }
+ /**
+ * 娣诲姞鐢ㄦ埛
+ * @param smUserDTO
+ * @return
+ */
+ @RequestMapping(value = "/addUser",method = RequestMethod.POST)
+ @ResponseBody
+ @VciUnCheckRight
+ public BaseResult addUser(@RequestBody SmUserDTO smUserDTO){
+ try {
+ return BaseResult.success(userQueryService.addUser(smUserDTO) ? "鐢ㄦ埛娣诲姞鎴愬姛锛�":"鐢ㄦ埛娣诲姞澶辫触锛�");
+ }catch (Exception e){
+ e.printStackTrace();
+ log.error("娣诲姞鐢ㄦ埛鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + e.getMessage());
+ return BaseResult.fail("娣诲姞鐢ㄦ埛鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + e.getMessage());
+ }
+ }
+ /**
+ * 淇敼鐢ㄦ埛淇℃伅
+ * @param smUserDTO
+ * @return
+ */
+ @RequestMapping(value = "/updateUser",method = RequestMethod.PUT)
+ @ResponseBody
+ @VciUnCheckRight
+ public BaseResult updateUser(@RequestBody SmUserDTO smUserDTO){
+ try {
+ return BaseResult.success(userQueryService.updateUser(smUserDTO) ? "鐢ㄦ埛淇敼鎴愬姛锛�":"鐢ㄦ埛淇敼澶辫触锛�");
+ }catch (Exception e){
+ e.printStackTrace();
+ log.error("淇敼鐢ㄦ埛鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + e.getMessage());
+ return BaseResult.fail("淇敼鐢ㄦ埛鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + e.getMessage());
+ }
+ }
+
+ /**
+ * 鍒犻櫎鐢ㄦ埛
+ * @param ids
+ * @return
+ */
+ @RequestMapping(value = "/deleteUser",method = RequestMethod.DELETE)
+ @ResponseBody
+ //@VciUnCheckRight
+ public BaseResult deleteUser(String[] ids){
+ try {
+ return BaseResult.success(userQueryService.deleteUser(ids) ? "鍒犻櫎鐢ㄦ埛鎴愬姛锛�":"鍒犻櫎鐢ㄦ埛澶辫触锛�");
+ }catch (Exception e){
+ e.printStackTrace();
+ log.error("娣诲姞鐢ㄦ埛鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + e.getMessage());
+ return BaseResult.fail("娣诲姞鐢ㄦ埛鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + e.getMessage());
+ }
+ }
+
+ /**
+ * 鐢ㄦ埛鍋滅敤/鍚敤
+ * @param ids
+ * @param flag
+ * @return
+ */
+ @RequestMapping(value = "/stopUsers",method = RequestMethod.POST)
+ @ResponseBody
+ //@VciUnCheckRight
+ public BaseResult disableOrEnableUsers(String[] ids,boolean flag){
+ try {
+ userQueryService.disableOrEnableUsers(ids,flag);
+ return BaseResult.success("鐢ㄦ埛銆愬仠鐢�/鍚敤銆戞垚鍔燂紒");
+ }catch (Exception e){
+ e.printStackTrace();
+ log.error("鐢ㄦ埛銆愬仠鐢�/鍚敤銆戞椂鍑虹幇閿欒锛屽師鍥狅細" + e.getMessage());
+ return BaseResult.fail("鐢ㄦ埛銆愬仠鐢�/鍚敤銆戞椂鍑虹幇閿欒锛屽師鍥狅細" + e.getMessage());
+ }
+ }
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/pagemodel/SmUserVO.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/pagemodel/SmUserVO.java
index 79655e4..d265e21 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/pagemodel/SmUserVO.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/pagemodel/SmUserVO.java
@@ -1,4 +1,5 @@
package com.vci.frameworkcore.pagemodel;
+import com.vci.common.annotaion.CustomAnnotaion;
import com.vci.starter.web.pagemodel.BaseModelVO;
import java.util.Date;
@@ -23,7 +24,6 @@
* 鐢ㄦ埛濮撳悕
*/
private String name;
-
/**
* 鐢ㄦ埛绫诲瀷
@@ -118,7 +118,6 @@
/**
* 鎬у埆
*/
-
private String sex;
/**
@@ -145,6 +144,24 @@
* 澶村儚
*/
private String photo;
+
+ /**
+ * 鏄惁鏄儴闂ㄩ瀵兼爣璇� 1锛氭槸 0锛氫笉鏄�
+ */
+ private String isDeptLeader = "0";
+
+ /**
+ * 涓撲笟
+ */
+ private String specialties;
+
+ public void setSpecialties(String specialties) {
+ this.specialties = specialties;
+ }
+
+ public String getSpecialties() {
+ return specialties;
+ }
@Override
public String getId() {
@@ -357,6 +374,14 @@
this.photo = photo;
}
+ public void setIsDeptLeader(String isDeptLeader) {
+ this.isDeptLeader = isDeptLeader;
+ }
+
+ public String getIsDeptLeader() {
+ return isDeptLeader;
+ }
+
@Override
public String toString() {
return "SmUserVO{" +
--
Gitblit v1.9.3