Commit 8bcff4ed6f8e14758b939289d1b5489e9b70a4e1
1 parent
2e18506e
Revert "Revert "refactor(yudao-module-mp-biz): 微信公众号粉丝管理重构""
This reverts commit 2e18506e1a5d8ec9a23319f7ddef47051b6856d4.
Showing
14 changed files
with
160 additions
and
248 deletions
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/WxFansTagController.java renamed to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/FansTagController.java
| 1 | 1 | package cn.iocoder.yudao.module.mp.controller.admin.fanstag; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 6 | +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | |
| 7 | +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.*; | |
| 8 | +import cn.iocoder.yudao.module.mp.convert.fanstag.WxFansTagConvert; | |
| 9 | +import cn.iocoder.yudao.module.mp.service.tag.FansTagService; | |
| 10 | +import io.swagger.annotations.Api; | |
| 11 | +import io.swagger.annotations.ApiImplicitParam; | |
| 12 | +import io.swagger.annotations.ApiOperation; | |
| 13 | +import me.chanjar.weixin.mp.bean.tag.WxUserTag; | |
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 15 | +import org.springframework.validation.annotation.Validated; | |
| 3 | 16 | import org.springframework.web.bind.annotation.*; |
| 4 | 17 | |
| 5 | 18 | 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.*; | |
| 19 | +import javax.servlet.http.HttpServletResponse; | |
| 20 | +import javax.validation.Valid; | |
| 14 | 21 | import java.io.IOException; |
| 15 | - | |
| 16 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 17 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 22 | +import java.util.Collection; | |
| 23 | +import java.util.List; | |
| 18 | 24 | |
| 19 | 25 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 26 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | |
| 20 | 27 | |
| 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.fanstag.vo.*; | |
| 28 | -import cn.iocoder.yudao.module.mp.dal.dataobject.fanstag.WxFansTagDO; | |
| 29 | -import cn.iocoder.yudao.module.mp.convert.fanstag.WxFansTagConvert; | |
| 30 | -import cn.iocoder.yudao.module.mp.service.fanstag.WxFansTagService; | |
| 31 | - | |
| 28 | +/** | |
| 29 | + * @author fengdan | |
| 30 | + */ | |
| 32 | 31 | @Api(tags = "管理后台 - 粉丝标签") |
| 33 | 32 | @RestController |
| 34 | -@RequestMapping("/wechatMp/wx-fans-tag") | |
| 33 | +@RequestMapping("/wechat-mp/fans-tag") | |
| 35 | 34 | @Validated |
| 36 | -public class WxFansTagController { | |
| 35 | +public class FansTagController { | |
| 37 | 36 | |
| 38 | 37 | @Resource |
| 39 | - private WxFansTagService wxFansTagService; | |
| 38 | + private FansTagService fansTagService; | |
| 40 | 39 | |
| 41 | 40 | @PostMapping("/create") |
| 42 | 41 | @ApiOperation("创建粉丝标签") |
| 43 | 42 | @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:create')") |
| 44 | - public CommonResult<Integer> createWxFansTag(@Valid @RequestBody WxFansTagCreateReqVO createReqVO) { | |
| 45 | - return success(wxFansTagService.createWxFansTag(createReqVO)); | |
| 43 | + public CommonResult<WxUserTag> createWxFansTag(@Valid @RequestBody FansTagCreateReqVO createReqVO) { | |
| 44 | + return success(fansTagService.createWxFansTag(createReqVO)); | |
| 46 | 45 | } |
| 47 | 46 | |
| 48 | 47 | @PutMapping("/update") |
| 49 | 48 | @ApiOperation("更新粉丝标签") |
| 50 | 49 | @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:update')") |
| 51 | - public CommonResult<Boolean> updateWxFansTag(@Valid @RequestBody WxFansTagUpdateReqVO updateReqVO) { | |
| 52 | - wxFansTagService.updateWxFansTag(updateReqVO); | |
| 50 | + public CommonResult<Boolean> updateWxFansTag(@Valid @RequestBody FansTagUpdateReqVO updateReqVO) { | |
| 51 | + fansTagService.updateWxFansTag(updateReqVO); | |
| 53 | 52 | return success(true); |
| 54 | 53 | } |
| 55 | 54 | |
| ... | ... | @@ -58,7 +57,7 @@ public class WxFansTagController { |
| 58 | 57 | @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Integer.class) |
| 59 | 58 | @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:delete')") |
| 60 | 59 | public CommonResult<Boolean> deleteWxFansTag(@RequestParam("id") Integer id) { |
| 61 | - wxFansTagService.deleteWxFansTag(id); | |
| 60 | + fansTagService.deleteWxFansTag(id); | |
| 62 | 61 | return success(true); |
| 63 | 62 | } |
| 64 | 63 | |
| ... | ... | @@ -66,8 +65,8 @@ public class WxFansTagController { |
| 66 | 65 | @ApiOperation("获得粉丝标签") |
| 67 | 66 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Integer.class) |
| 68 | 67 | @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:query')") |
| 69 | - public CommonResult<WxFansTagRespVO> getWxFansTag(@RequestParam("id") Integer id) { | |
| 70 | - WxFansTagDO wxFansTag = wxFansTagService.getWxFansTag(id); | |
| 68 | + public CommonResult<FansTagRespVO> getWxFansTag(@RequestParam("id") Integer id) { | |
| 69 | + WxUserTag wxFansTag = fansTagService.getWxFansTag(id); | |
| 71 | 70 | return success(WxFansTagConvert.INSTANCE.convert(wxFansTag)); |
| 72 | 71 | } |
| 73 | 72 | |
| ... | ... | @@ -75,16 +74,16 @@ public class WxFansTagController { |
| 75 | 74 | @ApiOperation("获得粉丝标签列表") |
| 76 | 75 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) |
| 77 | 76 | @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:query')") |
| 78 | - public CommonResult<List<WxFansTagRespVO>> getWxFansTagList(@RequestParam("ids") Collection<Integer> ids) { | |
| 79 | - List<WxFansTagDO> list = wxFansTagService.getWxFansTagList(ids); | |
| 77 | + public CommonResult<List<FansTagRespVO>> getWxFansTagList(@RequestParam("ids") Collection<Integer> ids) { | |
| 78 | + List<WxUserTag> list = fansTagService.getWxFansTagList(ids); | |
| 80 | 79 | return success(WxFansTagConvert.INSTANCE.convertList(list)); |
| 81 | 80 | } |
| 82 | 81 | |
| 83 | 82 | @GetMapping("/page") |
| 84 | 83 | @ApiOperation("获得粉丝标签分页") |
| 85 | 84 | @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:query')") |
| 86 | - public CommonResult<PageResult<WxFansTagRespVO>> getWxFansTagPage(@Valid WxFansTagPageReqVO pageVO) { | |
| 87 | - PageResult<WxFansTagDO> pageResult = wxFansTagService.getWxFansTagPage(pageVO); | |
| 85 | + public CommonResult<PageResult<FansTagRespVO>> getWxFansTagPage(@Valid FansTagPageReqVO pageVO) { | |
| 86 | + PageResult<WxUserTag> pageResult = fansTagService.getWxFansTagPage(pageVO); | |
| 88 | 87 | return success(WxFansTagConvert.INSTANCE.convertPage(pageResult)); |
| 89 | 88 | } |
| 90 | 89 | |
| ... | ... | @@ -92,12 +91,12 @@ public class WxFansTagController { |
| 92 | 91 | @ApiOperation("导出粉丝标签 Excel") |
| 93 | 92 | @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:export')") |
| 94 | 93 | @OperateLog(type = EXPORT) |
| 95 | - public void exportWxFansTagExcel(@Valid WxFansTagExportReqVO exportReqVO, | |
| 94 | + public void exportWxFansTagExcel(@Valid FansTagExportReqVO exportReqVO, | |
| 96 | 95 | HttpServletResponse response) throws IOException { |
| 97 | - List<WxFansTagDO> list = wxFansTagService.getWxFansTagList(exportReqVO); | |
| 96 | + List<WxUserTag> list = fansTagService.getWxFansTagList(exportReqVO); | |
| 98 | 97 | // 导出 Excel |
| 99 | - List<WxFansTagExcelVO> datas = WxFansTagConvert.INSTANCE.convertList02(list); | |
| 100 | - ExcelUtils.write(response, "粉丝标签.xls", "数据", WxFansTagExcelVO.class, datas); | |
| 98 | + List<FansTagExcelVO> datas = WxFansTagConvert.INSTANCE.convertList02(list); | |
| 99 | + ExcelUtils.write(response, "粉丝标签.xls", "数据", FansTagExcelVO.class, datas); | |
| 101 | 100 | } |
| 102 | 101 | |
| 103 | 102 | } | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagBaseVO.java renamed to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/FansTagBaseVO.java
| 1 | 1 | package cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo; |
| 2 | 2 | |
| 3 | -import lombok.*; | |
| 4 | -import io.swagger.annotations.*; | |
| 3 | +import io.swagger.annotations.ApiModelProperty; | |
| 4 | +import lombok.Data; | |
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * 粉丝标签 Base VO,提供给添加、修改、详细的子 VO 使用 |
| 8 | 8 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 9 | + * | |
| 10 | + * @author fengdan | |
| 9 | 11 | */ |
| 10 | 12 | @Data |
| 11 | -public class WxFansTagBaseVO { | |
| 13 | +public class FansTagBaseVO { | |
| 12 | 14 | |
| 13 | - @ApiModelProperty(value = "标签名称") | |
| 15 | + @ApiModelProperty(value = "标签名,UTF8编码.") | |
| 14 | 16 | private String name; |
| 15 | 17 | |
| 16 | - @ApiModelProperty(value = "粉丝数量") | |
| 18 | + @ApiModelProperty(value = "此标签下粉丝数") | |
| 17 | 19 | private Integer count; |
| 18 | - | |
| 19 | - @ApiModelProperty(value = "微信账号ID") | |
| 20 | - private String wxAccountId; | |
| 21 | - | |
| 22 | 20 | } | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagCreateReqVO.java renamed to 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; |
| 3 | 3 | import lombok.*; |
| 4 | 4 | import io.swagger.annotations.*; |
| 5 | 5 | |
| 6 | +/** | |
| 7 | + * @author fengdan | |
| 8 | + */ | |
| 6 | 9 | @ApiModel("管理后台 - 粉丝标签创建 Request VO") |
| 7 | 10 | @Data |
| 8 | 11 | @EqualsAndHashCode(callSuper = true) |
| 9 | 12 | @ToString(callSuper = true) |
| 10 | -public class WxFansTagCreateReqVO extends WxFansTagBaseVO { | |
| 13 | +public class FansTagCreateReqVO extends FansTagBaseVO { | |
| 11 | 14 | |
| 12 | 15 | } | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagExcelVO.java renamed to 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; |
| 12 | 12 | * @author 芋道源码 |
| 13 | 13 | */ |
| 14 | 14 | @Data |
| 15 | -public class WxFansTagExcelVO { | |
| 15 | +public class FansTagExcelVO { | |
| 16 | 16 | |
| 17 | 17 | @ExcelProperty("主键") |
| 18 | 18 | private Integer id; |
| ... | ... | @@ -23,9 +23,6 @@ public class WxFansTagExcelVO { |
| 23 | 23 | @ExcelProperty("粉丝数量") |
| 24 | 24 | private Integer count; |
| 25 | 25 | |
| 26 | - @ExcelProperty("微信账号ID") | |
| 27 | - private String wxAccountId; | |
| 28 | - | |
| 29 | 26 | @ExcelProperty("创建时间") |
| 30 | 27 | private Date createTime; |
| 31 | 28 | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagExportReqVO.java renamed to 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_ |
| 11 | 11 | |
| 12 | 12 | @ApiModel(value = "管理后台 - 粉丝标签 Excel 导出 Request VO", description = "参数和 WxFansTagPageReqVO 是一致的") |
| 13 | 13 | @Data |
| 14 | -public class WxFansTagExportReqVO { | |
| 14 | +public class FansTagExportReqVO { | |
| 15 | 15 | |
| 16 | 16 | @ApiModelProperty(value = "标签名称") |
| 17 | 17 | private String name; | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagPageReqVO.java renamed to 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_ |
| 14 | 14 | @Data |
| 15 | 15 | @EqualsAndHashCode(callSuper = true) |
| 16 | 16 | @ToString(callSuper = true) |
| 17 | -public class WxFansTagPageReqVO extends PageParam { | |
| 17 | +public class FansTagPageReqVO extends PageParam { | |
| 18 | 18 | |
| 19 | 19 | @ApiModelProperty(value = "标签名称") |
| 20 | 20 | private String name; | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagRespVO.java renamed to 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.*; |
| 10 | 10 | @Data |
| 11 | 11 | @EqualsAndHashCode(callSuper = true) |
| 12 | 12 | @ToString(callSuper = true) |
| 13 | -public class WxFansTagRespVO extends WxFansTagBaseVO { | |
| 13 | +public class FansTagRespVO extends FansTagBaseVO { | |
| 14 | 14 | |
| 15 | - @ApiModelProperty(value = "主键", required = true) | |
| 16 | - private Integer id; | |
| 15 | + @ApiModelProperty(value = "标签id,由微信分配.") | |
| 16 | + private Long id; | |
| 17 | 17 | |
| 18 | 18 | @ApiModelProperty(value = "创建时间", required = true) |
| 19 | 19 | private Date createTime; | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/fanstag/vo/WxFansTagUpdateReqVO.java renamed to 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.*; |
| 9 | 9 | @Data |
| 10 | 10 | @EqualsAndHashCode(callSuper = true) |
| 11 | 11 | @ToString(callSuper = true) |
| 12 | -public class WxFansTagUpdateReqVO extends WxFansTagBaseVO { | |
| 12 | +public class FansTagUpdateReqVO extends FansTagBaseVO { | |
| 13 | 13 | |
| 14 | 14 | @ApiModelProperty(value = "主键", required = true) |
| 15 | 15 | @NotNull(message = "主键不能为空") | ... | ... |
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.*; |
| 4 | 4 | |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 6 | |
| 7 | +import me.chanjar.weixin.mp.bean.tag.WxUserTag; | |
| 7 | 8 | import org.mapstruct.Mapper; |
| 8 | 9 | import org.mapstruct.factory.Mappers; |
| 9 | 10 | import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.*; |
| 10 | -import cn.iocoder.yudao.module.mp.dal.dataobject.fanstag.WxFansTagDO; | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * 粉丝标签 Convert |
| 14 | 14 | * |
| 15 | - * @author 芋道源码 | |
| 15 | + * @author fengdan | |
| 16 | 16 | */ |
| 17 | 17 | @Mapper |
| 18 | 18 | public interface WxFansTagConvert { |
| 19 | 19 | |
| 20 | 20 | WxFansTagConvert INSTANCE = Mappers.getMapper(WxFansTagConvert.class); |
| 21 | 21 | |
| 22 | - WxFansTagDO convert(WxFansTagCreateReqVO bean); | |
| 22 | + WxUserTag convert(FansTagCreateReqVO bean); | |
| 23 | 23 | |
| 24 | - WxFansTagDO convert(WxFansTagUpdateReqVO bean); | |
| 24 | + WxUserTag convert(FansTagUpdateReqVO bean); | |
| 25 | 25 | |
| 26 | - WxFansTagRespVO convert(WxFansTagDO bean); | |
| 26 | + FansTagRespVO convert(WxUserTag bean); | |
| 27 | 27 | |
| 28 | - List<WxFansTagRespVO> convertList(List<WxFansTagDO> list); | |
| 28 | + List<FansTagRespVO> convertList(List<WxUserTag> list); | |
| 29 | 29 | |
| 30 | - PageResult<WxFansTagRespVO> convertPage(PageResult<WxFansTagDO> page); | |
| 30 | + PageResult<FansTagRespVO> convertPage(PageResult<WxUserTag> page); | |
| 31 | 31 | |
| 32 | - List<WxFansTagExcelVO> convertList02(List<WxFansTagDO> list); | |
| 32 | + List<FansTagExcelVO> convertList02(List<WxUserTag> list); | |
| 33 | 33 | |
| 34 | 34 | } | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/fanstag/WxFansTagDO.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.dal.dataobject.fanstag; | |
| 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_fans_tag") | |
| 16 | -@KeySequence("wx_fans_tag_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 WxFansTagDO extends BaseDO { | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 主键 | |
| 27 | - */ | |
| 28 | - @TableId | |
| 29 | - private Integer id; | |
| 30 | - /** | |
| 31 | - * 标签名称 | |
| 32 | - */ | |
| 33 | - private String name; | |
| 34 | - /** | |
| 35 | - * 粉丝数量 | |
| 36 | - */ | |
| 37 | - private Integer count; | |
| 38 | - /** | |
| 39 | - * 微信账号ID | |
| 40 | - */ | |
| 41 | - private String wxAccountId; | |
| 42 | - | |
| 43 | -} |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/fanstag/WxFansTagMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.dal.mysql.fanstag; | |
| 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.fanstag.WxFansTagDO; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | -import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.*; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 粉丝标签 Mapper | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface WxFansTagMapper extends BaseMapperX<WxFansTagDO> { | |
| 19 | - | |
| 20 | - default PageResult<WxFansTagDO> selectPage(WxFansTagPageReqVO reqVO) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<WxFansTagDO>() | |
| 22 | - .likeIfPresent(WxFansTagDO::getName, reqVO.getName()) | |
| 23 | - .eqIfPresent(WxFansTagDO::getCount, reqVO.getCount()) | |
| 24 | - .eqIfPresent(WxFansTagDO::getWxAccountId, reqVO.getWxAccountId()) | |
| 25 | - .betweenIfPresent(WxFansTagDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 26 | - .orderByDesc(WxFansTagDO::getId)); | |
| 27 | - } | |
| 28 | - | |
| 29 | - default List<WxFansTagDO> selectList(WxFansTagExportReqVO reqVO) { | |
| 30 | - return selectList(new LambdaQueryWrapperX<WxFansTagDO>() | |
| 31 | - .likeIfPresent(WxFansTagDO::getName, reqVO.getName()) | |
| 32 | - .eqIfPresent(WxFansTagDO::getCount, reqVO.getCount()) | |
| 33 | - .eqIfPresent(WxFansTagDO::getWxAccountId, reqVO.getWxAccountId()) | |
| 34 | - .betweenIfPresent(WxFansTagDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | |
| 35 | - .orderByDesc(WxFansTagDO::getId)); | |
| 36 | - } | |
| 37 | - | |
| 38 | -} |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.mp.service.fanstag; | |
| 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.fanstag.vo.*; | |
| 12 | -import cn.iocoder.yudao.module.mp.dal.dataobject.fanstag.WxFansTagDO; | |
| 13 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 14 | - | |
| 15 | -import cn.iocoder.yudao.module.mp.convert.fanstag.WxFansTagConvert; | |
| 16 | -import cn.iocoder.yudao.module.mp.dal.mysql.fanstag.WxFansTagMapper; | |
| 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 WxFansTagServiceImpl implements WxFansTagService { | |
| 29 | - | |
| 30 | - @Resource | |
| 31 | - private WxFansTagMapper wxFansTagMapper; | |
| 32 | - | |
| 33 | - @Override | |
| 34 | - public Integer createWxFansTag(WxFansTagCreateReqVO createReqVO) { | |
| 35 | - // 插入 | |
| 36 | - WxFansTagDO wxFansTag = WxFansTagConvert.INSTANCE.convert(createReqVO); | |
| 37 | - wxFansTagMapper.insert(wxFansTag); | |
| 38 | - // 返回 | |
| 39 | - return wxFansTag.getId(); | |
| 40 | - } | |
| 41 | - | |
| 42 | - @Override | |
| 43 | - public void updateWxFansTag(WxFansTagUpdateReqVO updateReqVO) { | |
| 44 | - // 校验存在 | |
| 45 | - this.validateWxFansTagExists(updateReqVO.getId()); | |
| 46 | - // 更新 | |
| 47 | - WxFansTagDO updateObj = WxFansTagConvert.INSTANCE.convert(updateReqVO); | |
| 48 | - wxFansTagMapper.updateById(updateObj); | |
| 49 | - } | |
| 50 | - | |
| 51 | - @Override | |
| 52 | - public void deleteWxFansTag(Integer id) { | |
| 53 | - // 校验存在 | |
| 54 | - this.validateWxFansTagExists(id); | |
| 55 | - // 删除 | |
| 56 | - wxFansTagMapper.deleteById(id); | |
| 57 | - } | |
| 58 | - | |
| 59 | - private void validateWxFansTagExists(Integer id) { | |
| 60 | - if (wxFansTagMapper.selectById(id) == null) { | |
| 61 | - throw exception(COMMON_NOT_EXISTS); | |
| 62 | - } | |
| 63 | - } | |
| 64 | - | |
| 65 | - @Override | |
| 66 | - public WxFansTagDO getWxFansTag(Integer id) { | |
| 67 | - return wxFansTagMapper.selectById(id); | |
| 68 | - } | |
| 69 | - | |
| 70 | - @Override | |
| 71 | - public List<WxFansTagDO> getWxFansTagList(Collection<Integer> ids) { | |
| 72 | - return wxFansTagMapper.selectBatchIds(ids); | |
| 73 | - } | |
| 74 | - | |
| 75 | - @Override | |
| 76 | - public PageResult<WxFansTagDO> getWxFansTagPage(WxFansTagPageReqVO pageReqVO) { | |
| 77 | - return wxFansTagMapper.selectPage(pageReqVO); | |
| 78 | - } | |
| 79 | - | |
| 80 | - @Override | |
| 81 | - public List<WxFansTagDO> getWxFansTagList(WxFansTagExportReqVO exportReqVO) { | |
| 82 | - return wxFansTagMapper.selectList(exportReqVO); | |
| 83 | - } | |
| 84 | - | |
| 85 | -} |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/fanstag/WxFansTagService.java renamed to yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagService.java
| 1 | -package cn.iocoder.yudao.module.mp.service.fanstag; | |
| 1 | +package cn.iocoder.yudao.module.mp.service.tag; | |
| 2 | 2 | |
| 3 | -import java.util.*; | |
| 4 | -import javax.validation.*; | |
| 5 | - | |
| 6 | -import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.*; | |
| 7 | -import cn.iocoder.yudao.module.mp.dal.dataobject.fanstag.WxFansTagDO; | |
| 8 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagExportReqVO; | |
| 6 | +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagUpdateReqVO; | |
| 8 | +import me.chanjar.weixin.mp.bean.tag.WxUserTag; | |
| 9 | + | |
| 10 | +import javax.validation.Valid; | |
| 11 | +import java.util.Collection; | |
| 12 | +import java.util.List; | |
| 9 | 13 | |
| 10 | 14 | /** |
| 11 | 15 | * 粉丝标签 Service 接口 |
| 12 | 16 | * |
| 13 | - * @author 芋道源码 | |
| 17 | + * @author fengdan | |
| 14 | 18 | */ |
| 15 | -public interface WxFansTagService { | |
| 19 | +public interface FansTagService { | |
| 16 | 20 | |
| 17 | 21 | /** |
| 18 | 22 | * 创建粉丝标签 |
| ... | ... | @@ -20,14 +24,14 @@ public interface WxFansTagService { |
| 20 | 24 | * @param createReqVO 创建信息 |
| 21 | 25 | * @return 编号 |
| 22 | 26 | */ |
| 23 | - Integer createWxFansTag(@Valid WxFansTagCreateReqVO createReqVO); | |
| 27 | + WxUserTag createWxFansTag(@Valid FansTagCreateReqVO createReqVO); | |
| 24 | 28 | |
| 25 | 29 | /** |
| 26 | 30 | * 更新粉丝标签 |
| 27 | 31 | * |
| 28 | 32 | * @param updateReqVO 更新信息 |
| 29 | 33 | */ |
| 30 | - void updateWxFansTag(@Valid WxFansTagUpdateReqVO updateReqVO); | |
| 34 | + void updateWxFansTag(@Valid FansTagUpdateReqVO updateReqVO); | |
| 31 | 35 | |
| 32 | 36 | /** |
| 33 | 37 | * 删除粉丝标签 |
| ... | ... | @@ -42,7 +46,7 @@ public interface WxFansTagService { |
| 42 | 46 | * @param id 编号 |
| 43 | 47 | * @return 粉丝标签 |
| 44 | 48 | */ |
| 45 | - WxFansTagDO getWxFansTag(Integer id); | |
| 49 | + WxUserTag getWxFansTag(Integer id); | |
| 46 | 50 | |
| 47 | 51 | /** |
| 48 | 52 | * 获得粉丝标签列表 |
| ... | ... | @@ -50,7 +54,7 @@ public interface WxFansTagService { |
| 50 | 54 | * @param ids 编号 |
| 51 | 55 | * @return 粉丝标签列表 |
| 52 | 56 | */ |
| 53 | - List<WxFansTagDO> getWxFansTagList(Collection<Integer> ids); | |
| 57 | + List<WxUserTag> getWxFansTagList(Collection<Integer> ids); | |
| 54 | 58 | |
| 55 | 59 | /** |
| 56 | 60 | * 获得粉丝标签分页 |
| ... | ... | @@ -58,7 +62,7 @@ public interface WxFansTagService { |
| 58 | 62 | * @param pageReqVO 分页查询 |
| 59 | 63 | * @return 粉丝标签分页 |
| 60 | 64 | */ |
| 61 | - PageResult<WxFansTagDO> getWxFansTagPage(WxFansTagPageReqVO pageReqVO); | |
| 65 | + PageResult<WxUserTag> getWxFansTagPage(FansTagPageReqVO pageReqVO); | |
| 62 | 66 | |
| 63 | 67 | /** |
| 64 | 68 | * 获得粉丝标签列表, 用于 Excel 导出 |
| ... | ... | @@ -66,6 +70,6 @@ public interface WxFansTagService { |
| 66 | 70 | * @param exportReqVO 查询条件 |
| 67 | 71 | * @return 粉丝标签列表 |
| 68 | 72 | */ |
| 69 | - List<WxFansTagDO> getWxFansTagList(WxFansTagExportReqVO exportReqVO); | |
| 73 | + List<WxUserTag> getWxFansTagList(FansTagExportReqVO exportReqVO); | |
| 70 | 74 | |
| 71 | 75 | } | ... | ... |
yudao-module-wechat/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/tag/FansTagServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mp.service.tag; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagExportReqVO; | |
| 6 | +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.mp.controller.admin.fanstag.vo.FansTagUpdateReqVO; | |
| 8 | +import cn.iocoder.yudao.module.mp.convert.fanstag.WxFansTagConvert; | |
| 9 | +import lombok.extern.slf4j.Slf4j; | |
| 10 | +import me.chanjar.weixin.common.error.WxErrorException; | |
| 11 | +import me.chanjar.weixin.mp.api.WxMpService; | |
| 12 | +import me.chanjar.weixin.mp.bean.tag.WxUserTag; | |
| 13 | +import org.springframework.stereotype.Service; | |
| 14 | +import org.springframework.validation.annotation.Validated; | |
| 15 | + | |
| 16 | +import javax.annotation.Resource; | |
| 17 | +import java.util.Collection; | |
| 18 | +import java.util.List; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * 粉丝标签 Service 实现类 | |
| 22 | + * | |
| 23 | + * @author fengdan | |
| 24 | + */ | |
| 25 | +@Slf4j | |
| 26 | +@Service | |
| 27 | +@Validated | |
| 28 | +public class FansTagServiceImpl implements FansTagService { | |
| 29 | + | |
| 30 | + @Resource | |
| 31 | + private WxMpService wxMpService; | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public WxUserTag createWxFansTag(FansTagCreateReqVO createReqVO) { | |
| 35 | + try { | |
| 36 | + return wxMpService.getUserTagService().tagCreate("wxFansTag"); | |
| 37 | + } catch (WxErrorException e) { | |
| 38 | + throw new RuntimeException(e); | |
| 39 | + } | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + public void updateWxFansTag(FansTagUpdateReqVO updateReqVO) { | |
| 44 | + // 校验存在 | |
| 45 | + // 更新 | |
| 46 | + WxUserTag updateObj = WxFansTagConvert.INSTANCE.convert(updateReqVO); | |
| 47 | + | |
| 48 | + } | |
| 49 | + | |
| 50 | + @Override | |
| 51 | + public void deleteWxFansTag(Integer id) { | |
| 52 | + // 校验存在 | |
| 53 | + // 删除 | |
| 54 | + } | |
| 55 | + | |
| 56 | + | |
| 57 | + @Override | |
| 58 | + public WxUserTag getWxFansTag(Integer id) { | |
| 59 | + return null; | |
| 60 | + } | |
| 61 | + | |
| 62 | + @Override | |
| 63 | + public List<WxUserTag> getWxFansTagList(Collection<Integer> ids) { | |
| 64 | + return null; | |
| 65 | + } | |
| 66 | + | |
| 67 | + @Override | |
| 68 | + public PageResult<WxUserTag> getWxFansTagPage(FansTagPageReqVO pageReqVO) { | |
| 69 | + return null; | |
| 70 | + } | |
| 71 | + | |
| 72 | + @Override | |
| 73 | + public List<WxUserTag> getWxFansTagList(FansTagExportReqVO exportReqVO) { | |
| 74 | + return null; | |
| 75 | + } | |
| 76 | + | |
| 77 | +} | ... | ... |