Browse Source

fix

release_toaliyun_real
winter 2 years ago
parent
commit
5c349a642c
2 changed files with 16 additions and 0 deletions
  1. +14
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxMsgCallbackServiceImpl.java
  2. +2
    -0
      mallinkService/src/main/java/com/iformall/utils/Constant.java

+ 14
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxMsgCallbackServiceImpl.java View File

@@ -12,13 +12,17 @@ import com.iformall.enums.EnumMsgSendStatus;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.*;
import com.iformall.service.WxMsgCallbackService;
import com.iformall.utils.Constant;
import com.iformall.utils.HMACSHA256;
import com.iformall.utils.RedisCacheUtils;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.*;
@@ -47,6 +51,10 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService {

@Autowired
WxMallMapper wxMallMapper;
@Autowired
@Qualifier("objectCommonRedisTemplate")
RedisTemplate<String, Object> redisTemplate;

@Override
public PageInfo<WxMsgCallback> listAsPage(WxMsgCallback record, Integer pageIndex, Integer pageSize) {
@@ -222,6 +230,11 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService {
wxMsgCallbackMapper.updateByBatchNo(wxMsgCallback);
//失败回滚 回滚数量
if (!"true".equalsIgnoreCase(success)) {
String redisKey = Constant.cache_aliyun_msg+wxMsgCallback.getBatchNo()+":"+wxMsgCallback.getPhone();
Integer msgCached = RedisCacheUtils.getCacheInteger(redisTemplate, success);
if (1== msgCached) {
return;
}
WxMsgCallback wxMsgCallbackq = new WxMsgCallback();
wxMsgCallbackq.setBatchNo(wxMsgCallback.getBatchNo());
wxMsgCallbackq.setPhone(wxMsgCallback.getPhone());
@@ -237,6 +250,7 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService {
WxMsgConfig mconfig = wxMsgConfigs.get(0);
mconfig.setRemains(1L);
wxMsgConfigMapper.addRemains(mconfig);
RedisCacheUtils.cache(redisTemplate, redisKey, 1, 3600);
}
}
}


+ 2
- 0
mallinkService/src/main/java/com/iformall/utils/Constant.java View File

@@ -132,5 +132,7 @@ public class Constant {
public static final Integer default_business = 6;
public static final String default_business_name = "其他";
public static final Integer dy_business = 2;
public static final String cache_aliyun_msg ="aliyunMsg:";

}

Loading…
Cancel
Save