|
@@ -488,9 +488,10 @@ public class StatisticsDataController {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取每日平台订单折线数据
|
|
* 获取每日平台订单折线数据
|
|
|
|
|
+ * @param chain 默认1日 2周 3月
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/get/plat/brokenLine")
|
|
@GetMapping("/get/plat/brokenLine")
|
|
|
- public Result<BrokenLineObjView> getPlatBrokenLine(Long firstDate, Long lastDate) {
|
|
|
|
|
|
|
+ public Result<BrokenLineObjView> getPlatBrokenLine(Long firstDate, Long lastDate, @RequestParam(defaultValue = "1") Integer chain) {
|
|
|
String first = null;
|
|
String first = null;
|
|
|
String end = null;
|
|
String end = null;
|
|
|
if (firstDate != null) {
|
|
if (firstDate != null) {
|
|
@@ -499,11 +500,18 @@ public class StatisticsDataController {
|
|
|
if (lastDate != null) {
|
|
if (lastDate != null) {
|
|
|
end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd");
|
|
end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd");
|
|
|
}
|
|
}
|
|
|
|
|
+ String dateSqL = "date_format(od.created_time,'%Y-%m-%d')";
|
|
|
|
|
+ if (chain == 2) {
|
|
|
|
|
+ dateSqL = "DATE_FORMAT(created_time - INTERVAL (DAYOFWEEK(created_time) - 2) DAY, '%Y-%m-%d')";
|
|
|
|
|
+ } else if (chain == 3) {
|
|
|
|
|
+ dateSqL = "DATE_FORMAT(od.created_time, '%Y-%m')";
|
|
|
|
|
+ }
|
|
|
BrokenLineObjView brokenLineObjView = Optional.ofNullable(orderDonMapper.selectPlatBrokenLineMoney(first, end))
|
|
BrokenLineObjView brokenLineObjView = Optional.ofNullable(orderDonMapper.selectPlatBrokenLineMoney(first, end))
|
|
|
.orElse(new BrokenLineObjView());
|
|
.orElse(new BrokenLineObjView());
|
|
|
|
|
|
|
|
if (brokenLineObjView != null) {
|
|
if (brokenLineObjView != null) {
|
|
|
List<PlatOrderDonBrokenLineView> views = beanSearcher.searchAll(PlatOrderDonBrokenLineView.class, MapUtils.builder()
|
|
List<PlatOrderDonBrokenLineView> views = beanSearcher.searchAll(PlatOrderDonBrokenLineView.class, MapUtils.builder()
|
|
|
|
|
+ .put("date", dateSqL)
|
|
|
.field(PlatOrderDonBrokenLineView::getDate, first, end).op(Operator.Between)
|
|
.field(PlatOrderDonBrokenLineView::getDate, first, end).op(Operator.Between)
|
|
|
.orderBy(PlatOrderDonBrokenLineView::getDate).asc()
|
|
.orderBy(PlatOrderDonBrokenLineView::getDate).asc()
|
|
|
.build());
|
|
.build());
|