活动同步逻辑修改
This commit is contained in:
parent
dcc160e66f
commit
9c0a8428f2
@ -35,6 +35,7 @@ import com.suisung.mall.common.feignService.SearchService;
|
||||
import com.suisung.mall.common.modules.account.AccountUserBase;
|
||||
import com.suisung.mall.common.modules.base.ShopBaseProductBrand;
|
||||
import com.suisung.mall.common.modules.base.ShopBaseProductCategory;
|
||||
import com.suisung.mall.common.modules.product.ShopProductIndex;
|
||||
import com.suisung.mall.common.modules.sixun.SxSyncGoods;
|
||||
import com.suisung.mall.common.modules.sixun.SxSyncVip;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreActivityBase;
|
||||
@ -53,6 +54,7 @@ import com.suisung.mall.shop.base.service.ShopBaseProductSpecService;
|
||||
import com.suisung.mall.shop.number.service.ShopNumberSeqService;
|
||||
import com.suisung.mall.shop.page.service.OssService;
|
||||
import com.suisung.mall.shop.product.service.ShopProductBaseService;
|
||||
import com.suisung.mall.shop.product.service.ShopProductIndexService;
|
||||
import com.suisung.mall.shop.product.service.ShopProductItemService;
|
||||
import com.suisung.mall.shop.product.service.ShopProductSpecItemService;
|
||||
import com.suisung.mall.shop.sixun.dao.SxDataDao;
|
||||
@ -183,6 +185,10 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
@Autowired
|
||||
private ProductMappingService productMappingService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ShopProductIndexService shopProductIndexService;
|
||||
|
||||
/**
|
||||
* 批量保存商品的分类
|
||||
*
|
||||
@ -1007,12 +1013,14 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
Date activityEndtime = jsonObj.getDate("activityEndtime");
|
||||
Integer activityState = jsonObj.getInt("activityState");
|
||||
String flowNo = jsonObj.getStr("flowNo");
|
||||
String activity_remark=jsonObj.getStr("activity_remark");
|
||||
// Date activityReleasetime= jsonObj.getDate("activityReleasetime");
|
||||
BigDecimal discount = jsonObj.getBigDecimal("discount");
|
||||
shopStoreActivityBase.setActivity_state(activityState);
|
||||
shopStoreActivityBase.setActivity_name(activityName);
|
||||
shopStoreActivityBase.setActivity_type(1);//免费参与
|
||||
shopStoreActivityBase.setActivity_title(activityName);
|
||||
shopStoreActivityBase.setActivity_remark(activity_remark);
|
||||
// shopStoreActivityBase.setActivity_releasetime(activityReleasetime);
|
||||
shopStoreActivityBase.setStore_id(storeId);
|
||||
shopStoreActivityBase.setActivity_on_is_off(0);
|
||||
@ -1025,7 +1033,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
shopStoreActivityBase.setFlow_no(flowNo);
|
||||
if (stringIntegerMap.containsKey(flowNo)) {//更新
|
||||
String keyVal = MapUtil.getStr(stringIntegerMap, flowNo);
|
||||
shopStoreActivityBase.setActivity_id(MapUtil.getInt(stringIntegerMap, keyVal.split("_")[0]));
|
||||
shopStoreActivityBase.setActivity_id(Integer.valueOf(keyVal.split("_")[0]));
|
||||
synchronized (updateShopStoreActivityBaseList) {
|
||||
updateShopStoreActivityBaseList.add(shopStoreActivityBase);
|
||||
}
|
||||
@ -1039,7 +1047,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
shopStoreActivityBaseService.saveBatch(addshopStoreActivityBaseList, addshopStoreActivityBaseList.size());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(updateShopStoreActivityBaseList)) {
|
||||
shopStoreActivityBaseService.updateBatchById(updateShopStoreActivityBaseList);
|
||||
shopStoreActivityBaseService.updateBatchById(updateShopStoreActivityBaseList,updateShopStoreActivityBaseList.size());
|
||||
}
|
||||
logger.info("同步活动数据结束:共{}条数据更新,{}条数据新增", updateShopStoreActivityBaseList.size(), addshopStoreActivityBaseList.size());
|
||||
}
|
||||
@ -1110,6 +1118,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
}
|
||||
|
||||
Map<String, Long> shopStoreActvityItems = shopStoreActivityItemService.getExistingActvieShopItem(activityIds, storeId);
|
||||
List<ShopProductIndex> shopProductIndexList=new ArrayList<>();
|
||||
//activity_id, product_id,item_id
|
||||
List<ShopStoreActivityItem> addShopStoreActivityItems = new ArrayList<>();
|
||||
List<ShopStoreActivityItem> updteShopStoreActivityItems = new ArrayList<>();
|
||||
@ -1153,7 +1162,11 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
BigDecimal oldPrice;
|
||||
BigDecimal specPrice;
|
||||
BigDecimal newDiscout = new BigDecimal(1);
|
||||
ShopProductIndex shopProductIndex=new ShopProductIndex();
|
||||
shopProductIndex.setIs_special(null);
|
||||
shopProductIndex.setProduct_id(productId);
|
||||
if (activityTypeId == 1) {//限时秒杀
|
||||
shopProductIndex.setActivity_type_ids(String.valueOf(StateCode.ACTIVITY_TYPE_LIMITED_DISCOUNT));
|
||||
ruleType = ActiveShopJsonUtils.SECKILL;
|
||||
oldPrice = jsonObj.getBigDecimal("oldPrice");
|
||||
specPrice = jsonObj.getBigDecimal("specPrice");
|
||||
@ -1169,6 +1182,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
}
|
||||
ruleType = ActiveShopJsonUtils.DISCOUNT;
|
||||
newItems.addAll(getFulReduItemList(itemIds, ruleType, discount));//获取满减规则的itemid
|
||||
shopProductIndex.setActivity_type_ids(String.valueOf(StateCode.ACTIVITY_TYPE_ONE_PIECE_DISCOUNT));
|
||||
}
|
||||
if (activityTypeId == 3) {//满减
|
||||
ruleType = ActiveShopJsonUtils.FULLREDUCE;
|
||||
@ -1208,6 +1222,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
addShopStoreActivityItems.add(shopStoreActivityItem);
|
||||
}
|
||||
}
|
||||
shopProductIndexList.add(shopProductIndex);
|
||||
}
|
||||
});
|
||||
if (!rulesChe.isEmpty()) {
|
||||
@ -1231,7 +1246,9 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
if(CollectionUtil.isNotEmpty(updteShopStoreActivityItems)){
|
||||
shopStoreActivityItemService.updateBatchById(updteShopStoreActivityItems,updteShopStoreActivityItems.size());
|
||||
}
|
||||
|
||||
if(CollectionUtil.isNotEmpty(shopProductIndexList)){
|
||||
shopProductIndexService.updateBatchById(shopProductIndexList);
|
||||
}
|
||||
logger.info("同步活动商品数据结束:更新共{}条活动数据,商品数据为{}条",updateShopStoreActivityBaseList.size(),jsonArray.size());
|
||||
logger.info("同步活动商品数据结束:新增数据{}条,更新{}条活动数据,商品数据为{}条",addShopStoreActivityItems.size(),updteShopStoreActivityItems.size(),jsonArray.size());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user