文件上传https

This commit is contained in:
chen-xin-zhi 2025-03-22 15:07:28 +08:00
parent 07ac1fca56
commit 6c4037b685
6 changed files with 191 additions and 11 deletions

View File

@ -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端管理员查看全局数据
@ -137,4 +161,61 @@ public class GlobalController {
}
/**
* 小程序端获取所有的写真产品和服装产品
* @return map
*/
@GetMapping("/getAllProducts")
@Operation(summary = "小程序端获取所有的写真产品和服装产品", description = "参数权限所有人方法名getAllPhotoProductsAndClothes")
public BaseResponse<Map<String, Object>> getAllPhotoProductsAndClothes() {
Map<String, List<PhotoProductsLabelVO>> photoProductsMap = new HashMap<>();
List<PhotoProducts> photoProductsList = commonService.findByFieldEqTargetField("isShelves", 1, photoProductsService);
List<PhotoProductsLabelVO> photoProductsLabelVOS = commonService.convertList(photoProductsList, PhotoProductsLabelVO.class);
for (PhotoProductsLabelVO photoProductsLabelVO : photoProductsLabelVOS) {
String categoryName = photoProductsLabelVO.getCategoryName();
List<PhotoProductsLabelVO> photoProductsLabelVOList = photoProductsMap.get(categoryName);
if (photoProductsLabelVOList == null) {
photoProductsLabelVOList = new ArrayList<>();
}
photoProductsLabelVOList.add(photoProductsLabelVO);
photoProductsMap.put(categoryName, photoProductsLabelVOList);
}
// 获取所有的服装类别
Map<Long, String> idToName = new HashMap<>();
List<ClothesCategory> clothesCategoryList = clothesCategoryService.list();
for (ClothesCategory clothesCategory : clothesCategoryList) {
idToName.put(clothesCategory.getId(), clothesCategory.getName());
}
Map<String, List<ClothesLabelVO>> clothesMap = new HashMap<>();
List<Clothes> clothesList = commonService.findByFieldEqTargetField("isShelves", 1, clothesService);
List<ClothesLabelVO> clothesLabelVOS = commonService.convertList(clothesList, ClothesLabelVO.class);
for (ClothesLabelVO clothesLabelVO : clothesLabelVOS) {
Long id = clothesLabelVO.getCategoryId();
String type = idToName.get(id);
List<ClothesLabelVO> clothesLabelVOList = clothesMap.get(type);
if (clothesLabelVOList == null) {
clothesLabelVOList = new ArrayList<>();
}
clothesLabelVOList.add(clothesLabelVO);
clothesMap.put(type, clothesLabelVOList);
}
Map<String, Object> map = new HashMap<>();
map.put("clothesMap", clothesMap);
map.put("photoProductsMap", photoProductsMap);
return ResultUtils.success(map);
}
}

View File

@ -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<Page<ClothesRentOrderVO>> listClothesRentOrderByPage(@RequestBody ClothesRentOrderQueryRequest clothesRentOrderQueryRequest) {
if (clothesRentOrderQueryRequest == null) {

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -34,11 +34,13 @@ public class ClothesRentOrderServiceImpl extends ServiceImpl<ClothesRentOrderMap
*/
@Override
public QueryWrapper<ClothesRentOrder> getQueryWrapper(ClothesRentOrderQueryRequest clothesRentOrderQueryRequest) {
String id = clothesRentOrderQueryRequest.getId();
String orderNumber = clothesRentOrderQueryRequest.getOrderNumber();
String orderStatus = clothesRentOrderQueryRequest.getOrderStatus();
String name = clothesRentOrderQueryRequest.getName();
String phone = clothesRentOrderQueryRequest.getPhone();
QueryWrapper<ClothesRentOrder> 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);