|
@@ -1,13 +1,30 @@
|
|
|
package com.citu.module.pay.controller.admin.currency;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import com.citu.framework.common.enums.UserTypeEnum;
|
|
|
import com.citu.framework.common.pojo.CommonResult;
|
|
|
+import com.citu.framework.common.pojo.PageParam;
|
|
|
+import com.citu.framework.common.pojo.PageResult;
|
|
|
import com.citu.module.pay.api.notify.dto.PayOrderNotifyReqDTO;
|
|
|
import com.citu.module.pay.api.notify.dto.PayRefundNotifyReqDTO;
|
|
|
+import com.citu.module.pay.controller.admin.currency.vo.recharge.PayCurrencyRechargePageReqVO;
|
|
|
+import com.citu.module.pay.controller.admin.currency.vo.recharge.PayCurrencyRechargeRespVO;
|
|
|
+import com.citu.module.pay.controller.admin.order.vo.PayOrderPageItemRespVO;
|
|
|
+import com.citu.module.pay.controller.admin.order.vo.PayOrderPageReqVO;
|
|
|
+import com.citu.module.pay.controller.app.currency.vo.recharge.AppPayCurrencyRechargeRespVO;
|
|
|
+import com.citu.module.pay.convert.currency.PayCurrencyRechargeConvert;
|
|
|
+import com.citu.module.pay.convert.order.PayOrderConvert;
|
|
|
+import com.citu.module.pay.dal.dataobject.app.PayAppDO;
|
|
|
+import com.citu.module.pay.dal.dataobject.currency.PayCurrencyRechargeDO;
|
|
|
+import com.citu.module.pay.dal.dataobject.order.PayOrderDO;
|
|
|
import com.citu.module.pay.service.currency.PayCurrencyRechargeService;
|
|
|
+import com.citu.module.pay.service.order.PayOrderService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@@ -15,8 +32,14 @@ import javax.annotation.Resource;
|
|
|
import javax.annotation.security.PermitAll;
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
import static com.citu.framework.common.pojo.CommonResult.success;
|
|
|
+import static com.citu.framework.common.util.collection.CollectionUtils.convertList;
|
|
|
import static com.citu.framework.common.util.servlet.ServletUtils.getClientIP;
|
|
|
+import static com.citu.framework.security.core.util.SecurityFrameworkUtils.getLoginUserDataId;
|
|
|
+import static com.citu.framework.web.core.util.WebFrameworkUtils.getLoginUserId;
|
|
|
|
|
|
@Tag(name = "管理后台 - 货币账户充值")
|
|
|
@RestController
|
|
@@ -28,6 +51,9 @@ public class PayCurrencyRechargeController {
|
|
|
@Resource
|
|
|
private PayCurrencyRechargeService currencyRechargeService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private PayOrderService payOrderService;
|
|
|
+
|
|
|
@PostMapping("/update-paid")
|
|
|
@Operation(summary = "更新货币账户充值为已充值") // 由 pay-module 支付服务,进行回调,可见 PayNotifyJob
|
|
|
@PermitAll // 无需登录, 内部校验实现
|
|
@@ -38,9 +64,10 @@ public class PayCurrencyRechargeController {
|
|
|
}
|
|
|
|
|
|
// TODO @jason:发起退款,要 post 操作哈;
|
|
|
- @GetMapping("/refund")
|
|
|
+ @PutMapping("/refund")
|
|
|
@Operation(summary = "发起货币账户充值退款")
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('pay:currency-recharge:update')")
|
|
|
public CommonResult<Boolean> refundCurrencyRecharge(@RequestParam("id") Long id) {
|
|
|
currencyRechargeService.refundCurrencyRecharge(id, getClientIP());
|
|
|
return success(true);
|
|
@@ -55,4 +82,19 @@ public class PayCurrencyRechargeController {
|
|
|
return success(true);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/page")
|
|
|
+ @Operation(summary = "获得货币账户充值记录分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('pay:currency-recharge:query')")
|
|
|
+ public CommonResult<PageResult<PayCurrencyRechargeRespVO>> getCurrencyRechargePage(
|
|
|
+ @Valid PayCurrencyRechargePageReqVO pageReqVO) {
|
|
|
+ PageResult<PayCurrencyRechargeDO> pageResult = currencyRechargeService
|
|
|
+ .getCurrencyRechargePackagePage(pageReqVO);
|
|
|
+ if (CollUtil.isEmpty(pageResult.getList())) {
|
|
|
+ return success(PageResult.empty(pageResult.getTotal()));
|
|
|
+ }
|
|
|
+ // 拼接数据
|
|
|
+ List<PayOrderDO> payOrderList = payOrderService.getOrderList(
|
|
|
+ convertList(pageResult.getList(), PayCurrencyRechargeDO::getPayOrderId));
|
|
|
+ return success(PayCurrencyRechargeConvert.INSTANCE.convertPage2(pageResult, payOrderList));
|
|
|
+ }
|
|
|
}
|