mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
mp:重构 mp user 的表结构,以及相关的 service
This commit is contained in:
parent
a7e4ff0d76
commit
cdb7348b08
@ -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<Long> createWxAccountFans(@Valid @RequestBody WxAccountFansCreateReqVO createReqVO) {
|
||||
return success(wxAccountFansService.createWxAccountFans(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("更新微信公众号粉丝")
|
||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<WxAccountFansRespVO> 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<List<WxAccountFansRespVO>> getWxAccountFansList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<WxAccountFansDO> list = wxAccountFansService.getWxAccountFansList(ids);
|
||||
return success(WxAccountFansConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得微信公众号粉丝分页")
|
||||
@PreAuthorize("@ss.hasPermission('wechatMp:wx-account-fans:query')")
|
||||
public CommonResult<PageResult<WxAccountFansRespVO>> getWxAccountFansPage(@Valid WxAccountFansPageReqVO pageVO) {
|
||||
PageResult<WxAccountFansDO> 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<WxAccountFansDO> list = wxAccountFansService.getWxAccountFansList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<WxAccountFansExcelVO> datas = WxAccountFansConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "微信公众号粉丝.xls", "数据", WxAccountFansExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -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 {
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<PageResult<MpUserRespVO>> getUserPage(@Valid MpUserPageReqVO pageVO) {
|
||||
PageResult<MpUserDO> pageResult = mpUserService.getUserPage(pageVO);
|
||||
return success(MpUserConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
@ -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<WxAccountFansRespVO> convertList(List<WxAccountFansDO> list);
|
||||
|
||||
PageResult<WxAccountFansRespVO> convertPage(PageResult<WxAccountFansDO> page);
|
||||
|
||||
List<WxAccountFansExcelVO> convertList02(List<WxAccountFansDO> list);
|
||||
|
||||
}
|
@ -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<MpUserRespVO> convertList(List<MpUserDO> list);
|
||||
|
||||
PageResult<MpUserRespVO> convertPage(PageResult<MpUserDO> page);
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<MpUserDO> {
|
||||
|
||||
default PageResult<MpUserDO> selectPage(MpUserPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MpUserDO>()
|
||||
.likeIfPresent(MpUserDO::getOpenid, reqVO.getOpenid())
|
||||
.likeIfPresent(MpUserDO::getNickname, reqVO.getNickname())
|
||||
.eqIfPresent(MpUserDO::getAccountId, reqVO.getAccountId())
|
||||
.orderByDesc(MpUserDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -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<WxAccountFansDO> {
|
||||
|
||||
default PageResult<WxAccountFansDO> selectPage(WxAccountFansPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<WxAccountFansDO>()
|
||||
.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<WxAccountFansDO> selectList(WxAccountFansExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<WxAccountFansDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
@ -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<WxAccountFansDO> getWxAccountFansList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得微信公众号粉丝分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 微信公众号粉丝分页
|
||||
*/
|
||||
PageResult<WxAccountFansDO> getWxAccountFansPage(WxAccountFansPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得微信公众号粉丝列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 微信公众号粉丝列表
|
||||
*/
|
||||
List<WxAccountFansDO> getWxAccountFansList(WxAccountFansExportReqVO exportReqVO);
|
||||
|
||||
/**
|
||||
* 查询粉丝
|
||||
*
|
||||
* @param sFunction
|
||||
* @param val
|
||||
* @return
|
||||
*/
|
||||
WxAccountFansDO findBy(SFunction<WxAccountFansDO, ?> sFunction, Object val);
|
||||
}
|
@ -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<WxAccountFansDO> getWxAccountFansList(Collection<Long> ids) {
|
||||
return wxAccountFansMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<WxAccountFansDO> getWxAccountFansPage(WxAccountFansPageReqVO pageReqVO) {
|
||||
return wxAccountFansMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WxAccountFansDO> getWxAccountFansList(WxAccountFansExportReqVO exportReqVO) {
|
||||
return wxAccountFansMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxAccountFansDO findBy(SFunction<WxAccountFansDO, ?> sFunction, Object val) {
|
||||
return wxAccountFansMapper.selectOne(sFunction, val);
|
||||
}
|
||||
}
|
@ -49,9 +49,8 @@ public class DefaultMessageHandler implements WxMpMessageHandler {
|
||||
private FileApi fileApi;
|
||||
|
||||
@Override
|
||||
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
|
||||
Map<String, Object> context, WxMpService weixinService,
|
||||
WxSessionManager sessionManager) {
|
||||
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> 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;
|
||||
|
@ -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());
|
@ -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());
|
@ -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<MpUserDO> getUserList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得微信公众号粉丝分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 微信公众号粉丝分页
|
||||
*/
|
||||
PageResult<MpUserDO> getUserPage(MpUserPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -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<MpUserDO> getUserList(Collection<Long> ids) {
|
||||
return mpUserMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MpUserDO> getUserPage(MpUserPageReqVO pageReqVO) {
|
||||
return mpUserMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user