From a02bed07c8281ae0fda850921eb7443393c5fb0c Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期日, 29 十二月 2024 13:59:29 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master-v4' into master-v4
---
src/main/java/com/mzl/flower/web/v2/sms/SmsTaskController.java | 85 ++++++++++++++++++++++++++----------------
1 files changed, 53 insertions(+), 32 deletions(-)
diff --git a/src/main/java/com/mzl/flower/web/v2/sms/SmsTaskController.java b/src/main/java/com/mzl/flower/web/v2/sms/SmsTaskController.java
index a5f22de..7ae694c 100644
--- a/src/main/java/com/mzl/flower/web/v2/sms/SmsTaskController.java
+++ b/src/main/java/com/mzl/flower/web/v2/sms/SmsTaskController.java
@@ -1,63 +1,84 @@
package com.mzl.flower.web.v2.sms;
-
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mzl.flower.base.BaseController;
import com.mzl.flower.base.R;
import com.mzl.flower.base.ReturnDataDTO;
+import com.mzl.flower.dto.request.sms.SmsTaskDTO;
+import com.mzl.flower.dto.request.sms.SmsTaskQueryDTO;
+import com.mzl.flower.dto.response.coupon.CouponTemplateUserVO;
+import com.mzl.flower.dto.response.coupon.CouponTemplateVO;
+import com.mzl.flower.dto.response.sms.SmsSelectVO;
+import com.mzl.flower.dto.response.sms.SmsTaskVO;
+import com.mzl.flower.service.sms.SmsTaskService;
+import com.mzl.flower.utils.ConverterUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestParam;
-import com.mzl.flower.entity.SmsTaskDO;
+import org.springframework.web.bind.annotation.*;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Positive;
+import javax.validation.constraints.NotNull;
-import org.springframework.web.bind.annotation.RestController;
/**
* @author @TaoJie
* @since 2024-12-25
*/
+@Api(value = "短信任务管理", tags = "短信任务管理")
@RestController
@RequestMapping("/v2/sms-task")
+@RequiredArgsConstructor
public class SmsTaskController extends BaseController {
- @PostMapping("")
- public ResponseEntity<ReturnDataDTO> create() {
+ private final SmsTaskService smsTaskService;
+
+ @PostMapping("/new")
+ @ApiOperation(value = "保存短信任务", httpMethod = "POST")
+ public ResponseEntity<ReturnDataDTO> create(@RequestBody SmsTaskDTO smsTaskDTO) {
+ smsTaskService.saveSmsTask(smsTaskDTO);
return returnData(R.SUCCESS.getCode(), null);
}
- @PutMapping("/{id}")
- public ResponseEntity<ReturnDataDTO> update(@PathVariable @Positive(message = "{id.positive}") Integer id) {
+ @PostMapping(value = "/edit")
+ @ApiOperation(value = "更新短信任务", httpMethod = "POST")
+ public ResponseEntity<ReturnDataDTO> update(@RequestBody SmsTaskDTO smsTaskDTO) {
+ smsTaskService.updateSmsTask(smsTaskDTO);
return returnData(R.SUCCESS.getCode(), null);
}
- @DeleteMapping("/{id}")
- public ResponseEntity<ReturnDataDTO> delete(@PathVariable @Positive(message = "{id.positive}") Integer id) {
+ @GetMapping(value = "/delete")
+ @ApiOperation(value = "删除短信任务 ", httpMethod = "GET", notes = "ID")
+ public ResponseEntity<ReturnDataDTO> delete(@NotNull(message = "id不能为空") Long id) {
+ smsTaskService.deleteSmsTask(id);
return returnData(R.SUCCESS.getCode(), null);
}
+
+ @GetMapping("/list")
+ @ApiOperation(value = "短信任务列表", httpMethod = "GET")
+ public ResponseEntity<ReturnDataDTO<Page<SmsTaskVO>>> getSmsTaskList(Page page, SmsTaskQueryDTO dto) {
+ return returnData(R.SUCCESS.getCode(), smsTaskService.queryPage(dto, page));
+ }
+
+ @PostMapping("/publish")
+ @ApiOperation(value = "发布短信任务", httpMethod = "POST")
+ public ResponseEntity<ReturnDataDTO> publish(@RequestBody SmsTaskDTO smsTaskDTO) {
+ smsTaskService.publishSmsTask(smsTaskDTO);
+ return returnData(R.SUCCESS.getCode(), null);
+ }
+
+ @GetMapping("/select/{id}")
+ @ApiOperation(value = "任务筛选详情列表", httpMethod = "GET")
+ public ResponseEntity<ReturnDataDTO<SmsSelectVO>> selectList(@PathVariable(name = "id") Long id) {
+ return returnData(R.SUCCESS.getCode(), smsTaskService.getSelectList(id));
+ }
+
@GetMapping("/{id}")
- public ResponseEntity<ReturnDataDTO> get(@PathVariable(value = "id") @Positive(message = "{id.positive}") Integer id) {
- return null;
- }
-
- @GetMapping("/page")
- public ResponseEntity<ReturnDataDTO<Page<SmsTaskDO>>> page(
- @RequestParam(name = "page", required = false, defaultValue = "0")
- @Min(value = 0, message = "{page.number.min}") Integer page,
- @RequestParam(name = "count", required = false, defaultValue = "10")
- @Min(value = 1, message = "{page.count.min}")
- @Max(value = 30, message = "{page.count.max}") Integer count
- ) {
- return null;
+ @ApiOperation(value = "详情", notes = "详情")
+ public ResponseEntity<ReturnDataDTO> get(@PathVariable Long id) {
+ SmsTaskVO smsTaskVO = smsTaskService.getDetailById(id);
+ return returnData(R.SUCCESS.getCode(), smsTaskVO);
}
}
--
Gitblit v1.9.3