zoujiajian 1 år sedan
förälder
incheckning
9fb16fa3f6

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

@@ -93,4 +93,6 @@ public interface OrderDonMapper extends BaseMapper<OrderDon> {
 	BigDecimal getCouponUsedMoney(Long couponId);
 
 	Integer checkUserHasPaidMjMirror(@Param("list") List<Long> userIdList);
+
+	Map<String, Object> selectUserMIrrorShopDistributeOrderDetail(@Param("startDate") Date startDate, @Param("endDate") Date endDate);
 }

+ 11 - 0
netflix-dao/src/main/java/com/cyksj/mapper/mirrorshop/UserMirrorShopMapper.java

@@ -2,6 +2,11 @@ package com.cyksj.mapper.mirrorshop;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.cyksj.model.entity.UserMirrorShop;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.Map;
 
 /**
  * 项目名: yhlxj2
@@ -11,4 +16,10 @@ import com.cyksj.model.entity.UserMirrorShop;
  */
 public interface UserMirrorShopMapper extends BaseMapper<UserMirrorShop> {
 	String selectSoldMaxGoods(Long userId);
+
+	Map<String, Object> selectUserMIrrorShopDetail(@Param("startDate") Date startDate, @Param("endDate") Date endDate);
+
+	BigDecimal selectUserMirrorShopTakeMoney(@Param("startDate") Date startDate, @Param("endDate") Date endDate);
+
+	Map<String, Object> selectUserMirrorShopApplyMoney(@Param("startDate") Date startDate, @Param("endDate") Date endDate);
 }

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

@@ -522,4 +522,16 @@
         and status not in ('close','noPayment','refund') and sku_id in (select id from goods_don_sku where goods_id = 26 and
         is_mirror = 1)
     </select>
+
+    <select id="selectUserMIrrorShopDistributeOrderDetail" resultType="java.util.Map">
+        select count(*) as numOfDsOrder,
+        ifnull(sum(money),0) as dsMoney
+        from `order_don` o inner join user_mirror_shop_order_relate uor on uor.order_id = o.id and o.status not in ('close','noPayment','refund')
+        <if test="startDate != null">
+            and o.created_time >= #{startDate}
+        </if>
+        <if test="endDate != null">
+            and o.created_time &lt; #{endDate}
+        </if>
+    </select>
 </mapper>

+ 36 - 0
netflix-dao/src/main/resources/mapper/UserMirrorShopMapper.xml

@@ -14,4 +14,40 @@
                     group by od.goods_id
                     order by max(od.money) desc limit 1)
     </select>
+
+    <select id="selectUserMIrrorShopDetail" resultType="java.util.Map">
+        select count(distinct ys.user_id) as numOfYhShop,
+        count(distinct us.user_id) as numOfRegisterYhShopUser
+        from (select user_id from `user_mirror_shop` ys
+        where 1 = 1
+        <if test="startDate != null">
+            and created_time >= #{startDate}
+        </if>
+        <if test="endDate != null">
+            and created_time &lt; #{endDate}
+        </if>) ys left join user_mirror_shop_user_distribute_shared us on us.shop_user_id = ys.user_id
+    </select>
+
+    <select id="selectUserMirrorShopTakeMoney" resultType="java.math.BigDecimal">
+        select ifnull(sum(money),0) from `user_mirror_shop_distribute_waiting_send_points` where send_status in
+        ('waiting','success')
+        <if test="startDate != null">
+            and created_time >= #{startDate}
+        </if>
+        <if test="endDate != null">
+            and created_time &lt; #{endDate}
+        </if>
+    </select>
+
+    <select id="selectUserMirrorShopApplyMoney" resultType="java.util.Map">
+        select ifnull(sum(if(verify_status = 'success',money,0)),0)s,
+        ifnull(sum(if(verify_status = 'verifying',money,0)),0)vf
+        from user_mirror_shop_distribute_money_apply where verify_status in ('verifying','success')
+        <if test="startDate != null">
+            and created_time >= #{startDate}
+        </if>
+        <if test="endDate != null">
+            and created_time &lt; #{endDate}
+        </if>
+    </select>
 </mapper>

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

@@ -11,6 +11,7 @@ import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
 import com.cyksj.mapper.*;
 import com.cyksj.mapper.manage.statistics.*;
+import com.cyksj.mapper.mirrorshop.UserMirrorShopMapper;
 import com.cyksj.mapper.shop.YhShopMapper;
 import com.cyksj.mapper.sys.SysConfigMapper;
 import com.cyksj.model.dto.MonthlyUserOrderDetailDto;
@@ -89,6 +90,8 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 
 	private final SysConfigMapper sysConfigMapper;
 
+	private final UserMirrorShopMapper userMirrorShopMapper;
+
 	private static final GlobalThreadPoolTaskExecutor TASK_POOL = GlobalThreadPoolTaskExecutor.getInstance();
 
 	@Override
@@ -444,7 +447,26 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 
 	@Override
 	public void userMirrorShopDistribute(BackgroundDataView backgroundDataView, Date startDate, Date endDate) {
+		//店铺数量
+		//注册用户
+		Map<String, Object> yhShopDetail = userMirrorShopMapper.selectUserMIrrorShopDetail(startDate, endDate);
+		backgroundDataView.setNumOfYhShop(Integer.parseInt(yhShopDetail.get("numOfYhShop").toString()));
+		backgroundDataView.setNumOfYhShopRegisterUser(Integer.parseInt(yhShopDetail.get("numOfRegisterYhShopUser").toString()));
+		//销售单数
+		//销售金额
+		Map<String, Object> yhShopOrderDetail = orderDonMapper.selectUserMIrrorShopDistributeOrderDetail(startDate, endDate);
+		backgroundDataView.setNumOfYhShopDsOrders(Integer.parseInt(yhShopOrderDetail.get("numOfDsOrder").toString()));
+		backgroundDataView.setYhShopAmount(BigDecimal.valueOf(Long.parseLong(yhShopOrderDetail.get("dsMoney").toString())).divide(BigDecimal.valueOf(100)));
+		//提成金额
+		BigDecimal yhShopTakeMoney = userMirrorShopMapper.selectUserMirrorShopTakeMoney(startDate, endDate);
+		backgroundDataView.setYhShopTakeMoney(yhShopTakeMoney.divide(BigDecimal.valueOf(100)));
+
 
+		Map<String, Object> yhShopApplyDetail = userMirrorShopMapper.selectUserMirrorShopApplyMoney(startDate, endDate);
+		//已提现
+		backgroundDataView.setDistributeGotMoney(BigDecimal.valueOf(Long.parseLong(yhShopApplyDetail.get("s").toString())).divide(BigDecimal.valueOf(100)));
+		//待审核
+		backgroundDataView.setDistributeVerifyingMoney(BigDecimal.valueOf(Long.parseLong(yhShopApplyDetail.get("vf").toString())).divide(BigDecimal.valueOf(100)));
 	}
 
 	private void getUnbindChannelOrderData(GroupsDataStatisticsView groupsDataStatisticsView, String startDate, String endDate) {