Commit 16ee9d3a by guojx

年补齐

parent 3704404d
...@@ -350,8 +350,10 @@ public class DataController { ...@@ -350,8 +350,10 @@ public class DataController {
apolloKey.contains("week")) apolloKey.contains("week"))
&& jsonObject.containsKey("storeGroup") && && jsonObject.containsKey("storeGroup") &&
((apolloKey.contains("data_sales") && ((apolloKey.contains("data_sales") &&
(jsonObject.getInteger("storeGroup") == 3 || jsonObject.getInteger("storeGroup") == 4)) (jsonObject.getInteger("storeGroup") == 3 || jsonObject.getInteger("storeGroup") == 4
|| (apolloKey.contains("data_mbr") && jsonObject.getInteger("storeGroup") == 2)); || jsonObject.getInteger("storeGroup") == 5))
|| (apolloKey.contains("data_mbr") && (jsonObject.getInteger("storeGroup") == 2
|| jsonObject.getInteger("storeGroup") == 5)));
if (isNeedFill) { if (isNeedFill) {
log.info("需要补零"); log.info("需要补零");
List<JSONObject> resultList = DataApiUtils.getDataList(res); List<JSONObject> resultList = DataApiUtils.getDataList(res);
...@@ -362,7 +364,17 @@ public class DataController { ...@@ -362,7 +364,17 @@ public class DataController {
if (apolloKey.contains("day")) { if (apolloKey.contains("day")) {
dateTypeList = DateFillUtils.getDay(jsonObject.getString("bizDate")); dateTypeList = DateFillUtils.getDay(jsonObject.getString("bizDate"));
} else if (apolloKey.contains("month")) { } else if (apolloKey.contains("month")) {
dateTypeList = DateFillUtils.getMonth(jsonObject.getString("startDate").substring(0, 7)); //data_sales_perf_anal_cont_clerk_month_overview
//data_sales_perf_anal_cont_month_overview
//data_mbr_scale_stat_month_clerk_overview
//data_mbr_scale_stat_new_month_overview
//data_mbr_scale_stat_new_month_clerk_overview
boolean isYearMonthQuery = jsonObject.getInteger("storeGroup") == 5;
if (isYearMonthQuery) {
dateTypeList = DateFillUtils.getMonthOfYear(jsonObject.getString("startDate").substring(0, 4));
} else {
dateTypeList = DateFillUtils.getMonth(jsonObject.getString("startDate").substring(0, 7));
}
} else if (apolloKey.contains("week")) { } else if (apolloKey.contains("week")) {
dateTypeList = DateFillUtils.getWeek(jsonObject.getString("startDate")); dateTypeList = DateFillUtils.getWeek(jsonObject.getString("startDate"));
} else if (apolloKey.contains("custm")) { } else if (apolloKey.contains("custm")) {
......
...@@ -120,6 +120,18 @@ public class DateFillUtils { ...@@ -120,6 +120,18 @@ public class DateFillUtils {
return dateList; return dateList;
} }
public static List<String> getMonthOfYear(String date) {
List<String> dateList = new ArrayList<>();
for (int i = 1; i <= 12; i++) {
if (i < 10) {
dateList.add(date + "-0" + i);
} else {
dateList.add(date + "-" + i);
}
}
return dateList;
}
public static void main(String[] args) { public static void main(String[] args) {
log.info("" + JSONObject.toJSONString(getWeek("2023-11-27"))); log.info("" + JSONObject.toJSONString(getWeek("2023-11-27")));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment