用户充值活动接口联调处理
This commit is contained in:
parent
2b8b26906a
commit
a77474d3df
@ -0,0 +1,13 @@
|
||||
package com.red.circle.other.inner.endpoint.activity;
|
||||
|
||||
import com.red.circle.other.inner.endpoint.activity.api.UserActivityRechargeClientApi;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
||||
/**
|
||||
* 用户活动充值服务
|
||||
*/
|
||||
@FeignClient(name = "userActivityRechargeClient", url = "${feign.other.url}" +
|
||||
UserActivityRechargeClientApi.API_PREFIX)
|
||||
public interface UserActivityRechargeClient extends UserActivityRechargeClientApi {
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.red.circle.other.inner.endpoint.activity.api;
|
||||
|
||||
import com.red.circle.framework.dto.ResultResponse;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 用户活动充值服务 API
|
||||
*/
|
||||
public interface UserActivityRechargeClientApi {
|
||||
|
||||
String API_PREFIX = "/activity-recharge/client";
|
||||
|
||||
/**
|
||||
* 记录用户活动充值
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param amount 充值金额
|
||||
* @param type 充值类型
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/record")
|
||||
ResultResponse<Void> recordRecharge(
|
||||
@RequestParam("userId") Long userId,
|
||||
@RequestParam("amount") BigDecimal amount,
|
||||
@RequestParam("type") String type
|
||||
);
|
||||
}
|
||||
@ -5,6 +5,7 @@ import com.red.circle.order.infra.database.rds.service.count.MonthlyRechargeUser
|
||||
import com.red.circle.order.infra.database.rds.service.count.TotalRechargeService;
|
||||
import com.red.circle.order.infra.database.rds.service.count.TotalRechargeUserService;
|
||||
import com.red.circle.order.infra.database.rds.service.count.UserMonthlyRechargeService;
|
||||
import com.red.circle.other.inner.endpoint.activity.UserActivityRechargeClient;
|
||||
import com.red.circle.order.inner.model.cmd.UserRechargeMonthQryCmd;
|
||||
import com.red.circle.order.inner.model.dto.MonthlyRechargeUserDTO;
|
||||
import com.red.circle.order.inner.model.dto.TotalRechargeUserDTO;
|
||||
@ -25,6 +26,7 @@ public class UserRechargeCountGatewayImpl implements UserRechargeCountGateway {
|
||||
private final TotalRechargeUserService totalRechargeUserService;
|
||||
private final MonthlyRechargeUserService monthlyRechargeUserService;
|
||||
private final UserMonthlyRechargeService userMonthlyRechargeService;
|
||||
private final UserActivityRechargeClient userActivityRechargeClient;
|
||||
|
||||
@Override
|
||||
public List<MonthlyRechargeUserDTO> listMonthlyRecharge(UserRechargeMonthQryCmd cmd) {
|
||||
@ -42,7 +44,7 @@ public class UserRechargeCountGatewayImpl implements UserRechargeCountGateway {
|
||||
totalRechargeService.incrAmount(userId, amount, type);
|
||||
monthlyRechargeUserService.incAmount(userId, amount);
|
||||
totalRechargeUserService.incAmount(userId, amount);
|
||||
|
||||
userActivityRechargeClient.recordRecharge(userId, amount, type.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
package com.red.circle.other.adapter.app.activity;
|
||||
|
||||
import com.red.circle.framework.dto.ResultResponse;
|
||||
import com.red.circle.order.inner.model.enums.MonthlyRechargeType;
|
||||
import com.red.circle.other.infra.database.rds.service.activity.UserActivityRechargeService;
|
||||
import com.red.circle.other.inner.endpoint.activity.api.UserActivityRechargeClientApi;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 用户活动充值服务实现
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(UserActivityRechargeClientApi.API_PREFIX)
|
||||
public class UserActivityRechargeClientController implements UserActivityRechargeClientApi {
|
||||
|
||||
private final UserActivityRechargeService userActivityRechargeService;
|
||||
|
||||
@Override
|
||||
public ResultResponse<Void> recordRecharge(Long userId, BigDecimal amount, String type) {
|
||||
userActivityRechargeService.recordRecharge(userId, amount, MonthlyRechargeType.valueOf(type));
|
||||
return ResultResponse.success();
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,13 @@
|
||||
package com.red.circle.other.infra.database.rds.entity.activity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.red.circle.framework.mybatis.entity.TimestampBaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
@ -20,9 +17,8 @@ import java.time.LocalDate;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("user_activity_recharge")
|
||||
public class UserActivityRecharge extends TimestampBaseEntity {
|
||||
public class UserActivityRecharge implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
@ -54,4 +50,10 @@ public class UserActivityRecharge extends TimestampBaseEntity {
|
||||
*/
|
||||
@TableField("amount")
|
||||
private BigDecimal amount;
|
||||
|
||||
@TableField("create_time")
|
||||
private Timestamp createTime;
|
||||
|
||||
@TableField("update_time")
|
||||
private Timestamp updateTime;
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ public class UserActivityRechargeServiceImpl implements UserActivityRechargeServ
|
||||
/**
|
||||
* 固定活动ID
|
||||
*/
|
||||
private static final Long FIXED_ACTIVITY_ID = 1L;
|
||||
private static final Long FIXED_ACTIVITY_ID = 2005571533988298753L;
|
||||
|
||||
@Override
|
||||
public void recordRecharge(Long userId, BigDecimal amount, MonthlyRechargeType type) {
|
||||
@ -37,8 +37,8 @@ public class UserActivityRechargeServiceImpl implements UserActivityRechargeServ
|
||||
type.name(),
|
||||
amount
|
||||
);
|
||||
|
||||
log.info("记录用户活动充值, userId:{}, amount:{}, type:{}, date:{}, result:{}",
|
||||
|
||||
log.info("记录用户活动充值, userId:{}, amount:{}, type:{}, date:{}, result:{}",
|
||||
userId, amount, type.name(), rechargeDate, result);
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ import com.red.circle.external.inner.model.enums.message.GroupMessageTypeEnum;
|
||||
import com.red.circle.external.inner.model.enums.message.OfficialNoticeTypeEnum;
|
||||
import com.red.circle.framework.core.dto.ReqSysOrigin;
|
||||
import com.red.circle.framework.dto.ResultResponse;
|
||||
import com.red.circle.order.inner.model.enums.MonthlyRechargeType;
|
||||
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
|
||||
import com.red.circle.other.app.dto.cmd.activity.RankingDataUpdateCmd;
|
||||
import com.red.circle.other.app.enums.violation.GameOriginEnum;
|
||||
@ -31,6 +32,7 @@ import com.red.circle.other.domain.ranking.RankingDimension;
|
||||
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
|
||||
import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig;
|
||||
import com.red.circle.other.infra.database.rds.entity.user.user.OneTimeTask;
|
||||
import com.red.circle.other.infra.database.rds.service.activity.UserActivityRechargeService;
|
||||
import com.red.circle.other.infra.database.rds.service.sys.GameListConfigService;
|
||||
import com.red.circle.other.infra.database.rds.service.user.device.LatestMobileDeviceService;
|
||||
import com.red.circle.other.infra.database.rds.service.user.user.OneTimeTaskService;
|
||||
@ -90,11 +92,13 @@ public class SpringTest {
|
||||
private LatestMobileDeviceService latestMobileDeviceService;
|
||||
@Autowired
|
||||
private UserRegionGateway userRegionGateway;
|
||||
@Autowired
|
||||
private UserActivityRechargeService userActivityRechargeService;
|
||||
|
||||
@Test
|
||||
public void getDeviceFingerprintByUserId() {
|
||||
|
||||
boolean eqRegion = userRegionGateway.checkEqRegion(1989287420580524033L, 1957345312961527809L);
|
||||
userActivityRechargeService.recordRecharge(1957345312961527809L, new BigDecimal("100"), MonthlyRechargeType.GOOGLE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user