Browse Source

fix 分销订单日周月数据环比统计

zoujiajian 1 năm trước cách đây
mục cha
commit
669c3b559b

+ 13 - 5
netflix-web/src/main/java/com/cyksj/web/controller/manage/distribute/DistributeController.java

@@ -251,22 +251,30 @@ public class DistributeController {
 		String first = null;
 		String end = null;
 		if (firstDate != null) {
-			first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd");
+			if (chain == 3) {
+				first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM");
+			} else {
+				first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd");
+			}
 		}
 		if (lastDate != null) {
-			end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd");
+			if (chain == 3) {
+				end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM");
+			} else {
+				end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd");
+			}
 		}
 		BrokenLineObjView brokenLineObjView = Optional.ofNullable(orderDonMapper.selectDsPlatBrokenLineMoney(sharedId, first, end))
 				.orElse(new BrokenLineObjView());
+		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
 		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')";
+			dateSqL = "DATE_FORMAT(od.created_time - INTERVAL (DAYOFWEEK(od.created_time) + 5) % 7 DAY, '%Y.%m.%d')";
 		} else if (chain == 3) {
 			dateSqL = "DATE_FORMAT(od.created_time, '%Y-%m')";
 		}
-
 		if (brokenLineObjView != null) {
-			List<DistributePlatOrderDonBrokenLineView> views = beanSearcher.searchAll(DistributePlatOrderDonBrokenLineView.class, MapUtils.flatBuilder(request.getParameterMap())
+			List<DistributePlatOrderDonBrokenLineView> views = beanSearcher.searchAll(DistributePlatOrderDonBrokenLineView.class, builder
 					.put("date", dateSqL)
 					.field(DistributePlatOrderDonBrokenLineView::getDate, first, end).op(Operator.Between)
 					.put("sid", String.format("where shared_id = %s", sharedId))