|
@@ -1,13 +1,19 @@
|
|
|
package com.zanxiang.game.data.serve.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
|
+import com.zangxiang.game.base.pojo.dto.SendMsgDto;
|
|
|
import com.zanxiang.erp.base.ErpServer;
|
|
|
import com.zanxiang.erp.base.rpc.ISysUserRpc;
|
|
|
+import com.zanxiang.erp.security.util.SecurityUtil;
|
|
|
import com.zanxiang.game.data.serve.pojo.dto.RoleCombatRankingDTO;
|
|
|
import com.zanxiang.game.data.serve.pojo.dto.RoleRechargeRankingDTO;
|
|
|
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.module.util.exception.BaseException;
|
|
|
+import com.zanxiang.module.util.pojo.ResultVO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -20,6 +26,7 @@ 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 java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
@@ -42,6 +49,11 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
@DubboReference(providedBy = ErpServer.SERVER_DUBBO_NAME)
|
|
|
private ISysUserRpc sysUserRpc;
|
|
|
|
|
|
+ @DubboReference
|
|
|
+ private SendMsgRpc sendMsgRpc;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 角色充值排行榜
|
|
|
* @param dto RoleRechargeRankingDTO
|
|
@@ -323,8 +335,209 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
*/
|
|
|
@Override
|
|
|
public void createSendMsgTask(SendMsgTaskDto dto) {
|
|
|
+ //获取当前用户id
|
|
|
+ Long sysUserId = SecurityUtil.getUserId();
|
|
|
+
|
|
|
+ //先查出来所有的角色
|
|
|
+ List<Map> roleList = getRoleList(dto.getRoleRechargeRankingDTO());
|
|
|
+ //筛选出角色id
|
|
|
+ List<String> roleIdList = roleList.stream().map(map -> map.get("role_id").toString()).collect(Collectors.toList());
|
|
|
+ SendMsgDto sendMsgDto = new SendMsgDto();
|
|
|
+ sendMsgDto.setMsg(dto.getSendContent());
|
|
|
+ sendMsgDto.setRoles(roleIdList);
|
|
|
+ sendMsgDto.setCreateBy(sysUserId);
|
|
|
+ if(CollectionUtils.isNotEmpty(roleList)){
|
|
|
+ String gameName = (String) roleList.get(0).get("role_reg_parent_game_name");
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取角色列表
|
|
|
+ * @param dto
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<Map> getRoleList(RoleRechargeRankingDTO dto) {
|
|
|
+
|
|
|
+ //默认查询不合服的数据
|
|
|
+ if (dto.getIsMergeServer() == null) {
|
|
|
+ dto.setIsMergeServer(Boolean.FALSE);
|
|
|
+ }
|
|
|
+ //创建查询条件 给主表使用
|
|
|
+ Criteria criA = Cnd.cri();
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getGameId())) {
|
|
|
+ //角色注册子游戏
|
|
|
+ criA.where().andInList("role_reg_game_id", dto.getGameId());
|
|
|
+ }
|
|
|
|
|
|
+ //拼接24内充值金额条件
|
|
|
+ if(dto.getRechargeAmountWithin24h()!=null){
|
|
|
+ criA = spliceRechargeAmountWithin24h(dto, criA);
|
|
|
+ }
|
|
|
+ if(dto.getRechargeTotalAmountWithin24h()!=null){
|
|
|
+ criA = spliceRechargeTotalAmountWithin24h(dto, criA);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getParentGameIds())) {
|
|
|
+ //角色注册父游戏
|
|
|
+ criA.where().andInList("role_reg_parent_game_id", dto.getParentGameIds());
|
|
|
+ }
|
|
|
+ if (dto.getSuperGameId() != null) {
|
|
|
+ //角色注册超父游戏
|
|
|
+ criA.where().andEquals("role_reg_super_game_id", dto.getSuperGameId());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(dto.getSourceSystem())) {
|
|
|
+ criA.where().andEquals("source_system", dto.getSourceSystem());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(dto.getRoleId())) {
|
|
|
+ criA.where().andEquals("role_id", dto.getRoleId());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(dto.getRoleName())) {
|
|
|
+ criA.where().andLike("role_name", dto.getRoleName());
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getServerIds()) && !dto.getIsMergeServer()) {
|
|
|
+ //区服列表查询,不合服的区服
|
|
|
+ criA.where().andIn("server_id", dto.getServerIds().toArray(String[]::new));
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getServerIds()) && dto.getIsMergeServer()) {
|
|
|
+ //合服区服列表查询
|
|
|
+ criA.where().andIn("merge_server_id", dto.getServerIds().toArray(String[]::new));
|
|
|
+ }
|
|
|
+ if (dto.getCreateRoleBeginDate() != null && dto.getCreateRoleEndDate() != null) {
|
|
|
+ //角色创建时间
|
|
|
+ criA.where().andBetween("DATE(role_create_time)", dto.getCreateRoleBeginDate(), dto.getCreateRoleEndDate());
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getVipLevel())) {
|
|
|
+ //角色vip等级
|
|
|
+ criA.where().andInList("vip_level", dto.getVipLevel());
|
|
|
+ }
|
|
|
+ if (dto.getIsSendMail() != null) {
|
|
|
+ criA.where().andEquals("is_send_mail", dto.getIsSendMail());
|
|
|
+ }
|
|
|
+ if (dto.getIsChange() != null) {
|
|
|
+ if (dto.getIsChange() == 2) {
|
|
|
+ //是否转端
|
|
|
+ criA.where().andIsNull("is_change_game_type");
|
|
|
+ } else {
|
|
|
+ //是否转端
|
|
|
+ criA.where().andEquals("is_change_game_type", dto.getIsChange());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(dto.getWeChatCompany())) {
|
|
|
+ //企业微信号
|
|
|
+ criA.where().andLike("add_corp_user_id", dto.getWeChatCompany());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(dto.getWeChat())) {
|
|
|
+ //客户微信
|
|
|
+ criA.where().andLike("user_wechat", dto.getWeChat());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(dto.getPhone())) {
|
|
|
+ //客户手机号
|
|
|
+ criA.where().andEquals("user_phone", dto.getPhone());
|
|
|
+ }
|
|
|
+ if (dto.getGsId() != null) {
|
|
|
+ //GS
|
|
|
+ if (dto.getGsId() == 0L) {
|
|
|
+ criA.where().andIsNull("gs_id");
|
|
|
+ } else {
|
|
|
+ criA.where().andEquals("gs_id", dto.getGsId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (dto.getPitcherId() != null) {
|
|
|
+ //投手
|
|
|
+ criA.where().andEquals("put_user_id", dto.getPitcherId());
|
|
|
+ }
|
|
|
+ if (dto.getOperatorId() != null) {
|
|
|
+ //运营
|
|
|
+ if (dto.getOperatorId() == 0L) {
|
|
|
+ criA.where().andIsNull("oper_user_id");
|
|
|
+ } else {
|
|
|
+ criA.where().andEquals("oper_user_id", dto.getOperatorId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (dto.getCustomerServerId() != null) {
|
|
|
+ //客服
|
|
|
+ if (dto.getCustomerServerId() == 0L) {
|
|
|
+ criA.where().andIsNull("customer_service_id");
|
|
|
+ } else {
|
|
|
+ criA.where().andEquals("customer_service_id", dto.getCustomerServerId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (dto.getTotalRechargeMin() != null) {
|
|
|
+ //累计充值金额最小值
|
|
|
+ criA.where().andGTE("amount", dto.getTotalRechargeMin());
|
|
|
+ }
|
|
|
+ if (dto.getTotalRechargeMax() != null) {
|
|
|
+ //累计充值金额最大值
|
|
|
+ criA.where().andLTE("amount", dto.getTotalRechargeMax());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(dto.getOs())) {
|
|
|
+ //玩家操作系统
|
|
|
+ criA.where().andEquals("os", dto.getOs());
|
|
|
+ }
|
|
|
+ if (dto.getIsRemoveGame() != null) {
|
|
|
+ if (dto.getIsRemoveGame() == 2) {
|
|
|
+ //是否退游
|
|
|
+ criA.where().andIsNull("is_remove_game");
|
|
|
+ } else {
|
|
|
+ //是否退游
|
|
|
+ criA.where().andEquals("is_remove_game", dto.getIsRemoveGame());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (dto.getIsRemoveGameForSystem() != null) {
|
|
|
+ //是否退游(系统判定)
|
|
|
+ criA.where().andEquals("is_remove_game_for_system", dto.getIsRemoveGameForSystem());
|
|
|
+ }
|
|
|
+ if (dto.getIsWakeUp() != null) {
|
|
|
+ if (dto.getIsWakeUp() == 2) {
|
|
|
+ //是否唤醒
|
|
|
+ criA.where().andIsNull("is_wake_up");
|
|
|
+ } else {
|
|
|
+ //是否唤醒
|
|
|
+ criA.where().andEquals("is_wake_up", dto.getIsWakeUp());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (dto.getIsAddCorpWechat() != null) {
|
|
|
+ if (dto.getIsAddCorpWechat() == 2) {
|
|
|
+ //是否添加企微
|
|
|
+ criA.where().andIsNull("is_add_corp_wechat");
|
|
|
+ } else {
|
|
|
+ //是否添加企微
|
|
|
+ criA.where().andEquals("is_add_corp_wechat", dto.getIsAddCorpWechat());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //给充值时间查询条件
|
|
|
+ Criteria criTodayAmount = Cnd.cri();
|
|
|
+ //查询充值成功的
|
|
|
+ criTodayAmount.where().andEquals("status", 2);
|
|
|
+ if (dto.getRechargeBeginDate() != null && dto.getRechargeEndDate() != null) {
|
|
|
+ //充值时间限制
|
|
|
+ criTodayAmount.where().andBetween("DATE(pay_time)", dto.getRechargeBeginDate(), dto.getRechargeEndDate());
|
|
|
+ }
|
|
|
|
|
|
+ //主表添加排序条件
|
|
|
+ if (StringUtils.isBlank(dto.getSortType())) {
|
|
|
+ dto.setSortType(OrderByEnum.DESC.getOrderType());
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(dto.getSortFiled())) {
|
|
|
+ criA.getOrderBy().orderBy("amount", dto.getSortType());
|
|
|
+ } else {
|
|
|
+ criA.getOrderBy().orderBy(dto.getSortFiled(), dto.getSortType());
|
|
|
+ }
|
|
|
+ //创建sql
|
|
|
+ Sql sql = Sqls.create(getRoleRechargeRankingSql(criA, criTodayAmount));
|
|
|
+ sql.setCallback(Sqls.callback.maps());
|
|
|
+ dao.execute(sql);
|
|
|
+ return sql.getList(Map.class);
|
|
|
}
|
|
|
|
|
|
/**
|