mirror of
https://gitee.com/likeadmin/likeadmin_java.git
synced 2026-05-11 19:12:01 +08:00
增加充值配置功能
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.mdd.admin.controller.marketing;
|
||||
|
||||
import com.mdd.admin.service.IMarketingRechargeService;
|
||||
import com.mdd.admin.validate.marketing.MarketingRechargeValidate;
|
||||
import com.mdd.admin.vo.marketing.MarketingRechargeVo;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("api/marketing/recharge")
|
||||
@Api("营销充值管理")
|
||||
public class MarketingRechargeController {
|
||||
|
||||
@Resource
|
||||
IMarketingRechargeService iMarketingRechargeService;
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiModelProperty(value = "充值配置详情")
|
||||
public AjaxResult<MarketingRechargeVo> detail() {
|
||||
MarketingRechargeVo vo = iMarketingRechargeService.detail();
|
||||
return AjaxResult.success(vo);
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
@ApiModelProperty(value = "充值配置保存")
|
||||
public AjaxResult<Object> save(@Validated @RequestBody MarketingRechargeValidate rechargeValidate) {
|
||||
iMarketingRechargeService.save(rechargeValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mdd.admin.service;
|
||||
|
||||
import com.mdd.admin.validate.marketing.MarketingRechargeValidate;
|
||||
import com.mdd.admin.vo.marketing.MarketingRechargeVo;
|
||||
|
||||
/**
|
||||
* 营销充值服务接口类
|
||||
*/
|
||||
public interface IMarketingRechargeService {
|
||||
|
||||
/**
|
||||
* 充值配置详情
|
||||
*
|
||||
* @author fzr
|
||||
* @return MarketingRechargeVo
|
||||
*/
|
||||
MarketingRechargeVo detail();
|
||||
|
||||
/**
|
||||
* 充值配置保存
|
||||
*
|
||||
* @author fzr
|
||||
* @param rechargeValidate 充值参数
|
||||
*/
|
||||
void save(MarketingRechargeValidate rechargeValidate);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.mdd.admin.service.impl;
|
||||
|
||||
import com.mdd.admin.service.IMarketingRechargeService;
|
||||
import com.mdd.admin.validate.marketing.MarketingRechargeValidate;
|
||||
import com.mdd.admin.vo.marketing.MarketingRechargeVo;
|
||||
import com.mdd.common.util.ConfigUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 营销充值服务实现类
|
||||
*/
|
||||
@Service
|
||||
public class MarketingRechargeServiceImpl implements IMarketingRechargeService {
|
||||
|
||||
/**
|
||||
* 充值配置详情
|
||||
*
|
||||
* @author fzr
|
||||
* @return MarketingRechargeVo
|
||||
*/
|
||||
@Override
|
||||
public MarketingRechargeVo detail() {
|
||||
Map<String, String> config = ConfigUtils.get("recharge");
|
||||
|
||||
MarketingRechargeVo vo = new MarketingRechargeVo();
|
||||
vo.setOpenRecharge(Integer.parseInt(config.getOrDefault("openRecharge", "0")));
|
||||
vo.setMinRechargeMoney(new BigDecimal(config.getOrDefault("minRechargeMoney", "0")));
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值配置保存
|
||||
*
|
||||
* @author fzr
|
||||
* @param rechargeValidate 充值参数
|
||||
*/
|
||||
@Override
|
||||
public void save(MarketingRechargeValidate rechargeValidate) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.mdd.admin.validate.marketing;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel("订单搜索参数")
|
||||
public class MarketingRechargeValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "openRecharge参数缺失")
|
||||
@ApiModelProperty("是否开启充值: 0=否,1=是")
|
||||
private Integer openRecharge;
|
||||
|
||||
@NotNull(message = "minRechargeMoney参数缺失")
|
||||
@ApiModelProperty("最低充值金额")
|
||||
private BigDecimal minRechargeMoney;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mdd.admin.vo.marketing;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel("营销充值Vo")
|
||||
public class MarketingRechargeVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("是否开启充值: 0=否,1=是")
|
||||
private Integer openRecharge;
|
||||
|
||||
@ApiModelProperty("最低充值金额")
|
||||
private BigDecimal minRechargeMoney;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user