新增 other 分页查询用户货运账户.

This commit is contained in:
tianfeng 2025-10-23 10:45:21 +08:00
parent bb69e5654a
commit 379ec8a77e
17 changed files with 398 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import com.red.circle.wallet.inner.model.cmd.AddFreightBalanceRunningWaterCmd;
import com.red.circle.wallet.inner.model.cmd.FreightAgentReviewCmd;
import com.red.circle.wallet.inner.model.cmd.FreightBalanceCmd;
import com.red.circle.wallet.inner.model.cmd.FreightBalanceRunningWaterCmd;
import com.red.circle.wallet.inner.model.cmd.UpdateFreightBalanceInfoCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalancePageQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalanceRunningWaterExportQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalanceRunningWaterPageQryCmd;
@ -133,4 +134,10 @@ public interface FreightGoldClientApi {
@GetMapping("/removeFreightSeller")
ResultResponse<Void> removeFreightSeller(@RequestParam("id") Long id);
/**
* 更新货运代理账户信息国家和联系方式.
*/
@PostMapping("/updateFreightBalanceInfo")
ResultResponse<Boolean> updateFreightBalanceInfo(@RequestBody @Validated UpdateFreightBalanceInfoCmd cmd);
}

View File

@ -0,0 +1,38 @@
package com.red.circle.wallet.inner.model.cmd;
import jakarta.validation.constraints.NotNull;
import java.io.Serial;
import java.io.Serializable;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 更新货运代理账户信息CMD.
*
* @author system
* @since 2025-10-21
*/
@Data
@Accessors(chain = true)
public class UpdateFreightBalanceInfoCmd implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 货运账户ID.
*/
@NotNull(message = "货运账户ID不能为空")
private Long id;
/**
* 支持的国家多个用逗号分隔.
*/
private String supportedCountries;
/**
* 联系方式.
*/
private String contactInfo;
}

View File

@ -46,4 +46,9 @@ public class UserFreightBalancePageQryCmd extends PageCommand {
* 是否经销商 0. 1..
*/
private Boolean dealer;
/**
* H5显示开关0-不显示1-显示.
*/
private Boolean h5Display;
}

View File

@ -82,6 +82,21 @@ public class UserFreightBalanceDTO implements Serializable {
*/
private Boolean superDealer;
/**
* 支持的国家多个用逗号分隔.
*/
private String supportedCountries;
/**
* 联系方式.
*/
private String contactInfo;
/**
* H5显示开关0-不显示1-显示.
*/
private Boolean h5Display;
/**
* 授权卖家数量.
*/

View File

@ -10,6 +10,7 @@ import com.red.circle.console.infra.annotations.OpsOperationReqLog;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.inner.model.cmd.user.UserFreightBalanceCmd;
import com.red.circle.wallet.inner.model.cmd.UpdateFreightBalanceInfoCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalancePageQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalanceRunningWaterExportQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalanceRunningWaterPageQryCmd;
@ -160,5 +161,13 @@ public class UserFreightRestController extends BaseController {
userFreightService.updateSellerQuantity(param);
}
/**
* 更新货运代理账户信息国家和联系方式.
*/
@OpsOperationReqLog("货运代理-更新账户信息")
@PostMapping("/update-info")
public void updateFreightBalanceInfo(@RequestBody @Validated UpdateFreightBalanceInfoCmd cmd) {
userFreightService.updateFreightBalanceInfo(cmd);
}
}

View File

@ -31,6 +31,7 @@ import com.red.circle.wallet.inner.endpoint.freight.FreightGoldClient;
import com.red.circle.wallet.inner.error.WalletErrorCode;
import com.red.circle.wallet.inner.model.cmd.AddFreightBalanceRunningWaterCmd;
import com.red.circle.wallet.inner.model.cmd.FreightAgentReviewCmd;
import com.red.circle.wallet.inner.model.cmd.UpdateFreightBalanceInfoCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalancePageQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalanceRunningWaterExportQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalanceRunningWaterPageQryCmd;
@ -308,7 +309,7 @@ public class UserFreightBalanceServiceImpl implements
freightGoldClient.getFreightBalanceById(id));
ResponseAssert.notNull(CommonErrorCode.NOT_FOUND_RECORD_INFO, balance);
balance.setDisplay(status);
balance.setH5Display(status);
balance.setUpdateTime(TimestampUtils.now());
ResponseAssert.isTrue(CommonErrorCode.UPDATE_FAILURE, ResponseAssert.requiredSuccess(
freightGoldClient.updateFreightBalance(
@ -543,4 +544,9 @@ public class UserFreightBalanceServiceImpl implements
badgeBackpackClient.deleteBadge(userId, freightBadgeId);
}
@Override
public void updateFreightBalanceInfo(UpdateFreightBalanceInfoCmd cmd) {
ResponseAssert.requiredSuccess(freightGoldClient.updateFreightBalanceInfo(cmd));
}
}

View File

@ -4,6 +4,7 @@ import com.red.circle.console.app.dto.clienobject.user.UserFreightBalanceCO;
import com.red.circle.console.app.dto.clienobject.user.UserFreightBalanceRunningWaterCO;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.other.inner.model.cmd.user.UserFreightBalanceCmd;
import com.red.circle.wallet.inner.model.cmd.UpdateFreightBalanceInfoCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalancePageQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalanceRunningWaterExportQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalanceRunningWaterPageQryCmd;
@ -111,4 +112,9 @@ public interface UserFreightService {
* 流水-导出.
*/
Collection<?> listExport(UserFreightBalanceRunningWaterExportQryCmd query);
/**
* 更新货运代理账户信息国家和联系方式.
*/
void updateFreightBalanceInfo(UpdateFreightBalanceInfoCmd cmd);
}

View File

@ -0,0 +1,45 @@
package com.red.circle.other.adapter.app.user.user;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.app.dto.clientobject.user.UserFreightBalanceCO;
import com.red.circle.other.app.service.user.UserFreightBalanceRestService;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalancePageQryCmd;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 用户货运账户 前端控制器.
*
* @author system
* @eo.api-type http
* @eo.groupName 用户服务.用户货运账户
* @eo.path /user/freight-balance
* @since 2025-10-21
*/
@Slf4j
@RestController
@RequestMapping(value = "/user/freight-balance", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class UserFreightBalanceRestController extends BaseController {
private final UserFreightBalanceRestService userFreightBalanceRestService;
/**
* 分页查询用户货运账户.
*
* @eo.name 分页查询用户货运账户.
* @eo.url /page
* @eo.method get
* @eo.request-type formdata
*/
@GetMapping("/page")
public PageResult<UserFreightBalanceCO> pageFreight(UserFreightBalancePageQryCmd cmd) {
return userFreightBalanceRestService.pageFreight(cmd);
}
}

View File

@ -0,0 +1,21 @@
package com.red.circle.other.app.convertor;
import com.red.circle.other.app.dto.clientobject.user.UserFreightBalanceCO;
import com.red.circle.wallet.inner.model.dto.UserFreightBalanceDTO;
import org.mapstruct.Mapper;
/**
* 用户货运账户转换器.
*
* @author system
* @since 2025-10-21
*/
@Mapper(componentModel = "spring")
public interface UserFreightBalanceConvertor {
/**
* DTO转CO.
*/
UserFreightBalanceCO toUserFreightBalanceCO(UserFreightBalanceDTO dto);
}

View File

@ -0,0 +1,67 @@
package com.red.circle.other.app.service.user.impl;
import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.other.app.convertor.UserFreightBalanceConvertor;
import com.red.circle.other.app.dto.clientobject.user.UserFreightBalanceCO;
import com.red.circle.other.app.service.user.UserFreightBalanceRestService;
import com.red.circle.other.inner.endpoint.user.user.UserProfileClient;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.wallet.inner.endpoint.freight.FreightBalanceClient;
import com.red.circle.wallet.inner.endpoint.freight.FreightGoldClient;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalancePageQryCmd;
import com.red.circle.wallet.inner.model.dto.UserFreightBalanceDTO;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 用户货运账户服务实现.
*
* @author system
* @since 2025-10-21
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class UserFreightBalanceRestServiceImpl implements UserFreightBalanceRestService {
private final FreightGoldClient freightGoldClient;
private final UserProfileClient userProfileClient;
private final UserFreightBalanceConvertor userFreightBalanceConvertor;
@Override
public PageResult<UserFreightBalanceCO> pageFreight(UserFreightBalancePageQryCmd cmd) {
// 写死默认查询条件H5开启且未关闭
cmd.setH5Display(true);
cmd.setClose(false);
// 1. 查询货运账户分页数据
PageResult<UserFreightBalanceDTO> freightPageResult = freightGoldClient.pageFreight(cmd).getBody();
if (freightPageResult.checkRecordsEmpty()) {
return freightPageResult.emptyRecords();
}
// 3. 查询用户基本信息
Map<Long, UserProfileDTO> userBaseInfoMap = ResponseAssert.requiredSuccess(
userProfileClient.mapByUserIds(
freightPageResult.getRecords().stream()
.map(UserFreightBalanceDTO::getUserId)
.collect(Collectors.toSet())
)
);
// 4. 转换并组装数据
return freightPageResult.convert(dto -> {
UserFreightBalanceCO co = userFreightBalanceConvertor.toUserFreightBalanceCO(dto);
co.setBalance(dto.getBalance());
co.setUserBaseInfo(userBaseInfoMap.get(dto.getUserId()));
return co;
});
}
}

View File

@ -0,0 +1,116 @@
package com.red.circle.other.app.dto.clientobject.user;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.red.circle.framework.dto.ClientObject;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import java.math.BigDecimal;
import java.sql.Timestamp;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 用户货运账户CO.
*
* @author system
* @since 2025-10-21
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class UserFreightBalanceCO extends ClientObject {
/**
* 主键标识.
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 归属平台.
*/
private String sysOrigin;
/**
* 用户id.
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long userId;
/**
* 获得糖果.
*/
private BigDecimal earnPoints;
/**
* 消费糖果.
*/
private BigDecimal consumptionPoints;
/**
* 余额.
*/
private BigDecimal balance;
/**
* 创建时间.
*/
private Timestamp createTime;
/**
* 修改时间.
*/
private Timestamp updateTime;
/**
* 0.未关闭 1.已关闭.
*/
private Boolean close;
/**
* 0.显示 1.不显示.
*/
private Boolean display;
/**
* 是否经销商 0. 1..
*/
private Boolean dealer;
/**
* 是否超级经销商 0. 1..
*/
private Boolean superDealer;
/**
* 支持的国家多个用逗号分隔.
*/
private String supportedCountries;
/**
* 联系方式.
*/
private String contactInfo;
/**
* H5显示开关0-不显示1-显示.
*/
private Boolean h5Display;
/**
* 授权卖家数量.
*/
private Integer sellerQuantity;
/**
* 实际授权卖家数量.
*/
private Long realSellerQuantity;
/**
* 用户基本信息.
*/
private UserProfileDTO userBaseInfo;
}

View File

@ -0,0 +1,20 @@
package com.red.circle.other.app.service.user;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.other.app.dto.clientobject.user.UserFreightBalanceCO;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalancePageQryCmd;
/**
* 用户货运账户服务.
*
* @author system
* @since 2025-10-21
*/
public interface UserFreightBalanceRestService {
/**
* 分页查询用户货运账户.
*/
PageResult<UserFreightBalanceCO> pageFreight(UserFreightBalancePageQryCmd cmd);
}

View File

@ -82,6 +82,24 @@ public class FreightBalance extends TimestampBaseEntity {
@TableField("super_dealer")
private Boolean superDealer;
/**
* 支持的国家多个用逗号分隔.
*/
@TableField("supported_countries")
private String supportedCountries;
/**
* 联系方式.
*/
@TableField("contact_info")
private String contactInfo;
/**
* H5显示开关0-不显示1-显示.
*/
@TableField("h5_display")
private Boolean h5Display;
/**
* 授权卖家数量.
*/

View File

@ -219,6 +219,7 @@ public class FreightBalanceServiceImpl extends
.eq(Objects.nonNull(query.getDealer()), FreightBalance::getDealer, query.getDealer())
.eq(Objects.nonNull(query.getId()), FreightBalance::getId, query.getId())
.eq(Objects.nonNull(query.getUserId()), FreightBalance::getUserId, query.getUserId())
.eq(Objects.nonNull(query.getH5Display()), FreightBalance::getH5Display, query.getH5Display())
.orderByDesc(FreightBalance::getId)
.page(query.getPageQuery());
}

View File

@ -8,6 +8,7 @@ import com.red.circle.wallet.inner.model.cmd.AddFreightBalanceRunningWaterCmd;
import com.red.circle.wallet.inner.model.cmd.FreightAgentReviewCmd;
import com.red.circle.wallet.inner.model.cmd.FreightBalanceCmd;
import com.red.circle.wallet.inner.model.cmd.FreightBalanceRunningWaterCmd;
import com.red.circle.wallet.inner.model.cmd.UpdateFreightBalanceInfoCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalancePageQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalanceRunningWaterExportQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalanceRunningWaterPageQryCmd;
@ -178,4 +179,9 @@ public class FreightGoldClientEndpoint implements FreightGoldClientApi {
freightGoldClientService.removeFreightSeller(id);
return ResultResponse.success();
}
@Override
public ResultResponse<Boolean> updateFreightBalanceInfo(UpdateFreightBalanceInfoCmd cmd) {
return ResultResponse.success(freightGoldClientService.updateFreightBalanceInfo(cmd));
}
}

View File

@ -6,6 +6,7 @@ import com.red.circle.wallet.inner.model.cmd.AddFreightBalanceRunningWaterCmd;
import com.red.circle.wallet.inner.model.cmd.FreightAgentReviewCmd;
import com.red.circle.wallet.inner.model.cmd.FreightBalanceCmd;
import com.red.circle.wallet.inner.model.cmd.FreightBalanceRunningWaterCmd;
import com.red.circle.wallet.inner.model.cmd.UpdateFreightBalanceInfoCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalancePageQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalanceRunningWaterExportQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalanceRunningWaterPageQryCmd;
@ -105,4 +106,9 @@ public interface FreightGoldClientService {
PageResult<UserFreightSellerDTO> pageFreightSeller(UserFreightSellerPageQryCmd query);
void removeFreightSeller(Long id);
/**
* 更新货运代理账户信息国家和联系方式.
*/
Boolean updateFreightBalanceInfo(UpdateFreightBalanceInfoCmd cmd);
}

View File

@ -8,6 +8,7 @@ import com.red.circle.framework.mybatis.constant.PageConstant;
import com.red.circle.order.inner.endpoint.UserFreightRechargeRecordClient;
import com.red.circle.wallet.domain.gateway.FreightShipGateway;
import com.red.circle.wallet.infra.database.rds.entity.freight.FreightAgentReview;
import com.red.circle.wallet.infra.database.rds.entity.freight.FreightBalance;
import com.red.circle.wallet.infra.database.rds.entity.freight.FreightBalanceRunningWater;
import com.red.circle.wallet.infra.database.rds.service.freight.FreightBalanceRunningWaterService;
import com.red.circle.wallet.infra.database.rds.service.freight.FreightBalanceService;
@ -18,6 +19,7 @@ import com.red.circle.wallet.inner.model.cmd.AddFreightBalanceRunningWaterCmd;
import com.red.circle.wallet.inner.model.cmd.FreightAgentReviewCmd;
import com.red.circle.wallet.inner.model.cmd.FreightBalanceCmd;
import com.red.circle.wallet.inner.model.cmd.FreightBalanceRunningWaterCmd;
import com.red.circle.wallet.inner.model.cmd.UpdateFreightBalanceInfoCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalancePageQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalanceRunningWaterExportQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserFreightBalanceRunningWaterPageQryCmd;
@ -244,4 +246,13 @@ public class FreightGoldClientServiceImpl implements FreightGoldClientService {
public void removeFreightSeller(Long id) {
freightSellerService.removeFreightSeller(id);
}
@Override
public Boolean updateFreightBalanceInfo(UpdateFreightBalanceInfoCmd cmd) {
return freightBalanceService.update()
.eq(FreightBalance::getId, cmd.getId())
.set(FreightBalance::getSupportedCountries, cmd.getSupportedCountries())
.set(FreightBalance::getContactInfo, cmd.getContactInfo())
.execute();
}
}