Commit 2361e951 by 徐高华

Merge branch 'feature/xgh/20241月迭代' into 'developer'

Feature/xgh/20241月迭代

See merge request !1674
parents 1181e44f 42f44a17
......@@ -52,8 +52,6 @@ public class MemberUnionidRelatedDTO implements Serializable{
private String wxUserId ;
private int reTry ;
private boolean isFlush = false ;
public String getWxUserId() {
......@@ -64,14 +62,6 @@ public class MemberUnionidRelatedDTO implements Serializable{
this.wxUserId = wxUserId;
}
public int getReTry() {
return reTry;
}
public void setReTry(int reTry) {
this.reTry = reTry;
}
public boolean isFlush() {
return isFlush;
}
......
......@@ -85,17 +85,20 @@ public class TabQywxErrorLogServiceImpl implements QywxErrorLogService {
@Override
public void doFriendTimer(String params) {
log.info("加好友异常重试");
Date start = DateUtil.getStartTimeOfDay() ;
Date end = DateUtil.getEndTimeOfDay() ;
Date yesterday = DateUtil.addDay(new Date() , -1) ;
Date start = DateUtil.getStartTimeOfDay(yesterday) ;
Date end = DateUtil.getEndTimeOfDay(yesterday) ;
List<TabQywxErrorLog> list = this.tabQywxErrorLogMapper.listErrorFriend(null,4, start, end) ;
if(CollectionUtils.isNotEmpty(list)) {
String mqName = "dealQywxExternalUserMq2";
for(TabQywxErrorLog tab : list) {
DealQywxExternalUserPojo dealQywxExternalUserPojo = new DealQywxExternalUserPojo();
dealQywxExternalUserPojo.setType(DealQywxExternalUserPojo.DealType.add.getType());
dealQywxExternalUserPojo.setData(JSONObject.parseObject(tab.getErrorContent(), QwFrientNoticeDTO.class));
try {
clientInstance.sendMessage(mqName, JSONObject.toJSONString(dealQywxExternalUserPojo));
DealQywxExternalUserPojo dealQywxExternalUserPojo = new DealQywxExternalUserPojo();
dealQywxExternalUserPojo.setType(DealQywxExternalUserPojo.DealType.add.getType());
if(StringUtils.isNotBlank(tab.getErrorContent())) {
dealQywxExternalUserPojo.setData(JSONObject.parseObject(tab.getErrorContent(), QwFrientNoticeDTO.class));
clientInstance.sendMessage(mqName, JSONObject.toJSONString(dealQywxExternalUserPojo));
}
} catch (Exception e) {
log.info("异步处理异常:{}", e);
}
......
package com.gic.haoban.manage.service.util;
import com.gic.commons.util.IPUtil;
import com.gic.dubbo.util.DubboInvokeUtil;
import com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService;
import com.gic.haoban.manage.service.pojo.HBQwMonitorBO;
import com.gic.redis.data.util.RedisUtil;
import org.apache.logging.log4j.LogManager;
......@@ -17,16 +20,17 @@ public class HBQwMonitorUtils {
private static Logger logger = LogManager.getLogger(HBQwMonitorUtils.class);
private static final List<String> keyList = Arrays.asList("hbDatakey:qwFriendNotice","hbDataKey:addFriendFail") ;
private static final List<String> keyList = Arrays.asList("hbmonitor:friendNotice","hbmonitor:friendFail") ;
/**
* @param index 0加好友企微通知数量 1加好友查询企微接口限制数量
*/
public static void addForFriend(int index) {
logger.info("addForFriend");
String key = keyList.get(index) ;
String ip = IPUtil.getLocalIP();
logger.info("addForFriend={}",ip);
String key = keyList.get(index)+ip ;
RAtomicLong cache = RedisUtil.getRedisClient().getAtomicLong(key);
long val = cache.addAndGet(1);
cache.addAndGet(1);
}
......@@ -35,21 +39,24 @@ public class HBQwMonitorUtils {
}
public static void addByTimer() {
List<String> ipList = DubboInvokeUtil.getServiceHostList(MemberUnionidRelatedApiService.class) ;
logger.info("add timer");
for(int i=0;i<keyList.size();i++) {
String key = keyList.get(i) ;
int count = 0 ;
Object countObj = RedisUtil.getCache(key) ;
if(null != countObj) {
count = Integer.valueOf(countObj.toString()) ;
for(String ip : ipList) {
String key = keyList.get(i)+ip ;
int count = 0 ;
Object countObj = RedisUtil.getCache(key) ;
if(null != countObj) {
count = Integer.valueOf(countObj.toString()) ;
}
RAtomicLong cache = RedisUtil.getRedisClient().getAtomicLong(key);
cache.addAndGet(-count) ;
HBQwMonitorBO bo = new HBQwMonitorBO() ;
bo.setHost(ip);
bo.setType(""+i);
bo.setNum(count);
InfluxDbMonitorUtils.getInstance().friendAdd(bo);
}
RAtomicLong cache = RedisUtil.getRedisClient().getAtomicLong(key);
cache.addAndGet(-count) ;
HBQwMonitorBO bo = new HBQwMonitorBO() ;
bo.setHost("127.0.0.1");
bo.setType(""+i);
bo.setNum(count);
InfluxDbMonitorUtils.getInstance().friendAdd(bo);
}
}
......
......@@ -58,6 +58,7 @@ public class InfluxDbMonitorUtils {
influxDB.write(Point.measurement("hb_qw_friend_monitor")
.time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
.addField("num", bo.getNum())
.tag("application","haoban-manage3")
.tag("host", bo.getHost())
.tag("type", bo.getType())
.build());
......
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