打印设备 分类Id问题

This commit is contained in:
2026-04-16 09:56:27 +08:00
parent 2b3b76f6ef
commit 710cca65d6

View File

@@ -2,7 +2,6 @@ package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.czg.account.entity.PrintMachine;
import com.czg.account.service.PrintMachineService;
import com.czg.exception.CzgException;
@@ -23,13 +22,9 @@ public class PrintMachineServiceImpl extends ServiceImpl<PrintMachineMapper, Pri
@Override
public boolean add(Long shopId, PrintMachine dto) {
dto.setShopId(shopId);
//分类打印选择部分打印时必传JsonArray字符串数据 如:[{"id":125,"name":"意式咖啡"},{"id":127,"name":"饮品"}]
if ("1".equals(dto.getClassifyPrint())) {
if (StrUtil.isBlank(dto.getCategoryIds()) || dto.getCategoryIds().length() < 3) {
throw new CzgException("分类打印选择部分打印时,必须勾选需要部分打印的菜品");
}
if (!JSONUtil.isTypeJSONArray(dto.getCategoryIds())) {
throw new CzgException("传递的部分打印菜品数据不合法");
if (StrUtil.isBlank(dto.getCategoryIds())) {
throw new CzgException("分类打印选择部分打印时,必须勾选需要部分打印的分类");
}
} else {
dto.setCategoryIds(null);
@@ -41,11 +36,8 @@ public class PrintMachineServiceImpl extends ServiceImpl<PrintMachineMapper, Pri
public Boolean edit(Long shopId, PrintMachine printerEditDTO) {
printerEditDTO.setShopId(shopId);
if ("1".equals(printerEditDTO.getClassifyPrint())) {
if (StrUtil.isBlank(printerEditDTO.getCategoryIds()) || printerEditDTO.getCategoryIds().length() < 3) {
throw new CzgException("分类打印选择部分打印时,必须勾选需要部分打印的菜品");
}
if (!JSONUtil.isTypeJSONArray(printerEditDTO.getCategoryIds())) {
throw new CzgException("传递的部分打印菜品数据不合法");
if (StrUtil.isBlank(printerEditDTO.getCategoryIds())) {
throw new CzgException("分类打印选择部分打印时,必须勾选需要部分打印的分类");
}
} else {
printerEditDTO.setCategoryIds(null);