|
@@ -1503,11 +1503,15 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
,getOneFree = false,promotion = false,halfPrice = false;
|
|
|
|
|
|
List<String> topicList = new ArrayList<>(); // 记录有哪些营销活动的topic
|
|
|
- Map<String,Long> mkaIdMap = new HashMap<>(); // 记录topic跟mkaId的关系
|
|
|
+ Map<String,String> mkaIdMap = new HashMap<>(); // 记录topic跟mkaId的关系
|
|
|
// 将所有的营销活动新增到list中
|
|
|
for(MkActivitiesEntity mkActivitiesEntity : mkActivitiesEntityList){
|
|
|
topicList.add(mkActivitiesEntity.getMkaTopic());
|
|
|
- mkaIdMap.put(mkActivitiesEntity.getMkaTopic(),mkActivitiesEntity.getMkaId());
|
|
|
+ String mkaId = mkaIdMap.putIfAbsent(mkActivitiesEntity.getMkaTopic(), mkActivitiesEntity.getMkaId()+"");
|
|
|
+ if(StringUtils.isNotEmpty(mkaId)){
|
|
|
+ mkaId = "'"+mkaId + "','" + mkActivitiesEntity.getMkaId()+"'";
|
|
|
+ mkaIdMap.put(mkActivitiesEntity.getMkaTopic(),mkaId);
|
|
|
+ }
|
|
|
}
|
|
|
// 判断有哪些营销活动
|
|
|
if(topicList.contains("zhjsp")) // 组合价
|
|
@@ -1549,7 +1553,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
* TODO
|
|
|
*/
|
|
|
if(combinationPrice){
|
|
|
- Long mkaId = mkaIdMap.get("zhjsp");
|
|
|
+ String mkaId = mkaIdMap.get("zhjsp");
|
|
|
Map<String,Object> param = new HashMap<>();
|
|
|
param.put("mkaId",mkaId);
|
|
|
param.put("prodBarcode",prodBarcode);
|
|
@@ -1575,7 +1579,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
*/
|
|
|
Map<String,Object> fullReductionMap = new HashMap<>();
|
|
|
if(fullReduction){
|
|
|
- Long mkaId = mkaIdMap.get("mj");
|
|
|
+ String mkaId = mkaIdMap.get("mj");
|
|
|
MkActivitiesFullReductionEntity fullReductionEntity = fullReductionService.queryByCodeOrBrand(mkaId,prodBarcode,brandName,nowTime);
|
|
|
if(fullReductionEntity != null) {
|
|
|
if(!StringUtils.isNullOrEmpty(fullReductionEntity.getProductBrand())){
|
|
@@ -1599,7 +1603,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
*/
|
|
|
Map<String,Object> fullGiftMap = new HashMap<>();
|
|
|
if(fullGift){
|
|
|
- Long mkaId = mkaIdMap.get("mz");
|
|
|
+ String mkaId = mkaIdMap.get("mz");
|
|
|
MkActivitiesFullGiftEntity giftEntity = fullGiftService.queryByCodeOrBrand(mkaId,prodBarcode,brandName,nowTime);
|
|
|
if(giftEntity != null) {
|
|
|
if(giftEntity.getProductBrand() != null){
|
|
@@ -1625,7 +1629,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
* key 商品条码 value 赠品条码
|
|
|
*/
|
|
|
if(getOneFree){
|
|
|
- Long mkaId = mkaIdMap.get("mysy");
|
|
|
+ String mkaId = mkaIdMap.get("mysy");
|
|
|
MkActivitiesGetOneFreeGoodsEntity getOneFreeGoodsEntity = getOneFreeGoodsService.queryByCodeOrBrand(mkaId,prodBarcode,brandName);
|
|
|
if(getOneFreeGoodsEntity != null){
|
|
|
if("无".equals(getOneFreeGoodsEntity.getProductBrand())){
|
|
@@ -1642,7 +1646,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
|
|
|
// 第二份半价
|
|
|
if(halfPrice){
|
|
|
- Long mkaId = mkaIdMap.get("drjbj");
|
|
|
+ String mkaId = mkaIdMap.get("drjbj");
|
|
|
MkActivitiesHalfPriceEntity activitiesHalfPriceEntity = halfPriceService.queryByCodeOrBrand(mkaId,prodBarcode);
|
|
|
if(activitiesHalfPriceEntity != null){
|
|
|
skuActivitiesMap.put("drjbj",activitiesHalfPriceEntity);
|
|
@@ -1659,7 +1663,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
*/
|
|
|
|
|
|
if(coupon){
|
|
|
- Long mkaId = mkaIdMap.get("yhq");
|
|
|
+ String mkaId = mkaIdMap.get("yhq");
|
|
|
MkActivitiesCouponEntity couponEntity = couponService.queryByBarCode(mkaId,prodBarcode,nowTime);
|
|
|
if(couponEntity != null){ // 优惠券码,优惠金额
|
|
|
Map<String,Object> returnMap = new HashMap<>();
|
|
@@ -1674,7 +1678,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
*/
|
|
|
|
|
|
if(discount){
|
|
|
- Long mkaId = mkaIdMap.get("dz");
|
|
|
+ String mkaId = mkaIdMap.get("dz");
|
|
|
MkActivitiesDiscountEntity discountEntity = discountService.queryByBarCode(mkaId,prodBarcode);
|
|
|
// TODO 可能会直接替代产品价格
|
|
|
if (discountEntity != null) {
|
|
@@ -1692,7 +1696,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
* 日常活动跟着条形码走,优先级比临时促销低,但是高于正常价格
|
|
|
*/
|
|
|
if(daily){
|
|
|
- Long mkaId = mkaIdMap.get("rchd");
|
|
|
+ String mkaId = mkaIdMap.get("rchd");
|
|
|
MkDailyActivitiesEntity dailyActivitiesEntity = dailyActivitiesService.queryByBarCode(mkaId,prodBarcode);
|
|
|
if(dailyActivitiesEntity != null){
|
|
|
goods.setActualPaymentAmount(dailyActivitiesEntity.getActivityPrice());
|
|
@@ -1710,7 +1714,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
* 临时促销跟着条形码走,优先级应该最高,所以排到了最下面
|
|
|
*/
|
|
|
if(promotion){
|
|
|
- Long mkaId = mkaIdMap.get("lscx");
|
|
|
+ String mkaId = mkaIdMap.get("lscx");
|
|
|
MkActivitiesPromotionEntity promotionEntity = promotionService.queryByBarCode(mkaId,prodBarcode);
|
|
|
// 如果该商品存在临时促销,直接替换活动价格
|
|
|
if(promotionEntity != null){
|