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 | 636 +++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 545 insertions(+), 91 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 b0ae3c0..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 @@ -1,12 +1,24 @@ package com.vci.frameworkcore.compatibility.impl; -import com.vci.client.common.providers.ServiceProvider; +import com.vci.client.common.objects.UserObject; import com.vci.common.util.ThreeDES; import com.vci.corba.common.PLException; +import com.vci.corba.common.data.UserEntityInfo; +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.model.dto.SmUserDTO; +import com.vci.frameworkcore.model.SmUserDO; +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; +import com.vci.starter.web.enumpck.UserSecretEnum; import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.pagemodel.DataGrid; import com.vci.starter.web.pagemodel.PageHelper; @@ -14,23 +26,25 @@ import com.vci.starter.web.pagemodel.TreeQueryObject; 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.wrapper.VciQueryWrapperForDO; -import com.vci.web.model.SmPasswordStrategyDO; -import com.vci.web.model.SmUserDO; +import com.vci.web.enumpck.UserTypeEnum; 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; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.*; +import java.util.regex.Pattern; import java.util.stream.Collectors; import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST; -import static com.vci.web.util.WebUtil.arryAndSqlToClientBusinessObject; +import static com.vci.web.util.WebUtil.arryAndSqlToBusinessObject; /** * 鐢ㄦ埛鐨勬煡璇㈢浉鍏崇殑鏈嶅姟锛屽彲浠ュ吋瀹硅�佸钩鍙板拰鑰佺殑pdm @@ -53,6 +67,24 @@ */ @Autowired private WebBoServiceI boService; + + /** + * 閮ㄩ棬鏈嶅姟 + */ + @Autowired + private OrgDeptQueryServiceI orgDeptQueryService; + + /** + * 瑙掕壊鏈嶅姟 + */ + @Autowired + private SmRoleQueryServiceI smRoleQueryService; + + /** + * 瀵嗙爜绛栫暐鏌ヨ鏈嶅姟 + */ + @Autowired + private SmPwdStrategyQueryServiceI smPwdStrategyQueryService; /** * 浣跨敤瑙掕壊鐨勫睘鎬ф煡璇㈢敤鎴锋椂 @@ -80,11 +112,39 @@ public static final String QUERY_FIELD_ROLE = "roleUser.plroleuid"; /** - * 鑷紩鐢� + * 鐢ㄦ埛鍒嗛〉鏌ヨ鏃惰幏鍙栭儴闂ㄦ斁鍒拌繖閲岄伩鍏嶉噸澶嶆煡璇� */ - @Autowired(required = false) - @Lazy - private SmUserQueryServiceI self; + 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("500", new String[] { "妫�鏌ョ敤鎴锋槸鍚﹀瓨鍦ㄦ椂锛屼紶閫掔殑鍙傛暟鐢ㄦ埛鍚嶅拰鐢ㄦ埛oid閮戒负绌猴紒"}); + } + UserInfo userInfo = null; + if(Func.isNotEmpty(userName)) { + userInfo = platformClientUtil.getFrameworkService().getUserObjectByUserName(userName); + }else{ + userInfo = platformClientUtil.getFrameworkService().getUserObjectByoid(oid); + } + return Func.isNotEmpty(userInfo); + } /** * 鏍规嵁鐢ㄦ埛鍚嶈幏鍙栫敤鎴风殑瀵硅薄锛屼笉鍖哄垎澶у皬鍐� @@ -95,7 +155,12 @@ @Override public SmUserVO getUserByUserId(String userId) throws VciBaseException { WebUtil.alertNotNull(userId,"鐢ㄦ埛鍚�"); - return getUserByField("plusername",userId); + try { + UserInfo userInfo = platformClientUtil.getFrameworkService().getUserObjectByUserName(userId); + return userInfo2VO(userInfo); + } catch (PLException e) { + throw new VciBaseException("鐧诲綍鏃讹紝鑾峰彇鐢ㄦ埛淇℃伅澶辫触锛�"+e.getMessage()); + } } /** @@ -106,7 +171,7 @@ * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ private SmUserVO getUserByField(String queryField,String queryValue) throws VciBaseException{ - VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(null,SmUserDO.class,null,true); + VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(null, SmUserDO.class,null,true); queryWrapper.eq(queryWrapper.getTableNick() + "." +queryField,queryValue); queryWrapper.setDistinct(true); queryWrapper.wrapperSql(); @@ -117,9 +182,9 @@ " left join PLUSERPASSWORDSTRATEGY pkUserPassword on " +queryWrapper.getTableNick() + ".pluid = pkUserPassword.pluseruid " + queryWrapper.getLinkTableSql() + (StringUtils.isNotBlank(queryWrapper.getWhereSql())?(" where " + queryWrapper.getWhereSql()):""); try{ - String[][] sqlQueryResult = ServiceProvider.getBOFService().getSqlQueryResult(sql + fromSql, null); + String[][] sqlQueryResult = platformClientUtil.getBOFService().getSqlQueryResult(sql + fromSql, null); if(sqlQueryResult.length>0){ - com.vci.client.bof.ClientBusinessObject cbo = arryAndSqlToClientBusinessObject(queryWrapper.getSelectFieldSql(),sqlQueryResult[0]); + BusinessObject cbo = arryAndSqlToBusinessObject(queryWrapper.getSelectFieldSql(),sqlQueryResult[0]); return cbo2VO(cbo); } }catch (Exception e){ @@ -147,7 +212,7 @@ + " left join pluserdept up on " + queryWrapper.getTableNick() + ".pluid = up.pluseruid left join pldept pkDepartment on up.pldeptuid = pkDepartment.pluid " + " left join PLUSERPASSWORDSTRATEGY pkUserPassword on " +queryWrapper.getTableNick() + ".pluid = pkUserPassword.pluseruid " + queryWrapper.getLinkTableSql() + (StringUtils.isNotBlank(queryWrapper.getWhereSql())?(" where " + queryWrapper.getWhereSql()):""); - List<com.vci.client.bof.ClientBusinessObject> dataList = boService.queryBySql(sql + fromSql, null); + List<BusinessObject> dataList = boService.queryBySql(sql + fromSql, null); if(!CollectionUtils.isEmpty(dataList)){ dataList.stream().forEach(cbo->{ userVOList.add(cbo2VO(cbo)); @@ -166,7 +231,12 @@ @Override public List<SmUserVO> listUserByUserIds(Collection<String> userIdCollections)throws VciBaseException { WebUtil.alertNotNull(userIdCollections,"鐢ㄦ埛鍚嶉泦鍚�"); - return listUserByField("plusername",userIdCollections); + try { + UserInfo[] userInfo = platformClientUtil.getFrameworkService().fetchUserInfoByNames(VciBaseUtil.collection2StrArr(userIdCollections)); + return userInfoArr2VO(userInfo); + } catch (PLException e) { + throw new VciBaseException("鑾峰彇鐢ㄦ埛澶辫触锛�"+e.getMessage()); + } } /** * 鏍规嵁鐢ㄦ埛涓婚敭鑾峰彇鐢ㄦ埛鐨勪俊鎭� @@ -177,8 +247,14 @@ @Override public SmUserVO getUserByUserOid(String userOid) throws VciBaseException { WebUtil.alertNotNull(userOid,"鐢ㄦ埛涓婚敭"); - return getUserByField("pluid",userOid); + try { + UserInfo userInfo = platformClientUtil.getFrameworkService().getUserObjectByoid(userOid); + return userInfo2VO(userInfo); + } catch (PLException e) { + throw new VciBaseException("鑾峰彇鐢ㄦ埛澶辫触锛�"+e.getMessage()); + } } + /** * 鎵归噺鑾峰彇鐢ㄦ埛鐨勪俊鎭� 锛堟牴鎹敤鎴蜂富閿級 * @param userOidCollections 鐢ㄦ埛涓婚敭鐨勯泦鍚堬紝鍙互瓒呰繃1000涓� @@ -186,10 +262,107 @@ * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呮暟鎹簱瀛樺湪闂鐨勬椂鍊欎細鎶涘嚭寮傚父 */ @Override - public List<SmUserVO> listUserByUserOids( - Collection<String> userOidCollections) throws VciBaseException { + public List<SmUserVO> listUserByUserOids(Collection<String> userOidCollections) throws VciBaseException { WebUtil.alertNotNull(userOidCollections,"鐢ㄦ埛涓婚敭闆嗗悎"); - return listUserByField("pluid",userOidCollections); + try { + UserInfo[] userInfoArr = platformClientUtil.getFrameworkService().getUserObjectByoids(VciBaseUtil.collection2StrArr(userOidCollections)); + return userInfoArr2VO(userInfoArr); + } catch (PLException e) { + throw new VciBaseException("鑾峰彇鐢ㄦ埛淇℃伅澶辫触:"+e.getMessage()); + } + } + + /** + * 涓氬姟鏁版嵁鏁扮粍杞樉绀哄璞¢泦鍚� + * @param userInfoArr 涓氬姟鏁版嵁鏁扮粍 + * @return 鏄剧ず瀵硅薄闆嗗悎 + */ + private List<SmUserVO> userInfoArr2VO(UserInfo[] userInfoArr) throws PLException { + List<SmUserVO> userVOList = new ArrayList<>(); + for(UserInfo userInfo : userInfoArr){ + userVOList.add(userInfo2VO(userInfo)); + } + return userVOList; + } + + /** + * 涓氬姟鏁版嵁杞崲涓烘樉绀哄璞� + * @param userInfo 骞冲彴杩斿洖鐨勪笟鍔℃暟鎹� + * @return 鐢ㄦ埛鏄剧ず瀵硅薄 + */ + private SmUserVO userInfo2VO(UserInfo userInfo) throws PLException { + if(Func.isBlank(userInfo.id)){ + return new SmUserVO(); + } + 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); + smUserVO.setStatus(userInfo.status); + smUserVO.setPassword(userInfo.pwd); + //鐢ㄦ埛鎵�灞為儴闂ㄧ殑鏌ヨ璁剧疆 + List<OrgDepartmentVO> orgDepartmentVOList; + //鏌ョ湅鍏ㄥ眬鍙橀噺涓槸鍚﹀瓨鍦ㄩ儴闂ㄤ俊鎭紝瀛樺湪鐨勬儏鍐垫渶涓昏鏄拡瀵瑰鏉$敤鎴锋煡璇㈢殑鏃跺�欓伩鍏嶉噸澶嶆煡璇㈢殑 + if(Func.isNotEmpty(orgDepartmentVOMap)){ + orgDepartmentVOList = orgDepartmentVOMap.get(userInfo.id); + }else { + orgDepartmentVOList = orgDeptQueryService.listDeptByUserOid(userInfo.id,null); + } + 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; + if(Func.isNotEmpty(smPwdStrategyVOMap)){ + smPasswordStrategyVO = smPwdStrategyVOMap.getOrDefault(userInfo.id,new SmPasswordStrategyVO()); + }else { + smPasswordStrategyVO = smPwdStrategyQueryService.getPasswordStrategyVOByUserOid(userInfo.id); + //濡傛灉涓嶅瓨鍦ㄥ氨鑾峰彇榛樿鐨� + smPasswordStrategyVO = Func.isNotEmpty(smPasswordStrategyVO) ? smPasswordStrategyVO:smPwdStrategyQueryService.getPasswordStrategyVOByDefault(); + } + smUserVO.setPkPasswordStrategy(smPasswordStrategyVO.getOid()); + smUserVO.setPkPasswordStrategyName(smPasswordStrategyVO.getName()); + //瑙掕壊鏌ヨ璁剧疆 + List<SmRoleVO> smRoleVOList; + if (Func.isNotEmpty(smRoleVOMap)) { + smRoleVOList = smRoleVOMap.get(userInfo.id); + }else { + smRoleVOList = smRoleQueryService.listRoleByUserOid(userInfo.id,null); + } + 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; } /** @@ -200,11 +373,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; } /** @@ -228,7 +410,7 @@ + " left join pluserdept up on " + queryWrapper.getTableNick() + ".pluid = up.pluseruid left join pldept pkDepartment on up.pldeptuid = pkDepartment.pluid " + " left join PLUSERPASSWORDSTRATEGY pkUserPassword on " +queryWrapper.getTableNick() + ".pluid = pkUserPassword.pluseruid " + (QUERY_FIELD_ROLE.equalsIgnoreCase(queryField)?roleSql:"") + queryWrapper.getLinkTableSql() + (StringUtils.isNotBlank(queryWrapper.getWhereSql())?(" where " + queryWrapper.getWhereSql()):""); - List<com.vci.client.bof.ClientBusinessObject> dataList = boService.queryBySql(sql + fromSql, null); + List<BusinessObject> dataList = boService.queryBySql(sql + fromSql, null); if(!CollectionUtils.isEmpty(dataList)){ dataList.stream().forEach(cbo->{ userVOList.add(cbo2VO(cbo)); @@ -242,7 +424,7 @@ * @param cbo 涓氬姟鏁版嵁 * @return 鏄剧ず瀵硅薄 */ - private SmUserVO cbo2VO(com.vci.client.bof.ClientBusinessObject cbo){ + private SmUserVO cbo2VO(BusinessObject cbo){ SmUserDO userDO = new SmUserDO(); SmUserVO userVO = new SmUserVO(); WebUtil.copyValueToObjectFromCbos(cbo,userDO); @@ -265,9 +447,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()); @@ -296,7 +478,7 @@ } } } - List<com.vci.client.bof.ClientBusinessObject> dataList = boService.queryBySql((isPage?("select " + pageSelectList.stream().collect(Collectors.joining(","))+ " from (select A.*,rownum RN from ( "):"") + sql + fromSql + (isPage?pageSubfix:""), null); + List<BusinessObject> dataList = boService.queryBySql((isPage?("select " + pageSelectList.stream().collect(Collectors.joining(","))+ " from (select A.*,rownum RN from ( "):"") + sql + fromSql + (isPage?pageSubfix:""), null); if(!CollectionUtils.isEmpty(dataList)){ dataList.stream().forEach(cbo->{ userVOList.add(cbo2VO(cbo)); @@ -310,6 +492,7 @@ } return dataGrid; } + /** * 鑾峰彇鐢ㄦ埛鐨勫垪琛紝榛樿浼氫互鐢ㄦ埛鍚嶅崌搴忔帓鍒楋紝鐢ㄦ埛鐨勭紪杈戦〉闈㈠垪琛ㄤ笉瑕佷娇鐢ㄨ繖涓帴鍙� * @param queryMap 鏌ヨ鏉′欢 @@ -321,6 +504,50 @@ 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"); + //TODO:涓轰簡鏂逛究璋冭瘯锛屾墍浠ヨ繖鍎垮厛娉ㄩ噴鍐欐鍚庨潰璁板緱鏇存敼 + //String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserName(); + //鍒嗛〉鏌ヨ + UserInfo[] userInfos = platformClientUtil.getFrameworkService().fetchUserInfoByCondition( + conditionMap.get("name"), + conditionMap.get("id"), + conditionMap.get("pkDepartment"), + conditionMap.get("pkPerson"), + "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("id"), + conditionMap.get("pkDepartment"), + conditionMap.get("pkPerson"), + "developer" //褰撳墠鐧诲綍鐨勭敤鎴峰悕 + ) + ); + } + return dataGrid; } /** @@ -351,9 +578,10 @@ */ @Override public String getUserNameByUserId(String userId) { - SmUserVO userVO = self.getUserByUserId(userId); + SmUserVO userVO = getUserByUserId(userId); return userVO == null?"":userVO.getName(); } + /** * 鏍规嵁鐢ㄦ埛涓婚敭鑾峰彇鐢ㄦ埛鐨勫鍚� * @param userOid 鐢ㄦ埛涓婚敭 @@ -361,11 +589,9 @@ */ @Override public String getUserNameByUserOid(String userOid) { - SmUserVO userVO = self.getUserByUserOid(userOid); + SmUserVO userVO = getUserByUserOid(userOid); return userVO.getName(); } - - /** * 鏌ヨ鏌愪釜閮ㄩ棬涓嬬殑鐢ㄦ埛瀵硅薄 @@ -384,7 +610,7 @@ } /** - * 鑾峰彇 + * 鑾峰彇鏌ヨ灏佽鍣紝榛樿鍙煡浜唒lstatus=0鍜宲lusertype=2锛屾帓搴忛粯璁lusername * @param queryField 鏌ヨ灞炴�� * @param queryValue 鏌ヨ鐨勫�� * @param queryMap 鏌ヨ鏉′欢锛屽鏋滄槸瑙掕壊鐨勫睘鎬э紝闇�瑕佷娇鐢╬krole.xxx @@ -419,6 +645,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 閮ㄩ棬鐨勪富閿� @@ -433,6 +696,7 @@ throws VciBaseException { return gridUserByQueryField(QUERY_FIELD_DEPARTMENT,deptOid,queryMap,pageHelper,false); } + /** * 鎵归噺鏍规嵁閮ㄩ棬鐨勪富閿幏鍙栫敤鎴� * @param deptOidCollection 閮ㄩ棬鐨勪富閿泦鍚� @@ -451,6 +715,7 @@ } return new HashMap<>(); } + /** * 鏌ヨ涓嶅湪鏌愪釜閮ㄩ棬涓嬬殑鐢ㄦ埛瀵硅薄鍒楄〃 * @param deptOid 閮ㄩ棬鐨勪富閿� @@ -466,6 +731,7 @@ } return listUserByQueryField(QUERY_FIELD_DEPARTMENT,deptOid,queryMap,true); } + /** * 鏌ヨ涓嶅湪鏌愪釜閮ㄩ棬涓嬬殑鐢ㄦ埛瀵硅薄鍒楄〃 * @param deptOid 閮ㄩ棬鐨勪富閿� @@ -480,6 +746,7 @@ throws VciBaseException { return gridUserByQueryField(QUERY_FIELD_DEPARTMENT,deptOid,queryMap,pageHelper,true); } + /** * 鏌ヨ鏌愪釜瑙掕壊涓嬬殑鐢ㄦ埛瀵硅薄 * @param roleOid 瑙掕壊鐨勪富閿� @@ -496,6 +763,7 @@ return listUserByQueryField(QUERY_FIELD_ROLE,roleOid,queryMap,false); } + /** * 鏌ヨ鏌愪釜瑙掕壊涓嬬殑鐢ㄦ埛瀵硅薄鍒楄〃 * @param roleOid 瑙掕壊鐨勪富閿� @@ -510,6 +778,7 @@ throws VciBaseException { return gridUserByQueryField(QUERY_FIELD_ROLE,roleOid,queryMap,pageHelper,false); } + /** * 鏌ヨ涓嶅湪鏌愪釜瑙掕壊涓嬬殑鐢ㄦ埛瀵硅薄鍒楄〃 * @param roleOid 瑙掕壊鐨勪富閿� @@ -525,6 +794,7 @@ } return listUserByQueryField(QUERY_FIELD_ROLE,roleOid,queryMap,true); } + /** * 鏌ヨ涓嶅湪鏌愪釜瑙掕壊涓嬬殑鐢ㄦ埛瀵硅薄鍒楄〃 * @param roleOid 瑙掕壊鐨勪富閿� @@ -539,6 +809,7 @@ throws VciBaseException { return gridUserByQueryField(QUERY_FIELD_ROLE,roleOid,queryMap,pageHelper,true); } + /** * 鎵归噺鏍规嵁瑙掕壊鐨勪富閿幏鍙栫敤鎴� * @param roleOidCollection 瑙掕壊鐨勪富閿泦鍚� @@ -596,6 +867,7 @@ PageHelper pageHelper) throws VciBaseException { return gridUserByQueryField(null,null,queryMap,pageHelper,false); } + /** * 鍙傜収鐢ㄦ埛鐨勬爲褰㈡樉绀� * @param treeQueryObject 鏍戝瀷鎺ュ彛鏌ヨ瀵硅薄 @@ -612,13 +884,13 @@ + " left join pluserdept up on " + queryWrapper.getTableNick() + ".pluid = up.pluseruid left join pldept pkDepartment on up.pldeptuid = pkDepartment.pluid " + " left join PLUSERPASSWORDSTRATEGY pkUserPassword on " +queryWrapper.getTableNick() + ".pluid = pkUserPassword.pluseruid " + queryWrapper.getLinkTableSql() + (StringUtils.isNotBlank(queryWrapper.getWhereSql())?(" where " + queryWrapper.getWhereSql()):""); - List<com.vci.client.bof.ClientBusinessObject> dataList = boService.queryBySql(sql + fromSql, null); + List<BusinessObject> dataList = boService.queryBySql(sql + fromSql, null); List<Tree> treeList = new ArrayList<>(); if(!CollectionUtils.isEmpty(dataList)){ dataList.stream().forEach(cbo->{ Tree tree = new Tree(); - tree.setOid(cbo.getOid()); - tree.setText(cbo.getId() + " " + cbo.getName()); + tree.setOid(cbo.oid); + tree.setText(cbo.id + " " + cbo.name); Map<String,String> attributeMap = new HashMap<>(); WebUtil.copyValueToCboFromMap(cbo,attributeMap); tree.setAttributes(attributeMap); @@ -628,6 +900,7 @@ } return treeList; } + /** * 鏍¢獙瀵嗙爜鏄惁鐩稿悓锛屽湪鏂板钩鍙颁腑瀛樺偍鐨勫瘑鐮佹槸涓ゆmd5 * @param userOid 鐢ㄦ埛涓婚敭 @@ -642,19 +915,20 @@ String sql = " select plpassword from pluser where pluid = :userOid"; Map<String,String> conditionMap = new HashMap<>(); conditionMap.put("userOid",userOid.trim()); - List<com.vci.client.bof.ClientBusinessObject> clientBusinessObjectList = boService.queryBySql(sql, conditionMap); - if(CollectionUtils.isEmpty(clientBusinessObjectList)){ + List<BusinessObject> BusinessObjectList = boService.queryBySql(sql, conditionMap); + if(CollectionUtils.isEmpty(BusinessObjectList)){ return false; } ThreeDES des = new ThreeDES();// 瀹炰緥鍖栦竴涓锟�? des.getKey("daliantan0v0");// 鐢熸垚瀵嗗寵 md5Password = des.getEncString(md5Password); - if(md5Password.equals(clientBusinessObjectList.get(0).getAttributeValue("plpassword"))){ + if(md5Password.equals(ObjectTool.getNewBOAttributeValue(BusinessObjectList.get(0),"plpassword"))){ return true; } return false; } + /** * 鏍¢獙鐢ㄦ埛鏄惁閿佸畾 * @param smUserVO 鐢ㄦ埛瀵硅薄 @@ -667,7 +941,9 @@ return smUserVO.isLockFlag(); } //鏌ヨ瀵嗙爜绛栫暐 - SmPasswordStrategyVO passwordStrategyVO = getPasswordStrategyVOByOid(smUserVO.getPkPasswordStrategy()); + SmPasswordStrategyVO passwordStrategyVO = smPwdStrategyQueryService.getPasswordStrategyVOByOid( + smUserVO.getPkPasswordStrategy() + ); if(passwordStrategyVO == null){ throw new VciBaseException("绯荤粺閲屾病鏈夊瘑鐮佸畨鍏ㄧ瓥鐣�"); } @@ -675,58 +951,6 @@ return true; } return false; - } - - /** - * 浣跨敤涓婚敭鑾峰彇瀵嗙爜绛栫暐 - * @param oid 涓婚敭 - * @return 瀵嗙爜绛栫暐鏄剧ず瀵硅薄 - */ - public SmPasswordStrategyVO getPasswordStrategyVOByOid(String oid){ - VciQueryWrapperForDO queryWrapperForDO = new VciQueryWrapperForDO(null, SmPasswordStrategyDO.class); - queryWrapperForDO.eq("oid",oid.trim()); - List<com.vci.client.bof.ClientBusinessObject> 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()); } /** @@ -737,6 +961,7 @@ public void lockUser(String userId) { //鑰佺殑杩欎釜骞冲彴锛屾槸渚濋潬閿佸畾娆℃暟鏉ュ垽鏂殑锛屾墍浠ヨ繖閲屾病鍔炴硶鐩存帴璁剧疆 } + /** * 璁剧疆鏌愪釜鐢ㄦ埛涓嶆槸閿佸畾鐘舵�� * @param userId 鐢ㄦ埛鍚� @@ -751,6 +976,7 @@ throw WebUtil.getVciBaseException(vciError); } } + /** * 淇敼瀵嗙爜 * @param userOid 鐢ㄦ埛涓婚敭 @@ -758,6 +984,7 @@ * @param confirmPassword 纭瀵嗙爜 */ @Override + @Transactional(rollbackFor = Exception.class) public void changePassword(String userOid, String password, String confirmPassword) throws VciBaseException { WebUtil.alertNotNull(userOid,"鐢ㄦ埛涓婚敭",password,"瀵嗙爜",confirmPassword,"纭瀵嗙爜"); @@ -774,6 +1001,7 @@ throw WebUtil.getVciBaseException(vciError); } } + /** * 鏇存柊鐢ㄦ埛鐨勫瘑鐮侀敊璇鏁� * @param userOid 鐢ㄦ埛鐨勪富閿� @@ -791,6 +1019,7 @@ throw WebUtil.getVciBaseException(vciError); } } + /** * 鏇存柊鐢ㄦ埛鐨勬渶鍚庣櫥褰曟椂闂� * @param userOid 鐢ㄦ埛鐨勪富閿� @@ -806,4 +1035,229 @@ throw WebUtil.getVciBaseException(vciError); } } + + /** + * 娣诲姞鐢ㄦ埛 + * @param smUserDTO + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean addUser(SmUserDTO smUserDTO) throws PLException { + //鍒ょ┖ + VciBaseUtil.alertNotNull( + smUserDTO,"娣诲姞鐨勭敤鎴峰璞�", + smUserDTO.getId(),"鐢ㄦ埛鍚�", + smUserDTO.getPassword(),"瀵嗙爜", + smUserDTO.getConfirmPassword(),"纭瀵嗙爜", + smUserDTO.getName(),"濮撳悕" + ); + //鏍¢獙 + check(smUserDTO,true); + //鐢熸垚瀛樺偍鐨凞O瀵硅薄 + Date date = new Date(); + smUserDTO.setPwdUpdateTime(date); + smUserDTO.setStatus((short) 0); + smUserDTO.setCreateTime(date); + smUserDTO.setLastModifyTime(date); + //userObject.setCreateUser(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserName()); + smUserDTO.setCreator("developer"); + //userObject.setUpdateUser(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserName()); + smUserDTO.setLastModifier("developer"); + 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())){ + //鎵ц淇濆瓨鐢ㄦ埛閮ㄩ棬鍏宠仈鍏崇郴 + orgDeptQueryService.saveUsersDept(new String[]{oid},smUserDTO.getPkDepartment()); + //platformClientUtil.getFrameworkService().saveUserDept(new String[]{oid}, smUserDTO.getPkDepartment(), userEntityInfo); + } + return true; + } + + /** + * 淇敼鐢ㄦ埛 + * @param smUserDTO + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean updateUser(SmUserDTO smUserDTO) throws PLException { + //鍒ょ┖ + VciBaseUtil.alertNotNull( + smUserDTO,"淇敼鐨勭敤鎴峰璞�", + smUserDTO.getOid(),"鐢ㄦ埛涓婚敭", + smUserDTO.getId(),"鐢ㄦ埛鍚�", + smUserDTO.getPassword(),"瀵嗙爜", + smUserDTO.getConfirmPassword(),"纭瀵嗙爜", + smUserDTO.getName(),"濮撳悕" + ); + //鏍¢獙 + check(smUserDTO,false); + //鏌ヨ鏁版嵁搴撲腑鐨� + 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 = changeSmUserDTOToUserInfo(smUserDTO); + boolean updateBoolean = platformClientUtil.getFrameworkService().updateUser(userInfo, new UserEntityInfo("developer", null)); + //淇敼鎴愬姛锛屽苟涓旂敤鎴峰叧鑱旈儴闂ㄦ湁鎵�鏇存敼 + if(updateBoolean && Func.isNotEmpty(smUserDTO.getPkDepartment()) && !smUserDTO.getPkDepartment().equals(dbSmUserVO.getPkDepartment())){ + //鎵ц淇濆瓨鐢ㄦ埛閮ㄩ棬鍏宠仈鍏崇郴 + orgDeptQueryService.saveUsersDept(new String[]{dbSmUserVO.getOid()},smUserDTO.getPkDepartment()); + } + return updateBoolean; + } + + /** + * 妫�鏌ョ敤鎴蜂俊鎭槸鍚︾鍚堣鑼� + * @param smUserDTO + * @param isAdd + */ + private void check(SmUserDTO smUserDTO, boolean isAdd){ + if(!smUserDTO.getPassword().equals(smUserDTO.getConfirmPassword())){ + throw new VciBaseException("瀵嗙爜鍜岀‘璁ゅ瘑鐮佷笉鐩哥瓑"); + } + if(smUserDTO.getId().getBytes().length > 128){ + throw new VciBaseException("鐢ㄦ埛鍚嶉暱搴﹁秴杩囦笂闄�"); + } + if(smUserDTO.getPassword().getBytes().length > 128){ + throw new VciBaseException("瀵嗙爜闀垮害瓒呰繃涓婇檺"); + } + if(smUserDTO.getName().getBytes().length > 64){ + throw new VciBaseException("濮撳悕闀垮害瓒呰繃涓婇檺"); + } + if (Func.isNotBlank(smUserDTO.getSpecialties()) && smUserDTO.getSpecialties().getBytes().length > 255){ + throw new VciBaseException("涓撲笟闀垮害瓒呰繃涓婇檺"); + } + if (Func.isNotBlank(smUserDTO.getEmail()) && smUserDTO.getEmail().getBytes().length > 128){ + throw new VciBaseException("鐢靛瓙閭闀垮害瓒呰繃涓婇檺"); + } + if (Func.isNotBlank(smUserDTO.getDescription()) && smUserDTO.getDescription().getBytes().length > 255 ){ + throw new VciBaseException("鎻忚堪闀垮害瓒呰繃涓婇檺"); + } + 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()); + if(Func.isNotEmpty(dbSmUserVO) && Func.isNotBlank(dbSmUserVO.getOid())){ + throw new VciBaseException("璇ョ敤鎴峰悕鍦ㄧ郴缁熶腑宸茬粡瀛樺湪,璇蜂慨鏀�!"); + } + } + //鏍规嵁褰撳墠鍒涘缓杩欎釜鐢ㄦ埛鐨勪汉鎵�缁戝畾瀵嗙爜绛栫暐鏉ヨ繘琛屽瘑鐮佹牎楠� + try { + //TODO:涓轰簡鏂逛究璋冭瘯锛屾墍浠ヨ繖鍎垮厛娉ㄩ噴鍐欐鍚庨潰璁板緱鏇存敼 + //String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserName(); + String userName = "developer"; + String error = platformClientUtil.getFrameworkService().checkPasswordStrategyByUserId(userName, smUserDTO.getPassword(),null); + if (!StringUtils.isBlank(error)) { + throw new VciBaseException("褰撳墠璁剧疆鐨勫瘑鐮侊紝瀵嗙爜绛栫暐鏍¢獙鏈�氳繃"); + } + } catch (PLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + throw new VciBaseException("妫�鏌ュ瘑鐮佺瓥鐣ョ鍚堟儏鍐靛け璐ワ紒2"); + } + } + + /*** + * 鐢ㄦ埛浠嶥TO瀵硅薄鍒癱orba瀵硅薄 + * @param user + * @return + */ + public UserInfo changeSmUserDTOToUserInfo(SmUserDTO user) { + UserInfo userInfo = new UserInfo(); + userInfo.id = user.getOid() == null ? "" : user.getOid(); + userInfo.userName = user.getId() == null ? "" : user.getId(); + userInfo.pwd = user.getPassword() == null ? "" : user.getPassword(); + userInfo.trueName = user.getName() == null ? "" : user.getName(); + userInfo.specialties = user.getSpecialties() == null ? "" : user.getSpecialties(); + userInfo.email = user.getEmail() == null ? "" : user.getEmail(); + userInfo.desc = user.getDescription() == null ? "" : user.getDescription(); + userInfo.userType = user.getUserType(); + userInfo.status = user.getStatus(); + userInfo.createTime = user.getCreateTime().getTime(); + userInfo.createUser = user.getCreator() == null ? "" : user.getCreator(); + userInfo.updateTime = user.getLastModifyTime().getTime(); + userInfo.updateUser = user.getLastModifier() == null ? "" : user.getLastModifier(); + userInfo.pwdUpdateTime = user.getPwdUpdateTime().getTime(); + userInfo.grantor = user.getGrantor() == null ? "" : user.getGrantor(); + userInfo.isDeptLeader = user.getIsDeptLeader() == null ? "0" : user.getIsDeptLeader(); + return userInfo; + } + + /*** + * 鐢ㄦ埛浠庡鎴风瀵硅薄鍒癱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 + @Transactional(rollbackFor = Exception.class) + public boolean deleteUser(String[] ids) throws PLException { + if(Func.isEmpty(ids)){ + throw new VciBaseException("寰呭垹闄ょ殑鐢ㄦ埛id鍒楄〃涓嶈兘涓虹┖锛�"); + } + //璋冪敤platformClientUtil鐨勫垹闄ょ敤鎴风殑鏂规硶锛屼細涓�璧峰垹闄ゆ帀鍏峰鍏宠仈鍏崇郴鐨勪竴浜涗俊鎭紝濡傞儴闂� + return platformClientUtil.getFrameworkService().deleteUser(ids, null); + } + + /** + * 鐢ㄦ埛鍋滅敤/鍚敤 + * @param ids + * @param flag + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + 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