|
@@ -335,30 +335,45 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
//获取当前用户id
|
|
|
Long sysUserId = SecurityUtil.getUserId();
|
|
|
|
|
|
+ //构建发送消息dto
|
|
|
+ SendMsgDto sendMsgDto = buildSendMsgDto(dto, sysUserId);
|
|
|
+
|
|
|
+ //调用发送消息接口
|
|
|
+ ResultVO<Boolean> booleanResultVO = sendMsgRpc.sendMsg(sendMsgDto);
|
|
|
+ if (!booleanResultVO.isSuccess()) {
|
|
|
+ throw new BaseException(booleanResultVO.getMsg());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private SendMsgDto buildSendMsgDto(SendMsgTaskDto dto, Long sysUserId) {
|
|
|
//先查出来所有的角色
|
|
|
List<Map> roleList = getRoleList(dto.getRoleRechargeRankingDTO());
|
|
|
+
|
|
|
//筛选出角色id
|
|
|
List<String> roleIdList = roleList.stream()
|
|
|
.map(map -> Optional.ofNullable(map.get("role_id")).map(Object::toString).orElse(null))
|
|
|
- .collect(Collectors.toList());
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
SendMsgDto sendMsgDto = new SendMsgDto();
|
|
|
sendMsgDto.setMsg(dto.getSendContent());
|
|
|
- sendMsgDto.setRoles(roleIdList);
|
|
|
+
|
|
|
+ //暂时用前端传的角色id后期在用自己查的
|
|
|
+ sendMsgDto.setRoles(dto.getRoleIds());
|
|
|
sendMsgDto.setCreateBy(sysUserId);
|
|
|
- if(CollectionUtils.isNotEmpty(roleList)){
|
|
|
- String gameName = (String) roleList.get(0).get("role_reg_parent_game_name");
|
|
|
+
|
|
|
+ if (!roleList.isEmpty()) {
|
|
|
+ String gameName = roleList.get(0).get("role_reg_parent_game_name").toString();
|
|
|
sendMsgDto.setGameName(gameName);
|
|
|
}
|
|
|
+ //条件
|
|
|
RoleRechargeRankingDTO roleRechargeRankingDTO = dto.getRoleRechargeRankingDTO();
|
|
|
sendMsgDto.setSendConditionJson(JSON.toJSONString(roleRechargeRankingDTO));
|
|
|
|
|
|
- //调用发送消息接口
|
|
|
- ResultVO<Boolean> booleanResultVO = sendMsgRpc.sendMsg(sendMsgDto);
|
|
|
- if (!booleanResultVO.isSuccess()) {
|
|
|
- throw new BaseException(booleanResultVO.getMsg());
|
|
|
- }
|
|
|
+ return sendMsgDto;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 获取角色列表
|
|
|
* @param dto
|