|
@ -68,6 +68,7 @@ public class GoodsSpuController { |
|
|
private GoodsCategoryService goodsCategoryService; |
|
|
private GoodsCategoryService goodsCategoryService; |
|
|
private SeeYonRequestBaseService seeYonRequestBaseService; |
|
|
private SeeYonRequestBaseService seeYonRequestBaseService; |
|
|
private ErpDispatchDataMapper dispatchDataMapper; |
|
|
private ErpDispatchDataMapper dispatchDataMapper; |
|
|
|
|
|
private GoodsAccreditService goodsAccreditService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -134,7 +135,51 @@ public class GoodsSpuController { |
|
|
return R.error("供应商不存在或停用"); |
|
|
return R.error("供应商不存在或停用"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//规则设置
|
|
|
//客户规则设置
|
|
|
|
|
|
this.toSetSpuParam(param, supplier); |
|
|
|
|
|
//产品规则设置
|
|
|
|
|
|
this.tiSetSpuParam2(param, supplier); |
|
|
|
|
|
|
|
|
|
|
|
Long total = goodsSpuService.selectCountSkuJoinSpuList(param); |
|
|
|
|
|
if(total<1){ |
|
|
|
|
|
return R.byEmptyList(); |
|
|
|
|
|
} |
|
|
|
|
|
List<GoodsSpu> list = goodsSpuService.selectSkuJoinSpuList(param); |
|
|
|
|
|
for (GoodsSpu spu : list) { |
|
|
|
|
|
spu.setUuid(spu.getId()+"_"+spu.getSkuId()); |
|
|
|
|
|
} |
|
|
|
|
|
List<String> skuCodes = list.stream().map(GoodsSpu::getSkuCode).collect(Collectors.toList()); |
|
|
|
|
|
this.initSpuWithCustomerPrice(param.getSupplierCode(), list, skuCodes); |
|
|
|
|
|
return R.byPageList(total,list); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void tiSetSpuParam2(GoodsSpu param, BmsSupplier supplier) { |
|
|
|
|
|
List<GoodsAccredit> goodsAccreditList = goodsAccreditService |
|
|
|
|
|
.listIgnoreAcc(supplier.getId(), supplier.listBizRegionIds(), supplier.listSaleRegionIds()); |
|
|
|
|
|
Set<Long> spuIds = goodsAccreditList.stream().map(GoodsAccredit::getSpuId).collect(Collectors.toSet()); |
|
|
|
|
|
Set<String> cateIds = goodsAccreditList.stream().map(GoodsAccredit::getCategoryId).collect(Collectors.toSet()); |
|
|
|
|
|
if(CollUtil.isNotEmpty(cateIds)){ |
|
|
|
|
|
if(CollUtil.isEmpty(param.getSelectNotIntCateIds())){ |
|
|
|
|
|
param.setSelectNotIntCateIds(new ArrayList<>(cateIds)); |
|
|
|
|
|
}else{ |
|
|
|
|
|
param.getSelectNotIntCateIds().addAll(cateIds); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if(CollUtil.isNotEmpty(spuIds)){ |
|
|
|
|
|
if (CollUtil.isEmpty(param.getSelectNotInIds())){ |
|
|
|
|
|
param.setSelectNotInIds(new ArrayList<>(spuIds)); |
|
|
|
|
|
}else{ |
|
|
|
|
|
param.getSelectNotInIds().addAll(spuIds); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 设置Spu查询条件 |
|
|
|
|
|
* @param param |
|
|
|
|
|
* @param supplier |
|
|
|
|
|
*/ |
|
|
|
|
|
private void toSetSpuParam(GoodsSpu param, BmsSupplier supplier) { |
|
|
List<GoodsRuleItem> ruleItems = goodsRuleService.listBySupplierId(supplier.getId()); |
|
|
List<GoodsRuleItem> ruleItems = goodsRuleService.listBySupplierId(supplier.getId()); |
|
|
GoodsRuleItemDTO ruleItemDTO = goodsRuleService.buildGoodsRuleItemDTO(ruleItems); |
|
|
GoodsRuleItemDTO ruleItemDTO = goodsRuleService.buildGoodsRuleItemDTO(ruleItems); |
|
|
if(ruleItemDTO!=null){ |
|
|
if(ruleItemDTO!=null){ |
|
@ -212,19 +257,6 @@ public class GoodsSpuController { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Long total = goodsSpuService.selectCountSkuJoinSpuList(param); |
|
|
|
|
|
if(total<1){ |
|
|
|
|
|
return R.byEmptyList(); |
|
|
|
|
|
} |
|
|
|
|
|
List<GoodsSpu> list = goodsSpuService.selectSkuJoinSpuList(param); |
|
|
|
|
|
for (GoodsSpu spu : list) { |
|
|
|
|
|
spu.setUuid(spu.getId()+"_"+spu.getSkuId()); |
|
|
|
|
|
} |
|
|
|
|
|
List<String> skuCodes = list.stream().map(GoodsSpu::getSkuCode).collect(Collectors.toList()); |
|
|
|
|
|
this.initSpuWithCustomerPrice(param.getSupplierCode(), list, skuCodes); |
|
|
|
|
|
return R.byPageList(total,list); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|