mp:重构部分 message 的实现

This commit is contained in:
YunaiV 2023-01-02 22:15:04 +08:00
parent 39d377b0bd
commit fefad029ad
46 changed files with 447 additions and 1187 deletions

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.mp.enums.message;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 微信公众号消息的发送来源
*
* @author 芋道源码
*/
@Getter
@AllArgsConstructor
public enum MpMessageSendFrom {
USER_TO_MP(1, "用户发送给公众号"),
MP_TO_USER(2, "公众号发给用户"),
;
/**
* 来源
*/
private final Integer from;
/**
* 来源的名字
*/
private final String name;
}

View File

@ -1,103 +0,0 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsg;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.mp.controller.admin.fansmsg.vo.*;
import cn.iocoder.yudao.module.mp.dal.dataobject.fansmsg.WxFansMsgDO;
import cn.iocoder.yudao.module.mp.convert.fansmsg.WxFansMsgConvert;
import cn.iocoder.yudao.module.mp.service.fansmsg.WxFansMsgService;
@Api(tags = "管理后台 - 粉丝消息表 ")
@RestController
@RequestMapping("/wechatMp/wx-fans-msg")
@Validated
public class WxFansMsgController {
@Resource
private WxFansMsgService wxFansMsgService;
@PostMapping("/create")
@ApiOperation("创建粉丝消息表 ")
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg:create')")
public CommonResult<Integer> createWxFansMsg(@Valid @RequestBody WxFansMsgCreateReqVO createReqVO) {
return success(wxFansMsgService.createWxFansMsg(createReqVO));
}
@PutMapping("/update")
@ApiOperation("更新粉丝消息表 ")
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg:update')")
public CommonResult<Boolean> updateWxFansMsg(@Valid @RequestBody WxFansMsgUpdateReqVO updateReqVO) {
wxFansMsgService.updateWxFansMsg(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@ApiOperation("删除粉丝消息表 ")
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class)
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg:delete')")
public CommonResult<Boolean> deleteWxFansMsg(@RequestParam("id") Integer id) {
wxFansMsgService.deleteWxFansMsg(id);
return success(true);
}
@GetMapping("/get")
@ApiOperation("获得粉丝消息表 ")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class)
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg:query')")
public CommonResult<WxFansMsgRespVO> getWxFansMsg(@RequestParam("id") Integer id) {
WxFansMsgDO wxFansMsg = wxFansMsgService.getWxFansMsg(id);
return success(WxFansMsgConvert.INSTANCE.convert(wxFansMsg));
}
@GetMapping("/list")
@ApiOperation("获得粉丝消息表 列表")
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg:query')")
public CommonResult<List<WxFansMsgRespVO>> getWxFansMsgList(@RequestParam("ids") Collection<Integer> ids) {
List<WxFansMsgDO> list = wxFansMsgService.getWxFansMsgList(ids);
return success(WxFansMsgConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@ApiOperation("获得粉丝消息表 分页")
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg:query')")
public CommonResult<PageResult<WxFansMsgRespVO>> getWxFansMsgPage(@Valid WxFansMsgPageReqVO pageVO) {
PageResult<WxFansMsgDO> pageResult = wxFansMsgService.getWxFansMsgPage(pageVO);
return success(WxFansMsgConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@ApiOperation("导出粉丝消息表 Excel")
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg:export')")
@OperateLog(type = EXPORT)
public void exportWxFansMsgExcel(@Valid WxFansMsgExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<WxFansMsgDO> list = wxFansMsgService.getWxFansMsgList(exportReqVO);
// 导出 Excel
List<WxFansMsgExcelVO> datas = WxFansMsgConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "粉丝消息表 .xls", "数据", WxFansMsgExcelVO.class, datas);
}
}

View File

@ -1,12 +0,0 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsg.vo;
import lombok.*;
import io.swagger.annotations.*;
@ApiModel("管理后台 - 粉丝消息表 创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class WxFansMsgCreateReqVO extends WxFansMsgBaseVO {
}

View File

@ -1,56 +0,0 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsg.vo;
import lombok.*;
import java.util.*;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* 粉丝消息表 Excel VO
*
* @author 芋道源码
*/
@Data
public class WxFansMsgExcelVO {
@ExcelProperty("主键")
private Integer id;
@ExcelProperty("用户标识")
private String openid;
@ExcelProperty("昵称")
private byte[] nickname;
@ExcelProperty("头像地址")
private String headimgUrl;
@ExcelProperty("微信账号ID")
private String wxAccountId;
@ExcelProperty("消息类型")
private String msgType;
@ExcelProperty("内容")
private String content;
@ExcelProperty("最近一条回复内容")
private String resContent;
@ExcelProperty("是否已回复")
private String isRes;
@ExcelProperty("微信素材ID")
private String mediaId;
@ExcelProperty("微信图片URL")
private String picUrl;
@ExcelProperty("本地图片路径")
private String picPath;
@ExcelProperty("创建时间")
private Date createTime;
}

View File

@ -1,57 +0,0 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsg.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel(value = "管理后台 - 粉丝消息表 Excel 导出 Request VO", description = "参数和 WxFansMsgPageReqVO 是一致的")
@Data
public class WxFansMsgExportReqVO {
@ApiModelProperty(value = "用户标识")
private String openid;
@ApiModelProperty(value = "昵称")
private String nickname;
@ApiModelProperty(value = "头像地址")
private String headimgUrl;
@ApiModelProperty(value = "微信账号ID")
private String wxAccountId;
@ApiModelProperty(value = "消息类型")
private String msgType;
@ApiModelProperty(value = "内容")
private String content;
@ApiModelProperty(value = "最近一条回复内容")
private String resContent;
@ApiModelProperty(value = "是否已回复")
private String isRes;
@ApiModelProperty(value = "微信素材ID")
private String mediaId;
@ApiModelProperty(value = "微信图片URL")
private String picUrl;
@ApiModelProperty(value = "本地图片路径")
private String picPath;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
}

View File

@ -1,60 +0,0 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsg.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 粉丝消息表 分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class WxFansMsgPageReqVO extends PageParam {
@ApiModelProperty(value = "用户标识")
private String openid;
@ApiModelProperty(value = "昵称")
private String nickname;
@ApiModelProperty(value = "头像地址")
private String headimgUrl;
@ApiModelProperty(value = "微信账号ID")
private String wxAccountId;
@ApiModelProperty(value = "消息类型")
private String msgType;
@ApiModelProperty(value = "内容")
private String content;
@ApiModelProperty(value = "最近一条回复内容")
private String resContent;
@ApiModelProperty(value = "是否已回复")
private String isRes;
@ApiModelProperty(value = "微信素材ID")
private String mediaId;
@ApiModelProperty(value = "微信图片URL")
private String picUrl;
@ApiModelProperty(value = "本地图片路径")
private String picPath;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
}

View File

@ -1,18 +0,0 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsg.vo;
import lombok.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
@ApiModel("管理后台 - 粉丝消息表 更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class WxFansMsgUpdateReqVO extends WxFansMsgBaseVO {
@ApiModelProperty(value = "主键", required = true)
@NotNull(message = "主键不能为空")
private Integer id;
}

View File

@ -1,103 +0,0 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsgres;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.mp.controller.admin.fansmsgres.vo.*;
import cn.iocoder.yudao.module.mp.dal.dataobject.fansmsgres.WxFansMsgResDO;
import cn.iocoder.yudao.module.mp.convert.fansmsgres.WxFansMsgResConvert;
import cn.iocoder.yudao.module.mp.service.fansmsgres.WxFansMsgResService;
@Api(tags = "管理后台 - 回复粉丝消息历史表 ")
@RestController
@RequestMapping("/wechatMp/wx-fans-msg-res")
@Validated
public class WxFansMsgResController {
@Resource
private WxFansMsgResService wxFansMsgResService;
@PostMapping("/create")
@ApiOperation("创建回复粉丝消息历史表 ")
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg-res:create')")
public CommonResult<Integer> createWxFansMsgRes(@Valid @RequestBody WxFansMsgResCreateReqVO createReqVO) {
return success(wxFansMsgResService.createWxFansMsgRes(createReqVO));
}
@PutMapping("/update")
@ApiOperation("更新回复粉丝消息历史表 ")
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg-res:update')")
public CommonResult<Boolean> updateWxFansMsgRes(@Valid @RequestBody WxFansMsgResUpdateReqVO updateReqVO) {
wxFansMsgResService.updateWxFansMsgRes(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@ApiOperation("删除回复粉丝消息历史表 ")
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class)
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg-res:delete')")
public CommonResult<Boolean> deleteWxFansMsgRes(@RequestParam("id") Integer id) {
wxFansMsgResService.deleteWxFansMsgRes(id);
return success(true);
}
@GetMapping("/get")
@ApiOperation("获得回复粉丝消息历史表 ")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class)
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg-res:query')")
public CommonResult<WxFansMsgResRespVO> getWxFansMsgRes(@RequestParam("id") Integer id) {
WxFansMsgResDO wxFansMsgRes = wxFansMsgResService.getWxFansMsgRes(id);
return success(WxFansMsgResConvert.INSTANCE.convert(wxFansMsgRes));
}
@GetMapping("/list")
@ApiOperation("获得回复粉丝消息历史表 列表")
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg-res:query')")
public CommonResult<List<WxFansMsgResRespVO>> getWxFansMsgResList(@RequestParam("ids") Collection<Integer> ids) {
List<WxFansMsgResDO> list = wxFansMsgResService.getWxFansMsgResList(ids);
return success(WxFansMsgResConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@ApiOperation("获得回复粉丝消息历史表 分页")
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg-res:query')")
public CommonResult<PageResult<WxFansMsgResRespVO>> getWxFansMsgResPage(@Valid WxFansMsgResPageReqVO pageVO) {
PageResult<WxFansMsgResDO> pageResult = wxFansMsgResService.getWxFansMsgResPage(pageVO);
return success(WxFansMsgResConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@ApiOperation("导出回复粉丝消息历史表 Excel")
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg-res:export')")
@OperateLog(type = EXPORT)
public void exportWxFansMsgResExcel(@Valid WxFansMsgResExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<WxFansMsgResDO> list = wxFansMsgResService.getWxFansMsgResList(exportReqVO);
// 导出 Excel
List<WxFansMsgResExcelVO> datas = WxFansMsgResConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "回复粉丝消息历史表 .xls", "数据", WxFansMsgResExcelVO.class, datas);
}
}

View File

@ -1,19 +0,0 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsgres.vo;
import lombok.*;
import io.swagger.annotations.*;
/**
* 回复粉丝消息历史表 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/
@Data
public class WxFansMsgResBaseVO {
@ApiModelProperty(value = "粉丝消息ID")
private String fansMsgId;
@ApiModelProperty(value = "回复内容")
private String resContent;
}

View File

@ -1,12 +0,0 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsgres.vo;
import lombok.*;
import io.swagger.annotations.*;
@ApiModel("管理后台 - 回复粉丝消息历史表 创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class WxFansMsgResCreateReqVO extends WxFansMsgResBaseVO {
}

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsgres.vo;
import lombok.*;
import java.util.*;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* 回复粉丝消息历史表 Excel VO
*
* @author 芋道源码
*/
@Data
public class WxFansMsgResExcelVO {
@ExcelProperty("主键")
private Integer id;
@ExcelProperty("粉丝消息ID")
private String fansMsgId;
@ExcelProperty("回复内容")
private String resContent;
@ExcelProperty("创建时间")
private Date createTime;
}

View File

@ -1,30 +0,0 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsgres.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel(value = "管理后台 - 回复粉丝消息历史表 Excel 导出 Request VO", description = "参数和 WxFansMsgResPageReqVO 是一致的")
@Data
public class WxFansMsgResExportReqVO {
@ApiModelProperty(value = "粉丝消息ID")
private String fansMsgId;
@ApiModelProperty(value = "回复内容")
private String resContent;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
}

View File

@ -1,33 +0,0 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsgres.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 回复粉丝消息历史表 分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class WxFansMsgResPageReqVO extends PageParam {
@ApiModelProperty(value = "粉丝消息ID")
private String fansMsgId;
@ApiModelProperty(value = "回复内容")
private String resContent;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
}

View File

@ -1,21 +0,0 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsgres.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
@ApiModel("管理后台 - 回复粉丝消息历史表 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class WxFansMsgResRespVO extends WxFansMsgResBaseVO {
@ApiModelProperty(value = "主键", required = true)
private Integer id;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@ -1,18 +0,0 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsgres.vo;
import lombok.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
@ApiModel("管理后台 - 回复粉丝消息历史表 更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class WxFansMsgResUpdateReqVO extends WxFansMsgResBaseVO {
@ApiModelProperty(value = "主键", required = true)
@NotNull(message = "主键不能为空")
private Integer id;
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.mp.controller.admin.message;
import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpMessageDO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.module.mp.controller.admin.message.vo.*;
import cn.iocoder.yudao.module.mp.convert.message.MpMessageConvert;
import cn.iocoder.yudao.module.mp.service.message.MpMessageService;
@Api(tags = "管理后台 - 粉丝消息表")
@RestController
@RequestMapping("/mp/message")
@Validated
public class MpMessageController {
@Resource
private MpMessageService mpMessageService;
@GetMapping("/page")
@ApiOperation("获得粉丝消息表分页")
@PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-msg:query')")
public CommonResult<PageResult<MpMessageRespVO>> getWxFansMsgPage(@Valid MpMessagePageReqVO pageVO) {
PageResult<MpMessageDO> pageResult = mpMessageService.getWxFansMsgPage(pageVO);
return success(MpMessageConvert.INSTANCE.convertPage(pageResult));
}
}

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsg.vo; package cn.iocoder.yudao.module.mp.controller.admin.message.vo;
import lombok.*; import lombok.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
@ -8,7 +8,7 @@ import io.swagger.annotations.*;
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
public class WxFansMsgBaseVO { public class MpMessageBaseVO {
@ApiModelProperty(value = "用户标识") @ApiModelProperty(value = "用户标识")
private String openid; private String openid;

View File

@ -0,0 +1,26 @@
package cn.iocoder.yudao.module.mp.controller.admin.message.vo;
import lombok.*;
import io.swagger.annotations.*;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
@ApiModel("管理后台 - 粉丝消息表分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MpMessagePageReqVO extends PageParam {
@ApiModelProperty(value = "用户标识")
private String openId;
@ApiModelProperty(value = "昵称")
private String nickname;
@ApiModelProperty(value = "微信账号ID")
private Long accountId;
@ApiModelProperty(value = "消息类型")
private String type;
}

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.mp.controller.admin.fansmsg.vo; package cn.iocoder.yudao.module.mp.controller.admin.message.vo;
import lombok.*; import lombok.*;
@ -10,7 +10,7 @@ import io.swagger.annotations.*;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class WxFansMsgRespVO extends WxFansMsgBaseVO { public class MpMessageRespVO extends MpMessageBaseVO {
@ApiModelProperty(value = "主键", required = true) @ApiModelProperty(value = "主键", required = true)
private Integer id; private Integer id;

View File

@ -1,34 +0,0 @@
package cn.iocoder.yudao.module.mp.convert.fansmsg;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.mp.controller.admin.fansmsg.vo.*;
import cn.iocoder.yudao.module.mp.dal.dataobject.fansmsg.WxFansMsgDO;
/**
* 粉丝消息表 Convert
*
* @author 芋道源码
*/
@Mapper
public interface WxFansMsgConvert {
WxFansMsgConvert INSTANCE = Mappers.getMapper(WxFansMsgConvert.class);
WxFansMsgDO convert(WxFansMsgCreateReqVO bean);
WxFansMsgDO convert(WxFansMsgUpdateReqVO bean);
WxFansMsgRespVO convert(WxFansMsgDO bean);
List<WxFansMsgRespVO> convertList(List<WxFansMsgDO> list);
PageResult<WxFansMsgRespVO> convertPage(PageResult<WxFansMsgDO> page);
List<WxFansMsgExcelVO> convertList02(List<WxFansMsgDO> list);
}

View File

@ -1,34 +0,0 @@
package cn.iocoder.yudao.module.mp.convert.fansmsgres;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.mp.controller.admin.fansmsgres.vo.*;
import cn.iocoder.yudao.module.mp.dal.dataobject.fansmsgres.WxFansMsgResDO;
/**
* 回复粉丝消息历史表 Convert
*
* @author 芋道源码
*/
@Mapper
public interface WxFansMsgResConvert {
WxFansMsgResConvert INSTANCE = Mappers.getMapper(WxFansMsgResConvert.class);
WxFansMsgResDO convert(WxFansMsgResCreateReqVO bean);
WxFansMsgResDO convert(WxFansMsgResUpdateReqVO bean);
WxFansMsgResRespVO convert(WxFansMsgResDO bean);
List<WxFansMsgResRespVO> convertList(List<WxFansMsgResDO> list);
PageResult<WxFansMsgResRespVO> convertPage(PageResult<WxFansMsgResDO> page);
List<WxFansMsgResExcelVO> convertList02(List<WxFansMsgResDO> list);
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.mp.convert.message;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpMessageDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.mp.controller.admin.message.vo.*;
@Mapper
public interface MpMessageConvert {
MpMessageConvert INSTANCE = Mappers.getMapper(MpMessageConvert.class);
MpMessageRespVO convert(MpMessageDO bean);
List<MpMessageRespVO> convertList(List<MpMessageDO> list);
PageResult<MpMessageRespVO> convertPage(PageResult<MpMessageDO> page);
}

View File

@ -1,75 +0,0 @@
package cn.iocoder.yudao.module.mp.dal.dataobject.fansmsg;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 粉丝消息表 DO
*
* @author 芋道源码
*/
@TableName("wx_fans_msg")
@KeySequence("wx_fans_msg_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxFansMsgDO extends BaseDO {
/**
* 主键
*/
@TableId
private Integer id;
/**
* 用户标识
*/
private String openid;
/**
* 昵称
*/
private byte[] nickname;
/**
* 头像地址
*/
private String headimgUrl;
/**
* 微信账号ID
*/
private String wxAccountId;
/**
* 消息类型
*/
private String msgType;
/**
* 内容
*/
private String content;
/**
* 最近一条回复内容
*/
private String resContent;
/**
* 是否已回复
*/
private String isRes;
/**
* 微信素材ID
*/
private String mediaId;
/**
* 微信图片URL
*/
private String picUrl;
/**
* 本地图片路径
*/
private String picPath;
}

View File

@ -1,39 +0,0 @@
package cn.iocoder.yudao.module.mp.dal.dataobject.fansmsgres;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 回复粉丝消息历史表 DO
*
* @author 芋道源码
*/
@TableName("wx_fans_msg_res")
@KeySequence("wx_fans_msg_res_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxFansMsgResDO extends BaseDO {
/**
* 主键
*/
@TableId
private Integer id;
/**
* 粉丝消息ID
*/
private String fansMsgId;
/**
* 回复内容
*/
private String resContent;
}

View File

@ -0,0 +1,206 @@
package cn.iocoder.yudao.module.mp.dal.dataobject.message;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO;
import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO;
import cn.iocoder.yudao.module.mp.enums.message.MpMessageSendFrom;
import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
import lombok.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import me.chanjar.weixin.common.api.WxConsts;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* 微信消息 DO
*
* @author 芋道源码
*/
@TableName(value = "mp_message", autoResultMap = true)
@KeySequence("mp_message_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MpMessageDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 微信公众号 ID
*
* 关联 {@link MpAccountDO#getId()}
*/
private Long accountId;
/**
* 微信公众号 appid
*
* 冗余 {@link MpAccountDO#getAppId()}
*/
private String appId;
/**
* 微信用户编号
*
* 关联 {@link MpUserDO#getId()}
*/
private Long userId;
/**
* 用户标识
*
* 冗余 {@link MpUserDO#getId()}
*/
private String openId;
// /**
// * 昵称
// */
// private String nickname;
// /**
// * 头像
// */
// private String headImageUrl;
/**
* 消息类型
*
* 枚举 {@link WxConsts.XmlMsgType}
*/
private String type;
/**
* 消息来源
*
* 枚举 {@link MpMessageSendFrom}
*/
private Integer sendFrom;
// ========= 消息内容 ==========
/**
* 消息内容
*
* 消息类型为 {@link WxConsts.XmlMsgType} TEXT
*/
private String content;
/**
* 通过素材管理中的接口上传多媒体文件得到的 id
*
* 消息类型为 {@link WxConsts.XmlMsgType} IMAGEVOICEVIDEO
*/
private String mediaId;
/**
* 标题
*
* 消息类型为 {@link WxConsts.XmlMsgType} VIDEOMUSIC
*/
private String title;
/**
* 描述
*
* 消息类型为 {@link WxConsts.XmlMsgType} VIDEOMUSIC
*/
private String description;
/**
* 音乐链接
*
* 消息类型为 {@link WxConsts.XmlMsgType} MUSIC
*/
private String musicURL;
/**
* 高质量音乐链接WIFI 环境优先使用该链接播放音乐
*
* 消息类型为 {@link WxConsts.XmlMsgType} MUSIC
*/
private String hqMusicUrl;
/**
* 缩略图的媒体 id通过素材管理中的接口上传多媒体文件得到的 id
*
* 消息类型为 {@link WxConsts.XmlMsgType} MUSIC
*/
private String thumbMediaId;
/**
* 图文消息个数限制为 10 条以内
*
* 消息类型为 {@link WxConsts.XmlMsgType} NEWS
*/
private Integer articleCount;
/**
* 图文消息数组
*
* 消息类型为 {@link WxConsts.XmlMsgType} NEWS
*/
@TableField(typeHandler = ArticleTypeHandler.class)
private List<Article> articles;
/**
* 地理位置维度
*
* 消息类型为 {@link WxConsts.XmlMsgType} LOCATION
*/
private Double locationX;
/**
* 地理位置经度
*
* 消息类型为 {@link WxConsts.XmlMsgType} LOCATION
*/
private Double locationY;
/**
* 地图缩放大小
*
* 消息类型为 {@link WxConsts.XmlMsgType} LOCATION
*/
private Double scale;
/**
* 文章
*/
@Data
public static class Article implements Serializable {
/**
* 图文消息标题
*/
private String title;
/**
* 图文消息描述
*/
private String description;
/**
* 图片链接
*
* 支持JPGPNG格式较好的效果为大图 360*200小图 200*200
*/
private String picUrl;
/**
* 点击图文消息跳转链接
*/
private String url;
}
// TODO @芋艿可以找一些新的思路
public static class ArticleTypeHandler extends AbstractJsonTypeHandler<List<Article>> {
@Override
protected List<Article> parse(String json) {
return JsonUtils.parseArray(json, Article.class);
}
@Override
protected String toJson(List<Article> obj) {
return JsonUtils.toJsonString(obj);
}
}
}

View File

@ -92,7 +92,7 @@ public class MpUserDO extends BaseDO {
/** /**
* 微信公众号 appid * 微信公众号 appid
* *
* 冗余{@link MpAccountDO#getAppId()} * 冗余 {@link MpAccountDO#getAppId()}
*/ */
private String appId; private String appId;

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.mp.dal.mysql.fansmsg;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.mp.controller.admin.message.vo.MpMessagePageReqVO;
import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpMessageDO;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MpMessageMapper extends BaseMapperX<MpMessageDO> {
default PageResult<MpMessageDO> selectPage(MpMessagePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MpMessageDO>()
.eqIfPresent(MpMessageDO::getAccountId, reqVO.getAccountId())
.eqIfPresent(MpMessageDO::getOpenId, reqVO.getOpenId())
// .likeIfPresent(MpMessageDO::getNickname, reqVO.getNickname())
.eqIfPresent(MpMessageDO::getType, reqVO.getType())
.orderByDesc(MpMessageDO::getId));
}
}

View File

@ -1,54 +0,0 @@
package cn.iocoder.yudao.module.mp.dal.mysql.fansmsg;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mp.dal.dataobject.fansmsg.WxFansMsgDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mp.controller.admin.fansmsg.vo.*;
/**
* 粉丝消息表 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface WxFansMsgMapper extends BaseMapperX<WxFansMsgDO> {
default PageResult<WxFansMsgDO> selectPage(WxFansMsgPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<WxFansMsgDO>()
.eqIfPresent(WxFansMsgDO::getOpenid, reqVO.getOpenid())
.likeIfPresent(WxFansMsgDO::getNickname, reqVO.getNickname())
.eqIfPresent(WxFansMsgDO::getHeadimgUrl, reqVO.getHeadimgUrl())
.eqIfPresent(WxFansMsgDO::getWxAccountId, reqVO.getWxAccountId())
.eqIfPresent(WxFansMsgDO::getMsgType, reqVO.getMsgType())
.eqIfPresent(WxFansMsgDO::getContent, reqVO.getContent())
.eqIfPresent(WxFansMsgDO::getResContent, reqVO.getResContent())
.eqIfPresent(WxFansMsgDO::getIsRes, reqVO.getIsRes())
.eqIfPresent(WxFansMsgDO::getMediaId, reqVO.getMediaId())
.eqIfPresent(WxFansMsgDO::getPicUrl, reqVO.getPicUrl())
.eqIfPresent(WxFansMsgDO::getPicPath, reqVO.getPicPath())
.betweenIfPresent(WxFansMsgDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.orderByDesc(WxFansMsgDO::getId));
}
default List<WxFansMsgDO> selectList(WxFansMsgExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<WxFansMsgDO>()
.eqIfPresent(WxFansMsgDO::getOpenid, reqVO.getOpenid())
.likeIfPresent(WxFansMsgDO::getNickname, reqVO.getNickname())
.eqIfPresent(WxFansMsgDO::getHeadimgUrl, reqVO.getHeadimgUrl())
.eqIfPresent(WxFansMsgDO::getWxAccountId, reqVO.getWxAccountId())
.eqIfPresent(WxFansMsgDO::getMsgType, reqVO.getMsgType())
.eqIfPresent(WxFansMsgDO::getContent, reqVO.getContent())
.eqIfPresent(WxFansMsgDO::getResContent, reqVO.getResContent())
.eqIfPresent(WxFansMsgDO::getIsRes, reqVO.getIsRes())
.eqIfPresent(WxFansMsgDO::getMediaId, reqVO.getMediaId())
.eqIfPresent(WxFansMsgDO::getPicUrl, reqVO.getPicUrl())
.eqIfPresent(WxFansMsgDO::getPicPath, reqVO.getPicPath())
.betweenIfPresent(WxFansMsgDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.orderByDesc(WxFansMsgDO::getId));
}
}

View File

@ -1,36 +0,0 @@
package cn.iocoder.yudao.module.mp.dal.mysql.fansmsgres;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mp.dal.dataobject.fansmsgres.WxFansMsgResDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mp.controller.admin.fansmsgres.vo.*;
/**
* 回复粉丝消息历史表 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface WxFansMsgResMapper extends BaseMapperX<WxFansMsgResDO> {
default PageResult<WxFansMsgResDO> selectPage(WxFansMsgResPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<WxFansMsgResDO>()
.eqIfPresent(WxFansMsgResDO::getFansMsgId, reqVO.getFansMsgId())
.eqIfPresent(WxFansMsgResDO::getResContent, reqVO.getResContent())
.betweenIfPresent(WxFansMsgResDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.orderByDesc(WxFansMsgResDO::getId));
}
default List<WxFansMsgResDO> selectList(WxFansMsgResExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<WxFansMsgResDO>()
.eqIfPresent(WxFansMsgResDO::getFansMsgId, reqVO.getFansMsgId())
.eqIfPresent(WxFansMsgResDO::getResContent, reqVO.getResContent())
.betweenIfPresent(WxFansMsgResDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.orderByDesc(WxFansMsgResDO::getId));
}
}

View File

@ -2,8 +2,14 @@ package cn.iocoder.yudao.module.mp.framework.mp.config;
import cn.iocoder.yudao.module.mp.framework.mp.core.DefaultMpServiceFactory; import cn.iocoder.yudao.module.mp.framework.mp.core.DefaultMpServiceFactory;
import cn.iocoder.yudao.module.mp.framework.mp.core.MpServiceFactory; import cn.iocoder.yudao.module.mp.framework.mp.core.MpServiceFactory;
import cn.iocoder.yudao.module.mp.service.fansmsgres.NullHandler; import cn.iocoder.yudao.module.mp.service.handler.menu.MenuHandler;
import cn.iocoder.yudao.module.mp.service.handler.*; import cn.iocoder.yudao.module.mp.service.handler.message.MessageLogHandler;
import cn.iocoder.yudao.module.mp.service.handler.message.MessageAutoReplyHandler;
import cn.iocoder.yudao.module.mp.service.handler.other.KfSessionHandler;
import cn.iocoder.yudao.module.mp.service.handler.other.NullHandler;
import cn.iocoder.yudao.module.mp.service.handler.other.ScanHandler;
import cn.iocoder.yudao.module.mp.service.handler.other.StoreCheckNotifyHandler;
import cn.iocoder.yudao.module.mp.service.handler.user.LocationHandler;
import cn.iocoder.yudao.module.mp.service.handler.user.SubscribeHandler; import cn.iocoder.yudao.module.mp.service.handler.user.SubscribeHandler;
import cn.iocoder.yudao.module.mp.service.handler.user.UnsubscribeHandler; import cn.iocoder.yudao.module.mp.service.handler.user.UnsubscribeHandler;
import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties; import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties;
@ -30,7 +36,7 @@ public class MpConfiguration {
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
public MpServiceFactory mpServiceFactory(RedisTemplateWxRedisOps redisTemplateWxRedisOps, public MpServiceFactory mpServiceFactory(RedisTemplateWxRedisOps redisTemplateWxRedisOps,
WxMpProperties wxMpProperties, WxMpProperties wxMpProperties,
LogHandler logHandler, MessageLogHandler logHandler,
KfSessionHandler kfSessionHandler, KfSessionHandler kfSessionHandler,
StoreCheckNotifyHandler storeCheckNotifyHandler, StoreCheckNotifyHandler storeCheckNotifyHandler,
MenuHandler menuHandler, MenuHandler menuHandler,
@ -39,7 +45,7 @@ public class MpConfiguration {
UnsubscribeHandler unsubscribeHandler, UnsubscribeHandler unsubscribeHandler,
LocationHandler locationHandler, LocationHandler locationHandler,
ScanHandler scanHandler, ScanHandler scanHandler,
DefaultMessageHandler msgHandler) { MessageAutoReplyHandler msgHandler) {
return new DefaultMpServiceFactory(redisTemplateWxRedisOps, wxMpProperties, return new DefaultMpServiceFactory(redisTemplateWxRedisOps, wxMpProperties,
logHandler, kfSessionHandler, storeCheckNotifyHandler, menuHandler, logHandler, kfSessionHandler, storeCheckNotifyHandler, menuHandler,
nullHandler, subscribeHandler, unsubscribeHandler, locationHandler, scanHandler, msgHandler); nullHandler, subscribeHandler, unsubscribeHandler, locationHandler, scanHandler, msgHandler);

View File

@ -1,8 +1,14 @@
package cn.iocoder.yudao.module.mp.framework.mp.core; package cn.iocoder.yudao.module.mp.framework.mp.core;
import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO; import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO;
import cn.iocoder.yudao.module.mp.service.fansmsgres.NullHandler; import cn.iocoder.yudao.module.mp.service.handler.menu.MenuHandler;
import cn.iocoder.yudao.module.mp.service.handler.*; import cn.iocoder.yudao.module.mp.service.handler.message.MessageLogHandler;
import cn.iocoder.yudao.module.mp.service.handler.message.MessageAutoReplyHandler;
import cn.iocoder.yudao.module.mp.service.handler.other.KfSessionHandler;
import cn.iocoder.yudao.module.mp.service.handler.other.NullHandler;
import cn.iocoder.yudao.module.mp.service.handler.other.ScanHandler;
import cn.iocoder.yudao.module.mp.service.handler.other.StoreCheckNotifyHandler;
import cn.iocoder.yudao.module.mp.service.handler.user.LocationHandler;
import cn.iocoder.yudao.module.mp.service.handler.user.SubscribeHandler; import cn.iocoder.yudao.module.mp.service.handler.user.SubscribeHandler;
import cn.iocoder.yudao.module.mp.service.handler.user.UnsubscribeHandler; import cn.iocoder.yudao.module.mp.service.handler.user.UnsubscribeHandler;
import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties; import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties;
@ -43,7 +49,7 @@ public class DefaultMpServiceFactory implements MpServiceFactory {
// ========== 各种 Handler ========== // ========== 各种 Handler ==========
private final LogHandler logHandler; private final MessageLogHandler logHandler;
private final KfSessionHandler kfSessionHandler; private final KfSessionHandler kfSessionHandler;
private final StoreCheckNotifyHandler storeCheckNotifyHandler; private final StoreCheckNotifyHandler storeCheckNotifyHandler;
private final MenuHandler menuHandler; private final MenuHandler menuHandler;
@ -52,7 +58,7 @@ public class DefaultMpServiceFactory implements MpServiceFactory {
private final UnsubscribeHandler unsubscribeHandler; private final UnsubscribeHandler unsubscribeHandler;
private final LocationHandler locationHandler; private final LocationHandler locationHandler;
private final ScanHandler scanHandler; private final ScanHandler scanHandler;
private final DefaultMessageHandler msgHandler; private final MessageAutoReplyHandler msgHandler;
@Override @Override
public void init(List<MpAccountDO> list) { public void init(List<MpAccountDO> list) {

View File

@ -1,71 +0,0 @@
package cn.iocoder.yudao.module.mp.service.fansmsg;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.mp.controller.admin.fansmsg.vo.*;
import cn.iocoder.yudao.module.mp.dal.dataobject.fansmsg.WxFansMsgDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* 粉丝消息表 Service 接口
*
* @author 芋道源码
*/
public interface WxFansMsgService {
/**
* 创建粉丝消息表
*
* @param createReqVO 创建信息
* @return 编号
*/
Integer createWxFansMsg(@Valid WxFansMsgCreateReqVO createReqVO);
/**
* 更新粉丝消息表
*
* @param updateReqVO 更新信息
*/
void updateWxFansMsg(@Valid WxFansMsgUpdateReqVO updateReqVO);
/**
* 删除粉丝消息表
*
* @param id 编号
*/
void deleteWxFansMsg(Integer id);
/**
* 获得粉丝消息表
*
* @param id 编号
* @return 粉丝消息表
*/
WxFansMsgDO getWxFansMsg(Integer id);
/**
* 获得粉丝消息表 列表
*
* @param ids 编号
* @return 粉丝消息表 列表
*/
List<WxFansMsgDO> getWxFansMsgList(Collection<Integer> ids);
/**
* 获得粉丝消息表 分页
*
* @param pageReqVO 分页查询
* @return 粉丝消息表 分页
*/
PageResult<WxFansMsgDO> getWxFansMsgPage(WxFansMsgPageReqVO pageReqVO);
/**
* 获得粉丝消息表 列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 粉丝消息表 列表
*/
List<WxFansMsgDO> getWxFansMsgList(WxFansMsgExportReqVO exportReqVO);
}

View File

@ -1,85 +0,0 @@
package cn.iocoder.yudao.module.mp.service.fansmsg;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.mp.controller.admin.fansmsg.vo.*;
import cn.iocoder.yudao.module.mp.dal.dataobject.fansmsg.WxFansMsgDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.mp.convert.fansmsg.WxFansMsgConvert;
import cn.iocoder.yudao.module.mp.dal.mysql.fansmsg.WxFansMsgMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants.*;
/**
* 粉丝消息表 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class WxFansMsgServiceImpl implements WxFansMsgService {
@Resource
private WxFansMsgMapper wxFansMsgMapper;
@Override
public Integer createWxFansMsg(WxFansMsgCreateReqVO createReqVO) {
// 插入
WxFansMsgDO wxFansMsg = WxFansMsgConvert.INSTANCE.convert(createReqVO);
wxFansMsgMapper.insert(wxFansMsg);
// 返回
return wxFansMsg.getId();
}
@Override
public void updateWxFansMsg(WxFansMsgUpdateReqVO updateReqVO) {
// 校验存在
this.validateWxFansMsgExists(updateReqVO.getId());
// 更新
WxFansMsgDO updateObj = WxFansMsgConvert.INSTANCE.convert(updateReqVO);
wxFansMsgMapper.updateById(updateObj);
}
@Override
public void deleteWxFansMsg(Integer id) {
// 校验存在
this.validateWxFansMsgExists(id);
// 删除
wxFansMsgMapper.deleteById(id);
}
private void validateWxFansMsgExists(Integer id) {
if (wxFansMsgMapper.selectById(id) == null) {
throw exception(COMMON_NOT_EXISTS);
}
}
@Override
public WxFansMsgDO getWxFansMsg(Integer id) {
return wxFansMsgMapper.selectById(id);
}
@Override
public List<WxFansMsgDO> getWxFansMsgList(Collection<Integer> ids) {
return wxFansMsgMapper.selectBatchIds(ids);
}
@Override
public PageResult<WxFansMsgDO> getWxFansMsgPage(WxFansMsgPageReqVO pageReqVO) {
return wxFansMsgMapper.selectPage(pageReqVO);
}
@Override
public List<WxFansMsgDO> getWxFansMsgList(WxFansMsgExportReqVO exportReqVO) {
return wxFansMsgMapper.selectList(exportReqVO);
}
}

View File

@ -1,71 +0,0 @@
package cn.iocoder.yudao.module.mp.service.fansmsgres;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.mp.controller.admin.fansmsgres.vo.*;
import cn.iocoder.yudao.module.mp.dal.dataobject.fansmsgres.WxFansMsgResDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* 回复粉丝消息历史表 Service 接口
*
* @author 芋道源码
*/
public interface WxFansMsgResService {
/**
* 创建回复粉丝消息历史表
*
* @param createReqVO 创建信息
* @return 编号
*/
Integer createWxFansMsgRes(@Valid WxFansMsgResCreateReqVO createReqVO);
/**
* 更新回复粉丝消息历史表
*
* @param updateReqVO 更新信息
*/
void updateWxFansMsgRes(@Valid WxFansMsgResUpdateReqVO updateReqVO);
/**
* 删除回复粉丝消息历史表
*
* @param id 编号
*/
void deleteWxFansMsgRes(Integer id);
/**
* 获得回复粉丝消息历史表
*
* @param id 编号
* @return 回复粉丝消息历史表
*/
WxFansMsgResDO getWxFansMsgRes(Integer id);
/**
* 获得回复粉丝消息历史表 列表
*
* @param ids 编号
* @return 回复粉丝消息历史表 列表
*/
List<WxFansMsgResDO> getWxFansMsgResList(Collection<Integer> ids);
/**
* 获得回复粉丝消息历史表 分页
*
* @param pageReqVO 分页查询
* @return 回复粉丝消息历史表 分页
*/
PageResult<WxFansMsgResDO> getWxFansMsgResPage(WxFansMsgResPageReqVO pageReqVO);
/**
* 获得回复粉丝消息历史表 列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 回复粉丝消息历史表 列表
*/
List<WxFansMsgResDO> getWxFansMsgResList(WxFansMsgResExportReqVO exportReqVO);
}

View File

@ -1,85 +0,0 @@
package cn.iocoder.yudao.module.mp.service.fansmsgres;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.mp.controller.admin.fansmsgres.vo.*;
import cn.iocoder.yudao.module.mp.dal.dataobject.fansmsgres.WxFansMsgResDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.mp.convert.fansmsgres.WxFansMsgResConvert;
import cn.iocoder.yudao.module.mp.dal.mysql.fansmsgres.WxFansMsgResMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants.*;
/**
* 回复粉丝消息历史表 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class WxFansMsgResServiceImpl implements WxFansMsgResService {
@Resource
private WxFansMsgResMapper wxFansMsgResMapper;
@Override
public Integer createWxFansMsgRes(WxFansMsgResCreateReqVO createReqVO) {
// 插入
WxFansMsgResDO wxFansMsgRes = WxFansMsgResConvert.INSTANCE.convert(createReqVO);
wxFansMsgResMapper.insert(wxFansMsgRes);
// 返回
return wxFansMsgRes.getId();
}
@Override
public void updateWxFansMsgRes(WxFansMsgResUpdateReqVO updateReqVO) {
// 校验存在
this.validateWxFansMsgResExists(updateReqVO.getId());
// 更新
WxFansMsgResDO updateObj = WxFansMsgResConvert.INSTANCE.convert(updateReqVO);
wxFansMsgResMapper.updateById(updateObj);
}
@Override
public void deleteWxFansMsgRes(Integer id) {
// 校验存在
this.validateWxFansMsgResExists(id);
// 删除
wxFansMsgResMapper.deleteById(id);
}
private void validateWxFansMsgResExists(Integer id) {
if (wxFansMsgResMapper.selectById(id) == null) {
throw exception(COMMON_NOT_EXISTS);
}
}
@Override
public WxFansMsgResDO getWxFansMsgRes(Integer id) {
return wxFansMsgResMapper.selectById(id);
}
@Override
public List<WxFansMsgResDO> getWxFansMsgResList(Collection<Integer> ids) {
return wxFansMsgResMapper.selectBatchIds(ids);
}
@Override
public PageResult<WxFansMsgResDO> getWxFansMsgResPage(WxFansMsgResPageReqVO pageReqVO) {
return wxFansMsgResMapper.selectPage(pageReqVO);
}
@Override
public List<WxFansMsgResDO> getWxFansMsgResList(WxFansMsgResExportReqVO exportReqVO) {
return wxFansMsgResMapper.selectList(exportReqVO);
}
}

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.mp.service.handler; package cn.iocoder.yudao.module.mp.service.handler.menu;
import me.chanjar.weixin.common.session.WxSessionManager; import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpMessageHandler; import me.chanjar.weixin.mp.api.WxMpMessageHandler;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.mp.service.handler; package cn.iocoder.yudao.module.mp.service.handler.message;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.http.HtmlUtil; import cn.hutool.http.HtmlUtil;
@ -6,10 +6,9 @@ import cn.hutool.http.HttpUtil;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.module.infra.api.file.FileApi; import cn.iocoder.yudao.module.infra.api.file.FileApi;
import cn.iocoder.yudao.module.mp.builder.TextBuilder; import cn.iocoder.yudao.module.mp.builder.TextBuilder;
import cn.iocoder.yudao.module.mp.controller.admin.fansmsg.vo.WxFansMsgCreateReqVO;
import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO; import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO;
import cn.iocoder.yudao.module.mp.service.account.MpAccountService; import cn.iocoder.yudao.module.mp.service.account.MpAccountService;
import cn.iocoder.yudao.module.mp.service.fansmsg.WxFansMsgService; import cn.iocoder.yudao.module.mp.service.message.MpMessageService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.api.WxConsts; import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.error.WxErrorException;
@ -20,7 +19,6 @@ import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import me.chanjar.weixin.mp.bean.result.WxMpUser; import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -30,20 +28,20 @@ import java.io.UnsupportedEncodingException;
import java.util.Map; import java.util.Map;
/** /**
* 默认所有消息的事件处理器 * 自动回复消息的事件处理器
* *
* // TODO 芋艿待实现 * @author 芋道源码
*/ */
@Component @Component
@Slf4j @Slf4j
public class DefaultMessageHandler implements WxMpMessageHandler { public class MessageAutoReplyHandler implements WxMpMessageHandler {
@Resource @Resource
@Lazy // 延迟加载解决循环依赖的问题 @Lazy // 延迟加载解决循环依赖的问题
private MpAccountService mpAccountService; private MpAccountService mpAccountService;
@Autowired @Resource
private WxFansMsgService wxFansMsgService; private MpMessageService mpMessageService;
@Resource @Resource
private FileApi fileApi; private FileApi fileApi;
@ -84,7 +82,7 @@ public class DefaultMessageHandler implements WxMpMessageHandler {
content = HtmlUtil.escape(content); content = HtmlUtil.escape(content);
wxFansMsg.setResContent(content); wxFansMsg.setResContent(content);
wxFansMsgService.createWxFansMsg(wxFansMsg); mpMessageService.createWxFansMsg(wxFansMsg);
return new TextBuilder().build(content, wxMessage, weixinService); return new TextBuilder().build(content, wxMessage, weixinService);
} }
@ -112,7 +110,7 @@ public class DefaultMessageHandler implements WxMpMessageHandler {
log.info("download pic size : {}", size); log.info("download pic size : {}", size);
wxFansMsg.setPicPath(filepath); wxFansMsg.setPicPath(filepath);
wxFansMsg.setIsRes("0"); wxFansMsg.setIsRes("0");
wxFansMsgService.createWxFansMsg(wxFansMsg); mpMessageService.createWxFansMsg(wxFansMsg);
} }
} }

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.mp.service.handler; package cn.iocoder.yudao.module.mp.service.handler.message;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -18,7 +18,7 @@ import java.util.Map;
*/ */
@Component @Component
@Slf4j @Slf4j
public class LogHandler implements WxMpMessageHandler { public class MessageLogHandler implements WxMpMessageHandler {
@Override @Override
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context,

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.mp.service.handler; package cn.iocoder.yudao.module.mp.service.handler.other;
import me.chanjar.weixin.common.session.WxSessionManager; import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpMessageHandler; import me.chanjar.weixin.mp.api.WxMpMessageHandler;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.mp.service.fansmsgres; package cn.iocoder.yudao.module.mp.service.handler.other;
import me.chanjar.weixin.common.session.WxSessionManager; import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpMessageHandler; import me.chanjar.weixin.mp.api.WxMpMessageHandler;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.mp.service.handler; package cn.iocoder.yudao.module.mp.service.handler.other;
import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.session.WxSessionManager; import me.chanjar.weixin.common.session.WxSessionManager;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.mp.service.handler; package cn.iocoder.yudao.module.mp.service.handler.other;
import me.chanjar.weixin.common.session.WxSessionManager; import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpMessageHandler; import me.chanjar.weixin.mp.api.WxMpMessageHandler;

View File

@ -0,0 +1,4 @@
/**
* 本包内的 handler 都是一些不重要的所以放在 other 其它里
*/
package cn.iocoder.yudao.module.mp.service.handler.other;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.mp.service.handler; package cn.iocoder.yudao.module.mp.service.handler.user;
import cn.iocoder.yudao.module.mp.builder.TextBuilder; import cn.iocoder.yudao.module.mp.builder.TextBuilder;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.mp.service.message;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.mp.controller.admin.message.vo.MpMessagePageReqVO;
import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpMessageDO;
/**
* 粉丝消息表 Service 接口
*
* @author 芋道源码
*/
public interface MpMessageService {
/**
* 获得粉丝消息表 分页
*
* @param pageReqVO 分页查询
* @return 粉丝消息表 分页
*/
PageResult<MpMessageDO> getWxFansMsgPage(MpMessagePageReqVO pageReqVO);
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.mp.service.message;
import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpMessageDO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.module.mp.controller.admin.message.vo.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.mp.dal.mysql.fansmsg.MpMessageMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
/**
* 粉丝消息表 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class MpMessageServiceImpl implements MpMessageService {
@Resource
private MpMessageMapper mpMessageMapper;
@Override
public PageResult<MpMessageDO> getWxFansMsgPage(MpMessagePageReqVO pageReqVO) {
return mpMessageMapper.selectPage(pageReqVO);
}
}