|
@@ -40,7 +40,8 @@ public class OrderTagHandler extends AbstractTagHandler {
|
|
|
|
|
|
String lrMobileSql = mobileLeft == null || mobileRight == null ? "" : String.format(" and USERID>='%s' and USERID<'%s'", mobileLeft, mobileRight);
|
|
|
String lrUserIdSql = mobileLeft == null || mobileRight == null ? "" : String.format(" and USERVAL>='%s' and USERVAL<'%s'", mobileLeft, mobileRight);
|
|
|
-
|
|
|
+ String lrSevIdSql = mobileLeft == null || mobileRight == null ? "" : String.format(" SERVICE_ID>='%s' and SERVICE_ID<'%s'", mobileLeft, mobileRight);
|
|
|
+
|
|
|
// 获取开始日期
|
|
|
String theLeftDay = month + "01";
|
|
|
String theRightDay = LocalDate.parse(theLeftDay, DateTimeFormatter.BASIC_ISO_DATE).plusMonths(1).format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
|
@@ -136,7 +137,11 @@ public class OrderTagHandler extends AbstractTagHandler {
|
|
|
sqlBuilder.append(m0CancelSql).appendLn(",");
|
|
|
//高频退订
|
|
|
String m6CancelSql = userprofileTagService.genSelectSql("高频当月订退", "M6_CANCEL", "M6_CANCEL", null, "","tagValue");
|
|
|
- sqlBuilder.append(m6CancelSql).appendLn("");
|
|
|
+ sqlBuilder.append(m6CancelSql).appendLn(",");
|
|
|
+
|
|
|
+ //是否CAP
|
|
|
+ String capSql = userprofileTagService.genSelectSql("是否CAP订购", "IS_CAP", "IS_CAP", null, "","tagValue");
|
|
|
+ sqlBuilder.append(capSql).appendLn("");
|
|
|
|
|
|
sqlBuilder.appendLn("from (").appendLn(
|
|
|
"with toDate(concat(SUBSTRING(toString(THEMONTH),1,4),'-' ,SUBSTRING(toString(THEMONTH),5,2),'-01')) as mstr").appendLn(
|
|
@@ -211,8 +216,10 @@ public class OrderTagHandler extends AbstractTagHandler {
|
|
|
.appendLn(" left join ads.DIM_TB_CHANNELS d1 on o1.CHANNEL=d1.ID").appendLn(
|
|
|
") s1").appendLn(
|
|
|
"left join ads.ETL_V_TB_SP_INFO d on s1.SPID=d.SPID").appendLn(
|
|
|
- ") s");
|
|
|
-// log.info("\n" + sqlBuilder.toString());
|
|
|
+ ") s2 ").appendLn(
|
|
|
+ String.format("left join (select ID as IS_CAP,PRODUCT_NAME,CREATE_TIME from ads.SMS_USERINFO where %s) sms ",lrSevIdSql)).appendLn(
|
|
|
+ "on (s2.SPNAME=sms.PRODUCT_NAME and s2.ORDERTIME =sms.CREATE_TIME)");
|
|
|
+ //log.info("\n" + sqlBuilder.toString());
|
|
|
dynamicExecuteService.execute(DsEnum.clickhouse, sqlBuilder.toString(), String.format("[%s]订购关系相关标签生成{%s-%s}", ZT_TABLE_NAME, mobileLeft, mobileRight));
|
|
|
}
|
|
|
|