|
@@ -12,6 +12,7 @@ import com.ydd.common.enums.ResponseResultCodeEnum;
|
|
|
import com.ydd.common.utils.http.HttpUtils;
|
|
|
import com.ydd.common.utils.sign.SignatureUtil;
|
|
|
import com.ydd.ecloud.core.utils.JsonMapper;
|
|
|
+import com.ydd.module.constants.AppConstant;
|
|
|
import com.ydd.module.domain.AppInfo;
|
|
|
import com.ydd.module.expection.CustomAppException;
|
|
|
import com.ydd.module.service.IAppInfoService;
|
|
@@ -20,7 +21,6 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
|
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
@@ -47,6 +47,8 @@ public class DelayPushStoreStatusListener {
|
|
|
try {
|
|
|
if (msg instanceof StoreStatusNotifyVo) {
|
|
|
StoreStatusNotifyVo storeStatusNotifyVo = (StoreStatusNotifyVo) msg;
|
|
|
+ Integer notifyCount = storeStatusNotifyVo.getNotifyCount();
|
|
|
+ log.info("第 {} 次推送状态通知, 通知内容: {}", notifyCount, JSONObject.toJSONString(storeStatusNotifyVo));
|
|
|
String key = storeStatusNotifyVo.getShopCode() + "-" + storeStatusNotifyVo.getStatus();
|
|
|
// 判断缓存是否有成功响应
|
|
|
if (redisCache.hasKey(key)) {
|
|
@@ -80,6 +82,11 @@ public class DelayPushStoreStatusListener {
|
|
|
// 收到成功响应后存入缓存, 后续不再推送
|
|
|
if (ResponseResultCodeEnum.SUCCESS.getMessage().equals(resp)) {
|
|
|
redisCache.setCacheObject(key, "SUCCESS", 24, TimeUnit.HOURS);
|
|
|
+ } else {
|
|
|
+ if (notifyCount == AppConstant.NOTIFY_INTERVAL_DURATION.size()) {
|
|
|
+ // todo: 未收到三方的状态通知回复, 待处理: 增加入库记录...
|
|
|
+ log.warn("门店状态通知结束, 未收到三方的成功响应");
|
|
|
+ }
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("门店状态同步异常: {}", e.getMessage());
|