mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-24 16:05:08 +08:00
@ -57,4 +57,12 @@ public interface MemberUserApi {
|
||||
* @return 用户信息
|
||||
*/
|
||||
MemberUserRespDTO getUserByMobile(String mobile);
|
||||
|
||||
/**
|
||||
* 校验用户是否存在
|
||||
*
|
||||
* @param id 用户编号
|
||||
*/
|
||||
void validateUser(Long id);
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,9 @@ import jakarta.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.USER_MOBILE_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 会员用户的 API 实现类
|
||||
*
|
||||
@ -44,4 +47,12 @@ public class MemberUserApiImpl implements MemberUserApi {
|
||||
return MemberUserConvert.INSTANCE.convert2(userService.getUserByMobile(mobile));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateUser(Long id) {
|
||||
MemberUserDO user = userService.getUser(id);
|
||||
if (user == null) {
|
||||
throw exception(USER_MOBILE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.social;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
@ -7,18 +8,20 @@ import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||
import cn.iocoder.yudao.module.member.controller.app.social.vo.AppSocialUserBindReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.social.vo.AppSocialUserRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.social.vo.AppSocialUserUnbindReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.social.vo.AppSocialWxQrcodeReqVO;
|
||||
import cn.iocoder.yudao.module.system.api.social.SocialClientApi;
|
||||
import cn.iocoder.yudao.module.system.api.social.SocialUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserUnbindReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialWxQrcodeReqDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
@ -31,6 +34,8 @@ public class AppSocialUserController {
|
||||
|
||||
@Resource
|
||||
private SocialUserApi socialUserApi;
|
||||
@Resource
|
||||
private SocialClientApi socialClientApi;
|
||||
|
||||
@PostMapping("/bind")
|
||||
@Operation(summary = "社交绑定,使用 code 授权码")
|
||||
@ -60,4 +65,11 @@ public class AppSocialUserController {
|
||||
return success(BeanUtils.toBean(socialUser, AppSocialUserRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/wxa-qrcode")
|
||||
@Operation(summary = "获得微信小程序码(base64 image)")
|
||||
public CommonResult<String> getWxaQrcode(@RequestBody @Valid AppSocialWxQrcodeReqVO reqVO) {
|
||||
byte[] wxQrcode = socialClientApi.getWxaQrcode(BeanUtils.toBean(reqVO, SocialWxQrcodeReqDTO.class));
|
||||
return success(Base64.encode(wxQrcode));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.social.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Schema(description = "用户 APP - 获得获取小程序码 Request VO")
|
||||
@Data
|
||||
public class AppSocialWxQrcodeReqVO {
|
||||
|
||||
/**
|
||||
* 页面路径不能携带参数(参数请放在scene字段里)
|
||||
*/
|
||||
@Schema(description = "场景值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1001")
|
||||
private String scene;
|
||||
|
||||
/**
|
||||
* 默认是主页,页面 page,例如 pages/index/index,根路径前不要填加 /,不能携带参数(参数请放在scene字段里),
|
||||
* 如果不填写这个字段,默认跳主页面。scancode_time为系统保留参数,不允许配置
|
||||
*/
|
||||
@Schema(description = "页面路径", requiredMode = Schema.RequiredMode.REQUIRED, example = "pages/goods/index")
|
||||
@NotEmpty(message = "页面路径不能为空")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "二维码宽度", requiredMode = Schema.RequiredMode.REQUIRED, example = "430")
|
||||
private Integer width;
|
||||
|
||||
@Schema(description = "是/否自动配置线条颜色", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
private Boolean autoColor;
|
||||
|
||||
@Schema(description = "是/否检查 page 是否存在", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
private Boolean checkPath;
|
||||
|
||||
@Schema(description = "是/否需要透明底色", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
private Boolean hyaline;
|
||||
|
||||
}
|
@ -11,6 +11,9 @@ import lombok.NoArgsConstructor;
|
||||
@AllArgsConstructor
|
||||
public class AppMemberUserInfoRespVO {
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
private String nickname;
|
||||
|
||||
|
@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.member.dal.dataobject.tag.MemberTagDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
@ -27,8 +28,12 @@ public interface MemberUserConvert {
|
||||
|
||||
AppMemberUserInfoRespVO convert(MemberUserDO bean);
|
||||
|
||||
@Mapping(source = "level", target = "level")
|
||||
@Mapping(source = "bean.experience", target = "experience")
|
||||
|
||||
@Mappings({
|
||||
@Mapping(source = "level", target = "level"),
|
||||
@Mapping(source = "bean.id", target = "id"),
|
||||
@Mapping(source = "bean.experience", target = "experience")
|
||||
})
|
||||
AppMemberUserInfoRespVO convert(MemberUserDO bean, MemberLevelDO level);
|
||||
|
||||
MemberUserRespDTO convert2(MemberUserDO bean);
|
||||
|
Reference in New Issue
Block a user