|
|
@@ -29,7 +29,6 @@ import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
-import org.jetbrains.annotations.NotNull;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -61,20 +60,21 @@ public class KwpGoodsService {
|
|
|
* @desc: 添加草稿商品
|
|
|
* @author: yzc
|
|
|
* @date: 2023-07-03 9:30
|
|
|
- * @Param addGoodsParam:
|
|
|
+ * @Param param:
|
|
|
* @return: void
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void addDraft(AddGoodsParam addGoodsParam) {
|
|
|
+ public void addDraft(AddGoodsDraftParam param) {
|
|
|
Long entId = LoginUserHolder.getEntId();
|
|
|
//添加商品信息
|
|
|
- KwpGoods goods = BeanUtils.copyProperties(addGoodsParam, KwpGoods.class);
|
|
|
- if (Objects.nonNull(addGoodsParam.getAddressInfo())) {
|
|
|
- Integer cityCode = addGoodsParam.getAddressInfo().getCityCode();
|
|
|
+ KwpGoods goods = BeanUtils.copyProperties(param, KwpGoods.class);
|
|
|
+ if (Objects.nonNull(param.getAddressInfo())) {
|
|
|
+ Integer cityCode = param.getAddressInfo().getCityCode();
|
|
|
goods.setAreaCode(cityCode);
|
|
|
}
|
|
|
goods.setEntId(entId).setStatus(GoodsStatusEnum.SAVED.getCode());
|
|
|
kwpGoodsMapper.insert(goods);
|
|
|
+ AddGoodsParam addGoodsParam = BeanUtils.copyProperties(param, AddGoodsParam.class);
|
|
|
addGoodsOtherInfo(goods.getId(), addGoodsParam);
|
|
|
}
|
|
|
|
|
|
@@ -289,9 +289,9 @@ public class KwpGoodsService {
|
|
|
* @Param param:
|
|
|
* @return: void
|
|
|
*/
|
|
|
- private void judgeParameters(@NotNull UpdateGoodsParam param) {
|
|
|
- if (StringUtils.isBlank(param.getName()) || param.getName().length() > 50) {
|
|
|
- throw new BusinessException("商品名称不能为空且最长50字符!");
|
|
|
+ private void judgeParameters(UpdateGoodsParam param) {
|
|
|
+ if (StringUtils.isBlank(param.getName())) {
|
|
|
+ throw new BusinessException("商品名称不能为空且!");
|
|
|
}
|
|
|
if (StringUtils.isBlank(param.getGoodsType())) {
|
|
|
throw new BusinessException("商品类型不能为空!");
|
|
|
@@ -299,11 +299,11 @@ public class KwpGoodsService {
|
|
|
if (StringUtils.isBlank(param.getUnit())) {
|
|
|
throw new BusinessException("计量单位不能为空!");
|
|
|
}
|
|
|
- if (StringUtils.isBlank(param.getSpec()) || param.getSpec().length() > 20) {
|
|
|
+ if (StringUtils.isBlank(param.getSpec())) {
|
|
|
throw new BusinessException("规格尺寸不能为空!");
|
|
|
}
|
|
|
- if (Objects.isNull(param.getAmount()) || param.getAmount().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
- throw new BusinessException("库存数量不能为空且最小为零!");
|
|
|
+ if (Objects.isNull(param.getAmount())) {
|
|
|
+ throw new BusinessException("库存数量不能为空!");
|
|
|
}
|
|
|
if (StringUtils.isBlank(param.getTaxRate())) {
|
|
|
throw new BusinessException("发票税率不能为空!");
|
|
|
@@ -318,11 +318,8 @@ public class KwpGoodsService {
|
|
|
List<GoodsAttributes> attributes = param.getAttributes();
|
|
|
if (CollectionUtils.isNotEmpty(attributes)) {
|
|
|
attributes.forEach(e -> {
|
|
|
- if (StringUtils.isBlank(e.getName()) || e.getName().length() > 10) {
|
|
|
- throw new BusinessException("参数名称不能为空且最长10字符!");
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(e.getVal()) || e.getVal().length() > 20) {
|
|
|
- throw new BusinessException("参数值不能为空且最长20字符!");
|
|
|
+ if (StringUtils.isBlank(e.getName()) || StringUtils.isBlank(e.getVal())) {
|
|
|
+ throw new BusinessException("参数名称或参数值不能为空且!");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -389,9 +386,6 @@ public class KwpGoodsService {
|
|
|
if (Objects.isNull(param.getManager())) {
|
|
|
throw new BusinessException("客户经理不能为空!");
|
|
|
}
|
|
|
- if (StringUtils.isNotBlank(param.getRemark()) && param.getRemark().length() > 200) {
|
|
|
- throw new BusinessException("备注最多支持200字!");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
/**
|