feat:更新对运费模板的name长度判断

This commit is contained in:
SUCH HAVE YOU 2024-11-08 15:13:51 +08:00
parent dbe494fad8
commit 99a399b245

View file

@ -4,7 +4,6 @@
package com.skyeye.delivery.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -72,15 +71,18 @@ public class ShopDeliveryTemplateServiceImpl extends SkyeyeBusinessServiceImpl<S
public void validatorEntity(ShopDeliveryTemplate shopDeliveryTemplate) {
super.validatorEntity(shopDeliveryTemplate);
if (StrUtil.isNotEmpty(shopDeliveryTemplate.getName()) || shopDeliveryTemplate.getName().length() <= 100) {
throw new CustomException("运费模板名称过长: " + shopDeliveryTemplate.getName());
if (StrUtil.isNotEmpty(shopDeliveryTemplate.getName()) && shopDeliveryTemplate.getName().length() > 100) {
throw new CustomException("运费模板名称过长");
}
if (!(shopDeliveryTemplate.getOrderBy() instanceof Integer)){
throw new CustomException("排序值类型错误,请输入整数数字");
}
//判断StoreId是否存在
if (StrUtil.isNotEmpty(shopDeliveryTemplate.getStoreId())) {
ShopStore shopStore = shopStoreService.selectById(shopDeliveryTemplate.getStoreId());
//判断shopStore是否为空如果为空则抛出异常
if (StrUtil.isNotEmpty(shopStore.getId())) {
throw new CustomException("门店不存在: " + shopDeliveryTemplate.getName());
throw new CustomException("门店不存在: " + shopStore);
}
}
}