代理添加全球国家代理

This commit is contained in:
2025-09-10 15:52:57 +08:00
parent 64eb667638
commit 3d304e0d73
9 changed files with 73 additions and 51 deletions

View File

@@ -37,7 +37,9 @@ public class ChargeRegionAdminServiceImpl implements ChargeRegionAdminService {
@Override
public List<ChargeRegion> list() {
return chargeRegionService.list();
return chargeRegionService.lambdaQuery()
.orderByAsc(ChargeRegion::getSeq)
.list();
}
@Override

View File

@@ -239,36 +239,40 @@ public class RechargeUserAdminServiceImpl implements RechargeUserAdminService {
}
private long saveRechargeUserRegion(List<RechargeUserRegionAdminDto> userRegions, long type, Long uid, Date now) {
if (CollectionUtil.isNotEmpty(userRegions)) {
log.info("userRegions : {}", JSONObject.toJSON(userRegions));
for (RechargeUserRegionAdminDto userRegion : userRegions) {
String name = userRegion.getName();
Long userRegionType = userRegion.getType();
Boolean isCheck = userRegion.getIsCheck();
Integer seq = userRegion.getSeq();
if (isCheck) {
type |= userRegionType;
RechargeUserRegion rechargeUserRegion = null;
List<RechargeUserRegion> rechargeUserRegions = rechargeUserRegionService.list(Wrappers.<RechargeUserRegion>lambdaQuery()
.eq(RechargeUserRegion::getUid, uid)
.eq(RechargeUserRegion::getType, userRegionType));
if (CollectionUtil.isNotEmpty(rechargeUserRegions)) {
rechargeUserRegion = rechargeUserRegions.get(0);
} else {
rechargeUserRegion = new RechargeUserRegion();
rechargeUserRegion.setUid(uid);
rechargeUserRegion.setType(userRegionType);
rechargeUserRegion.setCreateTime(now);
}
rechargeUserRegion.setName(name);
rechargeUserRegion.setSeq(seq);
rechargeUserRegion.setUpdateTime(now);
rechargeUserRegionService.saveOrUpdate(rechargeUserRegion);
if (CollectionUtil.isEmpty(userRegions)) {
return type;
}
log.info("userRegions : {}", JSONObject.toJSON(userRegions));
for (RechargeUserRegionAdminDto userRegion : userRegions) {
String name = userRegion.getName();
Long userRegionType = userRegion.getType();
Boolean isCheck = userRegion.getIsCheck();
Integer seq = userRegion.getSeq();
if (isCheck && userRegionType != null && userRegionType == 0) {
continue;
}
if (isCheck) {
type |= userRegionType;
RechargeUserRegion rechargeUserRegion = null;
List<RechargeUserRegion> rechargeUserRegions = rechargeUserRegionService.list(Wrappers.<RechargeUserRegion>lambdaQuery()
.eq(RechargeUserRegion::getUid, uid)
.eq(RechargeUserRegion::getType, userRegionType));
if (CollectionUtil.isNotEmpty(rechargeUserRegions)) {
rechargeUserRegion = rechargeUserRegions.get(0);
} else {
rechargeUserRegionService.remove(Wrappers.<RechargeUserRegion>lambdaQuery()
.eq(RechargeUserRegion::getUid, uid)
.eq(RechargeUserRegion::getType, userRegionType));
rechargeUserRegion = new RechargeUserRegion();
rechargeUserRegion.setUid(uid);
rechargeUserRegion.setType(userRegionType);
rechargeUserRegion.setCreateTime(now);
}
rechargeUserRegion.setName(name);
rechargeUserRegion.setSeq(seq);
rechargeUserRegion.setUpdateTime(now);
rechargeUserRegionService.saveOrUpdate(rechargeUserRegion);
} else {
rechargeUserRegionService.remove(Wrappers.<RechargeUserRegion>lambdaQuery()
.eq(RechargeUserRegion::getUid, uid)
.eq(RechargeUserRegion::getType, userRegionType));
}
}
return type;

View File

@@ -985,6 +985,8 @@ public enum BusiStatus {
SUPER_BLOCK_NOAUTHORITY(500, "NOAUTHORITY OPERATE"),
SUPER_BLOCK_MUST_BLOCK_REASON(500, "MUST SIGN BLOCK REASON"),
DAILY_TASK_REWARD_ERROR(500, "DAILY TASK REWARD ERROR"),
RECHARGE_REGION_GIVE_LIMIT(500,"你暂时还未开启该区域业务"),
RECHARGE_REGION_SALARY_LIMIT(500,"该代理暂不代理该区域业务"),
ROOM_DAY_DIAMOND_REWARD_DATE_CHECK(500, "TODAY NOT ALLOW RECEIVE"),
;

View File

@@ -4091,5 +4091,6 @@ public class Constant {
public static final int ADD = 2;
}
public static final String GLOBAL_CODE = "Global";
}

View File

@@ -1,21 +1,10 @@
package com.accompany.payment.vo;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.accompany.common.annotation.ReplaceAppDomain;
import com.accompany.common.utils.DateTimeUtil;
import com.accompany.core.enumeration.PartitionEnum;
import com.accompany.payment.model.RechargeUser;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.DayOfWeek;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.Date;
/**
* @author: liaozetao
* @date: 2023/8/17 19:02
@@ -73,4 +62,6 @@ public class RechargeUserVo extends RechargeUser {
private Integer subNum;//子代理数量
private Long type;
}

View File

@@ -23,7 +23,7 @@ public interface RechargeUserMapper extends BaseMapper<RechargeUser> {
*/
List<RechargeUserVo> getRechargeUserList(@Param("regionCode") String regionCode);
List<RechargeUserVo> listByPartitionIdByGuildTab(@Param("partitionId") Integer partitionId);
List<RechargeUserVo> listByPartitionIdByGuildTab(@Param("partitionId") Integer partitionId, @Param("regionCode") String regionCode);
List<RechargeUserVo> listByManageUid(@Param("manageUids") List<Long> manageUids);
@@ -31,4 +31,6 @@ public interface RechargeUserMapper extends BaseMapper<RechargeUser> {
Integer countByManageUid(@Param("manageUid") Long manageUid);
List<RechargeUser> listByPartitionId(@Param("partitionId") Integer partitionId);
List<String> regionCodeList(@Param("rechargeUid") Long rechargeUid);
}

View File

@@ -1,16 +1,12 @@
package com.accompany.payment.service;
import com.accompany.common.result.BusiResult;
import com.accompany.payment.model.RechargeUser;
import com.accompany.payment.vo.RechargeUserVo;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.bind.annotation.RequestHeader;
import java.util.List;
import java.util.Map;
import static com.accompany.common.constant.ApplicationConstant.PublicParameters.PUB_UID;
/**
* @author: liaozetao
* @date: 2023/8/15 11:20
@@ -18,7 +14,7 @@ import static com.accompany.common.constant.ApplicationConstant.PublicParameters
*/
public interface RechargeUserService extends IService<RechargeUser> {
List<RechargeUserVo> listByPartitionIdByGuildTab(Integer partitionId);
List<RechargeUserVo> listByPartitionIdByGuildTab(Integer partitionId, String regionCode);
/**
* 列表
@@ -54,4 +50,6 @@ public interface RechargeUserService extends IService<RechargeUser> {
List<RechargeUserVo> selectListByManageUids(List<Long> manageUids);
Integer countByManageUid(Long manageUid);
List<String> regionCodeList(Long rechargeUid);
}

View File

@@ -3,7 +3,6 @@ package com.accompany.payment.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.accompany.common.constant.Constant;
import com.accompany.common.redis.RedisKey;
import com.accompany.common.result.BusiResult;
import com.accompany.core.model.Users;
import com.accompany.core.service.common.JedisService;
import com.accompany.core.service.user.UsersBaseService;
@@ -22,9 +21,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.accompany.common.constant.Constant.GLOBAL_CODE;
import static java.util.Collections.EMPTY_MAP;
/**
@@ -44,8 +47,8 @@ public class RechargeUserServiceImpl extends ServiceImpl<RechargeUserMapper, Rec
private JedisService jedisService;
@Override
public List<RechargeUserVo> listByPartitionIdByGuildTab(Integer partitionId) {
List<RechargeUserVo> list = rechargeUserMapper.listByPartitionIdByGuildTab(partitionId);
public List<RechargeUserVo> listByPartitionIdByGuildTab(Integer partitionId, String regionCode) {
List<RechargeUserVo> list = rechargeUserMapper.listByPartitionIdByGuildTab(partitionId, regionCode);
if (CollectionUtil.isEmpty(list)) {
return Collections.emptyList();
}
@@ -54,6 +57,9 @@ public class RechargeUserServiceImpl extends ServiceImpl<RechargeUserMapper, Rec
@Override
public List<RechargeUserVo> selectList(String regionCode) {
if (GLOBAL_CODE.equals(regionCode)) {
return Collections.emptyList();
}
List<RechargeUserVo> list = rechargeUserMapper.getRechargeUserList(regionCode);
if (CollectionUtil.isEmpty(list)) {
return Collections.emptyList();
@@ -144,4 +150,9 @@ public class RechargeUserServiceImpl extends ServiceImpl<RechargeUserMapper, Rec
return rechargeUserMapper.countByManageUid(manageUid);
}
@Override
public List<String> regionCodeList(Long rechargeUid) {
return baseMapper.regionCodeList(rechargeUid);
}
}

View File

@@ -32,8 +32,12 @@
ru.has_guild_charge hasCharge,
ru.has_guild_charge hasGuildCharge
from recharge_user ru
left join charge_region as cr on ((ru.`type` <![CDATA[ & ]]> cr.`type`) != 0)
left join recharge_user_region as rur on rur.`type` = cr.`type` and ru.uid = rur.uid
inner join users u on ru.uid = u.uid
where u.partition_id = #{partitionId} and ru.has_guild_charge = 1
where u.partition_id = #{partitionId}
and ru.has_guild_charge = 1
and (cr.`code` = #{regionCode} or cr.`code` = 'Global')
</select>
<select id="listByManageUid" resultType="com.accompany.payment.vo.RechargeUserVo">
@@ -66,4 +70,11 @@
where u.partition_id = #{partitionId}
</select>
<select id="regionCodeList" resultType="java.lang.String">
select cr.code from recharge_user ru
left join charge_region as cr on ((ru.`type` <![CDATA[ & ]]> cr.`type`) != 0)
left join recharge_user_region as rur on rur.`type` = cr.`type` and ru.uid = rur.uid
where ru.uid = #{rechargeUid}
</select>
</mapper>