diff --git a/src/main/java/com/cultural/heritage/controller/global/GlobalController.java b/src/main/java/com/cultural/heritage/controller/global/GlobalController.java index 415d713..6b42026 100644 --- a/src/main/java/com/cultural/heritage/controller/global/GlobalController.java +++ b/src/main/java/com/cultural/heritage/controller/global/GlobalController.java @@ -7,10 +7,15 @@ import com.cultural.heritage.common.BaseResponse; import com.cultural.heritage.common.ResultUtils; import com.cultural.heritage.constant.OrderStatusConstant; import com.cultural.heritage.constant.UserConstant; -import com.cultural.heritage.model.entity.AdvanceOrder; -import com.cultural.heritage.model.entity.Good; -import com.cultural.heritage.model.entity.Order; +import com.cultural.heritage.model.entity.*; +import com.cultural.heritage.model.vo.clothes.ClothesLabelVO; +import com.cultural.heritage.model.vo.photoProducts.PhotoProductsLabelVO; import com.cultural.heritage.service.book.AdvanceOrderService; +import com.cultural.heritage.service.book.PhotoCategoryService; +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.GoodService; import com.cultural.heritage.service.order.OrderService; import com.google.gson.Gson; @@ -18,15 +23,13 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @RestController @RequestMapping("/global") @@ -47,6 +50,27 @@ public class GlobalController { private GoodService goodService; + @Resource + private PhotoProductsService photoProductsService; + + + @Resource + private PhotoCategoryService photoCategoryService; + + + @Resource + private ClothesCategoryService clothesCategoryService; + + + @Resource + private ClothesService clothesService; + + + @Resource + private CommonService commonService; + + + /** * Web端管理员查看全局数据 @@ -135,6 +159,63 @@ public class GlobalController { Object obj = gson.fromJson(json, Object.class); return ResultUtils.success(obj); } - + + + + + + /** + * 小程序端获取所有的写真产品和服装产品 + * @return map + */ + @GetMapping("/getAllProducts") + @Operation(summary = "小程序端获取所有的写真产品和服装产品", description = "参数:无,权限:所有人,方法名:getAllPhotoProductsAndClothes") + public BaseResponse> getAllPhotoProductsAndClothes() { + Map> photoProductsMap = new HashMap<>(); + List photoProductsList = commonService.findByFieldEqTargetField("isShelves", 1, photoProductsService); + List photoProductsLabelVOS = commonService.convertList(photoProductsList, PhotoProductsLabelVO.class); + + for (PhotoProductsLabelVO photoProductsLabelVO : photoProductsLabelVOS) { + String categoryName = photoProductsLabelVO.getCategoryName(); + List photoProductsLabelVOList = photoProductsMap.get(categoryName); + if (photoProductsLabelVOList == null) { + photoProductsLabelVOList = new ArrayList<>(); + } + photoProductsLabelVOList.add(photoProductsLabelVO); + photoProductsMap.put(categoryName, photoProductsLabelVOList); + } + + // 获取所有的服装类别 + Map idToName = new HashMap<>(); + List clothesCategoryList = clothesCategoryService.list(); + for (ClothesCategory clothesCategory : clothesCategoryList) { + idToName.put(clothesCategory.getId(), clothesCategory.getName()); + } + + Map> clothesMap = new HashMap<>(); + List clothesList = commonService.findByFieldEqTargetField("isShelves", 1, clothesService); + List clothesLabelVOS = commonService.convertList(clothesList, ClothesLabelVO.class); + + for (ClothesLabelVO clothesLabelVO : clothesLabelVOS) { + Long id = clothesLabelVO.getCategoryId(); + String type = idToName.get(id); + List clothesLabelVOList = clothesMap.get(type); + if (clothesLabelVOList == null) { + clothesLabelVOList = new ArrayList<>(); + } + clothesLabelVOList.add(clothesLabelVO); + clothesMap.put(type, clothesLabelVOList); + } + + Map map = new HashMap<>(); + map.put("clothesMap", clothesMap); + map.put("photoProductsMap", photoProductsMap); + + return ResultUtils.success(map); + } + + + + } diff --git a/src/main/java/com/cultural/heritage/controller/order/ClothesRentOrderController.java b/src/main/java/com/cultural/heritage/controller/order/ClothesRentOrderController.java index 06dfadc..93c75e5 100644 --- a/src/main/java/com/cultural/heritage/controller/order/ClothesRentOrderController.java +++ b/src/main/java/com/cultural/heritage/controller/order/ClothesRentOrderController.java @@ -162,7 +162,7 @@ public class ClothesRentOrderController { * @return 服装租赁订单列表 */ @PostMapping("/list") - @Operation(summary = "Web端管理员分页查询写真预约订单", description = "参数:服装租赁订单查询请求体, 权限:管理员(admin, boss),方法名:listClothesRentOrderByPage") + @Operation(summary = "Web端管理员分页查询服装租赁订单", description = "参数:服装租赁订单查询请求体, 权限:管理员(admin, boss),方法名:listClothesRentOrderByPage") @AuthCheck(mustRole = UserConstant.ADMIN_ROLE) public BaseResponse> listClothesRentOrderByPage(@RequestBody ClothesRentOrderQueryRequest clothesRentOrderQueryRequest) { if (clothesRentOrderQueryRequest == null) { diff --git a/src/main/java/com/cultural/heritage/model/dto/clothesRentOrder/ClothesRentOrderQueryRequest.java b/src/main/java/com/cultural/heritage/model/dto/clothesRentOrder/ClothesRentOrderQueryRequest.java index e555591..909ba4e 100644 --- a/src/main/java/com/cultural/heritage/model/dto/clothesRentOrder/ClothesRentOrderQueryRequest.java +++ b/src/main/java/com/cultural/heritage/model/dto/clothesRentOrder/ClothesRentOrderQueryRequest.java @@ -10,14 +10,23 @@ import java.io.Serializable; @EqualsAndHashCode(callSuper = true) @Data -@Schema(description = "服装租赁订单查询请求体", requiredProperties = {"clothesId", "contactsId", "rentDays"}) +@Schema(description = "服装租赁订单查询请求体", requiredProperties = {"current", "pageSize"}) public class ClothesRentOrderQueryRequest extends PageRequest implements Serializable { + + /** + * 订单id + */ + @Schema(description = "订单id(id > 0)", example = "2") + private String id; + + + /** * 订单号 */ - @Schema(description = "订单号(id > 0)", example = "2432432432342") + @Schema(description = "订单号", example = "2432432432342") private String orderNumber; diff --git a/src/main/java/com/cultural/heritage/model/vo/clothes/ClothesLabelVO.java b/src/main/java/com/cultural/heritage/model/vo/clothes/ClothesLabelVO.java new file mode 100644 index 0000000..2dc6d19 --- /dev/null +++ b/src/main/java/com/cultural/heritage/model/vo/clothes/ClothesLabelVO.java @@ -0,0 +1,40 @@ +package com.cultural.heritage.model.vo.clothes; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class ClothesLabelVO implements Serializable { + + /** + * 编号 + */ + private Long id; + + /** + * 服装名称 + */ + private String name; + + /** + * 类别id + */ + private Long categoryId; + + /** + * 服装图片 + */ + private String image; + + /** + * 价格/天 + */ + private BigDecimal price; + + + @Serial + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/cultural/heritage/model/vo/photoProducts/PhotoProductsLabelVO.java b/src/main/java/com/cultural/heritage/model/vo/photoProducts/PhotoProductsLabelVO.java new file mode 100644 index 0000000..9d703e3 --- /dev/null +++ b/src/main/java/com/cultural/heritage/model/vo/photoProducts/PhotoProductsLabelVO.java @@ -0,0 +1,48 @@ +package com.cultural.heritage.model.vo.photoProducts; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class PhotoProductsLabelVO implements Serializable { + + + + /** + * 产品id + */ + private Long id; + + + /** + * 产品名称 + */ + private String name; + + + /** + * 介绍图片 + */ + private String introImg; + + + /** + * 产品价格 + */ + private BigDecimal price; + + + /** + * 写真类别名称 + */ + private String categoryName; + + + + + @Serial + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/cultural/heritage/service/order/impl/ClothesRentOrderServiceImpl.java b/src/main/java/com/cultural/heritage/service/order/impl/ClothesRentOrderServiceImpl.java index 2d073ca..9ef6cad 100644 --- a/src/main/java/com/cultural/heritage/service/order/impl/ClothesRentOrderServiceImpl.java +++ b/src/main/java/com/cultural/heritage/service/order/impl/ClothesRentOrderServiceImpl.java @@ -34,11 +34,13 @@ public class ClothesRentOrderServiceImpl extends ServiceImpl getQueryWrapper(ClothesRentOrderQueryRequest clothesRentOrderQueryRequest) { + String id = clothesRentOrderQueryRequest.getId(); String orderNumber = clothesRentOrderQueryRequest.getOrderNumber(); String orderStatus = clothesRentOrderQueryRequest.getOrderStatus(); String name = clothesRentOrderQueryRequest.getName(); String phone = clothesRentOrderQueryRequest.getPhone(); QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(ObjectUtils.isNotEmpty(id), "id", id); queryWrapper.eq(StringUtils.isNotBlank(orderNumber), "orderNumber", orderNumber); queryWrapper.eq(StringUtils.isNotBlank(orderStatus), "orderStatus", orderStatus); queryWrapper.like(StringUtils.isNotBlank(name), "JSON_UNQUOTE(JSON_EXTRACT(contactsSnapshot, '$.name'))", name);