diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/AccountService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/AccountService.java index 376a299d..1f772b30 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/AccountService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/AccountService.java @@ -104,4 +104,11 @@ public interface AccountService * 根据用户查询 */ List selectByUserId(Long userId); + + /** + * 查询用户账户 + * @param userId 用户ID + * @param type 账户类型 + */ + List selectUserAccountByType(Long userId, String type); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/impl/AccountServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/impl/AccountServiceImpl.java index 6bd099ee..42ddef08 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/impl/AccountServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/impl/AccountServiceImpl.java @@ -209,6 +209,14 @@ public class AccountServiceImpl implements AccountService { return this.selectSmAccountList(query); } + @Override + public List selectUserAccountByType(Long userId, String type) { + AccountQuery query = new AccountQuery(); + query.setUserId(userId); + query.setAccountType(type); + return this.selectSmAccountList(query); + } + private boolean isRepeat(Account data) { AccountQuery dto = new AccountQuery(); dto.setUserId(data.getUserId()); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/TransactionBill.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/TransactionBill.java index df4ffd5d..172e6c5f 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/TransactionBill.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/TransactionBill.java @@ -203,6 +203,9 @@ public class TransactionBill extends BaseEntity implements Payable @JsonView(JsonViewProfile.AppMch.class) private String withdrawType; + @ApiModelProperty("提现审核时的二维码") + private String offlineImage; + /** * 获取价格(分) */ diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/dto/WithdrawApprovalDTO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/dto/WithdrawApprovalDTO.java index 238947b7..7518594e 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/dto/WithdrawApprovalDTO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/dto/WithdrawApprovalDTO.java @@ -28,6 +28,9 @@ public class WithdrawApprovalDTO { @DictValid(type = DictTypeConstants.WITHDRAW_TYPE, message = "非法的打款方式") private String withdrawType; + @ApiModelProperty("审核时的二维码图片") + private String offlineImage; + @ApiModelProperty("支付凭证") private String payPicture; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml index 8898b5ca..5cf12723 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml @@ -48,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" stb.refund_service_amount, stb.pay_picture, stb.withdraw_type, + stb.offline_image, su.user_name as user_name, su1.user_name as mch_name, su1.phonenumber as mch_mobile, @@ -257,6 +258,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" refund_service_amount, pay_picture, withdraw_type, + offline_image, #{billNo}, @@ -297,6 +299,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{refundServiceAmount}, #{payPicture}, #{withdrawType}, + #{offlineImage}, @@ -354,6 +357,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" refund_service_amount = #{data.refundServiceAmount}, pay_picture = #{data.payPicture}, withdraw_type = #{data.withdrawType}, + offline_image = #{data.offlineImage}, diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java index 732a4d45..31b96dfb 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java @@ -37,4 +37,9 @@ public interface TransactionBillValidator { * @param userId 用户ID */ boolean isMch(TransactionBillVO bill, Long userId); + + /** + * 判断用户是否订单发起人 + */ + boolean isUser(TransactionBillVO bill, Long userId); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java index efe3ad32..772ffd14 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java @@ -475,6 +475,7 @@ public class TransactionBillServiceImpl implements TransactionBillService { data.setRemark(dto.getRemark()); data.setPayPicture(dto.getPayPicture()); data.setWithdrawType(dto.getWithdrawType()); + data.setOfflineImage(dto.getOfflineImage()); TransactionBillQuery query = new TransactionBillQuery(); query.setBillId(dto.getBillId()); query.setType(TransactionBillType.WITHDRAW.getType()); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java index 1d132b70..90d6ddc1 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java @@ -166,4 +166,9 @@ public class TransactionBillValidatorImpl extends BaseValidator implements Trans public boolean isMch(TransactionBillVO bill, Long userId) { return bill != null && bill.getMchId() != null && bill.getMchId().equals(userId); } + + @Override + public boolean isUser(TransactionBillVO bill, Long userId) { + return bill != null && bill.getUserId() != null && bill.getUserId().equals(userId); + } } diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/mch/MchWithdrawController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/mch/MchWithdrawController.java new file mode 100644 index 00000000..c74b93ff --- /dev/null +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/mch/MchWithdrawController.java @@ -0,0 +1,49 @@ +package com.ruoyi.web.controller.mch; + +import com.fasterxml.jackson.annotation.JsonView; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.JsonViewProfile; +import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO; +import com.ruoyi.ss.transactionBill.service.TransactionAssembler; +import com.ruoyi.ss.transactionBill.service.TransactionBillService; +import com.ruoyi.ss.transactionBill.service.TransactionBillValidator; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Collections; + +/** + * @author wjh + * 2024/8/1 + */ +@RestController +@RequestMapping("/mch/withdraw") +public class MchWithdrawController extends BaseController { + + @Autowired + private TransactionBillService transactionBillService; + + @Autowired + private TransactionBillValidator transactionBillValidator; + + @Autowired + private TransactionAssembler transactionAssembler; + + @ApiOperation("查询本人提现详情") + @GetMapping("/{billId}") + @JsonView(JsonViewProfile.AppMch.class) + public AjaxResult getWithdrawInfo(@PathVariable Long billId) { + TransactionBillVO bill = transactionBillService.selectSmTransactionBillByBillId(billId); + if (bill == null || !transactionBillValidator.isUser(bill, getUserId())) { + return success(); + } + transactionAssembler.assembleChannelName(Collections.singletonList(bill)); + return AjaxResult.success(bill); + } + +} diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/AccountController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/AccountController.java index 501bdd9b..48e35a4e 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/AccountController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/AccountController.java @@ -4,17 +4,11 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; import com.ruoyi.common.core.domain.ValidGroup; +import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -106,4 +100,14 @@ public class AccountController extends BaseController public AjaxResult remove(@PathVariable Long[] accountIds) { return toAjax(smAccountService.deleteSmAccountByAccountIds(accountIds)); } + + /** + * 根据类型获取用户账户 + * @param userId 用户ID + * @param type 类型 + */ + @GetMapping("/getUserAccountByType") + public AjaxResult getUserAccountByType(@RequestParam Long userId, @RequestParam String type) { + return success(smAccountService.selectUserAccountByType(userId, type)); + } }