新增超级金币代理身份

This commit is contained in:
tianfeng 2025-09-27 17:29:46 +08:00
parent a5de05b77f
commit 2027a96422
16 changed files with 100 additions and 1 deletions

View File

@ -15,7 +15,12 @@ public enum PayApplicationCommodityType {
/**
* 货运金币.
*/
FREIGHT_GOLD;
FREIGHT_GOLD,
/**
* 超级金币代理
*/
FREIGHT_GOLD_SUPER;
public boolean eq(String key) {
return Objects.equals(key, this.name());

View File

@ -189,6 +189,11 @@ public class UserProfileDTO implements Serializable {
*/
private Boolean isFreightAgent;
/**
* 是否超级金币代理
*/
private Boolean isSuperFreightAgent;
/**
* 用户使用的徽章.
*/

View File

@ -60,6 +60,12 @@ public interface FreightGoldClientApi {
@GetMapping("/checkFreightAgent")
ResultResponse<Boolean> checkFreightAgent(@RequestParam("userId") Long userId);
/**
* 是否为超级货运代理角色
*/
@GetMapping("/checkSuperFreightAgent")
ResultResponse<Boolean> checkSuperFreightAgent(@RequestParam("userId") Long userId);
@PostMapping("/pageFreight")
ResultResponse<PageResult<UserFreightBalanceDTO>> pageFreight(
@RequestBody UserFreightBalancePageQryCmd query);

View File

@ -63,6 +63,11 @@ public class FreightBalanceCmd extends CommonCommand {
*/
private Boolean dealer;
/**
* 是否超级经销商 0. 1..
*/
private Boolean superDealer;
/**
* 授权卖家数量.
*/

View File

@ -77,6 +77,11 @@ public class UserFreightBalanceDTO implements Serializable {
*/
private Boolean dealer;
/**
* 是否超级经销商 0. 1..
*/
private Boolean superDealer;
/**
* 授权卖家数量.
*/

View File

@ -92,6 +92,16 @@ public class UserFreightRestController extends BaseController {
userFreightService.switchDealerStatus(id, status);
}
/**
* 是否超级经销商切换
*/
@OpsOperationReqLog("货运代理-是否超级经销商开关")
@PostMapping("/switch-superdealer-status/{id}/{status}")
public void switchSuperDealerStatus(@PathVariable("id") Long id,
@PathVariable("status") Boolean status) {
userFreightService.switchSuperDealerStatus(id, status);
}
/**
* 扣除货款.
*/

View File

@ -327,6 +327,19 @@ public class UserFreightBalanceServiceImpl implements
walletAppConvertor.toUserFreightBalanceCmd(balance))));
}
@Override
public void switchSuperDealerStatus(Long id, Boolean status) {
UserFreightBalanceDTO balance = ResponseAssert.requiredSuccess(
freightGoldClient.getFreightBalanceById(id));
ResponseAssert.notNull(CommonErrorCode.NOT_FOUND_RECORD_INFO, balance);
balance.setSuperDealer(status);
balance.setUpdateTime(TimestampUtils.now());
ResponseAssert.isTrue(CommonErrorCode.UPDATE_FAILURE, ResponseAssert.requiredSuccess(
freightGoldClient.updateFreightBalance(
walletAppConvertor.toUserFreightBalanceCmd(balance))));
}
@Override
public void updateSellerQuantity(UserFreightSellerCmd param) {
if (!freightGoldClient.updateSellerQuantity(param).getBody()){

View File

@ -78,6 +78,11 @@ public class UserFreightBalanceCO implements Serializable {
*/
private Boolean dealer;
/**
* 是否超级经销商 0. 1..
*/
private Boolean superDealer;
/**
* 授权卖家数量.
*/

View File

@ -82,6 +82,11 @@ public interface UserFreightService {
*/
void switchDealerStatus(Long id, Boolean status);
/**
* 是否超级经销商切换
*/
void switchSuperDealerStatus(Long id, Boolean status);
/**
* 修改经销商卖家数量
*/

View File

@ -39,6 +39,7 @@ public class UserProfileUseSearchQryExe {
UserProfileDTO userProfileDTO = userProfileAppConvertor.toUserProfileDTO(userProfile);
userProfileDTO.setIsFreightAgent(ResponseAssert.requiredSuccess(freightGoldClient.checkFreightAgent(userProfile.getId())));
userProfileDTO.setIsSuperFreightAgent(ResponseAssert.requiredSuccess(freightGoldClient.checkSuperFreightAgent(userProfile.getId())));
return userProfileDTO;
}

View File

@ -76,6 +76,12 @@ public class FreightBalance extends TimestampBaseEntity {
@TableField("dealer")
private Boolean dealer;
/**
* 是否超级经销商 0. 1..
*/
@TableField("super_dealer")
private Boolean superDealer;
/**
* 授权卖家数量.
*/

View File

@ -109,6 +109,11 @@ public interface FreightBalanceService extends BaseService<FreightBalance> {
*/
Boolean checkFreightAgent(Long userId);
/**
* 是否为超级货运代理角色
*/
Boolean checkSuperFreightAgent(Long userId);
/**
* 根据用户id获取货运代理
*/

View File

@ -131,6 +131,19 @@ public class FreightBalanceServiceImpl extends
.orElse(false);
}
@Override
public Boolean checkSuperFreightAgent(Long userId) {
return Optional.ofNullable(query()
.select(FreightBalance::getId)
.eq(FreightBalance::getUserId, userId)
.eq(FreightBalance::getClose, Boolean.FALSE)
.eq(FreightBalance::getSuperDealer, Boolean.TRUE)
.last(PageConstant.LIMIT_ONE)
.getOne())
.map(item -> Objects.nonNull(item.getId()))
.orElse(false);
}
@Override
public FreightBalance getFreightBalance(Long userId) {
return query().eq(FreightBalance::getUserId, userId).last(PageConstant.LIMIT_ONE).getOne();

View File

@ -58,6 +58,11 @@ public class FreightGoldClientEndpoint implements FreightGoldClientApi {
return ResultResponse.success(freightGoldClientService.checkFreightAgent(userId));
}
@Override
public ResultResponse<Boolean> checkSuperFreightAgent(Long userId) {
return ResultResponse.success(freightGoldClientService.checkSuperFreightAgent(userId));
}
@Override
public ResultResponse<PageResult<UserFreightBalanceDTO>> pageFreight(
UserFreightBalancePageQryCmd query) {

View File

@ -58,6 +58,11 @@ public interface FreightGoldClientService {
*/
Boolean checkFreightAgent(Long userId);
/**
* 是否为超级货运代理角色
*/
Boolean checkSuperFreightAgent(Long userId);
PageResult<UserFreightBalanceDTO> pageFreight(UserFreightBalancePageQryCmd query);
UserFreightBalanceDTO getFreightBalance(Long userId);

View File

@ -109,6 +109,11 @@ public class FreightGoldClientServiceImpl implements FreightGoldClientService {
return freightBalanceService.checkFreightAgent(userId);
}
@Override
public Boolean checkSuperFreightAgent(Long userId) {
return freightBalanceService.checkSuperFreightAgent(userId);
}
@Override
public PageResult<UserFreightBalanceDTO> pageFreight(UserFreightBalancePageQryCmd query) {
return freightBalanceService.pageFreight(query)