From eca817885262f7151cab5582598613c788c7efa5 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Mon, 10 Nov 2025 00:19:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=90=8E=E5=8F=B0=20?= =?UTF-8?q?=E6=8F=90=E7=8E=B0=E4=BF=A1=E6=81=AF=E6=9F=A5=E8=AF=A2=20?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../endpoint/bank/UserWithdrawInfoClient.java | 15 ++ .../bank/api/UserWithdrawInfoClientApi.java | 70 +++++++++ .../model/cmd/UserWithdrawInfoBackQryCmd.java | 37 +++++ .../inner/model/cmd/UserWithdrawInfoCmd.java | 100 +++++++++++++ .../model/cmd/UserWithdrawInfoPassCmd.java | 33 +++++ .../inner/model/dto/UserWithdrawInfoDTO.java | 102 +++++++++++++ .../user/UserWithdrawInfoRestController.java | 113 +++++++++++++++ .../user/UserWithdrawInfoBackServiceImpl.java | 136 ++++++++++++++++++ .../clienobject/user/UserWithdrawInfoCO.java | 108 ++++++++++++++ .../app/user/UserWithdrawInfoBackService.java | 73 ++++++++++ .../bank/UserWithdrawInfoClientEndpoint.java | 106 ++++++++++++++ .../bank/UserWithdrawInfoClientService.java | 43 ++++++ .../UserWithdrawInfoClientServiceImpl.java | 97 +++++++++++++ 13 files changed, 1033 insertions(+) create mode 100644 rc-service/rc-inner-api/wallet-inner/wallet-inner-api/src/main/java/com/red/circle/wallet/inner/endpoint/bank/UserWithdrawInfoClient.java create mode 100644 rc-service/rc-inner-api/wallet-inner/wallet-inner-api/src/main/java/com/red/circle/wallet/inner/endpoint/bank/api/UserWithdrawInfoClientApi.java create mode 100644 rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/cmd/UserWithdrawInfoBackQryCmd.java create mode 100644 rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/cmd/UserWithdrawInfoCmd.java create mode 100644 rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/cmd/UserWithdrawInfoPassCmd.java create mode 100644 rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/dto/UserWithdrawInfoDTO.java create mode 100644 rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/user/UserWithdrawInfoRestController.java create mode 100644 rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/user/UserWithdrawInfoBackServiceImpl.java create mode 100644 rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/user/UserWithdrawInfoCO.java create mode 100644 rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/user/UserWithdrawInfoBackService.java create mode 100644 rc-service/rc-service-wallet/wallet-inner-endpoint/src/main/java/com/red/circle/wallet/inner/endpoint/bank/UserWithdrawInfoClientEndpoint.java create mode 100644 rc-service/rc-service-wallet/wallet-inner-endpoint/src/main/java/com/red/circle/wallet/inner/service/bank/UserWithdrawInfoClientService.java create mode 100644 rc-service/rc-service-wallet/wallet-inner-endpoint/src/main/java/com/red/circle/wallet/inner/service/bank/impl/UserWithdrawInfoClientServiceImpl.java diff --git a/rc-service/rc-inner-api/wallet-inner/wallet-inner-api/src/main/java/com/red/circle/wallet/inner/endpoint/bank/UserWithdrawInfoClient.java b/rc-service/rc-inner-api/wallet-inner/wallet-inner-api/src/main/java/com/red/circle/wallet/inner/endpoint/bank/UserWithdrawInfoClient.java new file mode 100644 index 00000000..0a74f241 --- /dev/null +++ b/rc-service/rc-inner-api/wallet-inner/wallet-inner-api/src/main/java/com/red/circle/wallet/inner/endpoint/bank/UserWithdrawInfoClient.java @@ -0,0 +1,15 @@ +package com.red.circle.wallet.inner.endpoint.bank; + +import com.red.circle.wallet.inner.endpoint.bank.api.UserWithdrawInfoClientApi; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 用户提现信息. + * + * @author tf + */ +@FeignClient(name = "userWithdrawInfoClient", url = "${feign.wallet.url}" + + UserWithdrawInfoClientApi.API_PREFIX) +public interface UserWithdrawInfoClient extends UserWithdrawInfoClientApi { + +} diff --git a/rc-service/rc-inner-api/wallet-inner/wallet-inner-api/src/main/java/com/red/circle/wallet/inner/endpoint/bank/api/UserWithdrawInfoClientApi.java b/rc-service/rc-inner-api/wallet-inner/wallet-inner-api/src/main/java/com/red/circle/wallet/inner/endpoint/bank/api/UserWithdrawInfoClientApi.java new file mode 100644 index 00000000..94100acd --- /dev/null +++ b/rc-service/rc-inner-api/wallet-inner/wallet-inner-api/src/main/java/com/red/circle/wallet/inner/endpoint/bank/api/UserWithdrawInfoClientApi.java @@ -0,0 +1,70 @@ +package com.red.circle.wallet.inner.endpoint.bank.api; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoBackQryCmd; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoCmd; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoPassCmd; +import com.red.circle.wallet.inner.model.dto.UserWithdrawInfoDTO; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * 用户提现信息. + * + * @author tf + */ +public interface UserWithdrawInfoClientApi { + + String API_PREFIX = "/user-withdraw-info/client"; + + @PostMapping("/mapByIds") + ResultResponse> mapByIds(@RequestBody Set ids); + + @GetMapping("/getById") + ResultResponse getById(@RequestParam("id") Long id); + + @GetMapping("/existWithdrawInfo") + ResultResponse existWithdrawInfo(@RequestParam("userId") Long userId, + @RequestParam("category") String category); + + @PostMapping("/addWithdrawInfo") + ResultResponse addWithdrawInfo(@RequestBody UserWithdrawInfoCmd cmd); + + @PostMapping("/updateWithdrawInfo") + ResultResponse updateWithdrawInfo(@RequestBody UserWithdrawInfoCmd param); + + @GetMapping("/listByUserId") + ResultResponse> listByUserId(@RequestParam("userId") Long userId); + + @GetMapping("/listPassByUserId") + ResultResponse> listPassByUserId(@RequestParam("userId") Long userId); + + @GetMapping("/useWithdrawInfo") + ResultResponse useWithdrawInfo(@RequestParam("id") Long id, + @RequestParam("userId") Long userId, + @RequestParam("currentUidLong") Long currentUidLong); + + @GetMapping("/deleteByIdByUserId") + ResultResponse deleteByIdByUserId(@RequestParam("id") Long id, + @RequestParam("userId") Long userId, + @RequestParam("currentUidLong") Long currentUidLong); + + @PostMapping("/pass") + ResultResponse pass(@RequestBody UserWithdrawInfoPassCmd cmd); + + @PostMapping("/notPass") + ResultResponse notPass(@RequestBody UserWithdrawInfoPassCmd cmd); + + @PostMapping("/pageQuery") + ResultResponse> pageQuery( + @RequestBody UserWithdrawInfoBackQryCmd dbQuery); + + @PostMapping("/removeBatchByUserId") + ResultResponse removeBatchByUserId(@RequestBody List userIds); +} diff --git a/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/cmd/UserWithdrawInfoBackQryCmd.java b/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/cmd/UserWithdrawInfoBackQryCmd.java new file mode 100644 index 00000000..44d3672d --- /dev/null +++ b/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/cmd/UserWithdrawInfoBackQryCmd.java @@ -0,0 +1,37 @@ +package com.red.circle.wallet.inner.model.cmd; + +import com.red.circle.common.business.dto.PageQueryCmd; +import com.red.circle.framework.core.dto.PageCommand; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户提现信息后台查询命令. + * + * @author tf + */ +@Data +@EqualsAndHashCode(callSuper = false) +public class UserWithdrawInfoBackQryCmd extends PageCommand { + + /** + * 系统来源. + */ + private String sysOrigin; + + /** + * 用户ID. + */ + private Long userId; + + /** + * 类别. + */ + private String category; + + /** + * 审核状态. + */ + private String status; + +} diff --git a/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/cmd/UserWithdrawInfoCmd.java b/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/cmd/UserWithdrawInfoCmd.java new file mode 100644 index 00000000..db8b3e7c --- /dev/null +++ b/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/cmd/UserWithdrawInfoCmd.java @@ -0,0 +1,100 @@ +package com.red.circle.wallet.inner.model.cmd; + +import com.red.circle.framework.core.dto.CommonCommand; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import java.io.Serial; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * 用户提现信息. + * + * @author tf + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +public class UserWithdrawInfoCmd extends CommonCommand { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 记录id. + */ + private Long id; + + /** + * 归属系统. + */ + private String sysOrigin; + + /** + * 用户id. + */ + @NotNull + private Long userId; + + /** + * 联系电话. + */ + @NotBlank + private String contactNumber; + + /** + * 类别. + */ + @NotBlank + private String category; + + /** + * 其他描述. + */ + private String otherDescription; + + /** + * 护照/身份证正面照片URL. + */ + @NotBlank + private String passportFrontUrl; + + /** + * 护照/身份证背面照片URL. + */ + @NotBlank + private String passportBackUrl; + + /** + * 状态. + */ + private String status; + + /** + * 是否已删除(true是). + */ + private Boolean del; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 修改时间. + */ + private Timestamp updateTime; + + /** + * 创建用户. + */ + private Long createUser; + + /** + * 修改用户. + */ + private Long updateUser; + +} diff --git a/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/cmd/UserWithdrawInfoPassCmd.java b/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/cmd/UserWithdrawInfoPassCmd.java new file mode 100644 index 00000000..43859a6c --- /dev/null +++ b/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/cmd/UserWithdrawInfoPassCmd.java @@ -0,0 +1,33 @@ +package com.red.circle.wallet.inner.model.cmd; + +import com.red.circle.framework.core.dto.CommonCommand; +import java.io.Serial; +import java.util.Set; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * 用户提现信息审核命令. + * + * @author tf + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +public class UserWithdrawInfoPassCmd extends CommonCommand { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 提现信息ID集合. + */ + private Set ids; + + /** + * 当前操作用户ID. + */ + private Long currentUidLong; + +} diff --git a/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/dto/UserWithdrawInfoDTO.java b/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/dto/UserWithdrawInfoDTO.java new file mode 100644 index 00000000..bfa5d5fe --- /dev/null +++ b/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/dto/UserWithdrawInfoDTO.java @@ -0,0 +1,102 @@ +package com.red.circle.wallet.inner.model.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import java.io.Serial; +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 用户提现信息DTO. + * + * @author tf + */ +@Data +@Accessors(chain = true) +public class UserWithdrawInfoDTO implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 记录id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 用户id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 归属系统. + */ + private String sysOrigin; + + /** + * true正在使用. + */ + private Boolean use; + + /** + * 审核状态: 等待审核,已通过,不通过. + */ + private String status; + + /** + * 联系电话. + */ + private String contactNumber; + + /** + * 类别. + */ + private String category; + + /** + * 其他描述. + */ + private String otherDescription; + + /** + * 护照/身份证正面照片URL. + */ + private String passportFrontUrl; + + /** + * 护照/身份证背面照片URL. + */ + private String passportBackUrl; + + /** + * 是否已删除(true是). + */ + private Boolean del; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 修改时间. + */ + private Timestamp updateTime; + + /** + * 创建用户. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long createUser; + + /** + * 修改用户. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long updateUser; + +} diff --git a/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/user/UserWithdrawInfoRestController.java b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/user/UserWithdrawInfoRestController.java new file mode 100644 index 00000000..2e8a0390 --- /dev/null +++ b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/user/UserWithdrawInfoRestController.java @@ -0,0 +1,113 @@ +package com.red.circle.console.adapter.app.user; + +import com.red.circle.console.app.dto.clienobject.user.UserWithdrawInfoCO; +import com.red.circle.console.app.service.app.user.UserWithdrawInfoBackService; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.web.controller.BaseController; +import com.red.circle.tool.core.date.TimestampUtils; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoBackQryCmd; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoCmd; +import com.red.circle.wallet.inner.model.dto.UserWithdrawInfoDTO; +import java.util.List; +import java.util.Set; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 用户提现信息 前端控制器. + *

+ * + * @author tf + * @since 2025-01-09 + */ +@RequiredArgsConstructor +@RestController +@RequestMapping("/user/withdraw-info") +public class UserWithdrawInfoRestController extends BaseController { + + private final UserWithdrawInfoBackService userWithdrawInfoBackService; + + /** + * 列表查询. + */ + @GetMapping("/list/user-id/{id}") + public List listByUserId(@PathVariable("id") Long id) { + return userWithdrawInfoBackService.listByUserId(id); + } + + /** + * 通过的提现信息列表. + */ + @GetMapping("/pass-list") + public List listPassWithdrawInfo(Long userId) { + return userWithdrawInfoBackService.listPassWithdrawInfo(userId); + } + + /** + * 用户提现信息分页. + */ + @GetMapping("/page") + public PageResult pageQuery(UserWithdrawInfoBackQryCmd query) { + return userWithdrawInfoBackService.pageQuery(query); + } + + /** + * 修改用户提现信息. + */ + @PostMapping("/update") + public void update(@RequestBody @Validated UserWithdrawInfoCmd param) { + param.setUpdateUser(param.getReqUserId()); + param.setUpdateTime(TimestampUtils.now()); + userWithdrawInfoBackService.update(param); + } + + /** + * 添加用户提现信息. + */ + @PostMapping("/add") + public void add(@RequestBody @Validated UserWithdrawInfoCmd param) { + param.setCreateUser(param.getReqUserId()); + param.setCreateTime(TimestampUtils.now()); + userWithdrawInfoBackService.add(param); + } + + /** + * 审核驳回用户提现信息. + */ + @PostMapping("/not-pass") + public void notPass(@RequestBody Set ids) { + userWithdrawInfoBackService.notPass(ids, getReqUserId()); + } + + /** + * 审核通过用户提现信息. + */ + @PostMapping("/pass") + public void pass(@RequestBody Set ids) { + userWithdrawInfoBackService.pass(ids, getReqUserId()); + } + + /** + * 根据提现信息id删除用户提现信息. + */ + @GetMapping("/delete/{id}") + public void deleteById(@PathVariable("id") Long id) { + userWithdrawInfoBackService.deleteById(id, getReqUserId()); + } + + /** + * 切换使用中的提现信息. + */ + @GetMapping("/use/{id}") + public void use(@PathVariable("id") Long id) { + userWithdrawInfoBackService.use(id, getReqUserId()); + } + +} diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/user/UserWithdrawInfoBackServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/user/UserWithdrawInfoBackServiceImpl.java new file mode 100644 index 00000000..efe8acde --- /dev/null +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/user/UserWithdrawInfoBackServiceImpl.java @@ -0,0 +1,136 @@ +package com.red.circle.console.app.service.app.user; + +import com.red.circle.common.business.core.enums.ApprovalStatusEnum; +import com.red.circle.console.app.convertor.bank.BankAppConvertor; +import com.red.circle.console.app.dto.clienobject.user.UserWithdrawInfoCO; +import com.red.circle.console.inner.error.ConsoleErrorCode; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.endpoint.user.user.UserProfileClient; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.sequence.IdWorkerUtils; +import com.red.circle.wallet.inner.endpoint.bank.UserWithdrawInfoClient; +import com.red.circle.wallet.inner.error.BankErrorCode; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoBackQryCmd; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoCmd; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoPassCmd; +import com.red.circle.wallet.inner.model.dto.UserWithdrawInfoDTO; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + * 用户提现信息. + * + * @author tf + */ +@Service +@RequiredArgsConstructor +public class UserWithdrawInfoBackServiceImpl implements UserWithdrawInfoBackService { + + private final UserWithdrawInfoClient withdrawInfoClient; + private final BankAppConvertor bankAppConvertor; + private final UserProfileClient userProfileClient; + + @Override + public void add(UserWithdrawInfoCmd param) { + ResponseAssert.isFalse(BankErrorCode.REPEAT_WITHDRAW_INFO_ERROR, + ResponseAssert.requiredSuccess( + withdrawInfoClient.existWithdrawInfo(param.getUserId(), param.getCategory()))); + + param.setId(IdWorkerUtils.getId()); + param.setDel(Boolean.FALSE); + param.setStatus(ApprovalStatusEnum.PASS.name()); + param.setSysOrigin(param.getSysOrigin()); + withdrawInfoClient.addWithdrawInfo(param); + } + + @Override + public void update(UserWithdrawInfoCmd param) { + withdrawInfoClient.updateWithdrawInfo(param); + } + + @Override + public List listByUserId(Long userId) { + return bankAppConvertor.toListUserWithdrawInfoCO( + ResponseAssert.requiredSuccess(withdrawInfoClient.listByUserId(userId))); + } + + @Override + public List listPassWithdrawInfo(Long userId) { + return ResponseAssert.requiredSuccess(withdrawInfoClient.listPassByUserId(userId)); + } + + @Override + public void use(Long id, Long currentUidLong) { + UserWithdrawInfoDTO withdrawInfo = ResponseAssert.requiredSuccess( + withdrawInfoClient.getById(id)); + ResponseAssert.notNull(ConsoleErrorCode.NOT_FOUND_RECORD, withdrawInfo); + ResponseAssert.isFalse(ConsoleErrorCode.NOT_FOUND_RECORD, withdrawInfo.getDel()); + ResponseAssert.isTrue(BankErrorCode.NOT_APPROVED_ERROR, + Objects.equals(ApprovalStatusEnum.PASS.name(), withdrawInfo.getStatus())); + ResponseAssert.requiredSuccess( + withdrawInfoClient.useWithdrawInfo(id, withdrawInfo.getUserId(), currentUidLong)); + } + + @Override + public void deleteById(Long id, Long currentUidLong) { + UserWithdrawInfoDTO withdrawInfo = ResponseAssert.requiredSuccess( + withdrawInfoClient.getById(id)); + ResponseAssert.notNull(ConsoleErrorCode.NOT_FOUND_RECORD, withdrawInfo); + ResponseAssert.isFalse(ConsoleErrorCode.NOT_FOUND_RECORD, withdrawInfo.getDel()); + withdrawInfoClient.deleteByIdByUserId(id, withdrawInfo.getUserId(), currentUidLong); + } + + @Override + public void pass(Set ids, Long currentUidLong) { + withdrawInfoClient.pass( + new UserWithdrawInfoPassCmd().setCurrentUidLong(currentUidLong).setIds(ids)); + } + + @Override + public void notPass(Set ids, Long currentUidLong) { + withdrawInfoClient.notPass( + new UserWithdrawInfoPassCmd().setCurrentUidLong(currentUidLong).setIds(ids)); + } + + @Override + public PageResult pageQuery(UserWithdrawInfoBackQryCmd query) { + PageResult withdrawInfoDTOPageResult = ResponseAssert.requiredSuccess( + withdrawInfoClient.pageQuery(query)); + PageResult pageResult = withdrawInfoDTOPageResult.convert( + bankAppConvertor::toUserWithdrawInfoCO); + + if (pageResult.getTotal() <= 0) { + return pageResult; + } + + Map userProfileMap = getUserProfileMap( + pageResult.getRecords().stream().toList()); + if (CollectionUtils.isEmpty(userProfileMap)) { + return pageResult; + } + + pageResult.setRecords(pageResult.getRecords().stream().map(info -> { + UserProfileDTO userProfile = userProfileMap.get(info.getUserId()); + if (Objects.isNull(userProfile)) { + return null; + } + info.setUserProfile(userProfile); + return info; + }).filter(Objects::nonNull).collect(Collectors.toList())); + + return pageResult; + } + + private Map getUserProfileMap(List withdrawInfos) { + return ResponseAssert.requiredSuccess(userProfileClient.mapByUserIds( + withdrawInfos.stream().map(UserWithdrawInfoCO::getUserId).collect(Collectors.toSet()))); + } + +} diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/user/UserWithdrawInfoCO.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/user/UserWithdrawInfoCO.java new file mode 100644 index 00000000..7bbdf758 --- /dev/null +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/user/UserWithdrawInfoCO.java @@ -0,0 +1,108 @@ +package com.red.circle.console.app.dto.clienobject.user; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import java.io.Serial; +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 用户提现信息. + * + * @author tf + */ +@Data +@Accessors(chain = true) +public class UserWithdrawInfoCO implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 记录id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 归属系统. + */ + private String sysOrigin; + + /** + * 用户id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 用户. + */ + private UserProfileDTO userProfile; + + /** + * true正在使用. + */ + private Boolean use; + + /** + * 审核状态: 等待审核,已通过,不通过. + */ + private String status; + + /** + * 联系电话. + */ + private String contactNumber; + + /** + * 类别. + */ + private String category; + + /** + * 其他描述. + */ + private String otherDescription; + + /** + * 护照/身份证正面照片URL. + */ + private String passportFrontUrl; + + /** + * 护照/身份证背面照片URL. + */ + private String passportBackUrl; + + /** + * 是否已删除(true是). + */ + private Boolean del; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 修改时间. + */ + private Timestamp updateTime; + + /** + * 创建用户. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long createUser; + + /** + * 修改用户. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long updateUser; + +} diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/user/UserWithdrawInfoBackService.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/user/UserWithdrawInfoBackService.java new file mode 100644 index 00000000..c80e5745 --- /dev/null +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/user/UserWithdrawInfoBackService.java @@ -0,0 +1,73 @@ +package com.red.circle.console.app.service.app.user; + +import com.red.circle.console.app.dto.clienobject.user.UserWithdrawInfoCO; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoBackQryCmd; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoCmd; +import com.red.circle.wallet.inner.model.dto.UserWithdrawInfoDTO; +import java.util.List; +import java.util.Set; + +/** + * 用户提现信息. + * + * @author tf + */ +public interface UserWithdrawInfoBackService { + + /** + * 添加. + */ + void add(UserWithdrawInfoCmd param); + + /** + * 修改. + */ + void update(UserWithdrawInfoCmd param); + + /** + * 根据用户id获得提现信息列表. + * + * @param userId 用户id. + */ + List listByUserId(Long userId); + + /** + * 获取用户通过的提现信息列表. + */ + List listPassWithdrawInfo(Long userId); + + /** + * 将提现信息设置为使用状态. + * + * @param id id. + */ + void use(Long id, Long currentUidLong); + + /** + * 删除提现信息. + * + * @param id id. + */ + void deleteById(Long id, Long currentUidLong); + + /** + * 通过审核. + * + * @param ids ids. + */ + void pass(Set ids, Long currentUidLong); + + /** + * 驳回. + * + * @param ids ids. + */ + void notPass(Set ids, Long currentUidLong); + + /** + * 提现信息列表分页. + */ + PageResult pageQuery(UserWithdrawInfoBackQryCmd query); + +} diff --git a/rc-service/rc-service-wallet/wallet-inner-endpoint/src/main/java/com/red/circle/wallet/inner/endpoint/bank/UserWithdrawInfoClientEndpoint.java b/rc-service/rc-service-wallet/wallet-inner-endpoint/src/main/java/com/red/circle/wallet/inner/endpoint/bank/UserWithdrawInfoClientEndpoint.java new file mode 100644 index 00000000..6e23d99c --- /dev/null +++ b/rc-service/rc-service-wallet/wallet-inner-endpoint/src/main/java/com/red/circle/wallet/inner/endpoint/bank/UserWithdrawInfoClientEndpoint.java @@ -0,0 +1,106 @@ +package com.red.circle.wallet.inner.endpoint.bank; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.wallet.inner.endpoint.bank.api.UserWithdrawInfoClientApi; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoBackQryCmd; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoCmd; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoPassCmd; +import com.red.circle.wallet.inner.model.dto.UserWithdrawInfoDTO; +import com.red.circle.wallet.inner.service.bank.UserWithdrawInfoClientService; +import java.util.List; +import java.util.Map; +import java.util.Set; +import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 用户提现信息. + * + * @author tf + */ +@Validated +@RestController +@RequestMapping(value = UserWithdrawInfoClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE) +@RequiredArgsConstructor +public class UserWithdrawInfoClientEndpoint implements UserWithdrawInfoClientApi { + + private final UserWithdrawInfoClientService userWithdrawInfoClientService; + + @Override + public ResultResponse> mapByIds(Set ids) { + return ResultResponse.success(userWithdrawInfoClientService.mapByIds(ids)); + } + + @Override + public ResultResponse getById(Long id) { + return ResultResponse.success(userWithdrawInfoClientService.getById(id)); + } + + @Override + public ResultResponse existWithdrawInfo(Long userId, String category) { + return ResultResponse.success( + userWithdrawInfoClientService.existWithdrawInfo(userId, category)); + } + + @Override + public ResultResponse addWithdrawInfo(UserWithdrawInfoCmd cmd) { + userWithdrawInfoClientService.addWithdrawInfo(cmd); + return ResultResponse.success(); + } + + @Override + public ResultResponse updateWithdrawInfo(UserWithdrawInfoCmd param) { + userWithdrawInfoClientService.updateWithdrawInfo(param); + return ResultResponse.success(); + } + + @Override + public ResultResponse> listByUserId(Long userId) { + return ResultResponse.success(userWithdrawInfoClientService.listByUserId(userId)); + } + + @Override + public ResultResponse> listPassByUserId(Long userId) { + return ResultResponse.success(userWithdrawInfoClientService.listPassByUserId(userId)); + } + + @Override + public ResultResponse useWithdrawInfo(Long id, Long userId, Long currentUidLong) { + userWithdrawInfoClientService.useWithdrawInfo(id, userId, currentUidLong); + return ResultResponse.success(); + } + + @Override + public ResultResponse deleteByIdByUserId(Long id, Long userId, Long currentUidLong) { + userWithdrawInfoClientService.deleteByIdByUserId(id, userId, currentUidLong); + return ResultResponse.success(); + } + + @Override + public ResultResponse pass(UserWithdrawInfoPassCmd cmd) { + userWithdrawInfoClientService.pass(cmd.getIds(), cmd.getCurrentUidLong()); + return ResultResponse.success(); + } + + @Override + public ResultResponse notPass(UserWithdrawInfoPassCmd cmd) { + userWithdrawInfoClientService.notPass(cmd.getIds(), cmd.getCurrentUidLong()); + return ResultResponse.success(); + } + + @Override + public ResultResponse> pageQuery( + UserWithdrawInfoBackQryCmd dbQuery) { + return ResultResponse.success(userWithdrawInfoClientService.pageQuery(dbQuery)); + } + + @Override + public ResultResponse removeBatchByUserId(List userIds) { + userWithdrawInfoClientService.removeBatchByUserId(userIds); + return ResultResponse.success(); + } +} diff --git a/rc-service/rc-service-wallet/wallet-inner-endpoint/src/main/java/com/red/circle/wallet/inner/service/bank/UserWithdrawInfoClientService.java b/rc-service/rc-service-wallet/wallet-inner-endpoint/src/main/java/com/red/circle/wallet/inner/service/bank/UserWithdrawInfoClientService.java new file mode 100644 index 00000000..94c98f1a --- /dev/null +++ b/rc-service/rc-service-wallet/wallet-inner-endpoint/src/main/java/com/red/circle/wallet/inner/service/bank/UserWithdrawInfoClientService.java @@ -0,0 +1,43 @@ +package com.red.circle.wallet.inner.service.bank; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoBackQryCmd; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoCmd; +import com.red.circle.wallet.inner.model.dto.UserWithdrawInfoDTO; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 用户提现信息. + * + * @author tf + */ +public interface UserWithdrawInfoClientService { + + Map mapByIds(Set ids); + + UserWithdrawInfoDTO getById(Long id); + + Boolean existWithdrawInfo(Long userId, String category); + + void addWithdrawInfo(UserWithdrawInfoCmd cmd); + + void updateWithdrawInfo(UserWithdrawInfoCmd param); + + List listByUserId(Long userId); + + List listPassByUserId(Long userId); + + void useWithdrawInfo(Long id, Long userId, Long currentUidLong); + + void deleteByIdByUserId(Long id, Long userId, Long currentUidLong); + + void pass(Set ids, Long currentUidLong); + + void notPass(Set ids, Long currentUidLong); + + PageResult pageQuery(UserWithdrawInfoBackQryCmd dbQuery); + + void removeBatchByUserId(List userIds); +} diff --git a/rc-service/rc-service-wallet/wallet-inner-endpoint/src/main/java/com/red/circle/wallet/inner/service/bank/impl/UserWithdrawInfoClientServiceImpl.java b/rc-service/rc-service-wallet/wallet-inner-endpoint/src/main/java/com/red/circle/wallet/inner/service/bank/impl/UserWithdrawInfoClientServiceImpl.java new file mode 100644 index 00000000..ffa2aa5b --- /dev/null +++ b/rc-service/rc-service-wallet/wallet-inner-endpoint/src/main/java/com/red/circle/wallet/inner/service/bank/impl/UserWithdrawInfoClientServiceImpl.java @@ -0,0 +1,97 @@ +package com.red.circle.wallet.inner.service.bank.impl; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.wallet.infra.database.mongo.entity.bank.UserWithdrawInfo; +import com.red.circle.wallet.infra.database.mongo.service.bank.UserWithdrawInfoService; +import com.red.circle.wallet.inner.convertor.UserBankInnerConvertor; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoBackQryCmd; +import com.red.circle.wallet.inner.model.cmd.UserWithdrawInfoCmd; +import com.red.circle.wallet.inner.model.dto.UserWithdrawInfoDTO; +import com.red.circle.wallet.inner.service.bank.UserWithdrawInfoClientService; +import java.util.List; +import java.util.Map; +import java.util.Set; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + * 用户提现信息. + * + * @author tf + */ +@Service +@RequiredArgsConstructor +public class UserWithdrawInfoClientServiceImpl implements UserWithdrawInfoClientService { + + private final UserWithdrawInfoService userWithdrawInfoService; + private final UserBankInnerConvertor userBankInnerConvertor; + + @Override + public Map mapByIds(Set ids) { + return userBankInnerConvertor.toMapUserWithdrawInfoDTO( + userWithdrawInfoService.mapByIds(ids)); + } + + @Override + public UserWithdrawInfoDTO getById(Long id) { + return userBankInnerConvertor.toUserWithdrawInfoDTO(userWithdrawInfoService.getById(id)); + } + + @Override + public Boolean existWithdrawInfo(Long userId, String category) { + return userWithdrawInfoService.exist(userId, category); + } + + @Override + public void addWithdrawInfo(UserWithdrawInfoCmd cmd) { + userWithdrawInfoService.add(userBankInnerConvertor.toUserWithdrawInfo(cmd)); + } + + @Override + public void updateWithdrawInfo(UserWithdrawInfoCmd param) { + userWithdrawInfoService.update(userBankInnerConvertor.toUserWithdrawInfo(param)); + } + + @Override + public List listByUserId(Long userId) { + return userBankInnerConvertor.toListUserWithdrawInfoDTO( + userWithdrawInfoService.listByUserId(userId)); + } + + @Override + public List listPassByUserId(Long userId) { + return userBankInnerConvertor.toListUserWithdrawInfoDTO( + userWithdrawInfoService.listPassByUserId(userId)); + } + + @Override + public void useWithdrawInfo(Long id, Long userId, Long currentUidLong) { + userWithdrawInfoService.use(id, userId, currentUidLong); + } + + @Override + public void deleteByIdByUserId(Long id, Long userId, Long currentUidLong) { + userWithdrawInfoService.deleteByIdByUserId(id, userId, currentUidLong); + } + + @Override + public void pass(Set ids, Long currentUidLong) { + userWithdrawInfoService.pass(ids, currentUidLong); + } + + @Override + public void notPass(Set ids, Long currentUidLong) { + userWithdrawInfoService.notPass(ids, currentUidLong); + } + + @Override + public PageResult pageQuery(UserWithdrawInfoBackQryCmd dbQuery) { + PageResult pageResult = userWithdrawInfoService.pageQuery(dbQuery); + return pageResult.convert(userBankInnerConvertor::toUserWithdrawInfoDTO); + } + + @Override + public void removeBatchByUserId(List userIds) { + userWithdrawInfoService.removeBatchByUserId(userIds); + } +}