公众号回复

This commit is contained in:
TinyAnts
2022-09-13 15:32:53 +08:00
parent ca8fc2dfae
commit 21431d751a
9 changed files with 206 additions and 41 deletions

View File

@@ -1,4 +1,4 @@
package com.mdd.admin.controller.channel.oa;
package com.mdd.admin.controller.channel;
import com.mdd.admin.service.channel.IChannelOaMenuService;
import com.mdd.common.core.AjaxResult;
@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 公众号菜单
* 公众号菜单管理
*/
@RestController
@RequestMapping("api/channel/oa/menu")

View File

@@ -0,0 +1,46 @@
package com.mdd.admin.controller.channel;
import com.mdd.admin.service.channel.IChannelOaReplyService;
import com.mdd.common.core.AjaxResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Map;
/**
* 公众号回复管理
*/
@RestController
@RequestMapping("api/channel/OaReply")
public class OaReplyController {
@Resource
IChannelOaReplyService iChannelOaReplyService;
@GetMapping("/list")
public Object list() {
return AjaxResult.success();
}
@GetMapping("/detail")
public Object detail() {
return AjaxResult.success();
}
@PostMapping("/add")
public Object add(@RequestBody Map<String, String> params) {
iChannelOaReplyService.add(params);
return AjaxResult.success();
}
@PostMapping("/edit")
public Object edit() {
return AjaxResult.success();
}
@PostMapping("/del")
public Object del() {
return AjaxResult.success();
}
}

View File

@@ -1,15 +0,0 @@
package com.mdd.admin.controller.channel.oa;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 公众号默认回复
*/
@RestController
@RequestMapping("api/channel/oa/defaultReply")
public class OaDefaultReplyController {
}

View File

@@ -1,12 +0,0 @@
package com.mdd.admin.controller.channel.oa;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 公众号关注回复
*/
@RestController
@RequestMapping("api/channel/oa/followReply")
public class OaFollowReplyController {
}

View File

@@ -1,12 +0,0 @@
package com.mdd.admin.controller.channel.oa;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 公众号关键词回复
*/
@RestController
@RequestMapping("api/channel/oa/keywordReply")
public class OaKeywordReplyController {
}

View File

@@ -0,0 +1,17 @@
package com.mdd.admin.service.channel;
import java.util.Map;
public interface IChannelOaReplyService {
Object list();
Object detail();
void add(Map<String, String> params);
void edit();
void del();
}

View File

@@ -0,0 +1,98 @@
package com.mdd.admin.service.channel.impl;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.mdd.admin.service.channel.IChannelOaReplyService;
import com.mdd.common.entity.OfficialReply;
import com.mdd.common.entity.server.Sys;
import com.mdd.common.exception.OperateException;
import com.mdd.common.mapper.OfficialReplyMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Map;
@Service
public class ChannelOaReplyServiceImpl implements IChannelOaReplyService {
@Resource
OfficialReplyMapper officialReplyMapper;
@Override
public Object list() {
return null;
}
@Override
public Object detail() {
return null;
}
@Override
public void add(Map<String, String> params) {
String type = params.getOrDefault("type", "");
OfficialReply officialReply = new OfficialReply();
switch (type) {
case "follow":
Assert.notNull(params.get("name"), "规则名称不能为空");
Assert.notNull(params.get("contentType"), "请正确选择回复类型");
Assert.notNull(params.get("content"), "回复内容不能为空");
Assert.notNull(params.get("status"), "请正确选择状态");
officialReply.setName(params.get("name"));
officialReply.setReplyType(1);
officialReply.setContentType(Integer.parseInt(params.get("replyType")));
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 "keyword":
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.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 "default":
Assert.notNull(params.get("name"), "规则名称不能为空");
Assert.notNull(params.get("contentType"), "请正确选择回复类型");
Assert.notNull(params.get("content"), "回复内容不能为空");
Assert.notNull(params.get("status"), "请正确选择状态");
officialReply.setName(params.get("name"));
officialReply.setReplyType(3);
officialReply.setMatchingType(Integer.parseInt(params.get("matchingType")));
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
public void edit() {
}
@Override
public void del() {
}
}