店铺管理-店铺配置:打印机设置相关接口
This commit is contained in:
@@ -62,10 +62,15 @@ public class ShopPrinterDTO implements Serializable {
|
||||
private String shopId;
|
||||
|
||||
/**
|
||||
* 冗余/遗留字段
|
||||
* 部分分类id 用逗号隔开,部分打印时必传,如:1,2,3
|
||||
*/
|
||||
private String categoryIds;
|
||||
|
||||
/**
|
||||
* 部分分类列表 分类打印选择部分打印时必传,JsonArray字符串数据 如:[{"id":125,"name":"意式咖啡"},{"id":127,"name":"饮品"}]
|
||||
*/
|
||||
private String categoryList;
|
||||
|
||||
/**
|
||||
* 打印机品牌
|
||||
* 云想印 = yxyPrinter
|
||||
|
||||
@@ -6,7 +6,9 @@ import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.map.MapProxy;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.ysk.cashier.dto.shop.ShopPrinterDTO;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbPrintMachineMapper;
|
||||
import cn.ysk.cashier.pojo.shop.TbPrintMachineEntity;
|
||||
import cn.ysk.cashier.service.shop.ShopPrinterService;
|
||||
@@ -99,6 +101,21 @@ public class ShopPrinterServiceImpl extends ServiceImpl<TbPrintMachineMapper, Tb
|
||||
public void save(ShopPrinterDTO dto) {
|
||||
CopyOptions options = new CopyOptions();
|
||||
options.setIgnoreProperties("createdAt", "updatedAt");
|
||||
//分类打印选择部分打印时必传,JsonArray字符串数据 如:[{"id":125,"name":"意式咖啡"},{"id":127,"name":"饮品"}]
|
||||
if ("1".equals(dto.getClassifyPrint()) || "2".equals(dto.getClassifyPrint())) {
|
||||
if (StrUtil.isBlank(dto.getCategoryList())) {
|
||||
throw new BadRequestException("分类打印选择部分打印时,必须勾选需要部分打印的菜品");
|
||||
}
|
||||
if (JSONUtil.isTypeJSONArray(dto.getCategoryList())) {
|
||||
throw new BadRequestException("传递的部分打印菜品数据不合法");
|
||||
}
|
||||
if (StrUtil.isBlank(dto.getCategoryIds())) {
|
||||
throw new BadRequestException("分类打印选择部分打印时,传递的部分打印菜品id数据不能为空");
|
||||
}
|
||||
} else {
|
||||
dto.setCategoryIds(null);
|
||||
dto.setCategoryList(null);
|
||||
}
|
||||
TbPrintMachineEntity entity = BeanUtil.toBean(dto, TbPrintMachineEntity.class, options);
|
||||
entity.setCreatedAt(System.currentTimeMillis());
|
||||
entity.setUpdatedAt(System.currentTimeMillis());
|
||||
@@ -110,6 +127,21 @@ public class ShopPrinterServiceImpl extends ServiceImpl<TbPrintMachineMapper, Tb
|
||||
TbPrintMachineEntity entity = baseMapper.selectById(dto.getId());
|
||||
CopyOptions options = new CopyOptions();
|
||||
options.setIgnoreProperties("createdAt", "updatedAt");
|
||||
//分类打印选择部分打印时必传,JsonArray字符串数据 如:[{"id":125,"name":"意式咖啡"},{"id":127,"name":"饮品"}]
|
||||
if ("1".equals(dto.getClassifyPrint()) || "2".equals(dto.getClassifyPrint())) {
|
||||
if (StrUtil.isBlank(dto.getCategoryList())) {
|
||||
throw new BadRequestException("分类打印选择部分打印时,必须勾选需要部分打印的菜品");
|
||||
}
|
||||
if (JSONUtil.isTypeJSONArray(dto.getCategoryList())) {
|
||||
throw new BadRequestException("传递的部分打印菜品数据不合法");
|
||||
}
|
||||
if (StrUtil.isBlank(dto.getCategoryIds())) {
|
||||
throw new BadRequestException("分类打印选择部分打印时,传递的部分打印菜品id数据不能为空");
|
||||
}
|
||||
} else {
|
||||
dto.setCategoryIds(null);
|
||||
dto.setCategoryList(null);
|
||||
}
|
||||
BeanUtil.copyProperties(dto, entity, options);
|
||||
entity.setUpdatedAt(System.currentTimeMillis());
|
||||
baseMapper.updateById(entity);
|
||||
|
||||
Reference in New Issue
Block a user