Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tankaikai
2025-02-19 19:48:43 +08:00
25 changed files with 582 additions and 46 deletions

View File

@@ -33,7 +33,7 @@ public class MerchantRegisterController {
* @return 激活码列表
*/
@SaAdminCheckRole("管理员")
@SaAdminCheckPermission("merchantRegister:list")
@SaAdminCheckPermission(value = "merchantRegister:list", name = "激活码列表")
@GetMapping
public CzgResult<Page<MerchantRegister>> get(PageDTO pageDTO, Integer state, String startTime, String endTime) {
return CzgResult.success(merchantRegisterService.get(pageDTO, state, startTime, endTime));

View File

@@ -0,0 +1,51 @@
package com.czg.controller.admin;
import cn.hutool.core.util.StrUtil;
import com.czg.account.dto.extend.ShopExtendDTO;
import com.czg.account.entity.ShopExtend;
import com.czg.account.service.ShopExtendService;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 店铺拓展配置/装修
* @author Administrator
*/
@RestController
@RequestMapping("/admin/shopExtend")
public class ShopExtendController {
@Resource
private ShopExtendService shopExtendService;
/**
* 获取当前店铺拓展参数
* @param autoKey key名称
* @return 参数列表
*/
@SaAdminCheckPermission(value = "shopExtend:list", name = "店铺拓展参数列表")
@GetMapping
public CzgResult<List<ShopExtend>> list(String autoKey) {
QueryWrapper queryWrapper = new QueryWrapper().eq(ShopExtend::getShopId, StpKit.USER.getShopId());
if (StrUtil.isNotBlank(autoKey)) {
queryWrapper.eq(ShopExtend::getAutoKey, autoKey);
}
return CzgResult.success(shopExtendService.list(queryWrapper));
}
/**
* 店铺拓展参数修改
* @return 是否成功
*/
@SaAdminCheckPermission(value = "shopExtend:edit", name = "店铺拓展参数修改")
@PutMapping
public CzgResult<Boolean> edit(@RequestBody @Validated ShopExtendDTO shopExtendDTO) {
return CzgResult.success(shopExtendService.edit(StpKit.USER.getShopId(), shopExtendDTO));
}
}

View File

@@ -28,9 +28,18 @@ public class NotifyController {
@RequestMapping("/payCallBack")
public String notifyCallBack(@RequestBody CzgBaseRespParams respParams){
JSONObject czg = CzgPayUtils.getCzg(respParams);
AssertUtil.isNull(czg, "回调数据为空");
AssertUtil.isNull(czg, "支付回调数据为空");
log.info("支付回调数据为:{}", czg);
orderInfoService.payCallBackOrder(czg.getString("mchOrderNo"), czg);
return SUCCESS;
}
@RequestMapping("/refundCallBack")
public String refundCallBack(@RequestBody CzgBaseRespParams respParams){
JSONObject czg = CzgPayUtils.getCzg(respParams);
AssertUtil.isNull(czg, "退款回调数据为空");
log.info("退款回调数据为:{}", czg);
orderInfoService.refundCallBackOrder(czg.getString("mchOrderNo"), czg);
return SUCCESS;
}
}

View File

@@ -2,6 +2,7 @@ package com.czg.controller;
import com.czg.resp.CzgResult;
import com.czg.service.order.dto.VipPayParamDTO;
import com.czg.service.order.dto.VipRefundDTO;
import com.czg.service.order.service.PayService;
import com.czg.utils.AssertUtil;
import com.czg.utils.ServletUtil;
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.Map;
/**
@@ -68,7 +70,7 @@ public class VipPayController {
@PostMapping("/scanPayVip")
public CzgResult<Map<String, Object>> scanPayVip(HttpServletRequest request, @Validated @RequestBody VipPayParamDTO payParam) {
AssertUtil.isNull(payParam.getShopUserId(), "充值失败 未指定店铺用户Id");
payParam.setPlatformType(ServletUtil.getHeaderIgnoreCase(ServletUtil.getRequest(), "platformType"));
payParam.setPlatformType(ServletUtil.getHeaderIgnoreCase(request, "platformType"));
return payService.scanPayVip(ServletUtil.getClientIPByHeader(request), payParam);
}
@@ -82,4 +84,34 @@ public class VipPayController {
payParam.setPlatformType(ServletUtil.getHeaderIgnoreCase(ServletUtil.getRequest(), "platformType"));
return payService.microPayVip(payParam);
}
/**
* 退款前置
* 最大退款金额 为 充值金额 inAmount
*/
@PostMapping("/refundVipBefore")
public CzgResult<Map<String, BigDecimal>> refundVipBefore(@Validated @RequestBody VipRefundDTO payParam) {
return payService.refundVipBefore(payParam);
}
/**
* cashRefund 是否是现金退款
* 会员退款(先调用 退款前置接口 refundVipBefore)
* 最大退款金额为 充值金额 inAmount
* 理论可退最大金额为
* 用户余额-赠送金额 >充值金额 则可退充值金额
* 实际可退最大金额为 充值金额
* 如果实际 大于 理论 则 需要勾选 outOfRange 超额退款 为true 默认为false
*/
@PostMapping("/refundVip")
public CzgResult<Object> refundVip(HttpServletRequest request, @Validated @RequestBody VipRefundDTO payParam) {
AssertUtil.isNull(payParam.getRefAmount(), "退款金额不能为空");
if (payParam.getRefAmount().compareTo(BigDecimal.ZERO) <= 0) {
return CzgResult.failure("退款金额必须大于0");
} else if (payParam.getRefAmount().compareTo(new BigDecimal("10001")) > 0) {
return CzgResult.failure("退款金额过大");
}
payParam.setPlatformType(ServletUtil.getHeaderIgnoreCase(request, "platformType"));
return payService.refundVip(payParam);
}
}