Browse Source

对接拼团数据

master
wangfukang 4 weeks ago
parent
commit
41b157f146
  1. 6
      hiver-admin/src/main/resources/application.yml
  2. 2
      hiver-core/src/main/java/cc/hiver/core/dao/WorkerDao.java
  3. 4
      hiver-core/src/main/java/cc/hiver/core/entity/Worker.java
  4. 2
      hiver-core/src/main/java/cc/hiver/core/service/WorkerService.java
  5. 24
      hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java
  6. 19
      hiver-core/src/main/java/cc/hiver/core/serviceimpl/WorkerServiceImpl.java
  7. 3
      hiver-core/src/main/java/cc/hiver/core/vo/WorkerQueryVO.java
  8. 36
      hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java
  9. 54
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/WorkerController.java
  10. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/WorkerRelaPriceController.java
  11. 10
      hiver-modules/hiver-social/src/main/java/cc/hiver/social/controller/WechatController.java
  12. 4
      hiver-modules/hiver-social/src/main/java/cc/hiver/social/handler/WxServerMsgHandler.java

6
hiver-admin/src/main/resources/application.yml

@ -26,7 +26,7 @@ spring:
# 数据源 # 数据源
datasource: datasource:
# url: jdbc:mysql://154.8.162.157:3306/hiver_shop?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true # url: jdbc:mysql://154.8.162.157:3306/hiver_shop?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true
url: jdbc:mysql://8.140.253.224:3306/school?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true url: jdbc:mysql://8.140.253.224:3306/school?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false&maxReconnects=10
username: root username: root
# Jasypt加密 可到common-utils中找到JasyptUtil加解密工具类生成加密结果 格式为ENC(加密结果) 以下解密结果为123456 # Jasypt加密 可到common-utils中找到JasyptUtil加解密工具类生成加密结果 格式为ENC(加密结果) 以下解密结果为123456
password: ENC(87YloapnWG6mLejOa27eLN0afFhCrbAGxoHXXrSUrGJ0trM/BndC2kx/gfoJsXIi) password: ENC(87YloapnWG6mLejOa27eLN0afFhCrbAGxoHXXrSUrGJ0trM/BndC2kx/gfoJsXIi)
@ -252,9 +252,9 @@ wx:
templateId: o9YG7vWS8It-mddU2Wnknf1jgzTqZtLeBQRLhF54SXQ templateId: o9YG7vWS8It-mddU2Wnknf1jgzTqZtLeBQRLhF54SXQ
mp: mp:
# 微信公众号的appid # 微信公众号的appid
appId: wx415a86fa6c2eff11 appId: wx0a49a4804987aa99
# 信公众号的app secret # 信公众号的app secret
secret: b4bf01832f7a640353367d8979409900 secret: c94f47ce35d41f18c46ee628a4328484
# 微信公众号的toke # 微信公众号的toke
token: kuaiyidian token: kuaiyidian
# 微信公众号的EncodingAESKey # 微信公众号的EncodingAESKey

2
hiver-core/src/main/java/cc/hiver/core/dao/WorkerDao.java

@ -13,6 +13,8 @@ public interface WorkerDao extends HiverBaseDao<Worker, String> {
Worker findByUsername(String username); Worker findByUsername(String username);
Worker findByUserId(String userId);
@Modifying @Modifying
@Query("update Worker w set w.isOnLine=?2 where w.workerId=?1") @Query("update Worker w set w.isOnLine=?2 where w.workerId=?1")
void changeOnLine(String id, Integer onLine); void changeOnLine(String id, Integer onLine);

4
hiver-core/src/main/java/cc/hiver/core/entity/Worker.java

@ -153,6 +153,10 @@ public class Worker implements Serializable {
@ApiModelProperty(value = "手上的待接单订单数") @ApiModelProperty(value = "手上的待接单订单数")
private Integer orderWaitCount; private Integer orderWaitCount;
@Transient
@ApiModelProperty(value = "用户切换校区")
private Integer isChangeArea;
@Transient @Transient
@ApiModelProperty(value = "手上的待取货订单数") @ApiModelProperty(value = "手上的待取货订单数")
private Integer orderGetCount; private Integer orderGetCount;

2
hiver-core/src/main/java/cc/hiver/core/service/WorkerService.java

@ -28,6 +28,8 @@ public interface WorkerService extends HiverBaseService<Worker, String> {
Worker findByMobile(String mobile); Worker findByMobile(String mobile);
Worker findByUserId(String userId);
Worker findByWorkerId(String workerId); Worker findByWorkerId(String workerId);
List<Worker> getWXByCondition(WorkerQueryVO worker); List<Worker> getWXByCondition(WorkerQueryVO worker);

24
hiver-core/src/main/java/cc/hiver/core/serviceimpl/UserServiceImpl.java

@ -2,9 +2,7 @@ package cc.hiver.core.serviceimpl;
import cc.hiver.core.common.constant.CommonConstant; import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.constant.UserConstant; import cc.hiver.core.common.constant.UserConstant;
import cc.hiver.core.common.utils.PageUtil;
import cc.hiver.core.common.utils.SecurityUtil; import cc.hiver.core.common.utils.SecurityUtil;
import cc.hiver.core.common.utils.StringUtils;
import cc.hiver.core.common.vo.PageVo; import cc.hiver.core.common.vo.PageVo;
import cc.hiver.core.common.vo.SearchVo; import cc.hiver.core.common.vo.SearchVo;
import cc.hiver.core.dao.UserDao; import cc.hiver.core.dao.UserDao;
@ -281,11 +279,11 @@ public class UserServiceImpl implements UserService {
final Map<String, Object> resultMap = new HashMap<>(); final Map<String, Object> resultMap = new HashMap<>();
if (wechatUser != null) { if (wechatUser != null) {
wechatUser.setOfficialAccountOpenid(openid); wechatUser.setOfficialAccountOpenid(openid);
if (!wechatUser.getType().contains(UserConstant.USER_TYPE_CUSTOM)) { /*if (!wechatUser.getType().contains(UserConstant.USER_TYPE_CUSTOM)) {
// 不包含,赋予下游客户身份 // 不包含,赋予下游客户身份
final String newUserType = StringUtils.isEmpty(wechatUser.getType()) ? UserConstant.USER_TYPE_CUSTOM : wechatUser.getType() + ',' + UserConstant.USER_TYPE_CUSTOM; final String newUserType = StringUtils.isEmpty(wechatUser.getType()) ? UserConstant.USER_TYPE_CUSTOM : wechatUser.getType() + ',' + UserConstant.USER_TYPE_CUSTOM;
wechatUser.setType(newUserType); wechatUser.setType(newUserType);
} }*/
} else { } else {
try { try {
// 新增用户信息 // 新增用户信息
@ -293,20 +291,20 @@ public class UserServiceImpl implements UserService {
wechatUser.setUnionid(unionid); wechatUser.setUnionid(unionid);
wechatUser.setOfficialAccountOpenid(openid); wechatUser.setOfficialAccountOpenid(openid);
wechatUser.setStatus(UserConstant.USER_STATUS_NORMAL); wechatUser.setStatus(UserConstant.USER_STATUS_NORMAL);
wechatUser.setType(UserConstant.USER_TYPE_CUSTOM); wechatUser.setType(UserConstant.USER_TYPE_NORMAL);
wechatUser = save(wechatUser); wechatUser = save(wechatUser);
// 设置用户角色 // 设置用户角色
final UserRole userRole = new UserRole();
final PageVo pageVo = new PageVo(); final PageVo pageVo = new PageVo();
pageVo.setPageNumber(1); pageVo.setPageNumber(1);
pageVo.setPageSize(1); pageVo.setPageSize(1);
final Page<Role> roleCustomer = roleService.findByCondition("ROLE_CUSTOMER", PageUtil.initPage(pageVo)); // 默认角色
final Role role = roleCustomer.getContent().get(0); final List<Role> roleList = roleService.findByDefaultRole(true);
//客户角色 if (roleList != null && roleList.size() > 0) {
userRole.setRoleId(role.getId()); for (Role role : roleList) {
userRole.setRoleName("客户"); final UserRole ur = new UserRole().setUserId(wechatUser.getId()).setRoleId(role.getId());
userRole.setUserId(wechatUser.getId()); userRoleService.save(ur);
userRoleService.save(userRole); }
}
// 更新客户信息,绑定登录用户 // 更新客户信息,绑定登录用户
// customerService.updateUserId(wechatVo.getCustomId(),wechatUser.getId()); // customerService.updateUserId(wechatVo.getCustomId(),wechatUser.getId());
// 返回当前登录人的信息 // 返回当前登录人的信息

19
hiver-core/src/main/java/cc/hiver/core/serviceimpl/WorkerServiceImpl.java

@ -23,7 +23,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.persistence.criteria.*; import javax.persistence.criteria.*;
import java.util.*; import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/** /**
* 用户接口实现 * 用户接口实现
@ -65,6 +67,7 @@ public class WorkerServiceImpl implements WorkerService {
final Path<Date> createTimeField = root.get("createTime"); final Path<Date> createTimeField = root.get("createTime");
final Path<Date> signPersonField = root.get("signPerson"); final Path<Date> signPersonField = root.get("signPerson");
final Path<String> isOnLineField = root.get("isOnLine"); final Path<String> isOnLineField = root.get("isOnLine");
final Path<String> userIdField = root.get("userId");
final List<Predicate> list = new ArrayList<>(); final List<Predicate> list = new ArrayList<>();
@ -73,6 +76,10 @@ public class WorkerServiceImpl implements WorkerService {
list.add(cb.equal(workerIdField, worker.getWorkerId())); list.add(cb.equal(workerIdField, worker.getWorkerId()));
} }
if (CharSequenceUtil.isNotBlank(worker.getUserId())) {
list.add(cb.equal(userIdField, worker.getUserId()));
}
if (CharSequenceUtil.isNotBlank(worker.getSignPerson())) { if (CharSequenceUtil.isNotBlank(worker.getSignPerson())) {
list.add(cb.equal(signPersonField, worker.getSignPerson())); list.add(cb.equal(signPersonField, worker.getSignPerson()));
} }
@ -130,14 +137,14 @@ public class WorkerServiceImpl implements WorkerService {
for (Worker worker1 : content) { for (Worker worker1 : content) {
workerIdList.add(worker1.getWorkerId()); workerIdList.add(worker1.getWorkerId());
} }
// 查询每个拉包工身上的单子数量 /*// 查询每个拉包工身上的单子数量
final List<Map<String, Object>> workerOrderCountList = orderOfCoreService.findWorkerOrderCount(workerIdList); final List<Map<String, Object>> workerOrderCountList = orderOfCoreService.findWorkerOrderCount(workerIdList);
Map<String,Integer> workerOrderCountMap = new HashMap<>(); Map<String,Integer> workerOrderCountMap = new HashMap<>();
for (Map<String, Object> stringIntegerMap : workerOrderCountList) { for (Map<String, Object> stringIntegerMap : workerOrderCountList) {
String workId = stringIntegerMap.get("workId").toString(); String workId = stringIntegerMap.get("workId").toString();
String orderCount = stringIntegerMap.get("orderCount").toString(); String orderCount = stringIntegerMap.get("orderCount").toString();
workerOrderCountMap.put(workId, Integer.valueOf(orderCount)); workerOrderCountMap.put(workId, Integer.valueOf(orderCount));
} }*/
return workerPage; return workerPage;
} }
@ -147,6 +154,12 @@ public class WorkerServiceImpl implements WorkerService {
return worker; return worker;
} }
@Override
public Worker findByUserId(String userId) {
final Worker worker = workerDao.findByUserId(userId);
return worker;
}
@Override @Override
public Worker findByWorkerId(String orderId) { public Worker findByWorkerId(String orderId) {
return workerDao.findByWorkerId(orderId); return workerDao.findByWorkerId(orderId);

3
hiver-core/src/main/java/cc/hiver/core/vo/WorkerQueryVO.java

@ -115,4 +115,7 @@ public class WorkerQueryVO extends HiverBasePageQuery {
@ApiModelProperty("后台管理系统标识") @ApiModelProperty("后台管理系统标识")
private String adminFlag; private String adminFlag;
@ApiModelProperty("后台管理系统标识")
private String userId;
} }

36
hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java

@ -13,17 +13,12 @@ import cc.hiver.core.common.vo.PageVo;
import cc.hiver.core.common.vo.Result; import cc.hiver.core.common.vo.Result;
import cc.hiver.core.common.vo.SearchVo; import cc.hiver.core.common.vo.SearchVo;
import cc.hiver.core.dao.mapper.DeleteMapper; import cc.hiver.core.dao.mapper.DeleteMapper;
import cc.hiver.core.entity.Department; import cc.hiver.core.entity.*;
import cc.hiver.core.entity.Role;
import cc.hiver.core.entity.User;
import cc.hiver.core.entity.UserRole;
import cc.hiver.core.service.*; import cc.hiver.core.service.*;
import cc.hiver.core.service.mybatis.IUserRoleService; import cc.hiver.core.service.mybatis.IUserRoleService;
import cc.hiver.core.vo.RoleDTO; import cc.hiver.core.vo.RoleDTO;
import cc.hiver.core.vo.WechatVo; import cc.hiver.core.vo.WechatVo;
import cc.hiver.mall.entity.Shop;
import cc.hiver.mall.entity.ShopArea; import cc.hiver.mall.entity.ShopArea;
import cc.hiver.mall.entity.ShopUser;
import cc.hiver.mall.service.ShopAreaService; import cc.hiver.mall.service.ShopAreaService;
import cc.hiver.mall.service.ShopService; import cc.hiver.mall.service.ShopService;
import cc.hiver.mall.service.ShopUserService; import cc.hiver.mall.service.ShopUserService;
@ -76,6 +71,9 @@ public class UserController {
@Autowired @Autowired
private DepartmentService departmentService; private DepartmentService departmentService;
@Autowired
private WorkerService workerService;
@Autowired @Autowired
private ShopAreaService shopAreaService; private ShopAreaService shopAreaService;
@ -255,7 +253,7 @@ public class UserController {
u.setMobile(mobile); u.setMobile(mobile);
userService.update(u); userService.update(u);
// 删除缓存 // 删除缓存
redisTemplate.delete(USER + u.getUsername()); //redisTemplate.delete(USER + u.getUsername());
return ResultUtil.success("修改手机号成功"); return ResultUtil.success("修改手机号成功");
} }
@ -674,28 +672,8 @@ public class UserController {
// 返回当前登录人的信息 // 返回当前登录人的信息
resultMap.put("user", wechatUser); resultMap.put("user", wechatUser);
// 店铺登录的话,根据登录人查询所有关联的店铺(店铺启用,并且在有效期内) Worker worker = workerService.findByUserId(wechatUser.getId());
if (UserConstant.USER_TYPE_NORMAL.equals(wechatUser.getType())) { resultMap.put("worker", worker);
// 获取
final List<ShopUser> shopUsers = shopUserService.selectByUserId(wechatUser.getId());
if (shopUsers != null && !shopUsers.isEmpty()) {
// 获取店主手机号
for (ShopUser shopUser : shopUsers) {
final Shop shop = shopService.findById(shopUser.getShop().getId());
if (shop != null && shop.getShopOwnerId() != null && StringUtils.isNotEmpty(shop.getShopOwnerId())) {
final User shopOwner = userService.findById(shop.getShopOwnerId());
if (shopOwner != null) {
shopUser.setShopOwnerName(shopOwner.getNickname());
shopUser.setShopOwnerPhone(shopOwner.getMobile());
}
}
}
resultMap.put("shopList", shopUsers);
} else {
return ResultUtil.error("店铺未开通!");
}
}
return ResultUtil.data(resultMap); return ResultUtil.data(resultMap);
} }

54
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/WorkerController.java

@ -4,7 +4,9 @@ import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.constant.WorkerConstant; import cc.hiver.core.common.constant.WorkerConstant;
import cc.hiver.core.common.utils.BeanUtils; import cc.hiver.core.common.utils.BeanUtils;
import cc.hiver.core.common.utils.ResultUtil; import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.utils.SecurityUtil;
import cc.hiver.core.common.vo.Result; import cc.hiver.core.common.vo.Result;
import cc.hiver.core.entity.User;
import cc.hiver.core.entity.Worker; import cc.hiver.core.entity.Worker;
import cc.hiver.core.service.WorkerService; import cc.hiver.core.service.WorkerService;
import cc.hiver.core.vo.WorkerAppVO; import cc.hiver.core.vo.WorkerAppVO;
@ -57,6 +59,9 @@ public class WorkerController {
@Autowired @Autowired
private WorkerRelaPriceMapper workerRelaPriceMapper; private WorkerRelaPriceMapper workerRelaPriceMapper;
@Autowired
private SecurityUtil securityUtil;
@RequestMapping(value = "/getByCondition", method = RequestMethod.POST) @RequestMapping(value = "/getByCondition", method = RequestMethod.POST)
@ApiOperation(value = "多条件分页获取订单列表") @ApiOperation(value = "多条件分页获取订单列表")
public Result<Page<Worker>> getByCondition(@RequestBody WorkerQueryVO worker) { public Result<Page<Worker>> getByCondition(@RequestBody WorkerQueryVO worker) {
@ -91,33 +96,32 @@ public class WorkerController {
} }
@RequestMapping(value = "/admin/add", method = RequestMethod.POST) @RequestMapping(value = "/admin/add", method = RequestMethod.POST)
@ApiOperation(value = "创建配送员") @ApiOperation(value = "创建配送员或切换校区")
public Result add(@Valid Worker u) { public Result<Worker> add(@Valid Worker u) {
final User user = securityUtil.getCurrUser();
// 添加商圈名称 Worker worker = workerService.findByUserId(user.getId());
if (StrUtil.isNotBlank(u.getRegion())) { if(worker != null){
ShopArea d = shopAreaService.get(u.getRegion()); if(u.getRegion().equals(worker.getRegion())){
if (d != null) { return new ResultUtil<Worker>().setData(worker);
u.setRegionTitle(d.getTitle()); }else{
} worker.setRegion(u.getRegion());
} else { workerService.update(worker);
u.setRegion(null); return new ResultUtil<Worker>().setData(worker);
u.setRegionTitle("");
} }
//更新充值记录 }else{
Recharge recharge = new Recharge(); if(u.getIsChangeArea() != null && u.getIsChangeArea() == 0){
return new ResultUtil<Worker>().setData(worker);
recharge.setRechargeName(u.getWorkerName()); }else{
recharge.setRechargeWorkerId(u.getWorkerId()); u.setWorkerName(user.getNickname());
recharge.setMobile(u.getMobile()); u.setUserId(user.getId());
u.setAvgTime(BigDecimal.valueOf(30));
rechargeService.save(recharge); u.setMobile(user.getMobile());
u.setIsOnLine(CommonConstant.OFF_LINE);
//更新余额,重置当次应缴 u.setScore(BigDecimal.valueOf(5));
u.setIsOnLine(CommonConstant.ON_LINE);
workerService.save(u); workerService.save(u);
return new ResultUtil<Worker>().setData(u);
return ResultUtil.success("创建成功"); }
}
} }
@RequestMapping(value = "/admin/edit", method = RequestMethod.POST) @RequestMapping(value = "/admin/edit", method = RequestMethod.POST)

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/WorkerRelaPriceController.java

@ -52,11 +52,13 @@ public class WorkerRelaPriceController {
public Result<WorkerRealPriceVo> getByProductId(@RequestParam String workerId) { public Result<WorkerRealPriceVo> getByProductId(@RequestParam String workerId) {
WorkerRealPriceVo workerRealPriceVo = new WorkerRealPriceVo(); WorkerRealPriceVo workerRealPriceVo = new WorkerRealPriceVo();
Worker worker = workerService.findByWorkerId(workerId); Worker worker = workerService.findByWorkerId(workerId);
if(worker != null){
workerRealPriceVo.setWorkerName(worker.getWorkerName()); workerRealPriceVo.setWorkerName(worker.getWorkerName());
workerRealPriceVo.setCardPicture(worker.getCardPicture()); workerRealPriceVo.setCardPicture(worker.getCardPicture());
workerRealPriceVo.setHighFloorFee(worker.getHighFloorFee()); workerRealPriceVo.setHighFloorFee(worker.getHighFloorFee());
final List<WorkerRelaPrice> workerRelaPriceList = workerRelaPriceService.selectByWorkerId(workerId); final List<WorkerRelaPrice> workerRelaPriceList = workerRelaPriceService.selectByWorkerId(workerId);
workerRealPriceVo.setWorkerRelaPriceList(workerRelaPriceList); workerRealPriceVo.setWorkerRelaPriceList(workerRelaPriceList);
}
return new ResultUtil<WorkerRealPriceVo>().setData(workerRealPriceVo); return new ResultUtil<WorkerRealPriceVo>().setData(workerRealPriceVo);
} }

10
hiver-modules/hiver-social/src/main/java/cc/hiver/social/controller/WechatController.java

@ -8,6 +8,8 @@ import cc.hiver.core.common.redis.RedisTemplateHelper;
import cc.hiver.core.common.utils.ResultUtil; import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.utils.SecurityUtil; import cc.hiver.core.common.utils.SecurityUtil;
import cc.hiver.core.common.vo.Result; import cc.hiver.core.common.vo.Result;
import cc.hiver.core.entity.User;
import cc.hiver.core.service.UserService;
import cc.hiver.mall.service.mybatis.CustomerService; import cc.hiver.mall.service.mybatis.CustomerService;
import cc.hiver.social.entity.Social; import cc.hiver.social.entity.Social;
import cc.hiver.social.service.SocialService; import cc.hiver.social.service.SocialService;
@ -80,6 +82,9 @@ public class WechatController {
@Autowired @Autowired
private RedisTemplateHelper redisTemplate; private RedisTemplateHelper redisTemplate;
@Autowired
private UserService userService;
@Autowired @Autowired
private WxMpService wxMpService; private WxMpService wxMpService;
@ -128,6 +133,11 @@ public class WechatController {
String phoneNumber = wechatPhoneService.getPhoneNumber(code); String phoneNumber = wechatPhoneService.getPhoneNumber(code);
if (phoneNumber != null) { if (phoneNumber != null) {
final User u = securityUtil.getCurrUser();
u.setMobile(phoneNumber);
userService.update(u);
// 删除缓存
//redisTemplate.delete(USER + u.getUsername());
return ResultUtil.data(phoneNumber); return ResultUtil.data(phoneNumber);
} else { } else {
return ResultUtil.error(401,"获取手机号失败"); return ResultUtil.error(401,"获取手机号失败");

4
hiver-modules/hiver-social/src/main/java/cc/hiver/social/handler/WxServerMsgHandler.java

@ -28,13 +28,13 @@ public class WxServerMsgHandler implements WxMpMessageHandler {
log.info("接收到的消息MsgType:{};Event:{};OpenId:{};FromUser:{};",wxMessage.getMsgType(),wxMessage.getEvent(),wxMessage.getOpenId(),wxMessage.getFromUser()); log.info("接收到的消息MsgType:{};Event:{};OpenId:{};FromUser:{};",wxMessage.getMsgType(),wxMessage.getEvent(),wxMessage.getOpenId(),wxMessage.getFromUser());
// 响应的消息内容 // 响应的消息内容
String outContent = ""; String outContent = "";
//判断是否是事件类型 //判断是否是事件类型 用户关注取消关注公众号回调
if(wxMessage.getMsgType().equals(WxConsts.XmlMsgType.EVENT)){ if(wxMessage.getMsgType().equals(WxConsts.XmlMsgType.EVENT)){
//订阅 //订阅
final String lang = "zh_CN"; //语言 final String lang = "zh_CN"; //语言
final WxMpUser user = wxMpService.getUserService().userInfo(wxMessage.getFromUser(),lang); final WxMpUser user = wxMpService.getUserService().userInfo(wxMessage.getFromUser(),lang);
if(wxMessage.getEvent().equals(WxConsts.EventType.SUBSCRIBE)){ if(wxMessage.getEvent().equals(WxConsts.EventType.SUBSCRIBE)){
outContent = "【快衣店信息推送】欢迎您!致力于帮助服装店主们更好地进行商品管理和营销推广,我们会持续发布实用技巧、成功案例分析等内容。期待与您共同成长,共创辉煌业绩!"; outContent = "【快拾科技】欢迎您!";
log.info("关注公众号的用户信息:user====:{}",user); log.info("关注公众号的用户信息:user====:{}",user);
userService.subscribeWxServer(user); userService.subscribeWxServer(user);
} }

Loading…
Cancel
Save