Commit 0ea445fa by 徐高华

好办加好友统计

parent c27dda31
package com.gic.haoban.manage.service.service;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.api.dto.QywxErrorLogDTO;
import com.gic.haoban.manage.api.dto.qdto.QywxErrorLogListQDTO;
import com.gic.haoban.manage.service.entity.TabQywxErrorLog;
import com.gic.haoban.manage.service.pojo.bo.TabQywxErrorLogBO;
......@@ -33,4 +34,14 @@ public interface QywxErrorLogService {
*/
List<TabQywxErrorLog> queryListByPage(QywxErrorLogListQDTO qywxErrorLogListQDTO);
/**
*
* @param wxEnterpriseId
* @param msg
* @param type 4自建 5第三方
*/
void addFriendErrLog(String wxEnterpriseId , String msg , int type) ;
public void putToMq(QywxErrorLogDTO dto) ;
}
......@@ -3,7 +3,15 @@ package com.gic.haoban.manage.service.service.impl;
import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.dubbo.entity.ProviderLocalTag;
import com.gic.haoban.manage.api.constants.Manage3Constants;
import com.gic.haoban.manage.api.dto.QywxErrorLogDTO;
import com.gic.mq.sdk.GicMQClient;
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;
......@@ -23,10 +31,13 @@ import com.gic.haoban.manage.service.service.QywxErrorLogService;
*/
@Service
public class TabQywxErrorLogServiceImpl implements QywxErrorLogService {
private static final Logger log = LogManager.getLogger(QywxErrorLogService.class);
@Autowired
private TabQywxErrorLogMapper tabQywxErrorLogMapper;
private static GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
@Override
public TabQywxErrorLogBO insert(TabQywxErrorLogBO tabQywxErrorLogBO) {
String wxEnterpriseId = tabQywxErrorLogBO.getWxEnterpriseId();
......@@ -44,4 +55,24 @@ public class TabQywxErrorLogServiceImpl implements QywxErrorLogService {
return this.tabQywxErrorLogMapper.queryListByPage(qywxErrorLogListQDTO);
}
@Override
public void addFriendErrLog(String wxEnterpriseId, String msg, int type) {
QywxErrorLogDTO errLog = new QywxErrorLogDTO() ;
errLog.setWxEnterpriseId(wxEnterpriseId);
errLog.setExternalUserId("-1");
errLog.setTraceId(ProviderLocalTag.tag.get().traceId);
errLog.setQywxErrorType(type);
errLog.setScenario("加好友");
errLog.setErrorContent(msg);
this.putToMq(errLog);
}
@Override
public void putToMq(QywxErrorLogDTO errLog) {
try {
clientInstance.sendMessage(Manage3Constants.QYWX_ERROR_MSG, JSON.toJSONString(errLog));
} catch (Exception e) {
log.error("发送消息失败:{}", e.getMessage(), e);
}
}
}
......@@ -4,6 +4,7 @@ import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.util.EventUtils;
import com.gic.haoban.manage.service.util.HBQwMonitorUtils;
import org.apache.commons.collections.CollectionUtils;
......@@ -74,18 +75,6 @@ import com.gic.haoban.manage.service.pojo.ExternalUserPojo;
import com.gic.haoban.manage.service.pojo.QywxTagSyncInfoPojo;
import com.gic.haoban.manage.service.pojo.bo.hm.HmLinkBO;
import com.gic.haoban.manage.service.pojo.bo.hm.KeyDataLinkBO;
import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.ExternalMemberService;
import com.gic.haoban.manage.service.service.KeyDataService;
import com.gic.haoban.manage.service.service.MemberUnionRelatedService;
import com.gic.haoban.manage.service.service.QywxSendService;
import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.WelcomeSendService;
import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.chat.GroupChatService;
import com.gic.haoban.manage.service.service.hm.HmLinkService;
import com.gic.haoban.manage.service.service.hm.WxUserAddLogService;
......@@ -186,6 +175,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
private ExternalMemberService externalMemberService ;
@Autowired
private ClerkMainStoreRelatedApiService clerkMainStoreRelatedApiService ;
@Autowired
private QywxErrorLogService qywxErrorLogService ;
GicMQClient instance = GICMQClientUtil.getClientInstance();
......@@ -929,11 +920,15 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
HBQwMonitorUtils.addForFriend(0);
this.updateExternalStatus(dto.getExternalUserid(),dto.getStaffId());
String unionIdJson = qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), dto.getExternalUserid(),qwDTO.getUrlHost());
if(unionIdJson.contains("徐高华")) {
this.qywxErrorLogService.addFriendErrLog(wxEnterpriseId,JSONObject.toJSONString(dto),4);
}
if (StringUtils.isBlank(unionIdJson)) {
log.info("好友不存在");
return null;
} else if ("1".equals(unionIdJson)) {
log.info("接口调用被限制");
this.qywxErrorLogService.addFriendErrLog(wxEnterpriseId,JSONObject.toJSONString(dto),4);
HBQwMonitorUtils.addForFriend(1);
throw new WxApiLimitException("getCorpSelfExternalUseridInfo接口调用被限制");
}
......@@ -1404,6 +1399,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
} else if ("1".equals(uJ)) {
log.info("限制次数");
if(from==0) {
this.qywxErrorLogService.addFriendErrLog(wxEnterpriseId,tabHaobanStaff.getStaffId(),5);
HBQwMonitorUtils.addForFriend(1);
}
throw new WxApiLimitException("getExternalUseridInfo接口次数限制");
......
......@@ -97,7 +97,7 @@
and ( member_id = #{scenario} or external_user_id = #{scenario} )
</if>
<if test="qywxErrorType != null">
and qywx_error_type = #{qywxErrorType}
and qywx_error_type = 1
</if>
<if test="startDate != null">
and create_time <![CDATA[ >= ]]> #{startDate}
......
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