1.change category attribution
This commit is contained in:
2025-11-13 15:12:31 +08:00
parent 449328c726
commit 547b9dde7c
10 changed files with 242 additions and 66 deletions

View File

@@ -97,6 +97,18 @@ public class KioskApiController {
return R.data(list);
}
/**
* 风格目录查询
*
* @return List<DictBizApiVO>
*/
@GetMapping("/style-list")
@Operation(summary = "风格目录")
public R<List<DictBizApiVO>> styleList() {
List<DictBizApiVO> list = kioskApiService.styleList();
return R.data(list);
}
/**
* 生成上传地址
*

View File

@@ -48,7 +48,7 @@
<if test="priceList.csize !=null">
and kpl.size = #{csize}
</if>
order by kpl.price, kc.type
order by kpl.original_price, kc.type
</select>
<select id="selectPriceList" resultType="org.springblade.modules.kiosk.pojo.vo.PriceListVO">
@@ -74,14 +74,16 @@
<if test="csize !=null">
and kpl.size = #{csize}
</if>
order by kpl.price, kc.type
<if test="style !=null">
and kpl.style = #{style}
</if>
order by kpl.original_price, kc.type
</select>
<insert id="initWallByCrossJoin">
INSERT INTO kiosk_price_list (category_id, shape, material, size, dept_id, tenant_id, create_user, create_dept,
INSERT INTO kiosk_price_list (category_id, material, size, dept_id, tenant_id, create_user, create_dept,
create_time, update_user, update_time)
SELECT c.id AS category_id,
c.shape AS shape,
CAST(m.dict_key AS SIGNED) AS material,
CAST(s.dict_key AS SIGNED) AS size,
#{targetDept} AS dept_id,

View File

@@ -23,8 +23,8 @@ public class OrderApiRequest implements Serializable {
@Data
public static class Item {
@NotNull(message = "category is missing")
private Long category;
@NotNull(message = "priceList is missing")
private Long priceList;
@NotEmpty(message = "snapshot is missing")
private Long snapshot;
@@ -32,15 +32,14 @@ public class OrderApiRequest implements Serializable {
@NotEmpty(message = "photos is missing")
private List<Photo> photos = List.of();
@NotNull(message = "size is missing")
private Integer size;
private Text printBack;
@NotNull(message = "material is missing")
private Integer material;
private Boolean extraStand;
private Integer shape;
private Boolean sizeUp;
private Boolean materialUp;
private List<Long> accessories = List.of();
}
@Data
@@ -49,6 +48,12 @@ public class OrderApiRequest implements Serializable {
private String content;
private String font;
private Integer size;
private Boolean bold;
private Boolean italic;
}
@Data

View File

@@ -68,10 +68,5 @@ public class CategoryEntity extends TenantEntity {
*/
@Schema(description = "照片数量")
private Integer photoLimit;
/**
* 形状
*/
@Schema(description = "形状")
private String shape;
}

View File

@@ -77,15 +77,70 @@ public class PriceListEntity extends TenantEntity {
@Schema(description = "尺寸")
private Integer size;
/**
* 单价
* 尺寸描述
*/
@Schema(description = "单价")
@Schema(description = "尺寸描述")
private String sizeDescription;
/**
* 风格
*/
@Schema(description = "风格")
private Integer style;
/**
* 货币单位
*/
@Schema(description = "货币单位")
private String currency;
/**
* 单价
* 原价
*/
@Schema(description = "单价")
private BigDecimal price;
@Schema(description = "原价")
private BigDecimal originalPrice;
/**
* 售价
*/
@Schema(description = "售价")
private BigDecimal actualPrice;
/**
* 背面打印
*/
@Schema(description = "背面打印")
private Integer backPrint;
/**
* 背面打印价格
*/
@Schema(description = "背面打印价格")
private BigDecimal backPrintPrice;
/**
* 尺寸升级
*/
@Schema(description = "尺寸升级")
private Integer sizeUpgrade;
/**
* 尺寸升级价格
*/
@Schema(description = "尺寸升级价格")
private BigDecimal sizeUpgradePrice;
/**
* 材质升级
*/
@Schema(description = "材质升级")
private Integer materialUpgrade;
/**
* 材质升级价格
*/
@Schema(description = "材质升级价格")
private BigDecimal materialUpgradePrice;
/**
* 支架
*/
@Schema(description = "支架")
private Integer stand;
/**
* 支架价格
*/
@Schema(description = "支架价格")
private BigDecimal standPrice;
/**
* 目标部门
*/

View File

@@ -44,14 +44,38 @@ public class PriceListApiVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long id;
private Integer shape;
private Integer size;
private String sizeDescription;
private Integer material;
private Integer style;
private String currency;
private BigDecimal price;
private BigDecimal originalPrice;
private BigDecimal actualPrice;
private Integer backPrint;
private BigDecimal backPrintPrice;
private Integer sizeUpgrade;
private BigDecimal sizeUpgradePrice;
private Integer materialUpgrade;
private BigDecimal materialUpgradePrice;
private Integer stand;
private BigDecimal standPrice;
}

View File

@@ -74,15 +74,70 @@ public class PriceListVO extends TenantEntity {
@Schema(description = "尺寸")
private Integer csize;
/**
* 单价
* 尺寸描述
*/
@Schema(description = "单价")
@Schema(description = "尺寸描述")
private String sizeDescription;
/**
* 风格
*/
@Schema(description = "风格")
private Integer style;
/**
* 货币单位
*/
@Schema(description = "货币单位")
private String currency;
/**
* 单价
* 原价
*/
@Schema(description = "单价")
private BigDecimal price;
@Schema(description = "原价")
private BigDecimal originalPrice;
/**
* 售价
*/
@Schema(description = "售价")
private BigDecimal actualPrice;
/**
* 背面打印
*/
@Schema(description = "背面打印")
private Integer printBack;
/**
* 背面打印价格
*/
@Schema(description = "背面打印价格")
private BigDecimal printBackPrice;
/**
* 尺寸升级
*/
@Schema(description = "尺寸升级")
private Integer sizeUpgrade;
/**
* 尺寸升级价格
*/
@Schema(description = "尺寸升级价格")
private BigDecimal sizeUpgradePrice;
/**
* 材质升级
*/
@Schema(description = "材质升级")
private Integer materialUpgrade;
/**
* 材质升级价格
*/
@Schema(description = "材质升级价格")
private BigDecimal materialUpgradePrice;
/**
* 支架
*/
@Schema(description = "支架")
private Integer stand;
/**
* 支架价格
*/
@Schema(description = "支架价格")
private BigDecimal standPrice;
/**
* 目标部门
*/

View File

@@ -29,6 +29,8 @@ public interface IKioskApiService {
List<DictBizApiVO> shapeList();
List<DictBizApiVO> styleList();
Long upload(String fileName, InputStream stream);
List<PriceListApiVO> priceList(Long id);

View File

@@ -69,6 +69,8 @@ public class KioskServiceImpl implements IKioskApiService {
private static final String materialType = "material_type";
private static final String styleType = "style_type";
private static final String categoryType = "category_type";
private static final String autoCleanKey = "kiosk.default.autoCleanSeconds";
@@ -187,31 +189,33 @@ public class KioskServiceImpl implements IKioskApiService {
OrderDetailEntity orderDetail = new OrderDetailEntity();
orderDetail.setOrderId(order.getId());
CategoryEntity category = categoryService.getById(item.getCategory());
PriceListEntity priceList = priceListService.getById(item.getPriceList());
if (priceList == null) {
throw new ServiceException("Invalid price.");
}
CategoryEntity category = categoryService.getById(priceList.getCategoryId());
if (category == null) {
throw new ServiceException("Invalid category.");
}
if (category.getType() == 1 && item.getShape() == null) {
throw new ServiceException("Invalid shape.");
}
orderDetail.setCategoryId(item.getCategory());
orderDetail.setCategoryId(priceList.getCategoryId());
orderDetail.setCategoryType(category.getType());
orderDetail.setCategoryName(category.getName());
String materialTypeValue = dictService.getValue(materialType, String.valueOf(item.getMaterial()));
String materialTypeValue = dictService.getValue(materialType, String.valueOf(priceList.getMaterial()));
if (StringUtil.isBlank(materialTypeValue)) {
throw new ServiceException("Invalid material.");
}
orderDetail.setMaterial(materialTypeValue);
String sizeTypeValue = dictService.getValue(sizeType, String.valueOf(item.getSize()));
String sizeTypeValue = dictService.getValue(sizeType, String.valueOf(priceList.getSize()));
if (StringUtil.isBlank(sizeTypeValue)) {
throw new ServiceException("Invalid size.");
}
orderDetail.setSize(sizeTypeValue);
String shapeTypeKey = category.getType() == 1 ? String.valueOf(item.getShape()) : category.getShape();
String shapeTypeValue = dictService.getValue(shapeType, shapeTypeKey);
String shapeTypeValue = dictService.getValue(shapeType, String.valueOf(priceList.getShape()));
if (StringUtil.isBlank(shapeTypeValue)) {
throw new ServiceException("Invalid shape.");
}
@@ -223,17 +227,9 @@ public class KioskServiceImpl implements IKioskApiService {
}
orderDetail.setSnapshotLink(snapshotPhoto.getLink());
PriceListEntity price = priceListService.getOne(Wrappers.<PriceListEntity>lambdaQuery()
.eq(PriceListEntity::getCategoryId, category.getId())
.eq(PriceListEntity::getShape, Integer.valueOf(shapeTypeKey))
.eq(PriceListEntity::getSize, item.getSize())
.eq(PriceListEntity::getMaterial, item.getMaterial())
);
if (price == null) {
throw new ServiceException("Invalid price.");
}
orderDetail.setTotalAmount(price.getPrice());
totalAmount.add(price.getPrice());
orderDetail.setTotalAmount(priceList.getActualPrice());
totalAmount.add(priceList.getActualPrice());
orderDetailService.save(orderDetail);
item.getPhotos().forEach(photo -> photoAttachmentService.createPhotoDetail(photo, orderDetail.getId()));
@@ -289,6 +285,16 @@ public class KioskServiceImpl implements IKioskApiService {
}).toList();
}
@Override
public List<DictBizApiVO> styleList() {
return dictService.getList(styleType).stream().map(dictBiz -> {
DictBizApiVO vo = new DictBizApiVO();
vo.setKey(dictBiz.getDictKey());
vo.setValue(dictBiz.getDictValue());
return vo;
}).toList();
}
@Override
public Long upload(String fileName, InputStream stream) {
BladeUser user = AuthUtil.getUser();
@@ -320,9 +326,19 @@ public class KioskServiceImpl implements IKioskApiService {
PriceListApiVO vo = new PriceListApiVO();
vo.setShape(p.getShape());
vo.setSize(p.getSize());
vo.setSizeDescription(p.getSizeDescription());
vo.setMaterial(p.getMaterial());
vo.setCurrency(p.getCurrency());
vo.setPrice(p.getPrice());
vo.setOriginalPrice(p.getOriginalPrice());
vo.setActualPrice(p.getActualPrice());
vo.setBackPrint(p.getBackPrint());
vo.setBackPrintPrice(p.getBackPrintPrice());
vo.setSizeUpgrade(p.getSizeUpgrade());
vo.setSizeUpgradePrice(p.getSizeUpgradePrice());
vo.setMaterialUpgrade(p.getMaterialUpgrade());
vo.setMaterialUpgradePrice(p.getMaterialUpgradePrice());
vo.setStand(p.getStand());
vo.setStandPrice(p.getStandPrice());
return vo;
}).toList();
}