公众号回复管理功能

This commit is contained in:
TinyAnts 2022-09-13 16:06:50 +08:00
parent 8ea0b037b6
commit 71998ed2f1
4 changed files with 125 additions and 6 deletions

View File

@ -11,33 +11,64 @@ import java.util.Map;
* 公众号回复管理
*/
@RestController
@RequestMapping("api/channel/OaReply")
@RequestMapping("api/channel/oaReply")
public class OaReplyController {
@Resource
IChannelOaReplyService iChannelOaReplyService;
/**
* 回复列表
*
* @author fzr
* @return Object
*/
@GetMapping("/list")
public Object list() {
return AjaxResult.success();
}
/**
* 回复详情
*
* @author fzr
* @return Object
*/
@GetMapping("/detail")
public Object detail() {
return AjaxResult.success();
}
/**
* 回复新增
*
* @author fzr
* @param params 参数
* @return Object
*/
@PostMapping("/add")
public Object add(@RequestBody Map<String, String> params) {
iChannelOaReplyService.add(params);
return AjaxResult.success();
}
/**
* 回复编辑
*
* @author fzr
* @return Object
*/
@PostMapping("/edit")
public Object edit() {
return AjaxResult.success();
}
/**
* 回复删除
*
* @author fzr
* @return Object
*/
@PostMapping("/del")
public Object del() {
return AjaxResult.success();

View File

@ -8,9 +8,21 @@ public interface IChannelOaReplyService {
Object detail();
/**
* 回复新增
*
* @author fzr
* @param params 参数
*/
void add(Map<String, String> params);
void edit();
/**
* 回复编辑
*
* @author fzr
* @param params 参数
*/
void edit(Map<String, String> params);
void del();

View File

@ -1,5 +1,6 @@
package com.mdd.admin.service.channel.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.mdd.admin.service.channel.IChannelOaReplyService;
import com.mdd.common.entity.OfficialReply;
@ -29,6 +30,12 @@ public class ChannelOaReplyServiceImpl implements IChannelOaReplyService {
return null;
}
/**
* 回复新增
*
* @author fzr
* @param params 参数
*/
@Override
public void add(Map<String, String> params) {
String type = params.getOrDefault("type", "");
@ -41,7 +48,7 @@ public class ChannelOaReplyServiceImpl implements IChannelOaReplyService {
Assert.notNull(params.get("status"), "请正确选择状态");
officialReply.setName(params.get("name"));
officialReply.setReplyType(1);
officialReply.setContentType(Integer.parseInt(params.get("replyType")));
officialReply.setContentType(Integer.parseInt(params.get("contentType")));
officialReply.setContent(params.get("content"));
officialReply.setStatus(Integer.parseInt(params.get("status")));
officialReply.setCreateTime(System.currentTimeMillis() / 1000);
@ -73,7 +80,8 @@ public class ChannelOaReplyServiceImpl implements IChannelOaReplyService {
Assert.notNull(params.get("status"), "请正确选择状态");
officialReply.setName(params.get("name"));
officialReply.setReplyType(3);
officialReply.setMatchingType(Integer.parseInt(params.get("matchingType")));
officialReply.setContent(params.get("content"));
officialReply.setContentType(Integer.parseInt(params.get("contentType")));
officialReply.setStatus(Integer.parseInt(params.get("status")));
officialReply.setCreateTime(System.currentTimeMillis() / 1000);
officialReply.setUpdateTime(System.currentTimeMillis() / 1000);
@ -82,12 +90,79 @@ public class ChannelOaReplyServiceImpl implements IChannelOaReplyService {
default:
throw new OperateException("不被支持的类型");
}
}
/**
* 回复编辑
*
* @author fzr
* @param params 参数
*/
@Override
public void edit() {
public void edit(Map<String, String> params) {
Assert.notNull(params.get("id"), "id参数缺失");
Integer id = Integer.parseInt(params.get("id"));
OfficialReply officialReply = officialReplyMapper.selectOne(new QueryWrapper<OfficialReply>()
.eq("id", id)
.eq("is_delete", 0)
.last("limit 1"));
Assert.notNull(officialReply, "数据不存在!");
switch (officialReply.getReplyType()) {
case 1:
Assert.notNull(params.get("name"), "规则名称不能为空");
Assert.notNull(params.get("contentType"), "请正确选择回复类型");
Assert.notNull(params.get("content"), "回复内容不能为空");
Assert.notNull(params.get("status"), "请正确选择状态");
officialReply.setId(id);
officialReply.setName(params.get("name"));
officialReply.setReplyType(1);
officialReply.setContentType(Integer.parseInt(params.get("contentType")));
officialReply.setContent(params.get("content"));
officialReply.setStatus(Integer.parseInt(params.get("status")));
officialReply.setCreateTime(System.currentTimeMillis() / 1000);
officialReply.setUpdateTime(System.currentTimeMillis() / 1000);
officialReplyMapper.insert(officialReply);
break;
case 2:
Assert.notNull(params.get("name"), "规则名称不能为空");
Assert.notNull(params.get("keyword"), "关键词不能为空");
Assert.notNull(params.get("matchingType"), "请正确选择匹配模式");
Assert.notNull(params.get("contentType"), "请正确选择回复类型");
Assert.notNull(params.get("content"), "回复内容不能为空");
Assert.notNull(params.get("status"), "请正确选择状态");
officialReply.setId(id);
officialReply.setName(params.get("name"));
officialReply.setKeyword(params.get("keyword"));
officialReply.setMatchingType(Integer.parseInt(params.get("matchingType")));
officialReply.setReplyType(2);
officialReply.setContent(params.get("content"));
officialReply.setContentType(Integer.parseInt(params.get("contentType")));
officialReply.setStatus(Integer.parseInt(params.get("status")));
officialReply.setCreateTime(System.currentTimeMillis() / 1000);
officialReply.setUpdateTime(System.currentTimeMillis() / 1000);
officialReplyMapper.insert(officialReply);
break;
case 3:
Assert.notNull(params.get("name"), "规则名称不能为空");
Assert.notNull(params.get("contentType"), "请正确选择回复类型");
Assert.notNull(params.get("content"), "回复内容不能为空");
Assert.notNull(params.get("status"), "请正确选择状态");
officialReply.setId(id);
officialReply.setName(params.get("name"));
officialReply.setReplyType(3);
officialReply.setContent(params.get("content"));
officialReply.setContentType(Integer.parseInt(params.get("contentType")));
officialReply.setStatus(Integer.parseInt(params.get("status")));
officialReply.setCreateTime(System.currentTimeMillis() / 1000);
officialReply.setUpdateTime(System.currentTimeMillis() / 1000);
officialReplyMapper.insert(officialReply);
break;
default:
throw new OperateException("不被支持的类型");
}
}
@Override

View File

@ -24,6 +24,7 @@ public class OfficialReply implements Serializable {
private Integer status; // 启动状态: [1=启动, 0=关闭]
private String content; // 回复内容
private Integer sort; // 排序编号
private Integer isDelete; // 是否删除
private Long createTime; // 创建时间
private Long updateTime; // 更新时间
private Long deleteTime; // 删除时间