Commit 34c73fa0 by 徐高华

告警

parent 1a2bb6c3
......@@ -7,16 +7,21 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.api.constant.EnterpriseServiceEnum;
import com.gic.enterprise.api.dto.EnterpriseSettingDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.EnterpriseUseForbidService;
import com.gic.haoban.manage.api.dto.QwPendingIdDTO;
import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.service.QwFriendApiService;
import com.gic.haoban.manage.service.config.Config;
......@@ -44,6 +49,8 @@ public class QwFriendApiServiceImpl implements QwFriendApiService {
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Autowired
private EnterpriseService enterpriseService ;
@Autowired
private Config config;
@Override
......@@ -195,6 +202,16 @@ public class QwFriendApiServiceImpl implements QwFriendApiService {
// 非总部或不存在
return ServiceResponse.failure("2010", "请确认商户是否有效且是总部");
}
EnterpriseSettingDTO setting = this.enterpriseService.getEnterpriseSettingByEnterpriseId(enterpriseId) ;
String customSetting = setting.getCustomSetting() ;
if(StringUtils.isNotBlank(customSetting)) {
JSONObject json = JSON.parseObject(customSetting) ;
String qw = json.getString("qwPendingidFlag") ;
if(StringUtils.isNotBlank(qw) && "0".equals(qw)) {
log.info("未配置unionid查询企微外部联系人接口调用");
return ServiceResponse.failure("2010", "未配置unionid查询企微外部联系人接口调用");
}
}
Integer code = this.enterpriseUseForbidService.selectPermissionStatus(enterpriseId,
EnterpriseServiceEnum.HAO_BAN.getRightMenuCode());
log.info("好办是否到期停用={},{}", enterpriseId, code);
......
......@@ -143,6 +143,7 @@ public class QwTimesUtils {
// 调用次数达上线
String time = null;
String title = "已达上限";
String alertKey = qwInterface.getName()+enterpriseId+"alert"+type ;
boolean sendFlag = false;
if (doneTimes >= setTimes) {
sendFlag = true;
......@@ -175,12 +176,12 @@ public class QwTimesUtils {
time = DateUtil.dateToStr(now, "yyyy年MM月dd日");
}
title = "即将达到可调用次数";
alertKey+="_1" ;
}
}
String alertKey = qwInterface.getName()+enterpriseId+"alert" ;
logger.info("告警key={},value={}",alertKey,RedisUtil.getCache(alertKey));
if (sendFlag && null == RedisUtil.getCache(alertKey)) {
RedisUtil.setCache(alertKey, 1 , 1000*60*60*24L);
RedisUtil.setCache(alertKey, 1 , 60*60*24L);
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(enterpriseId);
String brandName = enterpriseDTO.getBrandName();
// 达到上限时文案
......
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