提交
This commit is contained in:
parent
aacf734ba4
commit
309bcb18a2
|
@ -8,7 +8,6 @@ import com.ruoyi.common.pay.tm.vo.RefundInfo;
|
|||
import com.ruoyi.common.pay.tm.vo.TmTradeInfo;
|
||||
import com.ruoyi.common.pay.wx.domain.Payable;
|
||||
import com.ruoyi.common.pay.wx.domain.RefundAble;
|
||||
import com.ruoyi.common.utils.http.AliHttpUtils;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -83,9 +82,9 @@ public class TmPayService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 小程序支付
|
||||
* 微信小程序支付
|
||||
*/
|
||||
public PrepayWithRequestPaymentResponse pay(Payable payable) {
|
||||
public PrepayWithRequestPaymentResponse wxPay(Payable payable) {
|
||||
HashMap<String, Object> body = new HashMap<>();
|
||||
body.put("payAmount", String.valueOf(payable.payableMoney()));
|
||||
body.put("terminalType", "1");
|
||||
|
|
|
@ -346,7 +346,7 @@ public class PayBillServiceImpl implements PayBillService
|
|||
} else if (TransactionBillPayType.TL_WX.getType().equals(bill.getChannelId())) {
|
||||
vo.setPayParams(sybPayService.prepayWxApp(bill));
|
||||
} else if (TransactionBillPayType.TM_WX.getType().equals(bill.getChannelId())) {
|
||||
vo.setPayParams(tmPayService.pay(bill));
|
||||
vo.setPayParams(tmPayService.wxPay(bill));
|
||||
} else {
|
||||
throw new ServiceException("暂不支持该支付方式");
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.ss.vip.domain;
|
|||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.domain.ValidGroup;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
@ -11,6 +12,8 @@ import com.ruoyi.common.annotation.Excel;
|
|||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 会员对象 ss_vip
|
||||
*
|
||||
|
@ -34,6 +37,7 @@ public class Vip extends BaseEntity
|
|||
|
||||
@Excel(name = "会员等级ID")
|
||||
@ApiModelProperty("会员等级ID")
|
||||
@NotNull(message = "会员等级不允许为空", groups = {ValidGroup.Create.class})
|
||||
private Long levelId;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.ruoyi.ss.vip.domain;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/12/9
|
||||
|
@ -13,4 +15,7 @@ public class VipQuery extends VipVO{
|
|||
@ApiModelProperty("排除ID")
|
||||
private Long excludeId;
|
||||
|
||||
@ApiModelProperty("VIP等级ID列表")
|
||||
private List<Long> vipLevelIds;
|
||||
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ public class VipVO extends Vip{
|
|||
private String vipLevelName;
|
||||
|
||||
@ApiModelProperty("店铺商户ID")
|
||||
private String storeMchId;
|
||||
private Long storeMchId;
|
||||
|
||||
@ApiModelProperty("VIP商户ID")
|
||||
private String vipMchId;
|
||||
private Long vipMchId;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.storeName != null and query.storeName != ''">and ss.name like concat('%',#{query.storeName},'%')</if>
|
||||
<if test="query.vipLevelName != null and query.vipLevelName != ''">and svl.name like concat('%',#{query.vipLevelName},'%')</if>
|
||||
<if test="query.excludeId != null">and sv.id != #{query.excludeId}</if>
|
||||
<if test="query.vipLevelIds != null and query.vipLevelIds.size() > 0">
|
||||
and sv.level_id in
|
||||
<foreach collection="query.vipLevelIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectVipList" parameterType="VipQuery" resultMap="VipResult">
|
||||
|
|
|
@ -18,4 +18,9 @@ public interface VipValidator {
|
|||
* 新增、更新后校验
|
||||
*/
|
||||
void afterCheck(VipVO vo);
|
||||
|
||||
/**
|
||||
* 是否允许查看
|
||||
*/
|
||||
boolean canView(VipVO vo, Long userId);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,12 @@ public class VipValidatorImpl implements VipValidator {
|
|||
this.checkMch(vo.getStoreMchId(), vo.getVipMchId());
|
||||
}
|
||||
|
||||
private void checkMch(String storeMchId, String vipMchId) {
|
||||
@Override
|
||||
public boolean canView(VipVO vo, Long userId) {
|
||||
return vo != null && userId != null && Objects.equals(vo.getStoreMchId(), userId);
|
||||
}
|
||||
|
||||
private void checkMch(Long storeMchId, Long vipMchId) {
|
||||
ServiceUtil.assertion(!Objects.equals(storeMchId, vipMchId), "当前选择的VIP等级与店铺商户不一致");
|
||||
}
|
||||
|
||||
|
|
|
@ -85,8 +85,10 @@ public class VipLevelServiceImpl implements VipLevelService
|
|||
*/
|
||||
@Override
|
||||
public int deleteVipLevelByIds(List<Long> ids) {
|
||||
if (CollectionUtils.isEmptyElement(ids)) {
|
||||
return 0;
|
||||
}
|
||||
vipLevelValidator.beforeDel(ids);
|
||||
|
||||
return vipLevelMapper.deleteVipLevelByIds(ids);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.ss.vipLevel.service.impl;
|
|||
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.ss.vip.domain.VipQuery;
|
||||
import com.ruoyi.ss.vip.service.VipService;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
|
||||
import com.ruoyi.ss.vipLevel.service.VipLevelService;
|
||||
|
@ -68,7 +69,16 @@ public class VipLevelValidatorImpl implements VipLevelValidator {
|
|||
public void beforeDel(List<Long> ids) {
|
||||
ServiceUtil.assertion(CollectionUtils.isEmptyElement(ids), "参数错误");
|
||||
|
||||
// TODO
|
||||
// vipService.selectVip
|
||||
// 判断当前等级下还有没有VIP
|
||||
ServiceUtil.assertion(this.hasVip(ids), "待删除的等级中还有用户正在使用中,请先删除对应VIP后重试");;
|
||||
}
|
||||
|
||||
private boolean hasVip(List<Long> ids) {
|
||||
if (CollectionUtils.isEmptyElement(ids)) {
|
||||
return false;
|
||||
}
|
||||
VipQuery query = new VipQuery();
|
||||
query.setVipLevelIds(ids);
|
||||
return vipService.selectCount(query) > 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
package com.ruoyi.web.controller.mch;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.ValidGroup;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.ss.vip.domain.Vip;
|
||||
import com.ruoyi.ss.vip.domain.VipQuery;
|
||||
import com.ruoyi.ss.vip.domain.VipVO;
|
||||
import com.ruoyi.ss.vip.service.VipService;
|
||||
import com.ruoyi.ss.vip.service.VipValidator;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/12/10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mch/vip")
|
||||
public class MchVipController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private VipService vipService;
|
||||
|
||||
@Autowired
|
||||
private VipValidator vipValidator;
|
||||
|
||||
@ApiOperation("商户获取VIP列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(VipQuery query) {
|
||||
startPage();
|
||||
query.setStoreMchId(getUserId());
|
||||
return getDataTable(vipService.selectVipList(query));
|
||||
}
|
||||
|
||||
@ApiOperation("商户获取VIP详情")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult getById(@PathVariable Long id) {
|
||||
VipVO vo = vipService.selectVipById(id);
|
||||
if (!vipValidator.canView(vo, getUserId())) {
|
||||
return error("您无权查看该信息");
|
||||
}
|
||||
return success(vo);
|
||||
}
|
||||
|
||||
@ApiOperation("商户新增VIP")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody @Validated(ValidGroup.FrontCreate.class) Vip data) {
|
||||
// TODO
|
||||
return success();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user