代理添加全球国家代理

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 @Override
public List<ChargeRegion> list() { public List<ChargeRegion> list() {
return chargeRegionService.list(); return chargeRegionService.lambdaQuery()
.orderByAsc(ChargeRegion::getSeq)
.list();
} }
@Override @Override

View File

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

View File

@@ -985,6 +985,8 @@ public enum BusiStatus {
SUPER_BLOCK_NOAUTHORITY(500, "NOAUTHORITY OPERATE"), SUPER_BLOCK_NOAUTHORITY(500, "NOAUTHORITY OPERATE"),
SUPER_BLOCK_MUST_BLOCK_REASON(500, "MUST SIGN BLOCK REASON"), SUPER_BLOCK_MUST_BLOCK_REASON(500, "MUST SIGN BLOCK REASON"),
DAILY_TASK_REWARD_ERROR(500, "DAILY TASK REWARD ERROR"), 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"), 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 int ADD = 2;
} }
public static final String GLOBAL_CODE = "Global";
} }

View File

@@ -1,21 +1,10 @@
package com.accompany.payment.vo; 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.annotation.ReplaceAppDomain;
import com.accompany.common.utils.DateTimeUtil;
import com.accompany.core.enumeration.PartitionEnum;
import com.accompany.payment.model.RechargeUser; import com.accompany.payment.model.RechargeUser;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; 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 * @author: liaozetao
* @date: 2023/8/17 19:02 * @date: 2023/8/17 19:02
@@ -73,4 +62,6 @@ public class RechargeUserVo extends RechargeUser {
private Integer subNum;//子代理数量 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> 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); List<RechargeUserVo> listByManageUid(@Param("manageUids") List<Long> manageUids);
@@ -31,4 +31,6 @@ public interface RechargeUserMapper extends BaseMapper<RechargeUser> {
Integer countByManageUid(@Param("manageUid") Long manageUid); Integer countByManageUid(@Param("manageUid") Long manageUid);
List<RechargeUser> listByPartitionId(@Param("partitionId") Integer partitionId); 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; package com.accompany.payment.service;
import com.accompany.common.result.BusiResult;
import com.accompany.payment.model.RechargeUser; import com.accompany.payment.model.RechargeUser;
import com.accompany.payment.vo.RechargeUserVo; import com.accompany.payment.vo.RechargeUserVo;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.bind.annotation.RequestHeader;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.accompany.common.constant.ApplicationConstant.PublicParameters.PUB_UID;
/** /**
* @author: liaozetao * @author: liaozetao
* @date: 2023/8/15 11:20 * @date: 2023/8/15 11:20
@@ -18,7 +14,7 @@ import static com.accompany.common.constant.ApplicationConstant.PublicParameters
*/ */
public interface RechargeUserService extends IService<RechargeUser> { 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); List<RechargeUserVo> selectListByManageUids(List<Long> manageUids);
Integer countByManageUid(Long manageUid); 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 cn.hutool.core.collection.CollectionUtil;
import com.accompany.common.constant.Constant; import com.accompany.common.constant.Constant;
import com.accompany.common.redis.RedisKey; import com.accompany.common.redis.RedisKey;
import com.accompany.common.result.BusiResult;
import com.accompany.core.model.Users; import com.accompany.core.model.Users;
import com.accompany.core.service.common.JedisService; import com.accompany.core.service.common.JedisService;
import com.accompany.core.service.user.UsersBaseService; 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.stereotype.Service;
import org.springframework.util.StringUtils; 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 java.util.stream.Collectors;
import static com.accompany.common.constant.Constant.GLOBAL_CODE;
import static java.util.Collections.EMPTY_MAP; import static java.util.Collections.EMPTY_MAP;
/** /**
@@ -44,8 +47,8 @@ public class RechargeUserServiceImpl extends ServiceImpl<RechargeUserMapper, Rec
private JedisService jedisService; private JedisService jedisService;
@Override @Override
public List<RechargeUserVo> listByPartitionIdByGuildTab(Integer partitionId) { public List<RechargeUserVo> listByPartitionIdByGuildTab(Integer partitionId, String regionCode) {
List<RechargeUserVo> list = rechargeUserMapper.listByPartitionIdByGuildTab(partitionId); List<RechargeUserVo> list = rechargeUserMapper.listByPartitionIdByGuildTab(partitionId, regionCode);
if (CollectionUtil.isEmpty(list)) { if (CollectionUtil.isEmpty(list)) {
return Collections.emptyList(); return Collections.emptyList();
} }
@@ -54,6 +57,9 @@ public class RechargeUserServiceImpl extends ServiceImpl<RechargeUserMapper, Rec
@Override @Override
public List<RechargeUserVo> selectList(String regionCode) { public List<RechargeUserVo> selectList(String regionCode) {
if (GLOBAL_CODE.equals(regionCode)) {
return Collections.emptyList();
}
List<RechargeUserVo> list = rechargeUserMapper.getRechargeUserList(regionCode); List<RechargeUserVo> list = rechargeUserMapper.getRechargeUserList(regionCode);
if (CollectionUtil.isEmpty(list)) { if (CollectionUtil.isEmpty(list)) {
return Collections.emptyList(); return Collections.emptyList();
@@ -144,4 +150,9 @@ public class RechargeUserServiceImpl extends ServiceImpl<RechargeUserMapper, Rec
return rechargeUserMapper.countByManageUid(manageUid); 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 hasCharge,
ru.has_guild_charge hasGuildCharge ru.has_guild_charge hasGuildCharge
from recharge_user ru 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 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>
<select id="listByManageUid" resultType="com.accompany.payment.vo.RechargeUserVo"> <select id="listByManageUid" resultType="com.accompany.payment.vo.RechargeUserVo">
@@ -66,4 +70,11 @@
where u.partition_id = #{partitionId} where u.partition_id = #{partitionId}
</select> </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> </mapper>