多语言-公会-公会权限
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
package com.accompany.business.vo;
|
||||
|
||||
import com.accompany.common.annotation.ReplaceAppDomain;
|
||||
import com.accompany.core.annotation.I18n;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HallMemberAuthVo {
|
||||
private String code;
|
||||
|
||||
@I18n(className = "HallMemberAuth")
|
||||
private String name;
|
||||
|
||||
@ReplaceAppDomain
|
||||
@@ -20,55 +24,4 @@ public class HallMemberAuthVo {
|
||||
|
||||
private Byte sort;
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getMinImage() {
|
||||
return minImage;
|
||||
}
|
||||
|
||||
public void setMinImage(String minImage) {
|
||||
this.minImage = minImage;
|
||||
}
|
||||
|
||||
public String getMaxImage() {
|
||||
return maxImage;
|
||||
}
|
||||
|
||||
public void setMaxImage(String maxImage) {
|
||||
this.maxImage = maxImage;
|
||||
}
|
||||
|
||||
public String getDescription() {return description;}
|
||||
|
||||
public void setDescription(String description) {this.description = description;}
|
||||
|
||||
public Byte getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(Byte sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
}
|
||||
|
@@ -1,23 +0,0 @@
|
||||
package com.accompany.business.vo.clan;
|
||||
|
||||
import com.accompany.business.vo.hall.HallVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class ClanHallMemberGoldFlowTotalVO {
|
||||
|
||||
private Double total = 0d;
|
||||
|
||||
private Map<Long, HallMemberGoldFlowTotalVO> hallMemberMap;
|
||||
|
||||
private List<HallVo> hallVoList;
|
||||
|
||||
private Double totalRemainGolds = 0d;
|
||||
private Double totalEarnGolds = 0d;
|
||||
private Double totalGiftGolds = 0d;
|
||||
private Double totalExchangeGolds = 0d;
|
||||
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
package com.accompany.business.vo.clan;
|
||||
|
||||
import com.accompany.business.vo.hall.HallVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ClanHallMemberGoldSettlementTotalVO {
|
||||
|
||||
private Double total = 0d;
|
||||
|
||||
private List<ClanHallMemberGoldSettlementVO> memberSettlement;
|
||||
|
||||
private List<HallVo> hallVoList;
|
||||
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
package com.accompany.business.vo.clan;
|
||||
|
||||
import com.accompany.common.annotation.ReplaceAppDomain;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ClanHallMemberGoldSettlementVO {
|
||||
|
||||
private Long uid;
|
||||
private String nick;
|
||||
@ReplaceAppDomain
|
||||
private String avatar;
|
||||
private Double exchangeGolds;
|
||||
private Double settlementGolds;
|
||||
|
||||
private Long hallId;
|
||||
private Long hallOwnerUid;
|
||||
private String hallAvatar;
|
||||
private String hallName;
|
||||
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 文 件 名: ClanMemberListVO
|
||||
* 版 权:
|
||||
* 描 述: <描述>
|
||||
* 创建人: H1
|
||||
* 创建时间: 2020/11/19
|
||||
* 修改人:
|
||||
* 修改内容:
|
||||
* 修改时间:
|
||||
*/
|
||||
package com.accompany.business.vo.clan;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <br>类描述:
|
||||
* <br>功能详细描述:
|
||||
*
|
||||
* @author H1
|
||||
* @date [2020/11/19]
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class ClanMemberListVO {
|
||||
@ApiModelProperty(value = "成员列表")
|
||||
private List<ClanMemberVO> members;
|
||||
@ApiModelProperty(value = "成员总数")
|
||||
private Integer count;
|
||||
}
|
@@ -1,14 +0,0 @@
|
||||
package com.accompany.business.vo.clan;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HallMemberGoldFlowTotalVO {
|
||||
|
||||
private Double total = 0d;
|
||||
|
||||
private List<HallMemberGoldFlowVO> hallMember;
|
||||
|
||||
}
|
@@ -14,6 +14,7 @@ import com.accompany.business.vo.message.HallMessage;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.redis.RedisKey;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.core.exception.ServiceException;
|
||||
import com.accompany.core.service.base.BaseService;
|
||||
import com.accompany.core.util.StringUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -59,9 +60,6 @@ public class HallAuthService extends BaseService {
|
||||
@Autowired
|
||||
private HallRoleAuthBizService hallRoleAuthBizService;
|
||||
|
||||
@Autowired
|
||||
private HallMemberService hallMemberService;
|
||||
|
||||
/**
|
||||
* 查询模厅首页
|
||||
*
|
||||
@@ -70,36 +68,33 @@ public class HallAuthService extends BaseService {
|
||||
*/
|
||||
public List<HallMemberAuthVo> getHallMenusByUid(Long uid) {
|
||||
Set<String> menus = this.jedisService.zrangeMembers(RedisKey.hall_member_menus.getKey(uid.toString()), 0, -1);
|
||||
if (CollectionUtils.isEmpty(menus)) {
|
||||
List<Byte> list = new ArrayList(2);
|
||||
list.add(Constant.HallAuthType.MENU);
|
||||
list.add(Constant.HallAuthType.RESOURCE_MENU);
|
||||
|
||||
HallMemberAuthExample example = new HallMemberAuthExample();
|
||||
example.createCriteria().andUidEqualTo(uid).andAuthTypeIn(list).andStatusEqualTo(Constant.HallAuthStatus.AUTH_EXISTS);
|
||||
example.setOrderByClause("sort asc");
|
||||
List<HallMemberAuth> memberAuths = this.hallMemberAuthMapper.selectByExample(example);
|
||||
List<HallMemberAuthVo> authVoList = Lists.newArrayList();
|
||||
if (CollectionUtils.isEmpty(memberAuths)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Map<String, Double> sortSetMap = new HashMap<String, Double>();
|
||||
memberAuths.stream().forEach(memberAuth -> {
|
||||
HallMemberAuthVo authVo = converToHallMemberAuthVo(memberAuth);
|
||||
authVoList.add(authVo);
|
||||
sortSetMap.put(JSON.toJSONString(authVo), Double.parseDouble(authVo.getSort() == null ? "0" : authVo.getSort().toString()));
|
||||
});
|
||||
|
||||
this.jedisService.zadd(RedisKey.hall_member_menus.getKey(uid.toString()), sortSetMap, true);
|
||||
this.jedisService.expire(RedisKey.hall_member_menus.getKey(uid.toString()), Constant.HallKeySaveDate.hall_member_menus);
|
||||
return authVoList;
|
||||
} else {
|
||||
List<HallMemberAuthVo> authVoList = Lists.newArrayList();
|
||||
menus.stream().forEach(menu -> authVoList.add(JSON.parseObject(menu, HallMemberAuthVo.class)));
|
||||
return authVoList;
|
||||
if (!CollectionUtils.isEmpty(menus)) {
|
||||
return menus.stream().map(menu->JSON.parseObject(menu, HallMemberAuthVo.class)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
List<Byte> list = new ArrayList(2);
|
||||
list.add(Constant.HallAuthType.MENU);
|
||||
list.add(Constant.HallAuthType.RESOURCE_MENU);
|
||||
|
||||
HallMemberAuthExample example = new HallMemberAuthExample();
|
||||
example.createCriteria().andUidEqualTo(uid).andAuthTypeIn(list).andStatusEqualTo(Constant.HallAuthStatus.AUTH_EXISTS);
|
||||
example.setOrderByClause("sort asc");
|
||||
List<HallMemberAuth> memberAuths = this.hallMemberAuthMapper.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(memberAuths)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<HallMemberAuthVo> authVoList = Lists.newArrayList();
|
||||
Map<String, Double> sortSetMap = new HashMap<String, Double>();
|
||||
memberAuths.stream().forEach(memberAuth -> {
|
||||
HallMemberAuthVo authVo = converToHallMemberAuthVo(memberAuth);
|
||||
authVoList.add(authVo);
|
||||
sortSetMap.put(JSON.toJSONString(authVo), Double.parseDouble(authVo.getSort() == null ? "0" : authVo.getSort().toString()));
|
||||
});
|
||||
|
||||
this.jedisService.zadd(RedisKey.hall_member_menus.getKey(uid.toString()), sortSetMap, true);
|
||||
this.jedisService.expire(RedisKey.hall_member_menus.getKey(uid.toString()), Constant.HallKeySaveDate.hall_member_menus);
|
||||
return authVoList;
|
||||
}
|
||||
|
||||
|
||||
@@ -203,22 +198,22 @@ public class HallAuthService extends BaseService {
|
||||
* @return authSets不包含"高管成员通用"的权限,所以在添加权限时,要把"高管成员通用"权限也设置进去
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int setHallManagerAuths(Long uid, Long managerUid, Long hallId, List<String> authSets) throws Exception {
|
||||
public void setHallManagerAuths(Long uid, Long managerUid, Long hallId, List<String> authSets) {
|
||||
if (CollectionUtils.isEmpty(authSets)) {
|
||||
setMemberAuthIsNull(hallId, authSets, managerUid);
|
||||
return BusiStatus.SUCCESS.value();
|
||||
return ;
|
||||
}
|
||||
byte[] roles = {Constant.HallAuthRoleType.OWNER_MANAGER, Constant.HallAuthRoleType.MANAGER, Constant.HallAuthRoleType.CLAN_ELDER_OWNER_MANAGER};
|
||||
List<HallAuth> auths = getHallAuths(roles, null);
|
||||
if (CollectionUtils.isEmpty(auths)) {
|
||||
return BusiStatus.HALL_MANAGER_NOT_FOUND_MENU_AUTH.value();
|
||||
throw new ServiceException(BusiStatus.HALL_MANAGER_NOT_FOUND_MENU_AUTH);
|
||||
}
|
||||
HallMember hallmember = hallService.getHallMember(managerUid);
|
||||
if (hallmember == null || !hallmember.getRoleType().equals(Constant.HallRoleType.MANAGER)) {
|
||||
return BusiStatus.HALL_MANAGER_NOT_FOUND.value();
|
||||
throw new ServiceException(BusiStatus.HALL_MANAGER_NOT_FOUND);
|
||||
}
|
||||
if (!hallmember.getHallId().equals(hallId)) {
|
||||
return BusiStatus.HALL_MANAGER_NOT_BELONG.value();
|
||||
throw new ServiceException(BusiStatus.HALL_MANAGER_NOT_BELONG);
|
||||
}
|
||||
Map<String, String> memberAuthMap = authSets.stream().collect(Collectors.toMap(String::toString, a -> a, (k1, k2) -> k1));
|
||||
Map<String, Double> sortSetMap = new HashMap<>();
|
||||
@@ -295,7 +290,6 @@ public class HallAuthService extends BaseService {
|
||||
this.jedisService.zadd(RedisKey.hall_member_menus.getKey(managerUid.toString()), sortSetMap, true);
|
||||
this.jedisService.expire(RedisKey.hall_member_menus.getKey(uid.toString()), Constant.HallKeySaveDate.hall_member_menus);
|
||||
}
|
||||
return BusiStatus.SUCCESS.value();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -420,7 +414,7 @@ public class HallAuthService extends BaseService {
|
||||
* @throws Exception
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addAuth(HallAuth auth, Boolean ownerNeedSet) throws Exception {
|
||||
public void addAuth(HallAuth auth, Boolean ownerNeedSet) {
|
||||
auth.setCreateTime(new Date());
|
||||
hallAuthMapper.insert(auth);
|
||||
List<HallMemberAuth> list = null;
|
||||
|
@@ -4,6 +4,7 @@ package com.accompany.business.controller.hall;
|
||||
* Created by wangChuangBiao on 2018/12/29.
|
||||
*/
|
||||
|
||||
import com.accompany.business.common.BaseController;
|
||||
import com.accompany.business.model.HallAuth;
|
||||
import com.accompany.business.model.HallMember;
|
||||
import com.accompany.business.service.hall.HallAuthService;
|
||||
@@ -15,6 +16,7 @@ import com.accompany.common.annotation.MemberAuth;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.core.exception.ServiceException;
|
||||
import com.accompany.core.util.StringUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.slf4j.Logger;
|
||||
@@ -30,7 +32,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
@RequestMapping("/hallAuth")
|
||||
@RestController
|
||||
public class HallAuthController {
|
||||
public class HallAuthController extends BaseController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(HallAuthController.class);
|
||||
|
||||
@@ -42,28 +44,10 @@ public class HallAuthController {
|
||||
|
||||
@RequestMapping(value = "getHallMenusByUid", method = RequestMethod.POST)
|
||||
@Authorization
|
||||
public BusiResult getHallMenusByUid(Long uid, HttpServletRequest request) {
|
||||
logger.info("getHallMenusByUid, uid={}", uid);
|
||||
BusiResult busiResult = new BusiResult(BusiStatus.SUCCESS);
|
||||
if (uid == null || uid == 0L) {
|
||||
busiResult.setCode(BusiStatus.PARAMETERILLEGAL.value());
|
||||
return busiResult;
|
||||
}
|
||||
try {
|
||||
List<HallMemberAuthVo> vos = hallAuthService.getHallMenusByUid(uid);
|
||||
if (!CollectionUtils.isEmpty(vos)) {
|
||||
if ((StringUtils.isNotEmpty(request.getParameter("os"))
|
||||
&& "ios".equals(request.getParameter("os").toLowerCase())
|
||||
) || vos.size() > 3) {
|
||||
vos = vos.stream().filter(vo -> !vo.getCode().equals(Constant.HallAuthCode.HALL_BUILD)).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
busiResult.setData(vos);
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to getHallMenusByUid. Cause by {}", e.getMessage());
|
||||
return new BusiResult(BusiStatus.SERVERERROR);
|
||||
}
|
||||
return busiResult;
|
||||
public BusiResult getHallMenusByUid(HttpServletRequest request) {
|
||||
Long uid = getUid(request);
|
||||
List<HallMemberAuthVo> vos = hallAuthService.getHallMenusByUid(uid);
|
||||
return BusiResult.success(vos);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,43 +59,29 @@ public class HallAuthController {
|
||||
@Authorization
|
||||
public BusiResult getHallManagerAuths(Long uid, Long managerUid) {
|
||||
logger.info("getHallManagerAuths, uid={},managerUid={}", uid, managerUid);
|
||||
BusiResult busiResult = new BusiResult(BusiStatus.SUCCESS);
|
||||
if (uid == null || uid == 0L && managerUid == null || managerUid == 0L) {
|
||||
busiResult.setCode(BusiStatus.PARAMETERILLEGAL.value());
|
||||
busiResult.setMessage("参数异常");
|
||||
return busiResult;
|
||||
throw new ServiceException(BusiStatus.PARAMETERILLEGAL);
|
||||
}
|
||||
try {
|
||||
List<HallManagerAuthVo> managerAuthVos = hallAuthService.getHallManagerAuths(uid, managerUid);
|
||||
if (managerAuthVos == null) {
|
||||
busiResult.setCode(BusiStatus.HALL_MANAGER_NOT_FOUND_MENU_AUTH.value());
|
||||
busiResult.setMessage("高管权限为空");
|
||||
} else {
|
||||
busiResult.setData(managerAuthVos);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to getHallManagerAuths. Cause by :" + e.getMessage(), e);
|
||||
return new BusiResult(BusiStatus.SERVERERROR);
|
||||
List<HallManagerAuthVo> managerAuthVos = hallAuthService.getHallManagerAuths(uid, managerUid);
|
||||
if (managerAuthVos == null) {
|
||||
throw new ServiceException(BusiStatus.HALL_MANAGER_NOT_FOUND_MENU_AUTH);
|
||||
}
|
||||
return busiResult;
|
||||
return BusiResult.success(managerAuthVos);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("getHallAuths")
|
||||
@Authorization
|
||||
public BusiResult<List<HallManagerAuthVo>> getHallAuths(Long uid, Integer roleType, Long hallId) {
|
||||
logger.info("getHallAuths, uid={},roleType={}", uid, roleType);
|
||||
public BusiResult<List<HallManagerAuthVo>> getHallAuths(HttpServletRequest request) {
|
||||
Long uid = getUid(request);
|
||||
if (uid == null || uid == 0L) {
|
||||
return BusiResult.fail(BusiStatus.PARAMETERILLEGAL);
|
||||
throw new ServiceException(BusiStatus.PARAMETERILLEGAL);
|
||||
}
|
||||
HallMember hallMember = hallService.getHallMember(uid);
|
||||
if (null != hallMember) {
|
||||
roleType = hallMember.getRoleType().intValue();
|
||||
if (null == hallId) {
|
||||
hallId = hallMember.getHallId();
|
||||
}
|
||||
if (null == hallMember){
|
||||
return BusiResult.success();
|
||||
}
|
||||
List<HallManagerAuthVo> managerAuths = hallAuthService.getHallAuths(uid, roleType, hallId);
|
||||
List<HallManagerAuthVo> managerAuths = hallAuthService.getHallAuths(uid, hallMember.getRoleType().intValue(), hallMember.getHallId());
|
||||
if (managerAuths == null) {
|
||||
return BusiResult.fail(BusiStatus.HALL_MANAGER_NOT_FOUND_MENU_AUTH);
|
||||
}
|
||||
@@ -127,21 +97,12 @@ public class HallAuthController {
|
||||
@Authorization
|
||||
@MemberAuth(authCode = Constant.HallAuthCode.HALL_MANAGER_SET)
|
||||
public BusiResult<Void> setHallManagerAuths(Long uid, Long managerUid, Long hallId, String authStr) {
|
||||
logger.info("setHallManagerAuths, uid={},managerUid={},authStr={}", uid, managerUid, authStr);
|
||||
BusiResult<Void> busiResult = new BusiResult<>(BusiStatus.SUCCESS);
|
||||
if (uid == null || uid == 0L && managerUid == null || managerUid == 0L) {
|
||||
busiResult.setCode(BusiStatus.PARAMETERILLEGAL.value());
|
||||
busiResult.setMessage("参数异常");
|
||||
return busiResult;
|
||||
throw new ServiceException(BusiStatus.PARAMETERILLEGAL);
|
||||
}
|
||||
try {
|
||||
List<String> authSets = Arrays.stream(authStr.split(",")).filter(string -> !string.isEmpty()).collect(Collectors.toList());
|
||||
busiResult.setCode(hallAuthService.setHallManagerAuths(uid, managerUid, hallId, authSets));
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to setHallManagerAuths. Cause by :" + e.getMessage(), e);
|
||||
return new BusiResult<>(BusiStatus.SERVERERROR);
|
||||
}
|
||||
return busiResult;
|
||||
List<String> authSets = Arrays.stream(authStr.split(",")).filter(string -> !string.isEmpty()).collect(Collectors.toList());
|
||||
hallAuthService.setHallManagerAuths(uid, managerUid, hallId, authSets);
|
||||
return BusiResult.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -154,34 +115,18 @@ public class HallAuthController {
|
||||
*/
|
||||
@RequestMapping(value = "addAuth", method = RequestMethod.POST)
|
||||
@Authorization
|
||||
public BusiResult addAuth(@RequestBody HallAuth auth, @RequestParam(defaultValue = "true") Boolean needOwnerSet) {
|
||||
logger.info("addAuth, addAuth={}", JSON.toJSONString(auth));
|
||||
BusiResult busiResult = new BusiResult(BusiStatus.SUCCESS);
|
||||
public BusiResult<Void> addAuth(@RequestBody HallAuth auth, @RequestParam(defaultValue = "true") Boolean needOwnerSet) {
|
||||
if (auth == null || StringUtils.isEmpty(auth.getCode()) || StringUtils.isEmpty(auth.getName()) || auth.getRoleType() == null) {
|
||||
busiResult.setCode(BusiStatus.PARAMETERILLEGAL.value());
|
||||
busiResult.setMessage("参数异常");
|
||||
return busiResult;
|
||||
throw new ServiceException(BusiStatus.PARAMETERILLEGAL);
|
||||
}
|
||||
try {
|
||||
hallAuthService.addAuth(auth, needOwnerSet);
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to setHallManagerAuths. Cause by :" + e.getMessage(), e);
|
||||
return new BusiResult(BusiStatus.SERVERERROR);
|
||||
}
|
||||
return busiResult;
|
||||
hallAuthService.addAuth(auth, needOwnerSet);
|
||||
return BusiResult.success();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateData", method = RequestMethod.POST)
|
||||
@Authorization
|
||||
public BusiResult updateAuth() {
|
||||
BusiResult busiResult = new BusiResult(BusiStatus.SUCCESS);
|
||||
|
||||
try {
|
||||
hallAuthService.updateData();
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to updateAuth. Cause by {}", e.getMessage());
|
||||
return new BusiResult(BusiStatus.SERVERERROR);
|
||||
}
|
||||
return busiResult;
|
||||
public BusiResult<Void> updateAuth() {
|
||||
hallAuthService.updateData();
|
||||
return BusiResult.success();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user