记得上下班打卡 | git大法好,push需谨慎

Commit 5fa3b82a authored by 胡佳晨's avatar 胡佳晨

Merge remote-tracking branch 'origin/dev_goblin' into dev_goblin

parents cf9c59b1 8746ddf8
...@@ -92,6 +92,14 @@ public class GoblinFrontSelectGoodsServiceImpl extends ServiceImpl<GoblinFrontSe ...@@ -92,6 +92,14 @@ public class GoblinFrontSelectGoodsServiceImpl extends ServiceImpl<GoblinFrontSe
goblinFrontSelectGoods1.setOrderType(goblinFrontSelectGoods.getOrderType()); goblinFrontSelectGoods1.setOrderType(goblinFrontSelectGoods.getOrderType());
goblinFrontSelectGoodsMapper.insert(goblinFrontSelectGoods1); goblinFrontSelectGoodsMapper.insert(goblinFrontSelectGoods1);
} }
}else{
GoblinFrontSelectGoods goblinFrontSelectGoods1=new GoblinFrontSelectGoods();
goblinFrontSelectGoods1.setUpdateTime(LocalDateTime.now());
goblinFrontSelectGoods1.setDelTag(0);
goblinFrontSelectGoods1.setCreateTime(LocalDateTime.now());
goblinFrontSelectGoods1.setSelectGoodsId(IDGenerator.nextSnowId());
goblinFrontSelectGoods1.setOrderType(goblinFrontSelectGoods.getOrderType());
goblinFrontSelectGoodsMapper.insert(goblinFrontSelectGoods1);
} }
/* if(goblinFrontSelectGoods.getMid()>0){ /* if(goblinFrontSelectGoods.getMid()>0){
goblinFrontSelectGoods.setUpdateTime(LocalDateTime.now()); goblinFrontSelectGoods.setUpdateTime(LocalDateTime.now());
......
...@@ -238,6 +238,7 @@ public class MQConst { ...@@ -238,6 +238,7 @@ public class MQConst {
public enum GoblinQueue { public enum GoblinQueue {
SQL_STORE("goblin:stream:sql.store", "group.sql.ustore", "店铺相关"), SQL_STORE("goblin:stream:sql.store", "group.sql.ustore", "店铺相关"),
SQL_GOODS("goblin:stream:sql.goods", "group.sql.ustore", "商品相关"), SQL_GOODS("goblin:stream:sql.goods", "group.sql.ustore", "商品相关"),
SQL_COUPON("goblin:stream:sql.coupon", "group.sql.ustore", "店铺优惠券相关"),
GOBLIN_STORE_MARKET("goblin:stream:store.market", "group.store.market", "店铺活动"), GOBLIN_STORE_MARKET("goblin:stream:store.market", "group.store.market", "店铺活动"),
GOBLIN_SELF_MARKET("goblin:stream:self.market", "group.self.market", "平台活动"), GOBLIN_SELF_MARKET("goblin:stream:self.market", "group.self.market", "平台活动"),
GOBLIN_ORDER_CREATE_PAY("goblin:stream:order:create_pay", "group.order:create_pay", "订单创建&支付"), GOBLIN_ORDER_CREATE_PAY("goblin:stream:order:create_pay", "group.order:create_pay", "订单创建&支付"),
......
...@@ -39,9 +39,10 @@ public class TestAdam { ...@@ -39,9 +39,10 @@ public class TestAdam {
"adam:info:member:code:GMRGBUQB30", "adam:info:member:code:GMRGBUQB30",
"adam:info:certification:1141181199209160192", "adam:info:certification:1141181199209160192",
"adam:identity:mobile:15529282737", "adam:identity:mobile:18548596019",
"adam:identity:sso:882883", "adam:identity:sso:882883",
"adam:info:user:882883", "adam:info:user:809406",
"adam:info:user:922833055536291845022973",
"adam:morder:2283655", "adam:morder:2283655",
"adam:info:umember:1957341", "adam:info:umember:1957341",
"adam:info:morder:331587681810022407979836", "adam:info:morder:331587681810022407979836",
...@@ -66,6 +67,12 @@ public class TestAdam { ...@@ -66,6 +67,12 @@ public class TestAdam {
"sweet:manual:pushList", "sweet:manual:pushList",
"goblin:sku:relation:226416501783461229",
"goblin:bsc:goods:2264185547679ZZ87427",
"goblin:bsc:goods_sku:226418554767964895ZZ87427",
"goblin:bsc:ustore:809406",
"goblin:bsc:ustore:922833055536291845022973",
"goblin:bsc:store:839fa8dde17b5bf248575370f1249eab",
}; };
for (String key : keys) { for (String key : keys) {
long value = key.hashCode(); long value = key.hashCode();
......
package com.liquidnet.service.consumer.goblin.config; package com.liquidnet.service.consumer.goblin.config;
import com.liquidnet.service.base.constant.MQConst; import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.goblin.receiver.ConsumerGoblinSqlCouponRdsReceiver;
import com.liquidnet.service.consumer.goblin.receiver.ConsumerGoblinSqlGoodsRdsReceiver; import com.liquidnet.service.consumer.goblin.receiver.ConsumerGoblinSqlGoodsRdsReceiver;
import com.liquidnet.service.consumer.goblin.receiver.ConsumerGoblinSqlStoreRdsReceiver; import com.liquidnet.service.consumer.goblin.receiver.ConsumerGoblinSqlStoreRdsReceiver;
import lombok.var; import lombok.var;
...@@ -17,14 +18,14 @@ import org.springframework.data.redis.stream.Subscription; ...@@ -17,14 +18,14 @@ import org.springframework.data.redis.stream.Subscription;
import java.time.Duration; import java.time.Duration;
import static com.liquidnet.service.base.constant.MQConst.AdamQueue;
@Configuration @Configuration
public class ConsumerGoblinSqlUstoreRedisStreamConfig { public class ConsumerGoblinSqlUstoreRedisStreamConfig {
@Autowired @Autowired
ConsumerGoblinSqlStoreRdsReceiver consumerGoblinSqlStoreRdsReceiver; ConsumerGoblinSqlStoreRdsReceiver consumerGoblinSqlStoreRdsReceiver;
@Autowired @Autowired
ConsumerGoblinSqlGoodsRdsReceiver consumerGoblinSqlGoodsRdsReceiver; ConsumerGoblinSqlGoodsRdsReceiver consumerGoblinSqlGoodsRdsReceiver;
@Autowired
ConsumerGoblinSqlCouponRdsReceiver consumerGoblinSqlCouponRdsReceiver;
private StreamMessageListenerContainer<String, MapRecord<String, String, String>> buildStreamMessageListenerContainer(RedisConnectionFactory factory) { private StreamMessageListenerContainer<String, MapRecord<String, String, String>> buildStreamMessageListenerContainer(RedisConnectionFactory factory) {
var options = StreamMessageListenerContainer var options = StreamMessageListenerContainer
...@@ -43,10 +44,8 @@ public class ConsumerGoblinSqlUstoreRedisStreamConfig { ...@@ -43,10 +44,8 @@ public class ConsumerGoblinSqlUstoreRedisStreamConfig {
* @return Subscription * @return Subscription
*/ */
private Subscription receiveSqlStore(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) { private Subscription receiveSqlStore(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck( return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.SQL_STORE.getGroup(), MQConst.GoblinQueue.SQL_STORE.name() + t),
Consumer.from(MQConst.GoblinQueue.SQL_STORE.getGroup(), MQConst.GoblinQueue.SQL_STORE.name() + t), StreamOffset.create(MQConst.GoblinQueue.SQL_STORE.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlStoreRdsReceiver);
StreamOffset.create(MQConst.GoblinQueue.SQL_STORE.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlStoreRdsReceiver
);
} }
/** /**
...@@ -57,10 +56,20 @@ public class ConsumerGoblinSqlUstoreRedisStreamConfig { ...@@ -57,10 +56,20 @@ public class ConsumerGoblinSqlUstoreRedisStreamConfig {
* @return Subscription * @return Subscription
*/ */
private Subscription receiveSqlGoods(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) { private Subscription receiveSqlGoods(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck( return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.SQL_GOODS.getGroup(), MQConst.GoblinQueue.SQL_GOODS.name() + t),
Consumer.from(MQConst.GoblinQueue.SQL_GOODS.getGroup(), MQConst.GoblinQueue.SQL_GOODS.name() + t), StreamOffset.create(MQConst.GoblinQueue.SQL_GOODS.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlGoodsRdsReceiver);
StreamOffset.create(MQConst.GoblinQueue.SQL_GOODS.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlGoodsRdsReceiver }
);
/**
* 店铺优惠券相关
*
* @param listenerContainer StreamMessageListenerContainer
* @param t 消费者序号
* @return Subscription
*/
private Subscription receiveSqlCoupon(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(Consumer.from(MQConst.GoblinQueue.SQL_COUPON.getGroup(), MQConst.GoblinQueue.SQL_COUPON.name() + t),
StreamOffset.create(MQConst.GoblinQueue.SQL_COUPON.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlCouponRdsReceiver);
} }
/* —————————————————————————— | —————————————————————————— | —————————————————————————— */ /* —————————————————————————— | —————————————————————————— | —————————————————————————— */
...@@ -83,36 +92,102 @@ public class ConsumerGoblinSqlUstoreRedisStreamConfig { ...@@ -83,36 +92,102 @@ public class ConsumerGoblinSqlUstoreRedisStreamConfig {
return subscription; return subscription;
} }
/* -------------------------------------------------------- | 用户中心 */
@Bean @Bean
public Subscription subscriptionSqlStore3(RedisConnectionFactory factory) { public Subscription subscriptionSqlGoods1(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory); var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlStore(listenerContainer, 3); var subscription = receiveSqlGoods(listenerContainer, 1);
listenerContainer.start(); listenerContainer.start();
return subscription; return subscription;
} }
/* -------------------------------------------------------- | 用户中心 */ @Bean
public Subscription subscriptionSqlGoods2(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlGoods(listenerContainer, 2);
listenerContainer.start();
return subscription;
}
/* -------------------------------------------------------- | 店铺优惠券相关 */
@Bean @Bean
public Subscription subscriptionSqlGoods1(RedisConnectionFactory factory) { public Subscription subscriptionSqlCoupon1(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory); var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlGoods(listenerContainer, 1); var subscription = receiveSqlCoupon(listenerContainer, 1);
listenerContainer.start(); listenerContainer.start();
return subscription; return subscription;
} }
@Bean @Bean
public Subscription subscriptionSqlGoods2(RedisConnectionFactory factory) { public Subscription subscriptionSqlCoupon2(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory); var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlGoods(listenerContainer, 2); var subscription = receiveSqlCoupon(listenerContainer, 2);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlCoupon3(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlCoupon(listenerContainer, 3);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlCoupon4(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlCoupon(listenerContainer, 4);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlCoupon5(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlCoupon(listenerContainer, 5);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlCoupon6(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlCoupon(listenerContainer, 6);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlCoupon7(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlCoupon(listenerContainer, 7);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlCoupon8(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlCoupon(listenerContainer, 8);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlCoupon9(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlCoupon(listenerContainer, 9);
listenerContainer.start(); listenerContainer.start();
return subscription; return subscription;
} }
@Bean @Bean
public Subscription subscriptionSqlGoods3(RedisConnectionFactory factory) { public Subscription subscriptionSqlCoupon10(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory); var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlGoods(listenerContainer, 3); var subscription = receiveSqlCoupon(listenerContainer, 10);
listenerContainer.start(); listenerContainer.start();
return subscription; return subscription;
} }
......
package com.liquidnet.service.consumer.goblin.receiver;
import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinSqlCouponRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.SQL_COUPON.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.SQL_COUPON.getGroup();
}
}
...@@ -4,6 +4,9 @@ XGROUP CREATE goblin:stream:sql.store group.sql.ustore 0 ...@@ -4,6 +4,9 @@ XGROUP CREATE goblin:stream:sql.store group.sql.ustore 0
#---- 商品相关 #---- 商品相关
XADD goblin:stream:sql.goods * 0 0 XADD goblin:stream:sql.goods * 0 0
XGROUP CREATE goblin:stream:sql.goods group.sql.ustore 0 XGROUP CREATE goblin:stream:sql.goods group.sql.ustore 0
#---- 店铺优惠券相关
XADD goblin:stream:sql.coupon * 0 0
XGROUP CREATE goblin:stream:sql.coupon group.sql.ustore 0
#---- # #---- #
XADD goblin:stream:store.market * 0 0 XADD goblin:stream:store.market * 0 0
XGROUP CREATE goblin:stream:store.market group.store.market 0 XGROUP CREATE goblin:stream:store.market group.store.market 0
......
...@@ -97,7 +97,7 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -97,7 +97,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
receiveUserCouponBasicVo.getState(), receiveUserCouponBasicVo.getBindAt(), receiveUserCouponBasicVo.getDuedAt(), receiveUserCouponBasicVo.getState(), receiveUserCouponBasicVo.getBindAt(), receiveUserCouponBasicVo.getDuedAt(),
receiveUserCouponBasicVo.getOperator(), receiveUserCouponBasicVo.getCreatedAt() receiveUserCouponBasicVo.getOperator(), receiveUserCouponBasicVo.getCreatedAt()
}); });
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_COUPON.getKey(),
SqlMapping.get("goblin_user_coupon.insert", initUserCouponObjs)); SqlMapping.get("goblin_user_coupon.insert", initUserCouponObjs));
return true; return true;
} }
...@@ -240,7 +240,7 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -240,7 +240,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
vo.setState(5); vo.setState(5);
vo.setUsedFor(content); vo.setUsedFor(content);
goblinMongoUtils.changeCouponVos(vo.getUcouponId(), vo); goblinMongoUtils.changeCouponVos(vo.getUcouponId(), vo);
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_COUPON.getKey(),
SqlMapping.get("goblin_user_coupon.updateState", vo.getState(), vo.getUsedFor(), LocalDateTime.now(), vo.getUcouponId())); SqlMapping.get("goblin_user_coupon.updateState", vo.getState(), vo.getUsedFor(), LocalDateTime.now(), vo.getUcouponId()));
break; break;
} else { } else {
...@@ -269,7 +269,7 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -269,7 +269,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
vo.setState(5); vo.setState(5);
vo.setUsedFor(content); vo.setUsedFor(content);
goblinMongoUtils.changeCouponVos(vo.getUcouponId(), vo); goblinMongoUtils.changeCouponVos(vo.getUcouponId(), vo);
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_COUPON.getKey(),
SqlMapping.get("goblin_user_coupon.updateState", vo.getState(), vo.getUsedFor(), LocalDateTime.now(), vo.getUcouponId())); SqlMapping.get("goblin_user_coupon.updateState", vo.getState(), vo.getUsedFor(), LocalDateTime.now(), vo.getUcouponId()));
} }
break; break;
...@@ -297,7 +297,7 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -297,7 +297,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
vo.setUsedFor(""); vo.setUsedFor("");
goblinRedisUtils.setUserCouponVos(item.getUid(), voList); goblinRedisUtils.setUserCouponVos(item.getUid(), voList);
goblinMongoUtils.changeCouponVos(vo.getUcouponId(), vo); goblinMongoUtils.changeCouponVos(vo.getUcouponId(), vo);
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_COUPON.getKey(),
SqlMapping.get("goblin_user_coupon.updateState", vo.getState(), vo.getUsedFor(), LocalDateTime.now(), vo.getUcouponId())); SqlMapping.get("goblin_user_coupon.updateState", vo.getState(), vo.getUsedFor(), LocalDateTime.now(), vo.getUcouponId()));
} }
break; break;
......
...@@ -100,7 +100,7 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer ...@@ -100,7 +100,7 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer
LinkedList<Object[]> activityStoreCouponObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> activityStoreCouponObjs = CollectionUtil.linkedListObjectArr();
storeCouponIdList.forEach(storeCouponId -> activityStoreCouponObjs.add(new Object[]{state, uid, now, storeCouponId})); storeCouponIdList.forEach(storeCouponId -> activityStoreCouponObjs.add(new Object[]{state, uid, now, storeCouponId}));
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_COUPON.getKey(),
SqlMapping.get("goblin_store_coupon.activity", activityStoreCouponObjs)); SqlMapping.get("goblin_store_coupon.activity", activityStoreCouponObjs));
} }
} }
...@@ -126,7 +126,7 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer ...@@ -126,7 +126,7 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer
LinkedList<Object[]> deleteStoreCouponObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> deleteStoreCouponObjs = CollectionUtil.linkedListObjectArr();
storeCouponIdList.forEach(storeCouponId -> deleteStoreCouponObjs.add(new Object[]{uid, now, storeCouponId})); storeCouponIdList.forEach(storeCouponId -> deleteStoreCouponObjs.add(new Object[]{uid, now, storeCouponId}));
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_COUPON.getKey(),
SqlMapping.get("goblin_store_coupon.delete", deleteStoreCouponObjs)); SqlMapping.get("goblin_store_coupon.delete", deleteStoreCouponObjs));
} }
} }
...@@ -178,7 +178,7 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer ...@@ -178,7 +178,7 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer
storeCouponBasicVo.getSpuIdList().forEach(spuId -> initStoreCouponRuleObjs.add(new Object[]{storeCouponId, spuId, uid, now})); storeCouponBasicVo.getSpuIdList().forEach(spuId -> initStoreCouponRuleObjs.add(new Object[]{storeCouponId, spuId, uid, now}));
} }
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_COUPON.getKey(),
SqlMapping.gets(toMqSqls, initStoreCouponObjs, initStoreCouponRuleObjs)); SqlMapping.gets(toMqSqls, initStoreCouponObjs, initStoreCouponRuleObjs));
} }
...@@ -259,7 +259,7 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer ...@@ -259,7 +259,7 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer
storeCouponBasicVo.getSpuIdList().forEach(spuId -> initStoreCouponRuleObjs.add(new Object[]{storeCouponId, spuId, uid, now})); storeCouponBasicVo.getSpuIdList().forEach(spuId -> initStoreCouponRuleObjs.add(new Object[]{storeCouponId, spuId, uid, now}));
} }
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_COUPON.getKey(),
SqlMapping.gets(toMqSqls, updateStoreCouponObjs, delStoreCouponRuleObjs, initStoreCouponRuleObjs)); SqlMapping.gets(toMqSqls, updateStoreCouponObjs, delStoreCouponRuleObjs, initStoreCouponRuleObjs));
return true; return true;
} }
...@@ -292,7 +292,7 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer ...@@ -292,7 +292,7 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer
} }
goblinRedisUtils.del(GoblinRedisConst.STORE_COUPON.concat(storeCouponId));// 删除REDIS缓存 goblinRedisUtils.del(GoblinRedisConst.STORE_COUPON.concat(storeCouponId));// 删除REDIS缓存
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_COUPON.getKey(),
SqlMapping.get("goblin_store_coupon.update_stock", stock, uid, now, storeCouponId)); SqlMapping.get("goblin_store_coupon.update_stock", stock, uid, now, storeCouponId));
return true; return true;
} }
......
...@@ -294,8 +294,10 @@ public class GoblinMongoUtils { ...@@ -294,8 +294,10 @@ public class GoblinMongoUtils {
return list; return list;
} }
public GoblinStoreInfoVo getStoreInfoVoByUid(String uid) { public List<GoblinStoreInfoVo> getStoreInfoVoByUid(String uid) {
return mongoTemplate.findOne(Query.query(Criteria.where("uid").is(uid).and("delFlg").is("0")), // return mongoTemplate.findOne(Query.query(Criteria.where("uid").is(uid).and("delFlg").is("0")),
// GoblinStoreInfoVo.class, GoblinStoreInfoVo.class.getSimpleName());
return mongoTemplate.find(Query.query(Criteria.where("uid").is(uid).and("delFlg").is("0")),
GoblinStoreInfoVo.class, GoblinStoreInfoVo.class.getSimpleName()); GoblinStoreInfoVo.class, GoblinStoreInfoVo.class.getSimpleName());
} }
......
...@@ -343,13 +343,16 @@ public class GoblinRedisUtils { ...@@ -343,13 +343,16 @@ public class GoblinRedisUtils {
public GoblinStoreInfoVo getStoreInfoVoByUid(String uid) { public GoblinStoreInfoVo getStoreInfoVoByUid(String uid) {
List<String> storeIds = this.getStoreIds(uid); List<String> storeIds = this.getStoreIds(uid);
GoblinStoreInfoVo storeInfoVo; GoblinStoreInfoVo storeInfoVo = null;
if (CollectionUtils.isEmpty(storeIds)) { if (CollectionUtils.isEmpty(storeIds)) {
storeInfoVo = goblinMongoUtils.getStoreInfoVoByUid(uid); List<GoblinStoreInfoVo> vos = goblinMongoUtils.getStoreInfoVoByUid(uid);
if (null != storeInfoVo) { if (!CollectionUtils.isEmpty(vos)) {
storeIds = CollectionUtil.arrayListString(); storeIds = CollectionUtil.arrayListString();
storeIds.add(storeInfoVo.getStoreId()); for (GoblinStoreInfoVo vo : vos) {
storeIds.add(vo.getStoreId());
}
this.setStoreIds(uid, storeIds); this.setStoreIds(uid, storeIds);
storeInfoVo = vos.get(0);
} }
} else { } else {
storeInfoVo = this.getStoreInfoVo(storeIds.get(0)); storeInfoVo = this.getStoreInfoVo(storeIds.get(0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment