1. add price list api
This commit is contained in:
2025-10-13 23:33:50 +08:00
parent 06be2dd60f
commit 46163400ac
4 changed files with 92 additions and 14 deletions

View File

@@ -7,10 +7,7 @@ import lombok.SneakyThrows;
import org.springblade.core.secure.annotation.PreAuth; import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.modules.kiosk.pojo.dto.OrderApiRequest; import org.springblade.modules.kiosk.pojo.dto.OrderApiRequest;
import org.springblade.modules.kiosk.pojo.vo.CategoryApiVO; import org.springblade.modules.kiosk.pojo.vo.*;
import org.springblade.modules.kiosk.pojo.vo.DictBizApiVO;
import org.springblade.modules.kiosk.pojo.vo.PhotoAttachmentApiVO;
import org.springblade.modules.kiosk.pojo.vo.StickersApiVO;
import org.springblade.modules.kiosk.service.IKioskApiService; import org.springblade.modules.kiosk.service.IKioskApiService;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -134,4 +131,16 @@ public class KioskApiController {
public R<Long> upload(@RequestParam MultipartFile file) { public R<Long> upload(@RequestParam MultipartFile file) {
return R.data(kioskApiService.upload(file.getOriginalFilename(), file.getInputStream())); return R.data(kioskApiService.upload(file.getOriginalFilename(), file.getInputStream()));
} }
/**
* 价格查询
*
* @return List<DictBizApiVO>
*/
@GetMapping("/price-list")
@Operation(summary = "形状目录")
public R<List<PriceListApiVO>> shapeList(Long id) {
List<PriceListApiVO> list = kioskApiService.priceList(id);
return R.data(list);
}
} }

View File

@@ -0,0 +1,57 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.kiosk.pojo.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.modules.kiosk.pojo.entity.PriceListEntity;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 自助终端价格表 视图实体类
*
* @author Ray
* @since 2025-10-13
*/
@Data
public class PriceListApiVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Integer shape;
private Integer size;
private Integer material;
private String currency;
private BigDecimal price;
}

View File

@@ -1,10 +1,7 @@
package org.springblade.modules.kiosk.service; package org.springblade.modules.kiosk.service;
import org.springblade.modules.kiosk.pojo.dto.OrderApiRequest; import org.springblade.modules.kiosk.pojo.dto.OrderApiRequest;
import org.springblade.modules.kiosk.pojo.vo.CategoryApiVO; import org.springblade.modules.kiosk.pojo.vo.*;
import org.springblade.modules.kiosk.pojo.vo.DictBizApiVO;
import org.springblade.modules.kiosk.pojo.vo.PhotoAttachmentApiVO;
import org.springblade.modules.kiosk.pojo.vo.StickersApiVO;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
@@ -32,4 +29,5 @@ public interface IKioskApiService {
Long upload(String fileName, InputStream stream); Long upload(String fileName, InputStream stream);
List<PriceListApiVO> priceList(Long id);
} }

View File

@@ -12,10 +12,7 @@ import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.*; import org.springblade.core.tool.utils.*;
import org.springblade.modules.kiosk.pojo.dto.OrderApiRequest; import org.springblade.modules.kiosk.pojo.dto.OrderApiRequest;
import org.springblade.modules.kiosk.pojo.entity.*; import org.springblade.modules.kiosk.pojo.entity.*;
import org.springblade.modules.kiosk.pojo.vo.CategoryApiVO; import org.springblade.modules.kiosk.pojo.vo.*;
import org.springblade.modules.kiosk.pojo.vo.DictBizApiVO;
import org.springblade.modules.kiosk.pojo.vo.PhotoAttachmentApiVO;
import org.springblade.modules.kiosk.pojo.vo.StickersApiVO;
import org.springblade.modules.kiosk.service.*; import org.springblade.modules.kiosk.service.*;
import org.springblade.modules.system.pojo.entity.User; import org.springblade.modules.system.pojo.entity.User;
import org.springblade.modules.system.service.IDictBizService; import org.springblade.modules.system.service.IDictBizService;
@@ -45,14 +42,14 @@ public class KioskServiceImpl implements IKioskApiService {
private final IPhotoAttachmentService photoAttachmentService; private final IPhotoAttachmentService photoAttachmentService;
private final IOrderService orderService; private final IOrderService orderService;
private final IOrderDetailService orderDetailService; private final IOrderDetailService orderDetailService;
private final IStickersService stickersService; private final IStickersService stickersService;
private final IPriceListService priceListService;
private static final String codePrefix = "kiosk:upload:code:"; private static final String codePrefix = "kiosk:upload:code:";
@@ -256,4 +253,21 @@ public class KioskServiceImpl implements IKioskApiService {
return photoAttachmentEntity.getId(); return photoAttachmentEntity.getId();
} }
@Override
public List<PriceListApiVO> priceList(Long id) {
List<PriceListEntity> list = priceListService.list(Wrappers.<PriceListEntity>lambdaQuery()
.eq(PriceListEntity::getIsDeleted, 0)
.eq(PriceListEntity::getCategoryId, id)
.eq(PriceListEntity::getDeptId, Long.valueOf(AuthUtil.getDeptId())));
return list.stream().map(p -> {
PriceListApiVO vo = new PriceListApiVO();
vo.setShape(p.getShape());
vo.setSize(p.getSize());
vo.setMaterial(p.getMaterial());
vo.setCurrency(p.getCurrency());
vo.setPrice(p.getPrice());
return vo;
}).toList();
}
} }