给快递公司,运费模板一些字段设置输入限制

This commit is contained in:
SUCH HAVE YOU 2024-11-08 17:03:22 +08:00
parent 3dc269cf25
commit 15660278f3
4 changed files with 33 additions and 1 deletions

View file

@ -4,6 +4,8 @@
package com.skyeye.adsense.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;
import com.skyeye.adsense.dao.AdsenseDao;
@ -16,6 +18,9 @@ import com.skyeye.common.enumeration.EnableEnum;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.mybatisplus.MybatisPlusUtil;
import com.skyeye.delivery.entity.ShopDeliveryCompany;
import com.skyeye.exception.CustomException;
import com.skyeye.store.entity.ShopStore;
import org.springframework.stereotype.Service;
import java.util.Arrays;
@ -47,4 +52,18 @@ public class AdsenseServiceImpl extends SkyeyeBusinessServiceImpl<AdsenseDao, Ad
List<Adsense> beans = list(queryWrapper);
return JSONUtil.toList(JSONUtil.toJsonStr(beans), null);
}
/**
* 重写新增编辑前置条件广告位管理
*/
@Override
public void validatorEntity(Adsense adsense) {
super.validatorEntity(adsense);
if (StrUtil.isNotEmpty(adsense.getName()) && adsense.getName().length() > 100) {
throw new CustomException("广告位名称过长");
}
if (adsense.getOrderBy() < -128 || adsense.getOrderBy() > 127) {
throw new CustomException("广告位排序值超出范围");
}
}
}

View file

@ -53,7 +53,7 @@ public class ShopDeliveryCompany extends OperatorUserInfo {
@TableField(value = "`order_by`")
@ApiModelProperty(value = "排序",required = "required")
private String orderBy;
private Integer orderBy;
@TableField(value = "`store_id`")
@ApiModelProperty(value = "门店id",required = "required",fuzzyLike = true)

View file

@ -74,6 +74,15 @@ public class ShopDeliveryCompanyServiceImpl extends SkyeyeBusinessServiceImpl<Sh
@Override
public void validatorEntity(ShopDeliveryCompany shopDeliveryCompany) {
super.validatorEntity(shopDeliveryCompany);
if (StrUtil.isNotEmpty(shopDeliveryCompany.getCodeNum()) && shopDeliveryCompany.getCodeNum().length() > 50) {
throw new CustomException("快递公司 code过长");
}
if (StrUtil.isNotEmpty(shopDeliveryCompany.getName()) && shopDeliveryCompany.getName().length() > 50) {
throw new CustomException("快递公司名称过长");
}
if (shopDeliveryCompany.getOrderBy() < -128 || shopDeliveryCompany.getOrderBy() > 127) {
throw new CustomException("运费模板排序值超出范围");
}
//判断StoreId是否存在
if (ObjectUtil.isNotNull(shopDeliveryCompany.getStoreId())) {
ShopStore shopStore = shopStoreService.selectById(shopDeliveryCompany.getStoreId());

View file

@ -73,6 +73,10 @@ public class ShopDeliveryTemplateServiceImpl extends SkyeyeBusinessServiceImpl<S
if (StrUtil.isNotEmpty(shopDeliveryTemplate.getName()) && shopDeliveryTemplate.getName().length() > 100) {
throw new CustomException("运费模板名称过长");
}
if (shopDeliveryTemplate.getOrderBy() < -128 || shopDeliveryTemplate.getOrderBy() > 127) {
throw new CustomException("运费模板排序值超出范围");
}
//判断StoreId是否存在
if (StrUtil.isNotEmpty(shopDeliveryTemplate.getStoreId())) {
ShopStore shopStore = shopStoreService.selectById(shopDeliveryTemplate.getStoreId());