Commit cdb7348b0872102d462db3d4edad7cb34f47e185

Authored by YunaiV
1 parent a7e4ff0d

mp:重构 mp user 的表结构,以及相关的 service

Showing 25 changed files with 255 additions and 642 deletions
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/accountfans/WxAccountFansController.java deleted
1 -package cn.iocoder.yudao.module.mp.controller.admin.accountfans;  
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.accountfans.vo.*;  
8 -import cn.iocoder.yudao.module.mp.convert.accountfans.WxAccountFansConvert;  
9 -import cn.iocoder.yudao.module.mp.dal.dataobject.accountfans.WxAccountFansDO;  
10 -import cn.iocoder.yudao.module.mp.service.accountfans.WxAccountFansService;  
11 -import io.swagger.annotations.Api;  
12 -import io.swagger.annotations.ApiImplicitParam;  
13 -import io.swagger.annotations.ApiOperation;  
14 -import org.springframework.security.access.prepost.PreAuthorize;  
15 -import org.springframework.validation.annotation.Validated;  
16 -import org.springframework.web.bind.annotation.*;  
17 -  
18 -import javax.annotation.Resource;  
19 -import javax.servlet.http.HttpServletResponse;  
20 -import javax.validation.Valid;  
21 -import java.io.IOException;  
22 -import java.util.Collection;  
23 -import java.util.List;  
24 -  
25 -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;  
26 -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;  
27 -  
28 -@Api(tags = "管理后台 - 微信公众号粉丝")  
29 -@RestController  
30 -@RequestMapping("/wechatMp/wx-account-fans")  
31 -@Validated  
32 -public class WxAccountFansController {  
33 -  
34 - @Resource  
35 - private WxAccountFansService wxAccountFansService;  
36 -  
37 - @PostMapping("/create")  
38 - @ApiOperation("创建微信公众号粉丝")  
39 - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:create')")  
40 - public CommonResult<Long> createWxAccountFans(@Valid @RequestBody WxAccountFansCreateReqVO createReqVO) {  
41 - return success(wxAccountFansService.createWxAccountFans(createReqVO));  
42 - }  
43 -  
44 - @PutMapping("/update")  
45 - @ApiOperation("更新微信公众号粉丝")  
46 - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:update')")  
47 - public CommonResult<Boolean> updateWxAccountFans(@Valid @RequestBody WxAccountFansUpdateReqVO updateReqVO) {  
48 - wxAccountFansService.updateWxAccountFans(updateReqVO);  
49 - return success(true);  
50 - }  
51 -  
52 - @DeleteMapping("/delete")  
53 - @ApiOperation("删除微信公众号粉丝")  
54 - @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)  
55 - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:delete')")  
56 - public CommonResult<Boolean> deleteWxAccountFans(@RequestParam("id") Long id) {  
57 - wxAccountFansService.deleteWxAccountFans(id);  
58 - return success(true);  
59 - }  
60 -  
61 - @GetMapping("/get")  
62 - @ApiOperation("获得微信公众号粉丝")  
63 - @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)  
64 - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:query')")  
65 - public CommonResult<WxAccountFansRespVO> getWxAccountFans(@RequestParam("id") Long id) {  
66 - WxAccountFansDO wxAccountFans = wxAccountFansService.getWxAccountFans(id);  
67 - return success(WxAccountFansConvert.INSTANCE.convert(wxAccountFans));  
68 - }  
69 -  
70 - @GetMapping("/list")  
71 - @ApiOperation("获得微信公众号粉丝列表")  
72 - @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)  
73 - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:query')")  
74 - public CommonResult<List<WxAccountFansRespVO>> getWxAccountFansList(@RequestParam("ids") Collection<Long> ids) {  
75 - List<WxAccountFansDO> list = wxAccountFansService.getWxAccountFansList(ids);  
76 - return success(WxAccountFansConvert.INSTANCE.convertList(list));  
77 - }  
78 -  
79 - @GetMapping("/page")  
80 - @ApiOperation("获得微信公众号粉丝分页")  
81 - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:query')")  
82 - public CommonResult<PageResult<WxAccountFansRespVO>> getWxAccountFansPage(@Valid WxAccountFansPageReqVO pageVO) {  
83 - PageResult<WxAccountFansDO> pageResult = wxAccountFansService.getWxAccountFansPage(pageVO);  
84 - return success(WxAccountFansConvert.INSTANCE.convertPage(pageResult));  
85 - }  
86 -  
87 - @GetMapping("/export-excel")  
88 - @ApiOperation("导出微信公众号粉丝 Excel")  
89 - @PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:export')")  
90 - @OperateLog(type = EXPORT)  
91 - public void exportWxAccountFansExcel(@Valid WxAccountFansExportReqVO exportReqVO,  
92 - HttpServletResponse response) throws IOException {  
93 - List<WxAccountFansDO> list = wxAccountFansService.getWxAccountFansList(exportReqVO);  
94 - // 导出 Excel  
95 - List<WxAccountFansExcelVO> datas = WxAccountFansConvert.INSTANCE.convertList02(list);  
96 - ExcelUtils.write(response, "微信公众号粉丝.xls", "数据", WxAccountFansExcelVO.class, datas);  
97 - }  
98 -  
99 -}  
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/accountfans/vo/WxAccountFansCreateReqVO.java deleted
1 -package cn.iocoder.yudao.module.mp.controller.admin.accountfans.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 WxAccountFansCreateReqVO extends WxAccountFansBaseVO {  
11 -  
12 -}  
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/accountfans/vo/WxAccountFansExcelVO.java deleted
1 -package cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo;  
2 -  
3 -import lombok.*;  
4 -import java.util.*;  
5 -  
6 -import com.alibaba.excel.annotation.ExcelProperty;  
7 -  
8 -/**  
9 - * 微信公众号粉丝 Excel VO  
10 - *  
11 - * @author 芋道源码  
12 - */  
13 -@Data  
14 -public class WxAccountFansExcelVO {  
15 -  
16 - @ExcelProperty("编号")  
17 - private Long id;  
18 -  
19 - @ExcelProperty("用户标识")  
20 - private String openid;  
21 -  
22 - @ExcelProperty("订阅状态,0未关注,1已关注")  
23 - private String subscribeStatus;  
24 -  
25 - @ExcelProperty("订阅时间")  
26 - private Date subscribeTime;  
27 -  
28 - @ExcelProperty("昵称")  
29 - private byte[] nickname;  
30 -  
31 - @ExcelProperty("性别,1男,2女,0未知")  
32 - private String gender;  
33 -  
34 - @ExcelProperty("语言")  
35 - private String language;  
36 -  
37 - @ExcelProperty("国家")  
38 - private String country;  
39 -  
40 - @ExcelProperty("省份")  
41 - private String province;  
42 -  
43 - @ExcelProperty("城市")  
44 - private String city;  
45 -  
46 - @ExcelProperty("头像地址")  
47 - private String headimgUrl;  
48 -  
49 - @ExcelProperty("备注")  
50 - private String remark;  
51 -  
52 - @ExcelProperty("微信公众号ID")  
53 - private String wxAccountId;  
54 -  
55 - @ExcelProperty("微信公众号appid")  
56 - private String wxAccountAppid;  
57 -  
58 - @ExcelProperty("创建时间")  
59 - private Date createTime;  
60 -  
61 -}  
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/accountfans/vo/WxAccountFansExportReqVO.java deleted
1 -package cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo;  
2 -  
3 -import lombok.*;  
4 -import java.util.*;  
5 -import io.swagger.annotations.*;  
6 -import org.springframework.format.annotation.DateTimeFormat;  
7 -  
8 -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;  
9 -  
10 -@ApiModel(value = "管理后台 - 微信公众号粉丝 Excel 导出 Request VO", description = "参数和 WxAccountFansPageReqVO 是一致的")  
11 -@Data  
12 -public class WxAccountFansExportReqVO {  
13 -  
14 - @ApiModelProperty(value = "用户标识")  
15 - private String openid;  
16 -  
17 - @ApiModelProperty(value = "订阅状态,0未关注,1已关注")  
18 - private String subscribeStatus;  
19 -  
20 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
21 - @ApiModelProperty(value = "开始订阅时间")  
22 - private Date beginSubscribeTime;  
23 -  
24 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
25 - @ApiModelProperty(value = "结束订阅时间")  
26 - private Date endSubscribeTime;  
27 -  
28 - @ApiModelProperty(value = "昵称")  
29 - private String nickname;  
30 -  
31 - @ApiModelProperty(value = "性别,1男,2女,0未知")  
32 - private String gender;  
33 -  
34 - @ApiModelProperty(value = "语言")  
35 - private String language;  
36 -  
37 - @ApiModelProperty(value = "国家")  
38 - private String country;  
39 -  
40 - @ApiModelProperty(value = "省份")  
41 - private String province;  
42 -  
43 - @ApiModelProperty(value = "城市")  
44 - private String city;  
45 -  
46 - @ApiModelProperty(value = "头像地址")  
47 - private String headimgUrl;  
48 -  
49 - @ApiModelProperty(value = "备注")  
50 - private String remark;  
51 -  
52 - @ApiModelProperty(value = "微信公众号ID")  
53 - private String wxAccountId;  
54 -  
55 - @ApiModelProperty(value = "微信公众号appid")  
56 - private String wxAccountAppid;  
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/accountfans/vo/WxAccountFansPageReqVO.java deleted
1 -package cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo;  
2 -  
3 -import lombok.*;  
4 -import java.util.*;  
5 -import io.swagger.annotations.*;  
6 -import cn.iocoder.yudao.framework.common.pojo.PageParam;  
7 -import org.springframework.format.annotation.DateTimeFormat;  
8 -  
9 -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;  
10 -  
11 -@ApiModel("管理后台 - 微信公众号粉丝分页 Request VO")  
12 -@Data  
13 -@EqualsAndHashCode(callSuper = true)  
14 -@ToString(callSuper = true)  
15 -public class WxAccountFansPageReqVO extends PageParam {  
16 -  
17 - @ApiModelProperty(value = "用户标识")  
18 - private String openid;  
19 -  
20 - @ApiModelProperty(value = "订阅状态,0未关注,1已关注")  
21 - private String subscribeStatus;  
22 -  
23 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
24 - @ApiModelProperty(value = "开始订阅时间")  
25 - private Date beginSubscribeTime;  
26 -  
27 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
28 - @ApiModelProperty(value = "结束订阅时间")  
29 - private Date endSubscribeTime;  
30 -  
31 - @ApiModelProperty(value = "昵称")  
32 - private String nickname;  
33 -  
34 - @ApiModelProperty(value = "性别,1男,2女,0未知")  
35 - private String gender;  
36 -  
37 - @ApiModelProperty(value = "语言")  
38 - private String language;  
39 -  
40 - @ApiModelProperty(value = "国家")  
41 - private String country;  
42 -  
43 - @ApiModelProperty(value = "省份")  
44 - private String province;  
45 -  
46 - @ApiModelProperty(value = "城市")  
47 - private String city;  
48 -  
49 - @ApiModelProperty(value = "头像地址")  
50 - private String headimgUrl;  
51 -  
52 - @ApiModelProperty(value = "备注")  
53 - private String remark;  
54 -  
55 - @ApiModelProperty(value = "微信公众号ID")  
56 - private String wxAccountId;  
57 -  
58 - @ApiModelProperty(value = "微信公众号appid")  
59 - private String wxAccountAppid;  
60 -  
61 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
62 - @ApiModelProperty(value = "开始创建时间")  
63 - private Date beginCreateTime;  
64 -  
65 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
66 - @ApiModelProperty(value = "结束创建时间")  
67 - private Date endCreateTime;  
68 -  
69 -}  
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/accountfans/vo/WxAccountFansUpdateReqVO.java deleted
1 -package cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo;  
2 -  
3 -import lombok.*;  
4 -import io.swagger.annotations.*;  
5 -import javax.validation.constraints.*;  
6 -  
7 -@ApiModel("管理后台 - 微信公众号粉丝更新 Request VO")  
8 -@Data  
9 -@EqualsAndHashCode(callSuper = true)  
10 -@ToString(callSuper = true)  
11 -public class WxAccountFansUpdateReqVO extends WxAccountFansBaseVO {  
12 -  
13 - @ApiModelProperty(value = "编号", required = true)  
14 - @NotNull(message = "编号不能为空")  
15 - private Long id;  
16 -  
17 -}  
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/user/MpUserController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.mp.controller.admin.user;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  5 +import cn.iocoder.yudao.module.mp.controller.admin.user.vo.*;
  6 +import cn.iocoder.yudao.module.mp.convert.user.MpUserConvert;
  7 +import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO;
  8 +import cn.iocoder.yudao.module.mp.service.user.MpUserService;
  9 +import io.swagger.annotations.Api;
  10 +import io.swagger.annotations.ApiOperation;
  11 +import org.springframework.security.access.prepost.PreAuthorize;
  12 +import org.springframework.validation.annotation.Validated;
  13 +import org.springframework.web.bind.annotation.*;
  14 +
  15 +import javax.annotation.Resource;
  16 +import javax.validation.Valid;
  17 +
  18 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  19 +
  20 +@Api(tags = "管理后台 - 微信公众号粉丝")
  21 +@RestController
  22 +@RequestMapping("/mp/user")
  23 +@Validated
  24 +public class MpUserController {
  25 +
  26 + @Resource
  27 + private MpUserService mpUserService;
  28 +
  29 + @GetMapping("/page")
  30 + @ApiOperation("获得微信公众号粉丝分页")
  31 + @PreAuthorize("@ss.hasPermission('mp:user:query')")
  32 + public CommonResult<PageResult<MpUserRespVO>> getUserPage(@Valid MpUserPageReqVO pageVO) {
  33 + PageResult<MpUserDO> pageResult = mpUserService.getUserPage(pageVO);
  34 + return success(MpUserConvert.INSTANCE.convertPage(pageResult));
  35 + }
  36 +
  37 +}
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/accountfans/vo/WxAccountFansBaseVO.java renamed to yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/user/vo/MpUserBaseVO.java
1 -package cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo; 1 +package cn.iocoder.yudao.module.mp.controller.admin.user.vo;
2 2
3 import lombok.*; 3 import lombok.*;
4 import java.util.*; 4 import java.util.*;
@@ -12,23 +12,27 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @@ -12,23 +12,27 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
12 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 12 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
13 */ 13 */
14 @Data 14 @Data
15 -public class WxAccountFansBaseVO { 15 +public class MpUserBaseVO {
16 16
17 @ApiModelProperty(value = "用户标识") 17 @ApiModelProperty(value = "用户标识")
18 private String openid; 18 private String openid;
19 19
20 @ApiModelProperty(value = "订阅状态,0未关注,1已关注") 20 @ApiModelProperty(value = "订阅状态,0未关注,1已关注")
21 - private String subscribeStatus; 21 + private Integer subscribeStatus;
22 22
23 @ApiModelProperty(value = "订阅时间") 23 @ApiModelProperty(value = "订阅时间")
24 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) 24 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
25 private Date subscribeTime; 25 private Date subscribeTime;
26 26
  27 + @ApiModelProperty(value = "订阅时间")
  28 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  29 + private Date unsubscribeTime;
  30 +
27 @ApiModelProperty(value = "昵称") 31 @ApiModelProperty(value = "昵称")
28 - private byte[] nickname; 32 + private String nickname;
29 33
30 @ApiModelProperty(value = "性别,1男,2女,0未知") 34 @ApiModelProperty(value = "性别,1男,2女,0未知")
31 - private String gender; 35 + private Integer gender;
32 36
33 @ApiModelProperty(value = "语言") 37 @ApiModelProperty(value = "语言")
34 private String language; 38 private String language;
@@ -43,15 +47,15 @@ public class WxAccountFansBaseVO { @@ -43,15 +47,15 @@ public class WxAccountFansBaseVO {
43 private String city; 47 private String city;
44 48
45 @ApiModelProperty(value = "头像地址") 49 @ApiModelProperty(value = "头像地址")
46 - private String headimgUrl; 50 + private String headImageUrl;
47 51
48 @ApiModelProperty(value = "备注") 52 @ApiModelProperty(value = "备注")
49 private String remark; 53 private String remark;
50 54
51 @ApiModelProperty(value = "微信公众号ID") 55 @ApiModelProperty(value = "微信公众号ID")
52 - private String wxAccountId; 56 + private Long accountId;
53 57
54 @ApiModelProperty(value = "微信公众号appid") 58 @ApiModelProperty(value = "微信公众号appid")
55 - private String wxAccountAppid; 59 + private String appId;
56 60
57 } 61 }
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/user/vo/MpUserPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.mp.controller.admin.user.vo;
  2 +
  3 +import lombok.*;
  4 +import io.swagger.annotations.*;
  5 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  6 +
  7 +@ApiModel("管理后台 - 微信公众号粉丝分页 Request VO")
  8 +@Data
  9 +@EqualsAndHashCode(callSuper = true)
  10 +@ToString(callSuper = true)
  11 +public class MpUserPageReqVO extends PageParam {
  12 +
  13 + @ApiModelProperty(value = "用户标识")
  14 + private String openid;
  15 +
  16 + @ApiModelProperty(value = "昵称")
  17 + private String nickname;
  18 +
  19 + @ApiModelProperty(value = "微信公众号 ID")
  20 + private Long accountId;
  21 +
  22 +}
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/accountfans/vo/WxAccountFansRespVO.java renamed to yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/user/vo/MpUserRespVO.java
1 -package cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo; 1 +package cn.iocoder.yudao.module.mp.controller.admin.user.vo;
2 2
3 import lombok.*; 3 import lombok.*;
4 import java.util.*; 4 import java.util.*;
@@ -8,7 +8,7 @@ import io.swagger.annotations.*; @@ -8,7 +8,7 @@ import io.swagger.annotations.*;
8 @Data 8 @Data
9 @EqualsAndHashCode(callSuper = true) 9 @EqualsAndHashCode(callSuper = true)
10 @ToString(callSuper = true) 10 @ToString(callSuper = true)
11 -public class WxAccountFansRespVO extends WxAccountFansBaseVO { 11 +public class MpUserRespVO extends MpUserBaseVO {
12 12
13 @ApiModelProperty(value = "编号", required = true) 13 @ApiModelProperty(value = "编号", required = true)
14 private Long id; 14 private Long id;
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/accountfans/WxAccountFansConvert.java deleted
1 -package cn.iocoder.yudao.module.mp.convert.accountfans;  
2 -  
3 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
4 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansCreateReqVO;  
5 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansExcelVO;  
6 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansRespVO;  
7 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansUpdateReqVO;  
8 -import cn.iocoder.yudao.module.mp.dal.dataobject.accountfans.WxAccountFansDO;  
9 -import org.mapstruct.Mapper;  
10 -import org.mapstruct.factory.Mappers;  
11 -  
12 -import java.util.List;  
13 -  
14 -/**  
15 - * 微信公众号粉丝 Convert  
16 - *  
17 - * @author 芋道源码  
18 - */  
19 -@Mapper  
20 -public interface WxAccountFansConvert {  
21 -  
22 - WxAccountFansConvert INSTANCE = Mappers.getMapper(WxAccountFansConvert.class);  
23 -  
24 - WxAccountFansDO convert(WxAccountFansCreateReqVO bean);  
25 -  
26 - WxAccountFansDO convert(WxAccountFansUpdateReqVO bean);  
27 -  
28 - WxAccountFansRespVO convert(WxAccountFansDO bean);  
29 -  
30 - List<WxAccountFansRespVO> convertList(List<WxAccountFansDO> list);  
31 -  
32 - PageResult<WxAccountFansRespVO> convertPage(PageResult<WxAccountFansDO> page);  
33 -  
34 - List<WxAccountFansExcelVO> convertList02(List<WxAccountFansDO> list);  
35 -  
36 -}  
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/user/MpUserConvert.java 0 → 100644
  1 +package cn.iocoder.yudao.module.mp.convert.user;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.mp.controller.admin.user.vo.MpUserRespVO;
  5 +import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO;
  6 +import org.mapstruct.Mapper;
  7 +import org.mapstruct.factory.Mappers;
  8 +
  9 +import java.util.List;
  10 +
  11 +@Mapper
  12 +public interface MpUserConvert {
  13 +
  14 + MpUserConvert INSTANCE = Mappers.getMapper(MpUserConvert.class);
  15 +
  16 + MpUserRespVO convert(MpUserDO bean);
  17 +
  18 + List<MpUserRespVO> convertList(List<MpUserDO> list);
  19 +
  20 + PageResult<MpUserRespVO> convertPage(PageResult<MpUserDO> page);
  21 +
  22 +}
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/accountfans/WxAccountFansDO.java renamed to yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/dataobject/user/MpUserDO.java
1 -package cn.iocoder.yudao.module.mp.dal.dataobject.accountfans; 1 +package cn.iocoder.yudao.module.mp.dal.dataobject.user;
2 2
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
3 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; 4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  5 +import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO;
4 import com.baomidou.mybatisplus.annotation.KeySequence; 6 import com.baomidou.mybatisplus.annotation.KeySequence;
5 import com.baomidou.mybatisplus.annotation.TableId; 7 import com.baomidou.mybatisplus.annotation.TableId;
6 import com.baomidou.mybatisplus.annotation.TableName; 8 import com.baomidou.mybatisplus.annotation.TableName;
7 import lombok.*; 9 import lombok.*;
8 10
9 -import java.util.Date; 11 +import java.time.LocalDateTime;
10 12
11 /** 13 /**
12 * 微信公众号粉丝 DO 14 * 微信公众号粉丝 DO
13 * 15 *
14 * @author 芋道源码 16 * @author 芋道源码
15 */ 17 */
16 -// TODO @亚洲:WxUserDO  
17 -@TableName("wx_account_fans")  
18 -@KeySequence("wx_account_fans_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 18 +@TableName("mp_user")
  19 +@KeySequence("mp_user_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
19 @Data 20 @Data
20 @EqualsAndHashCode(callSuper = true) 21 @EqualsAndHashCode(callSuper = true)
21 @ToString(callSuper = true) 22 @ToString(callSuper = true)
22 @Builder 23 @Builder
23 @NoArgsConstructor 24 @NoArgsConstructor
24 @AllArgsConstructor 25 @AllArgsConstructor
25 -public class WxAccountFansDO extends BaseDO { 26 +public class MpUserDO extends BaseDO {
26 27
27 /** 28 /**
28 * 编号 29 * 编号
@@ -34,25 +35,32 @@ public class WxAccountFansDO extends BaseDO { @@ -34,25 +35,32 @@ public class WxAccountFansDO extends BaseDO {
34 */ 35 */
35 private String openid; 36 private String openid;
36 /** 37 /**
37 - * 订阅状态,0未关注,1已关注 38 + * 关注状态
  39 + *
  40 + * 枚举 {@link CommonStatusEnum}
  41 + * 1. 开启 - 已关注
  42 + * 2. 禁用 - 取消关注
38 */ 43 */
39 - // TODO @亚洲:Integer 然后写个枚举哈  
40 - private String subscribeStatus; 44 + private Integer subscribeStatus;
41 /** 45 /**
42 - * 订阅时间 46 + * 关注时间
43 */ 47 */
44 - // TODO @亚洲:增加一个取消关注的事件  
45 - private Date subscribeTime; 48 + private LocalDateTime subscribeTime;
  49 + /**
  50 + * 取消关注时间
  51 + */
  52 + private LocalDateTime unsubscribeTime;
46 /** 53 /**
47 * 昵称 54 * 昵称
48 */ 55 */
49 - // TODO @亚洲:String  
50 - private byte[] nickname; 56 + private String nickname;
51 /** 57 /**
52 - * 性别,1男,2女,0未知 58 + * 性别
  59 + *
  60 + * 1- 男
  61 + * 2- 女
53 */ 62 */
54 - // TODO @亚洲:Integer  
55 - private String gender; 63 + private Integer gender;
56 /** 64 /**
57 * 语言 65 * 语言
58 */ 66 */
@@ -72,21 +80,23 @@ public class WxAccountFansDO extends BaseDO { @@ -72,21 +80,23 @@ public class WxAccountFansDO extends BaseDO {
72 /** 80 /**
73 * 头像地址 81 * 头像地址
74 */ 82 */
75 - // TODO @亚洲:headImageUrl  
76 - private String headimgUrl; 83 + private String headImageUrl;
77 /** 84 /**
78 * 备注 85 * 备注
79 */ 86 */
80 private String remark; 87 private String remark;
81 88
82 - // TODO @亚洲:是不是只要存储 WxAccountDO 的 id 呀?  
83 /** 89 /**
84 * 微信公众号 ID 90 * 微信公众号 ID
  91 + *
  92 + * 关联 {@link MpAccountDO#getId()}
85 */ 93 */
86 - private String wxAccountId; 94 + private String accountId;
87 /** 95 /**
88 * 微信公众号 appid 96 * 微信公众号 appid
  97 + *
  98 + * 冗余{@link MpAccountDO#getAppId()}
89 */ 99 */
90 - private String wxAccountAppid; 100 + private String appId;
91 101
92 } 102 }
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/accountfans/MpUserMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.mp.dal.mysql.accountfans;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  5 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  6 +import cn.iocoder.yudao.module.mp.controller.admin.user.vo.MpUserPageReqVO;
  7 +import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO;
  8 +import org.apache.ibatis.annotations.Mapper;
  9 +
  10 +@Mapper
  11 +public interface MpUserMapper extends BaseMapperX<MpUserDO> {
  12 +
  13 + default PageResult<MpUserDO> selectPage(MpUserPageReqVO reqVO) {
  14 + return selectPage(reqVO, new LambdaQueryWrapperX<MpUserDO>()
  15 + .likeIfPresent(MpUserDO::getOpenid, reqVO.getOpenid())
  16 + .likeIfPresent(MpUserDO::getNickname, reqVO.getNickname())
  17 + .eqIfPresent(MpUserDO::getAccountId, reqVO.getAccountId())
  18 + .orderByDesc(MpUserDO::getId));
  19 + }
  20 +
  21 +}
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/dal/mysql/accountfans/WxAccountFansMapper.java deleted
1 -package cn.iocoder.yudao.module.mp.dal.mysql.accountfans;  
2 -  
3 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
4 -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;  
5 -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;  
6 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansExportReqVO;  
7 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansPageReqVO;  
8 -import cn.iocoder.yudao.module.mp.dal.dataobject.accountfans.WxAccountFansDO;  
9 -import org.apache.ibatis.annotations.Mapper;  
10 -  
11 -import java.util.List;  
12 -  
13 -/**  
14 - * 微信公众号粉丝 Mapper  
15 - *  
16 - * @author 芋道源码  
17 - */  
18 -@Mapper  
19 -public interface WxAccountFansMapper extends BaseMapperX<WxAccountFansDO> {  
20 -  
21 - default PageResult<WxAccountFansDO> selectPage(WxAccountFansPageReqVO reqVO) {  
22 - return selectPage(reqVO, new LambdaQueryWrapperX<WxAccountFansDO>()  
23 - .eqIfPresent(WxAccountFansDO::getOpenid, reqVO.getOpenid())  
24 - .eqIfPresent(WxAccountFansDO::getSubscribeStatus, reqVO.getSubscribeStatus())  
25 - .betweenIfPresent(WxAccountFansDO::getSubscribeTime, reqVO.getBeginSubscribeTime(), reqVO.getEndSubscribeTime())  
26 - .likeIfPresent(WxAccountFansDO::getNickname, reqVO.getNickname())  
27 - .eqIfPresent(WxAccountFansDO::getGender, reqVO.getGender())  
28 - .eqIfPresent(WxAccountFansDO::getLanguage, reqVO.getLanguage())  
29 - .eqIfPresent(WxAccountFansDO::getCountry, reqVO.getCountry())  
30 - .eqIfPresent(WxAccountFansDO::getProvince, reqVO.getProvince())  
31 - .eqIfPresent(WxAccountFansDO::getCity, reqVO.getCity())  
32 - .eqIfPresent(WxAccountFansDO::getHeadimgUrl, reqVO.getHeadimgUrl())  
33 - .eqIfPresent(WxAccountFansDO::getRemark, reqVO.getRemark())  
34 - .eqIfPresent(WxAccountFansDO::getWxAccountId, reqVO.getWxAccountId())  
35 - .eqIfPresent(WxAccountFansDO::getWxAccountAppid, reqVO.getWxAccountAppid())  
36 - .betweenIfPresent(WxAccountFansDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())  
37 - .orderByDesc(WxAccountFansDO::getId));  
38 - }  
39 -  
40 - default List<WxAccountFansDO> selectList(WxAccountFansExportReqVO reqVO) {  
41 - return selectList(new LambdaQueryWrapperX<WxAccountFansDO>()  
42 - .eqIfPresent(WxAccountFansDO::getOpenid, reqVO.getOpenid())  
43 - .eqIfPresent(WxAccountFansDO::getSubscribeStatus, reqVO.getSubscribeStatus())  
44 - .betweenIfPresent(WxAccountFansDO::getSubscribeTime, reqVO.getBeginSubscribeTime(), reqVO.getEndSubscribeTime())  
45 - .likeIfPresent(WxAccountFansDO::getNickname, reqVO.getNickname())  
46 - .eqIfPresent(WxAccountFansDO::getGender, reqVO.getGender())  
47 - .eqIfPresent(WxAccountFansDO::getLanguage, reqVO.getLanguage())  
48 - .eqIfPresent(WxAccountFansDO::getCountry, reqVO.getCountry())  
49 - .eqIfPresent(WxAccountFansDO::getProvince, reqVO.getProvince())  
50 - .eqIfPresent(WxAccountFansDO::getCity, reqVO.getCity())  
51 - .eqIfPresent(WxAccountFansDO::getHeadimgUrl, reqVO.getHeadimgUrl())  
52 - .eqIfPresent(WxAccountFansDO::getRemark, reqVO.getRemark())  
53 - .eqIfPresent(WxAccountFansDO::getWxAccountId, reqVO.getWxAccountId())  
54 - .eqIfPresent(WxAccountFansDO::getWxAccountAppid, reqVO.getWxAccountAppid())  
55 - .betweenIfPresent(WxAccountFansDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())  
56 - .orderByDesc(WxAccountFansDO::getId));  
57 - }  
58 -  
59 -}  
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/framework/mp/config/MpConfiguration.java
@@ -4,6 +4,8 @@ import cn.iocoder.yudao.module.mp.framework.mp.core.DefaultMpServiceFactory; @@ -4,6 +4,8 @@ import cn.iocoder.yudao.module.mp.framework.mp.core.DefaultMpServiceFactory;
4 import cn.iocoder.yudao.module.mp.framework.mp.core.MpServiceFactory; 4 import cn.iocoder.yudao.module.mp.framework.mp.core.MpServiceFactory;
5 import cn.iocoder.yudao.module.mp.service.fansmsgres.NullHandler; 5 import cn.iocoder.yudao.module.mp.service.fansmsgres.NullHandler;
6 import cn.iocoder.yudao.module.mp.service.handler.*; 6 import cn.iocoder.yudao.module.mp.service.handler.*;
  7 +import cn.iocoder.yudao.module.mp.service.handler.user.SubscribeHandler;
  8 +import cn.iocoder.yudao.module.mp.service.handler.user.UnsubscribeHandler;
7 import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties; 9 import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties;
8 import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps; 10 import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps;
9 import org.springframework.context.annotation.Bean; 11 import org.springframework.context.annotation.Bean;
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/framework/mp/core/DefaultMpServiceFactory.java
@@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.mp.framework.mp.core; @@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.mp.framework.mp.core;
3 import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO; 3 import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO;
4 import cn.iocoder.yudao.module.mp.service.fansmsgres.NullHandler; 4 import cn.iocoder.yudao.module.mp.service.fansmsgres.NullHandler;
5 import cn.iocoder.yudao.module.mp.service.handler.*; 5 import cn.iocoder.yudao.module.mp.service.handler.*;
  6 +import cn.iocoder.yudao.module.mp.service.handler.user.SubscribeHandler;
  7 +import cn.iocoder.yudao.module.mp.service.handler.user.UnsubscribeHandler;
6 import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties; 8 import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties;
7 import com.google.common.collect.Maps; 9 import com.google.common.collect.Maps;
8 import lombok.RequiredArgsConstructor; 10 import lombok.RequiredArgsConstructor;
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/mq/costomer/MpConfigRefreshConsumer.java renamed to yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/mq/consumer/MpConfigRefreshConsumer.java
1 -package cn.iocoder.yudao.module.mp.mq.costomer; 1 +package cn.iocoder.yudao.module.mp.mq.consumer;
2 2
3 import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; 3 import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
4 import cn.iocoder.yudao.module.mp.mq.message.MpConfigRefreshMessage; 4 import cn.iocoder.yudao.module.mp.mq.message.MpConfigRefreshMessage;
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/accountfans/WxAccountFansService.java deleted
1 -package cn.iocoder.yudao.module.mp.service.accountfans;  
2 -  
3 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
4 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansCreateReqVO;  
5 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansExportReqVO;  
6 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansPageReqVO;  
7 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansUpdateReqVO;  
8 -import cn.iocoder.yudao.module.mp.dal.dataobject.accountfans.WxAccountFansDO;  
9 -import com.baomidou.mybatisplus.core.toolkit.support.SFunction;  
10 -  
11 -import javax.validation.Valid;  
12 -import java.util.Collection;  
13 -import java.util.List;  
14 -  
15 -/**  
16 - * 微信公众号粉丝 Service 接口  
17 - *  
18 - * @author 芋道源码  
19 - */  
20 -public interface WxAccountFansService {  
21 -  
22 - /**  
23 - * 创建微信公众号粉丝  
24 - *  
25 - * @param createReqVO 创建信息  
26 - * @return 编号  
27 - */  
28 - Long createWxAccountFans(@Valid WxAccountFansCreateReqVO createReqVO);  
29 -  
30 - /**  
31 - * 更新微信公众号粉丝  
32 - *  
33 - * @param updateReqVO 更新信息  
34 - */  
35 - void updateWxAccountFans(@Valid WxAccountFansUpdateReqVO updateReqVO);  
36 -  
37 - /**  
38 - * 删除微信公众号粉丝  
39 - *  
40 - * @param id 编号  
41 - */  
42 - void deleteWxAccountFans(Long id);  
43 -  
44 - /**  
45 - * 获得微信公众号粉丝  
46 - *  
47 - * @param id 编号  
48 - * @return 微信公众号粉丝  
49 - */  
50 - WxAccountFansDO getWxAccountFans(Long id);  
51 -  
52 - /**  
53 - * 获得微信公众号粉丝列表  
54 - *  
55 - * @param ids 编号  
56 - * @return 微信公众号粉丝列表  
57 - */  
58 - List<WxAccountFansDO> getWxAccountFansList(Collection<Long> ids);  
59 -  
60 - /**  
61 - * 获得微信公众号粉丝分页  
62 - *  
63 - * @param pageReqVO 分页查询  
64 - * @return 微信公众号粉丝分页  
65 - */  
66 - PageResult<WxAccountFansDO> getWxAccountFansPage(WxAccountFansPageReqVO pageReqVO);  
67 -  
68 - /**  
69 - * 获得微信公众号粉丝列表, 用于 Excel 导出  
70 - *  
71 - * @param exportReqVO 查询条件  
72 - * @return 微信公众号粉丝列表  
73 - */  
74 - List<WxAccountFansDO> getWxAccountFansList(WxAccountFansExportReqVO exportReqVO);  
75 -  
76 - /**  
77 - * 查询粉丝  
78 - *  
79 - * @param sFunction  
80 - * @param val  
81 - * @return  
82 - */  
83 - WxAccountFansDO findBy(SFunction<WxAccountFansDO, ?> sFunction, Object val);  
84 -}  
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/accountfans/WxAccountFansServiceImpl.java deleted
1 -package cn.iocoder.yudao.module.mp.service.accountfans;  
2 -  
3 -import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;  
4 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
5 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansCreateReqVO;  
6 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansExportReqVO;  
7 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansPageReqVO;  
8 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansUpdateReqVO;  
9 -import cn.iocoder.yudao.module.mp.convert.accountfans.WxAccountFansConvert;  
10 -import cn.iocoder.yudao.module.mp.dal.dataobject.accountfans.WxAccountFansDO;  
11 -import cn.iocoder.yudao.module.mp.dal.mysql.accountfans.WxAccountFansMapper;  
12 -import cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants;  
13 -import com.baomidou.mybatisplus.core.toolkit.support.SFunction;  
14 -import org.springframework.stereotype.Service;  
15 -import org.springframework.validation.annotation.Validated;  
16 -  
17 -import javax.annotation.Resource;  
18 -import java.util.Collection;  
19 -import java.util.List;  
20 -  
21 -/**  
22 - * 微信公众号粉丝 Service 实现类  
23 - *  
24 - * @author 芋道源码  
25 - */  
26 -@Service  
27 -@Validated  
28 -public class WxAccountFansServiceImpl implements WxAccountFansService {  
29 -  
30 - @Resource  
31 - private WxAccountFansMapper wxAccountFansMapper;  
32 -  
33 - @Override  
34 - public Long createWxAccountFans(WxAccountFansCreateReqVO createReqVO) {  
35 - // 插入  
36 - WxAccountFansDO wxAccountFans = WxAccountFansConvert.INSTANCE.convert(createReqVO);  
37 - wxAccountFansMapper.insert(wxAccountFans);  
38 - // 返回  
39 - return wxAccountFans.getId();  
40 - }  
41 -  
42 - @Override  
43 - public void updateWxAccountFans(WxAccountFansUpdateReqVO updateReqVO) {  
44 - // 校验存在  
45 - this.validateWxAccountFansExists(updateReqVO.getId());  
46 - // 更新  
47 - WxAccountFansDO updateObj = WxAccountFansConvert.INSTANCE.convert(updateReqVO);  
48 - wxAccountFansMapper.updateById(updateObj);  
49 - }  
50 -  
51 - @Override  
52 - public void deleteWxAccountFans(Long id) {  
53 - // 校验存在  
54 - this.validateWxAccountFansExists(id);  
55 - // 删除  
56 - wxAccountFansMapper.deleteById(id);  
57 - }  
58 -  
59 - private void validateWxAccountFansExists(Long id) {  
60 - if (wxAccountFansMapper.selectById(id) == null) {  
61 - throw ServiceExceptionUtil.exception(ErrorCodeConstants.WX_ACCOUNT_FANS_NOT_EXISTS);  
62 - }  
63 - }  
64 -  
65 - @Override  
66 - public WxAccountFansDO getWxAccountFans(Long id) {  
67 - return wxAccountFansMapper.selectById(id);  
68 - }  
69 -  
70 - @Override  
71 - public List<WxAccountFansDO> getWxAccountFansList(Collection<Long> ids) {  
72 - return wxAccountFansMapper.selectBatchIds(ids);  
73 - }  
74 -  
75 - @Override  
76 - public PageResult<WxAccountFansDO> getWxAccountFansPage(WxAccountFansPageReqVO pageReqVO) {  
77 - return wxAccountFansMapper.selectPage(pageReqVO);  
78 - }  
79 -  
80 - @Override  
81 - public List<WxAccountFansDO> getWxAccountFansList(WxAccountFansExportReqVO exportReqVO) {  
82 - return wxAccountFansMapper.selectList(exportReqVO);  
83 - }  
84 -  
85 - @Override  
86 - public WxAccountFansDO findBy(SFunction<WxAccountFansDO, ?> sFunction, Object val) {  
87 - return wxAccountFansMapper.selectOne(sFunction, val);  
88 - }  
89 -}  
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/handler/DefaultMessageHandler.java
@@ -49,9 +49,8 @@ public class DefaultMessageHandler implements WxMpMessageHandler { @@ -49,9 +49,8 @@ public class DefaultMessageHandler implements WxMpMessageHandler {
49 private FileApi fileApi; 49 private FileApi fileApi;
50 50
51 @Override 51 @Override
52 - public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,  
53 - Map<String, Object> context, WxMpService weixinService,  
54 - WxSessionManager sessionManager) { 52 + public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context,
  53 + WxMpService weixinService, WxSessionManager sessionManager) {
55 log.info("收到信息内容:{}", JsonUtils.toJsonString(wxMessage)); 54 log.info("收到信息内容:{}", JsonUtils.toJsonString(wxMessage));
56 log.info("关键字:{}", wxMessage.getContent()); 55 log.info("关键字:{}", wxMessage.getContent());
57 56
@@ -148,7 +147,7 @@ public class DefaultMessageHandler implements WxMpMessageHandler { @@ -148,7 +147,7 @@ public class DefaultMessageHandler implements WxMpMessageHandler {
148 147
149 //处理回复信息,优先级,关键字、智能机器人、默认值 148 //处理回复信息,优先级,关键字、智能机器人、默认值
150 String processContent(WxMpXmlMessage wxMessage) { 149 String processContent(WxMpXmlMessage wxMessage) {
151 - String content = ""; 150 + String content = "你猜";
152 /* content = processReceiveTextContent(wxMessage); 151 /* content = processReceiveTextContent(wxMessage);
153 if(StringUtils.isNotBlank( content )){ 152 if(StringUtils.isNotBlank( content )){
154 return content; 153 return content;
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/handler/SubscribeHandler.java renamed to yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/handler/user/SubscribeHandler.java
1 -package cn.iocoder.yudao.module.mp.service.handler; 1 +package cn.iocoder.yudao.module.mp.service.handler.user;
2 2
3 import cn.hutool.core.date.DateUtil; 3 import cn.hutool.core.date.DateUtil;
4 import cn.iocoder.yudao.framework.common.util.json.JsonUtils; 4 import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
5 import cn.iocoder.yudao.module.mp.builder.TextBuilder; 5 import cn.iocoder.yudao.module.mp.builder.TextBuilder;
6 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansCreateReqVO;  
7 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansUpdateReqVO; 6 +import cn.iocoder.yudao.module.mp.controller.admin.user.vo.WxAccountFansCreateReqVO;
  7 +import cn.iocoder.yudao.module.mp.controller.admin.user.vo.WxAccountFansUpdateReqVO;
8 import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO; 8 import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO;
9 -import cn.iocoder.yudao.module.mp.dal.dataobject.accountfans.WxAccountFansDO; 9 +import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO;
10 import cn.iocoder.yudao.module.mp.dal.dataobject.subscribetext.WxSubscribeTextDO; 10 import cn.iocoder.yudao.module.mp.dal.dataobject.subscribetext.WxSubscribeTextDO;
11 import cn.iocoder.yudao.module.mp.dal.dataobject.texttemplate.WxTextTemplateDO; 11 import cn.iocoder.yudao.module.mp.dal.dataobject.texttemplate.WxTextTemplateDO;
12 import cn.iocoder.yudao.module.mp.service.account.MpAccountService; 12 import cn.iocoder.yudao.module.mp.service.account.MpAccountService;
13 -import cn.iocoder.yudao.module.mp.service.accountfans.WxAccountFansService; 13 +import cn.iocoder.yudao.module.mp.service.user.MpUserService;
14 import cn.iocoder.yudao.module.mp.service.accountfanstag.WxAccountFansTagService; 14 import cn.iocoder.yudao.module.mp.service.accountfanstag.WxAccountFansTagService;
15 import cn.iocoder.yudao.module.mp.service.subscribetext.WxSubscribeTextService; 15 import cn.iocoder.yudao.module.mp.service.subscribetext.WxSubscribeTextService;
16 import cn.iocoder.yudao.module.mp.service.texttemplate.WxTextTemplateService; 16 import cn.iocoder.yudao.module.mp.service.texttemplate.WxTextTemplateService;
@@ -33,6 +33,8 @@ import java.util.Map; @@ -33,6 +33,8 @@ import java.util.Map;
33 /** 33 /**
34 * 关注的事件处理器 34 * 关注的事件处理器
35 * 35 *
  36 + * @author 芋道源码
  37 + *
36 * // TODO 芋艿:待实现 38 * // TODO 芋艿:待实现
37 */ 39 */
38 @Component 40 @Component
@@ -50,7 +52,7 @@ public class SubscribeHandler implements WxMpMessageHandler { @@ -50,7 +52,7 @@ public class SubscribeHandler implements WxMpMessageHandler {
50 private WxSubscribeTextService wxSubscribeTextService; 52 private WxSubscribeTextService wxSubscribeTextService;
51 53
52 @Autowired 54 @Autowired
53 - private WxAccountFansService wxAccountFansService; 55 + private MpUserService wxAccountFansService;
54 56
55 @Autowired 57 @Autowired
56 private WxAccountFansTagService wxAccountFansTagService; 58 private WxAccountFansTagService wxAccountFansTagService;
@@ -70,7 +72,7 @@ public class SubscribeHandler implements WxMpMessageHandler { @@ -70,7 +72,7 @@ public class SubscribeHandler implements WxMpMessageHandler {
70 // 可以添加关注用户到本地数据库 72 // 可以添加关注用户到本地数据库
71 MpAccountDO wxAccount = mpAccountService.findBy(MpAccountDO::getAccount, wxMessage.getToUser()); 73 MpAccountDO wxAccount = mpAccountService.findBy(MpAccountDO::getAccount, wxMessage.getToUser());
72 if (wxAccount != null) { 74 if (wxAccount != null) {
73 - WxAccountFansDO wxAccountFans = wxAccountFansService.findBy(WxAccountFansDO::getOpenid, wxmpUser.getOpenId()); 75 + MpUserDO wxAccountFans = wxAccountFansService.findBy(MpUserDO::getOpenid, wxmpUser.getOpenId());
74 if (wxAccountFans == null) {//insert 76 if (wxAccountFans == null) {//insert
75 WxAccountFansCreateReqVO wxAccountFansCreateReqVO = new WxAccountFansCreateReqVO(); 77 WxAccountFansCreateReqVO wxAccountFansCreateReqVO = new WxAccountFansCreateReqVO();
76 wxAccountFansCreateReqVO.setOpenid(wxmpUser.getOpenId()); 78 wxAccountFansCreateReqVO.setOpenid(wxmpUser.getOpenId());
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/handler/UnsubscribeHandler.java renamed to yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/handler/user/UnsubscribeHandler.java
1 -package cn.iocoder.yudao.module.mp.service.handler; 1 +package cn.iocoder.yudao.module.mp.service.handler.user;
2 2
3 -import cn.iocoder.yudao.module.mp.controller.admin.accountfans.vo.WxAccountFansUpdateReqVO; 3 +import cn.iocoder.yudao.module.mp.controller.admin.user.vo.WxAccountFansUpdateReqVO;
4 import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO; 4 import cn.iocoder.yudao.module.mp.dal.dataobject.account.MpAccountDO;
5 -import cn.iocoder.yudao.module.mp.dal.dataobject.accountfans.WxAccountFansDO; 5 +import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO;
6 import cn.iocoder.yudao.module.mp.service.account.MpAccountService; 6 import cn.iocoder.yudao.module.mp.service.account.MpAccountService;
7 -import cn.iocoder.yudao.module.mp.service.accountfans.WxAccountFansService; 7 +import cn.iocoder.yudao.module.mp.service.user.MpUserService;
8 import lombok.extern.slf4j.Slf4j; 8 import lombok.extern.slf4j.Slf4j;
9 import me.chanjar.weixin.common.session.WxSessionManager; 9 import me.chanjar.weixin.common.session.WxSessionManager;
10 import me.chanjar.weixin.mp.api.WxMpMessageHandler; 10 import me.chanjar.weixin.mp.api.WxMpMessageHandler;
@@ -21,6 +21,8 @@ import java.util.Map; @@ -21,6 +21,8 @@ import java.util.Map;
21 /** 21 /**
22 * 取消关注的事件处理器 22 * 取消关注的事件处理器
23 * 23 *
  24 + * @author 芋道源码
  25 + *
24 * // TODO 芋艿:待实现 26 * // TODO 芋艿:待实现
25 */ 27 */
26 @Component 28 @Component
@@ -32,7 +34,7 @@ public class UnsubscribeHandler implements WxMpMessageHandler { @@ -32,7 +34,7 @@ public class UnsubscribeHandler implements WxMpMessageHandler {
32 private MpAccountService mpAccountService; 34 private MpAccountService mpAccountService;
33 35
34 @Autowired 36 @Autowired
35 - private WxAccountFansService wxAccountFansService; 37 + private MpUserService wxAccountFansService;
36 38
37 @Override 39 @Override
38 public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, 40 public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
@@ -44,7 +46,7 @@ public class UnsubscribeHandler implements WxMpMessageHandler { @@ -44,7 +46,7 @@ public class UnsubscribeHandler implements WxMpMessageHandler {
44 46
45 MpAccountDO wxAccountDO = mpAccountService.findBy(MpAccountDO::getAccount, wxMessage.getToUser()); 47 MpAccountDO wxAccountDO = mpAccountService.findBy(MpAccountDO::getAccount, wxMessage.getToUser());
46 if (wxAccountDO != null) { 48 if (wxAccountDO != null) {
47 - WxAccountFansDO wxAccountFansDO = wxAccountFansService.findBy(WxAccountFansDO::getOpenid, openId); 49 + MpUserDO wxAccountFansDO = wxAccountFansService.findBy(MpUserDO::getOpenid, openId);
48 if (wxAccountFansDO != null) { 50 if (wxAccountFansDO != null) {
49 WxAccountFansUpdateReqVO wxAccountFansUpdateReqVO = new WxAccountFansUpdateReqVO(); 51 WxAccountFansUpdateReqVO wxAccountFansUpdateReqVO = new WxAccountFansUpdateReqVO();
50 wxAccountFansUpdateReqVO.setId(wxAccountDO.getId()); 52 wxAccountFansUpdateReqVO.setId(wxAccountDO.getId());
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/user/MpUserService.java 0 → 100644
  1 +package cn.iocoder.yudao.module.mp.service.user;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.mp.controller.admin.user.vo.MpUserPageReqVO;
  5 +import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO;
  6 +
  7 +import java.util.Collection;
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * 微信公众号粉丝 Service 接口
  12 + *
  13 + * @author 芋道源码
  14 + */
  15 +public interface MpUserService {
  16 +
  17 + /**
  18 + * 获得微信公众号粉丝
  19 + *
  20 + * @param id 编号
  21 + * @return 微信公众号粉丝
  22 + */
  23 + MpUserDO getUser(Long id);
  24 +
  25 + /**
  26 + * 获得微信公众号粉丝列表
  27 + *
  28 + * @param ids 编号
  29 + * @return 微信公众号粉丝列表
  30 + */
  31 + List<MpUserDO> getUserList(Collection<Long> ids);
  32 +
  33 + /**
  34 + * 获得微信公众号粉丝分页
  35 + *
  36 + * @param pageReqVO 分页查询
  37 + * @return 微信公众号粉丝分页
  38 + */
  39 + PageResult<MpUserDO> getUserPage(MpUserPageReqVO pageReqVO);
  40 +
  41 +}
yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/user/MpUserServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.mp.service.user;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.mp.controller.admin.user.vo.MpUserPageReqVO;
  5 +import cn.iocoder.yudao.module.mp.dal.dataobject.user.MpUserDO;
  6 +import cn.iocoder.yudao.module.mp.dal.mysql.accountfans.MpUserMapper;
  7 +import org.springframework.stereotype.Service;
  8 +import org.springframework.validation.annotation.Validated;
  9 +
  10 +import javax.annotation.Resource;
  11 +import java.util.Collection;
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * 微信公众号粉丝 Service 实现类
  16 + *
  17 + * @author 芋道源码
  18 + */
  19 +@Service
  20 +@Validated
  21 +public class MpUserServiceImpl implements MpUserService {
  22 +
  23 + @Resource
  24 + private MpUserMapper mpUserMapper;
  25 +
  26 + @Override
  27 + public MpUserDO getUser(Long id) {
  28 + return mpUserMapper.selectById(id);
  29 + }
  30 +
  31 + @Override
  32 + public List<MpUserDO> getUserList(Collection<Long> ids) {
  33 + return mpUserMapper.selectBatchIds(ids);
  34 + }
  35 +
  36 + @Override
  37 + public PageResult<MpUserDO> getUserPage(MpUserPageReqVO pageReqVO) {
  38 + return mpUserMapper.selectPage(pageReqVO);
  39 + }
  40 +
  41 +}