diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/channel/oa/OaMenuController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/channel/OaMenuController.java similarity index 92% rename from server/like-admin/src/main/java/com/mdd/admin/controller/channel/oa/OaMenuController.java rename to server/like-admin/src/main/java/com/mdd/admin/controller/channel/OaMenuController.java index 11d5b663..581f119c 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/controller/channel/oa/OaMenuController.java +++ b/server/like-admin/src/main/java/com/mdd/admin/controller/channel/OaMenuController.java @@ -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") diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/channel/OaReplyController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/channel/OaReplyController.java new file mode 100644 index 00000000..208ac173 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/controller/channel/OaReplyController.java @@ -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 params) { + iChannelOaReplyService.add(params); + return AjaxResult.success(); + } + + @PostMapping("/edit") + public Object edit() { + return AjaxResult.success(); + } + + @PostMapping("/del") + public Object del() { + return AjaxResult.success(); + } + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/channel/oa/OaDefaultReplyController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/channel/oa/OaDefaultReplyController.java deleted file mode 100644 index 50c51096..00000000 --- a/server/like-admin/src/main/java/com/mdd/admin/controller/channel/oa/OaDefaultReplyController.java +++ /dev/null @@ -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 { - - - -} diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/channel/oa/OaFollowReplyController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/channel/oa/OaFollowReplyController.java deleted file mode 100644 index 26e2a79b..00000000 --- a/server/like-admin/src/main/java/com/mdd/admin/controller/channel/oa/OaFollowReplyController.java +++ /dev/null @@ -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 { -} diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/channel/oa/OaKeywordReplyController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/channel/oa/OaKeywordReplyController.java deleted file mode 100644 index a652ec11..00000000 --- a/server/like-admin/src/main/java/com/mdd/admin/controller/channel/oa/OaKeywordReplyController.java +++ /dev/null @@ -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 { -} diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/channel/IChannelOaReplyService.java b/server/like-admin/src/main/java/com/mdd/admin/service/channel/IChannelOaReplyService.java new file mode 100644 index 00000000..975d7812 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/service/channel/IChannelOaReplyService.java @@ -0,0 +1,17 @@ +package com.mdd.admin.service.channel; + +import java.util.Map; + +public interface IChannelOaReplyService { + + Object list(); + + Object detail(); + + void add(Map params); + + void edit(); + + void del(); + +} diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/channel/impl/ChannelOaReplyServiceImpl.java b/server/like-admin/src/main/java/com/mdd/admin/service/channel/impl/ChannelOaReplyServiceImpl.java new file mode 100644 index 00000000..72c055e4 --- /dev/null +++ b/server/like-admin/src/main/java/com/mdd/admin/service/channel/impl/ChannelOaReplyServiceImpl.java @@ -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 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() { + + } + +} diff --git a/server/like-common/src/main/java/com/mdd/common/entity/OfficialReply.java b/server/like-common/src/main/java/com/mdd/common/entity/OfficialReply.java new file mode 100644 index 00000000..f21f83de --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/entity/OfficialReply.java @@ -0,0 +1,31 @@ +package com.mdd.common.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; + +import java.io.Serializable; + +/** + * 公众号回复实体 + */ +@Data +public class OfficialReply implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value="id", type= IdType.AUTO) + private Integer id; // 主键ID + private String name; // 规则名 + private String keyword; // 关键词 + private Integer replyType; // 回复类型: [1=关注回复 2=关键字回复, 3=默认回复] + private Integer matchingType; // 匹配方式: [1=全匹配, 2=模糊匹配] + private Integer contentType; // 内容类型: [1=文本] + private Integer status; // 启动状态: [1=启动, 0=关闭] + private String content; // 回复内容 + private Integer sort; // 排序编号 + private Long createTime; // 创建时间 + private Long updateTime; // 更新时间 + private Long deleteTime; // 删除时间 + +} diff --git a/server/like-common/src/main/java/com/mdd/common/mapper/OfficialReplyMapper.java b/server/like-common/src/main/java/com/mdd/common/mapper/OfficialReplyMapper.java new file mode 100644 index 00000000..db34db99 --- /dev/null +++ b/server/like-common/src/main/java/com/mdd/common/mapper/OfficialReplyMapper.java @@ -0,0 +1,12 @@ +package com.mdd.common.mapper; + +import com.mdd.common.core.basics.IBaseMapper; +import com.mdd.common.entity.OfficialReply; +import org.apache.ibatis.annotations.Mapper; + +/** + * 公众号回复Mapper + */ +@Mapper +public interface OfficialReplyMapper extends IBaseMapper { +}