this is 3.24 update
This commit is contained in:
parent
2fc2f8330e
commit
50639f39e8
|
@ -289,8 +289,6 @@ public class PhotoProductsController {
|
|||
|
||||
PhotoProductsVO photoProductsVO = new PhotoProductsVO();
|
||||
BeanUtils.copyProperties(photoProducts, photoProductsVO);
|
||||
// TODO
|
||||
// photoProductsVO.setIntroImg(FileConstant.SERVER_HOST + photoProducts.getIntroImg());
|
||||
photoProductsVO.setBookingDateVOList(bookingDateVOList);
|
||||
photoProductsVOList.add(photoProductsVO);
|
||||
}
|
||||
|
@ -425,8 +423,6 @@ public class PhotoProductsController {
|
|||
PhotoProductsVO photoProductsVO = new PhotoProductsVO();
|
||||
BeanUtils.copyProperties(photoProducts, photoProductsVO);
|
||||
photoProductsVO.setRichText(DecoderUtils.decodeText(photoProductsVO.getRichText()));
|
||||
// TODO
|
||||
// photoProductsVO.setIntroImg(FileConstant.SERVER_HOST + photoProductsVO.getIntroImg());
|
||||
photoProductsVO.setBookingDateVOList(bookingDateVOList);
|
||||
|
||||
return ResultUtils.success(photoProductsVO);
|
||||
|
|
|
@ -9,6 +9,8 @@ import com.cultural.heritage.constant.OrderStatusConstant;
|
|||
import com.cultural.heritage.constant.UserConstant;
|
||||
import com.cultural.heritage.model.entity.*;
|
||||
import com.cultural.heritage.model.vo.clothes.ClothesLabelVO;
|
||||
import com.cultural.heritage.model.vo.good.GoodLabelVO;
|
||||
import com.cultural.heritage.model.vo.good.GoodTypeVO;
|
||||
import com.cultural.heritage.model.vo.photoProducts.PhotoProductsLabelVO;
|
||||
import com.cultural.heritage.service.book.AdvanceOrderService;
|
||||
import com.cultural.heritage.service.book.PhotoCategoryService;
|
||||
|
@ -16,6 +18,7 @@ import com.cultural.heritage.service.book.PhotoProductsService;
|
|||
import com.cultural.heritage.service.clothes.ClothesCategoryService;
|
||||
import com.cultural.heritage.service.clothes.ClothesService;
|
||||
import com.cultural.heritage.service.common.CommonService;
|
||||
import com.cultural.heritage.service.good.CategoryService;
|
||||
import com.cultural.heritage.service.good.GoodService;
|
||||
import com.cultural.heritage.service.order.OrderService;
|
||||
import com.google.gson.Gson;
|
||||
|
@ -70,6 +73,10 @@ public class GlobalController {
|
|||
private CommonService commonService;
|
||||
|
||||
|
||||
@Resource
|
||||
private CategoryService categoryService;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -218,4 +225,52 @@ public class GlobalController {
|
|||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户获取所有类别的商品
|
||||
* @return 当前类别的商品列表
|
||||
*/
|
||||
@GetMapping("/getAllGoods")
|
||||
@Operation(summary = "小程序端用户获取所有类别的商品", description = "参数:类别id,方法名:getAllGoods")
|
||||
public BaseResponse<Map<String, GoodTypeVO>> getAllGoods() {
|
||||
|
||||
// 获取所有类别
|
||||
List<Category> categoryList = categoryService.list();
|
||||
Map<String, String> nameToImage = new HashMap<>();
|
||||
for (Category category : categoryList) {
|
||||
nameToImage.put(category.getTypeName(), category.getTypeUrl());
|
||||
}
|
||||
|
||||
// 获取所有商品
|
||||
Map<String, Object> conditions = new HashMap<>();
|
||||
conditions.put("isGoodType", 1);
|
||||
conditions.put("isShelves", 1);
|
||||
List<Good> goodList = commonService.findByFieldEqTargetFields(conditions, goodService);
|
||||
List<GoodLabelVO> goodLabelVOS = commonService.convertList(goodList, GoodLabelVO.class);
|
||||
|
||||
Map<String, GoodTypeVO> map = new HashMap<>();
|
||||
for (GoodLabelVO goodLabelVO : goodLabelVOS) {
|
||||
String type = goodLabelVO.getType();
|
||||
GoodTypeVO goodTypeVO = map.get(type);
|
||||
if (goodTypeVO == null) {
|
||||
goodTypeVO = new GoodTypeVO();
|
||||
List<GoodLabelVO> goodLabelVOList = new ArrayList<>();
|
||||
goodLabelVOList.add(goodLabelVO);
|
||||
goodTypeVO.setImage(nameToImage.get(type));
|
||||
goodTypeVO.setGoodLabelVOList(goodLabelVOList);
|
||||
map.put(type, goodTypeVO);
|
||||
} else {
|
||||
List<GoodLabelVO> goodLabelVOList = goodTypeVO.getGoodLabelVOList();
|
||||
goodLabelVOList.add(goodLabelVO);
|
||||
goodTypeVO.setGoodLabelVOList(goodLabelVOList);
|
||||
map.put(type, goodTypeVO);
|
||||
}
|
||||
}
|
||||
|
||||
return ResultUtils.success(map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -266,8 +266,6 @@ public class CartExperienceController {
|
|||
Integer quantity = cartExperience.getQuantity();
|
||||
Long goodId = cartExperience.getGoodId();
|
||||
Good good = goodMap.get(goodId);
|
||||
// TODO
|
||||
// good.setGoodImg(FileConstant.SERVER_HOST + good.getGoodImg());
|
||||
String reservationDate = cartExperience.getReservationDate();
|
||||
String timeSlot = cartExperience.getTimeSlot();
|
||||
|
||||
|
|
|
@ -222,8 +222,6 @@ public class CartRecordController {
|
|||
Integer quantity = cartRecord.getQuantity();
|
||||
Long goodId = cartRecord.getGoodId();
|
||||
Good good = goodMap.get(goodId);
|
||||
// TODO
|
||||
// good.setGoodImg(FileConstant.SERVER_HOST + good.getGoodImg());
|
||||
CartGoodVO cartGoodVO = new CartGoodVO();
|
||||
BeanUtils.copyProperties(good, cartGoodVO);
|
||||
|
||||
|
|
|
@ -189,10 +189,6 @@ public class CategoryController {
|
|||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<List<Category>> listCategoryOnWeb() {
|
||||
List<Category> list = categoryService.list();
|
||||
// TODO
|
||||
// for (Category category : list) {
|
||||
// category.setTypeUrl(FileConstant.SERVER_HOST + category.getTypeUrl());
|
||||
// }
|
||||
return ResultUtils.success(list);
|
||||
}
|
||||
|
||||
|
@ -211,10 +207,6 @@ public class CategoryController {
|
|||
List<Good> goodList = commonService.findByFieldEqTargetField("isShelves", 1, goodService);
|
||||
// 获取所有存在上架商品的商品类别
|
||||
List<Category> categoryList = commonService.findByFieldInTargetField(goodList, categoryService, Good::getType, "typeName");
|
||||
// TODO
|
||||
// for (Category category : categoryList) {
|
||||
// category.setTypeUrl(FileConstant.SERVER_HOST + category.getTypeUrl());
|
||||
// }
|
||||
return ResultUtils.success(categoryList);
|
||||
}
|
||||
|
||||
|
@ -243,10 +235,6 @@ public class CategoryController {
|
|||
queryWrapper.eq("isShelves", 1);
|
||||
queryWrapper.orderByDesc("id");
|
||||
List<Good> goodList = goodService.list(queryWrapper);
|
||||
// TODO
|
||||
// for (Good good : goodList) {
|
||||
// good.setGoodImg(FileConstant.SERVER_HOST + good.getGoodImg());
|
||||
// }
|
||||
Map<Long, List<Good>> map = new HashMap<>();
|
||||
map.put(id, goodList);
|
||||
return ResultUtils.success(map);
|
||||
|
@ -255,5 +243,4 @@ public class CategoryController {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -290,8 +290,7 @@ public class CouponController {
|
|||
*/
|
||||
@GetMapping("/list/all")
|
||||
@Operation(summary = "小程序端用户查看商城优惠券", description = "参数:无,权限:所有人,方法名:listAllCoupon")
|
||||
public BaseResponse<List<CouponVO>> listAllCoupon(HttpServletRequest request) {
|
||||
userService.getLoginUser(request);
|
||||
public BaseResponse<List<CouponVO>> listAllCoupon() {
|
||||
QueryWrapper<Coupon> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("status", "可用");
|
||||
List<Coupon> coupons = couponService.list(queryWrapper);
|
||||
|
@ -307,8 +306,7 @@ public class CouponController {
|
|||
*/
|
||||
@PostMapping("/list/id")
|
||||
@Operation(summary = "小程序端用户根据id查看优惠券详情", description = "参数:优惠券id,权限:所有人,方法名:listCouponById")
|
||||
public BaseResponse<CouponVO> listCouponById(@RequestBody CommonRequest commonRequest, HttpServletRequest request) {
|
||||
userService.getLoginUser(request);
|
||||
public BaseResponse<CouponVO> listCouponById(@RequestBody CommonRequest commonRequest) {
|
||||
if (commonRequest == null || commonRequest.getId() <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
|
|
|
@ -122,8 +122,6 @@ public class FestivalController {
|
|||
// 遍历查找匹配的节日
|
||||
for (Festival festival : festivalList) {
|
||||
if (festival.getName().equals(festivalName)) {
|
||||
// TODO
|
||||
// String wholeFilePath = FileConstant.SERVER_HOST + festival.getUrl();
|
||||
return ResultUtils.success(festival.getUrl()); // 返回对应的 URL
|
||||
}
|
||||
}
|
||||
|
@ -141,10 +139,6 @@ public class FestivalController {
|
|||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<List<Festival>> getFestivalList() {
|
||||
List<Festival> festivalList = redisTemplate.opsForList().range(FESTIVAL_KEY, 0, -1);
|
||||
// TODO
|
||||
// for (Festival festival : festivalList) {
|
||||
// festival.setUrl(FileConstant.SERVER_HOST + festival.getUrl());
|
||||
// }
|
||||
return ResultUtils.success(festivalList);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ import com.cultural.heritage.utils.DecoderUtils;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -420,15 +419,6 @@ public class GoodController {
|
|||
QueryWrapper<Good> goodQueryWrapper = goodService.getGoodQueryWrapper(goodQueryRequest, false);
|
||||
Page<Good> page = goodService.page(new Page<>(current, pageSize), goodQueryWrapper);
|
||||
List<Good> records = page.getRecords();
|
||||
// TODO
|
||||
// for (Good good : records) {
|
||||
// String[] goodImgArr = good.getGoodImg().split(";");
|
||||
// for (int i = 0; i < goodImgArr.length; i++) {
|
||||
// goodImgArr[i] = FileConstant.SERVER_HOST + goodImgArr[i];
|
||||
// }
|
||||
// String joinImg = String.join(";", goodImgArr);
|
||||
// good.setGoodImg(joinImg);
|
||||
// }
|
||||
List<GoodPageVO> goodPageVOS = commonService.convertList(records, GoodPageVO.class);
|
||||
Page<GoodPageVO> goodPageVOPage = new Page<>();
|
||||
goodPageVOPage.setRecords(goodPageVOS);
|
||||
|
@ -479,13 +469,6 @@ public class GoodController {
|
|||
Long id = getByIdRequest.getId();
|
||||
Good good = goodService.getById(id);
|
||||
ThrowUtils.throwIf(good == null, ErrorCode.OPERATION_ERROR, "商品不存在");
|
||||
// TODO
|
||||
// String[] goodImgArr = good.getGoodImg().split(";");
|
||||
// for (int i = 0; i < goodImgArr.length; i++) {
|
||||
// goodImgArr[i] = FileConstant.SERVER_HOST + goodImgArr[i];
|
||||
// }
|
||||
// String joinImg = String.join(";", goodImgArr);
|
||||
// good.setGoodImg(joinImg);
|
||||
|
||||
good.setRichText(DecoderUtils.decodeText(good.getRichText()));
|
||||
GoodPageVO goodPageVO = new GoodPageVO();
|
||||
|
@ -516,10 +499,6 @@ public class GoodController {
|
|||
QueryWrapper<Good> goodQueryWrapper = goodService.getGoodQueryWrapper(goodQueryRequest, true);
|
||||
Page<Good> page = goodService.page(new Page<>(current, pageSize), goodQueryWrapper);
|
||||
List<Good> records = page.getRecords();
|
||||
// TODO
|
||||
// for (Good good : records) {
|
||||
// good.setGoodImg(FileConstant.SERVER_HOST + good.getGoodImg());
|
||||
// }
|
||||
|
||||
// 获取联表(预约日期表, 预约时间段表)查询结果
|
||||
List<AppointmentDateTimePeriodVO> appointmentDateTimePeriodVOS = appointmentDateService.queryAppointmentDateDetail();
|
||||
|
@ -606,16 +585,13 @@ public class GoodController {
|
|||
*/
|
||||
@PostMapping("/service/list/id")
|
||||
@Operation(summary = "小程序端用户根据id查询服务类商品", description = "参数:根据id查询请求体,权限:所有人,方法名:listServiceGoodVO")
|
||||
public BaseResponse<ServiceGoodVO> listServiceGoodVO(@RequestBody CommonRequest commonRequest, HttpServletRequest request) {
|
||||
public BaseResponse<ServiceGoodVO> listServiceGoodVO(@RequestBody CommonRequest commonRequest) {
|
||||
if (commonRequest == null || commonRequest.getId() <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
userService.getLoginUser(request);
|
||||
Long id = commonRequest.getId();
|
||||
Good good = goodService.getById(id);
|
||||
ThrowUtils.throwIf(good == null, ErrorCode.NOT_FOUND_ERROR, "商品不存在");
|
||||
// TODO
|
||||
// good.setGoodImg(FileConstant.SERVER_HOST + good.getGoodImg());
|
||||
ServiceGoodVO serviceGoodVO = new ServiceGoodVO();
|
||||
BeanUtils.copyProperties(good, serviceGoodVO);
|
||||
Long goodVOId = serviceGoodVO.getId();
|
||||
|
@ -716,10 +692,6 @@ public class GoodController {
|
|||
conditionMap.put("isGoodType", 0);
|
||||
List<Good> goodList = commonService.findByFieldEqTargetFields(conditionMap, goodService);
|
||||
goodList = goodList.stream().filter(good -> good.getName().contains(keyword)).toList();
|
||||
// TODO
|
||||
// for (Good good : goodList) {
|
||||
// good.setGoodImg(FileConstant.SERVER_HOST + good.getGoodImg());
|
||||
// }
|
||||
List<ServiceGoodCardVO> serviceGoodCardVOS = commonService.convertList(goodList, ServiceGoodCardVO.class);
|
||||
return ResultUtils.success(serviceGoodCardVOS);
|
||||
}
|
||||
|
@ -755,15 +727,6 @@ public class GoodController {
|
|||
}
|
||||
return false;
|
||||
}).toList();
|
||||
// TODO
|
||||
// for (Good good : goodList) {
|
||||
// String[] goodImgArr = good.getGoodImg().split(";");
|
||||
// for (int i = 0; i < goodImgArr.length; i++) {
|
||||
// goodImgArr[i] = FileConstant.SERVER_HOST + goodImgArr[i];
|
||||
// }
|
||||
// String joinImg = String.join(";", goodImgArr);
|
||||
// good.setGoodImg(joinImg);
|
||||
// }
|
||||
List<ServiceGoodCardVO> serviceGoodCardVOS = commonService.convertList(goodList, ServiceGoodCardVO.class);
|
||||
return ResultUtils.success(serviceGoodCardVOS);
|
||||
}
|
||||
|
@ -780,16 +743,11 @@ public class GoodController {
|
|||
*/
|
||||
@GetMapping("/service/list/card")
|
||||
@Operation(summary = "小程序端展示服务类商品卡片", description = "参数:无,权限:所有人,方法名:listServiceGoodCardVO")
|
||||
public BaseResponse<List<ServiceGoodCardVO>> listServiceGoodCardVO(HttpServletRequest request) {
|
||||
userService.getLoginUser(request);
|
||||
public BaseResponse<List<ServiceGoodCardVO>> listServiceGoodCardVO() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("isGoodType", 0);
|
||||
map.put("isShelves", 1);
|
||||
List<Good> goodList = commonService.findByFieldEqTargetFields(map, goodService);
|
||||
// TODO
|
||||
// for (Good good : goodList) {
|
||||
// good.setGoodImg(FileConstant.SERVER_HOST + good.getGoodImg());
|
||||
// }
|
||||
List<ServiceGoodCardVO> serviceGoodCardVOS = commonService.convertList(goodList, ServiceGoodCardVO.class);
|
||||
return ResultUtils.success(serviceGoodCardVOS);
|
||||
}
|
||||
|
@ -996,16 +954,13 @@ public class GoodController {
|
|||
*/
|
||||
@PostMapping("/query/service/id")
|
||||
@Operation(summary = "小程序端用户根据id查询服务类商品信息(不含预约日期和时间段)", description = "参数:商品id,权限:所有人,方法名:queryServiceGoodMainInfoById")
|
||||
public BaseResponse<ServiceGoodCardVO> queryServiceGoodMainInfoById(@RequestBody CommonRequest commonRequest, HttpServletRequest request) {
|
||||
public BaseResponse<ServiceGoodCardVO> queryServiceGoodMainInfoById(@RequestBody CommonRequest commonRequest) {
|
||||
if (commonRequest == null || commonRequest.getId() <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
userService.getLoginUser(request);
|
||||
Long id = commonRequest.getId();
|
||||
Good good = goodService.getById(id);
|
||||
ThrowUtils.throwIf(good == null, ErrorCode.NOT_FOUND_ERROR, "商品不存在");
|
||||
// TODO
|
||||
// good.setGoodImg(FileConstant.SERVER_HOST + good.getGoodImg());
|
||||
ServiceGoodCardVO serviceGoodVO = new ServiceGoodCardVO();
|
||||
BeanUtils.copyProperties(good, serviceGoodVO);
|
||||
|
||||
|
|
|
@ -230,12 +230,6 @@ public class AdvanceOrderController {
|
|||
// 封装成写真预约订单VO
|
||||
List<AdvanceOrder> records = page.getRecords();
|
||||
List<AdvanceOrderVO> advanceOrderVOS = commonService.convertList(records, AdvanceOrderVO.class);
|
||||
// TODO
|
||||
// for (AdvanceOrderVO advanceOrderVO : advanceOrderVOS) {
|
||||
// PhotoProductsSnapshot photoProductsSnapshot = advanceOrderVO.getPhotoProductsSnapshot();
|
||||
// photoProductsSnapshot.setIntroImg(FileConstant.SERVER_HOST + photoProductsSnapshot.getIntroImg());
|
||||
// advanceOrderVO.setPhotoProductsSnapshot(photoProductsSnapshot);
|
||||
// }
|
||||
Page<AdvanceOrderVO> voPage = new Page<>();
|
||||
voPage.setRecords(advanceOrderVOS);
|
||||
voPage.setTotal(page.getTotal());
|
||||
|
@ -260,12 +254,6 @@ public class AdvanceOrderController {
|
|||
QueryWrapper<AdvanceOrder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("userId", userId);
|
||||
List<AdvanceOrder> advanceOrderList = advanceOrderService.list(queryWrapper);
|
||||
// TODO
|
||||
// for (AdvanceOrder advanceOrder : advanceOrderList) {
|
||||
// PhotoProductsSnapshot photoProductsSnapshot = advanceOrder.getPhotoProductsSnapshot();
|
||||
// photoProductsSnapshot.setIntroImg(FileConstant.SERVER_HOST + photoProductsSnapshot.getIntroImg());
|
||||
// advanceOrder.setPhotoProductsSnapshot(photoProductsSnapshot);
|
||||
// }
|
||||
// 封装成写真预约订单VO
|
||||
List<AdvanceOrderVO> advanceOrderVOS = commonService.convertList(advanceOrderList, AdvanceOrderVO.class);
|
||||
Collections.reverse(advanceOrderVOS);
|
||||
|
|
|
@ -23,7 +23,6 @@ import com.cultural.heritage.service.user.UserService;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -128,11 +127,10 @@ public class PendingServiceGoodController {
|
|||
*/
|
||||
@PostMapping("/list/advance/count")
|
||||
@Operation(summary = "小程序端用户查看当前预约人数", description = "参数:服务类商品预约情况查询请求体,权限:管理员(admin, boss),方法名:listOrder")
|
||||
public BaseResponse<Map<String, Integer>> getCurrentBookingNumberMap(@RequestBody CommonRequest commonRequest, HttpServletRequest request) {
|
||||
public BaseResponse<Map<String, Integer>> getCurrentBookingNumberMap(@RequestBody CommonRequest commonRequest) {
|
||||
if (commonRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
userService.getLoginUser(request);
|
||||
Long id = commonRequest.getId();
|
||||
// 获取当前服务类商品的预约时间段
|
||||
List<PendingServiceGood> pendingServiceGoodList = commonService.findByFieldEqTargetField("goodId", id, pendingServiceGoodService);
|
||||
|
|
|
@ -146,8 +146,6 @@ public class UserController {
|
|||
@Operation(summary = "小程序端用户获取登录信息", description = "参数:无,权限:所有人, 方法名:getLoginUser")
|
||||
public BaseResponse<UserVO> getLoginUser(HttpServletRequest request) {
|
||||
User user = userService.getLoginUser(request);
|
||||
// TODO
|
||||
// user.setUserAvatar(FileConstant.SERVER_HOST + user.getUserAvatar());
|
||||
return ResultUtils.success(userService.getUserVO(user));
|
||||
}
|
||||
|
||||
|
@ -162,8 +160,6 @@ public class UserController {
|
|||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<User> getWebLoginUser(HttpServletRequest request) {
|
||||
User user = userService.getLoginUser(request);
|
||||
// TODO
|
||||
// user.setUserAvatar(FileConstant.SERVER_HOST + user.getUserAvatar());
|
||||
return ResultUtils.success(user);
|
||||
}
|
||||
|
||||
|
@ -324,10 +320,6 @@ public class UserController {
|
|||
QueryWrapper<User> queryWrapper = userService.getQueryWrapper(userQueryRequest);
|
||||
Page<User> page = userService.page(new Page<>(current, pageSize), queryWrapper);
|
||||
List<User> userList = page.getRecords();
|
||||
// TODO
|
||||
// for (User user : userList) {
|
||||
// user.setUserAvatar(FileConstant.SERVER_HOST + user.getUserAvatar());
|
||||
// }
|
||||
page.setRecords(userList);
|
||||
return ResultUtils.success(page);
|
||||
}
|
||||
|
@ -354,10 +346,6 @@ public class UserController {
|
|||
|
||||
Page<UserVO> userVOPage = new Page<>(current, pageSize, userPage.getTotal());
|
||||
List<UserVO> userVOS = userService.getUserVO(userPage.getRecords());
|
||||
// TODO
|
||||
// for (UserVO userVO : userVOS) {
|
||||
// userVO.setUserAvatar(FileConstant.SERVER_HOST + userVO);
|
||||
// }
|
||||
userVOPage.setRecords(userVOS);
|
||||
return ResultUtils.success(userVOPage);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package com.cultural.heritage.model.vo.good;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class GoodLabelVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 商品编号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 商品类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 商品图片
|
||||
*/
|
||||
private String goodImg;
|
||||
|
||||
/**
|
||||
* 商品简介
|
||||
*/
|
||||
private String intro;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.cultural.heritage.model.vo.good;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class GoodTypeVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 类别图片
|
||||
*/
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
private List<GoodLabelVO> goodLabelVOList;
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -29,10 +29,7 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
|
@ -118,6 +115,17 @@ public class CartExperienceServiceImpl extends ServiceImpl<CartExperienceMapper,
|
|||
|
||||
// 获取商品列表
|
||||
List<Good> goodList = commonService.findByFieldInTargetField(cartExperienceList, goodService, CartExperience::getGoodId, "id");
|
||||
List<Long> goodIds = goodList.stream().map(Good::getId).toList();
|
||||
// 移除购物车中不存在的商品项
|
||||
List<Long> errorCartIds = new ArrayList<>();
|
||||
for (CartExperience cartExperience : cartExperienceList) {
|
||||
Long cartRecordId = cartExperience.getId();
|
||||
Long goodId = cartExperience.getGoodId();
|
||||
if (!goodIds.contains(goodId)) errorCartIds.add(cartRecordId);
|
||||
}
|
||||
// 删除购物车中的商品项
|
||||
this.removeBatchByIds(errorCartIds);
|
||||
|
||||
// 封装map集合(键:商品id, 值:商品详情信息)
|
||||
Map<Long, Good> map = new HashMap<>();
|
||||
for (Good good : goodList) {
|
||||
|
@ -134,8 +142,6 @@ public class CartExperienceServiceImpl extends ServiceImpl<CartExperienceMapper,
|
|||
BeanUtils.copyProperties(good, cartExperienceGoodVO);
|
||||
|
||||
cartExperienceVO.setCartExperienceGoodVO(cartExperienceGoodVO);
|
||||
// TODO
|
||||
// cartExperienceGoodVO.setGoodImg(FileConstant.SERVER_HOST + cartExperienceGoodVO.getGoodImg());
|
||||
return cartExperienceVO;
|
||||
}).toList();
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -97,6 +98,18 @@ public class CartRecordServiceImpl extends ServiceImpl<CartRecordMapper, CartRec
|
|||
|
||||
// 获取所有商品列表
|
||||
List<Good> goodList = commonService.findByFieldInTargetField(list, goodService, CartRecord::getGoodId, "id");
|
||||
List<Long> goodIds = goodList.stream().map(Good::getId).toList();
|
||||
// 移除购物车中不存在的商品项
|
||||
List<Long> errorCartIds = new ArrayList<>();
|
||||
for (CartRecord cartRecord : list) {
|
||||
Long cartRecordId = cartRecord.getId();
|
||||
Long goodId = cartRecord.getGoodId();
|
||||
if (!goodIds.contains(goodId)) errorCartIds.add(cartRecordId);
|
||||
}
|
||||
// 删除购物车中的商品项
|
||||
this.removeBatchByIds(errorCartIds);
|
||||
|
||||
|
||||
// 封装map集合(键:商品id, 值:商品详情信息)
|
||||
Map<Long, Good> map = new HashMap<>();
|
||||
for (Good good : goodList) {
|
||||
|
@ -113,8 +126,6 @@ public class CartRecordServiceImpl extends ServiceImpl<CartRecordMapper, CartRec
|
|||
Good good = map.get(goodId);
|
||||
CartGoodVO goodVO = new CartGoodVO();
|
||||
BeanUtils.copyProperties(good, goodVO);
|
||||
// TODO
|
||||
// goodVO.setGoodImg(FileConstant.SERVER_HOST + goodVO.getGoodImg());
|
||||
cartRecordVO.setCartGoodVO(goodVO);
|
||||
return cartRecordVO;
|
||||
}).toList();
|
||||
|
|
|
@ -76,6 +76,7 @@ springdoc:
|
|||
|
||||
server:
|
||||
port: 9092
|
||||
# port: 8888
|
||||
# ssl:
|
||||
# key-store: classpath:carboner.cn.jks
|
||||
# key-store-password: 6gsn1hke4m4f7
|
||||
|
|
Loading…
Reference in New Issue
Block a user