完善了用户登录

This commit is contained in:
chen-xin-zhi 2024-11-04 14:07:25 +08:00
parent 92de3d4da4
commit e43b6be4d2
5 changed files with 14 additions and 7 deletions

View File

@ -80,7 +80,7 @@ public class AddressController {
* @return 是否更新成功 * @return 是否更新成功
*/ */
@PostMapping("/update") @PostMapping("/update")
// @Operation(summary = "小程序端用户更新地址信息", ) @Operation(summary = "小程序端用户更新地址信息", description = "参数地址更新请求体权限所有人方法名updateAddress")
public BaseResponse<Boolean> updateAddress(@RequestBody AddressUpdateRequest addressUpdateRequest) { public BaseResponse<Boolean> updateAddress(@RequestBody AddressUpdateRequest addressUpdateRequest) {
if (addressUpdateRequest == null || addressUpdateRequest.getId() <= 0) { if (addressUpdateRequest == null || addressUpdateRequest.getId() <= 0) {
throw new BusinessException(ErrorCode.PARAMS_ERROR); throw new BusinessException(ErrorCode.PARAMS_ERROR);
@ -102,6 +102,7 @@ public class AddressController {
* @return 用户地址列表 * @return 用户地址列表
*/ */
@PostMapping("/list") @PostMapping("/list")
@Operation(summary = "小程序端查询用户地址信息", description = "参数:地址查询请求体,权限:所有人,方法名:listAddress")
public BaseResponse<List<Address>> listAddress(@RequestBody CommonRequest addressQueryRequest) { public BaseResponse<List<Address>> listAddress(@RequestBody CommonRequest addressQueryRequest) {
if (addressQueryRequest == null || addressQueryRequest.getId() <= 0) { if (addressQueryRequest == null || addressQueryRequest.getId() <= 0) {
throw new BusinessException(ErrorCode.PARAMS_ERROR); throw new BusinessException(ErrorCode.PARAMS_ERROR);

View File

@ -1,6 +1,5 @@
package com.cultural.heritage.controller.address; package com.cultural.heritage.controller.address;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cultural.heritage.common.BaseResponse; import com.cultural.heritage.common.BaseResponse;
import com.cultural.heritage.common.ErrorCode; import com.cultural.heritage.common.ErrorCode;
import com.cultural.heritage.common.ResultUtils; import com.cultural.heritage.common.ResultUtils;
@ -11,9 +10,8 @@ import com.cultural.heritage.model.dto.contacts.ContactsAddRequest;
import com.cultural.heritage.model.dto.contacts.ContactsUpdateRequest; import com.cultural.heritage.model.dto.contacts.ContactsUpdateRequest;
import com.cultural.heritage.model.entity.Contacts; import com.cultural.heritage.model.entity.Contacts;
import com.cultural.heritage.service.address.ContactsService; import com.cultural.heritage.service.address.ContactsService;
import com.obs.services.internal.utils.RestUtils; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.models.info.Contact;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -41,6 +39,7 @@ public class ContactsController {
* @return 是否添加成功 * @return 是否添加成功
*/ */
@PostMapping("/add") @PostMapping("/add")
@Operation(summary = "小程序端用户添加联系人信息", description = "参数联系人添加请求体权限所有人方法名addContacts")
public BaseResponse<Boolean> addContacts(@RequestBody ContactsAddRequest contactsAddRequest) { public BaseResponse<Boolean> addContacts(@RequestBody ContactsAddRequest contactsAddRequest) {
if (contactsAddRequest == null) { if (contactsAddRequest == null) {
throw new BusinessException(ErrorCode.PARAMS_ERROR); throw new BusinessException(ErrorCode.PARAMS_ERROR);
@ -61,6 +60,7 @@ public class ContactsController {
* @return 是否更新成功 * @return 是否更新成功
*/ */
@PostMapping("/update") @PostMapping("/update")
@Operation(summary = "小程序端用户更新联系人信息", description = "参数:联系人更新请求体权限所有人方法名updateContacts")
public BaseResponse<Boolean> updateContacts(@RequestBody ContactsUpdateRequest contactsUpdateRequest) { public BaseResponse<Boolean> updateContacts(@RequestBody ContactsUpdateRequest contactsUpdateRequest) {
if (contactsUpdateRequest == null || contactsUpdateRequest.getId() <= 0) { if (contactsUpdateRequest == null || contactsUpdateRequest.getId() <= 0) {
throw new BusinessException(ErrorCode.PARAMS_ERROR); throw new BusinessException(ErrorCode.PARAMS_ERROR);
@ -82,6 +82,7 @@ public class ContactsController {
* @return 是否删除成功 * @return 是否删除成功
*/ */
@PostMapping("/delete") @PostMapping("/delete")
@Operation(summary = "小程序端用户删除联系人信息", description = "参数联系人删除请求体权限所有人方法名deleteContacts")
public BaseResponse<Boolean> deleteContacts(@RequestBody CommonRequest contactsDeleteRequest) { public BaseResponse<Boolean> deleteContacts(@RequestBody CommonRequest contactsDeleteRequest) {
if (contactsDeleteRequest == null || contactsDeleteRequest.getId() <= 0) { if (contactsDeleteRequest == null || contactsDeleteRequest.getId() <= 0) {
throw new BusinessException(ErrorCode.PARAMS_ERROR); throw new BusinessException(ErrorCode.PARAMS_ERROR);
@ -100,6 +101,7 @@ public class ContactsController {
* @return 用户联系人列表 * @return 用户联系人列表
*/ */
@PostMapping("/list") @PostMapping("/list")
@Operation(summary = "小程序端用户查询联系人信息", description = "参数联系人查询请求体权限所有人方法名listUserContacts")
public BaseResponse<List<Contacts>> listUserContacts(@RequestBody CommonRequest contactsQueryRequest) { public BaseResponse<List<Contacts>> listUserContacts(@RequestBody CommonRequest contactsQueryRequest) {
if (contactsQueryRequest == null || contactsQueryRequest.getId() <= 0) { if (contactsQueryRequest == null || contactsQueryRequest.getId() <= 0) {
throw new BusinessException(ErrorCode.PARAMS_ERROR); throw new BusinessException(ErrorCode.PARAMS_ERROR);

View File

@ -11,6 +11,7 @@ import com.cultural.heritage.model.entity.User;
import com.cultural.heritage.model.enums.FileUploadBizEnum; import com.cultural.heritage.model.enums.FileUploadBizEnum;
import com.cultural.heritage.service.file.IHweiYunOBSService; import com.cultural.heritage.service.file.IHweiYunOBSService;
import com.cultural.heritage.service.user.UserService; import com.cultural.heritage.service.user.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
@ -47,6 +48,7 @@ public class FileController {
* @return 图片可访问地址 * @return 图片可访问地址
*/ */
@PostMapping("/upload/server/not_login") @PostMapping("/upload/server/not_login")
@Operation(summary = "未登录情况下的文件上传", description = "参数文件对象multipartFile), 业务类型(biz)权限所有人方法名uploadServerFileNotLogin")
private BaseResponse<String> uploadServerFileNotLogin(@RequestPart("file")MultipartFile multipartFile, UploadFileRequest uploadFileRequest) { private BaseResponse<String> uploadServerFileNotLogin(@RequestPart("file")MultipartFile multipartFile, UploadFileRequest uploadFileRequest) {
//获取业务名称 //获取业务名称
String biz = uploadFileRequest.getBiz(); String biz = uploadFileRequest.getBiz();
@ -77,6 +79,7 @@ public class FileController {
@PostMapping("/upload/server") @PostMapping("/upload/server")
@Operation(summary = "未登录情况下的文件上传", description = "参数文件对象multipartFile), 业务类型(biz)权限所有人方法名uploadServerFile")
public BaseResponse<String> uploadServerFile(@RequestPart MultipartFile multipartFile, UploadFileRequest uploadFileRequest, HttpServletRequest request) { public BaseResponse<String> uploadServerFile(@RequestPart MultipartFile multipartFile, UploadFileRequest uploadFileRequest, HttpServletRequest request) {
//获取业务名称 //获取业务名称
String biz = uploadFileRequest.getBiz(); String biz = uploadFileRequest.getBiz();

View File

@ -12,7 +12,7 @@ import com.cultural.heritage.model.dto.cart.CartRecordUpdateRequest;
import com.cultural.heritage.model.entity.CartRecord; import com.cultural.heritage.model.entity.CartRecord;
import com.cultural.heritage.model.vo.CartRecordVO; import com.cultural.heritage.model.vo.CartRecordVO;
import com.cultural.heritage.service.good.CartRecordService; import com.cultural.heritage.service.good.CartRecordService;
import com.cultural.heritage.service.good.GoodService; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -36,13 +36,13 @@ public class CartRecordController {
private CartRecordService cartRecordService; private CartRecordService cartRecordService;
/** /**
* 用户添加商品至购物车 * 用户添加商品至购物车
* @param cartRecordAddRequest 购物车记录添加请求体 * @param cartRecordAddRequest 购物车记录添加请求体
* @return 是否添加成功 * @return 是否添加成功
*/ */
@PostMapping("/add") @PostMapping("/add")
@Operation(summary = "小程序端用户添加商品至购物车", description = "参数购物车记录添加请求体权限所有人方法名addCartRecord")
public BaseResponse<Boolean> addCartRecord(@RequestBody CartRecordAddRequest cartRecordAddRequest) { public BaseResponse<Boolean> addCartRecord(@RequestBody CartRecordAddRequest cartRecordAddRequest) {
if (cartRecordAddRequest == null) { if (cartRecordAddRequest == null) {
throw new BusinessException(ErrorCode.PARAMS_ERROR); throw new BusinessException(ErrorCode.PARAMS_ERROR);
@ -58,6 +58,7 @@ public class CartRecordController {
* @return 是否更新成功 * @return 是否更新成功
*/ */
@PostMapping("/update") @PostMapping("/update")
@Operation(summary = "小程序端用户更新商品至购物车", description = "参数:购物车记录更新请求体")
public BaseResponse<Boolean> updateCartRecord(@RequestBody List<CartRecordUpdateRequest> cartRecordUpdateRequestList) { public BaseResponse<Boolean> updateCartRecord(@RequestBody List<CartRecordUpdateRequest> cartRecordUpdateRequestList) {
if (CollectionUtils.isEmpty(cartRecordUpdateRequestList)) { if (CollectionUtils.isEmpty(cartRecordUpdateRequestList)) {
throw new BusinessException(ErrorCode.PARAMS_ERROR); throw new BusinessException(ErrorCode.PARAMS_ERROR);

View File

@ -60,7 +60,7 @@ public class UserController {
*/ */
@PostMapping("/login") @PostMapping("/login")
@Operation(summary = "Web端用户登录", description = "参数:{账号,密码}, 权限:管理员(admin, boss), 方法名userLogin") @Operation(summary = "Web端用户登录", description = "参数:{账号,密码}, 权限:管理员(admin, boss), 方法名userLogin")
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE) // @AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
public BaseResponse<UserVO> userLogin(@RequestBody UserLoginRequest userLoginRequest, HttpServletRequest request){ public BaseResponse<UserVO> userLogin(@RequestBody UserLoginRequest userLoginRequest, HttpServletRequest request){
if(userLoginRequest == null) { if(userLoginRequest == null) {
throw new BusinessException(ErrorCode.PARAMS_ERROR); throw new BusinessException(ErrorCode.PARAMS_ERROR);