|
@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -31,7 +32,7 @@ public class MovieRankPushServiceImpl implements IMovieRankPushService {
|
|
|
ReportsAdPushMapper reportsAdPushMapper;
|
|
ReportsAdPushMapper reportsAdPushMapper;
|
|
|
|
|
|
|
|
public static final String TEMPLATE_ID = "AAqhiuoh0Nohp";
|
|
public static final String TEMPLATE_ID = "AAqhiuoh0Nohp";
|
|
|
- public static final String TEMPLATE_VERSION = "1.0.9";
|
|
|
|
|
|
|
+ public static final String TEMPLATE_VERSION = "1.0.12";
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void send() {
|
|
public void send() {
|
|
@@ -49,10 +50,15 @@ public class MovieRankPushServiceImpl implements IMovieRankPushService {
|
|
|
List<String> chatIds = Arrays.asList(
|
|
List<String> chatIds = Arrays.asList(
|
|
|
|
|
|
|
|
);
|
|
);
|
|
|
- send(userIds, chatIds);
|
|
|
|
|
|
|
+ send(userIds, chatIds, true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void send(List<String> userIds, List<String> chatIds) {
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void test() {
|
|
|
|
|
+ send(Arrays.asList("44fbaed6"), Arrays.asList(), false);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void send(List<String> userIds, List<String> chatIds, boolean sendToOptimizers) {
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
String today = DateUtils.getNowDate("yyyy-MM-dd");
|
|
String today = DateUtils.getNowDate("yyyy-MM-dd");
|
|
@@ -61,18 +67,43 @@ public class MovieRankPushServiceImpl implements IMovieRankPushService {
|
|
|
int lastHour = hour - 1;
|
|
int lastHour = hour - 1;
|
|
|
int lastLastHour = hour - 2;
|
|
int lastLastHour = hour - 2;
|
|
|
|
|
|
|
|
- List<JSONObject> t1 = reportsAdPushMapper.movieTop(todayLong, lastHour, 1, "IAP");
|
|
|
|
|
- List<JSONObject> t2 = reportsAdPushMapper.movieTop(todayLong, lastHour, 1, "IAA");
|
|
|
|
|
- List<JSONObject> t3 = reportsAdPushMapper.movieTop(todayLong, lastHour, 4, "IAP");
|
|
|
|
|
- List<JSONObject> t4 = reportsAdPushMapper.movieTop(todayLong, lastHour, 4, "IAA");
|
|
|
|
|
|
|
+// List<JSONObject> t1 = reportsAdPushMapper.movieTop(todayLong, lastHour, 1, "IAP");
|
|
|
|
|
+// List<JSONObject> t2 = reportsAdPushMapper.movieTop(todayLong, lastHour, 1, "IAA");
|
|
|
|
|
+// List<JSONObject> t3 = reportsAdPushMapper.movieTop(todayLong, lastHour, 4, "IAP");
|
|
|
|
|
+// List<JSONObject> t4 = reportsAdPushMapper.movieTop(todayLong, lastHour, 4, "IAA");
|
|
|
|
|
|
|
|
JSONObject template_variables = new JSONObject();
|
|
JSONObject template_variables = new JSONObject();
|
|
|
template_variables.put("thisHour", String.valueOf(hour));
|
|
template_variables.put("thisHour", String.valueOf(hour));
|
|
|
template_variables.put("lastHour", String.valueOf(lastHour));
|
|
template_variables.put("lastHour", String.valueOf(lastHour));
|
|
|
- template_variables.put("table_raw_array_1", buildFeishuTable(t1));
|
|
|
|
|
- template_variables.put("table_raw_array_2", buildFeishuTable(t2));
|
|
|
|
|
- template_variables.put("table_raw_array_3", buildFeishuTable(t3));
|
|
|
|
|
- template_variables.put("table_raw_array_4", buildFeishuTable(t4));
|
|
|
|
|
|
|
+// template_variables.put("table_raw_array_1", buildFeishuTable(t1));
|
|
|
|
|
+// template_variables.put("table_raw_array_2", buildFeishuTable(t2));
|
|
|
|
|
+// template_variables.put("table_raw_array_3", buildFeishuTable(t3));
|
|
|
|
|
+// template_variables.put("table_raw_array_4", buildFeishuTable(t4));
|
|
|
|
|
+
|
|
|
|
|
+ List<JSONObject> topMovies = reportsAdPushMapper.todayTopMovie(todayLong, String.valueOf(lastHour), "cost_amount desc");
|
|
|
|
|
+ List<JSONObject> object_list = new ArrayList<>();
|
|
|
|
|
+ for (JSONObject m : topMovies){
|
|
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
|
|
+ Double hourCostAmount = m.getDoubleValue("hour_cost_amount");
|
|
|
|
|
+ Double dayCostAmount = m.getDoubleValue("cost_amount");
|
|
|
|
|
+ if (hourCostAmount >= 20000 || dayCostAmount >=60000){
|
|
|
|
|
+ obj.put("movieName", "<font color='red'>"+m.getString("movie_name")+"(起量)</font>");
|
|
|
|
|
+ obj.put("hourCostAmount", "<font color='red'>"+hourCostAmount+"</font>");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ obj.put("movieName", m.getString("movie_name"));
|
|
|
|
|
+ obj.put("hourCostAmount", ""+hourCostAmount);
|
|
|
|
|
+ }
|
|
|
|
|
+ obj.put("iaaCostAmount", m.getString("iaa_cost_amount"));
|
|
|
|
|
+ obj.put("iapCostAmount", m.getString("iap_cost_amount"));
|
|
|
|
|
+ String movieProjectSource = String.valueOf(m.get("movie_project_source_name"));
|
|
|
|
|
+ String projectAdStep = m.getString("project_ad_step");
|
|
|
|
|
+ String sb = "<text_tag color='blue'>" + movieProjectSource + "</text_tag>" +
|
|
|
|
|
+ "<text_tag color='green'>" + projectAdStep + "</text_tag>";
|
|
|
|
|
+ obj.put("movieProjectSource", sb);
|
|
|
|
|
+ object_list.add(obj);
|
|
|
|
|
+ }
|
|
|
|
|
+ template_variables.put("table_raw_array_5", object_list);
|
|
|
|
|
+
|
|
|
List<JSONObject> users = reportsAdPushMapper.selectOptimizerList();
|
|
List<JSONObject> users = reportsAdPushMapper.selectOptimizerList();
|
|
|
List<String> mobiles = users.stream().map(user -> user.getString("phonenumber"))
|
|
List<String> mobiles = users.stream().map(user -> user.getString("phonenumber"))
|
|
|
.filter(s -> s != null && s.length() == 11)
|
|
.filter(s -> s != null && s.length() == 11)
|