短信 余额 短信 余额 明细
This commit is contained in:
@@ -1,56 +1,98 @@
|
||||
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.market.dto.SmsShopMoneyDetailDTO;
|
||||
import com.czg.market.dto.SmsShopTemplateDTO;
|
||||
import com.czg.market.entity.SmsShopMoney;
|
||||
import com.czg.market.service.SmsShopMoneyDetailService;
|
||||
import com.czg.market.service.SmsShopTemplateService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.market.mapper.SmsShopMoneyMapper;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 短信模板
|
||||
*
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/smsTemplate")
|
||||
@RequestMapping("/admin")
|
||||
public class SmsShopTemplateController {
|
||||
@Resource
|
||||
private SmsShopTemplateService templateService;
|
||||
@Resource
|
||||
private SmsShopMoneyDetailService smsMoneyDetailService;
|
||||
@Resource
|
||||
private SmsShopMoneyMapper shopMoneyMapper;
|
||||
|
||||
// /**
|
||||
// * 列表
|
||||
// */
|
||||
// @GetMapping("/smsTemplate")
|
||||
// public CzgResult<List<SmsShopTemplateDTO>> getTemplateList(@RequestParam(required = false) String title) {
|
||||
// List<SmsShopTemplateDTO> data = templateService.getTemplateList(title, StpKit.USER.getShopId());
|
||||
// return CzgResult.success(data);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 新增
|
||||
// */
|
||||
// @PostMapping("/smsTemplate")
|
||||
// public CzgResult<Void> addTemplate(@RequestBody @Validated(InsertGroup.class) SmsShopTemplateDTO param) {
|
||||
// param.setShopId(StpKit.USER.getShopId());
|
||||
// templateService.addTemplate(param);
|
||||
// return CzgResult.success();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 重新提交
|
||||
// * 状态为 -1 失败的 可以修改模板重新提交
|
||||
// */
|
||||
// @PostMapping("/smsTemplate/resubmit")
|
||||
// public CzgResult<Void> resubmit(@RequestBody @Validated(UpdateGroup.class) SmsShopTemplateDTO param) {
|
||||
// param.setShopId(StpKit.USER.getShopId());
|
||||
// templateService.resubmit(param);
|
||||
// return CzgResult.success();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* 获取店铺短信余额
|
||||
*/
|
||||
@GetMapping
|
||||
public CzgResult<List<SmsShopTemplateDTO>> getTemplateList(@RequestParam(required = false) String title) {
|
||||
List<SmsShopTemplateDTO> data = templateService.getTemplateList(title, StpKit.USER.getShopId());
|
||||
@GetMapping("/smsMoney")
|
||||
public CzgResult<SmsShopMoney> getShopSmsMoney() {
|
||||
SmsShopMoney shopMoney = shopMoneyMapper.selectOneByQuery(
|
||||
new QueryWrapper()
|
||||
.eq(SmsShopMoney::getShopId, StpKit.USER.getShopId())
|
||||
);
|
||||
if (shopMoney == null) {
|
||||
shopMoney = new SmsShopMoney();
|
||||
shopMoney.setShopId(StpKit.USER.getShopId());
|
||||
shopMoney.setMoney(BigDecimal.ZERO);
|
||||
shopMoneyMapper.insert(shopMoney);
|
||||
}
|
||||
return CzgResult.success(shopMoney);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺短信余额明细
|
||||
*/
|
||||
@GetMapping("/smsMoneyDetail")
|
||||
public CzgResult<Page<SmsShopMoneyDetailDTO>> getSmsMoneyDetailPage(@RequestParam(required = false) Integer page,
|
||||
@RequestParam(required = false) Integer size) {
|
||||
Page<SmsShopMoneyDetailDTO> data = smsMoneyDetailService.getSmsMoneyDetailPage(StpKit.USER.getShopId());
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping
|
||||
public CzgResult<Void> addTemplate(@RequestBody @Validated(InsertGroup.class) SmsShopTemplateDTO param) {
|
||||
param.setShopId(StpKit.USER.getShopId());
|
||||
templateService.addTemplate(param);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新提交
|
||||
* 状态为 -1 失败的 可以修改模板重新提交
|
||||
*/
|
||||
@PostMapping("/resubmit")
|
||||
public CzgResult<Void> resubmit(@RequestBody @Validated(UpdateGroup.class) SmsShopTemplateDTO param) {
|
||||
param.setShopId(StpKit.USER.getShopId());
|
||||
templateService.resubmit(param);
|
||||
return CzgResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user