gufengshou1 1 سال پیش
والد
کامیت
f3ee7e58fa

+ 11 - 6
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/container/PidLambdaContainer.java

@@ -9,6 +9,7 @@ import com.aliyun.oss.common.auth.DefaultCredentialProvider;
 import com.aliyun.oss.model.CopyObjectResult;
 import com.aliyun.oss.model.OSSObject;
 import com.aliyun.oss.model.PutObjectResult;
+import com.tzld.piaoquan.ad.engine.commons.util.DateUtils;
 import com.tzld.piaoquan.ad.engine.service.predict.impl.PredictModelServiceImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -107,14 +108,18 @@ public class PidLambdaContainer {
             Double cpa=0d;
             Double realCost=0d;
             Double latestRealCPA=0d;
-            double et=0d;
+//            double et=0d;
             double sumE=0d;
-            double ve=0d;
+//            double ve=0d;
             while ((line = bufferedReader.readLine()) != null){
                 try {
                     String[] cols=line.split(",");
                     Long creativeId=Long.parseLong(cols[0]);
                     V1CacheItem cacheItem=lambdaCache.getOrDefault(creativeId,new V1CacheItem(creativeId));
+                    if(DateUtils.getCurrentHour()<=8){
+                        temp.put(creativeId,cacheItem);
+                        continue;
+                    }
                     conversion=Double.parseDouble(cols[1]);
                     cpa=Double.parseDouble(cols[2]);
                     realCost=Double.parseDouble(cols[3]);
@@ -132,7 +137,7 @@ public class PidLambdaContainer {
 
                     temp.put(creativeId,cacheItem);
 
-                    log.info("svc=calNewLambdaV2 creativeId={} lambdaNew={}", creativeId,lambdaNew);
+                    log.info("svc=calNewLambdaV1 creativeId={} lambdaNew={}", creativeId,lambdaNew);
                 }catch (Exception e){
                     e.printStackTrace();
                 }
@@ -140,7 +145,7 @@ public class PidLambdaContainer {
             lambdaCache.clear();
             lambdaCache=temp;
         }catch (Exception e){
-            log.error("svc=calNewLambdaV2 status=failed error={}", Arrays.toString(e.getStackTrace()));
+            log.error("svc=calNewLambdaV1 status=failed error={}", Arrays.toString(e.getStackTrace()));
         }
     }
 
@@ -154,7 +159,7 @@ public class PidLambdaContainer {
             this.cacheDate= copyObjectResult.getLastModified();
             client.deleteObject(bucketName, tempFile);
         }catch (Exception e){
-            log.error("svc=writeLambdaV2FileToOss status=failed error={}", Arrays.toString(e.getStackTrace()));
+            log.error("svc=writeLambdaV1FileToOss status=failed error={}", Arrays.toString(e.getStackTrace()));
             e.printStackTrace();
         }
     }
@@ -175,7 +180,7 @@ public class PidLambdaContainer {
             lambdaCache=JSONObject.parseObject(builder.toString(),new TypeReference<ConcurrentHashMap<Long, V1CacheItem>>(){});
             this.cacheDate=object.getObjectMetadata().getLastModified();
         }catch (Exception e){
-            log.error("svc=loadLambdaV2File status=failed error={}", Arrays.toString(e.getStackTrace()));
+            log.error("svc=loadLambdaV1File status=failed error={}", Arrays.toString(e.getStackTrace()));
             e.printStackTrace();
         }
     }