|
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -236,8 +237,31 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
sql.setCallback(Sqls.callback.maps());
|
|
sql.setCallback(Sqls.callback.maps());
|
|
sql.setPager(pager);
|
|
sql.setPager(pager);
|
|
dao.execute(sql);
|
|
dao.execute(sql);
|
|
- List<Map> list = sql.getList(Map.class).stream().map(map -> {
|
|
|
|
- getNameById(map);
|
|
|
|
|
|
+ //查询结果
|
|
|
|
+ List<Map> list = sql.getList(Map.class);
|
|
|
|
+ //用户id列表
|
|
|
|
+ List<Long> userIds = new ArrayList<>();
|
|
|
|
+ for (Map map : list) {
|
|
|
|
+// getNameById(map);
|
|
|
|
+ //把投手id和运营id和GSID和客服人员ID 转成List
|
|
|
|
+ if(map.get("put_user_id") != null){
|
|
|
|
+ userIds.add(Long.valueOf(map.get("put_user_id").toString()));
|
|
|
|
+ }
|
|
|
|
+ if(map.get("oper_user_id") != null){
|
|
|
|
+ userIds.add(Long.valueOf(map.get("oper_user_id").toString()));
|
|
|
|
+ }
|
|
|
|
+ if(map.get("gs_id") != null){
|
|
|
|
+ userIds.add(Long.valueOf(map.get("gs_id").toString()));
|
|
|
|
+ }
|
|
|
|
+ if(map.get("customer_service_id") != null){
|
|
|
|
+ userIds.add(Long.valueOf(map.get("customer_service_id").toString()));
|
|
|
|
+ }
|
|
|
|
+ String str = (String) map.get("role_amount");
|
|
|
|
+ if(str!=null&&str.contains("[") && str.contains("]")){
|
|
|
|
+ //去掉字符串中的‘[]’
|
|
|
|
+ map.put("role_amount", str.replaceAll("\\[|\\]", ""));
|
|
|
|
+ }
|
|
|
|
+
|
|
//去除‘null’字符串
|
|
//去除‘null’字符串
|
|
if ("null".equals(map.get("add_corp_user_id"))) {
|
|
if ("null".equals(map.get("add_corp_user_id"))) {
|
|
map.put("add_corp_user_id", null);
|
|
map.put("add_corp_user_id", null);
|
|
@@ -254,13 +278,44 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
if ("null".equals(map.get("country"))) {
|
|
if ("null".equals(map.get("country"))) {
|
|
map.put("country", null);
|
|
map.put("country", null);
|
|
}
|
|
}
|
|
- return map;
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+ //去重userIds
|
|
|
|
+ userIds = userIds.stream().distinct().collect(Collectors.toList());
|
|
|
|
+ //发送RPC接口查询所有用户
|
|
|
|
+ ResultVO<Map<Long, String>> userMap = sysUserRpc.getUserNameByIds(userIds);
|
|
|
|
+
|
|
|
|
+ for (Map map : list) {
|
|
|
|
+ //投手名
|
|
|
|
+ updateUserName(map, "put_user_id", "put_user_name", userMap);
|
|
|
|
+ //运营人员名
|
|
|
|
+ updateUserName(map, "oper_user_id", "oper_user_name", userMap);
|
|
|
|
+ //GS人员名
|
|
|
|
+ updateUserName(map, "gs_id", "gs_name", userMap);
|
|
|
|
+ //客服人员名
|
|
|
|
+ updateUserName(map, "customer_service_id", "customer_service_name", userMap);
|
|
|
|
+ }
|
|
//返回结果
|
|
//返回结果
|
|
return new Page<>(list, pager);
|
|
return new Page<>(list, pager);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 更新用户名称
|
|
|
|
+ private void updateUserName(Map<String, Object> map, String userIdKey, String userNameKey, ResultVO<Map<Long, String>> userMap) {
|
|
|
|
+ Object userIdObj = map.get(userIdKey);
|
|
|
|
+ if (userIdObj != null) {
|
|
|
|
+ try {
|
|
|
|
+ long userId = Long.parseLong(userIdObj.toString());
|
|
|
|
+ String userName = userMap.getData().get(userId);
|
|
|
|
+ if (userName != null) {
|
|
|
|
+ map.put(userNameKey, userName);
|
|
|
|
+ }
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ // 处理长整型转换异常
|
|
|
|
+ log.error("Error parsing user ID for key " + userIdKey + ": " + e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
private Criteria spliceRechargeTotalAmountWithin24h(RoleRechargeRankingDTO dto, Criteria criA) {
|
|
private Criteria spliceRechargeTotalAmountWithin24h(RoleRechargeRankingDTO dto, Criteria criA) {
|
|
switch (dto.getRechargeTotalAmountWithin24hUnit()) {
|
|
switch (dto.getRechargeTotalAmountWithin24hUnit()) {
|
|
case ">" -> criA.where().andGT("role_total_amount", dto.getRechargeTotalAmountWithin24h());
|
|
case ">" -> criA.where().andGT("role_total_amount", dto.getRechargeTotalAmountWithin24h());
|
|
@@ -278,12 +333,13 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
private Criteria spliceRechargeAmountWithin24h(RoleRechargeRankingDTO dto, Criteria criA) {
|
|
private Criteria spliceRechargeAmountWithin24h(RoleRechargeRankingDTO dto, Criteria criA) {
|
|
switch (dto.getRechargeAmountWithin24hUnit()) {
|
|
switch (dto.getRechargeAmountWithin24hUnit()) {
|
|
case ">" -> criA.where().andGT("max_amount", dto.getRechargeAmountWithin24h());
|
|
case ">" -> criA.where().andGT("max_amount", dto.getRechargeAmountWithin24h());
|
|
- case ">=" -> criA.where().andGTE("max_amount", dto.getRechargeAmountWithin24h());
|
|
|
|
- case "=" -> criA.where().andEquals("max_amount", dto.getRechargeAmountWithin24h());
|
|
|
|
- case "<" -> criA.where().andLT("max_amount", dto.getRechargeAmountWithin24h());
|
|
|
|
- case "<=" -> criA.where().andLTE("max_amount", dto.getRechargeAmountWithin24h());
|
|
|
|
|
|
+// case ">=" -> criA.where().andGTE("max_amount", dto.getRechargeAmountWithin24h());
|
|
|
|
+ //这里用到了array_contains 函数,如果包含则返回1,不包含则返回0
|
|
|
|
+ case "=" -> criA.where().andEquals("array_contains(role_amount,"+dto.getRechargeAmountWithin24h()+")", 1);
|
|
|
|
+ case "<" -> criA.where().andLT("min_amount", dto.getRechargeAmountWithin24h());
|
|
|
|
+// case "<=" -> criA.where().andLTE("max_amount", dto.getRechargeAmountWithin24h());
|
|
default -> {
|
|
default -> {
|
|
- criA.where().andGTE("max_amount", dto.getRechargeAmountWithin24h());
|
|
|
|
|
|
+ criA.where().andGT("max_amount", dto.getRechargeAmountWithin24h());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return criA;
|
|
return criA;
|
|
@@ -334,6 +390,12 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public void createSendMsgTask(SendMsgTaskDTO dto) {
|
|
public void createSendMsgTask(SendMsgTaskDTO dto) {
|
|
|
|
+ //校验游戏id的超父不为2的不让发消息,cp方未提供此功能
|
|
|
|
+ Map<Long, GameDTO> parentGameMap = getParentGameMap();
|
|
|
|
+ GameDTO gameDTO = parentGameMap.get(dto.getGameId());
|
|
|
|
+ if(gameDTO!=null && gameDTO.getSuperGameId()!=2){
|
|
|
|
+ throw new BaseException(gameDTO.getGameName()+">该游戏不支持发送消息");
|
|
|
|
+ }
|
|
//获取当前用户id
|
|
//获取当前用户id
|
|
Long sysUserId = SecurityUtil.getUserId();
|
|
Long sysUserId = SecurityUtil.getUserId();
|
|
//构建发送消息dto
|
|
//构建发送消息dto
|
|
@@ -571,17 +633,17 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
if(CollectionUtils.isEmpty(sendMsgTaskList.getRecords())){
|
|
if(CollectionUtils.isEmpty(sendMsgTaskList.getRecords())){
|
|
return new Page<>(sendMsgTaskList.getRecords(),sendMsgTaskList.getTotal(),sendMsgTaskList.getSize(),sendMsgTaskList.getCurrent(),sendMsgTaskList.getPages());
|
|
return new Page<>(sendMsgTaskList.getRecords(),sendMsgTaskList.getTotal(),sendMsgTaskList.getSize(),sendMsgTaskList.getCurrent(),sendMsgTaskList.getPages());
|
|
}
|
|
}
|
|
- //查询所有父游戏名称map key为父游戏id,value为游戏名称
|
|
|
|
- Map<Long, String> gameMap = getParentGameMap();
|
|
|
|
|
|
+ //查询所有游戏名称map key为游戏id,value为游戏名称
|
|
|
|
+ Map<Long, GameDTO> gameMap = getParentGameMap();
|
|
|
|
|
|
//查询创建人id key为创建人id,value为创建人名称
|
|
//查询创建人id key为创建人id,value为创建人名称
|
|
Map<Long, String> userMap = getCreateByNameMap(sendMsgTaskList);
|
|
Map<Long, String> userMap = getCreateByNameMap(sendMsgTaskList);
|
|
|
|
|
|
//循环遍历获取游戏名称, 获取创建人名称
|
|
//循环遍历获取游戏名称, 获取创建人名称
|
|
sendMsgTaskList.getRecords().forEach(item -> {
|
|
sendMsgTaskList.getRecords().forEach(item -> {
|
|
- String gameName = gameMap.get(item.getGameId());
|
|
|
|
- if (gameName != null){
|
|
|
|
- item.setGameName(gameName);
|
|
|
|
|
|
+ GameDTO gameDTO = gameMap.get(item.getGameId());
|
|
|
|
+ if (gameDTO!=null && gameDTO.getGameName() != null){
|
|
|
|
+ item.setGameName(gameDTO.getGameName());
|
|
}
|
|
}
|
|
String userName = userMap.get(item.getCreateBy());
|
|
String userName = userMap.get(item.getCreateBy());
|
|
if (userName != null){
|
|
if (userName != null){
|
|
@@ -610,16 +672,16 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 获取父游戏列表
|
|
|
|
|
|
+ * 获取游戏列表
|
|
*/
|
|
*/
|
|
- private Map<Long, String> getParentGameMap(){
|
|
|
|
|
|
+ private Map<Long, GameDTO> getParentGameMap(){
|
|
Sql sql = Sqls.create(getGameSql());
|
|
Sql sql = Sqls.create(getGameSql());
|
|
sql.setCallback(Sqls.callback.entities());
|
|
sql.setCallback(Sqls.callback.entities());
|
|
sql.setEntity(dao.getEntity(GameDTO.class));
|
|
sql.setEntity(dao.getEntity(GameDTO.class));
|
|
dao.execute(sql);
|
|
dao.execute(sql);
|
|
List<GameDTO> gameDtoList = sql.getList(GameDTO.class);
|
|
List<GameDTO> gameDtoList = sql.getList(GameDTO.class);
|
|
- //将游戏拼成map key为父游戏id,value为游戏名称
|
|
|
|
- return gameDtoList.stream().collect(Collectors.toMap(GameDTO::getParentId, GameDTO::getGameName));
|
|
|
|
|
|
+ //将游戏拼成map key为游戏id,value为游戏名称
|
|
|
|
+ return gameDtoList.stream().collect(Collectors.toMap(GameDTO::getId, Function.identity()));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -646,7 +708,7 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
Criteria cri = Cnd.cri();
|
|
Criteria cri = Cnd.cri();
|
|
//拼接游戏ID
|
|
//拼接游戏ID
|
|
cri.where().andInStrList("role_id", roleId);
|
|
cri.where().andInStrList("role_id", roleId);
|
|
- cri.where().andEquals("parent_id", sendMsgResultVo.getGameId());
|
|
|
|
|
|
+ cri.where().andEquals("b.id", sendMsgResultVo.getGameId());
|
|
|
|
|
|
//补齐参数
|
|
//补齐参数
|
|
Sql sql = Sqls.create(getTaskResultSql() + cri);
|
|
Sql sql = Sqls.create(getTaskResultSql() + cri);
|
|
@@ -713,7 +775,7 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
parent_id,
|
|
parent_id,
|
|
super_game_id
|
|
super_game_id
|
|
FROM dm_game_order.t_game
|
|
FROM dm_game_order.t_game
|
|
- where source_system = 'ZX_ONE' and id = parent_id
|
|
|
|
|
|
+ where source_system = 'ZX_ONE'
|
|
""";
|
|
""";
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1368,7 +1430,9 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
j.update_by as update_by, -- 更新者
|
|
j.update_by as update_by, -- 更新者
|
|
j.is_delete as is_delete, -- 是否删除 1-删除;0-正常
|
|
j.is_delete as is_delete, -- 是否删除 1-删除;0-正常
|
|
ara.role_total_amount as role_total_amount, -- 创角24小时内总充值金额
|
|
ara.role_total_amount as role_total_amount, -- 创角24小时内总充值金额
|
|
- ara.max_amount as max_amount -- 创角24小时内单笔最大充值金额
|
|
|
|
|
|
+ ara.max_amount as max_amount, -- 创角24小时内单笔最大充值金额
|
|
|
|
+ ara.min_amount as min_amount, -- 创角24小时内单笔最小充值金额
|
|
|
|
+ ara.role_amount as role_amount -- 角色充值数组
|
|
FROM
|
|
FROM
|
|
(
|
|
(
|
|
SELECT
|
|
SELECT
|
|
@@ -1397,8 +1461,10 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
SELECT source_system,
|
|
SELECT source_system,
|
|
role_id,
|
|
role_id,
|
|
role_total_amount,
|
|
role_total_amount,
|
|
- array_max(role_amount) max_amount
|
|
|
|
- FROM game_ads.ads_role_amount
|
|
|
|
|
|
+ array_min(role_amount) min_amount,
|
|
|
|
+ array_max(role_amount) max_amount,
|
|
|
|
+ role_amount
|
|
|
|
+ FROM game_ads.ads_role_amount
|
|
) ara on a.role_id = ara.role_id and a.source_system = ara.source_system
|
|
) ara on a.role_id = ara.role_id and a.source_system = ara.source_system
|
|
LEFT JOIN (
|
|
LEFT JOIN (
|
|
SELECT
|
|
SELECT
|
|
@@ -1777,7 +1843,9 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
j.update_by as update_by, -- 更新者
|
|
j.update_by as update_by, -- 更新者
|
|
j.is_delete as is_delete, -- 是否删除 1-删除;0-正常
|
|
j.is_delete as is_delete, -- 是否删除 1-删除;0-正常
|
|
ara.role_total_amount as role_total_amount, -- 创角24小时内总充值金额
|
|
ara.role_total_amount as role_total_amount, -- 创角24小时内总充值金额
|
|
- ara.max_amount as max_amount -- 创角24小时内单笔最大充值金额
|
|
|
|
|
|
+ ara.max_amount as max_amount, -- 创角24小时内单笔最大充值金额
|
|
|
|
+ ara.min_amount as min_amount, -- 创角24小时内单笔最小充值金额
|
|
|
|
+ ara.role_amount as role_amount -- 角色充值数组
|
|
FROM
|
|
FROM
|
|
(
|
|
(
|
|
SELECT
|
|
SELECT
|
|
@@ -1807,7 +1875,9 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
source_system,
|
|
source_system,
|
|
role_id,
|
|
role_id,
|
|
role_total_amount,
|
|
role_total_amount,
|
|
- array_max(role_amount) max_amount
|
|
|
|
|
|
+ array_min(role_amount) min_amount,
|
|
|
|
+ array_max(role_amount) max_amount,
|
|
|
|
+ role_amount
|
|
FROM game_ads.ads_role_amount
|
|
FROM game_ads.ads_role_amount
|
|
) ara on a.role_id = ara.role_id and a.source_system = ara.source_system
|
|
) ara on a.role_id = ara.role_id and a.source_system = ara.source_system
|
|
LEFT JOIN (
|
|
LEFT JOIN (
|