소스 검색

更新 订购预测标签查询

huaerzx 2 년 전
부모
커밋
89d9537ae4
1개의 변경된 파일27개의 추가작업 그리고 21개의 파일을 삭제
  1. 27 21
      src/main/java/com/platomix/userprofile/handler/core/ForecastOrderTagHandler.java

+ 27 - 21
src/main/java/com/platomix/userprofile/handler/core/ForecastOrderTagHandler.java

@@ -45,19 +45,19 @@ public class ForecastOrderTagHandler extends AbstractTagHandler {
 		String lrMobileSql = mobileLeft == null || mobileRight == null ? "" : String.format(" and DEVICE_NUMBER>='%s' and DEVICE_NUMBER<'%s'", mobileLeft, mobileRight);
 
 		List<ForecastParam> paramList = new ArrayList<>();
-		paramList.add(new ForecastParam(month, "AQY", "爱奇艺", "DeepCross", "", lrMobileSql));
-		paramList.add(new ForecastParam(month, "BZ", "哔哩", "DeepCross", lrMobileSql));
-		paramList.add(new ForecastParam(month, "KS", "快手", "DeepCross", lrMobileSql));
-		paramList.add(new ForecastParam(month, "TX", "腾讯", "DeepCross", lrMobileSql));
-		paramList.add(new ForecastParam(month, "YK", "优酷", "DeepCross", lrMobileSql));
-		paramList.add(new ForecastParam(month, "MG", "芒果", "DeepCross", lrMobileSql));
+		paramList.add(new ForecastParam(month, "AQY", "爱奇艺", "爱奇艺", "DeepCross", "", lrMobileSql));
+		paramList.add(new ForecastParam(month, "BZ", "哔哩", "哔哩哔哩", "DeepCross", lrMobileSql));
+		paramList.add(new ForecastParam(month, "KS", "快手", "快手", "DeepCross", lrMobileSql));
+		paramList.add(new ForecastParam(month, "TX", "腾讯","爱奇艺",  "DeepCross", lrMobileSql));
+		paramList.add(new ForecastParam(month, "YK", "优酷","优酷视频",  "DeepCross", lrMobileSql));
+		paramList.add(new ForecastParam(month, "MG", "芒果","芒果TV",  "DeepCross", lrMobileSql));
 		
-		paramList.add(new ForecastParam(month, "AQY", "爱奇艺", "XGBOOST", lrMobileSql));
-		paramList.add(new ForecastParam(month, "BZ", "哔哩", "XGBOOST", lrMobileSql));
-		paramList.add(new ForecastParam(month, "KS", "快手", "XGBOOST", lrMobileSql));
-		paramList.add(new ForecastParam(month, "TX", "腾讯", "XGBOOST", lrMobileSql));
-		paramList.add(new ForecastParam(month, "YK", "优酷", "XGBOOST", lrMobileSql));
-		paramList.add(new ForecastParam(month, "MG", "芒果", "XGBOOST", lrMobileSql));
+		paramList.add(new ForecastParam(month, "AQY", "爱奇艺","爱奇艺",  "XGBOOST", lrMobileSql));
+		paramList.add(new ForecastParam(month, "BZ", "哔哩", "哔哩哔哩", "XGBOOST", lrMobileSql));
+		paramList.add(new ForecastParam(month, "KS", "快手","快手",  "XGBOOST", lrMobileSql));
+		paramList.add(new ForecastParam(month, "TX", "腾讯","爱奇艺",  "XGBOOST", lrMobileSql));
+		paramList.add(new ForecastParam(month, "YK", "优酷","优酷视频",  "XGBOOST", lrMobileSql));
+		paramList.add(new ForecastParam(month, "MG", "芒果", "芒果TV", "XGBOOST", lrMobileSql));
 		
 		StrBuilder sqlBuilder = new StrBuilder();
 		sqlBuilder.appendLn(super.buildTableSql(ZT_TABLE_NAME, "THEMONTH_PRE", "USERID_PRE"));
@@ -94,14 +94,17 @@ public class ForecastOrderTagHandler extends AbstractTagHandler {
 		String fragmentSql = genBucketSql(englishName, "CANCEL_P1", "CANCEL_P2", tagListMap.get(englishName));
 		sqlBuilder.appendLn(fragmentSql);
 		
-		String valueStr  = "XGBoost".equalsIgnoreCase(param.getAlgName()) ? "PRO_RESULT" : "`PRO_RESULT_1`",
-			   value1Str = "XGBoost".equalsIgnoreCase(param.getAlgName()) ? "PREDICT" : "PREDICT",
-			   tableName = String.format("ads.ADS_ORDER_PRE_%s_%s_%s", param.getAlgName(), param.getTp(), value1Str);
+		String valueStr  = "XGBOOST".equalsIgnoreCase(param.getAlgName()) ? "PRO_XGBOOST" : "`PRO_DEEPCROSS`",
+			   //value1Str = "XGBOOST".equalsIgnoreCase(param.getAlgName()) ? "PREDICT" : "PREDICT",
+			   whereStr = String.format(" and APP_NAME='%s' ", param.getTpValue()),
+				tableName = "ADS_ORDER_PRE_PREDICT_DEEP";
 		sqlBuilder.appendLn("from")
 		          .appendLn("(")
 				  .appendLn("select DEVICE_NUMBER as  USERID,intDiv("+valueStr+"*100,10)*10 as CANCEL_P1,"+valueStr+"*100 as CANCEL_P2")
 				  .appendLn("from " + tableName)
-				  .append("where 1 = 1").appendLn(param.getLrMobileSql())
+				  .append(String.format("where MONTH_ID ='%s'",param.getMonth()))
+				  .appendLn(whereStr)
+				  .appendLn(param.getLrMobileSql())
 				  .appendLn(") t")
 				  .appendLn(") " + param.getTableAlias());
 		if(!StringUtils.isEmpty(param.getJoinStr())) {
@@ -126,6 +129,7 @@ public class ForecastOrderTagHandler extends AbstractTagHandler {
 		private String month;
 		private String tp;
 		private String tpName;
+		private String tpValue;
 		private String algName;
 		private String joinStr = " full outer join ";
 		private String lrMobileSql;
@@ -143,14 +147,15 @@ public class ForecastOrderTagHandler extends AbstractTagHandler {
 		 * @param month
 		 * @param tp
 		 * @param tpName
-		 * @param tableAlsStr
+		 * @param tpValue
 		 * @param lrMobileSql
 		 */
-		public ForecastParam(String month, String tp, String tpName, String algName, String lrMobileSql) {
+		public ForecastParam(String month, String tp, String tpName,String tpValue, String algName, String lrMobileSql) {
 			super();
 			this.month = month;
 			this.tp = tp;
 			this.tpName = tpName;
+			this.tpValue=tpValue;
 			this.algName = algName;
 			this.lrMobileSql = lrMobileSql;
 		}
@@ -158,16 +163,17 @@ public class ForecastOrderTagHandler extends AbstractTagHandler {
 		 * @param month
 		 * @param tp
 		 * @param tpName
-		 * @param tableAlsStr
+		 * @param tpValue
 		 * @param joinStr
 		 * @param lrMobileSql
 		 */
-		public ForecastParam(String month, String tp, String tpName, String algName, String joinStr,
+		public ForecastParam(String month, String tp, String tpName,String tpValue, String algName, String joinStr,
 				String lrMobileSql) {
 			super();
 			this.month = month;
 			this.tp = tp;
 			this.tpName = tpName;
+			this.tpValue=tpValue;
 			this.algName = algName;
 			this.joinStr = joinStr;
 			this.lrMobileSql = lrMobileSql;
@@ -180,7 +186,7 @@ public class ForecastOrderTagHandler extends AbstractTagHandler {
 		public String getTableAlias() {
 			return String.format("t%s_%s", algName, tp);
 		}
-		
+
 		public String getEnglishName() {
 			return String.format("als_order_%s_%s", getLongTp(), 
 					"DeepCross".equalsIgnoreCase(algName) ? "dec" : "xgb");