Przeglądaj źródła

fix 设备订单展示自然渠道过滤

zoujiajian 2 lat temu
rodzic
commit
3fff2e864d

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/mapper/OrderDonMapper.java

@@ -71,5 +71,5 @@ public interface OrderDonMapper extends BaseMapper<OrderDon> {
 
 	Page<CorpTagUserOrderDataView> getTagUserTimeOrderData(@Param("page") Page<Object> objectPage, @Param("tagIdStr") String tagIdStr, @Param("toDate") String toDate, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
-	List<RealGoodsSourceData> getRealGoodsSourceData(@Param("startDate") String startDate, @Param("endDate") String endDate);
+	List<RealGoodsSourceData> getRealGoodsSourceData(@Param("isGeneral") Boolean isGeneral, @Param("startDate") String startDate, @Param("endDate") String endDate);
 }

+ 11 - 7
netflix-dao/src/main/resources/mapper/OrderDonMapper.xml

@@ -404,18 +404,22 @@
 
     <select id="getRealGoodsSourceData" resultType="com.cyksj.model.views.RealGoodsSourceData">
         select label_source,
-               count(*) as orders,
-               sum(money) as orderMoney
-        from order_don
+        count(*) as orders,
+        sum(money) as orderMoney
+        from order_don o
+        left join user_distribute_shared us on us.user_id = o.user_id
         where goods_id = 15
         and status not in ('close', 'noPayment', 'refund')
         <if test="startDate != null">
-            and created_time >= #{startDate}
+            and o.created_time >= #{startDate}
         </if>
         <if test="endDate != null">
-            and created_time &lt; #{endDate}
+            and o.created_time &lt; #{endDate}
+        </if>
+        <if test="isGeneral != null and isGeneral">
+            and us.id is null
         </if>
-        and label_source != ''
-        group by label_source
+        and o.label_source != ''
+        group by o.label_source
     </select>
 </mapper>

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/mange/statistics/StatisticsDataService.java

@@ -47,5 +47,5 @@ public interface StatisticsDataService {
 
 	void yhShopDistribute(BackgroundDataView backgroundDataView, Date startDate, Date endDate);
 
-	GroupsDataStatisticsView getGroupsData(Long startTime, Long endTime, Integer type) throws Exception;
+	GroupsDataStatisticsView getGroupsData(Long startTime, Long endTime, Integer type, Boolean isDistribute) throws Exception;
 }

+ 7 - 7
netflix-service/src/main/java/com/cyksj/service/mange/statistics/impl/StatisticsDataServiceImpl.java

@@ -404,7 +404,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 	}
 
 	@Override
-	public GroupsDataStatisticsView getGroupsData(Long startTime, Long endTime, Integer type) throws Exception {
+	public GroupsDataStatisticsView getGroupsData(Long startTime, Long endTime, Integer type, Boolean isGeneral) throws Exception {
 		GroupsDataStatisticsView groupsDataStatisticsView = new GroupsDataStatisticsView();
 		String startDate = null;
 		String endDate = null;
@@ -434,10 +434,10 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 				getUnbindChannelOrderData(groupsDataStatisticsView, startDate, endDate);
 				break;
 			case 6:
-				getRealGoodsSourceData(groupsDataStatisticsView, startDate, endDate);
+				getRealGoodsSourceData(groupsDataStatisticsView, isGeneral, startDate, endDate);
 				break;
 			default:
-				getSynthesisData(groupsDataStatisticsView, startDate, endDate);
+				getSynthesisData(groupsDataStatisticsView, isGeneral, startDate, endDate);
 		}
 		return groupsDataStatisticsView;
 	}
@@ -517,7 +517,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		groupsDataStatisticsView.setNewBuyOrderMoney(totalMoney.subtract(groupsDataStatisticsView.getRenewOrderMoney()));
 	}
 
-	public void getSynthesisData(GroupsDataStatisticsView groupsDataStatisticsView, String startDate, String endDate) throws Exception {
+	public void getSynthesisData(GroupsDataStatisticsView groupsDataStatisticsView, Boolean isGeneral, String startDate, String endDate) throws Exception {
 		CountDownLatch latch = new CountDownLatch(2);
 		TASK_POOL.execute(() -> {
 			try {
@@ -532,7 +532,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 				getGroupsOrderCategoryData(groupsDataStatisticsView, startDate, endDate);
 				getRenewOrderData(groupsDataStatisticsView, startDate, endDate);
 				getUnbindChannelOrderData(groupsDataStatisticsView, startDate, endDate);
-				getRealGoodsSourceData(groupsDataStatisticsView, startDate, endDate);
+				getRealGoodsSourceData(groupsDataStatisticsView, isGeneral, startDate, endDate);
 			} finally {
 				latch.countDown();
 			}
@@ -540,8 +540,8 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		latch.await();
 	}
 
-	private void getRealGoodsSourceData(GroupsDataStatisticsView groupsDataStatisticsView, String startDate, String endDate) {
-		List<RealGoodsSourceData> realGoodsSourceDataList = orderDonMapper.getRealGoodsSourceData(startDate, endDate);
+	private void getRealGoodsSourceData(GroupsDataStatisticsView groupsDataStatisticsView, Boolean isGeneral, String startDate, String endDate) {
+		List<RealGoodsSourceData> realGoodsSourceDataList = orderDonMapper.getRealGoodsSourceData(isGeneral, startDate, endDate);
 		Map<String, List<RealGoodsSourceData>> collect = realGoodsSourceDataList.stream().collect(Collectors.groupingBy(RealGoodsSourceData::getLabelSource));
 		OrderDon.LabelSource[] values = OrderDon.LabelSource.values();
 		BigDecimal zero = BigDecimal.ZERO;

+ 2 - 2
netflix-web/src/main/java/com/cyksj/web/controller/manage/statistics/StatisticsDataController.java

@@ -137,8 +137,8 @@ public class StatisticsDataController {
 	 * type 1销售数据 2自然渠道分类数据 3 渠道商+个人 分类数据 4 续费/非续费数据
 	 */
 	@GetMapping("/get/groupsData")
-	public Result<GroupsDataStatisticsView> getGroupsData(Long startTime, Long endTime, @RequestParam(defaultValue = "0") Integer type) throws Exception {
-		GroupsDataStatisticsView groupsDataStatisticsView = statisticsDataService.getGroupsData(startTime, endTime, type);
+	public Result<GroupsDataStatisticsView> getGroupsData(Long startTime, Long endTime, @RequestParam(defaultValue = "0") Integer type, Boolean isGeneral) throws Exception {
+		GroupsDataStatisticsView groupsDataStatisticsView = statisticsDataService.getGroupsData(startTime, endTime, type, isGeneral);
 		return GatewayResponse.SUCCESS.newBuilder().toResult(groupsDataStatisticsView);
 	}