master
kira 6 years ago
parent 2456a8a6bb
commit 64fea0ebfe

@ -53,7 +53,6 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
@Resource @Resource
private StringRedisTemplate stringRedisTemplate; private StringRedisTemplate stringRedisTemplate;
private final String REDIS_UNREADMSG_PREFIX = "REDIS_UNREADMSG_PREFIX"; private final String REDIS_UNREADMSG_PREFIX = "REDIS_UNREADMSG_PREFIX";
private final String REDIS_UNREADMSG_SEND_PREFIX = "REDIS_UNREADMSG_SEND_PREFIX";
@Value("${im.openim.appkey}") @Value("${im.openim.appkey}")
private String appkey; private String appkey;
@ -151,7 +150,7 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
if (StringUtils.isEmpty(uid) || StringUtils.isEmpty(tuid)) { if (StringUtils.isEmpty(uid) || StringUtils.isEmpty(tuid)) {
return; return;
} }
BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps("REDIS_UNREADMSG_PREFIX" + tuid); BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps(REDIS_UNREADMSG_PREFIX + tuid);
for (int i = 0; i < ops.size(); i++) { for (int i = 0; i < ops.size(); i++) {
String jStr = ops.index(i); String jStr = ops.index(i);
if (jStr.contains(uid)) { if (jStr.contains(uid)) {
@ -171,7 +170,7 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi();
servants.parallelStream().forEach(p -> { servants.parallelStream().forEach(p -> {
p.getString("user_id"); p.getString("user_id");
BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps("REDIS_UNREADMSG_PREFIX" + p.getString("user_id")); BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps(REDIS_UNREADMSG_PREFIX + p.getString("user_id"));
if (ops.size() < 1) { if (ops.size() < 1) {
return; return;
} }
@ -183,7 +182,7 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
} }
TemplateMessage msg = initUnreadMsg(unreadMsg, clients, p.getString("wx_openid"), paymentApi.getTemplateId("commission")); TemplateMessage msg = initUnreadMsg(unreadMsg, clients, p.getString("wx_openid"), paymentApi.getTemplateId("commission"));
paymentApi.sendTemplateMessage(msg); paymentApi.sendTemplateMessage(msg);
stringRedisTemplate.delete("REDIS_UNREADMSG_PREFIX" + p.getString("user_id")); stringRedisTemplate.delete(REDIS_UNREADMSG_PREFIX + p.getString("user_id"));
}); });
} }

Loading…
Cancel
Save