|
|
@@ -294,8 +294,8 @@ public class KwpGoodsService {
|
|
|
* @return: void
|
|
|
*/
|
|
|
private void judgeParameters(@NotNull UpdateGoodsParam param) {
|
|
|
- if (StringUtils.isBlank(param.getName()) || param.getName().length() > 100) {
|
|
|
- throw new BusinessException("商品名称不能为空且最长100字符!");
|
|
|
+ if (StringUtils.isBlank(param.getName()) || param.getName().length() > 50) {
|
|
|
+ throw new BusinessException("商品名称不能为空且最长50字符!");
|
|
|
}
|
|
|
if (StringUtils.isBlank(param.getGoodsType())) {
|
|
|
throw new BusinessException("商品类型不能为空!");
|
|
|
@@ -303,14 +303,14 @@ public class KwpGoodsService {
|
|
|
if (StringUtils.isBlank(param.getUnit())) {
|
|
|
throw new BusinessException("计量单位不能为空!");
|
|
|
}
|
|
|
- if (StringUtils.isBlank(param.getSpec())) {
|
|
|
+ if (StringUtils.isBlank(param.getSpec()) || param.getSpec().length() > 20) {
|
|
|
throw new BusinessException("规格尺寸不能为空!");
|
|
|
}
|
|
|
if (Objects.isNull(param.getAmount()) || param.getAmount().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
throw new BusinessException("库存数量不能为空且最小为零!");
|
|
|
}
|
|
|
- if (Objects.isNull(param.getTaxRate())) {
|
|
|
- throw new BusinessException("发票税率不能为空!");
|
|
|
+ if (Objects.isNull(param.getTaxRate())|| param.getTaxRate().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
+ throw new BusinessException("发票税率不能为空最小为零!");
|
|
|
}
|
|
|
if (StringUtils.isBlank(param.getTrading())) {
|
|
|
throw new BusinessException("交易方式不能为空!");
|
|
|
@@ -322,11 +322,11 @@ public class KwpGoodsService {
|
|
|
List<GoodsAttributes> attributes = param.getAttributes();
|
|
|
if (CollectionUtils.isNotEmpty(attributes)) {
|
|
|
attributes.forEach(e -> {
|
|
|
- if (StringUtils.isBlank(e.getName()) || e.getName().length() > 40) {
|
|
|
- throw new BusinessException("参数名称不能为空且最长40字符!");
|
|
|
+ if (StringUtils.isBlank(e.getName()) || e.getName().length() > 10) {
|
|
|
+ throw new BusinessException("参数名称不能为空且最长10字符!");
|
|
|
}
|
|
|
- if (StringUtils.isBlank(e.getVal()) || e.getVal().length() > 40) {
|
|
|
- throw new BusinessException("参数值不能为空且最长40字符!");
|
|
|
+ if (StringUtils.isBlank(e.getVal()) || e.getVal().length() > 20) {
|
|
|
+ throw new BusinessException("参数值不能为空且最长20字符!");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -363,8 +363,8 @@ public class KwpGoodsService {
|
|
|
if (Objects.isNull(address)) {
|
|
|
throw new BusinessException("地址信息不能为空!");
|
|
|
}
|
|
|
- if (StringUtils.isBlank(address.getName()) || address.getName().length() > 60) {
|
|
|
- throw new BusinessException("参数名称不能为空且最长60字符!");
|
|
|
+ if (StringUtils.isBlank(address.getName()) || address.getName().length() > 50) {
|
|
|
+ throw new BusinessException("地址名称不能为空且最长50字符!");
|
|
|
}
|
|
|
if (StringUtils.isBlank(address.getType())) {
|
|
|
throw new BusinessException("地址类型不能为空!");
|
|
|
@@ -405,8 +405,8 @@ public class KwpGoodsService {
|
|
|
* @Param params:
|
|
|
* @return: java.util.List<com.sckw.product.model.vo.res.GoodsList>
|
|
|
*/
|
|
|
- public PageResult select(SelectGoodsListParam params, Boolean isPage) {
|
|
|
- IPage<KwpGoods> goodsIpage = getGoodsLists(params, isPage);
|
|
|
+ public PageResult select(SelectGoodsListParam params) {
|
|
|
+ IPage<KwpGoods> goodsIpage = getGoodsLists(params, true);
|
|
|
List<KwpGoods> goodsLists = goodsIpage.getRecords();
|
|
|
if (CollectionUtils.isEmpty(goodsLists)) {
|
|
|
return PageResult.build(params.getPage(), params.getPageSize(), goodsIpage.getTotal(), Collections.emptyList());
|
|
|
@@ -472,7 +472,7 @@ public class KwpGoodsService {
|
|
|
.le(Objects.nonNull(params.getEndCreateTime()), KwpGoods::getCreateTime, params.getEndCreateTime())
|
|
|
.eq(StringUtils.isNotBlank(params.getTrading()), KwpGoods::getTrading, params.getTrading())
|
|
|
.eq(StringUtils.isNotBlank(params.getGoodsType()), KwpGoods::getGoodsType, params.getGoodsType())
|
|
|
- .eq(Objects.nonNull(params.getStatus()), KwpGoods::getStatus, params.getStatus());
|
|
|
+ .eq(Objects.nonNull(params.getStatus()) && isPage, KwpGoods::getStatus, params.getStatus());
|
|
|
if (StringUtils.isNotBlank(params.getKeywords())) {
|
|
|
List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByName(params.getKeywords());
|
|
|
List<Long> entIds = entList.stream().map(EntCacheResDto::getId).toList();
|
|
|
@@ -529,7 +529,7 @@ public class KwpGoodsService {
|
|
|
* @return: void
|
|
|
*/
|
|
|
public List<GoodsListExport> export(ExportGoodsListParam params) {
|
|
|
- PageResult pageResult = select(BeanUtils.copyProperties(params, SelectGoodsListParam.class), false);
|
|
|
+ PageResult pageResult = select(BeanUtils.copyProperties(params, SelectGoodsListParam.class));
|
|
|
List<GoodsList> goodsLists = pageResult.getList();
|
|
|
if (CollectionUtils.isEmpty(goodsLists)) {
|
|
|
return Collections.emptyList();
|