Commit 04470711 by 陶光胜

Merge branch 'developer' into 'master'

Developer

See merge request !9
parents 053ef216 243cba2e
......@@ -195,6 +195,16 @@ public interface UserApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.auth.dto.UserDTO>>


*/
ServiceResponse<List<UserDTO>> listGicUser(Integer enterpriseId);
/**
* 运维账户
* @Title: listOperationUser

* @Description:

* @author guojuxing
* @param enterpriseId

* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.auth.dto.UserDTO>>


*/
ServiceResponse<List<UserDTO>> listOperationUser(Integer enterpriseId);
/**
* 查询全部
* @Title: listUser

......
......@@ -453,6 +453,15 @@ public class UserApiServiceImpl implements UserApiService {
}
@Override
public ServiceResponse<List<UserDTO>> listOperationUser(Integer enterpriseId) {
List<TabSysUser> list = userService.listGicUser(enterpriseId, 1);
if (CollectionUtils.isNotEmpty(list)) {
return ServiceResponse.success(EntityUtil.changeEntityListNew(UserDTO.class, list));
}
return ServiceResponse.success(Collections.emptyList());
}
@Override
public ServiceResponse<List<UserDTO>> listUser(Integer enterpriseId) {
List<TabSysUser> list = userService.listGicUser(enterpriseId, null);
if (CollectionUtils.isNotEmpty(list)) {
......
......@@ -55,8 +55,8 @@ public class AuthCodeController {
if(enterprise.isSuccess() && enterprise.getResult() != null){
String enterpriseName = UserDetailUtils.getUserDetail().getEnterpriseInfo().getEnterpriseName();
ServiceResponse<UserDTO> user = this.userApiService.getUserByEnterpriseId(eid);
String[] smsArr = new String[] { enterprise.getResult().getEnterpriseName(), enterpriseName, code, enterpriseName};
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms("GICUnionEnterprise",
String[] smsArr = new String[] {enterpriseName, code};
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms("GICJFZX006",
UserDetailUtils.getUserDetail().getEnterpriseInfo().getEnterpriseId(), user.getResult().getPhoneAreaCode(), user.getResult().getPhoneNumber(), smsArr);
if(smsSendResult.isSuccess()){
ServiceResponse<Integer> serviceResponse = this.authCodeApiService.saveAuth(authCodeDTO);
......
......@@ -6,6 +6,7 @@ import java.util.*;
import java.util.stream.Collectors;
import com.gic.auth.constant.MenuProjectConstants;
import com.gic.auth.web.utils.EnterpriseBasicAppUtils;
import com.gic.log.api.dto.LogSearchDTO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -196,8 +197,15 @@ public class MenuController {
null);
}
if (result.isSuccess()) {
//过滤商户基础应用
List<MenuDTO> appMenuList = result.getResult();
if (CollectionUtils.isNotEmpty(appMenuList)) {
appMenuList = appMenuList.stream()
.filter(e -> !EnterpriseBasicAppUtils.ENTERPRISE_BASIC_APP_CODE.equals(e.getMenuCode()))
.collect(Collectors.toList());
}
return RestResponse
.success(changePageListToTree(MenuLevelConstants.FIRST_LEVEL_PARENT_ID, result.getResult()));
.success(changePageListToTree(MenuLevelConstants.FIRST_LEVEL_PARENT_ID, appMenuList));
}
return EnterpriseRestResponse.failure(result);
}
......@@ -217,7 +225,10 @@ public class MenuController {
public RestResponse listOperationLog(String startTime, String endTime, Integer menuId, String search, PageQO pageQO)
throws ParseException {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
UserDetail userDetail = UserDetailUtils.getUserDetail();
Integer enterpriseId = userDetail.getEnterpriseId();
//是否是超级管理员
boolean isSuperAdmin = userDetail.getUserInfo().getSuperAdmin().intValue() == 1;
LogSearchDTO searchParam = new LogSearchDTO();
searchParam.setEnterpriseId(Long.valueOf(enterpriseId));
......@@ -227,7 +238,6 @@ public class MenuController {
} else {
//权限控制
List<Long> relationIdList = new ArrayList<>();
UserDetail userDetail = UserDetailUtils.getUserDetail();
//权限控制
ServiceResponse<List<MenuDTO>> gicResult = menuApiService.getUserMenuOfGicNotTree(
userDetail.getEnterpriseId(), userDetail.getUserId(), null,
......@@ -237,7 +247,6 @@ public class MenuController {
relationIdList.addAll(Optional.ofNullable(gicMenuList).orElse(new ArrayList<>()).stream()
.mapToLong(e -> e.getMenuId()).boxed().collect(Collectors.toList()));
}
boolean isSuperAdmin = userDetail.getUserInfo().getSuperAdmin().intValue() == 1;
ServiceResponse<List<MenuDTO>> appResult;
if (isSuperAdmin) {
appResult = menuApiService.listAppPageOfHasBuy(UserDetailUtils.getUserDetail().getEnterpriseId());
......@@ -263,9 +272,27 @@ public class MenuController {
searchParam.setLogTimeEnd(sdf.parse(endTime));
}
//用于过滤
List<String> matchPhoneList = new ArrayList<>();
//过滤运营操作,如果是品牌方登录;过滤品牌方日志,如果是运营登录
ServiceResponse<List<UserDTO>> userResult;
if (userDetail.getUserInfo().getLoginType().intValue() == 0) {
userResult = userApiService.listGicUser(enterpriseId);
} else {
userResult = userApiService.listOperationUser(enterpriseId);
}
if (userResult.isSuccess()) {
List<UserDTO> userList = userResult.getResult();
matchPhoneList = userList.stream()
.map(e -> e.getPhoneNumber())
.collect(Collectors.toList());
}
if (CollectionUtils.isNotEmpty(matchPhoneList)) {
searchParam.setPhoneList(matchPhoneList);
}
ServiceResponse<Page<SystemSetLogDTO>> response = logApiService.listSystemSetLog(pageQO.getPageSize(),
pageQO.getCurrentPage(), searchParam);
return ResultControllerUtils.commonPageResult(response, LogListVO.class);
}
......
......@@ -4,7 +4,10 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.gic.auth.web.utils.EnterpriseBasicAppUtils;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -70,9 +73,16 @@ public class RoleController {
//app已购买应用
ServiceResponse<List<MenuDTO>> appResult = menuApiService
.listAppPageOfHasBuy(UserDetailUtils.getUserDetail().getEnterpriseId());
//过滤商户基础应用
List<MenuDTO> appMenuList = appResult.getResult();
if (CollectionUtils.isNotEmpty(appMenuList)) {
appMenuList = appMenuList.stream()
.filter(e -> !EnterpriseBasicAppUtils.ENTERPRISE_BASIC_APP_CODE.equals(e.getMenuCode()))
.collect(Collectors.toList());
}
vo.setAppMap(
changeListToSelectTree(MenuLevelConstants.FIRST_LEVEL_PARENT_ID, appResult.getResult(), gicMap));
changeListToSelectTree(MenuLevelConstants.FIRST_LEVEL_PARENT_ID, appMenuList, gicMap));
return RestResponse.success(vo);
}
return EnterpriseRestResponse.failure(roleResult);
......@@ -144,7 +154,13 @@ public class RoleController {
ServiceResponse<List<MenuDTO>> result = menuApiService
.listAppPageOfHasBuy(UserDetailUtils.getUserDetail().getEnterpriseId());
if (result.isSuccess()) {
return RestResponse.success(changeListToTree(MenuLevelConstants.FIRST_LEVEL_PARENT_ID, result.getResult()));
List<MenuDTO> menuList = result.getResult();
if (CollectionUtils.isNotEmpty(menuList)) {
menuList = menuList.stream()
.filter(e -> !EnterpriseBasicAppUtils.ENTERPRISE_BASIC_APP_CODE.equals(e.getMenuCode()))
.collect(Collectors.toList());
}
return RestResponse.success(changeListToTree(MenuLevelConstants.FIRST_LEVEL_PARENT_ID, menuList));
}
return EnterpriseRestResponse.failure(result);
}
......
......@@ -3,6 +3,7 @@ package com.gic.auth.web.controller;
import com.gic.auth.web.vo.SuperUserVO;
import com.gic.auth.web.vo.UserOfGicVO;
import com.gic.enterprise.base.EnterpriseInfo;
import com.gic.enterprise.constants.Constants;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
......@@ -71,23 +72,26 @@ public class UserController {
if (isNeedSendSms) {
//发送短信,通知自动生成密码
if (StringUtils.isBlank(userDTO.getPhoneAreaCode())) {
userDTO.setPhoneAreaCode("86");
userDTO.setPhoneAreaCode(Constants.NATION_CODE);
}
smsArr = new String[] { UserDetailUtils.getUserDetail().getEnterpriseInfo().getEnterpriseName(),
userDTO.getPhoneNumber(), password };
smsArr = new String[] { UserDetailUtils.getUserDetail().getEnterpriseInfo().getEnterpriseName(), password };
}
}
ServiceResponse userResult;
//普通用户
userDTO.setSuperAdmin(0);
//sms场景ID
String smsSenceId = "GICSHHT003";
if (userDTO.getUserId() == null) {
userResult = userApiService.saveUser(userDTO);
} else {
smsSenceId = "GICSHHT004";
userResult = userApiService.editUser(userDTO);
}
if (userResult.isSuccess()) {
if (isNeedSendSms) {
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms("GICpassword001",
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms(smsSenceId,
UserDetailUtils.getUserDetail().getEnterpriseInfo().getEnterpriseId(),
userDTO.getPhoneAreaCode(), userDTO.getPhoneNumber(), smsArr);
if (!smsSendResult.isSuccess()) {
......@@ -153,7 +157,7 @@ public class UserController {
@RequestMapping("send-auth-code-to-modify-phone")
public RestResponse sendAuthCode(String phone, String nationCode) {
if (StringUtils.isBlank(nationCode)) {
nationCode = "86";
nationCode = Constants.NATION_CODE;
}
AuthCodeDTO authCodeDTO = new AuthCodeDTO();
authCodeDTO.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
......@@ -168,9 +172,8 @@ public class UserController {
if (result.isSuccess()) {
Integer authCodeId = result.getResult();
//发送手机验证码
String[] smsArr = new String[] { authCode,
UserDetailUtils.getUserDetail().getEnterpriseInfo().getEnterpriseName() };
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms("GICphone",
String[] smsArr = new String[] { authCode };
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms("GICSHHT005",
UserDetailUtils.getUserDetail().getEnterpriseInfo().getEnterpriseId(), nationCode, phone, smsArr);
if (!smsSendResult.isSuccess()) {
return EnterpriseRestResponse.failure(smsSendResult);
......@@ -213,9 +216,9 @@ public class UserController {
if (result.isSuccess()) {
Integer authCodeId = result.getResult();
//发送手机验证码
String[] smsArr = new String[] { authCode,
UserDetailUtils.getUserDetail().getEnterpriseInfo().getEnterpriseName() };
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms("GICpassword",
String[] smsArr = new String[] {
UserDetailUtils.getUserDetail().getEnterpriseInfo().getEnterpriseName(), authCode };
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms("GICSHHT004",
UserDetailUtils.getUserDetail().getEnterpriseInfo().getEnterpriseId(),
UserDetailUtils.getUserDetail().getUserInfo().getPhoneAreaCode(),
UserDetailUtils.getUserDetail().getUserInfo().getPhoneNumber(), smsArr);
......
package com.gic.auth.web.utils;
/**
* 商户基础服务应用code
* @ClassName: EnterpriseBasicAppUtils

* @Description: 

* @author guojuxing

* @date 2020/5/9 9:36 AM

*/
public class EnterpriseBasicAppUtils {
/**
* 商户基础服务code,用于过滤应用列表
*/
public static final String ENTERPRISE_BASIC_APP_CODE = "enterpriseBasicApp";
}
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