|
@@ -1,7 +1,6 @@
|
|
|
package com.zanxiang.game.data.serve.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
-import com.zangxiang.game.base.pojo.dto.SendMsgDto;
|
|
|
import com.zangxiang.game.base.pojo.vo.SendMsgVo;
|
|
|
import com.zanxiang.erp.base.ErpServer;
|
|
|
import com.zanxiang.erp.base.rpc.ISysUserRpc;
|
|
@@ -13,7 +12,8 @@ import com.zanxiang.game.data.serve.pojo.dto.SendMsgTaskDto;
|
|
|
import com.zanxiang.game.data.serve.pojo.enums.OrderByEnum;
|
|
|
import com.zanxiang.game.data.serve.service.IRoleManageService;
|
|
|
import com.zanxiang.game.data.serve.utils.Page;
|
|
|
-import com.zanxiang.module.util.JsonUtil;
|
|
|
+import com.zanxiang.game.module.base.pojo.dto.SendMsgDto;
|
|
|
+import com.zanxiang.game.module.base.rpc.SendMsgRpc;
|
|
|
import com.zanxiang.module.util.exception.BaseException;
|
|
|
import com.zanxiang.module.util.pojo.ResultVO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -28,8 +28,8 @@ import org.nutz.dao.sql.Criteria;
|
|
|
import org.nutz.dao.sql.Sql;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.zangxiang.game.base.rpc.SendMsgRpc;
|
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -336,6 +336,9 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
*/
|
|
|
@Override
|
|
|
public void createSendMsgTask(SendMsgTaskDto dto) {
|
|
|
+ //校验参数
|
|
|
+ validation(dto);
|
|
|
+
|
|
|
//获取当前用户id
|
|
|
Long sysUserId = SecurityUtil.getUserId();
|
|
|
|
|
@@ -349,6 +352,26 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 校验参数
|
|
|
+ * @param dto
|
|
|
+ */
|
|
|
+ private void validation(SendMsgTaskDto dto) {
|
|
|
+ if (StringUtils.isBlank(dto.getTaskName())) {
|
|
|
+ throw new BaseException("任务名称不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(dto.getSendContent())) {
|
|
|
+ throw new BaseException("发送内容不能为空");
|
|
|
+ }
|
|
|
+ if(dto.getGameId()==null){
|
|
|
+ throw new BaseException("游戏id不能为空");
|
|
|
+ }
|
|
|
+ if(CollectionUtils.isEmpty(dto.getRoleIds())){
|
|
|
+ throw new BaseException("角色id不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private SendMsgDto buildSendMsgDto(SendMsgTaskDto dto, Long sysUserId) {
|
|
|
//先查出来所有的角色
|
|
|
List<Map> roleList = getRoleList(dto.getRoleRechargeRankingDTO());
|
|
@@ -359,17 +382,16 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
SendMsgDto sendMsgDto = new SendMsgDto();
|
|
|
+ //任务名称
|
|
|
sendMsgDto.setTaskName(dto.getTaskName());
|
|
|
+ //消息
|
|
|
sendMsgDto.setMsg(dto.getSendContent());
|
|
|
-
|
|
|
+ //游戏id
|
|
|
+ sendMsgDto.setGameId(dto.getGameId());
|
|
|
//暂时用前端传的角色id后期在用自己查的
|
|
|
sendMsgDto.setRoles(dto.getRoleIds());
|
|
|
+ //创建人
|
|
|
sendMsgDto.setCreateBy(sysUserId);
|
|
|
-
|
|
|
- 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));
|