修复一些问题,优化前后端交互接口格式,优化首页轮播图图的维护
This commit is contained in:
+7
@@ -2,6 +2,7 @@ package com.xiaowang.yuminailcore.controller;
|
||||
|
||||
import com.xiaowang.yuminailcore.common.Result;
|
||||
import com.xiaowang.yuminailcore.dto.LoginRequestDTO;
|
||||
import com.xiaowang.yuminailcore.dto.RefreshTokenRequestDTO;
|
||||
import com.xiaowang.yuminailcore.service.UserService;
|
||||
import com.xiaowang.yuminailcore.vo.LoginResponseVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -24,4 +25,10 @@ public class AdminAuthController {
|
||||
public Result<Boolean> logout() {
|
||||
return Result.success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/refresh")
|
||||
public Result<LoginResponseVO> refreshToken(@RequestBody RefreshTokenRequestDTO refreshTokenRequestDTO) {
|
||||
LoginResponseVO loginResponseVO = userService.refreshToken(refreshTokenRequestDTO.getRefreshToken());
|
||||
return Result.success(loginResponseVO);
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -71,6 +71,16 @@ public class AdminCouponController {
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有优惠券
|
||||
*/
|
||||
@GetMapping("/list/all")
|
||||
@RequirePermission("coupon:view")
|
||||
public Result<List<CouponVO>> listAllCoupons() {
|
||||
List<CouponVO> coupons = couponService.listAllCoupons();
|
||||
return Result.success(coupons);
|
||||
}
|
||||
|
||||
/**
|
||||
* 为用户分配优惠券
|
||||
*/
|
||||
|
||||
+9
@@ -9,6 +9,8 @@ import com.xiaowang.yuminailcore.vo.ProductVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin/product")
|
||||
@RequiredArgsConstructor
|
||||
@@ -48,4 +50,11 @@ public class AdminProductController {
|
||||
boolean success = productService.deleteProduct(id);
|
||||
return Result.success(success);
|
||||
}
|
||||
|
||||
@GetMapping("/list/all")
|
||||
@RequirePermission("product:view")
|
||||
public Result<List<ProductVO>> listAllProducts() {
|
||||
List<ProductVO> products = productService.listAllProducts();
|
||||
return Result.success(products);
|
||||
}
|
||||
}
|
||||
|
||||
+32
@@ -11,6 +11,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin/user")
|
||||
@@ -75,6 +77,36 @@ public class AdminUserController {
|
||||
return Result.success(userVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有用户
|
||||
* @return 用户列表
|
||||
*/
|
||||
@GetMapping("/list/all")
|
||||
@RequirePermission("user:view")
|
||||
public Result<List<UserVO>> listAllUsers() {
|
||||
List<UserVO> users = userService.listAllUsers();
|
||||
return Result.success(users);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取美甲师列表
|
||||
* @param shopId 店铺ID(可选)
|
||||
* @return 美甲师列表
|
||||
*/
|
||||
@GetMapping("/list/artists")
|
||||
@RequirePermission("user:view")
|
||||
public Result<List<UserVO>> listArtists(@RequestParam(required = false) Long shopId) {
|
||||
// 用户类型 3 表示美甲师
|
||||
List<UserVO> artists = userService.listUsersByType(3);
|
||||
// 如果指定了店铺ID,则过滤该店铺的美甲师
|
||||
if (shopId != null) {
|
||||
artists = artists.stream()
|
||||
.filter(artist -> shopId.equals(artist.getShopId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
return Result.success(artists);
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class StatusRequest {
|
||||
private Integer status;
|
||||
|
||||
@@ -32,6 +32,11 @@ public class ShopDTO {
|
||||
*/
|
||||
private String businessHours;
|
||||
|
||||
/**
|
||||
* 店铺封面图文件ID集合(Banner图),多个ID以逗号分隔
|
||||
*/
|
||||
private String coverImageFileId;
|
||||
|
||||
/**
|
||||
* 店铺图片文件ID集合,多个ID以逗号分隔
|
||||
*/
|
||||
|
||||
@@ -42,6 +42,12 @@ public class ShopDO extends BaseEntity {
|
||||
@TableField("business_hours")
|
||||
private String businessHours;
|
||||
|
||||
/**
|
||||
* 店铺封面图文件ID集合(Banner图),多个ID以逗号分隔
|
||||
*/
|
||||
@TableField("cover_image_file_id")
|
||||
private String coverImageFileId;
|
||||
|
||||
/**
|
||||
* 店铺图片文件ID集合,多个ID以逗号分隔
|
||||
*/
|
||||
|
||||
@@ -54,6 +54,12 @@ public interface CouponService extends IService<CouponDO> {
|
||||
* @return 分页结果
|
||||
*/
|
||||
PageResultVO<CouponVO> listCoupons(Integer page, Integer size, Long shopId);
|
||||
|
||||
/**
|
||||
* 获取所有优惠券
|
||||
* @return 优惠券列表
|
||||
*/
|
||||
List<CouponVO> listAllCoupons();
|
||||
|
||||
/**
|
||||
* 为用户分配优惠券
|
||||
|
||||
+12
-1
@@ -134,7 +134,18 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, CouponDO> imple
|
||||
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<CouponVO> listAllCoupons() {
|
||||
List<CouponDO> couponDOs = list(new LambdaQueryWrapper<CouponDO>()
|
||||
.eq(CouponDO::getIsDelete, 0)
|
||||
.orderByDesc(CouponDO::getCreateTime)
|
||||
);
|
||||
return couponDOs.stream()
|
||||
.map(this::convertToCouponVO)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean assignCouponToUser(Long userId, Long couponId, Long shopId) {
|
||||
|
||||
+4
@@ -37,6 +37,7 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
|
||||
shopDO.setDescription(shopDTO.getDescription());
|
||||
shopDO.setAddress(shopDTO.getAddress());
|
||||
shopDO.setBusinessHours(shopDTO.getBusinessHours());
|
||||
shopDO.setCoverImageFileId(shopDTO.getCoverImageFileId());
|
||||
shopDO.setImageFileIds(shopDTO.getImageFileIds());
|
||||
shopDO.setIsDelete(0);
|
||||
shopMapper.insert(shopDO);
|
||||
@@ -53,6 +54,7 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
|
||||
shopDO.setDescription(shopDTO.getDescription());
|
||||
shopDO.setAddress(shopDTO.getAddress());
|
||||
shopDO.setBusinessHours(shopDTO.getBusinessHours());
|
||||
shopDO.setCoverImageFileId(shopDTO.getCoverImageFileId());
|
||||
shopDO.setImageFileIds(shopDTO.getImageFileIds());
|
||||
return shopMapper.updateById(shopDO) > 0;
|
||||
}
|
||||
@@ -137,6 +139,8 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
|
||||
shopVO.setDescription(shopDO.getDescription());
|
||||
shopVO.setAddress(shopDO.getAddress());
|
||||
shopVO.setBusinessHours(shopDO.getBusinessHours());
|
||||
shopVO.setCoverImageFileId(shopDO.getCoverImageFileId());
|
||||
shopVO.setCoverImageUrls(new java.util.ArrayList<>());
|
||||
shopVO.setImageFileIds(shopDO.getImageFileIds());
|
||||
shopVO.setImageUrls(new java.util.ArrayList<>());
|
||||
shopVO.setCreateTime(shopDO.getCreateTime());
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.xiaowang.yuminailcore.vo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺信息表 VO
|
||||
@@ -39,6 +40,16 @@ public class ShopVO {
|
||||
*/
|
||||
private String businessHours;
|
||||
|
||||
/**
|
||||
* 店铺封面图文件ID集合(Banner图),多个ID以逗号分隔
|
||||
*/
|
||||
private String coverImageFileId;
|
||||
|
||||
/**
|
||||
* 店铺封面图URL列表(Banner图)
|
||||
*/
|
||||
private List<String> coverImageUrls;
|
||||
|
||||
/**
|
||||
* 店铺图片文件ID集合,多个ID以逗号分隔
|
||||
*/
|
||||
@@ -47,7 +58,7 @@ public class ShopVO {
|
||||
/**
|
||||
* 店铺图片URL列表
|
||||
*/
|
||||
private java.util.List<String> imageUrls;
|
||||
private List<String> imageUrls;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
|
||||
Reference in New Issue
Block a user