Merge remote-tracking branch 'origin/master' into dev-chenjiajian
This commit is contained in:
commit
7068df5eda
@ -12,7 +12,7 @@ import com.seer.teach.mp.admin.service.IAdminActivityService;
|
||||
import com.seer.teach.mp.entity.MpActivityEntity;
|
||||
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||
import com.seer.teach.mp.service.IMpActivityService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityParticipantService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityRelationService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -37,7 +37,7 @@ public class AdminActivityServiceImpl implements IAdminActivityService {
|
||||
|
||||
private final IMpActivityService agentActivityService;
|
||||
|
||||
private final IMpAgentActivityParticipantService agentActivityParticipantService;
|
||||
private final IMpAgentActivityRelationService agentActivityParticipantService;
|
||||
|
||||
@Override
|
||||
public PageListBean<AdminActivityResp> pageList(MpActivityQueryReq query) {
|
||||
|
||||
@ -19,7 +19,7 @@ import com.seer.teach.mp.entity.MpActivityEntity;
|
||||
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||
import com.seer.teach.mp.entity.MpAgentEntity;
|
||||
import com.seer.teach.mp.service.IMpActivityService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityParticipantService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityRelationService;
|
||||
import com.seer.teach.mp.service.IMpAgentService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -39,7 +39,7 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
public class AdminAgentActivityRelationServiceImpl implements IAdminAgentActivityRelationService {
|
||||
|
||||
private final IMpAgentActivityParticipantService mpAgentActivityParticipantService;
|
||||
private final IMpAgentActivityRelationService mpAgentActivityParticipantService;
|
||||
|
||||
private final IMpAgentService mpAgentService;
|
||||
|
||||
|
||||
@ -52,7 +52,6 @@ public class AppAgentActivityRelationController {
|
||||
@PostMapping("/qrcode")
|
||||
@SaCheckPermission("mp:app:agent:activity:qrcode")
|
||||
public ResultBean<String> getQrCode(@RequestBody AppMpAgentActivityQrCodeQueryReq req) {
|
||||
Integer userId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(agentActivityParticipantService.getQrCode(req,userId));
|
||||
return ResultBean.success(agentActivityParticipantService.getQrCode(req));
|
||||
}
|
||||
}
|
||||
@ -31,7 +31,10 @@ public class AppParentAgentActivityController {
|
||||
@SaCheckLogin
|
||||
@Operation(summary = "家长报名参加代理商活动")
|
||||
public ResultBean<Boolean> signUpForActivity(@RequestBody @Validated AppMpSignUpActivityReq request) {
|
||||
Integer parentId = StpUtil.getLoginIdAsInt();
|
||||
Integer parentId = 0;
|
||||
if (StpUtil.isLogin()) {
|
||||
parentId = StpUtil.getLoginIdAsInt();
|
||||
}
|
||||
return ResultBean.success(appParentAgentActivityService.signUpForActivityWithInfo(request, parentId));
|
||||
}
|
||||
|
||||
@ -48,15 +51,15 @@ public class AppParentAgentActivityController {
|
||||
@Operation(summary = "取消报名参加代理商活动")
|
||||
public ResultBean<Boolean> cancelSignUp(@PathVariable("id") Integer id) {
|
||||
Integer parentId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(appParentAgentActivityService.cancelSignUp(id,parentId));
|
||||
return ResultBean.success(appParentAgentActivityService.cancelSignUp(id, parentId));
|
||||
}
|
||||
|
||||
@GetMapping("/{agentId}/{activityId}/info")
|
||||
@SaCheckLogin
|
||||
@Operation(summary = "获取家长参与代理商活动详情")
|
||||
public ResultBean<AppMpSignUpActivityResp> getRelationById(@PathVariable("agentId") Integer agentId,@PathVariable("activityId") Integer activityId) {
|
||||
public ResultBean<AppMpSignUpActivityResp> getRelationById(@PathVariable("agentId") Integer agentId, @PathVariable("activityId") Integer activityId) {
|
||||
Integer parentId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(appParentAgentActivityService.getByActivityIdAndParentId(agentId,activityId,parentId));
|
||||
return ResultBean.success(appParentAgentActivityService.getByActivityIdAndParentId(agentId, activityId, parentId));
|
||||
}
|
||||
|
||||
@PostMapping("/test-child-character")
|
||||
@ -74,4 +77,5 @@ public class AppParentAgentActivityController {
|
||||
Integer parentId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(appParentAgentActivityService.getChildCharacter(parentId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -34,7 +34,7 @@ public class AppParentAgentActivityService implements IAppParentAgentActivitySer
|
||||
|
||||
private final IMpAgentService agentService;
|
||||
|
||||
private final IMpAgentActivityParticipantService mpAgentActivityParticipantService;
|
||||
private final IMpAgentActivityRelationService mpAgentActivityParticipantService;
|
||||
|
||||
private final AiModelCallService aiModelCallService;
|
||||
|
||||
|
||||
@ -28,8 +28,7 @@ public interface IAppAgentActivityParticipantService {
|
||||
* 获取二维码
|
||||
*
|
||||
* @param req 请求参数
|
||||
* @param userId 用户Id
|
||||
* @return 二维码的url
|
||||
*/
|
||||
String getQrCode(AppMpAgentActivityQrCodeQueryReq req, Integer userId);
|
||||
String getQrCode(AppMpAgentActivityQrCodeQueryReq req);
|
||||
}
|
||||
@ -5,21 +5,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.seer.teach.common.PageListBean;
|
||||
import com.seer.teach.common.enums.ResultCodeEnum;
|
||||
import com.seer.teach.common.exception.CommonException;
|
||||
import com.seer.teach.common.utils.AssertUtils;
|
||||
import com.seer.teach.common.utils.PageConverterUtils;
|
||||
import com.seer.teach.mp.app.controller.req.AppActivityQueryReq;
|
||||
import com.seer.teach.mp.app.controller.req.MpGenerateQrCodeReq;
|
||||
import com.seer.teach.mp.app.controller.resp.AppActivityResp;
|
||||
import com.seer.teach.mp.app.controller.resp.MpQrCodeResp;
|
||||
import com.seer.teach.mp.app.convert.AppAgentActivityConvert;
|
||||
import com.seer.teach.mp.app.service.AppOfficialQrCodeService;
|
||||
import com.seer.teach.mp.app.service.IAppActivityService;
|
||||
import com.seer.teach.mp.entity.MpActivityEntity;
|
||||
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||
import com.seer.teach.mp.service.IMpActivityService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityParticipantService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityRelationService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -44,7 +38,7 @@ public class AppActivityServiceImpl implements IAppActivityService {
|
||||
|
||||
private final AppOfficialQrCodeService officialQrCodeService;
|
||||
|
||||
private final IMpAgentActivityParticipantService agentActivityParticipantService;
|
||||
private final IMpAgentActivityRelationService agentActivityParticipantService;
|
||||
|
||||
@Override
|
||||
public PageListBean<AppActivityResp> pageList(AppActivityQueryReq query, Integer agentId) {
|
||||
|
||||
@ -16,7 +16,7 @@ import com.seer.teach.mp.app.service.IAppAgentService;
|
||||
import com.seer.teach.mp.entity.MpActivityEntity;
|
||||
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||
import com.seer.teach.mp.service.IMpActivityService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityParticipantService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityRelationService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -44,7 +44,7 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
public class AppAgentActivityParticipantServiceImpl implements IAppAgentActivityParticipantService {
|
||||
|
||||
private final IMpAgentActivityParticipantService agentActivityParticipantService;
|
||||
private final IMpAgentActivityRelationService agentActivityParticipantService;
|
||||
|
||||
private final IAppAgentService appAgentService;
|
||||
|
||||
@ -80,15 +80,17 @@ public class AppAgentActivityParticipantServiceImpl implements IAppAgentActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQrCode(AppMpAgentActivityQrCodeQueryReq req, Integer userId) {
|
||||
public String getQrCode(AppMpAgentActivityQrCodeQueryReq req) {
|
||||
Integer activityId = req.getActivityId();
|
||||
Integer agentId = req.getAgentId();
|
||||
log.info("getQrCode param activityId:{},agentId:{}", activityId, agentId);
|
||||
MpActivityEntity activity = mpActivityService.getById(activityId);
|
||||
AssertUtils.notNull(activity, ResultCodeEnum.INVALID_ACTIVITY);
|
||||
if(Objects.isNull(activity)){
|
||||
return "";
|
||||
}
|
||||
|
||||
if(activity.getStatus() != 1){
|
||||
throw new CommonException(ResultCodeEnum.INVALID_ACTIVITY);
|
||||
return "";
|
||||
}
|
||||
MpAgentActivityParticipantEntity relation = agentActivityParticipantService.getParticipantsByActivityAndAgent(activityId, agentId);
|
||||
AssertUtils.notNull(relation, ResultCodeEnum.INVALID_ACTIVITY);
|
||||
|
||||
@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
public class WechatMiniProgramApiImpl implements WechatMiniProgramApi{
|
||||
public class AppMiniProgramApiImpl implements WechatMiniProgramApi{
|
||||
|
||||
private final IWechatMiniProgramService wechatMiniProgramService;
|
||||
|
||||
@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class WechatOfficialAccountApiImpl implements WechatOfficialAccountApi{
|
||||
public class AppOfficialAccountApiImpl implements WechatOfficialAccountApi{
|
||||
|
||||
@Autowired
|
||||
private MpServiceFactory mpServiceFactory;
|
||||
@ -4,6 +4,7 @@ import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties;
|
||||
import com.seer.teach.mp.factory.MpServiceFactory;
|
||||
import com.seer.teach.mp.handler.LocationHandler;
|
||||
import com.seer.teach.mp.handler.MessageReceiveHandler;
|
||||
import com.seer.teach.mp.handler.ScanHandler;
|
||||
import com.seer.teach.mp.handler.SubscribeHandler;
|
||||
import com.seer.teach.mp.handler.UnsubscribeHandler;
|
||||
import com.seer.teach.mp.service.IMpAccountService;
|
||||
@ -30,9 +31,10 @@ public class MpConfiguration {
|
||||
MessageReceiveHandler messageReceiveHandler,
|
||||
SubscribeHandler subscribeHandler,
|
||||
UnsubscribeHandler unsubscribeHandler,
|
||||
LocationHandler locationHandler) {
|
||||
LocationHandler locationHandler,
|
||||
ScanHandler scanHandler) {
|
||||
return new MpServiceFactory(redisTemplateWxRedisOps, mpAccountService,wxMpProperties,
|
||||
messageReceiveHandler, subscribeHandler, unsubscribeHandler, locationHandler);
|
||||
messageReceiveHandler, subscribeHandler, unsubscribeHandler, locationHandler, scanHandler);
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,6 +6,7 @@ import com.google.common.collect.Maps;
|
||||
import com.seer.teach.mp.entity.MpAccountEntity;
|
||||
import com.seer.teach.mp.handler.LocationHandler;
|
||||
import com.seer.teach.mp.handler.MessageReceiveHandler;
|
||||
import com.seer.teach.mp.handler.ScanHandler;
|
||||
import com.seer.teach.mp.handler.SubscribeHandler;
|
||||
import com.seer.teach.mp.handler.UnsubscribeHandler;
|
||||
import com.seer.teach.mp.service.IMpAccountService;
|
||||
@ -51,6 +52,7 @@ public class MpServiceFactory {
|
||||
private final SubscribeHandler subscribeHandler;
|
||||
private final UnsubscribeHandler unsubscribeHandler;
|
||||
private final LocationHandler locationHandler;
|
||||
private final ScanHandler scanHandler;
|
||||
|
||||
public void init() {
|
||||
List<MpAccountEntity> accounts = mpAccountService.list();
|
||||
@ -130,7 +132,7 @@ public class MpServiceFactory {
|
||||
private WxMpMessageRouter buildMpMessageRouter(WxMpService mpService) {
|
||||
WxMpMessageRouter router = new WxMpMessageRouter(mpService);
|
||||
// 记录所有事件的日志
|
||||
router.rule().handler(messageReceiveHandler).next();
|
||||
router.rule().async(true).handler(messageReceiveHandler).next();
|
||||
|
||||
// 关注事件
|
||||
router.rule().async(false).msgType(WxConsts.XmlMsgType.EVENT)
|
||||
@ -152,6 +154,10 @@ public class MpServiceFactory {
|
||||
router.rule().async(false).msgType(WxConsts.XmlMsgType.LOCATION)
|
||||
.handler(locationHandler).end();
|
||||
|
||||
// 扫码事件
|
||||
router.rule().async(false).msgType(WxConsts.XmlMsgType.EVENT)
|
||||
.event(WxConsts.EventType.SCAN).handler(scanHandler)
|
||||
.end();
|
||||
return router;
|
||||
}
|
||||
}
|
||||
@ -40,7 +40,7 @@ public class MessageReceiveHandler implements WxMpMessageHandler {
|
||||
return WxMpXmlOutMessage.TEXT()
|
||||
.toUser(wxMessage.getFromUser())
|
||||
.fromUser(wxMessage.getToUser())
|
||||
.content("点击下方菜单进入seerTeach小程序")
|
||||
.content("欢迎使用SeerTeach AI")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,68 @@
|
||||
package com.seer.teach.mp.handler;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.seer.teach.mp.entity.MpActivityEntity;
|
||||
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||
import com.seer.teach.mp.service.IMpActivityService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityRelationService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.session.WxSessionManager;
|
||||
import me.chanjar.weixin.mp.api.WxMpMessageHandler;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
|
||||
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
|
||||
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutNewsMessage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 用户扫码处理(已关注后的处理)
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ScanHandler implements WxMpMessageHandler {
|
||||
|
||||
@Autowired
|
||||
private IMpAgentActivityRelationService mpAgentActivityRelationService;
|
||||
|
||||
@Autowired
|
||||
private IMpActivityService mpActivityService;
|
||||
|
||||
@Override
|
||||
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, WxMpService wxMpService, WxSessionManager sessionManager) throws WxErrorException {
|
||||
log.info("[handle][扫码处理,内容:{}]", wxMessage);
|
||||
String eventKey = wxMessage.getEventKey();
|
||||
log.info("[handle][用户({})] 获取用户二维码信息:[{}]", wxMessage.getFromUser(), eventKey);
|
||||
if(StringUtils.hasText(eventKey) && eventKey.startsWith("agentId") && eventKey.contains("activityId")){
|
||||
Map<String, String> paramMap = HttpUtil.decodeParamMap(eventKey, StandardCharsets.UTF_8);
|
||||
Integer agentId = MapUtil.getInt(paramMap,"agentId",0);
|
||||
Integer activityId = MapUtil.getInt(paramMap,"activityId",0);
|
||||
if(agentId > 0 && activityId > 0){
|
||||
MpAgentActivityParticipantEntity participantsByActivityAndAgent = mpAgentActivityRelationService.getParticipantsByActivityAndAgent(activityId, agentId);
|
||||
MpActivityEntity activity = mpActivityService.getById(activityId);
|
||||
if(Objects.nonNull(participantsByActivityAndAgent)){
|
||||
WxMpXmlOutNewsMessage.Item item = new WxMpXmlOutNewsMessage.Item();
|
||||
item.setTitle(activity.getActivityName());
|
||||
item.setDescription(activity.getDescription());
|
||||
item.setPicUrl(participantsByActivityAndAgent.getQrCodeUrl());
|
||||
item.setUrl("https://mp.seerteach.net/login?" + eventKey);
|
||||
WxMpXmlOutNewsMessage build = WxMpXmlOutMessage.NEWS()
|
||||
.addArticle(item)
|
||||
.toUser(wxMessage.getFromUser())
|
||||
.fromUser(wxMessage.getToUser())
|
||||
.build();
|
||||
log.info("[handle][扫码处理,内容:{}]", build);
|
||||
return build;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -13,7 +13,7 @@ import java.util.List;
|
||||
* @author Lingma
|
||||
* @since 2025-12-29
|
||||
*/
|
||||
public interface IMpAgentActivityParticipantService extends IService<MpAgentActivityParticipantEntity> {
|
||||
public interface IMpAgentActivityRelationService extends IService<MpAgentActivityParticipantEntity> {
|
||||
|
||||
/**
|
||||
* 根据活动ID和代理商ID获取参与记录
|
||||
@ -10,7 +10,7 @@ import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||
import com.seer.teach.mp.mapper.MpAgentActivityMapper;
|
||||
import com.seer.teach.mp.service.IMpActivityService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityLogService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityParticipantService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityRelationService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -31,7 +31,7 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
public class MpActivityServiceImpl extends ServiceImpl<MpAgentActivityMapper, MpActivityEntity> implements IMpActivityService {
|
||||
|
||||
private final IMpAgentActivityParticipantService agentActivityParticipantService;
|
||||
private final IMpAgentActivityRelationService agentActivityParticipantService;
|
||||
private final IMpAgentActivityLogService agentActivityLogService;
|
||||
|
||||
@Override
|
||||
|
||||
@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||
import com.seer.teach.mp.mapper.MpAgentActivityParticipantMapper;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityLogService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityParticipantService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityRelationService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -23,7 +23,7 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class MpAgentActivityParticipantServiceImpl extends ServiceImpl<MpAgentActivityParticipantMapper, MpAgentActivityParticipantEntity> implements IMpAgentActivityParticipantService {
|
||||
public class MpAgentActivityRelationServiceImpl extends ServiceImpl<MpAgentActivityParticipantMapper, MpAgentActivityParticipantEntity> implements IMpAgentActivityRelationService {
|
||||
|
||||
private final IMpAgentActivityLogService agentActivityLogService;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user