| 
					
				 | 
			
			
				@@ -3,10 +3,14 @@ package com.tzld.longarticle.recommend.server.service.exterior.impl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.aliyun.odps.data.Record; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.common.constant.TimeConstant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.common.enums.GhTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.SecretEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.common.enums.StatusEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.cgi.ReplyStrategyServiceEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.response.CommonResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.response.ExceptionCodeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.mapper.growth.GhDetailMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.bo.MiniData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.cgi.BucketDataParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.cgi.GroupData; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -15,10 +19,13 @@ import com.tzld.longarticle.recommend.server.model.cgi.ReplyBucketData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.param.PushMessageParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.vo.PushMessageVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.vo.ReportUvVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.repository.model.GhDetail; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.repository.model.GhDetailExample; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.service.exterior.AccessTokenService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.service.exterior.ThirdPartyService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.service.strategy.reply.ReplyStrategyService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.util.DateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.util.LarkRobotUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.Data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -33,6 +40,7 @@ import javax.annotation.PostConstruct; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Objects; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Service 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -47,6 +55,9 @@ public class ThirdPartyServiceImpl implements ThirdPartyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private ODPSManager odpsManager; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private GhDetailMapper ghDetailMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApolloJsonValue("${canViewReportDate:2024-10-31}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private String canViewReportDate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -70,7 +81,23 @@ public class ThirdPartyServiceImpl implements ThirdPartyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (secretEnum == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return CommonResponse.create(ExceptionCodeEnum.PARAM_ERROR, "获取secret失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String channel = secretEnum.channel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("getPushMessage param={} secretEnum desc={}", param, secretEnum.desc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        GhDetailExample example = new GhDetailExample(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        example.createCriteria().andTypeEqualTo(GhTypeEnum.THIRD_PARTY_GH.type).andGhIdEqualTo(param.getGhId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<GhDetail> ghDetails = ghDetailMapper.selectByExample(example); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isEmpty(ghDetails)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return CommonResponse.create(ExceptionCodeEnum.PARAM_ERROR, "ghId不存在,请联系管理员配置"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String channel = ghDetails.get(0).getChannel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (channel == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LarkRobotUtil.sendMessage("channel不存在,请查看详情 ghId=", param.getGhId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return CommonResponse.create(ExceptionCodeEnum.PARAM_ERROR, "ghId异常,请联系管理员检查"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!Objects.equals(secretEnum.channel, channel)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LarkRobotUtil.sendMessage(String.format("channel异常 secretEnum.channel=%s ghDetail.channel=%s ghId=%s", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    secretEnum.channel, channel, param.getGhId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return CommonResponse.create(ExceptionCodeEnum.PARAM_ERROR, "ghId异常,请联系管理员检查"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<PushMessageVo> pushMessageVoList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ReplyBucketData replyBucketData = getPushMessageData(param, channel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log.info("replyBucketData={}", JSON.toJSONString(replyBucketData)); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -116,9 +143,12 @@ public class ThirdPartyServiceImpl implements ThirdPartyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (secretEnum == SecretEnum.SECRET_ENUM_2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return CommonResponse.create(500, "数据不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String channel = secretEnum.channel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //10点后可查询前一天数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        long nowTimestamp = System.currentTimeMillis() / 1000; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        long limitTime = nowTimestamp - 34L * TimeConstant.HOUR; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         long targetTime = DateUtils.dateStrToTimestamp(date, "yyyy-MM-dd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        long limitTime = DateUtils.dateStrToTimestamp(canViewReportDate, "yyyy-MM-dd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String channel = secretEnum.channel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (targetTime > limitTime) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return CommonResponse.create(500, "数据不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 |