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