Sfoglia il codice sorgente

分销订单数据日周月环比展示

zoujiajian 1 anno fa
parent
commit
baf6a06445

+ 2 - 2
netflix-dao/src/main/java/com/cyksj/model/views/DistributePlatOrderDonBrokenLineView.java

@@ -17,7 +17,7 @@ import java.math.BigDecimal;
 @Setter
 @Setter
 @SearchBean(tables = "(select order_id from distribute_waiting_send_points dp :sid:) dp inner join order_don od on od.id = dp.order_id",
 @SearchBean(tables = "(select order_id from distribute_waiting_send_points dp :sid:) dp inner join order_don od on od.id = dp.order_id",
 		where = "od.status not in ('noPayment','close','refund')",
 		where = "od.status not in ('noPayment','close','refund')",
-		groupBy = "od.goods_id,date_format(od.created_time,'%Y-%m-%d')")
+		groupBy = "od.goods_id,:date:")
 public class DistributePlatOrderDonBrokenLineView {
 public class DistributePlatOrderDonBrokenLineView {
 	@DbField("od.goods_id")
 	@DbField("od.goods_id")
 	private Long goodsId;
 	private Long goodsId;
@@ -37,6 +37,6 @@ public class DistributePlatOrderDonBrokenLineView {
 	/**
 	/**
 	 * 日期
 	 * 日期
 	 */
 	 */
-	@DbField("date_format(od.created_time,'%Y-%m-%d')")
+	@DbField(":date:")
 	private String date;
 	private String date;
 }
 }

+ 9 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/distribute/DistributeController.java

@@ -244,9 +244,10 @@ public class DistributeController {
 
 
 	/**
 	/**
 	 * 固定渠道平台分销详情 趋势图
 	 * 固定渠道平台分销详情 趋势图
+	 * chain 默认1日 2周 3月
 	 */
 	 */
 	@GetMapping("/get/distribute/plat/brokenLine/{sharedId}")
 	@GetMapping("/get/distribute/plat/brokenLine/{sharedId}")
-	public Result<BrokenLineObjView> getDsPlatBrokenLine(@PathVariable Long sharedId, Long firstDate, Long lastDate) {
+	public Result<BrokenLineObjView> getDsPlatBrokenLine(@PathVariable Long sharedId, 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) {
@@ -257,9 +258,16 @@ public class DistributeController {
 		}
 		}
 		BrokenLineObjView brokenLineObjView = Optional.ofNullable(orderDonMapper.selectDsPlatBrokenLineMoney(sharedId, first, end))
 		BrokenLineObjView brokenLineObjView = Optional.ofNullable(orderDonMapper.selectDsPlatBrokenLineMoney(sharedId, first, end))
 				.orElse(new BrokenLineObjView());
 				.orElse(new BrokenLineObjView());
+		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')";
+		}
 
 
 		if (brokenLineObjView != null) {
 		if (brokenLineObjView != null) {
 			List<DistributePlatOrderDonBrokenLineView> views = beanSearcher.searchAll(DistributePlatOrderDonBrokenLineView.class, MapUtils.flatBuilder(request.getParameterMap())
 			List<DistributePlatOrderDonBrokenLineView> views = beanSearcher.searchAll(DistributePlatOrderDonBrokenLineView.class, MapUtils.flatBuilder(request.getParameterMap())
+					.put("date", dateSqL)
 					.field(DistributePlatOrderDonBrokenLineView::getDate, first, end).op(Operator.Between)
 					.field(DistributePlatOrderDonBrokenLineView::getDate, first, end).op(Operator.Between)
 					.put("sid", String.format("where shared_id = %s", sharedId))
 					.put("sid", String.format("where shared_id = %s", sharedId))
 					.orderBy(DistributePlatOrderDonBrokenLineView::getDate).asc()
 					.orderBy(DistributePlatOrderDonBrokenLineView::getDate).asc()