临时提交

This commit is contained in:
磷叶 2025-01-20 15:55:51 +08:00
parent 2958d17e19
commit 7255481fc6
6 changed files with 142 additions and 0 deletions
smart-switch-service/src/main/java/com/ruoyi/ss
smart-switch-web/src/main/java/com/ruoyi/web/controller/app

View File

@ -0,0 +1,22 @@
package com.ruoyi.ss.transactionBill.domain.vo;
import java.math.BigDecimal;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 预存金额VO
*/
@Data
public class PrepayPriceVO {
@ApiModelProperty("原价")
private BigDecimal originalPrice;
@ApiModelProperty("应付金额")
private BigDecimal payPrice;
@ApiModelProperty("减免金额")
private BigDecimal discountAmount;
}

View File

@ -0,0 +1,14 @@
package com.ruoyi.ss.vipLevel.service;
import com.ruoyi.ss.vipLevel.domain.VipLevel;
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
public interface VipLevelConverter {
/**
* 商户修改会员等级
* @param data
* @return
*/
VipLevel toPoByMchEdit(VipLevelVO data);
}

View File

@ -0,0 +1,9 @@
package com.ruoyi.ss.vipLevel.service;
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
public interface VipLevelValidator {
void afterValid(VipLevelVO vo);
}

View File

@ -0,0 +1,37 @@
package com.ruoyi.ss.vipLevel.service.impl;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.ss.vipLevel.domain.VipLevel;
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
import com.ruoyi.ss.vipLevel.service.VipLevelConverter;
import org.springframework.stereotype.Service;
@Service
public class VipLevelConverterImpl implements VipLevelConverter {
@Override
public VipLevel toPoByMchEdit(VipLevelVO data) {
if (data == null) {
return null;
}
VipLevel po = new VipLevel();
// 商户id
po.setMchId(SecurityUtils.getUserId());
// 其他数据
po.setId(data.getId());
po.setPrice(data.getPrice());
po.setTime(data.getTime());
po.setDescription(data.getDescription());
po.setLimitType(data.getLimitType());
po.setLimitCount(data.getLimitCount());
po.setStatus(data.getStatus());
po.setName(data.getName());
po.setOriginalPrice(data.getOriginalPrice());
po.setLimitTotal(data.getLimitTotal());
po.setDiscount(data.getDiscount());
po.setStoreId(data.getStoreId());
return po;
}
}

View File

@ -0,0 +1,24 @@
package com.ruoyi.ss.vipLevel.service.impl;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
import com.ruoyi.ss.vipLevel.domain.enums.VipLevelLimitType;
import com.ruoyi.ss.vipLevel.service.VipLevelValidator;
@Service
public class VipLevelValidatorImpl implements VipLevelValidator {
@Override
public void afterValid(VipLevelVO vo) {
ServiceUtil.assertion(vo == null, "VIP等级定价不存在");
// 判断限制次数是否必填
if (!VipLevelLimitType.NONE.getType().equals(vo.getLimitType())) {
ServiceUtil.assertion(vo.getLimitCount() == null, "限制次数不能为空");
ServiceUtil.assertion(vo.getLimitCount() <= 0, "限制次数不能小于等于0");
}
}
}

View File

@ -0,0 +1,36 @@
package com.ruoyi.web.controller.app;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.ss.vipLevel.domain.VipLevelQuery;
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
import com.ruoyi.ss.vipLevel.domain.enums.VipLevelStatus;
import com.ruoyi.ss.vipLevel.service.VipLevelService;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/app/vipLevel")
public class AppVipLevelController extends BaseController {
@Autowired
private VipLevelService vipLevelService;
@ApiOperation("查询在售的会员等级列表")
@GetMapping("/list")
public TableDataInfo list(VipLevelQuery query) {
startPage();
query.setStatus(VipLevelStatus.ON_SALE.getStatus());
List<VipLevelVO> list = vipLevelService.selectVipLevelList(query);
return getDataTable(list);
}
}