超市导入增加库存效验
This commit is contained in:
1 parent
b1bc0d341d
commit
e1b62b2921
4 files changed
+28
-51
No files matched your search
+18
-15
@@ -13,31 +13,34 @@ public class ErpSpuValidator {
|
||||
List<String> errors = new ArrayList<>();
|
||||
|
||||
if (StringUtils.isEmpty(entity.getProductCode())) {
|
||||
errors.add("第" + (rowIndex + 1) + "行: 货号不能为空");
|
||||
errors.add("第" + (rowIndex ) + "行: 货号不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(entity.getProductName())) {
|
||||
errors.add("第" + (rowIndex + 1) + "行: 商品名称不能为空");
|
||||
errors.add("第" + (rowIndex ) + "行: 商品名称不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(entity.getUnit())) {
|
||||
errors.add("第" + (rowIndex + 1) + "行: 单位不能为空");
|
||||
errors.add("第" + (rowIndex ) + "行: 单位不能为空");
|
||||
}
|
||||
// if (StringUtils.isEmpty(entity.getSpec())) {
|
||||
// errors.add("第" + (rowIndex + 1) + "行: 规格不能为空");
|
||||
// }
|
||||
// if (StringUtils.isEmpty(entity.getClassification())) {
|
||||
// errors.add("第" + (rowIndex + 1) + "行: 分类不能为空");
|
||||
// }
|
||||
// if (StringUtils.isEmpty(entity.getCommodityNature())) {
|
||||
// errors.add("第" + (rowIndex + 1) + "行: 商品性质不能为空");
|
||||
// }
|
||||
// if (StringUtils.isEmpty(entity.getSupplier())) {
|
||||
// errors.add("第" + (rowIndex + 1) + "行: 货商不能为空");
|
||||
// errors.add("第" + (rowIndex ) + "行: 规格不能为空");
|
||||
// }
|
||||
if (null==entity.getStock()) {
|
||||
errors.add("第" + (rowIndex ) + "行: 商品库存不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(entity.getClassification())) {
|
||||
errors.add("第" + (rowIndex ) + "行: 分类不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(entity.getCommodityNature())) {
|
||||
errors.add("第" + (rowIndex ) + "行: 商品性质不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(entity.getSupplier())) {
|
||||
errors.add("第" + (rowIndex ) + "行: 货商不能为空");
|
||||
}
|
||||
if (null==entity.getPurchasePrice()) {
|
||||
errors.add("第" + (rowIndex + 1) + "行: 进价不能为空");
|
||||
errors.add("第" + (rowIndex ) + "行: 进价不能为空");
|
||||
}
|
||||
if (null==entity.getRetailPrice()) {
|
||||
errors.add("第" + (rowIndex + 1) + "行: 零售价不能为空");
|
||||
errors.add("第" + (rowIndex ) + "行: 零售价不能为空");
|
||||
}
|
||||
|
||||
return errors;
|
||||
|
||||
+8
-29
@@ -20,7 +20,6 @@ import com.bsd.pjcloud.supermarket.entity.SmErpSpuEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpStockEntity;
|
||||
import com.bsd.pjcloud.supermarket.entity.SmErpUnitEntity;
|
||||
import com.bsd.pjcloud.supermarket.service.*;
|
||||
import com.bsd.pjcloud.supermarket.task.TaskStoreService;
|
||||
import com.bsd.pjcloud.supermarket.vo.ad.SmErpSpuDetailsVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.ad.SpuVo;
|
||||
import com.bsd.pjcloud.supermarket.vo.erpspu.SmErpSpuSimpleVo;
|
||||
@@ -40,9 +39,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -70,9 +67,6 @@ public class SmErpSpuController {
|
||||
private final SmErpStockService smErpStockService;
|
||||
|
||||
|
||||
private final TaskStoreService taskStoreService;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -125,9 +119,11 @@ public class SmErpSpuController {
|
||||
LambdaQueryWrapper<SmErpStockEntity> smErpStockEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
smErpStockEntityLambdaQueryWrapper.eq(SmErpStockEntity::getErpSpuId, id);
|
||||
SmErpStockEntity smErpStockEntity = smErpStockService.getOne(smErpStockEntityLambdaQueryWrapper);
|
||||
smErpSpuEntity.setStock(smErpStockEntity.getBaseStock());
|
||||
smErpSpuEntity.setInventoryLowerLimit(smErpStockEntity.getInventoryLowerLimit());
|
||||
smErpSpuEntity.setInventoryUpperLimit(smErpStockEntity.getInventoryUpperLimit());
|
||||
if (null != smErpStockEntity){
|
||||
smErpSpuEntity.setStock(smErpStockEntity.getBaseStock());
|
||||
smErpSpuEntity.setInventoryLowerLimit(smErpStockEntity.getInventoryLowerLimit());
|
||||
smErpSpuEntity.setInventoryUpperLimit(smErpStockEntity.getInventoryUpperLimit());
|
||||
}
|
||||
|
||||
List<SmErpUnitEntity> list = smErpUnitService.list(new LambdaQueryWrapper<SmErpUnitEntity>().eq(SmErpUnitEntity::getSpuId, id));
|
||||
smErpSpuEntity.setSmErpUnitEntityList(list);
|
||||
@@ -223,11 +219,10 @@ public class SmErpSpuController {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导入
|
||||
*
|
||||
* @param
|
||||
* @param dtos 导入数据列表
|
||||
* @param bindingResult 错误信息列表
|
||||
* @return R
|
||||
*/
|
||||
@@ -241,10 +236,6 @@ public class SmErpSpuController {
|
||||
return smErpSpuService.importErpSpu(collect, bindingResult);
|
||||
}
|
||||
|
||||
|
||||
// --------APP-----------------
|
||||
|
||||
|
||||
/**
|
||||
* 条件查询spu单表 列表信息
|
||||
* @param supermarketSpuQueryDTO 商品spu
|
||||
@@ -285,24 +276,12 @@ public class SmErpSpuController {
|
||||
* 条件查询spu单表 列表信息
|
||||
* @param supermarketSpuQueryDTO 商品spu
|
||||
* @return
|
||||
*///todo 待完善,返回的参数不全,有问题
|
||||
*/
|
||||
@Operation(summary = "APP根据条件查询分页SPU" , description = "APP条件分页查询" )
|
||||
@PostMapping("/app/selectListAll" )
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')" )
|
||||
public R getSupermarketSpu(@RequestBody SupermarketSpuAppQueryDTO supermarketSpuQueryDTO,@ParameterObject Page page) {
|
||||
return R.ok(smSpuService.getAppPage(page,supermarketSpuQueryDTO));
|
||||
|
||||
// LambdaQueryWrapper<SmErpSpuEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
// wrapper.eq(supermarketSpuQueryDTO.getMerchantId() != null, SmErpSpuEntity::getMerchantId, supermarketSpuQueryDTO.getMerchantId());
|
||||
// wrapper.eq(supermarketSpuQueryDTO.getCategoryId() != null, SmErpSpuEntity::getCategoryId, supermarketSpuQueryDTO.getCategoryId());
|
||||
//// wrapper.eq(StrUtil.isNotBlank(supermarketSpuQueryDTO.getProductCode()), SupermarketSpuEntity::getProductCode, supermarketSpuQueryDTO.getProductCode());
|
||||
//// wrapper.eq(StrUtil.isNotBlank(supermarketSpuQueryDTO.getBarcode()), SupermarketSpuEntity::getBarcode, supermarketSpuQueryDTO.getBarcode());
|
||||
// wrapper.like(StrUtil.isNotBlank(supermarketSpuQueryDTO.getProductName()), SmErpSpuEntity::getProductName, supermarketSpuQueryDTO.getProductName());
|
||||
// Page pageDate = smErpSpuService.page(page, wrapper);
|
||||
// List list = pageDate.getRecords();
|
||||
// List<SupermarketAppSpuVo> bean = BeanUtils.toBean(list, SupermarketAppSpuVo.class);
|
||||
// pageDate.setRecords(bean);
|
||||
// return R.ok(pageDate);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
-5
@@ -102,9 +102,4 @@ public interface SmErpSpuService extends IService<SmErpSpuEntity> {
|
||||
*/
|
||||
R importErpSpu(List<SmErpSpuImportDto> smErpSupplierImportDtos, BindingResult bindingResult);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void asyncExecuteImport(String taskId, List<SmErpSpuImportDto> dtos);
|
||||
}
|
||||
+2
-2
@@ -753,7 +753,7 @@ public class SmErpSpuServiceImpl extends ServiceImpl<SmErpSpuMapper, SmErpSpuEnt
|
||||
smErpSupplierEntityLambdaQueryWrapper.eq(SmErpSupplierEntity::getSupplierName, supplierName);
|
||||
// 1. 查询现有供应商(名称唯一)
|
||||
SmErpSupplierEntity existSupplier = smErpSupplierMapper.selectListByScope(smErpSupplierEntityLambdaQueryWrapper
|
||||
,DataScope.of()
|
||||
,DataScope.of()
|
||||
).get(0);
|
||||
|
||||
if (existSupplier != null) {
|
||||
@@ -922,7 +922,7 @@ public class SmErpSpuServiceImpl extends ServiceImpl<SmErpSpuMapper, SmErpSpuEnt
|
||||
if (category != null) return category.getId();
|
||||
|
||||
SmErpCategoryEntity newCategory = new SmErpCategoryEntity();
|
||||
newCategory.setName(name);
|
||||
newCategory.setName(name);
|
||||
if (smErpCategoryMapper.insert(newCategory) > 0) {
|
||||
return newCategory.getId();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user