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