1.change category attribution
This commit is contained in:
2025-11-16 00:05:02 +08:00
parent b324537556
commit 17b88e5042
2 changed files with 25 additions and 16 deletions

View File

@@ -130,7 +130,7 @@ CREATE TABLE `kiosk_order_detail`
`order_id` bigint NOT NULL COMMENT 'oid', `order_id` bigint NOT NULL COMMENT 'oid',
`category_id` bigint NOT NULL COMMENT 'cid', `category_id` bigint NOT NULL COMMENT 'cid',
`category_type` int NOT NULL DEFAULT 1 COMMENT '产品类型 1:单张 2:组合', `category_type` int NOT NULL DEFAULT 1 COMMENT '产品类型 1:单张 2:组合',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品名称', `category_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品名称',
`material` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '材质', `material` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '材质',
`size` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '尺寸', `size` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '尺寸',
`shape` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '形状', `shape` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '形状',

View File

@@ -28,7 +28,6 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -207,13 +206,30 @@ public class KioskServiceImpl implements IKioskApiService {
orderDetail.setCategoryType(category.getType()); orderDetail.setCategoryType(category.getType());
orderDetail.setCategoryName(category.getName()); orderDetail.setCategoryName(category.getName());
String materialTypeValue = dictService.getValue(materialType, String.valueOf(priceList.getMaterial())); String materialTypeValue = dictService.getValue(materialType, String.valueOf(priceList.getMaterial()));
if (item.getMaterialUp()) {
if (priceList.getMaterialUpgrade() != 1) {
throw new ServiceException("Invalid material up.");
}
orderDetail.setMaterialUpgrade(1);
materialTypeValue = dictService.getValue(materialType, String.valueOf(priceList.getMaterialUpgradeTo()));
detailAmount = detailAmount.add(priceList.getMaterialUpgradePrice());
}
if (StringUtil.isBlank(materialTypeValue)) { if (StringUtil.isBlank(materialTypeValue)) {
throw new ServiceException("Invalid material."); throw new ServiceException("Invalid material.");
} }
orderDetail.setMaterial(materialTypeValue); orderDetail.setMaterial(materialTypeValue);
String sizeTypeValue = dictService.getValue(sizeType, String.valueOf(priceList.getSize())); String sizeTypeValue = dictService.getValue(sizeType, String.valueOf(priceList.getSize()));
if (item.getSizeUp()) {
if (priceList.getSizeUpgrade() != 1) {
throw new ServiceException("Invalid size up.");
}
orderDetail.setSizeUpgrade(1);
sizeTypeValue = dictService.getValue(sizeType, String.valueOf(priceList.getSizeUpgradeTo()));
detailAmount = detailAmount.add(priceList.getSizeUpgradePrice());
}
if (StringUtil.isBlank(sizeTypeValue)) { if (StringUtil.isBlank(sizeTypeValue)) {
throw new ServiceException("Invalid size."); throw new ServiceException("Invalid size.");
} }
@@ -232,6 +248,9 @@ public class KioskServiceImpl implements IKioskApiService {
orderDetail.setStyle(styleTypeValue); orderDetail.setStyle(styleTypeValue);
if (item.getPrintBack() != null && StringUtil.isNotBlank(item.getPrintBack().getContent())) { if (item.getPrintBack() != null && StringUtil.isNotBlank(item.getPrintBack().getContent())) {
if (priceList.getBackPrint() != 1) {
throw new ServiceException("Invalid print back.");
}
orderDetail.setBackPrint(item.getPrintBack().getContent()); orderDetail.setBackPrint(item.getPrintBack().getContent());
orderDetail.setBackPrintFont(item.getPrintBack().getFont()); orderDetail.setBackPrintFont(item.getPrintBack().getFont());
orderDetail.setBackPrintSize(item.getPrintBack().getSize()); orderDetail.setBackPrintSize(item.getPrintBack().getSize());
@@ -240,17 +259,10 @@ public class KioskServiceImpl implements IKioskApiService {
detailAmount = detailAmount.add(priceList.getBackPrintPrice()); detailAmount = detailAmount.add(priceList.getBackPrintPrice());
} }
if (item.getSizeUp()) {
orderDetail.setSizeUpgrade(1);
detailAmount = detailAmount.add(priceList.getSizeUpgradePrice());
}
if (item.getMaterialUp()) {
orderDetail.setMaterialUpgrade(1);
detailAmount = detailAmount.add(priceList.getMaterialUpgradePrice());
}
if (item.getExtraStand()) { if (item.getExtraStand()) {
if (priceList.getStand() != 1) {
throw new ServiceException("Invalid extra stand.");
}
orderDetail.setStand(1); orderDetail.setStand(1);
detailAmount = detailAmount.add(priceList.getStandPrice()); detailAmount = detailAmount.add(priceList.getStandPrice());
} }
@@ -350,10 +362,7 @@ public class KioskServiceImpl implements IKioskApiService {
@Override @Override
public List<PriceListApiVO> priceList(Long id) { public List<PriceListApiVO> priceList(Long id) {
List<PriceListEntity> list = priceListService.list(Wrappers.<PriceListEntity>lambdaQuery() List<PriceListEntity> list = priceListService.list(Wrappers.<PriceListEntity>lambdaQuery().eq(PriceListEntity::getIsDeleted, 0).eq(PriceListEntity::getCategoryId, id).eq(PriceListEntity::getStatus, 1)
.eq(PriceListEntity::getIsDeleted, 0)
.eq(PriceListEntity::getCategoryId, id)
.eq(PriceListEntity::getStatus, 1)
// .eq(PriceListEntity::getDeptId, Long.valueOf(AuthUtil.getDeptId()))); // .eq(PriceListEntity::getDeptId, Long.valueOf(AuthUtil.getDeptId())));
.eq(PriceListEntity::getDeptId, -1)); .eq(PriceListEntity::getDeptId, -1));
return list.stream().map(p -> { return list.stream().map(p -> {