|
|
@@ -25,7 +25,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Optional;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* admin/镜像店铺后台/数据
|
|
|
@@ -97,6 +99,48 @@ public class CmsUserMirrorShopDataController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(brokenLineCpsUserWMoneyView);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 数据中心折线图
|
|
|
+ */
|
|
|
+ @GetMapping("/get/data/brokenLine")
|
|
|
+ public Result<UserMirrorShopOrderDataStatisticsView> getDataBrokenLine(Long firstDate, Long lastDate) {
|
|
|
+ long yhShopUserId = StpUserMirrorShopManageUser.getLoginIdAsLong();
|
|
|
+ UserMirrorShop userMirrorShop = userMirrorShopMapper.selectOne(Wrappers.lambdaQuery(UserMirrorShop.class)
|
|
|
+ .eq(UserMirrorShop::getUserId, yhShopUserId)
|
|
|
+ .last("limit 1"));
|
|
|
+ String first = null;
|
|
|
+ String end = null;
|
|
|
+ if (firstDate != null) {
|
|
|
+ first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd");
|
|
|
+ }
|
|
|
+ if (lastDate != null) {
|
|
|
+ end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd");
|
|
|
+ }
|
|
|
+ UserMirrorShopOrderDataStatisticsView brokenLineObjView = Optional.ofNullable(userMirrorShopMapper.selectOrderBrokenLineMoney(userMirrorShop.getId(), first, end))
|
|
|
+ .orElse(new UserMirrorShopOrderDataStatisticsView());
|
|
|
+
|
|
|
+ if (brokenLineObjView != null) {
|
|
|
+ String timeSql = StrUtil.EMPTY;
|
|
|
+ if (firstDate != null) {
|
|
|
+ first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd HH:mm:ss");
|
|
|
+ timeSql += String.format(" and o.created_time >= '%s'", first);
|
|
|
+ }
|
|
|
+ if (lastDate != null) {
|
|
|
+ end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd HH:mm:ss");
|
|
|
+ timeSql += String.format(" and o.created_time < '%s'", end);
|
|
|
+ }
|
|
|
+ MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
+ if (StrUtil.isNotEmpty(timeSql)) {
|
|
|
+ builder.put("time", timeSql);
|
|
|
+ }
|
|
|
+ builder.put("mid", String.format(" and mp_id = %s", userMirrorShop.getId()));
|
|
|
+ List<UserMirrorShopOrderView> views = beanSearcher.searchAll(UserMirrorShopOrderView.class,builder.build());
|
|
|
+ Map<Long, List<UserMirrorShopOrderView>> goodsMap = views.stream().collect(Collectors.groupingBy(UserMirrorShopOrderView::getGoodsId));
|
|
|
+ brokenLineObjView.setGoodsData(goodsMap);
|
|
|
+ }
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(brokenLineObjView);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 店铺分销订单收入统计
|
|
|
*/
|