From 8bcff4ed6f8e14758b939289d1b5489e9b70a4e1 Mon Sep 17 00:00:00 2001 From: fengdan Date: Thu, 16 Jun 2022 12:42:23 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"Revert=20"refactor(yudao-module-mp-bi?= =?UTF-8?q?z):=20=E5=BE=AE=E4=BF=A1=E5=85=AC=E4=BC=97=E5=8F=B7=E7=B2=89?= =?UTF-8?q?=E4=B8=9D=E7=AE=A1=E7=90=86=E9=87=8D=E6=9E=84""?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 2e18506e1a5d8ec9a23319f7ddef47051b6856d4. --- ...Controller.java => FansTagController.java} | 79 +++++++++-------- ...xFansTagBaseVO.java => FansTagBaseVO.java} | 16 ++-- ...eateReqVO.java => FansTagCreateReqVO.java} | 5 +- ...ansTagExcelVO.java => FansTagExcelVO.java} | 5 +- ...portReqVO.java => FansTagExportReqVO.java} | 2 +- ...agPageReqVO.java => FansTagPageReqVO.java} | 2 +- ...xFansTagRespVO.java => FansTagRespVO.java} | 6 +- ...dateReqVO.java => FansTagUpdateReqVO.java} | 2 +- .../mp/convert/fanstag/WxFansTagConvert.java | 16 ++-- .../dal/dataobject/fanstag/WxFansTagDO.java | 43 ---------- .../mp/dal/mysql/fanstag/WxFansTagMapper.java | 38 --------- .../mp/service/fanstag/WxFansTagService.java | 71 ---------------- .../service/fanstag/WxFansTagServiceImpl.java | 85 ------------------- .../module/mp/service/tag/FansTagService.java | 75 ++++++++++++++++ .../mp/service/tag/FansTagServiceImpl.java | 77 +++++++++++++++++ 15 files changed, 217 insertions(+), 305 deletions(-) rename yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/{WxFansTagController.java => FansTagController.java} (64%) rename yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/{WxFansTagBaseVO.java => FansTagBaseVO.java} (54%) rename yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/{WxFansTagCreateReqVO.java => FansTagCreateReqVO.java} (74%) rename yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/{WxFansTagExcelVO.java => FansTagExcelVO.java} (82%) rename yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/{WxFansTagExportReqVO.java => FansTagExportReqVO.java} (96%) rename yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/{WxFansTagPageReqVO.java => FansTagPageReqVO.java} (95%) rename yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/{WxFansTagRespVO.java => FansTagRespVO.java} (72%) rename yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/{WxFansTagUpdateReqVO.java => FansTagUpdateReqVO.java} (87%) delete mode 100644 yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/fanstag/WxFansTagDO.java delete mode 100644 yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/fanstag/WxFansTagMapper.java delete mode 100644 yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagService.java delete mode 100644 yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagServiceImpl.java create mode 100644 yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagService.java create mode 100644 yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagServiceImpl.java diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/WxFansTagController.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/FansTagController.java similarity index 64% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/WxFansTagController.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/FansTagController.java index 9b20ecc97..f89758e57 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/WxFansTagController.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/FansTagController.java @@ -1,55 +1,54 @@ package cn.iocoder.yudao.module.mp.controller.admin.fanstag; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.*; +import cn.iocoder.yudao.module.mp.convert.fanstag.WxFansTagConvert; +import cn.iocoder.yudao.module.mp.service.tag.FansTagService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import me.chanjar.weixin.mp.bean.tag.WxUserTag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; 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 javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; import java.io.IOException; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import java.util.Collection; +import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; -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.fanstag.vo.*; -import cn.iocoder.yudao.module.mp.dal.dataobject.fanstag.WxFansTagDO; -import cn.iocoder.yudao.module.mp.convert.fanstag.WxFansTagConvert; -import cn.iocoder.yudao.module.mp.service.fanstag.WxFansTagService; - +/** + * @author fengdan + */ @Api(tags = "管理后台 - 粉丝标签") @RestController -@RequestMapping("/wechatMp/wx-fans-tag") +@RequestMapping("/wechat-mp/fans-tag") @Validated -public class WxFansTagController { +public class FansTagController { @Resource - private WxFansTagService wxFansTagService; + private FansTagService fansTagService; @PostMapping("/create") @ApiOperation("创建粉丝标签") @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:create')") - public CommonResult createWxFansTag(@Valid @RequestBody WxFansTagCreateReqVO createReqVO) { - return success(wxFansTagService.createWxFansTag(createReqVO)); + public CommonResult createWxFansTag(@Valid @RequestBody FansTagCreateReqVO createReqVO) { + return success(fansTagService.createWxFansTag(createReqVO)); } @PutMapping("/update") @ApiOperation("更新粉丝标签") @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:update')") - public CommonResult updateWxFansTag(@Valid @RequestBody WxFansTagUpdateReqVO updateReqVO) { - wxFansTagService.updateWxFansTag(updateReqVO); + public CommonResult updateWxFansTag(@Valid @RequestBody FansTagUpdateReqVO updateReqVO) { + fansTagService.updateWxFansTag(updateReqVO); return success(true); } @@ -58,7 +57,7 @@ public class WxFansTagController { @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class) @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:delete')") public CommonResult deleteWxFansTag(@RequestParam("id") Integer id) { - wxFansTagService.deleteWxFansTag(id); + fansTagService.deleteWxFansTag(id); return success(true); } @@ -66,8 +65,8 @@ public class WxFansTagController { @ApiOperation("获得粉丝标签") @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class) @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:query')") - public CommonResult getWxFansTag(@RequestParam("id") Integer id) { - WxFansTagDO wxFansTag = wxFansTagService.getWxFansTag(id); + public CommonResult getWxFansTag(@RequestParam("id") Integer id) { + WxUserTag wxFansTag = fansTagService.getWxFansTag(id); return success(WxFansTagConvert.INSTANCE.convert(wxFansTag)); } @@ -75,16 +74,16 @@ public class WxFansTagController { @ApiOperation("获得粉丝标签列表") @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:query')") - public CommonResult> getWxFansTagList(@RequestParam("ids") Collection ids) { - List list = wxFansTagService.getWxFansTagList(ids); + public CommonResult> getWxFansTagList(@RequestParam("ids") Collection ids) { + List list = fansTagService.getWxFansTagList(ids); return success(WxFansTagConvert.INSTANCE.convertList(list)); } @GetMapping("/page") @ApiOperation("获得粉丝标签分页") @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:query')") - public CommonResult> getWxFansTagPage(@Valid WxFansTagPageReqVO pageVO) { - PageResult pageResult = wxFansTagService.getWxFansTagPage(pageVO); + public CommonResult> getWxFansTagPage(@Valid FansTagPageReqVO pageVO) { + PageResult pageResult = fansTagService.getWxFansTagPage(pageVO); return success(WxFansTagConvert.INSTANCE.convertPage(pageResult)); } @@ -92,12 +91,12 @@ public class WxFansTagController { @ApiOperation("导出粉丝标签 Excel") @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:export')") @OperateLog(type = EXPORT) - public void exportWxFansTagExcel(@Valid WxFansTagExportReqVO exportReqVO, + public void exportWxFansTagExcel(@Valid FansTagExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = wxFansTagService.getWxFansTagList(exportReqVO); + List list = fansTagService.getWxFansTagList(exportReqVO); // 导出 Excel - List datas = WxFansTagConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "粉丝标签.xls", "数据", WxFansTagExcelVO.class, datas); + List datas = WxFansTagConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "粉丝标签.xls", "数据", FansTagExcelVO.class, datas); } } diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagBaseVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagBaseVO.java similarity index 54% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagBaseVO.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagBaseVO.java index 139a9b95a..3515dbae0 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagBaseVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagBaseVO.java @@ -1,22 +1,20 @@ package cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo; -import lombok.*; -import io.swagger.annotations.*; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; /** * 粉丝标签 Base VO,提供给添加、修改、详细的子 VO 使用 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + * + * @author fengdan */ @Data -public class WxFansTagBaseVO { +public class FansTagBaseVO { - @ApiModelProperty(value = "标签名称") + @ApiModelProperty(value = "标签名,UTF8编码.") private String name; - @ApiModelProperty(value = "粉丝数量") + @ApiModelProperty(value = "此标签下粉丝数") private Integer count; - - @ApiModelProperty(value = "微信账号ID") - private String wxAccountId; - } diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagCreateReqVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagCreateReqVO.java similarity index 74% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagCreateReqVO.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagCreateReqVO.java index a9ff3a8e8..51dc8552e 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagCreateReqVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagCreateReqVO.java @@ -3,10 +3,13 @@ package cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo; import lombok.*; import io.swagger.annotations.*; +/** + * @author fengdan + */ @ApiModel("管理后台 - 粉丝标签创建 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class WxFansTagCreateReqVO extends WxFansTagBaseVO { +public class FansTagCreateReqVO extends FansTagBaseVO { } diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagExcelVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagExcelVO.java similarity index 82% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagExcelVO.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagExcelVO.java index 26ecdeb25..b55c9ddf5 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagExcelVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagExcelVO.java @@ -12,7 +12,7 @@ import com.alibaba.excel.annotation.ExcelProperty; * @author 芋道源码 */ @Data -public class WxFansTagExcelVO { +public class FansTagExcelVO { @ExcelProperty("主键") private Integer id; @@ -23,9 +23,6 @@ public class WxFansTagExcelVO { @ExcelProperty("粉丝数量") private Integer count; - @ExcelProperty("微信账号ID") - private String wxAccountId; - @ExcelProperty("创建时间") private Date createTime; diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagExportReqVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagExportReqVO.java similarity index 96% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagExportReqVO.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagExportReqVO.java index f5ba4be2f..fbe23b2b4 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagExportReqVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagExportReqVO.java @@ -11,7 +11,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ApiModel(value = "管理后台 - 粉丝标签 Excel 导出 Request VO", description = "参数和 WxFansTagPageReqVO 是一致的") @Data -public class WxFansTagExportReqVO { +public class FansTagExportReqVO { @ApiModelProperty(value = "标签名称") private String name; diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagPageReqVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagPageReqVO.java similarity index 95% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagPageReqVO.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagPageReqVO.java index 94690e909..69014762d 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagPageReqVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagPageReqVO.java @@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class WxFansTagPageReqVO extends PageParam { +public class FansTagPageReqVO extends PageParam { @ApiModelProperty(value = "标签名称") private String name; diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagRespVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagRespVO.java similarity index 72% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagRespVO.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagRespVO.java index 601353583..7fd996715 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagRespVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagRespVO.java @@ -10,10 +10,10 @@ import io.swagger.annotations.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class WxFansTagRespVO extends WxFansTagBaseVO { +public class FansTagRespVO extends FansTagBaseVO { - @ApiModelProperty(value = "主键", required = true) - private Integer id; + @ApiModelProperty(value = "标签id,由微信分配.") + private Long id; @ApiModelProperty(value = "创建时间", required = true) private Date createTime; diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagUpdateReqVO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagUpdateReqVO.java similarity index 87% rename from yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagUpdateReqVO.java rename to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagUpdateReqVO.java index 155f263dd..bfb01dcfa 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagUpdateReqVO.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagUpdateReqVO.java @@ -9,7 +9,7 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class WxFansTagUpdateReqVO extends WxFansTagBaseVO { +public class FansTagUpdateReqVO extends FansTagBaseVO { @ApiModelProperty(value = "主键", required = true) @NotNull(message = "主键不能为空") diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/fanstag/WxFansTagConvert.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/fanstag/WxFansTagConvert.java index 948199677..968d62b8a 100644 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/fanstag/WxFansTagConvert.java +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/fanstag/WxFansTagConvert.java @@ -4,31 +4,31 @@ import java.util.*; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import me.chanjar.weixin.mp.bean.tag.WxUserTag; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.*; -import cn.iocoder.yudao.module.mp.dal.dataobject.fanstag.WxFansTagDO; /** * 粉丝标签 Convert * - * @author 芋道源码 + * @author fengdan */ @Mapper public interface WxFansTagConvert { WxFansTagConvert INSTANCE = Mappers.getMapper(WxFansTagConvert.class); - WxFansTagDO convert(WxFansTagCreateReqVO bean); + WxUserTag convert(FansTagCreateReqVO bean); - WxFansTagDO convert(WxFansTagUpdateReqVO bean); + WxUserTag convert(FansTagUpdateReqVO bean); - WxFansTagRespVO convert(WxFansTagDO bean); + FansTagRespVO convert(WxUserTag bean); - List convertList(List list); + List convertList(List list); - PageResult convertPage(PageResult page); + PageResult convertPage(PageResult page); - List convertList02(List list); + List convertList02(List list); } diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/fanstag/WxFansTagDO.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/fanstag/WxFansTagDO.java deleted file mode 100644 index a98f009b5..000000000 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/fanstag/WxFansTagDO.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.iocoder.yudao.module.mp.dal.dataobject.fanstag; - -import lombok.*; - -import java.util.*; - -import com.baomidou.mybatisplus.annotation.*; -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; - -/** - * 粉丝标签 DO - * - * @author 芋道源码 - */ -@TableName("wx_fans_tag") -@KeySequence("wx_fans_tag_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class WxFansTagDO extends BaseDO { - - /** - * 主键 - */ - @TableId - private Integer id; - /** - * 标签名称 - */ - private String name; - /** - * 粉丝数量 - */ - private Integer count; - /** - * 微信账号ID - */ - private String wxAccountId; - -} diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/fanstag/WxFansTagMapper.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/fanstag/WxFansTagMapper.java deleted file mode 100644 index 5ec73ffcf..000000000 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/fanstag/WxFansTagMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.iocoder.yudao.module.mp.dal.mysql.fanstag; - -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.fanstag.WxFansTagDO; -import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.*; - -/** - * 粉丝标签 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface WxFansTagMapper extends BaseMapperX { - - default PageResult selectPage(WxFansTagPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .likeIfPresent(WxFansTagDO::getName, reqVO.getName()) - .eqIfPresent(WxFansTagDO::getCount, reqVO.getCount()) - .eqIfPresent(WxFansTagDO::getWxAccountId, reqVO.getWxAccountId()) - .betweenIfPresent(WxFansTagDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc(WxFansTagDO::getId)); - } - - default List selectList(WxFansTagExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .likeIfPresent(WxFansTagDO::getName, reqVO.getName()) - .eqIfPresent(WxFansTagDO::getCount, reqVO.getCount()) - .eqIfPresent(WxFansTagDO::getWxAccountId, reqVO.getWxAccountId()) - .betweenIfPresent(WxFansTagDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc(WxFansTagDO::getId)); - } - -} diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagService.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagService.java deleted file mode 100644 index da5ec220c..000000000 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagService.java +++ /dev/null @@ -1,71 +0,0 @@ -package cn.iocoder.yudao.module.mp.service.fanstag; - -import java.util.*; -import javax.validation.*; - -import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.*; -import cn.iocoder.yudao.module.mp.dal.dataobject.fanstag.WxFansTagDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -/** - * 粉丝标签 Service 接口 - * - * @author 芋道源码 - */ -public interface WxFansTagService { - - /** - * 创建粉丝标签 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - Integer createWxFansTag(@Valid WxFansTagCreateReqVO createReqVO); - - /** - * 更新粉丝标签 - * - * @param updateReqVO 更新信息 - */ - void updateWxFansTag(@Valid WxFansTagUpdateReqVO updateReqVO); - - /** - * 删除粉丝标签 - * - * @param id 编号 - */ - void deleteWxFansTag(Integer id); - - /** - * 获得粉丝标签 - * - * @param id 编号 - * @return 粉丝标签 - */ - WxFansTagDO getWxFansTag(Integer id); - - /** - * 获得粉丝标签列表 - * - * @param ids 编号 - * @return 粉丝标签列表 - */ - List getWxFansTagList(Collection ids); - - /** - * 获得粉丝标签分页 - * - * @param pageReqVO 分页查询 - * @return 粉丝标签分页 - */ - PageResult getWxFansTagPage(WxFansTagPageReqVO pageReqVO); - - /** - * 获得粉丝标签列表, 用于 Excel 导出 - * - * @param exportReqVO 查询条件 - * @return 粉丝标签列表 - */ - List getWxFansTagList(WxFansTagExportReqVO exportReqVO); - -} diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagServiceImpl.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagServiceImpl.java deleted file mode 100644 index f1ae773f8..000000000 --- a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagServiceImpl.java +++ /dev/null @@ -1,85 +0,0 @@ -package cn.iocoder.yudao.module.mp.service.fanstag; - -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.fanstag.vo.*; -import cn.iocoder.yudao.module.mp.dal.dataobject.fanstag.WxFansTagDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import cn.iocoder.yudao.module.mp.convert.fanstag.WxFansTagConvert; -import cn.iocoder.yudao.module.mp.dal.mysql.fanstag.WxFansTagMapper; - -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 WxFansTagServiceImpl implements WxFansTagService { - - @Resource - private WxFansTagMapper wxFansTagMapper; - - @Override - public Integer createWxFansTag(WxFansTagCreateReqVO createReqVO) { - // 插入 - WxFansTagDO wxFansTag = WxFansTagConvert.INSTANCE.convert(createReqVO); - wxFansTagMapper.insert(wxFansTag); - // 返回 - return wxFansTag.getId(); - } - - @Override - public void updateWxFansTag(WxFansTagUpdateReqVO updateReqVO) { - // 校验存在 - this.validateWxFansTagExists(updateReqVO.getId()); - // 更新 - WxFansTagDO updateObj = WxFansTagConvert.INSTANCE.convert(updateReqVO); - wxFansTagMapper.updateById(updateObj); - } - - @Override - public void deleteWxFansTag(Integer id) { - // 校验存在 - this.validateWxFansTagExists(id); - // 删除 - wxFansTagMapper.deleteById(id); - } - - private void validateWxFansTagExists(Integer id) { - if (wxFansTagMapper.selectById(id) == null) { - throw exception(COMMON_NOT_EXISTS); - } - } - - @Override - public WxFansTagDO getWxFansTag(Integer id) { - return wxFansTagMapper.selectById(id); - } - - @Override - public List getWxFansTagList(Collection ids) { - return wxFansTagMapper.selectBatchIds(ids); - } - - @Override - public PageResult getWxFansTagPage(WxFansTagPageReqVO pageReqVO) { - return wxFansTagMapper.selectPage(pageReqVO); - } - - @Override - public List getWxFansTagList(WxFansTagExportReqVO exportReqVO) { - return wxFansTagMapper.selectList(exportReqVO); - } - -} diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagService.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagService.java new file mode 100644 index 000000000..f8f082608 --- /dev/null +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagService.java @@ -0,0 +1,75 @@ +package cn.iocoder.yudao.module.mp.service.tag; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagCreateReqVO; +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagExportReqVO; +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagPageReqVO; +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagUpdateReqVO; +import me.chanjar.weixin.mp.bean.tag.WxUserTag; + +import javax.validation.Valid; +import java.util.Collection; +import java.util.List; + +/** + * 粉丝标签 Service 接口 + * + * @author fengdan + */ +public interface FansTagService { + + /** + * 创建粉丝标签 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + WxUserTag createWxFansTag(@Valid FansTagCreateReqVO createReqVO); + + /** + * 更新粉丝标签 + * + * @param updateReqVO 更新信息 + */ + void updateWxFansTag(@Valid FansTagUpdateReqVO updateReqVO); + + /** + * 删除粉丝标签 + * + * @param id 编号 + */ + void deleteWxFansTag(Integer id); + + /** + * 获得粉丝标签 + * + * @param id 编号 + * @return 粉丝标签 + */ + WxUserTag getWxFansTag(Integer id); + + /** + * 获得粉丝标签列表 + * + * @param ids 编号 + * @return 粉丝标签列表 + */ + List getWxFansTagList(Collection ids); + + /** + * 获得粉丝标签分页 + * + * @param pageReqVO 分页查询 + * @return 粉丝标签分页 + */ + PageResult getWxFansTagPage(FansTagPageReqVO pageReqVO); + + /** + * 获得粉丝标签列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 粉丝标签列表 + */ + List getWxFansTagList(FansTagExportReqVO exportReqVO); + +} diff --git a/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagServiceImpl.java b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagServiceImpl.java new file mode 100644 index 000000000..61b207068 --- /dev/null +++ b/yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagServiceImpl.java @@ -0,0 +1,77 @@ +package cn.iocoder.yudao.module.mp.service.tag; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagCreateReqVO; +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagExportReqVO; +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagPageReqVO; +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagUpdateReqVO; +import cn.iocoder.yudao.module.mp.convert.fanstag.WxFansTagConvert; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.bean.tag.WxUserTag; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; + +/** + * 粉丝标签 Service 实现类 + * + * @author fengdan + */ +@Slf4j +@Service +@Validated +public class FansTagServiceImpl implements FansTagService { + + @Resource + private WxMpService wxMpService; + + @Override + public WxUserTag createWxFansTag(FansTagCreateReqVO createReqVO) { + try { + return wxMpService.getUserTagService().tagCreate("wxFansTag"); + } catch (WxErrorException e) { + throw new RuntimeException(e); + } + } + + @Override + public void updateWxFansTag(FansTagUpdateReqVO updateReqVO) { + // 校验存在 + // 更新 + WxUserTag updateObj = WxFansTagConvert.INSTANCE.convert(updateReqVO); + + } + + @Override + public void deleteWxFansTag(Integer id) { + // 校验存在 + // 删除 + } + + + @Override + public WxUserTag getWxFansTag(Integer id) { + return null; + } + + @Override + public List getWxFansTagList(Collection ids) { + return null; + } + + @Override + public PageResult getWxFansTagPage(FansTagPageReqVO pageReqVO) { + return null; + } + + @Override + public List getWxFansTagList(FansTagExportReqVO exportReqVO) { + return null; + } + +}