Commit 48bea21a46067daa1c35ddff7a57f98661e00527
1 parent
3cf85753
mp:清理冗余代码
Showing
37 changed files
with
149 additions
and
1518 deletions
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/builder/AbstractBuilder.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.builder; | |
| 2 | - | |
| 3 | -import me.chanjar.weixin.mp.api.WxMpService; | |
| 4 | -import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |
| 5 | -import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |
| 6 | -import org.slf4j.Logger; | |
| 7 | -import org.slf4j.LoggerFactory; | |
| 8 | - | |
| 9 | -// TODO @亚洲:看看是不是可以使用 convert 来做,更符合项目 | |
| 10 | -public abstract class AbstractBuilder { | |
| 11 | - protected final Logger logger = LoggerFactory.getLogger(getClass()); | |
| 12 | - | |
| 13 | - public abstract WxMpXmlOutMessage build(String content, | |
| 14 | - WxMpXmlMessage wxMessage, WxMpService service); | |
| 15 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/builder/ImageBuilder.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.builder; | |
| 2 | - | |
| 3 | -import me.chanjar.weixin.mp.api.WxMpService; | |
| 4 | -import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |
| 5 | -import me.chanjar.weixin.mp.bean.message.WxMpXmlOutImageMessage; | |
| 6 | -import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |
| 7 | - | |
| 8 | -public class ImageBuilder extends AbstractBuilder { | |
| 9 | - | |
| 10 | - @Override | |
| 11 | - public WxMpXmlOutMessage build(String content, WxMpXmlMessage wxMessage, | |
| 12 | - WxMpService service) { | |
| 13 | - | |
| 14 | - WxMpXmlOutImageMessage m = WxMpXmlOutMessage.IMAGE().mediaId(content) | |
| 15 | - .fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser()) | |
| 16 | - .build(); | |
| 17 | - | |
| 18 | - return m; | |
| 19 | - } | |
| 20 | - | |
| 21 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/builder/TextBuilder.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.builder; | |
| 2 | - | |
| 3 | -import me.chanjar.weixin.mp.api.WxMpService; | |
| 4 | -import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |
| 5 | -import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |
| 6 | -import me.chanjar.weixin.mp.bean.message.WxMpXmlOutTextMessage; | |
| 7 | - | |
| 8 | -public class TextBuilder extends AbstractBuilder { | |
| 9 | - | |
| 10 | - @Override | |
| 11 | - public WxMpXmlOutMessage build(String content, WxMpXmlMessage wxMessage, | |
| 12 | - WxMpService service) { | |
| 13 | - WxMpXmlOutTextMessage m = WxMpXmlOutMessage.TEXT().content(content) | |
| 14 | - .fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser()) | |
| 15 | - .build(); | |
| 16 | - return m; | |
| 17 | - } | |
| 18 | - | |
| 19 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newsarticleitem/WxNewsArticleItemController.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newsarticleitem; | |
| 2 | - | |
| 3 | -import org.springframework.web.bind.annotation.*; | |
| 4 | - | |
| 5 | -import javax.annotation.Resource; | |
| 6 | - | |
| 7 | -import org.springframework.validation.annotation.Validated; | |
| 8 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 9 | -import io.swagger.annotations.*; | |
| 10 | - | |
| 11 | -import javax.validation.*; | |
| 12 | -import javax.servlet.http.*; | |
| 13 | -import java.util.*; | |
| 14 | -import java.io.IOException; | |
| 15 | - | |
| 16 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 17 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 18 | - | |
| 19 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 20 | - | |
| 21 | -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 22 | - | |
| 23 | -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | |
| 24 | - | |
| 25 | -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; | |
| 26 | - | |
| 27 | -import cn.iocoder.yudao.module.mp.controller.admin.newsarticleitem.vo.*; | |
| 28 | -import cn.iocoder.yudao.module.mp.dal.dataobject.newsarticleitem.WxNewsArticleItemDO; | |
| 29 | -import cn.iocoder.yudao.module.mp.convert.newsarticleitem.WxNewsArticleItemConvert; | |
| 30 | -import cn.iocoder.yudao.module.mp.service.newsarticleitem.WxNewsArticleItemService; | |
| 31 | - | |
| 32 | -@Api(tags = "管理后台 - 图文消息文章列表表 ") | |
| 33 | -@RestController | |
| 34 | -@RequestMapping("/wechatMp/wx-news-article-item") | |
| 35 | -@Validated | |
| 36 | -public class WxNewsArticleItemController { | |
| 37 | - | |
| 38 | - @Resource | |
| 39 | - private WxNewsArticleItemService wxNewsArticleItemService; | |
| 40 | - | |
| 41 | - @PostMapping("/create") | |
| 42 | - @ApiOperation("创建图文消息文章列表表 ") | |
| 43 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-news-article-item:create')") | |
| 44 | - public CommonResult<Integer> createWxNewsArticleItem(@Valid @RequestBody WxNewsArticleItemCreateReqVO createReqVO) { | |
| 45 | - return success(wxNewsArticleItemService.createWxNewsArticleItem(createReqVO)); | |
| 46 | - } | |
| 47 | - | |
| 48 | - @PutMapping("/update") | |
| 49 | - @ApiOperation("更新图文消息文章列表表 ") | |
| 50 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-news-article-item:update')") | |
| 51 | - public CommonResult<Boolean> updateWxNewsArticleItem(@Valid @RequestBody WxNewsArticleItemUpdateReqVO updateReqVO) { | |
| 52 | - wxNewsArticleItemService.updateWxNewsArticleItem(updateReqVO); | |
| 53 | - return success(true); | |
| 54 | - } | |
| 55 | - | |
| 56 | - @DeleteMapping("/delete") | |
| 57 | - @ApiOperation("删除图文消息文章列表表 ") | |
| 58 | - @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class) | |
| 59 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-news-article-item:delete')") | |
| 60 | - public CommonResult<Boolean> deleteWxNewsArticleItem(@RequestParam("id") Integer id) { | |
| 61 | - wxNewsArticleItemService.deleteWxNewsArticleItem(id); | |
| 62 | - return success(true); | |
| 63 | - } | |
| 64 | - | |
| 65 | - @GetMapping("/get") | |
| 66 | - @ApiOperation("获得图文消息文章列表表 ") | |
| 67 | - @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class) | |
| 68 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-news-article-item:query')") | |
| 69 | - public CommonResult<WxNewsArticleItemRespVO> getWxNewsArticleItem(@RequestParam("id") Integer id) { | |
| 70 | - WxNewsArticleItemDO wxNewsArticleItem = wxNewsArticleItemService.getWxNewsArticleItem(id); | |
| 71 | - return success(WxNewsArticleItemConvert.INSTANCE.convert(wxNewsArticleItem)); | |
| 72 | - } | |
| 73 | - | |
| 74 | - @GetMapping("/list") | |
| 75 | - @ApiOperation("获得图文消息文章列表表 列表") | |
| 76 | - @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) | |
| 77 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-news-article-item:query')") | |
| 78 | - public CommonResult<List<WxNewsArticleItemRespVO>> getWxNewsArticleItemList(@RequestParam("ids") Collection<Integer> ids) { | |
| 79 | - List<WxNewsArticleItemDO> list = wxNewsArticleItemService.getWxNewsArticleItemList(ids); | |
| 80 | - return success(WxNewsArticleItemConvert.INSTANCE.convertList(list)); | |
| 81 | - } | |
| 82 | - | |
| 83 | - @GetMapping("/page") | |
| 84 | - @ApiOperation("获得图文消息文章列表表 分页") | |
| 85 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-news-article-item:query')") | |
| 86 | - public CommonResult<PageResult<WxNewsArticleItemRespVO>> getWxNewsArticleItemPage(@Valid WxNewsArticleItemPageReqVO pageVO) { | |
| 87 | - PageResult<WxNewsArticleItemDO> pageResult = wxNewsArticleItemService.getWxNewsArticleItemPage(pageVO); | |
| 88 | - return success(WxNewsArticleItemConvert.INSTANCE.convertPage(pageResult)); | |
| 89 | - } | |
| 90 | - | |
| 91 | - @GetMapping("/export-excel") | |
| 92 | - @ApiOperation("导出图文消息文章列表表 Excel") | |
| 93 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-news-article-item:export')") | |
| 94 | - @OperateLog(type = EXPORT) | |
| 95 | - public void exportWxNewsArticleItemExcel(@Valid WxNewsArticleItemExportReqVO exportReqVO, | |
| 96 | - HttpServletResponse response) throws IOException { | |
| 97 | - List<WxNewsArticleItemDO> list = wxNewsArticleItemService.getWxNewsArticleItemList(exportReqVO); | |
| 98 | - // 导出 Excel | |
| 99 | - List<WxNewsArticleItemExcelVO> datas = WxNewsArticleItemConvert.INSTANCE.convertList02(list); | |
| 100 | - ExcelUtils.write(response, "图文消息文章列表表 .xls", "数据", WxNewsArticleItemExcelVO.class, datas); | |
| 101 | - } | |
| 102 | - | |
| 103 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newsarticleitem/vo/WxNewsArticleItemBaseVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newsarticleitem.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import io.swagger.annotations.*; | |
| 5 | - | |
| 6 | -/** | |
| 7 | - * 图文消息文章列表表 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 8 | - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 9 | - */ | |
| 10 | -@Data | |
| 11 | -public class WxNewsArticleItemBaseVO { | |
| 12 | - | |
| 13 | - @ApiModelProperty(value = "标题") | |
| 14 | - private String title; | |
| 15 | - | |
| 16 | - @ApiModelProperty(value = "摘要") | |
| 17 | - private String digest; | |
| 18 | - | |
| 19 | - @ApiModelProperty(value = "作者") | |
| 20 | - private String author; | |
| 21 | - | |
| 22 | - @ApiModelProperty(value = "是否展示封面图片(0/1)") | |
| 23 | - private String showCoverPic; | |
| 24 | - | |
| 25 | - @ApiModelProperty(value = "上传微信,封面图片标识") | |
| 26 | - private String thumbMediaId; | |
| 27 | - | |
| 28 | - @ApiModelProperty(value = "内容") | |
| 29 | - private String content; | |
| 30 | - | |
| 31 | - @ApiModelProperty(value = "内容链接") | |
| 32 | - private String contentSourceUrl; | |
| 33 | - | |
| 34 | - @ApiModelProperty(value = "文章排序") | |
| 35 | - private Integer orderNo; | |
| 36 | - | |
| 37 | - @ApiModelProperty(value = "图片路径") | |
| 38 | - private String picPath; | |
| 39 | - | |
| 40 | - @ApiModelProperty(value = "是否可以留言") | |
| 41 | - private String needOpenComment; | |
| 42 | - | |
| 43 | - @ApiModelProperty(value = "是否仅粉丝可以留言") | |
| 44 | - private String onlyFansCanComment; | |
| 45 | - | |
| 46 | - @ApiModelProperty(value = "图文ID") | |
| 47 | - private String newsId; | |
| 48 | - | |
| 49 | - @ApiModelProperty(value = "微信账号ID") | |
| 50 | - private String wxAccountId; | |
| 51 | - | |
| 52 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newsarticleitem/vo/WxNewsArticleItemCreateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newsarticleitem.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import io.swagger.annotations.*; | |
| 5 | - | |
| 6 | -@ApiModel("管理后台 - 图文消息文章列表表 创建 Request VO") | |
| 7 | -@Data | |
| 8 | -@EqualsAndHashCode(callSuper = true) | |
| 9 | -@ToString(callSuper = true) | |
| 10 | -public class WxNewsArticleItemCreateReqVO extends WxNewsArticleItemBaseVO { | |
| 11 | - | |
| 12 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newsarticleitem/vo/WxNewsArticleItemExcelVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newsarticleitem.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | - | |
| 5 | -import java.util.*; | |
| 6 | - | |
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * 图文消息文章列表表 Excel VO | |
| 11 | - * | |
| 12 | - * @author 芋道源码 | |
| 13 | - */ | |
| 14 | -@Data | |
| 15 | -public class WxNewsArticleItemExcelVO { | |
| 16 | - | |
| 17 | - @ExcelProperty("主键") | |
| 18 | - private Integer id; | |
| 19 | - | |
| 20 | - @ExcelProperty("标题") | |
| 21 | - private String title; | |
| 22 | - | |
| 23 | - @ExcelProperty("摘要") | |
| 24 | - private String digest; | |
| 25 | - | |
| 26 | - @ExcelProperty("作者") | |
| 27 | - private String author; | |
| 28 | - | |
| 29 | - @ExcelProperty("是否展示封面图片(0/1)") | |
| 30 | - private String showCoverPic; | |
| 31 | - | |
| 32 | - @ExcelProperty("上传微信,封面图片标识") | |
| 33 | - private String thumbMediaId; | |
| 34 | - | |
| 35 | - @ExcelProperty("内容") | |
| 36 | - private String content; | |
| 37 | - | |
| 38 | - @ExcelProperty("内容链接") | |
| 39 | - private String contentSourceUrl; | |
| 40 | - | |
| 41 | - @ExcelProperty("文章排序") | |
| 42 | - private Integer orderNo; | |
| 43 | - | |
| 44 | - @ExcelProperty("图片路径") | |
| 45 | - private String picPath; | |
| 46 | - | |
| 47 | - @ExcelProperty("是否可以留言") | |
| 48 | - private String needOpenComment; | |
| 49 | - | |
| 50 | - @ExcelProperty("是否仅粉丝可以留言") | |
| 51 | - private String onlyFansCanComment; | |
| 52 | - | |
| 53 | - @ExcelProperty("图文ID") | |
| 54 | - private String newsId; | |
| 55 | - | |
| 56 | - @ExcelProperty("微信账号ID") | |
| 57 | - private String wxAccountId; | |
| 58 | - | |
| 59 | - @ExcelProperty("创建时间") | |
| 60 | - private Date createTime; | |
| 61 | - | |
| 62 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newsarticleitem/vo/WxNewsArticleItemExportReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newsarticleitem.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | - | |
| 5 | -import java.util.*; | |
| 6 | - | |
| 7 | -import io.swagger.annotations.*; | |
| 8 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | - | |
| 10 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | - | |
| 12 | -@ApiModel(value = "管理后台 - 图文消息文章列表表 Excel 导出 Request VO", description = "参数和 WxNewsArticleItemPageReqVO 是一致的") | |
| 13 | -@Data | |
| 14 | -public class WxNewsArticleItemExportReqVO { | |
| 15 | - | |
| 16 | - @ApiModelProperty(value = "标题") | |
| 17 | - private String title; | |
| 18 | - | |
| 19 | - @ApiModelProperty(value = "摘要") | |
| 20 | - private String digest; | |
| 21 | - | |
| 22 | - @ApiModelProperty(value = "作者") | |
| 23 | - private String author; | |
| 24 | - | |
| 25 | - @ApiModelProperty(value = "是否展示封面图片(0/1)") | |
| 26 | - private String showCoverPic; | |
| 27 | - | |
| 28 | - @ApiModelProperty(value = "上传微信,封面图片标识") | |
| 29 | - private String thumbMediaId; | |
| 30 | - | |
| 31 | - @ApiModelProperty(value = "内容") | |
| 32 | - private String content; | |
| 33 | - | |
| 34 | - @ApiModelProperty(value = "内容链接") | |
| 35 | - private String contentSourceUrl; | |
| 36 | - | |
| 37 | - @ApiModelProperty(value = "文章排序") | |
| 38 | - private Integer orderNo; | |
| 39 | - | |
| 40 | - @ApiModelProperty(value = "图片路径") | |
| 41 | - private String picPath; | |
| 42 | - | |
| 43 | - @ApiModelProperty(value = "是否可以留言") | |
| 44 | - private String needOpenComment; | |
| 45 | - | |
| 46 | - @ApiModelProperty(value = "是否仅粉丝可以留言") | |
| 47 | - private String onlyFansCanComment; | |
| 48 | - | |
| 49 | - @ApiModelProperty(value = "图文ID") | |
| 50 | - private String newsId; | |
| 51 | - | |
| 52 | - @ApiModelProperty(value = "微信账号ID") | |
| 53 | - private String wxAccountId; | |
| 54 | - | |
| 55 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 56 | - @ApiModelProperty(value = "开始创建时间") | |
| 57 | - private Date beginCreateTime; | |
| 58 | - | |
| 59 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 60 | - @ApiModelProperty(value = "结束创建时间") | |
| 61 | - private Date endCreateTime; | |
| 62 | - | |
| 63 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newsarticleitem/vo/WxNewsArticleItemPageReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newsarticleitem.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | - | |
| 5 | -import java.util.*; | |
| 6 | - | |
| 7 | -import io.swagger.annotations.*; | |
| 8 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 9 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 10 | - | |
| 11 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 12 | - | |
| 13 | -@ApiModel("管理后台 - 图文消息文章列表表 分页 Request VO") | |
| 14 | -@Data | |
| 15 | -@EqualsAndHashCode(callSuper = true) | |
| 16 | -@ToString(callSuper = true) | |
| 17 | -public class WxNewsArticleItemPageReqVO extends PageParam { | |
| 18 | - | |
| 19 | - @ApiModelProperty(value = "标题") | |
| 20 | - private String title; | |
| 21 | - | |
| 22 | - @ApiModelProperty(value = "摘要") | |
| 23 | - private String digest; | |
| 24 | - | |
| 25 | - @ApiModelProperty(value = "作者") | |
| 26 | - private String author; | |
| 27 | - | |
| 28 | - @ApiModelProperty(value = "是否展示封面图片(0/1)") | |
| 29 | - private String showCoverPic; | |
| 30 | - | |
| 31 | - @ApiModelProperty(value = "上传微信,封面图片标识") | |
| 32 | - private String thumbMediaId; | |
| 33 | - | |
| 34 | - @ApiModelProperty(value = "内容") | |
| 35 | - private String content; | |
| 36 | - | |
| 37 | - @ApiModelProperty(value = "内容链接") | |
| 38 | - private String contentSourceUrl; | |
| 39 | - | |
| 40 | - @ApiModelProperty(value = "文章排序") | |
| 41 | - private Integer orderNo; | |
| 42 | - | |
| 43 | - @ApiModelProperty(value = "图片路径") | |
| 44 | - private String picPath; | |
| 45 | - | |
| 46 | - @ApiModelProperty(value = "是否可以留言") | |
| 47 | - private String needOpenComment; | |
| 48 | - | |
| 49 | - @ApiModelProperty(value = "是否仅粉丝可以留言") | |
| 50 | - private String onlyFansCanComment; | |
| 51 | - | |
| 52 | - @ApiModelProperty(value = "图文ID") | |
| 53 | - private String newsId; | |
| 54 | - | |
| 55 | - @ApiModelProperty(value = "微信账号ID") | |
| 56 | - private String wxAccountId; | |
| 57 | - | |
| 58 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 59 | - @ApiModelProperty(value = "开始创建时间") | |
| 60 | - private Date beginCreateTime; | |
| 61 | - | |
| 62 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 63 | - @ApiModelProperty(value = "结束创建时间") | |
| 64 | - private Date endCreateTime; | |
| 65 | - | |
| 66 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newsarticleitem/vo/WxNewsArticleItemRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newsarticleitem.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | - | |
| 5 | -import java.util.*; | |
| 6 | - | |
| 7 | -import io.swagger.annotations.*; | |
| 8 | - | |
| 9 | -@ApiModel("管理后台 - 图文消息文章列表表 Response VO") | |
| 10 | -@Data | |
| 11 | -@EqualsAndHashCode(callSuper = true) | |
| 12 | -@ToString(callSuper = true) | |
| 13 | -public class WxNewsArticleItemRespVO extends WxNewsArticleItemBaseVO { | |
| 14 | - | |
| 15 | - @ApiModelProperty(value = "主键", required = true) | |
| 16 | - private Integer id; | |
| 17 | - | |
| 18 | - @ApiModelProperty(value = "创建时间", required = true) | |
| 19 | - private Date createTime; | |
| 20 | - | |
| 21 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newsarticleitem/vo/WxNewsArticleItemUpdateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newsarticleitem.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import io.swagger.annotations.*; | |
| 5 | - | |
| 6 | -import javax.validation.constraints.*; | |
| 7 | - | |
| 8 | -@ApiModel("管理后台 - 图文消息文章列表表 更新 Request VO") | |
| 9 | -@Data | |
| 10 | -@EqualsAndHashCode(callSuper = true) | |
| 11 | -@ToString(callSuper = true) | |
| 12 | -public class WxNewsArticleItemUpdateReqVO extends WxNewsArticleItemBaseVO { | |
| 13 | - | |
| 14 | - @ApiModelProperty(value = "主键", required = true) | |
| 15 | - @NotNull(message = "主键不能为空") | |
| 16 | - private Integer id; | |
| 17 | - | |
| 18 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newstemplate/WxNewsTemplateController.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newstemplate; | |
| 2 | - | |
| 3 | -import org.springframework.web.bind.annotation.*; | |
| 4 | - | |
| 5 | -import javax.annotation.Resource; | |
| 6 | - | |
| 7 | -import org.springframework.validation.annotation.Validated; | |
| 8 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 9 | -import io.swagger.annotations.*; | |
| 10 | - | |
| 11 | -import javax.validation.*; | |
| 12 | -import javax.servlet.http.*; | |
| 13 | -import java.util.*; | |
| 14 | -import java.io.IOException; | |
| 15 | - | |
| 16 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 17 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 18 | - | |
| 19 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 20 | - | |
| 21 | -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 22 | - | |
| 23 | -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | |
| 24 | - | |
| 25 | -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; | |
| 26 | - | |
| 27 | -import cn.iocoder.yudao.module.mp.controller.admin.newstemplate.vo.*; | |
| 28 | -import cn.iocoder.yudao.module.mp.dal.dataobject.newstemplate.WxNewsTemplateDO; | |
| 29 | -import cn.iocoder.yudao.module.mp.convert.newstemplate.WxNewsTemplateConvert; | |
| 30 | -import cn.iocoder.yudao.module.mp.service.newstemplate.WxNewsTemplateService; | |
| 31 | - | |
| 32 | -@Api(tags = "管理后台 - 图文消息模板") | |
| 33 | -@RestController | |
| 34 | -@RequestMapping("/wechatMp/wx-news-template") | |
| 35 | -@Validated | |
| 36 | -public class WxNewsTemplateController { | |
| 37 | - | |
| 38 | - @Resource | |
| 39 | - private WxNewsTemplateService wxNewsTemplateService; | |
| 40 | - | |
| 41 | - @PostMapping("/create") | |
| 42 | - @ApiOperation("创建图文消息模板") | |
| 43 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-news-template:create')") | |
| 44 | - public CommonResult<Integer> createWxNewsTemplate(@Valid @RequestBody WxNewsTemplateCreateReqVO createReqVO) { | |
| 45 | - return success(wxNewsTemplateService.createWxNewsTemplate(createReqVO)); | |
| 46 | - } | |
| 47 | - | |
| 48 | - @PutMapping("/update") | |
| 49 | - @ApiOperation("更新图文消息模板") | |
| 50 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-news-template:update')") | |
| 51 | - public CommonResult<Boolean> updateWxNewsTemplate(@Valid @RequestBody WxNewsTemplateUpdateReqVO updateReqVO) { | |
| 52 | - wxNewsTemplateService.updateWxNewsTemplate(updateReqVO); | |
| 53 | - return success(true); | |
| 54 | - } | |
| 55 | - | |
| 56 | - @DeleteMapping("/delete") | |
| 57 | - @ApiOperation("删除图文消息模板") | |
| 58 | - @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class) | |
| 59 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-news-template:delete')") | |
| 60 | - public CommonResult<Boolean> deleteWxNewsTemplate(@RequestParam("id") Integer id) { | |
| 61 | - wxNewsTemplateService.deleteWxNewsTemplate(id); | |
| 62 | - return success(true); | |
| 63 | - } | |
| 64 | - | |
| 65 | - @GetMapping("/get") | |
| 66 | - @ApiOperation("获得图文消息模板") | |
| 67 | - @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class) | |
| 68 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-news-template:query')") | |
| 69 | - public CommonResult<WxNewsTemplateRespVO> getWxNewsTemplate(@RequestParam("id") Integer id) { | |
| 70 | - WxNewsTemplateDO wxNewsTemplate = wxNewsTemplateService.getWxNewsTemplate(id); | |
| 71 | - return success(WxNewsTemplateConvert.INSTANCE.convert(wxNewsTemplate)); | |
| 72 | - } | |
| 73 | - | |
| 74 | - @GetMapping("/list") | |
| 75 | - @ApiOperation("获得图文消息模板列表") | |
| 76 | - @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) | |
| 77 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-news-template:query')") | |
| 78 | - public CommonResult<List<WxNewsTemplateRespVO>> getWxNewsTemplateList(@RequestParam("ids") Collection<Integer> ids) { | |
| 79 | - List<WxNewsTemplateDO> list = wxNewsTemplateService.getWxNewsTemplateList(ids); | |
| 80 | - return success(WxNewsTemplateConvert.INSTANCE.convertList(list)); | |
| 81 | - } | |
| 82 | - | |
| 83 | - @GetMapping("/page") | |
| 84 | - @ApiOperation("获得图文消息模板分页") | |
| 85 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-news-template:query')") | |
| 86 | - public CommonResult<PageResult<WxNewsTemplateRespVO>> getWxNewsTemplatePage(@Valid WxNewsTemplatePageReqVO pageVO) { | |
| 87 | - PageResult<WxNewsTemplateDO> pageResult = wxNewsTemplateService.getWxNewsTemplatePage(pageVO); | |
| 88 | - return success(WxNewsTemplateConvert.INSTANCE.convertPage(pageResult)); | |
| 89 | - } | |
| 90 | - | |
| 91 | - @GetMapping("/export-excel") | |
| 92 | - @ApiOperation("导出图文消息模板 Excel") | |
| 93 | - @PreAuthorize("@ss.hasPermission('wechatMp:wx-news-template:export')") | |
| 94 | - @OperateLog(type = EXPORT) | |
| 95 | - public void exportWxNewsTemplateExcel(@Valid WxNewsTemplateExportReqVO exportReqVO, | |
| 96 | - HttpServletResponse response) throws IOException { | |
| 97 | - List<WxNewsTemplateDO> list = wxNewsTemplateService.getWxNewsTemplateList(exportReqVO); | |
| 98 | - // 导出 Excel | |
| 99 | - List<WxNewsTemplateExcelVO> datas = WxNewsTemplateConvert.INSTANCE.convertList02(list); | |
| 100 | - ExcelUtils.write(response, "图文消息模板.xls", "数据", WxNewsTemplateExcelVO.class, datas); | |
| 101 | - } | |
| 102 | - | |
| 103 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newstemplate/vo/WxNewsTemplateBaseVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newstemplate.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import io.swagger.annotations.*; | |
| 5 | - | |
| 6 | -/** | |
| 7 | - * 图文消息模板 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 8 | - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 9 | - */ | |
| 10 | -@Data | |
| 11 | -public class WxNewsTemplateBaseVO { | |
| 12 | - | |
| 13 | - @ApiModelProperty(value = "模板名称") | |
| 14 | - private String tplName; | |
| 15 | - | |
| 16 | - @ApiModelProperty(value = "是否已上传微信") | |
| 17 | - private String isUpload; | |
| 18 | - | |
| 19 | - @ApiModelProperty(value = "素材ID") | |
| 20 | - private String mediaId; | |
| 21 | - | |
| 22 | - @ApiModelProperty(value = "微信账号ID") | |
| 23 | - private String wxAccountId; | |
| 24 | - | |
| 25 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newstemplate/vo/WxNewsTemplateCreateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newstemplate.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import io.swagger.annotations.*; | |
| 5 | - | |
| 6 | -@ApiModel("管理后台 - 图文消息模板创建 Request VO") | |
| 7 | -@Data | |
| 8 | -@EqualsAndHashCode(callSuper = true) | |
| 9 | -@ToString(callSuper = true) | |
| 10 | -public class WxNewsTemplateCreateReqVO extends WxNewsTemplateBaseVO { | |
| 11 | - | |
| 12 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newstemplate/vo/WxNewsTemplateExcelVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newstemplate.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | - | |
| 5 | -import java.util.*; | |
| 6 | - | |
| 7 | -import com.alibaba.excel.annotation.ExcelProperty; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * 图文消息模板 Excel VO | |
| 11 | - * | |
| 12 | - * @author 芋道源码 | |
| 13 | - */ | |
| 14 | -@Data | |
| 15 | -public class WxNewsTemplateExcelVO { | |
| 16 | - | |
| 17 | - @ExcelProperty("主键 主键ID") | |
| 18 | - private Integer id; | |
| 19 | - | |
| 20 | - @ExcelProperty("模板名称") | |
| 21 | - private String tplName; | |
| 22 | - | |
| 23 | - @ExcelProperty("是否已上传微信") | |
| 24 | - private String isUpload; | |
| 25 | - | |
| 26 | - @ExcelProperty("素材ID") | |
| 27 | - private String mediaId; | |
| 28 | - | |
| 29 | - @ExcelProperty("微信账号ID") | |
| 30 | - private String wxAccountId; | |
| 31 | - | |
| 32 | - @ExcelProperty("创建时间") | |
| 33 | - private Date createTime; | |
| 34 | - | |
| 35 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newstemplate/vo/WxNewsTemplateExportReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newstemplate.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | - | |
| 5 | -import java.util.*; | |
| 6 | - | |
| 7 | -import io.swagger.annotations.*; | |
| 8 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | - | |
| 10 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | - | |
| 12 | -@ApiModel(value = "管理后台 - 图文消息模板 Excel 导出 Request VO", description = "参数和 WxNewsTemplatePageReqVO 是一致的") | |
| 13 | -@Data | |
| 14 | -public class WxNewsTemplateExportReqVO { | |
| 15 | - | |
| 16 | - @ApiModelProperty(value = "模板名称") | |
| 17 | - private String tplName; | |
| 18 | - | |
| 19 | - @ApiModelProperty(value = "是否已上传微信") | |
| 20 | - private String isUpload; | |
| 21 | - | |
| 22 | - @ApiModelProperty(value = "素材ID") | |
| 23 | - private String mediaId; | |
| 24 | - | |
| 25 | - @ApiModelProperty(value = "微信账号ID") | |
| 26 | - private String wxAccountId; | |
| 27 | - | |
| 28 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 29 | - @ApiModelProperty(value = "开始创建时间") | |
| 30 | - private Date beginCreateTime; | |
| 31 | - | |
| 32 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 33 | - @ApiModelProperty(value = "结束创建时间") | |
| 34 | - private Date endCreateTime; | |
| 35 | - | |
| 36 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newstemplate/vo/WxNewsTemplatePageReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newstemplate.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | - | |
| 5 | -import java.util.*; | |
| 6 | - | |
| 7 | -import io.swagger.annotations.*; | |
| 8 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 9 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 10 | - | |
| 11 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 12 | - | |
| 13 | -@ApiModel("管理后台 - 图文消息模板分页 Request VO") | |
| 14 | -@Data | |
| 15 | -@EqualsAndHashCode(callSuper = true) | |
| 16 | -@ToString(callSuper = true) | |
| 17 | -public class WxNewsTemplatePageReqVO extends PageParam { | |
| 18 | - | |
| 19 | - @ApiModelProperty(value = "模板名称") | |
| 20 | - private String tplName; | |
| 21 | - | |
| 22 | - @ApiModelProperty(value = "是否已上传微信") | |
| 23 | - private String isUpload; | |
| 24 | - | |
| 25 | - @ApiModelProperty(value = "素材ID") | |
| 26 | - private String mediaId; | |
| 27 | - | |
| 28 | - @ApiModelProperty(value = "微信账号ID") | |
| 29 | - private String wxAccountId; | |
| 30 | - | |
| 31 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 32 | - @ApiModelProperty(value = "开始创建时间") | |
| 33 | - private Date beginCreateTime; | |
| 34 | - | |
| 35 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 36 | - @ApiModelProperty(value = "结束创建时间") | |
| 37 | - private Date endCreateTime; | |
| 38 | - | |
| 39 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newstemplate/vo/WxNewsTemplateRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newstemplate.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | - | |
| 5 | -import java.util.*; | |
| 6 | - | |
| 7 | -import io.swagger.annotations.*; | |
| 8 | - | |
| 9 | -@ApiModel("管理后台 - 图文消息模板 Response VO") | |
| 10 | -@Data | |
| 11 | -@EqualsAndHashCode(callSuper = true) | |
| 12 | -@ToString(callSuper = true) | |
| 13 | -public class WxNewsTemplateRespVO extends WxNewsTemplateBaseVO { | |
| 14 | - | |
| 15 | - @ApiModelProperty(value = "主键 主键ID", required = true) | |
| 16 | - private Integer id; | |
| 17 | - | |
| 18 | - @ApiModelProperty(value = "创建时间", required = true) | |
| 19 | - private Date createTime; | |
| 20 | - | |
| 21 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/newstemplate/vo/WxNewsTemplateUpdateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.controller.admin.newstemplate.vo; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | -import io.swagger.annotations.*; | |
| 5 | - | |
| 6 | -import javax.validation.constraints.*; | |
| 7 | - | |
| 8 | -@ApiModel("管理后台 - 图文消息模板更新 Request VO") | |
| 9 | -@Data | |
| 10 | -@EqualsAndHashCode(callSuper = true) | |
| 11 | -@ToString(callSuper = true) | |
| 12 | -public class WxNewsTemplateUpdateReqVO extends WxNewsTemplateBaseVO { | |
| 13 | - | |
| 14 | - @ApiModelProperty(value = "主键 主键ID", required = true) | |
| 15 | - @NotNull(message = "主键 主键ID不能为空") | |
| 16 | - private Integer id; | |
| 17 | - | |
| 18 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/message/MpMessageConvert.java
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/newsarticleitem/WxNewsArticleItemConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.convert.newsarticleitem; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | - | |
| 7 | -import org.mapstruct.Mapper; | |
| 8 | -import org.mapstruct.factory.Mappers; | |
| 9 | -import cn.iocoder.yudao.module.mp.controller.admin.newsarticleitem.vo.*; | |
| 10 | -import cn.iocoder.yudao.module.mp.dal.dataobject.newsarticleitem.WxNewsArticleItemDO; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 图文消息文章列表表 Convert | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface WxNewsArticleItemConvert { | |
| 19 | - | |
| 20 | - WxNewsArticleItemConvert INSTANCE = Mappers.getMapper(WxNewsArticleItemConvert.class); | |
| 21 | - | |
| 22 | - WxNewsArticleItemDO convert(WxNewsArticleItemCreateReqVO bean); | |
| 23 | - | |
| 24 | - WxNewsArticleItemDO convert(WxNewsArticleItemUpdateReqVO bean); | |
| 25 | - | |
| 26 | - WxNewsArticleItemRespVO convert(WxNewsArticleItemDO bean); | |
| 27 | - | |
| 28 | - List<WxNewsArticleItemRespVO> convertList(List<WxNewsArticleItemDO> list); | |
| 29 | - | |
| 30 | - PageResult<WxNewsArticleItemRespVO> convertPage(PageResult<WxNewsArticleItemDO> page); | |
| 31 | - | |
| 32 | - List<WxNewsArticleItemExcelVO> convertList02(List<WxNewsArticleItemDO> list); | |
| 33 | - | |
| 34 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/newstemplate/WxNewsTemplateConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.convert.newstemplate; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | - | |
| 7 | -import org.mapstruct.Mapper; | |
| 8 | -import org.mapstruct.factory.Mappers; | |
| 9 | -import cn.iocoder.yudao.module.mp.controller.admin.newstemplate.vo.*; | |
| 10 | -import cn.iocoder.yudao.module.mp.dal.dataobject.newstemplate.WxNewsTemplateDO; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 图文消息模板 Convert | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface WxNewsTemplateConvert { | |
| 19 | - | |
| 20 | - WxNewsTemplateConvert INSTANCE = Mappers.getMapper(WxNewsTemplateConvert.class); | |
| 21 | - | |
| 22 | - WxNewsTemplateDO convert(WxNewsTemplateCreateReqVO bean); | |
| 23 | - | |
| 24 | - WxNewsTemplateDO convert(WxNewsTemplateUpdateReqVO bean); | |
| 25 | - | |
| 26 | - WxNewsTemplateRespVO convert(WxNewsTemplateDO bean); | |
| 27 | - | |
| 28 | - List<WxNewsTemplateRespVO> convertList(List<WxNewsTemplateDO> list); | |
| 29 | - | |
| 30 | - PageResult<WxNewsTemplateRespVO> convertPage(PageResult<WxNewsTemplateDO> page); | |
| 31 | - | |
| 32 | - List<WxNewsTemplateExcelVO> convertList02(List<WxNewsTemplateDO> list); | |
| 33 | - | |
| 34 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/message/MpAutoReplyDO.java
| 1 | 1 | package cn.iocoder.yudao.module.mp.dal.dataobject.message; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.util.collection.SetUtils; | |
| 3 | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | 5 | import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO; |
| 5 | 6 | import cn.iocoder.yudao.module.mp.enums.message.MpAutoReplyMatchEnum; |
| ... | ... | @@ -13,6 +14,8 @@ import lombok.ToString; |
| 13 | 14 | import me.chanjar.weixin.common.api.WxConsts; |
| 14 | 15 | import me.chanjar.weixin.common.api.WxConsts.XmlMsgType; |
| 15 | 16 | |
| 17 | +import java.util.Set; | |
| 18 | + | |
| 16 | 19 | /** |
| 17 | 20 | * 微信消息自动回复 DO |
| 18 | 21 | * |
| ... | ... | @@ -25,6 +28,10 @@ import me.chanjar.weixin.common.api.WxConsts.XmlMsgType; |
| 25 | 28 | @ToString(callSuper = true) |
| 26 | 29 | public class MpAutoReplyDO extends BaseDO { |
| 27 | 30 | |
| 31 | + public static Set<String> REQUEST_MESSAGE_TYPE = SetUtils.asSet(WxConsts.XmlMsgType.TEXT, WxConsts.XmlMsgType.IMAGE, | |
| 32 | + WxConsts.XmlMsgType.VOICE, WxConsts.XmlMsgType.VIDEO, WxConsts.XmlMsgType.SHORTVIDEO, | |
| 33 | + WxConsts.XmlMsgType.LOCATION, WxConsts.XmlMsgType.LINK); | |
| 34 | + | |
| 28 | 35 | /** |
| 29 | 36 | * 主键 |
| 30 | 37 | */ |
| ... | ... | @@ -72,7 +79,7 @@ public class MpAutoReplyDO extends BaseDO { |
| 72 | 79 | * |
| 73 | 80 | * 当 {@link #type} 为 {@link MpAutoReplyTypeEnum#MESSAGE} |
| 74 | 81 | * |
| 75 | - * 枚举 {@link XmlMsgType} 中的 TEXT、IMAGE、VOICE、VIDEO、SHORTVIDEO、LOCATION、LINK | |
| 82 | + * 枚举 {@link XmlMsgType} 中的 {@link #REQUEST_MESSAGE_TYPE} | |
| 76 | 83 | */ |
| 77 | 84 | private String requestMessageType; |
| 78 | 85 | ... | ... |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/newsarticleitem/WxNewsArticleItemDO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.dal.dataobject.newsarticleitem; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | - | |
| 5 | -import java.util.*; | |
| 6 | - | |
| 7 | -import com.baomidou.mybatisplus.annotation.*; | |
| 8 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 图文消息文章列表表 DO | |
| 12 | - * | |
| 13 | - * @author 芋道源码 | |
| 14 | - */ | |
| 15 | -@TableName("wx_news_article_item") | |
| 16 | -@KeySequence("wx_news_article_item_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 17 | -@Data | |
| 18 | -@EqualsAndHashCode(callSuper = true) | |
| 19 | -@ToString(callSuper = true) | |
| 20 | -@Builder | |
| 21 | -@NoArgsConstructor | |
| 22 | -@AllArgsConstructor | |
| 23 | -public class WxNewsArticleItemDO extends BaseDO { | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 主键 | |
| 27 | - */ | |
| 28 | - @TableId | |
| 29 | - private Integer id; | |
| 30 | - /** | |
| 31 | - * 标题 | |
| 32 | - */ | |
| 33 | - private String title; | |
| 34 | - /** | |
| 35 | - * 摘要 | |
| 36 | - */ | |
| 37 | - private String digest; | |
| 38 | - /** | |
| 39 | - * 作者 | |
| 40 | - */ | |
| 41 | - private String author; | |
| 42 | - /** | |
| 43 | - * 是否展示封面图片(0/1) | |
| 44 | - */ | |
| 45 | - private String showCoverPic; | |
| 46 | - /** | |
| 47 | - * 上传微信,封面图片标识 | |
| 48 | - */ | |
| 49 | - private String thumbMediaId; | |
| 50 | - /** | |
| 51 | - * 内容 | |
| 52 | - */ | |
| 53 | - private String content; | |
| 54 | - /** | |
| 55 | - * 内容链接 | |
| 56 | - */ | |
| 57 | - private String contentSourceUrl; | |
| 58 | - /** | |
| 59 | - * 文章排序 | |
| 60 | - */ | |
| 61 | - private Integer orderNo; | |
| 62 | - /** | |
| 63 | - * 图片路径 | |
| 64 | - */ | |
| 65 | - private String picPath; | |
| 66 | - /** | |
| 67 | - * 是否可以留言 | |
| 68 | - */ | |
| 69 | - private String needOpenComment; | |
| 70 | - /** | |
| 71 | - * 是否仅粉丝可以留言 | |
| 72 | - */ | |
| 73 | - private String onlyFansCanComment; | |
| 74 | - /** | |
| 75 | - * 图文ID | |
| 76 | - */ | |
| 77 | - private String newsId; | |
| 78 | - /** | |
| 79 | - * 微信账号ID | |
| 80 | - */ | |
| 81 | - private String wxAccountId; | |
| 82 | - | |
| 83 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/newstemplate/WxNewsTemplateDO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.dal.dataobject.newstemplate; | |
| 2 | - | |
| 3 | -import lombok.*; | |
| 4 | - | |
| 5 | -import java.util.*; | |
| 6 | - | |
| 7 | -import com.baomidou.mybatisplus.annotation.*; | |
| 8 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 图文消息模板 DO | |
| 12 | - * | |
| 13 | - * @author 芋道源码 | |
| 14 | - */ | |
| 15 | -@TableName("wx_news_template") | |
| 16 | -@KeySequence("wx_news_template_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 17 | -@Data | |
| 18 | -@EqualsAndHashCode(callSuper = true) | |
| 19 | -@ToString(callSuper = true) | |
| 20 | -@Builder | |
| 21 | -@NoArgsConstructor | |
| 22 | -@AllArgsConstructor | |
| 23 | -public class WxNewsTemplateDO extends BaseDO { | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 主键 主键ID | |
| 27 | - */ | |
| 28 | - @TableId | |
| 29 | - private Integer id; | |
| 30 | - /** | |
| 31 | - * 模板名称 | |
| 32 | - */ | |
| 33 | - private String tplName; | |
| 34 | - /** | |
| 35 | - * 是否已上传微信 | |
| 36 | - */ | |
| 37 | - private String isUpload; | |
| 38 | - /** | |
| 39 | - * 素材ID | |
| 40 | - */ | |
| 41 | - private String mediaId; | |
| 42 | - /** | |
| 43 | - * 微信账号ID | |
| 44 | - */ | |
| 45 | - private String wxAccountId; | |
| 46 | - | |
| 47 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/message/MpAutoReplyMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mp.dal.mysql.message; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 5 | +import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpAutoReplyDO; | |
| 6 | +import cn.iocoder.yudao.module.mp.enums.message.MpAutoReplyMatchEnum; | |
| 7 | +import cn.iocoder.yudao.module.mp.enums.message.MpAutoReplyTypeEnum; | |
| 8 | + | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +public interface MpAutoReplyMapper extends BaseMapperX<MpAutoReplyDO> { | |
| 12 | + | |
| 13 | + default List<MpAutoReplyDO> selectListByAppIdAndKeywordAll(String appId, String requestKeyword) { | |
| 14 | + return selectList(new LambdaQueryWrapperX<MpAutoReplyDO>() | |
| 15 | + .eq(MpAutoReplyDO::getAppId, appId) | |
| 16 | + .eq(MpAutoReplyDO::getType, MpAutoReplyTypeEnum.KEYWORD.getType()) | |
| 17 | + .eq(MpAutoReplyDO::getRequestMatch, MpAutoReplyMatchEnum.ALL.getMatch()) | |
| 18 | + .eq(MpAutoReplyDO::getRequestKeyword, requestKeyword)); | |
| 19 | + } | |
| 20 | + | |
| 21 | + default List<MpAutoReplyDO> selectListByAppIdAndKeywordLike(String appId, String requestKeyword) { | |
| 22 | + return selectList(new LambdaQueryWrapperX<MpAutoReplyDO>() | |
| 23 | + .eq(MpAutoReplyDO::getAppId, appId) | |
| 24 | + .eq(MpAutoReplyDO::getType, MpAutoReplyTypeEnum.KEYWORD.getType()) | |
| 25 | + .eq(MpAutoReplyDO::getRequestMatch, MpAutoReplyMatchEnum.LIKE.getMatch()) | |
| 26 | + .like(MpAutoReplyDO::getRequestKeyword, requestKeyword)); | |
| 27 | + } | |
| 28 | + | |
| 29 | + default List<MpAutoReplyDO> selectListByAppIdAndMessage(String appId, String requestMessageType) { | |
| 30 | + return selectList(new LambdaQueryWrapperX<MpAutoReplyDO>() | |
| 31 | + .eq(MpAutoReplyDO::getAppId, appId) | |
| 32 | + .eq(MpAutoReplyDO::getType, MpAutoReplyTypeEnum.MESSAGE.getType()) | |
| 33 | + .eq(MpAutoReplyDO::getRequestMessageType, requestMessageType)); | |
| 34 | + } | |
| 35 | +} | ... | ... |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/newsarticleitem/WxNewsArticleItemMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.dal.mysql.newsarticleitem; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | -import cn.iocoder.yudao.module.mp.dal.dataobject.newsarticleitem.WxNewsArticleItemDO; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | -import cn.iocoder.yudao.module.mp.controller.admin.newsarticleitem.vo.*; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 图文消息文章列表表 Mapper | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface WxNewsArticleItemMapper extends BaseMapperX<WxNewsArticleItemDO> { | |
| 19 | - | |
| 20 | - default PageResult<WxNewsArticleItemDO> selectPage(WxNewsArticleItemPageReqVO reqVO) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<WxNewsArticleItemDO>() | |
| 22 | - .eqIfPresent(WxNewsArticleItemDO::getTitle, reqVO.getTitle()) | |
| 23 | - .eqIfPresent(WxNewsArticleItemDO::getDigest, reqVO.getDigest()) | |
| 24 | - .eqIfPresent(WxNewsArticleItemDO::getAuthor, reqVO.getAuthor()) | |
| 25 | - .eqIfPresent(WxNewsArticleItemDO::getShowCoverPic, reqVO.getShowCoverPic()) | |
| 26 | - .eqIfPresent(WxNewsArticleItemDO::getThumbMediaId, reqVO.getThumbMediaId()) | |
| 27 | - .eqIfPresent(WxNewsArticleItemDO::getContent, reqVO.getContent()) | |
| 28 | - .eqIfPresent(WxNewsArticleItemDO::getContentSourceUrl, reqVO.getContentSourceUrl()) | |
| 29 | - .eqIfPresent(WxNewsArticleItemDO::getOrderNo, reqVO.getOrderNo()) | |
| 30 | - .eqIfPresent(WxNewsArticleItemDO::getPicPath, reqVO.getPicPath()) | |
| 31 | - .eqIfPresent(WxNewsArticleItemDO::getNeedOpenComment, reqVO.getNeedOpenComment()) | |
| 32 | - .eqIfPresent(WxNewsArticleItemDO::getOnlyFansCanComment, reqVO.getOnlyFansCanComment()) | |
| 33 | - .eqIfPresent(WxNewsArticleItemDO::getNewsId, reqVO.getNewsId()) | |
| 34 | - .eqIfPresent(WxNewsArticleItemDO::getWxAccountId, reqVO.getWxAccountId()) | |
| 35 | - .betweenIfPresent(WxNewsArticleItemDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 36 | - .orderByDesc(WxNewsArticleItemDO::getId)); | |
| 37 | - } | |
| 38 | - | |
| 39 | - default List<WxNewsArticleItemDO> selectList(WxNewsArticleItemExportReqVO reqVO) { | |
| 40 | - return selectList(new LambdaQueryWrapperX<WxNewsArticleItemDO>() | |
| 41 | - .eqIfPresent(WxNewsArticleItemDO::getTitle, reqVO.getTitle()) | |
| 42 | - .eqIfPresent(WxNewsArticleItemDO::getDigest, reqVO.getDigest()) | |
| 43 | - .eqIfPresent(WxNewsArticleItemDO::getAuthor, reqVO.getAuthor()) | |
| 44 | - .eqIfPresent(WxNewsArticleItemDO::getShowCoverPic, reqVO.getShowCoverPic()) | |
| 45 | - .eqIfPresent(WxNewsArticleItemDO::getThumbMediaId, reqVO.getThumbMediaId()) | |
| 46 | - .eqIfPresent(WxNewsArticleItemDO::getContent, reqVO.getContent()) | |
| 47 | - .eqIfPresent(WxNewsArticleItemDO::getContentSourceUrl, reqVO.getContentSourceUrl()) | |
| 48 | - .eqIfPresent(WxNewsArticleItemDO::getOrderNo, reqVO.getOrderNo()) | |
| 49 | - .eqIfPresent(WxNewsArticleItemDO::getPicPath, reqVO.getPicPath()) | |
| 50 | - .eqIfPresent(WxNewsArticleItemDO::getNeedOpenComment, reqVO.getNeedOpenComment()) | |
| 51 | - .eqIfPresent(WxNewsArticleItemDO::getOnlyFansCanComment, reqVO.getOnlyFansCanComment()) | |
| 52 | - .eqIfPresent(WxNewsArticleItemDO::getNewsId, reqVO.getNewsId()) | |
| 53 | - .eqIfPresent(WxNewsArticleItemDO::getWxAccountId, reqVO.getWxAccountId()) | |
| 54 | - .betweenIfPresent(WxNewsArticleItemDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 55 | - .orderByDesc(WxNewsArticleItemDO::getId)); | |
| 56 | - } | |
| 57 | - | |
| 58 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/newstemplate/WxNewsTemplateMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.dal.mysql.newstemplate; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | -import cn.iocoder.yudao.module.mp.dal.dataobject.newstemplate.WxNewsTemplateDO; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | -import cn.iocoder.yudao.module.mp.controller.admin.newstemplate.vo.*; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 图文消息模板 Mapper | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface WxNewsTemplateMapper extends BaseMapperX<WxNewsTemplateDO> { | |
| 19 | - | |
| 20 | - default PageResult<WxNewsTemplateDO> selectPage(WxNewsTemplatePageReqVO reqVO) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<WxNewsTemplateDO>() | |
| 22 | - .likeIfPresent(WxNewsTemplateDO::getTplName, reqVO.getTplName()) | |
| 23 | - .eqIfPresent(WxNewsTemplateDO::getIsUpload, reqVO.getIsUpload()) | |
| 24 | - .eqIfPresent(WxNewsTemplateDO::getMediaId, reqVO.getMediaId()) | |
| 25 | - .eqIfPresent(WxNewsTemplateDO::getWxAccountId, reqVO.getWxAccountId()) | |
| 26 | - .betweenIfPresent(WxNewsTemplateDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 27 | - .orderByDesc(WxNewsTemplateDO::getId)); | |
| 28 | - } | |
| 29 | - | |
| 30 | - default List<WxNewsTemplateDO> selectList(WxNewsTemplateExportReqVO reqVO) { | |
| 31 | - return selectList(new LambdaQueryWrapperX<WxNewsTemplateDO>() | |
| 32 | - .likeIfPresent(WxNewsTemplateDO::getTplName, reqVO.getTplName()) | |
| 33 | - .eqIfPresent(WxNewsTemplateDO::getIsUpload, reqVO.getIsUpload()) | |
| 34 | - .eqIfPresent(WxNewsTemplateDO::getMediaId, reqVO.getMediaId()) | |
| 35 | - .eqIfPresent(WxNewsTemplateDO::getWxAccountId, reqVO.getWxAccountId()) | |
| 36 | - .betweenIfPresent(WxNewsTemplateDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 37 | - .orderByDesc(WxNewsTemplateDO::getId)); | |
| 38 | - } | |
| 39 | - | |
| 40 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/handler/message/MessageAutoReplyHandler.java
| 1 | 1 | package cn.iocoder.yudao.module.mp.service.handler.message; |
| 2 | 2 | |
| 3 | -import cn.hutool.core.io.FileUtil; | |
| 4 | -import cn.hutool.http.HtmlUtil; | |
| 5 | -import cn.hutool.http.HttpUtil; | |
| 6 | -import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | |
| 7 | -import cn.iocoder.yudao.module.infra.api.file.FileApi; | |
| 8 | -import cn.iocoder.yudao.module.mp.builder.TextBuilder; | |
| 9 | -import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO; | |
| 10 | -import cn.iocoder.yudao.module.mp.service.account.MpAccountService; | |
| 11 | -import cn.iocoder.yudao.module.mp.service.message.MpMessageService; | |
| 3 | +import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpAutoReplyDO; | |
| 4 | +import cn.iocoder.yudao.module.mp.framework.mp.core.context.MpContextHolder; | |
| 5 | +import cn.iocoder.yudao.module.mp.service.message.MpAutoReplyService; | |
| 12 | 6 | import lombok.extern.slf4j.Slf4j; |
| 13 | -import me.chanjar.weixin.common.api.WxConsts; | |
| 14 | -import me.chanjar.weixin.common.error.WxErrorException; | |
| 15 | 7 | import me.chanjar.weixin.common.session.WxSessionManager; |
| 16 | 8 | import me.chanjar.weixin.mp.api.WxMpMessageHandler; |
| 17 | 9 | import me.chanjar.weixin.mp.api.WxMpService; |
| 18 | 10 | import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; |
| 19 | 11 | import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; |
| 20 | -import me.chanjar.weixin.mp.bean.result.WxMpUser; | |
| 21 | -import org.apache.commons.lang3.StringUtils; | |
| 22 | -import org.springframework.context.annotation.Lazy; | |
| 23 | 12 | import org.springframework.stereotype.Component; |
| 24 | 13 | |
| 25 | 14 | import javax.annotation.Resource; |
| 26 | -import java.io.File; | |
| 27 | -import java.io.UnsupportedEncodingException; | |
| 28 | 15 | import java.util.Map; |
| 29 | 16 | |
| 30 | 17 | /** |
| ... | ... | @@ -37,145 +24,18 @@ import java.util.Map; |
| 37 | 24 | public class MessageAutoReplyHandler implements WxMpMessageHandler { |
| 38 | 25 | |
| 39 | 26 | @Resource |
| 40 | - @Lazy // 延迟加载,解决循环依赖的问题 | |
| 41 | - private MpAccountService mpAccountService; | |
| 42 | - | |
| 43 | - @Resource | |
| 44 | - private MpMessageService mpMessageService; | |
| 45 | - | |
| 46 | - @Resource | |
| 47 | - private FileApi fileApi; | |
| 48 | - | |
| 49 | - // auto reply | |
| 50 | - // createMessage | |
| 51 | - // outmessage | |
| 27 | + private MpAutoReplyService mpAutoReplyService; | |
| 52 | 28 | |
| 53 | 29 | @Override |
| 54 | 30 | public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, |
| 55 | 31 | WxMpService weixinService, WxSessionManager sessionManager) { |
| 56 | - log.info("收到信息内容:{}", JsonUtils.toJsonString(wxMessage)); | |
| 57 | - log.info("关键字:{}", wxMessage.getContent()); | |
| 58 | - | |
| 59 | -// if (!wxMessage.getMsgType().equals(WxConsts.XmlMsgType.EVENT)) { | |
| 60 | -// //可以选择将消息保存到本地 | |
| 61 | -// | |
| 62 | -// // 获取微信用户基本信息 | |
| 63 | -// try { | |
| 64 | -// WxMpUser wxmpUser = weixinService.getUserService() | |
| 65 | -// .userInfo(wxMessage.getFromUser(), null); | |
| 66 | -// if (wxmpUser != null) { | |
| 67 | -// MpAccountDO wxAccount = mpAccountService.findBy(MpAccountDO::getAccount, wxMessage.getToUser()); | |
| 68 | -// if (wxAccount != null) { | |
| 69 | -// | |
| 70 | -// if (wxMessage.getMsgType().equals(WxConsts.XmlMsgType.TEXT)) { | |
| 71 | -// WxFansMsgCreateReqVO wxFansMsg = new WxFansMsgCreateReqVO(); | |
| 72 | -// wxFansMsg.setOpenid(wxmpUser.getOpenId()); | |
| 73 | -// try { | |
| 74 | -// wxFansMsg.setNickname(wxmpUser.getNickname().getBytes("UTF-8")); | |
| 75 | -// } catch (UnsupportedEncodingException e) { | |
| 76 | -// e.printStackTrace(); | |
| 77 | -// } | |
| 78 | -// wxFansMsg.setHeadimgUrl(wxmpUser.getHeadImgUrl()); | |
| 79 | -// wxFansMsg.setWxAccountId(String.valueOf(wxAccount.getId())); | |
| 80 | -// wxFansMsg.setMsgType(wxMessage.getMsgType()); | |
| 81 | -// wxFansMsg.setContent(wxMessage.getContent()); | |
| 82 | -// wxFansMsg.setIsRes("1"); | |
| 83 | -// | |
| 84 | -// //组装回复消息 | |
| 85 | -// String content = processContent(wxMessage); | |
| 86 | -// content = HtmlUtil.escape(content); | |
| 87 | -// wxFansMsg.setResContent(content); | |
| 88 | -// | |
| 89 | -// mpMessageService.createWxFansMsg(wxFansMsg); | |
| 90 | -// return new TextBuilder().build(content, wxMessage, weixinService); | |
| 91 | -// | |
| 92 | -// } | |
| 93 | -// if (wxMessage.getMsgType().equals(WxConsts.XmlMsgType.IMAGE)) { | |
| 94 | -// WxFansMsgCreateReqVO wxFansMsg = new WxFansMsgCreateReqVO(); | |
| 95 | -// wxFansMsg.setOpenid(wxmpUser.getOpenId()); | |
| 96 | -// try { | |
| 97 | -// wxFansMsg.setNickname(wxmpUser.getNickname().getBytes("UTF-8")); | |
| 98 | -// } catch (UnsupportedEncodingException e) { | |
| 99 | -// e.printStackTrace(); | |
| 100 | -// } | |
| 101 | -// wxFansMsg.setHeadimgUrl(wxmpUser.getHeadImgUrl()); | |
| 102 | -// wxFansMsg.setWxAccountId(String.valueOf(wxAccount.getId())); | |
| 103 | -// wxFansMsg.setMsgType(wxMessage.getMsgType()); | |
| 104 | -// wxFansMsg.setMediaId(wxMessage.getMediaId()); | |
| 105 | -// wxFansMsg.setPicUrl(wxMessage.getPicUrl()); | |
| 106 | -// String downloadDirStr = fileApi.createFile(HttpUtil.downloadBytes(wxMessage.getPicUrl())); | |
| 107 | -// File downloadDir = new File(downloadDirStr); | |
| 108 | -// if (!downloadDir.exists()) { | |
| 109 | -// downloadDir.mkdirs(); | |
| 110 | -// } | |
| 111 | -// String filepath = downloadDirStr + System.currentTimeMillis() + ".png"; | |
| 112 | -// //微信pic url下载到本地,防止失效 | |
| 113 | -// long size = HttpUtil.downloadFile(wxMessage.getPicUrl(), FileUtil.file(filepath)); | |
| 114 | -// log.info("download pic size : {}", size); | |
| 115 | -// wxFansMsg.setPicPath(filepath); | |
| 116 | -// wxFansMsg.setIsRes("0"); | |
| 117 | -// mpMessageService.createWxFansMsg(wxFansMsg); | |
| 118 | -// } | |
| 119 | -// | |
| 120 | -// } | |
| 121 | -// } | |
| 122 | -// } catch (WxErrorException e) { | |
| 123 | -// if (e.getError().getErrorCode() == 48001) { | |
| 124 | -// log.info("该公众号没有获取用户信息权限!"); | |
| 125 | -// } | |
| 126 | -// } catch (Exception e) { | |
| 127 | -// e.printStackTrace(); | |
| 128 | -// } | |
| 129 | -// | |
| 130 | -// } | |
| 131 | -// | |
| 132 | -// //当用户输入关键词如“你好”,“客服”等,并且有客服在线时,把消息转发给在线客服 | |
| 133 | -// try { | |
| 134 | -// if (StringUtils.startsWithAny(wxMessage.getContent(), "你好", "客服") | |
| 135 | -// && weixinService.getKefuService().kfOnlineList() | |
| 136 | -// .getKfOnlineList().size() > 0) { | |
| 137 | -// return WxMpXmlOutMessage.TRANSFER_CUSTOMER_SERVICE() | |
| 138 | -// .fromUser(wxMessage.getToUser()) | |
| 139 | -// .toUser(wxMessage.getFromUser()).build(); | |
| 140 | -// } | |
| 141 | -// } catch (WxErrorException e) { | |
| 142 | -// e.printStackTrace(); | |
| 143 | -// } | |
| 144 | - | |
| 145 | - //组装默认回复消息 | |
| 146 | - return new TextBuilder().build("测试", wxMessage, weixinService); | |
| 147 | - } | |
| 148 | - | |
| 149 | - | |
| 150 | - //处理回复信息,优先级,关键字、智能机器人、默认值 | |
| 151 | - String processContent(WxMpXmlMessage wxMessage) { | |
| 152 | - String content = "你猜"; | |
| 153 | - /* content = processReceiveTextContent(wxMessage); | |
| 154 | - if(StringUtils.isNotBlank( content )){ | |
| 155 | - return content; | |
| 32 | + // 只处理指定类型的消息 | |
| 33 | + if (!MpAutoReplyDO.REQUEST_MESSAGE_TYPE.contains(wxMessage.getMsgType())) { | |
| 34 | + return null; | |
| 156 | 35 | } |
| 157 | 36 | |
| 158 | - content = defaultResponseContent;*/ | |
| 159 | - return content; | |
| 37 | + // 自动回复 | |
| 38 | + return mpAutoReplyService.replyForMessage(MpContextHolder.getAppId(), wxMessage); | |
| 160 | 39 | } |
| 161 | 40 | |
| 162 | - //处理关键字 | |
| 163 | - String processReceiveTextContent(WxMpXmlMessage wxMessage) { | |
| 164 | - String content = ""; | |
| 165 | - /* WxAccountDO wxAccount = wxAccountService.findBy( WxAccountDO::getAccount,wxMessage.getToUser()); | |
| 166 | - if(wxAccount != null){ | |
| 167 | - WxReceiveText wxReceiveTextTpl = new WxReceiveText(); | |
| 168 | - wxReceiveTextTpl.setWxAccountId( String.valueOf( wxAccount.getId() ) ); | |
| 169 | - wxReceiveTextTpl.setReceiveText( wxMessage.getContent() ); | |
| 170 | - List<WxReceiveText> wxReceiveTextList = wxReceiveTextService.findListByReceiveTest( wxReceiveTextTpl ); | |
| 171 | - if(wxReceiveTextList != null && wxReceiveTextList.size() > 0){ | |
| 172 | - WxReceiveText wxReceiveText = wxReceiveTextList.get( 0 ); | |
| 173 | - WxTextTemplate wxTextTemplate = wxTextTemplateService.findById( Integer.parseInt( wxReceiveText.getTplId() ) ); | |
| 174 | - content = wxTextTemplate.getContent(); | |
| 175 | - } | |
| 176 | - }*/ | |
| 177 | - return content; | |
| 178 | - } | |
| 179 | - | |
| 180 | - | |
| 181 | 41 | } | ... | ... |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/handler/user/LocationHandler.java
| 1 | 1 | package cn.iocoder.yudao.module.mp.service.handler.user; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.mp.builder.TextBuilder; | |
| 4 | 3 | import lombok.extern.slf4j.Slf4j; |
| 5 | 4 | import me.chanjar.weixin.common.session.WxSessionManager; |
| 6 | 5 | import me.chanjar.weixin.mp.api.WxMpMessageHandler; |
| ... | ... | @@ -11,8 +10,6 @@ import org.springframework.stereotype.Component; |
| 11 | 10 | |
| 12 | 11 | import java.util.Map; |
| 13 | 12 | |
| 14 | -import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType; | |
| 15 | - | |
| 16 | 13 | /** |
| 17 | 14 | * 上报地理位置的事件处理器 |
| 18 | 15 | * |
| ... | ... | @@ -25,20 +22,20 @@ public class LocationHandler implements WxMpMessageHandler { |
| 25 | 22 | @Override |
| 26 | 23 | public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, |
| 27 | 24 | WxMpService wxMpService, WxSessionManager sessionManager) { |
| 28 | - if (wxMessage.getMsgType().equals(XmlMsgType.LOCATION)) { | |
| 29 | - //TODO 接收处理用户发送的地理位置消息 | |
| 30 | - try { | |
| 31 | - String content = "感谢反馈,您的的地理位置已收到!"; | |
| 32 | - return new TextBuilder().build(content, wxMessage, null); | |
| 33 | - } catch (Exception e) { | |
| 34 | - log.error("位置消息接收处理失败", e); | |
| 35 | - return null; | |
| 36 | - } | |
| 37 | - } | |
| 38 | - | |
| 39 | - //上报地理位置事件 | |
| 40 | - log.info("上报地理位置,纬度 : {},经度 : {},精度 : {}", | |
| 41 | - wxMessage.getLatitude(), wxMessage.getLongitude(), String.valueOf(wxMessage.getPrecision())); | |
| 25 | +// if (wxMessage.getMsgType().equals(XmlMsgType.LOCATION)) { | |
| 26 | +// //TODO 接收处理用户发送的地理位置消息 | |
| 27 | +// try { | |
| 28 | +// String content = "感谢反馈,您的的地理位置已收到!"; | |
| 29 | +// return new TextBuilder().build(content, wxMessage, null); | |
| 30 | +// } catch (Exception e) { | |
| 31 | +// log.error("位置消息接收处理失败", e); | |
| 32 | +// return null; | |
| 33 | +// } | |
| 34 | +// } | |
| 35 | +// | |
| 36 | +// //上报地理位置事件 | |
| 37 | +// log.info("上报地理位置,纬度 : {},经度 : {},精度 : {}", | |
| 38 | +// wxMessage.getLatitude(), wxMessage.getLongitude(), String.valueOf(wxMessage.getPrecision())); | |
| 42 | 39 | |
| 43 | 40 | //TODO 可以将用户地理位置信息保存到本地数据库,以便以后使用 |
| 44 | 41 | ... | ... |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/handler/user/SubscribeHandler.java
| 1 | 1 | package cn.iocoder.yudao.module.mp.service.handler.user; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.mp.builder.TextBuilder; | |
| 4 | 3 | import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO; |
| 5 | 4 | import cn.iocoder.yudao.module.mp.framework.mp.core.context.MpContextHolder; |
| 6 | 5 | import cn.iocoder.yudao.module.mp.service.account.MpAccountService; |
| ... | ... | @@ -56,7 +55,8 @@ public class SubscribeHandler implements WxMpMessageHandler { |
| 56 | 55 | } |
| 57 | 56 | |
| 58 | 57 | // 第三步,回复关注的欢迎语 TODO 芋艿:关注的欢迎语 |
| 59 | - return new TextBuilder().build("感谢关注", wxMessage, weixinService); | |
| 58 | +// return new TextBuilder().build("感谢关注", wxMessage, weixinService); | |
| 59 | + return null; | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** | ... | ... |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/message/MpAutoReplyService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mp.service.message; | |
| 2 | + | |
| 3 | +import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |
| 4 | +import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 公众号的自动回复 Service 接口 | |
| 8 | + * | |
| 9 | + * @author 芋道源码 | |
| 10 | + */ | |
| 11 | +public interface MpAutoReplyService { | |
| 12 | + | |
| 13 | + /** | |
| 14 | + * 当收到消息时,自动回复 | |
| 15 | + * | |
| 16 | + * @param appId 微信公众号 appId | |
| 17 | + * @param wxMessage 消息 | |
| 18 | + * @return 回复的消息 | |
| 19 | + */ | |
| 20 | + WxMpXmlOutMessage replyForMessage(String appId, WxMpXmlMessage wxMessage); | |
| 21 | + | |
| 22 | +} | ... | ... |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/message/MpAutoReplyServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mp.service.message; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.iocoder.yudao.module.mp.dal.dataobject.message.MpAutoReplyDO; | |
| 5 | +import cn.iocoder.yudao.module.mp.dal.mysql.message.MpAutoReplyMapper; | |
| 6 | +import cn.iocoder.yudao.module.mp.enums.message.MpAutoReplyMatchEnum; | |
| 7 | +import me.chanjar.weixin.common.api.WxConsts; | |
| 8 | +import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |
| 9 | +import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |
| 10 | +import org.springframework.validation.annotation.Validated; | |
| 11 | + | |
| 12 | +import javax.annotation.Resource; | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * 公众号的自动回复 Service 实现类 | |
| 17 | + * | |
| 18 | + * @author 芋道源码 | |
| 19 | + */ | |
| 20 | +@Resource | |
| 21 | +@Validated | |
| 22 | +public class MpAutoReplyServiceImpl implements MpAutoReplyService { | |
| 23 | + | |
| 24 | + @Resource | |
| 25 | + private MpAutoReplyService mpAutoReplyService; | |
| 26 | + | |
| 27 | + @Resource | |
| 28 | + private MpAutoReplyMapper mpAutoReplyMapper; | |
| 29 | + | |
| 30 | + @Override | |
| 31 | + public WxMpXmlOutMessage replyForMessage(String appId, WxMpXmlMessage wxMessage) { | |
| 32 | + // 第一步,匹配自动回复 | |
| 33 | + List<MpAutoReplyDO> replies = null; | |
| 34 | + // 1.1 关键字 | |
| 35 | + if (wxMessage.getMsgType().equals(WxConsts.XmlMsgType.TEXT)) { | |
| 36 | + // 完全匹配 | |
| 37 | + replies = mpAutoReplyMapper.selectListByAppIdAndKeywordAll(appId, wxMessage.getContent()); | |
| 38 | + if (CollUtil.isEmpty(replies)) { | |
| 39 | + // 模糊匹配 | |
| 40 | + replies = mpAutoReplyMapper.selectListByAppIdAndKeywordLike(appId, wxMessage.getContent()); | |
| 41 | + } | |
| 42 | + } | |
| 43 | + // 1.2 消息类型 | |
| 44 | + if (CollUtil.isEmpty(replies)) { | |
| 45 | + replies = mpAutoReplyMapper.selectListByAppIdAndMessage(appId, wxMessage.getMsgType()); | |
| 46 | + } | |
| 47 | + if (CollUtil.isEmpty(replies)) { | |
| 48 | + return null; | |
| 49 | + } | |
| 50 | + | |
| 51 | + // 第二步,基于自动回复,创建消息 | |
| 52 | + | |
| 53 | + | |
| 54 | + // 第三步,将消息转换成 WxMpXmlOutMessage 返回 | |
| 55 | + return null; | |
| 56 | + } | |
| 57 | + | |
| 58 | +} | ... | ... |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/newsarticleitem/WxNewsArticleItemService.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.service.newsarticleitem; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | -import javax.validation.*; | |
| 5 | - | |
| 6 | -import cn.iocoder.yudao.module.mp.controller.admin.newsarticleitem.vo.*; | |
| 7 | -import cn.iocoder.yudao.module.mp.dal.dataobject.newsarticleitem.WxNewsArticleItemDO; | |
| 8 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 图文消息文章列表表 Service 接口 | |
| 12 | - * | |
| 13 | - * @author 芋道源码 | |
| 14 | - */ | |
| 15 | -public interface WxNewsArticleItemService { | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * 创建图文消息文章列表表 | |
| 19 | - * | |
| 20 | - * @param createReqVO 创建信息 | |
| 21 | - * @return 编号 | |
| 22 | - */ | |
| 23 | - Integer createWxNewsArticleItem(@Valid WxNewsArticleItemCreateReqVO createReqVO); | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 更新图文消息文章列表表 | |
| 27 | - * | |
| 28 | - * @param updateReqVO 更新信息 | |
| 29 | - */ | |
| 30 | - void updateWxNewsArticleItem(@Valid WxNewsArticleItemUpdateReqVO updateReqVO); | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 删除图文消息文章列表表 | |
| 34 | - * | |
| 35 | - * @param id 编号 | |
| 36 | - */ | |
| 37 | - void deleteWxNewsArticleItem(Integer id); | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * 获得图文消息文章列表表 | |
| 41 | - * | |
| 42 | - * @param id 编号 | |
| 43 | - * @return 图文消息文章列表表 | |
| 44 | - */ | |
| 45 | - WxNewsArticleItemDO getWxNewsArticleItem(Integer id); | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * 获得图文消息文章列表表 列表 | |
| 49 | - * | |
| 50 | - * @param ids 编号 | |
| 51 | - * @return 图文消息文章列表表 列表 | |
| 52 | - */ | |
| 53 | - List<WxNewsArticleItemDO> getWxNewsArticleItemList(Collection<Integer> ids); | |
| 54 | - | |
| 55 | - /** | |
| 56 | - * 获得图文消息文章列表表 分页 | |
| 57 | - * | |
| 58 | - * @param pageReqVO 分页查询 | |
| 59 | - * @return 图文消息文章列表表 分页 | |
| 60 | - */ | |
| 61 | - PageResult<WxNewsArticleItemDO> getWxNewsArticleItemPage(WxNewsArticleItemPageReqVO pageReqVO); | |
| 62 | - | |
| 63 | - /** | |
| 64 | - * 获得图文消息文章列表表 列表, 用于 Excel 导出 | |
| 65 | - * | |
| 66 | - * @param exportReqVO 查询条件 | |
| 67 | - * @return 图文消息文章列表表 列表 | |
| 68 | - */ | |
| 69 | - List<WxNewsArticleItemDO> getWxNewsArticleItemList(WxNewsArticleItemExportReqVO exportReqVO); | |
| 70 | - | |
| 71 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/newsarticleitem/WxNewsArticleItemServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.service.newsarticleitem; | |
| 2 | - | |
| 3 | -import org.springframework.stereotype.Service; | |
| 4 | - | |
| 5 | -import javax.annotation.Resource; | |
| 6 | - | |
| 7 | -import org.springframework.validation.annotation.Validated; | |
| 8 | - | |
| 9 | -import java.util.*; | |
| 10 | - | |
| 11 | -import cn.iocoder.yudao.module.mp.controller.admin.newsarticleitem.vo.*; | |
| 12 | -import cn.iocoder.yudao.module.mp.dal.dataobject.newsarticleitem.WxNewsArticleItemDO; | |
| 13 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 14 | - | |
| 15 | -import cn.iocoder.yudao.module.mp.convert.newsarticleitem.WxNewsArticleItemConvert; | |
| 16 | -import cn.iocoder.yudao.module.mp.dal.mysql.newsarticleitem.WxNewsArticleItemMapper; | |
| 17 | - | |
| 18 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 19 | -import static cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants.*; | |
| 20 | - | |
| 21 | -/** | |
| 22 | - * 图文消息文章列表表 Service 实现类 | |
| 23 | - * | |
| 24 | - * @author 芋道源码 | |
| 25 | - */ | |
| 26 | -@Service | |
| 27 | -@Validated | |
| 28 | -public class WxNewsArticleItemServiceImpl implements WxNewsArticleItemService { | |
| 29 | - | |
| 30 | - @Resource | |
| 31 | - private WxNewsArticleItemMapper wxNewsArticleItemMapper; | |
| 32 | - | |
| 33 | - @Override | |
| 34 | - public Integer createWxNewsArticleItem(WxNewsArticleItemCreateReqVO createReqVO) { | |
| 35 | - // 插入 | |
| 36 | - WxNewsArticleItemDO wxNewsArticleItem = WxNewsArticleItemConvert.INSTANCE.convert(createReqVO); | |
| 37 | - wxNewsArticleItemMapper.insert(wxNewsArticleItem); | |
| 38 | - // 返回 | |
| 39 | - return wxNewsArticleItem.getId(); | |
| 40 | - } | |
| 41 | - | |
| 42 | - @Override | |
| 43 | - public void updateWxNewsArticleItem(WxNewsArticleItemUpdateReqVO updateReqVO) { | |
| 44 | - // 校验存在 | |
| 45 | - this.validateWxNewsArticleItemExists(updateReqVO.getId()); | |
| 46 | - // 更新 | |
| 47 | - WxNewsArticleItemDO updateObj = WxNewsArticleItemConvert.INSTANCE.convert(updateReqVO); | |
| 48 | - wxNewsArticleItemMapper.updateById(updateObj); | |
| 49 | - } | |
| 50 | - | |
| 51 | - @Override | |
| 52 | - public void deleteWxNewsArticleItem(Integer id) { | |
| 53 | - // 校验存在 | |
| 54 | - this.validateWxNewsArticleItemExists(id); | |
| 55 | - // 删除 | |
| 56 | - wxNewsArticleItemMapper.deleteById(id); | |
| 57 | - } | |
| 58 | - | |
| 59 | - private void validateWxNewsArticleItemExists(Integer id) { | |
| 60 | - if (wxNewsArticleItemMapper.selectById(id) == null) { | |
| 61 | - throw exception(COMMON_NOT_EXISTS); | |
| 62 | - } | |
| 63 | - } | |
| 64 | - | |
| 65 | - @Override | |
| 66 | - public WxNewsArticleItemDO getWxNewsArticleItem(Integer id) { | |
| 67 | - return wxNewsArticleItemMapper.selectById(id); | |
| 68 | - } | |
| 69 | - | |
| 70 | - @Override | |
| 71 | - public List<WxNewsArticleItemDO> getWxNewsArticleItemList(Collection<Integer> ids) { | |
| 72 | - return wxNewsArticleItemMapper.selectBatchIds(ids); | |
| 73 | - } | |
| 74 | - | |
| 75 | - @Override | |
| 76 | - public PageResult<WxNewsArticleItemDO> getWxNewsArticleItemPage(WxNewsArticleItemPageReqVO pageReqVO) { | |
| 77 | - return wxNewsArticleItemMapper.selectPage(pageReqVO); | |
| 78 | - } | |
| 79 | - | |
| 80 | - @Override | |
| 81 | - public List<WxNewsArticleItemDO> getWxNewsArticleItemList(WxNewsArticleItemExportReqVO exportReqVO) { | |
| 82 | - return wxNewsArticleItemMapper.selectList(exportReqVO); | |
| 83 | - } | |
| 84 | - | |
| 85 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/newstemplate/WxNewsTemplateService.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.service.newstemplate; | |
| 2 | - | |
| 3 | -import java.util.*; | |
| 4 | -import javax.validation.*; | |
| 5 | - | |
| 6 | -import cn.iocoder.yudao.module.mp.controller.admin.newstemplate.vo.*; | |
| 7 | -import cn.iocoder.yudao.module.mp.dal.dataobject.newstemplate.WxNewsTemplateDO; | |
| 8 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 图文消息模板 Service 接口 | |
| 12 | - * | |
| 13 | - * @author 芋道源码 | |
| 14 | - */ | |
| 15 | -public interface WxNewsTemplateService { | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * 创建图文消息模板 | |
| 19 | - * | |
| 20 | - * @param createReqVO 创建信息 | |
| 21 | - * @return 编号 | |
| 22 | - */ | |
| 23 | - Integer createWxNewsTemplate(@Valid WxNewsTemplateCreateReqVO createReqVO); | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 更新图文消息模板 | |
| 27 | - * | |
| 28 | - * @param updateReqVO 更新信息 | |
| 29 | - */ | |
| 30 | - void updateWxNewsTemplate(@Valid WxNewsTemplateUpdateReqVO updateReqVO); | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 删除图文消息模板 | |
| 34 | - * | |
| 35 | - * @param id 编号 | |
| 36 | - */ | |
| 37 | - void deleteWxNewsTemplate(Integer id); | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * 获得图文消息模板 | |
| 41 | - * | |
| 42 | - * @param id 编号 | |
| 43 | - * @return 图文消息模板 | |
| 44 | - */ | |
| 45 | - WxNewsTemplateDO getWxNewsTemplate(Integer id); | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * 获得图文消息模板列表 | |
| 49 | - * | |
| 50 | - * @param ids 编号 | |
| 51 | - * @return 图文消息模板列表 | |
| 52 | - */ | |
| 53 | - List<WxNewsTemplateDO> getWxNewsTemplateList(Collection<Integer> ids); | |
| 54 | - | |
| 55 | - /** | |
| 56 | - * 获得图文消息模板分页 | |
| 57 | - * | |
| 58 | - * @param pageReqVO 分页查询 | |
| 59 | - * @return 图文消息模板分页 | |
| 60 | - */ | |
| 61 | - PageResult<WxNewsTemplateDO> getWxNewsTemplatePage(WxNewsTemplatePageReqVO pageReqVO); | |
| 62 | - | |
| 63 | - /** | |
| 64 | - * 获得图文消息模板列表, 用于 Excel 导出 | |
| 65 | - * | |
| 66 | - * @param exportReqVO 查询条件 | |
| 67 | - * @return 图文消息模板列表 | |
| 68 | - */ | |
| 69 | - List<WxNewsTemplateDO> getWxNewsTemplateList(WxNewsTemplateExportReqVO exportReqVO); | |
| 70 | - | |
| 71 | -} |
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/newstemplate/WxNewsTemplateServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.service.newstemplate; | |
| 2 | - | |
| 3 | -import org.springframework.stereotype.Service; | |
| 4 | - | |
| 5 | -import javax.annotation.Resource; | |
| 6 | - | |
| 7 | -import org.springframework.validation.annotation.Validated; | |
| 8 | - | |
| 9 | -import java.util.*; | |
| 10 | - | |
| 11 | -import cn.iocoder.yudao.module.mp.controller.admin.newstemplate.vo.*; | |
| 12 | -import cn.iocoder.yudao.module.mp.dal.dataobject.newstemplate.WxNewsTemplateDO; | |
| 13 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 14 | - | |
| 15 | -import cn.iocoder.yudao.module.mp.convert.newstemplate.WxNewsTemplateConvert; | |
| 16 | -import cn.iocoder.yudao.module.mp.dal.mysql.newstemplate.WxNewsTemplateMapper; | |
| 17 | - | |
| 18 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 19 | -import static cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants.*; | |
| 20 | - | |
| 21 | -/** | |
| 22 | - * 图文消息模板 Service 实现类 | |
| 23 | - * | |
| 24 | - * @author 芋道源码 | |
| 25 | - */ | |
| 26 | -@Service | |
| 27 | -@Validated | |
| 28 | -public class WxNewsTemplateServiceImpl implements WxNewsTemplateService { | |
| 29 | - | |
| 30 | - @Resource | |
| 31 | - private WxNewsTemplateMapper wxNewsTemplateMapper; | |
| 32 | - | |
| 33 | - @Override | |
| 34 | - public Integer createWxNewsTemplate(WxNewsTemplateCreateReqVO createReqVO) { | |
| 35 | - // 插入 | |
| 36 | - WxNewsTemplateDO wxNewsTemplate = WxNewsTemplateConvert.INSTANCE.convert(createReqVO); | |
| 37 | - wxNewsTemplateMapper.insert(wxNewsTemplate); | |
| 38 | - // 返回 | |
| 39 | - return wxNewsTemplate.getId(); | |
| 40 | - } | |
| 41 | - | |
| 42 | - @Override | |
| 43 | - public void updateWxNewsTemplate(WxNewsTemplateUpdateReqVO updateReqVO) { | |
| 44 | - // 校验存在 | |
| 45 | - this.validateWxNewsTemplateExists(updateReqVO.getId()); | |
| 46 | - // 更新 | |
| 47 | - WxNewsTemplateDO updateObj = WxNewsTemplateConvert.INSTANCE.convert(updateReqVO); | |
| 48 | - wxNewsTemplateMapper.updateById(updateObj); | |
| 49 | - } | |
| 50 | - | |
| 51 | - @Override | |
| 52 | - public void deleteWxNewsTemplate(Integer id) { | |
| 53 | - // 校验存在 | |
| 54 | - this.validateWxNewsTemplateExists(id); | |
| 55 | - // 删除 | |
| 56 | - wxNewsTemplateMapper.deleteById(id); | |
| 57 | - } | |
| 58 | - | |
| 59 | - private void validateWxNewsTemplateExists(Integer id) { | |
| 60 | - if (wxNewsTemplateMapper.selectById(id) == null) { | |
| 61 | - throw exception(COMMON_NOT_EXISTS); | |
| 62 | - } | |
| 63 | - } | |
| 64 | - | |
| 65 | - @Override | |
| 66 | - public WxNewsTemplateDO getWxNewsTemplate(Integer id) { | |
| 67 | - return wxNewsTemplateMapper.selectById(id); | |
| 68 | - } | |
| 69 | - | |
| 70 | - @Override | |
| 71 | - public List<WxNewsTemplateDO> getWxNewsTemplateList(Collection<Integer> ids) { | |
| 72 | - return wxNewsTemplateMapper.selectBatchIds(ids); | |
| 73 | - } | |
| 74 | - | |
| 75 | - @Override | |
| 76 | - public PageResult<WxNewsTemplateDO> getWxNewsTemplatePage(WxNewsTemplatePageReqVO pageReqVO) { | |
| 77 | - return wxNewsTemplateMapper.selectPage(pageReqVO); | |
| 78 | - } | |
| 79 | - | |
| 80 | - @Override | |
| 81 | - public List<WxNewsTemplateDO> getWxNewsTemplateList(WxNewsTemplateExportReqVO exportReqVO) { | |
| 82 | - return wxNewsTemplateMapper.selectList(exportReqVO); | |
| 83 | - } | |
| 84 | - | |
| 85 | -} |