记得上下班打卡 | git大法好,push需谨慎

Commit 89109bde authored by 张国柄's avatar 张国柄

~api:导入:模板/校验调整;

parent 8a550ad4
...@@ -51,7 +51,7 @@ public class GoblinStoreMgtGoodsImportController { ...@@ -51,7 +51,7 @@ public class GoblinStoreMgtGoodsImportController {
String analysisResultMsg; String analysisResultMsg;
try { try {
switch (dataType) { switch (dataType) {
case 1: case 1:// 模板https://img.zhengzai.tv/2022/11/09/shoppingmallimport.xlsx
analysisResultMsg = goblinStoreMgtGoodsImportService.goodsInformationDataAnalysisProcessing(file, currentUid, storeId); analysisResultMsg = goblinStoreMgtGoodsImportService.goodsInformationDataAnalysisProcessing(file, currentUid, storeId);
break; break;
case 2: case 2:
......
...@@ -61,14 +61,14 @@ public class GoblinStoreMgtGoodsImportService { ...@@ -61,14 +61,14 @@ public class GoblinStoreMgtGoodsImportService {
throw new LiquidnetServiceException("-1", String.format("数据内容不规范【第%s行商品编码有误】", rowNum)); throw new LiquidnetServiceException("-1", String.format("数据内容不规范【第%s行商品编码有误】", rowNum));
} }
/* 商品名称校验|------------------------------------------------------------------------------ */ /* 商品名称校验|------------------------------------------------------------------------------ */
if (StringUtils.isEmpty(dto.getSpuName()) || dto.getSpuName().length() > 100) { if (StringUtils.isEmpty(dto.getSpuName()) || dto.getSpuName().length() > 30) {
throw new LiquidnetServiceException("-1", String.format("数据内容不规范【第%s行商品名称有误】", rowNum)); throw new LiquidnetServiceException("-1", String.format("数据内容不规范【第%s行商品名称有误】", rowNum));
} }
/* 商品图片校验|------------------------------------------------------------------------------ */ /* 商品图片校验|------------------------------------------------------------------------------ */
if (StringUtils.isNotEmpty(dto.getSpuImgs())) { if (StringUtils.isNotEmpty(dto.getSpuImgs())) {
if (dto.getSpuImgs().startsWith("【图片链接】")) { if (dto.getSpuImgs().startsWith("【图片链接】")) {
String[] spuImgsArr = dto.getSpuImgs().replace("【图片链接】", "").replace(";", ";").split(";"); String[] spuImgsArr = dto.getSpuImgs().replace("【图片链接】", "").replace(";", ";").split(";");
if (spuImgsArr.length > 15) { if (spuImgsArr.length > 9) {
throw new LiquidnetServiceException("-1", String.format("数据内容不规范【第%s行商品图片最多支持15张】", rowNum)); throw new LiquidnetServiceException("-1", String.format("数据内容不规范【第%s行商品图片最多支持15张】", rowNum));
} }
ArrayList<String> spuImgList = CollectionUtil.arrayListString(); ArrayList<String> spuImgList = CollectionUtil.arrayListString();
...@@ -99,13 +99,16 @@ public class GoblinStoreMgtGoodsImportService { ...@@ -99,13 +99,16 @@ public class GoblinStoreMgtGoodsImportService {
if (ArrayUtils.isEmpty(specArr) || specArr.length != 2 || specArr[0].length() > 5 || specArr[1].length() > 40) { if (ArrayUtils.isEmpty(specArr) || specArr.length != 2 || specArr[0].length() > 5 || specArr[1].length() > 40) {
throw new LiquidnetServiceException("-1", String.format("数据内容不规范【第%s行商品规格信息有误】", rowNum)); throw new LiquidnetServiceException("-1", String.format("数据内容不规范【第%s行商品规格信息有误】", rowNum));
} }
if (skuSpecDtos.size() > 5) {
throw new LiquidnetServiceException("-1", String.format("数据内容不规范【第%s行商品规格项超出5个】", rowNum));
}
GoblinGoodsSpecDto skuSpecDto = GoblinGoodsSpecDto.getNew(); GoblinGoodsSpecDto skuSpecDto = GoblinGoodsSpecDto.getNew();
skuSpecDto.setSpecName(specArr[0]); skuSpecDto.setSpecName(specArr[0]);
skuSpecDto.setSpecVname(specArr[1]); skuSpecDto.setSpecVname(specArr[1]);
skuSpecDtos.add(skuSpecDto); skuSpecDtos.add(skuSpecDto);
dto.setSkuSpecDtos(skuSpecDtos);
} }
dto.setSkuSpecDtos(skuSpecDtos);
/* 规格编码校验|------------------------------------------------------------------------------ */ /* 规格编码校验|------------------------------------------------------------------------------ */
if (StringUtils.isNotEmpty(dto.getSkuCode()) && !Pattern.matches(LnsRegex.Valid.ALPHABET_NUMBER_UNDER_50, dto.getSkuCode())) { if (StringUtils.isNotEmpty(dto.getSkuCode()) && !Pattern.matches(LnsRegex.Valid.ALPHABET_NUMBER_UNDER_50, dto.getSkuCode())) {
throw new LiquidnetServiceException("-1", String.format("数据内容不规范【第%s行规格编码格式有误】", rowNum)); throw new LiquidnetServiceException("-1", String.format("数据内容不规范【第%s行规格编码格式有误】", rowNum));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment