Ver Fonte

Merge branch 'ds_st'

zoujiajian há 10 meses atrás
pai
commit
1f0fdc6280

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

@@ -95,4 +95,6 @@ public interface OrderDonMapper extends BaseMapper<OrderDon> {
 	Integer checkUserHasPaidMjMirror(@Param("list") List<Long> userIdList);
 
 	Map<String, Object> selectUserMIrrorShopDistributeOrderDetail(@Param("startDate") Date startDate, @Param("endDate") Date endDate);
+
+	List<DistributeOrderStatisticsDataView> getDistributeOrderView(@Param("goodsId") Long goodsId, @Param("start") String start, @Param("end") String end, @Param("isGeneral") Boolean isGeneral);
 }

+ 30 - 0
netflix-dao/src/main/java/com/cyksj/model/views/DistributeOrderStatisticsDataView.java

@@ -0,0 +1,30 @@
+package com.cyksj.model.views;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+@Getter
+@Setter
+public class DistributeOrderStatisticsDataView {
+	private String title;
+
+	private Long goodsId;
+
+	private BigDecimal money;
+
+	private Long userId;
+
+	private String nickname;
+
+	/**
+	 * true 普通渠道
+	 */
+	private Boolean isGeneral;
+
+	/**
+	 * 日期
+	 */
+	private String date;
+}

+ 31 - 0
netflix-dao/src/main/resources/mapper/OrderDonMapper.xml

@@ -535,4 +535,35 @@
             and o.created_time &lt; #{endDate}
         </if>
     </select>
+
+    <select id="getDistributeOrderView" resultType="com.cyksj.model.views.DistributeOrderStatisticsDataView">
+        select user_id, goods_id, nickname, `date`, money
+        from (
+        select us.shared_id as user_id,
+        o.goods_id,
+        (select nickname from `user` where id = us.shared_id limit 1) as nickname,
+        date_format(o.created_time,'%Y-%m-%d') `date`,
+        sum(money)/100 as money,
+        row_number() over (partition by date_format(o.created_time,'%Y-%m-%d') order by sum(money) desc) as rn
+        from user_distribute_shared us
+        <if test="isGeneral != null">
+            left join user_distribute ud on ud.user_id = us.shared_id and ud.deleted
+        </if>
+        inner join order_don o on o.user_Id = us.user_id
+        where o.`status` not in ('close','noPayment','refund')
+        and o.created_time BETWEEN #{start} and #{end}
+        and o.goods_id = #{goodsId} and o.is_fixed_distribute
+        <if test="isGeneral != null">
+            <if test="isGeneral">
+                and ud.id is null
+            </if>
+            <if test="!isGeneral">
+                and ud.id is not null
+            </if>
+        </if>
+        group by us.shared_id,o.goods_id,date_format(o.created_time,'%Y-%m-%d')
+        ) ranked
+        where rn &lt;= 5
+        order by `date` asc, money desc
+    </select>
 </mapper>

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

@@ -667,4 +667,17 @@ public class StatisticsDataController {
 		SearchResult<OrderCustomerServiceDataView> search = beanSearcher.search(OrderCustomerServiceDataView.class, MapUtils.builder().build());
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
+
+	/**
+	 * 商品渠道分销趋势
+	 *
+	 * @param isGeneral true 普通推广 false 渠道推广
+	 * @return
+	 */
+	@GetMapping("/get/distributeOrder/brokenLine")
+	public Result<List<DistributeOrderStatisticsDataView>> getDistributeOrderView(Long goodsId, String first, String end, Boolean isGeneral) {
+		List<DistributeOrderStatisticsDataView> dataList = orderDonMapper.getDistributeOrderView(goodsId, first, end, isGeneral);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(dataList);
+	}
+
 }