商品耗材关联关系 问题
This commit is contained in:
parent
6838854209
commit
03f40c4ae7
|
|
@ -1139,25 +1139,14 @@ public class ShopSyncServiceImpl implements ShopSyncService {
|
||||||
for (Long shopId : shopIds) {
|
for (Long shopId : shopIds) {
|
||||||
Product product = productService.queryChain().eq(Product::getSyncId, sourceProdId).eq(Product::getShopId, shopId).one();
|
Product product = productService.queryChain().eq(Product::getSyncId, sourceProdId).eq(Product::getShopId, shopId).one();
|
||||||
if (product != null) {
|
if (product != null) {
|
||||||
List<ConsInfo> newCons = new ArrayList<>();
|
prodConsRelationService.remove(QueryWrapper.create()
|
||||||
if (CollUtil.isEmpty(list)) {
|
.eq(ProdConsRelation::getShopId, shopId)
|
||||||
newCons = consInfoService.queryChain()
|
.eq(ProdConsRelation::getProductId, product.getId()));
|
||||||
.isNotNull(ConsInfo::getSyncId).eq(ConsInfo::getShopId, shopId).list();
|
if(CollUtil.isNotEmpty(list)){
|
||||||
if (CollUtil.isNotEmpty(newCons)) {
|
|
||||||
prodConsRelationService.remove(QueryWrapper.create()
|
|
||||||
.eq(ProdConsRelation::getShopId, shopId)
|
|
||||||
.eq(ProdConsRelation::getProductId, product.getId())
|
|
||||||
.in(ProdConsRelation::getConsInfoId, newCons.stream().map(ConsInfo::getId).collect(Collectors.toList())));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Map<Long, BigDecimal> map = list.stream().collect(Collectors.toMap(ProdConsRelation::getConsInfoId, ProdConsRelation::getSurplusStock));
|
Map<Long, BigDecimal> map = list.stream().collect(Collectors.toMap(ProdConsRelation::getConsInfoId, ProdConsRelation::getSurplusStock));
|
||||||
newCons = consInfoService.queryChain()
|
List<ConsInfo> newCons = consInfoService.queryChain()
|
||||||
.in(ConsInfo::getSyncId, map.keySet()).eq(ConsInfo::getShopId, shopId).list();
|
.in(ConsInfo::getSyncId, map.keySet()).eq(ConsInfo::getShopId, shopId).list();
|
||||||
if (CollUtil.isNotEmpty(newCons)) {
|
if (CollUtil.isNotEmpty(newCons)) {
|
||||||
prodConsRelationService.remove(QueryWrapper.create()
|
|
||||||
.eq(ProdConsRelation::getShopId, shopId)
|
|
||||||
.eq(ProdConsRelation::getProductId, product.getId())
|
|
||||||
.in(ProdConsRelation::getConsInfoId, newCons.stream().map(ConsInfo::getId).collect(Collectors.toList())));
|
|
||||||
for (ConsInfo newCon : newCons) {
|
for (ConsInfo newCon : newCons) {
|
||||||
ProdConsRelation prodConsRelation = new ProdConsRelation();
|
ProdConsRelation prodConsRelation = new ProdConsRelation();
|
||||||
prodConsRelation.setShopId(shopId);
|
prodConsRelation.setShopId(shopId);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue