mp:增加【自动回复】的前端实现

This commit is contained in:
YunaiV
2023-01-17 00:01:07 +08:00
parent ab41c96641
commit 1e402d8063
9 changed files with 239 additions and 112 deletions

View File

@ -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<MpAutoReplyRespVO> getAutoReply(@RequestParam("id") Long id) {
MpAutoReplyDO autoReply = mpAutoReplyService.getAutoReply(id);
return success(MpAutoReplyConvert.INSTANCE.convert(autoReply));
}
}

View File

@ -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 时,必填")

View File

@ -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;
}

View File

@ -27,4 +27,6 @@ public interface MpAutoReplyConvert {
PageResult<MpAutoReplyRespVO> convertPage(PageResult<MpAutoReplyDO> page);
MpAutoReplyRespVO convert(MpAutoReplyDO bean);
}

View File

@ -21,6 +21,14 @@ public interface MpAutoReplyService {
*/
PageResult<MpAutoReplyDO> getAutoReplyPage(MpMessagePageReqVO pageVO);
/**
* 获得公众号自动回复
*
* @param id 编号
* @return 自动回复
*/
MpAutoReplyDO getAutoReply(Long id);
/**
* 当收到消息时,自动回复
*

View File

@ -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) {
// 第一步,匹配自动回复