Commit 6c56d9c7 by guojuxing

操作模块初始化修改:查询全部

parent 5d1e9008
......@@ -2,6 +2,7 @@ package com.gic.auth.service.outer.impl;
import java.util.*;
import com.gic.enterprise.service.EnterpriseApiService;
import com.gic.open.api.service.ServeApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
......@@ -53,6 +54,8 @@ public class MenuApiServiceImpl implements MenuApiService {
private AppTokenApiService appTokenApiService;
@Autowired
private ServeApiService serveApiService;
@Autowired
private EnterpriseApiService enterpriseApiService;
@Override
public ServiceResponse<List<MenuDTO>> listByMenuIdList(List<Integer> menuIdList) {
......@@ -102,8 +105,14 @@ public class MenuApiServiceImpl implements MenuApiService {
}
@Override
public ServiceResponse<List<MenuDTO>> getSuperAdminMenu(Integer userId, String versionCode) {
return this.getUserMenuOfGic(userId, null, versionCode);
public ServiceResponse<List<MenuDTO>> getSuperAdminGicMenu(Integer enterpriseId) {
//查询超级管理员
TabSysUser tabSysUser = userService.getUserByEnterpriseId(enterpriseId);
if (tabSysUser == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "没有超级管理员,数据错误");
}
String versionCode = enterpriseApiService.getEnterpriseById(enterpriseId).getResult().getVersionCode();
return this.getUserMenuOfGic(tabSysUser.getUserId(), null, versionCode);
}
@Override
......
......@@ -112,16 +112,30 @@ public class LoginController {
List<MenuDTO> menuList = menuResult.getResult();
List<MenuInfo> menuInfoList = EntityUtil.changeEntityListNew(MenuInfo.class, menuList);
Map<String, Object> map = new HashMap<>(16);
Map<String, MenuInfo> moduleMap = new HashMap<>(16);
if (CollectionUtils.isNotEmpty(menuInfoList)) {
for (MenuInfo menuDTO : menuInfoList) {
if (StringUtils.isBlank(menuDTO.getMenuUrl())) {
continue;
}
moduleMap.put(menuDTO.getProjectUrlForWeb() + menuDTO.getMenuUrl(), menuDTO);
map.put(menuDTO.getMenuUrl(), menuDTO);
}
}
//查询全部的操作模块
Map<String, MenuInfo> moduleMap = new HashMap<>(16);
ServiceResponse<List<MenuDTO>> allGicMenu = menuApiService.getSuperAdminGicMenu(enterpriseId);
if (allGicMenu.isSuccess()) {
List<MenuDTO> temp = allGicMenu.getResult();
List<MenuInfo> tempMenuInfoList = EntityUtil.changeEntityListNew(MenuInfo.class, temp);
if (CollectionUtils.isNotEmpty(tempMenuInfoList)) {
for (MenuInfo menuDTO : menuInfoList) {
if (StringUtils.isBlank(menuDTO.getMenuUrl())) {
continue;
}
moduleMap.put(menuDTO.getProjectUrlForWeb() + menuDTO.getMenuUrl(), menuDTO);
}
}
}
//塞值
userDetail.setMenuInfoList(menuInfoList);
userDetail.setMenuUrlMap(map);
userDetail.setModuleUrlMap(moduleMap);
......
......@@ -113,20 +113,12 @@ public class RoleController {
@RequestMapping("/list-menu")
public RestResponse listMenu() {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
ServiceResponse<UserDTO> userResponse = userApiService.getUserByEnterpriseId(enterpriseId);
if (userResponse.isSuccess()) {
UserDTO admin = userResponse.getResult();
Integer userId = admin.getUserId();
ServiceResponse<List<MenuDTO>> menuResponse = menuApiService.getSuperAdminMenu(userId,
UserDetailUtils.getUserDetail().getEnterpriseInfo().getVersionCode());
if (menuResponse.isSuccess()) {
return RestResponse.success(menuResponse.getResult());
} else {
return EnterpriseRestResponse.failure(menuResponse);
}
ServiceResponse<List<MenuDTO>> menuResponse = menuApiService.getSuperAdminGicMenu(
UserDetailUtils.getUserDetail().getEnterpriseId());
if (menuResponse.isSuccess()) {
return RestResponse.success(menuResponse.getResult());
} else {
return EnterpriseRestResponse.failure(userResponse);
return EnterpriseRestResponse.failure(menuResponse);
}
}
......
package com.gic.auth.web.controller;
import com.gic.auth.constant.UserConstants;
import com.gic.auth.dto.AuthCodeDTO;
import com.gic.auth.service.AuthCodeApiService;
import com.gic.auth.web.vo.LoginUserVO;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.utils.CreateRandomUtils;
import com.gic.marketing.process.api.service.sms.SmsSendApiService;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.LogManager;
......@@ -34,6 +39,8 @@ public class UserController {
private UserApiService userApiService;
@Autowired
private SmsSendApiService smsSendApiService;
@Autowired
private AuthCodeApiService authCodeApiService;
@RequestMapping("/save-or-update-user")
public RestResponse editUser(@Validated({UserDTO.UserQoValid.class}) UserDTO userDTO) {
......@@ -115,6 +122,43 @@ public class UserController {
return ResultControllerUtils.commonResult(userApiService.pageUser(params));
}
/**
* 个人资料
* @Title: getLoginUser

* @Description:

 * @author guojuxing 

* @return com.gic.commons.webapi.reponse.RestResponse


 */
@RequestMapping("/get-login-user")
public RestResponse getLoginUser() {
LoginUserVO vo = EntityUtil.changeEntityNew(LoginUserVO.class, UserDetailUtils.getUserDetail().getUserInfo());
//商户logo
vo.setLogo(UserDetailUtils.getUserDetail().getEnterpriseInfo().getLogo());
return RestResponse.success(vo);
}
@RequestMapping("send-auth-code")
public RestResponse sendAuthCode(String phone, String nationCode) {
AuthCodeDTO authCodeDTO = new AuthCodeDTO();
authCodeDTO.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
//生成4位数字验证码
authCodeDTO.setAuthCode(CreateRandomUtils.getStringRandom(4));
ServiceResponse<Integer> result = authCodeApiService.saveAuth(authCodeDTO);
if (result.isSuccess()) {
Integer authCodeId = result.getResult();
//发送手机验证码
String[] smsArr = new String[]{};
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms("GICpassword001",
UserDetailUtils.getUserDetail().getEnterpriseInfo().getEnterpriseId(), nationCode, phone, smsArr);
if (!smsSendResult.isSuccess()) {
return EnterpriseRestResponse.failure(smsSendResult);
} else {
return RestResponse.success(authCodeId);
}
}
return EnterpriseRestResponse.failure(result);
}
@RequestMapping("/list-user-nopage")
public RestResponse listUserNoPage(UserListQO params) {
params.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
......
package com.gic.auth.web.vo;
import java.io.Serializable;
/**
* 登录用户的个人信息
* @ClassName: LoginUserVO

* @Description: 

* @author guojuxing

* @date 2019/11/15 1:57 PM

*/
public class LoginUserVO implements Serializable{
private static final long serialVersionUID = 8950007139503351315L;
/**
* 用户id
*/
private Integer userId;
/**
* 用户名
*/
private String userName;
/**
* 手机号码
*/
private String phoneNumber;
/**
* 国际区号,如中国 86
*/
private String phoneAreaCode;
private String logo;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getPhoneAreaCode() {
return phoneAreaCode;
}
public void setPhoneAreaCode(String phoneAreaCode) {
this.phoneAreaCode = phoneAreaCode;
}
public String getLogo() {
return logo;
}
public void setLogo(String logo) {
this.logo = logo;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment