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

@@ -28,7 +28,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -207,13 +206,30 @@ public class KioskServiceImpl implements IKioskApiService {
orderDetail.setCategoryType(category.getType());
orderDetail.setCategoryName(category.getName());
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)) {
throw new ServiceException("Invalid material.");
}
orderDetail.setMaterial(materialTypeValue);
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)) {
throw new ServiceException("Invalid size.");
}
@@ -232,6 +248,9 @@ public class KioskServiceImpl implements IKioskApiService {
orderDetail.setStyle(styleTypeValue);
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.setBackPrintFont(item.getPrintBack().getFont());
orderDetail.setBackPrintSize(item.getPrintBack().getSize());
@@ -240,17 +259,10 @@ public class KioskServiceImpl implements IKioskApiService {
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 (priceList.getStand() != 1) {
throw new ServiceException("Invalid extra stand.");
}
orderDetail.setStand(1);
detailAmount = detailAmount.add(priceList.getStandPrice());
}
@@ -350,10 +362,7 @@ public class KioskServiceImpl implements IKioskApiService {
@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::getStatus, 1)
List<PriceListEntity> list = priceListService.list(Wrappers.<PriceListEntity>lambdaQuery().eq(PriceListEntity::getIsDeleted, 0).eq(PriceListEntity::getCategoryId, id).eq(PriceListEntity::getStatus, 1)
// .eq(PriceListEntity::getDeptId, Long.valueOf(AuthUtil.getDeptId())));
.eq(PriceListEntity::getDeptId, -1));
return list.stream().map(p -> {