mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	refactor(yudao-module-mp-biz): 微信公众号粉丝管理重构
This commit is contained in:
		| @@ -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<Integer> createWxFansTag(@Valid @RequestBody WxFansTagCreateReqVO createReqVO) { | ||||
|         return success(wxFansTagService.createWxFansTag(createReqVO)); | ||||
|     public CommonResult<WxUserTag> createWxFansTag(@Valid @RequestBody FansTagCreateReqVO createReqVO) { | ||||
|         return success(fansTagService.createWxFansTag(createReqVO)); | ||||
|     } | ||||
| 
 | ||||
|     @PutMapping("/update") | ||||
|     @ApiOperation("更新粉丝标签") | ||||
|     @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:update')") | ||||
|     public CommonResult<Boolean> updateWxFansTag(@Valid @RequestBody WxFansTagUpdateReqVO updateReqVO) { | ||||
|         wxFansTagService.updateWxFansTag(updateReqVO); | ||||
|     public CommonResult<Boolean> 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<Boolean> 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<WxFansTagRespVO> getWxFansTag(@RequestParam("id") Integer id) { | ||||
|         WxFansTagDO wxFansTag = wxFansTagService.getWxFansTag(id); | ||||
|     public CommonResult<FansTagRespVO> 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<List<WxFansTagRespVO>> getWxFansTagList(@RequestParam("ids") Collection<Integer> ids) { | ||||
|         List<WxFansTagDO> list = wxFansTagService.getWxFansTagList(ids); | ||||
|     public CommonResult<List<FansTagRespVO>> getWxFansTagList(@RequestParam("ids") Collection<Integer> ids) { | ||||
|         List<WxUserTag> list = fansTagService.getWxFansTagList(ids); | ||||
|         return success(WxFansTagConvert.INSTANCE.convertList(list)); | ||||
|     } | ||||
| 
 | ||||
|     @GetMapping("/page") | ||||
|     @ApiOperation("获得粉丝标签分页") | ||||
|     @PreAuthorize("@ss.hasPermission('wechatMp:wx-fans-tag:query')") | ||||
|     public CommonResult<PageResult<WxFansTagRespVO>> getWxFansTagPage(@Valid WxFansTagPageReqVO pageVO) { | ||||
|         PageResult<WxFansTagDO> pageResult = wxFansTagService.getWxFansTagPage(pageVO); | ||||
|     public CommonResult<PageResult<FansTagRespVO>> getWxFansTagPage(@Valid FansTagPageReqVO pageVO) { | ||||
|         PageResult<WxUserTag> 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<WxFansTagDO> list = wxFansTagService.getWxFansTagList(exportReqVO); | ||||
|         List<WxUserTag> list = fansTagService.getWxFansTagList(exportReqVO); | ||||
|         // 导出 Excel | ||||
|         List<WxFansTagExcelVO> datas = WxFansTagConvert.INSTANCE.convertList02(list); | ||||
|         ExcelUtils.write(response, "粉丝标签.xls", "数据", WxFansTagExcelVO.class, datas); | ||||
|         List<FansTagExcelVO> datas = WxFansTagConvert.INSTANCE.convertList02(list); | ||||
|         ExcelUtils.write(response, "粉丝标签.xls", "数据", FansTagExcelVO.class, datas); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @@ -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; | ||||
| 
 | ||||
| } | ||||
| @@ -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 { | ||||
| 
 | ||||
| } | ||||
| @@ -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; | ||||
| 
 | ||||
| @@ -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; | ||||
| @@ -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; | ||||
| @@ -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; | ||||
| @@ -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 = "主键不能为空") | ||||
| @@ -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<WxFansTagRespVO> convertList(List<WxFansTagDO> list); | ||||
|     List<FansTagRespVO> convertList(List<WxUserTag> list); | ||||
|  | ||||
|     PageResult<WxFansTagRespVO> convertPage(PageResult<WxFansTagDO> page); | ||||
|     PageResult<FansTagRespVO> convertPage(PageResult<WxUserTag> page); | ||||
|  | ||||
|     List<WxFansTagExcelVO> convertList02(List<WxFansTagDO> list); | ||||
|     List<FansTagExcelVO> convertList02(List<WxUserTag> list); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -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; | ||||
|  | ||||
| } | ||||
| @@ -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<WxFansTagDO> { | ||||
|  | ||||
|     default PageResult<WxFansTagDO> selectPage(WxFansTagPageReqVO reqVO) { | ||||
|         return selectPage(reqVO, new LambdaQueryWrapperX<WxFansTagDO>() | ||||
|                 .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<WxFansTagDO> selectList(WxFansTagExportReqVO reqVO) { | ||||
|         return selectList(new LambdaQueryWrapperX<WxFansTagDO>() | ||||
|                 .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)); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -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<WxFansTagDO> getWxFansTagList(Collection<Integer> ids); | ||||
|  | ||||
|     /** | ||||
|      * 获得粉丝标签分页 | ||||
|      * | ||||
|      * @param pageReqVO 分页查询 | ||||
|      * @return 粉丝标签分页 | ||||
|      */ | ||||
|     PageResult<WxFansTagDO> getWxFansTagPage(WxFansTagPageReqVO pageReqVO); | ||||
|  | ||||
|     /** | ||||
|      * 获得粉丝标签列表, 用于 Excel 导出 | ||||
|      * | ||||
|      * @param exportReqVO 查询条件 | ||||
|      * @return 粉丝标签列表 | ||||
|      */ | ||||
|     List<WxFansTagDO> getWxFansTagList(WxFansTagExportReqVO exportReqVO); | ||||
|  | ||||
| } | ||||
| @@ -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<WxFansTagDO> getWxFansTagList(Collection<Integer> ids) { | ||||
|         return wxFansTagMapper.selectBatchIds(ids); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public PageResult<WxFansTagDO> getWxFansTagPage(WxFansTagPageReqVO pageReqVO) { | ||||
|         return wxFansTagMapper.selectPage(pageReqVO); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<WxFansTagDO> getWxFansTagList(WxFansTagExportReqVO exportReqVO) { | ||||
|         return wxFansTagMapper.selectList(exportReqVO); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -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<WxUserTag> getWxFansTagList(Collection<Integer> ids); | ||||
|  | ||||
|     /** | ||||
|      * 获得粉丝标签分页 | ||||
|      * | ||||
|      * @param pageReqVO 分页查询 | ||||
|      * @return 粉丝标签分页 | ||||
|      */ | ||||
|     PageResult<WxUserTag> getWxFansTagPage(FansTagPageReqVO pageReqVO); | ||||
|  | ||||
|     /** | ||||
|      * 获得粉丝标签列表, 用于 Excel 导出 | ||||
|      * | ||||
|      * @param exportReqVO 查询条件 | ||||
|      * @return 粉丝标签列表 | ||||
|      */ | ||||
|     List<WxUserTag> getWxFansTagList(FansTagExportReqVO exportReqVO); | ||||
|  | ||||
| } | ||||
| @@ -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<WxUserTag> getWxFansTagList(Collection<Integer> ids) { | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public PageResult<WxUserTag> getWxFansTagPage(FansTagPageReqVO pageReqVO) { | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<WxUserTag> getWxFansTagList(FansTagExportReqVO exportReqVO) { | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 fengdan
					fengdan