diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/MpAutoReplyController.java b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/MpAutoReplyController.java index 6fd1e7fde..397d091b6 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/MpAutoReplyController.java +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/MpAutoReplyController.java @@ -8,11 +8,13 @@ import cn.iocoder.yudao.module.mp.convert.message.MpAutoReplyConvert; import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpAutoReplyDO; import cn.iocoder.yudao.module.mp.service.message.MpAutoReplyService; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @@ -37,4 +39,13 @@ public class MpAutoReplyController { return success(MpAutoReplyConvert.INSTANCE.convertPage(pageResult)); } + @GetMapping("/get") + @ApiOperation("获得公众号自动回复") + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('mp:auto-reply:query')") + public CommonResult getAutoReply(@RequestParam("id") Long id) { + MpAutoReplyDO autoReply = mpAutoReplyService.getAutoReply(id); + return success(MpAutoReplyConvert.INSTANCE.convert(autoReply)); + } + } diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/vo/autoreply/MpAutoReplyBaseVO.java b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/vo/autoreply/MpAutoReplyBaseVO.java index 1fbf66b5b..fa9ae31c7 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/vo/autoreply/MpAutoReplyBaseVO.java +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/vo/autoreply/MpAutoReplyBaseVO.java @@ -30,7 +30,7 @@ public class MpAutoReplyBaseVO { @ApiModelProperty(value = "请求的关键字", example = "关键字", notes = "当 type 为 MpAutoReplyTypeEnum#KEYWORD 时,必填") private String requestKeyword; - @ApiModelProperty(value = "请求的关键字", example = "关键字", notes = "当 type 为 MpAutoReplyTypeEnum#KEYWORD 时,必填") + @ApiModelProperty(value = "请求的匹配方式", example = "1", notes = "当 type 为 MpAutoReplyTypeEnum#KEYWORD 时,必填") private Integer requestMatch; @ApiModelProperty(value = "请求的消息类型", example = "text", notes = "当 type 为 MpAutoReplyTypeEnum#MESSAGE 时,必填") diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/vo/autoreply/MpAutoReplyRespVO.java b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/vo/autoreply/MpAutoReplyRespVO.java index ec371b04e..83a25b6cb 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/vo/autoreply/MpAutoReplyRespVO.java +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/message/vo/autoreply/MpAutoReplyRespVO.java @@ -6,6 +6,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; +import java.util.Date; + @ApiModel("管理后台 - 公众号自动回复 Response VO") @Data @EqualsAndHashCode(callSuper = true) @@ -20,4 +22,7 @@ public class MpAutoReplyRespVO extends MpAutoReplyBaseVO { @ApiModelProperty(value = "微信公众号 appid", required = true, example = "wx1234567890") private String appId; + @ApiModelProperty(value = "创建时间", required = true) + private Date createTime; + } diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/message/MpAutoReplyConvert.java b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/message/MpAutoReplyConvert.java index 1f92c75fd..c33aa2449 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/message/MpAutoReplyConvert.java +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/message/MpAutoReplyConvert.java @@ -27,4 +27,6 @@ public interface MpAutoReplyConvert { PageResult convertPage(PageResult page); + MpAutoReplyRespVO convert(MpAutoReplyDO bean); + } diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/message/MpAutoReplyService.java b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/message/MpAutoReplyService.java index 75b8d2703..28278f2b5 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/message/MpAutoReplyService.java +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/message/MpAutoReplyService.java @@ -21,6 +21,14 @@ public interface MpAutoReplyService { */ PageResult getAutoReplyPage(MpMessagePageReqVO pageVO); + /** + * 获得公众号自动回复 + * + * @param id 编号 + * @return 自动回复 + */ + MpAutoReplyDO getAutoReply(Long id); + /** * 当收到消息时,自动回复 * diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/message/MpAutoReplyServiceImpl.java b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/message/MpAutoReplyServiceImpl.java index ad0410086..c818895ed 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/message/MpAutoReplyServiceImpl.java +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/message/MpAutoReplyServiceImpl.java @@ -44,6 +44,11 @@ public class MpAutoReplyServiceImpl implements MpAutoReplyService { return mpAutoReplyMapper.selectPage(pageVO); } + @Override + public MpAutoReplyDO getAutoReply(Long id) { + return mpAutoReplyMapper.selectById(id); + } + @Override public WxMpXmlOutMessage replyForMessage(String appId, WxMpXmlMessage wxMessage) { // 第一步,匹配自动回复 diff --git a/yudao-ui-admin/src/api/mp/autoReply.js b/yudao-ui-admin/src/api/mp/autoReply.js new file mode 100644 index 000000000..092773d2d --- /dev/null +++ b/yudao-ui-admin/src/api/mp/autoReply.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 创建公众号的自动回复 +export function createAutoReply(data) { + return request({ + url: '/mp/auto-reply/create', + method: 'post', + data: data + }) +} + +// 更新公众号的自动回复 +export function updateAutoReply(data) { + return request({ + url: '/mp/auto-reply/update', + method: 'put', + data: data + }) +} + +// 删除公众号的自动回复 +export function deleteAutoReply(id) { + return request({ + url: '/mp/auto-reply/delete?id=' + id, + method: 'delete' + }) +} + +// 获得公众号的自动回复 +export function getAutoReply(id) { + return request({ + url: '/mp/auto-reply/get?id=' + id, + method: 'get' + }) +} + +// 获得公众号的自动回复分页 +export function getAutoReplyPage(query) { + return request({ + url: '/mp/auto-reply/page', + method: 'get', + params: query + }) +} diff --git a/yudao-ui-admin/src/utils/dict.js b/yudao-ui-admin/src/utils/dict.js index 73ecc214f..f0aa7239d 100644 --- a/yudao-ui-admin/src/utils/dict.js +++ b/yudao-ui-admin/src/utils/dict.js @@ -58,6 +58,9 @@ export const DICT_TYPE = { PAY_REFUND_ORDER_STATUS: 'pay_refund_order_status', // 退款订单状态 PAY_REFUND_ORDER_TYPE: 'pay_refund_order_type', // 退款订单类别 + // ========== MP 模块 ========== + MP_AUTO_REPLY_REQUEST_MATCH: 'mp_auto_reply_request_match', // 自动回复请求匹配类型 + // ========== MALL - PRODUCT 模块 ========== PRODUCT_SPU_STATUS: 'product_spu_status', // 商品 SPU 状态 diff --git a/yudao-ui-admin/src/views/mp/autoReply/index.vue b/yudao-ui-admin/src/views/mp/autoReply/index.vue index 38150c7c7..586b1db23 100644 --- a/yudao-ui-admin/src/views/mp/autoReply/index.vue +++ b/yudao-ui-admin/src/views/mp/autoReply/index.vue @@ -22,6 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 芋道源码: ① 移除 avue 框架,使用 element-ui 重写 + ② 重写代码,保持和现有项目保持一致 -->