| | |
| | | import com.vci.client.common.providers.ServiceProvider; |
| | | import com.vci.common.util.ThreeDES; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.framework.data.UserInfo; |
| | | import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; |
| | | import com.vci.frameworkcore.pagemodel.SmPasswordStrategyVO; |
| | | import com.vci.frameworkcore.pagemodel.SmUserVO; |
| | | 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; |
| | |
| | | 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.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.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.util.CollectionUtils; |
| | | |
| | |
| | | public static final String QUERY_FIELD_ROLE = "roleUser.plroleuid"; |
| | | |
| | | /** |
| | | * èªå¼ç¨ |
| | | */ |
| | | @Autowired(required = false) |
| | | @Lazy |
| | | private SmUserQueryServiceI self; |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·åè·åç¨æ·ç对象ï¼ä¸åºå大å°å |
| | | * @param userId ç¨æ·å |
| | | * @return ç¨æ·çæ¾ç¤ºå¯¹è±¡ï¼å¦æç¨æ·ä¸åå¨åè¿ånullï¼ä¸ä¼æåºå¼å¸¸ |
| | |
| | | @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()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä¸å¡æ°æ®è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @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; |
| | | } |
| | | |
| | | /** |
| | |
| | | @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()); |
| | | } |
| | | } |
| | | /** |
| | | * æ ¹æ®ç¨æ·ä¸»é®è·åç¨æ·çä¿¡æ¯ |
| | |
| | | @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()); |
| | | } |
| | | } |
| | | /** |
| | | * æ¹éè·åç¨æ·çä¿¡æ¯ ï¼æ ¹æ®ç¨æ·ä¸»é®ï¼ |
| | |
| | | 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) { |
| | | List<SmUserVO> userVOList = new ArrayList<>(); |
| | | for(UserInfo userInfo : userInfoArr){ |
| | | userVOList.add(userInfo2VO(userInfo)); |
| | | } |
| | | return userVOList; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public String getUserNameByUserId(String userId) { |
| | | SmUserVO userVO = self.getUserByUserId(userId); |
| | | SmUserVO userVO = getUserByUserId(userId); |
| | | return userVO == null?"":userVO.getName(); |
| | | } |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public String getUserNameByUserOid(String userOid) { |
| | | SmUserVO userVO = self.getUserByUserOid(userOid); |
| | | SmUserVO userVO = getUserByUserOid(userOid); |
| | | return userVO.getName(); |
| | | } |
| | | |