61 lines
2.3 KiB
Java
61 lines
2.3 KiB
Java
|
|
package com.ruoyi.office.controller;
|
||
|
|
|
||
|
|
import com.ruoyi.common.annotation.Log;
|
||
|
|
import com.ruoyi.common.core.controller.BaseController;
|
||
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||
|
|
import com.ruoyi.common.enums.BusinessType;
|
||
|
|
import com.ruoyi.office.domain.TtWechatArticle;
|
||
|
|
import com.ruoyi.office.domain.WechatDraftPushRequest;
|
||
|
|
import com.ruoyi.office.service.IWechatDraftService;
|
||
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
||
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
||
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
||
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/office/wechat/draft")
|
||
|
|
public class TtWechatDraftController extends BaseController
|
||
|
|
{
|
||
|
|
private final IWechatDraftService draftService;
|
||
|
|
|
||
|
|
public TtWechatDraftController(IWechatDraftService draftService)
|
||
|
|
{
|
||
|
|
this.draftService = draftService;
|
||
|
|
}
|
||
|
|
|
||
|
|
@PreAuthorize("@ss.hasPermi('office:wechat:draft:list')")
|
||
|
|
@GetMapping("/list")
|
||
|
|
public TableDataInfo list(TtWechatArticle article)
|
||
|
|
{
|
||
|
|
startPage();
|
||
|
|
return getDataTable(draftService.selectList(article));
|
||
|
|
}
|
||
|
|
|
||
|
|
@PreAuthorize("@ss.hasPermi('office:wechat:draft:push')")
|
||
|
|
@PostMapping("/preview")
|
||
|
|
public AjaxResult preview(@RequestBody WechatDraftPushRequest request)
|
||
|
|
{
|
||
|
|
return success(draftService.preview(request));
|
||
|
|
}
|
||
|
|
|
||
|
|
@PreAuthorize("@ss.hasPermi('office:wechat:draft:push')")
|
||
|
|
@Log(title = "公众号草稿", businessType = BusinessType.INSERT)
|
||
|
|
@PostMapping
|
||
|
|
public AjaxResult push(@RequestBody WechatDraftPushRequest request)
|
||
|
|
{
|
||
|
|
return AjaxResult.success("已推送到公众号草稿箱", draftService.push(request));
|
||
|
|
}
|
||
|
|
|
||
|
|
@PreAuthorize("@ss.hasPermi('office:wechat:draft:retry')")
|
||
|
|
@Log(title = "公众号草稿重试", businessType = BusinessType.UPDATE)
|
||
|
|
@PostMapping("/{articleId}/retry")
|
||
|
|
public AjaxResult retry(@PathVariable Long articleId)
|
||
|
|
{
|
||
|
|
return AjaxResult.success("重试成功,已推送到草稿箱", draftService.retry(articleId));
|
||
|
|
}
|
||
|
|
}
|