增加服务号的扫描后自动回复消息的功能
This commit is contained in:
parent
3477ca2eaf
commit
a09c3224ed
@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
@FeignClient(name = ApiConstants.SERVER_NAME, contextId = "wechatMiniProgramApi", path = "/seer/mp")
|
@FeignClient(name = ApiConstants.SERVER_NAME, contextId = "wechatMiniProgramApi", path = "/seer/mp")
|
||||||
public interface WechatMiniProgramApi {
|
public interface MpMiniProgramApi {
|
||||||
|
|
||||||
@GetMapping("/wechat/sns/jscode2session")
|
@GetMapping("/wechat/sns/jscode2session")
|
||||||
WxMiniProgramSessionDTO code2Session(@RequestParam("code") String code);
|
WxMiniProgramSessionDTO code2Session(@RequestParam("code") String code);
|
||||||
@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
@FeignClient(name = ApiConstants.SERVER_NAME, contextId = "wechatOfficialAccountApi", path = "/seer/mp")
|
@FeignClient(name = ApiConstants.SERVER_NAME, contextId = "wechatOfficialAccountApi", path = "/seer/mp")
|
||||||
public interface WechatOfficialAccountApi {
|
public interface MpOfficialAccountApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户用户信息和授权 Token
|
* 获取用户用户信息和授权 Token
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
package com.seer.teach.mp.admin.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import com.seer.teach.common.PageListBean;
|
||||||
|
import com.seer.teach.common.ResultBean;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.MpAccountPageReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.MpAccountReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.resp.AdminMpAccountResp;
|
||||||
|
import com.seer.teach.mp.admin.service.AdminMpAccountMenuService;
|
||||||
|
import com.seer.teach.mp.admin.service.AdminMpAccountService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 公众号菜单表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Wang
|
||||||
|
* @since 2025-08-02 15:45:13
|
||||||
|
*/
|
||||||
|
@Tag(name = "管理端 - 公众号菜单")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mp/account")
|
||||||
|
public class AdminMpAccountMenuController {
|
||||||
|
|
||||||
|
private final AdminMpAccountMenuService adminMpAccountMenuService;
|
||||||
|
|
||||||
|
@PostMapping("/create/menu")
|
||||||
|
@Operation(summary = "创建公众号菜单")
|
||||||
|
@SaCheckPermission("admin:mp:account:menu:create")
|
||||||
|
public ResultBean<Boolean> createAccountMenu(@Valid @RequestBody MpAccountReq createReqVO) {
|
||||||
|
return ResultBean.success(adminMpAccountMenuService.createAccount(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新公众号菜单")
|
||||||
|
@SaCheckPermission("admin:mp:account:menu:update")
|
||||||
|
public ResultBean<Boolean> updateAccountMenu(@Valid @RequestBody MpAccountReq updateReqVO) {
|
||||||
|
return ResultBean.success(adminMpAccountMenuService.updateAccount(updateReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除公众号菜单")
|
||||||
|
@SaCheckPermission("admin:mp:account:menu:delete")
|
||||||
|
public ResultBean<Boolean> deleteAccountMenu(@RequestParam("id") Integer id) {
|
||||||
|
return ResultBean.success(adminMpAccountMenuService.deleteAccount(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/detail")
|
||||||
|
@Operation(summary = "获得公众号菜单")
|
||||||
|
@SaCheckPermission("admin:mp:account:menu:query")
|
||||||
|
public ResultBean<AdminMpAccountResp> getAccountMenu(@RequestParam("id") Integer id) {
|
||||||
|
return ResultBean.success(adminMpAccountMenuService.getAccount(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获取公众号菜单信息列表")
|
||||||
|
@SaCheckPermission("admin:mp:account:menu:list")
|
||||||
|
public ResultBean<List<AdminMpAccountResp>> getAccountMenuList() {
|
||||||
|
return ResultBean.success(adminMpAccountMenuService.getAccountList());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,6 +11,6 @@ public class MpActivityQueryReq extends PageRequest {
|
|||||||
@Schema(description = "活动名称")
|
@Schema(description = "活动名称")
|
||||||
private String activityName;
|
private String activityName;
|
||||||
|
|
||||||
@Schema(description = "活动状态:0-禁用,1-启用")
|
@Schema(description = "活动状态:-1-未开始,1-进行中,2-已结束")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
}
|
}
|
||||||
@ -0,0 +1,161 @@
|
|||||||
|
|
||||||
|
package com.seer.teach.mp.admin.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.seer.teach.common.PageListBean;
|
||||||
|
import com.seer.teach.common.utils.PageConverterUtils;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.MpAccountPageReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.MpAccountReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.resp.AdminMpAccountResp;
|
||||||
|
import com.seer.teach.mp.admin.convert.AdminMpAccountConvert;
|
||||||
|
import com.seer.teach.mp.api.MpOfficialAccountApi;
|
||||||
|
import com.seer.teach.mp.entity.MpAccountEntity;
|
||||||
|
import com.seer.teach.mp.factory.MpServiceFactory;
|
||||||
|
import com.seer.teach.mp.service.IMpAccountService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import me.chanjar.weixin.common.error.WxErrorException;
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
|
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
@Validated
|
||||||
|
@Service
|
||||||
|
public class AdminMpAccountMenuService {
|
||||||
|
|
||||||
|
private final IMpAccountService mpAccountService;
|
||||||
|
|
||||||
|
private final MpOfficialAccountApi mpOfficialAccountApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private MpServiceFactory mpServiceFactory;
|
||||||
|
|
||||||
|
public void loadCache() {
|
||||||
|
mpServiceFactory.init();
|
||||||
|
mpOfficialAccountApi.initMpAccountCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建公众号账号
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 公众号账号ID
|
||||||
|
*/
|
||||||
|
public boolean createAccount(@Valid MpAccountReq createReqVO) {
|
||||||
|
MpAccountEntity mpAccount = AdminMpAccountConvert.INSTANCE.convertOne(createReqVO);
|
||||||
|
boolean result = mpAccountService.save(mpAccount);
|
||||||
|
log.info("[createAccount][创建公众号账号成功,结果为:{}]", result);
|
||||||
|
loadCache();
|
||||||
|
log.info("[createAccount][刷新公众号緩存成功]");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新公众号账号
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
* @return 是否更新成功
|
||||||
|
*/
|
||||||
|
public Boolean updateAccount(@Valid MpAccountReq updateReqVO) {
|
||||||
|
MpAccountEntity mpAccount = AdminMpAccountConvert.INSTANCE.convertOne(updateReqVO);
|
||||||
|
boolean updated = mpAccountService.updateById(mpAccount);
|
||||||
|
log.info("[updateAccount][更新公众号账号成功,结果为:{}]", updated);
|
||||||
|
loadCache();
|
||||||
|
log.info("[updateAccount][刷新公众号緩存成功]");
|
||||||
|
return updated;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除公众号账号
|
||||||
|
*
|
||||||
|
* @param id 公众号账号ID
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
public Boolean deleteAccount(Integer id) {
|
||||||
|
boolean removed = mpAccountService.removeById(id);
|
||||||
|
log.info("[deleteAccount][删除公众号账号成功,结果为:{}]", removed);
|
||||||
|
loadCache();
|
||||||
|
log.info("[deleteAccount][刷新公众号緩存成功]");
|
||||||
|
return removed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取公众号账号详情
|
||||||
|
*
|
||||||
|
* @param id 公众号账号ID
|
||||||
|
* @return 公众号账号信息
|
||||||
|
*/
|
||||||
|
public AdminMpAccountResp getAccount(Integer id) {
|
||||||
|
MpAccountEntity mpAccount = mpAccountService.getById(id);
|
||||||
|
return AdminMpAccountConvert.INSTANCE.convertOne(mpAccount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页获取公众号账号列表
|
||||||
|
*
|
||||||
|
* @param pageReq 分页查询条件
|
||||||
|
* @return 公众号账号分页结果
|
||||||
|
*/
|
||||||
|
public PageListBean<AdminMpAccountResp> getAccountPage(MpAccountPageReq pageReq) {
|
||||||
|
Page<MpAccountEntity> pageParm = new Page<>(pageReq.getPageNo(), pageReq.getPageSize());
|
||||||
|
LambdaQueryWrapper<MpAccountEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotBlank(pageReq.getAppId())) {
|
||||||
|
wrapper.like(MpAccountEntity::getAppId, pageReq.getAppId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(pageReq.getName())) {
|
||||||
|
wrapper.like(MpAccountEntity::getName, pageReq.getName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(pageReq.getAccount())) {
|
||||||
|
wrapper.like(MpAccountEntity::getAccount, pageReq.getAccount());
|
||||||
|
}
|
||||||
|
IPage<MpAccountEntity> resultPage = mpAccountService.page(pageParm, wrapper);
|
||||||
|
|
||||||
|
return PageConverterUtils.convertPageListBean(resultPage, AdminMpAccountConvert.INSTANCE::convertRespList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有公众号账号列表
|
||||||
|
*
|
||||||
|
* @return 公众号账号列表
|
||||||
|
*/
|
||||||
|
public List<AdminMpAccountResp> getAccountList() {
|
||||||
|
List<MpAccountEntity> accountList = mpAccountService.list();
|
||||||
|
return AdminMpAccountConvert.INSTANCE.convertRespList(accountList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成公众号二维码
|
||||||
|
*
|
||||||
|
* @param id 公众号账号ID
|
||||||
|
* @return 是否生成成功
|
||||||
|
*/
|
||||||
|
public Boolean generateAccountQrCode(Integer id,String sceneStr) {
|
||||||
|
MpAccountEntity account = mpAccountService.getById(id);
|
||||||
|
WxMpService mpService = mpServiceFactory.getRequiredMpService(account.getAppId());
|
||||||
|
String qrCodeUrl;
|
||||||
|
try {
|
||||||
|
WxMpQrCodeTicket qrCodeTicket = mpService.getQrcodeService().qrCodeCreateLastTicket(sceneStr);
|
||||||
|
qrCodeUrl = mpService.getQrcodeService().qrCodePictureUrl(qrCodeTicket.getTicket());
|
||||||
|
} catch (WxErrorException e) {
|
||||||
|
log.error("生成公众号二维码失败", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
MpAccountEntity updateAccount = new MpAccountEntity();
|
||||||
|
updateAccount.setId(id);
|
||||||
|
updateAccount.setQrCodeUrl(qrCodeUrl);
|
||||||
|
|
||||||
|
return mpAccountService.updateById(updateAccount);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.seer.teach.common.PageListBean;
|
import com.seer.teach.common.PageListBean;
|
||||||
import com.seer.teach.common.utils.PageConverterUtils;
|
import com.seer.teach.common.utils.PageConverterUtils;
|
||||||
import com.seer.teach.mp.api.WechatOfficialAccountApi;
|
import com.seer.teach.mp.api.MpOfficialAccountApi;
|
||||||
import com.seer.teach.mp.admin.controller.req.MpAccountPageReq;
|
import com.seer.teach.mp.admin.controller.req.MpAccountPageReq;
|
||||||
import com.seer.teach.mp.admin.controller.req.MpAccountReq;
|
import com.seer.teach.mp.admin.controller.req.MpAccountReq;
|
||||||
import com.seer.teach.mp.admin.controller.resp.AdminMpAccountResp;
|
import com.seer.teach.mp.admin.controller.resp.AdminMpAccountResp;
|
||||||
@ -36,7 +36,7 @@ public class AdminMpAccountService {
|
|||||||
|
|
||||||
private final IMpAccountService mpAccountService;
|
private final IMpAccountService mpAccountService;
|
||||||
|
|
||||||
private final WechatOfficialAccountApi wechatOfficialAccountApi;
|
private final MpOfficialAccountApi mpOfficialAccountApi;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy
|
@Lazy
|
||||||
@ -44,7 +44,7 @@ public class AdminMpAccountService {
|
|||||||
|
|
||||||
public void loadCache() {
|
public void loadCache() {
|
||||||
mpServiceFactory.init();
|
mpServiceFactory.init();
|
||||||
wechatOfficialAccountApi.initMpAccountCache();
|
mpOfficialAccountApi.initMpAccountCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import com.seer.teach.common.annotation.EncryptionAnnotation;
|
|||||||
import com.seer.teach.common.annotation.LogPrint;
|
import com.seer.teach.common.annotation.LogPrint;
|
||||||
import com.seer.teach.mp.app.controller.req.AppMpAgentActivityQrCodeQueryReq;
|
import com.seer.teach.mp.app.controller.req.AppMpAgentActivityQrCodeQueryReq;
|
||||||
import com.seer.teach.mp.app.controller.resp.AgentActivityParticipantResp;
|
import com.seer.teach.mp.app.controller.resp.AgentActivityParticipantResp;
|
||||||
import com.seer.teach.mp.app.service.IAppAgentActivityParticipantService;
|
import com.seer.teach.mp.app.service.IAppAgentActivityRelationService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -38,7 +38,7 @@ import java.util.List;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AppAgentActivityRelationController {
|
public class AppAgentActivityRelationController {
|
||||||
|
|
||||||
private final IAppAgentActivityParticipantService agentActivityParticipantService;
|
private final IAppAgentActivityRelationService agentActivityParticipantService;
|
||||||
|
|
||||||
@Operation(summary = "获取代理商参加的活动列表")
|
@Operation(summary = "获取代理商参加的活动列表")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
|
|||||||
@ -11,6 +11,6 @@ public class AppActivityQueryReq extends PageRequest {
|
|||||||
@Schema(description = "活动名称")
|
@Schema(description = "活动名称")
|
||||||
private String activityName;
|
private String activityName;
|
||||||
|
|
||||||
@Schema(description = "活动状态:0-禁用,1-启用")
|
@Schema(description = "活动状态:-1-未开始,1-进行中,2-已结束")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
}
|
}
|
||||||
@ -3,6 +3,8 @@ package com.seer.teach.mp.app.controller.resp;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Schema(name = "AgentActivityParticipant", description = "代理商活动参与记录")
|
@Schema(name = "AgentActivityParticipant", description = "代理商活动参与记录")
|
||||||
@Data
|
@Data
|
||||||
public class AgentActivityParticipantResp {
|
public class AgentActivityParticipantResp {
|
||||||
@ -15,7 +17,19 @@ public class AgentActivityParticipantResp {
|
|||||||
@Schema(description = "代理商ID")
|
@Schema(description = "代理商ID")
|
||||||
private Integer agentId;
|
private Integer agentId;
|
||||||
|
|
||||||
|
@Schema(description = "活动名称")
|
||||||
private String activityName;
|
private String activityName;
|
||||||
|
|
||||||
|
@Schema(description = "活动描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "活动开始时间")
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
@Schema(description = "活动结束时间")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
@Schema(description = "活动状态:-1-未开始,1-进行中,2-已结束")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -23,7 +23,7 @@ public class AppActivityResp {
|
|||||||
@Schema(description = "活动结束时间")
|
@Schema(description = "活动结束时间")
|
||||||
private LocalDateTime endTime;
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
@Schema(description = "活动状态:0-禁用,1-启用")
|
@Schema(description = "活动状态:-1-未开始,1-进行中,2-已结束")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
* @author Lingma
|
* @author Lingma
|
||||||
* @since 2025-12-30
|
* @since 2025-12-30
|
||||||
*/
|
*/
|
||||||
public interface IAppAgentActivityParticipantService {
|
public interface IAppAgentActivityRelationService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据活动ID和代理商ID获取参与记录
|
* 根据活动ID和代理商ID获取参与记录
|
||||||
@ -11,7 +11,7 @@ import com.seer.teach.mp.app.controller.req.MpGenerateQrCodeReq;
|
|||||||
import com.seer.teach.mp.app.controller.resp.AgentActivityParticipantResp;
|
import com.seer.teach.mp.app.controller.resp.AgentActivityParticipantResp;
|
||||||
import com.seer.teach.mp.app.controller.resp.MpQrCodeResp;
|
import com.seer.teach.mp.app.controller.resp.MpQrCodeResp;
|
||||||
import com.seer.teach.mp.app.service.AppOfficialQrCodeService;
|
import com.seer.teach.mp.app.service.AppOfficialQrCodeService;
|
||||||
import com.seer.teach.mp.app.service.IAppAgentActivityParticipantService;
|
import com.seer.teach.mp.app.service.IAppAgentActivityRelationService;
|
||||||
import com.seer.teach.mp.app.service.IAppAgentService;
|
import com.seer.teach.mp.app.service.IAppAgentService;
|
||||||
import com.seer.teach.mp.entity.MpActivityEntity;
|
import com.seer.teach.mp.entity.MpActivityEntity;
|
||||||
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||||
@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -42,9 +43,9 @@ import java.util.stream.Collectors;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AppAgentActivityParticipantServiceImpl implements IAppAgentActivityParticipantService {
|
public class AppAgentActivityRelationServiceImpl implements IAppAgentActivityRelationService {
|
||||||
|
|
||||||
private final IMpAgentActivityRelationService agentActivityParticipantService;
|
private final IMpAgentActivityRelationService agentActivityRelationService;
|
||||||
|
|
||||||
private final IAppAgentService appAgentService;
|
private final IAppAgentService appAgentService;
|
||||||
|
|
||||||
@ -63,14 +64,14 @@ public class AppAgentActivityParticipantServiceImpl implements IAppAgentActivity
|
|||||||
if(!userAgentIds.contains(agentId) ){
|
if(!userAgentIds.contains(agentId) ){
|
||||||
throw new CommonException(ResultCodeEnum.RELATION_NOT_FOUND);
|
throw new CommonException(ResultCodeEnum.RELATION_NOT_FOUND);
|
||||||
}
|
}
|
||||||
var participants = agentActivityParticipantService.getListByAgentId(agentId);
|
var participants = agentActivityRelationService.getListByAgentId(agentId);
|
||||||
|
|
||||||
if (CollectionUtil.isEmpty(participants)) {
|
if (CollectionUtil.isEmpty(participants)) {
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
Set<Integer> activityIds = participants.stream().map(MpAgentActivityParticipantEntity::getActivityId).collect(Collectors.toSet());
|
Set<Integer> activityIds = participants.stream().map(MpAgentActivityParticipantEntity::getActivityId).collect(Collectors.toSet());
|
||||||
|
|
||||||
List<MpActivityEntity> parentInfos = mpActivityService.listByIds(activityIds);
|
List<MpActivityEntity> parentInfos = mpActivityService.getEffectiveActivityListByIds(activityIds);
|
||||||
|
|
||||||
var activityInfoMap = parentInfos.stream().collect(Collectors.toMap(MpActivityEntity::getId, activity -> activity));
|
var activityInfoMap = parentInfos.stream().collect(Collectors.toMap(MpActivityEntity::getId, activity -> activity));
|
||||||
|
|
||||||
@ -89,10 +90,13 @@ public class AppAgentActivityParticipantServiceImpl implements IAppAgentActivity
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(activity.getStatus() != 1){
|
// 检查活动是否在有效时间内且处于启用状态
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
boolean isWithinTimeRange = !now.isBefore(activity.getStartTime()) && !now.isAfter(activity.getEndTime());
|
||||||
|
if(activity.getStatus() != 1 || !isWithinTimeRange){
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
MpAgentActivityParticipantEntity relation = agentActivityParticipantService.getParticipantsByActivityAndAgent(activityId, agentId);
|
MpAgentActivityParticipantEntity relation = agentActivityRelationService.getParticipantsByActivityAndAgent(activityId, agentId);
|
||||||
AssertUtils.notNull(relation, ResultCodeEnum.INVALID_ACTIVITY);
|
AssertUtils.notNull(relation, ResultCodeEnum.INVALID_ACTIVITY);
|
||||||
if(StringUtils.isNotBlank(relation.getQrCodeUrl())){
|
if(StringUtils.isNotBlank(relation.getQrCodeUrl())){
|
||||||
return relation.getQrCodeUrl();
|
return relation.getQrCodeUrl();
|
||||||
@ -113,7 +117,7 @@ public class AppAgentActivityParticipantServiceImpl implements IAppAgentActivity
|
|||||||
relation.setQrCodeUrl(mpQrCodeResp.getQrCodeUrl());
|
relation.setQrCodeUrl(mpQrCodeResp.getQrCodeUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
agentActivityParticipantService.updateById(relation);
|
agentActivityRelationService.updateById(relation);
|
||||||
return mpQrCodeResp.getQrCodeUrl();
|
return mpQrCodeResp.getQrCodeUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,6 +130,19 @@ public class AppAgentActivityParticipantServiceImpl implements IAppAgentActivity
|
|||||||
MpActivityEntity activity = activityInfoMap.get(entity.getActivityId());
|
MpActivityEntity activity = activityInfoMap.get(entity.getActivityId());
|
||||||
if(Objects.nonNull(activity)){
|
if(Objects.nonNull(activity)){
|
||||||
resp.setActivityName(activity.getActivityName());
|
resp.setActivityName(activity.getActivityName());
|
||||||
|
resp.setDescription(activity.getDescription());
|
||||||
|
resp.setStartTime(activity.getStartTime());
|
||||||
|
resp.setEndTime(activity.getEndTime());
|
||||||
|
|
||||||
|
// 根据当前时间判断活动状态
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
if (now.isBefore(activity.getStartTime())) {
|
||||||
|
resp.setStatus(1); // 未开始
|
||||||
|
} else if (now.isAfter(activity.getEndTime())) {
|
||||||
|
resp.setStatus(3); // 已结束
|
||||||
|
} else {
|
||||||
|
resp.setStatus(1); // 进行中
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RestController
|
@RestController
|
||||||
public class AppMiniProgramApiImpl implements WechatMiniProgramApi{
|
public class AppMiniProgramApiImpl implements MpMiniProgramApi {
|
||||||
|
|
||||||
private final IWechatMiniProgramService wechatMiniProgramService;
|
private final IWechatMiniProgramService wechatMiniProgramService;
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
public class AppOfficialAccountApiImpl implements WechatOfficialAccountApi{
|
public class AppOfficialAccountApiImpl implements MpOfficialAccountApi {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MpServiceFactory mpServiceFactory;
|
private MpServiceFactory mpServiceFactory;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.seer.teach.mp.service;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.seer.teach.mp.entity.MpActivityEntity;
|
import com.seer.teach.mp.entity.MpActivityEntity;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,8 +34,10 @@ public interface IMpActivityService extends IService<MpActivityEntity> {
|
|||||||
boolean deleteActivity(Integer id);
|
boolean deleteActivity(Integer id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取代理商活动名称列表
|
* 根据ID查询代理商活动
|
||||||
* @return 代理商活动名称列表
|
*
|
||||||
|
* @param ids 活动ID
|
||||||
|
* @return 活动实体
|
||||||
*/
|
*/
|
||||||
List<String> getActivityName();
|
List<MpActivityEntity> getEffectiveActivityListByIds(Collection<Integer> ids);
|
||||||
}
|
}
|
||||||
@ -1,10 +1,13 @@
|
|||||||
package com.seer.teach.mp.service.impl;
|
package com.seer.teach.mp.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.seer.teach.common.constants.CommonConstant;
|
||||||
import com.seer.teach.common.enums.ResultCodeEnum;
|
import com.seer.teach.common.enums.ResultCodeEnum;
|
||||||
import com.seer.teach.common.utils.AssertUtils;
|
import com.seer.teach.common.utils.AssertUtils;
|
||||||
|
import com.seer.teach.common.utils.CommonUtils;
|
||||||
import com.seer.teach.mp.entity.MpActivityEntity;
|
import com.seer.teach.mp.entity.MpActivityEntity;
|
||||||
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||||
import com.seer.teach.mp.mapper.MpAgentActivityMapper;
|
import com.seer.teach.mp.mapper.MpAgentActivityMapper;
|
||||||
@ -16,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,14 +110,16 @@ public class MpActivityServiceImpl extends ServiceImpl<MpAgentActivityMapper, Mp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getActivityName() {
|
public List<MpActivityEntity> getEffectiveActivityListByIds(Collection<Integer> ids) {
|
||||||
return this.list().stream()
|
if(CollectionUtil.isEmpty(ids)){
|
||||||
.map(MpActivityEntity::getActivityName).toList();
|
return List.of();
|
||||||
}
|
}
|
||||||
|
return super.list(new LambdaQueryWrapper<MpActivityEntity>().in(MpActivityEntity::getId, ids).in(MpActivityEntity::getStatus, CommonConstant.ENABLE));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean saveOrUpdate(MpActivityEntity entity) {
|
public boolean saveOrUpdate(MpActivityEntity entity) {
|
||||||
boolean result = super.saveOrUpdate(entity);
|
return super.saveOrUpdate(entity);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,7 +8,7 @@ import com.seer.teach.common.enums.RoleEnum;
|
|||||||
import com.seer.teach.common.enums.UserRelationEnum;
|
import com.seer.teach.common.enums.UserRelationEnum;
|
||||||
import com.seer.teach.common.exception.CommonException;
|
import com.seer.teach.common.exception.CommonException;
|
||||||
import com.seer.teach.common.utils.AssertUtils;
|
import com.seer.teach.common.utils.AssertUtils;
|
||||||
import com.seer.teach.mp.api.WechatMiniProgramApi;
|
import com.seer.teach.mp.api.MpMiniProgramApi;
|
||||||
import com.seer.teach.mp.api.resp.WxMiniProgramSessionDTO;
|
import com.seer.teach.mp.api.resp.WxMiniProgramSessionDTO;
|
||||||
import com.seer.teach.user.app.auth.LoginType;
|
import com.seer.teach.user.app.auth.LoginType;
|
||||||
import com.seer.teach.user.app.auth.request.LoginParam;
|
import com.seer.teach.user.app.auth.request.LoginParam;
|
||||||
@ -45,7 +45,7 @@ import java.util.Objects;
|
|||||||
public class MiniProgramLoginStrategy extends AbstractLoginStrategy implements LoginStrategy {
|
public class MiniProgramLoginStrategy extends AbstractLoginStrategy implements LoginStrategy {
|
||||||
|
|
||||||
|
|
||||||
private final WechatMiniProgramApi wechatMiniProgramApi;
|
private final MpMiniProgramApi mpMiniProgramApi;
|
||||||
|
|
||||||
private final IUserService userService;
|
private final IUserService userService;
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ public class MiniProgramLoginStrategy extends AbstractLoginStrategy implements L
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoginUser authenticate(LoginParam request) {
|
public LoginUser authenticate(LoginParam request) {
|
||||||
WxMiniProgramSessionDTO wxMiniProgramSessionDTO = wechatMiniProgramApi.code2Session(request.getJsCode());
|
WxMiniProgramSessionDTO wxMiniProgramSessionDTO = mpMiniProgramApi.code2Session(request.getJsCode());
|
||||||
AssertUtils.isTrue(wxMiniProgramSessionDTO.isSuccess(), ResultCodeEnum.WX_OAUTH_USED_ERROR);
|
AssertUtils.isTrue(wxMiniProgramSessionDTO.isSuccess(), ResultCodeEnum.WX_OAUTH_USED_ERROR);
|
||||||
UserAuthEntity userAuth = userAuthService.getOneByOpenIdAndUnionId(wxMiniProgramSessionDTO.getOpenid(), wxMiniProgramSessionDTO.getUnionid());
|
UserAuthEntity userAuth = userAuthService.getOneByOpenIdAndUnionId(wxMiniProgramSessionDTO.getOpenid(), wxMiniProgramSessionDTO.getUnionid());
|
||||||
boolean isExistsChildren = false;
|
boolean isExistsChildren = false;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package com.seer.teach.user.app.auth.service.strategy;
|
|||||||
|
|
||||||
import com.seer.teach.common.enums.ResultCodeEnum;
|
import com.seer.teach.common.enums.ResultCodeEnum;
|
||||||
import com.seer.teach.common.utils.AssertUtils;
|
import com.seer.teach.common.utils.AssertUtils;
|
||||||
import com.seer.teach.mp.api.WechatOfficialAccountApi;
|
import com.seer.teach.mp.api.MpOfficialAccountApi;
|
||||||
import com.seer.teach.mp.api.resp.WxOAuth2AccessTokenDTO;
|
import com.seer.teach.mp.api.resp.WxOAuth2AccessTokenDTO;
|
||||||
import com.seer.teach.user.app.auth.LoginType;
|
import com.seer.teach.user.app.auth.LoginType;
|
||||||
import com.seer.teach.user.app.auth.request.LoginParam;
|
import com.seer.teach.user.app.auth.request.LoginParam;
|
||||||
@ -26,7 +26,7 @@ import java.util.Objects;
|
|||||||
public class OfficialAccountLoginStrategy extends AbstractLoginStrategy implements LoginStrategy {
|
public class OfficialAccountLoginStrategy extends AbstractLoginStrategy implements LoginStrategy {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WechatOfficialAccountApi wechatOfficialAccountApi;
|
private MpOfficialAccountApi mpOfficialAccountApi;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IUserService userService;
|
private IUserService userService;
|
||||||
@ -42,7 +42,7 @@ public class OfficialAccountLoginStrategy extends AbstractLoginStrategy implemen
|
|||||||
@Override
|
@Override
|
||||||
public LoginUser authenticate(LoginParam request) {
|
public LoginUser authenticate(LoginParam request) {
|
||||||
log.info("微信公众号登录:{}",request);
|
log.info("微信公众号登录:{}",request);
|
||||||
WxOAuth2AccessTokenDTO wxOAuth2AccessToken = wechatOfficialAccountApi.getUserWxOAuth2AccessToken(request.getAppId(), request.getJsCode());
|
WxOAuth2AccessTokenDTO wxOAuth2AccessToken = mpOfficialAccountApi.getUserWxOAuth2AccessToken(request.getAppId(), request.getJsCode());
|
||||||
log.debug("获取用户信息:{}",wxOAuth2AccessToken);
|
log.debug("获取用户信息:{}",wxOAuth2AccessToken);
|
||||||
AssertUtils.notNull(wxOAuth2AccessToken, ResultCodeEnum.WX_OAUTH_USED_ERROR);
|
AssertUtils.notNull(wxOAuth2AccessToken, ResultCodeEnum.WX_OAUTH_USED_ERROR);
|
||||||
String userOpenId = wxOAuth2AccessToken.getOpenId();
|
String userOpenId = wxOAuth2AccessToken.getOpenId();
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import com.seer.teach.common.enums.ResultCodeEnum;
|
|||||||
import com.seer.teach.common.exception.CommonException;
|
import com.seer.teach.common.exception.CommonException;
|
||||||
import com.seer.teach.common.utils.AssertUtils;
|
import com.seer.teach.common.utils.AssertUtils;
|
||||||
import com.seer.teach.common.utils.CommonUtils;
|
import com.seer.teach.common.utils.CommonUtils;
|
||||||
import com.seer.teach.mp.api.WechatOfficialAccountApi;
|
import com.seer.teach.mp.api.MpOfficialAccountApi;
|
||||||
import com.seer.teach.mp.api.resp.WxOAuth2AccessTokenDTO;
|
import com.seer.teach.mp.api.resp.WxOAuth2AccessTokenDTO;
|
||||||
import com.seer.teach.user.app.auth.LoginType;
|
import com.seer.teach.user.app.auth.LoginType;
|
||||||
import com.seer.teach.user.app.auth.request.LoginParam;
|
import com.seer.teach.user.app.auth.request.LoginParam;
|
||||||
@ -33,7 +33,7 @@ public class OfficialOauthWithAccountLoginStrategy extends AbstractLoginStrategy
|
|||||||
private final IUserService userService;
|
private final IUserService userService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WechatOfficialAccountApi wechatOfficialAccountApi;
|
private MpOfficialAccountApi mpOfficialAccountApi;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoginType getType() {
|
public LoginType getType() {
|
||||||
@ -54,7 +54,7 @@ public class OfficialOauthWithAccountLoginStrategy extends AbstractLoginStrategy
|
|||||||
AssertUtils.notNull(accountUser, ResultCodeEnum.USERNAME_OR_PASSWORD_IS_ERROR);
|
AssertUtils.notNull(accountUser, ResultCodeEnum.USERNAME_OR_PASSWORD_IS_ERROR);
|
||||||
String password = CommonUtils.encryptPassword(request.getPassword());
|
String password = CommonUtils.encryptPassword(request.getPassword());
|
||||||
if (password.equals(accountUser.getPassword())) {
|
if (password.equals(accountUser.getPassword())) {
|
||||||
WxOAuth2AccessTokenDTO wxOAuth2AccessToken = wechatOfficialAccountApi.getUserWxOAuth2AccessToken(request.getAppId(), request.getJsCode());
|
WxOAuth2AccessTokenDTO wxOAuth2AccessToken = mpOfficialAccountApi.getUserWxOAuth2AccessToken(request.getAppId(), request.getJsCode());
|
||||||
log.debug("获取用户信息:{}",wxOAuth2AccessToken);
|
log.debug("获取用户信息:{}",wxOAuth2AccessToken);
|
||||||
AssertUtils.notNull(wxOAuth2AccessToken, ResultCodeEnum.WX_OAUTH_USED_ERROR);
|
AssertUtils.notNull(wxOAuth2AccessToken, ResultCodeEnum.WX_OAUTH_USED_ERROR);
|
||||||
String userOpenId = wxOAuth2AccessToken.getOpenId();
|
String userOpenId = wxOAuth2AccessToken.getOpenId();
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import com.seer.teach.common.enums.RoleEnum;
|
|||||||
import com.seer.teach.common.exception.CommonException;
|
import com.seer.teach.common.exception.CommonException;
|
||||||
import com.seer.teach.common.utils.AssertUtils;
|
import com.seer.teach.common.utils.AssertUtils;
|
||||||
import com.seer.teach.common.utils.CommonUtils;
|
import com.seer.teach.common.utils.CommonUtils;
|
||||||
import com.seer.teach.mp.api.WechatOfficialAccountApi;
|
import com.seer.teach.mp.api.MpOfficialAccountApi;
|
||||||
import com.seer.teach.mp.api.resp.WxOAuth2AccessTokenDTO;
|
import com.seer.teach.mp.api.resp.WxOAuth2AccessTokenDTO;
|
||||||
import com.seer.teach.user.app.auth.LoginType;
|
import com.seer.teach.user.app.auth.LoginType;
|
||||||
import com.seer.teach.user.app.auth.request.LoginParam;
|
import com.seer.teach.user.app.auth.request.LoginParam;
|
||||||
@ -38,7 +38,7 @@ public class WarehouseAccountLoginStrategy extends AbstractLoginStrategy impleme
|
|||||||
|
|
||||||
private final IUserService userService;
|
private final IUserService userService;
|
||||||
|
|
||||||
private final WechatOfficialAccountApi wechatOfficialAccountApi;
|
private final MpOfficialAccountApi mpOfficialAccountApi;
|
||||||
|
|
||||||
private final IUserAuthService userAuthService;
|
private final IUserAuthService userAuthService;
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ public class WarehouseAccountLoginStrategy extends AbstractLoginStrategy impleme
|
|||||||
.findAny()
|
.findAny()
|
||||||
.orElseThrow(() -> new CommonException(ResultCodeEnum.USER_NOT_HAVE_WAREHOUSE_ROLE));
|
.orElseThrow(() -> new CommonException(ResultCodeEnum.USER_NOT_HAVE_WAREHOUSE_ROLE));
|
||||||
|
|
||||||
WxOAuth2AccessTokenDTO wxOAuth2AccessToken = wechatOfficialAccountApi.getUserWxOAuth2AccessToken(request.getAppId(),request.getJsCode());
|
WxOAuth2AccessTokenDTO wxOAuth2AccessToken = mpOfficialAccountApi.getUserWxOAuth2AccessToken(request.getAppId(),request.getJsCode());
|
||||||
AssertUtils.notNull(wxOAuth2AccessToken, ResultCodeEnum.WX_OAUTH_USED_ERROR);
|
AssertUtils.notNull(wxOAuth2AccessToken, ResultCodeEnum.WX_OAUTH_USED_ERROR);
|
||||||
UserAuthEntity userAuthEntity = userAuthService.getOneByOpenId(wxOAuth2AccessToken.getOpenId());
|
UserAuthEntity userAuthEntity = userAuthService.getOneByOpenId(wxOAuth2AccessToken.getOpenId());
|
||||||
if (Objects.isNull(userAuthEntity)) {
|
if (Objects.isNull(userAuthEntity)) {
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import com.seer.teach.common.exception.CommonException;
|
|||||||
import com.seer.teach.common.utils.AssertUtils;
|
import com.seer.teach.common.utils.AssertUtils;
|
||||||
import com.seer.teach.common.utils.CommonUtils;
|
import com.seer.teach.common.utils.CommonUtils;
|
||||||
import com.seer.teach.iot.api.UserDeviceServiceApi;
|
import com.seer.teach.iot.api.UserDeviceServiceApi;
|
||||||
import com.seer.teach.mp.api.WechatMiniProgramApi;
|
import com.seer.teach.mp.api.MpMiniProgramApi;
|
||||||
import com.seer.teach.mp.api.resp.WxMiniProgramSessionDTO;
|
import com.seer.teach.mp.api.resp.WxMiniProgramSessionDTO;
|
||||||
import com.seer.teach.user.app.auth.LoginType;
|
import com.seer.teach.user.app.auth.LoginType;
|
||||||
import com.seer.teach.user.app.auth.request.LoginParam;
|
import com.seer.teach.user.app.auth.request.LoginParam;
|
||||||
@ -35,7 +35,7 @@ public class WechatChildrenAccountLoginStrategy extends AbstractLoginStrategy im
|
|||||||
|
|
||||||
private final UserDeviceServiceApi userDeviceServiceApi;
|
private final UserDeviceServiceApi userDeviceServiceApi;
|
||||||
|
|
||||||
private final WechatMiniProgramApi wechatMiniProgramApi;
|
private final MpMiniProgramApi mpMiniProgramApi;
|
||||||
|
|
||||||
private final IUserRelationService userRelationService;
|
private final IUserRelationService userRelationService;
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ public class WechatChildrenAccountLoginStrategy extends AbstractLoginStrategy im
|
|||||||
AssertUtils.notNull(accountUser, ResultCodeEnum.USERNAME_OR_PASSWORD_IS_ERROR);
|
AssertUtils.notNull(accountUser, ResultCodeEnum.USERNAME_OR_PASSWORD_IS_ERROR);
|
||||||
String password = CommonUtils.encryptPassword(request.getPassword());
|
String password = CommonUtils.encryptPassword(request.getPassword());
|
||||||
if (password.equals(accountUser.getPassword())) {
|
if (password.equals(accountUser.getPassword())) {
|
||||||
WxMiniProgramSessionDTO miniProgramSessionDTO = wechatMiniProgramApi.code2Session(request.getJsCode());
|
WxMiniProgramSessionDTO miniProgramSessionDTO = mpMiniProgramApi.code2Session(request.getJsCode());
|
||||||
AssertUtils.notNull(miniProgramSessionDTO, ResultCodeEnum.WX_SESSION_CODE_USED_ERROR);
|
AssertUtils.notNull(miniProgramSessionDTO, ResultCodeEnum.WX_SESSION_CODE_USED_ERROR);
|
||||||
// 使用开关控制是否检查设备绑定
|
// 使用开关控制是否检查设备绑定
|
||||||
if (deviceCheckEnabled) {
|
if (deviceCheckEnabled) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user