zoujiajian 3 лет назад
Родитель
Сommit
f13d7a1e8f

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

@@ -21,5 +21,5 @@ public interface AccountMapper extends BaseMapper<Account> {
 
 	List<Account> getNoAppleOneAccount(String appleOne);
 
-	List<OrderDon> getNoAppleOneOrderDon(@Param("accountIds") List<Long> accountIds, @Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate, @Param("noOrderStatus") List<String> noOrderStatus);
+	List<OrderDon> getNoAppleOneOrderDon(@Param("skuIds") List<Long> skuIds, @Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate, @Param("noOrderStatus") List<String> noOrderStatus);
 }

+ 3 - 4
netflix-dao/src/main/resources/mapper/AccountMapper.xml

@@ -63,10 +63,9 @@
     </select>
 
     <select id="getNoAppleOneOrderDon" resultType="com.cyksj.model.entity.OrderDon">
-        select distinct od.* from `order_don` od left join `groups_relation` gr on od.relation_id = gr.id
-        left join `groups_trips` gt on gt.id = gr.groups_id
-        where gt.account_id in
-        <foreach collection="accountIds" item="item" open="(" separator="," close=")">
+        select distinct od.* from `order_don` od
+        where od.sku_id in
+        <foreach collection="skuIds" item="item" open="(" separator="," close=")">
             #{item}
         </foreach>
         and od.status not in

+ 1 - 1
netflix-dao/src/main/resources/mapper/AppleOneDataMapper.xml

@@ -17,7 +17,7 @@
                 statistics_date >= #{startDate}
             </if>
             <if test="endDate != null">
-                and statistics_date &lt;= #{endDate}
+                and statistics_date &lt; #{endDate}
             </if>
         </where>
         group by area_name

+ 1 - 1
netflix-dao/src/main/resources/mapper/RealGoodsDataMapper.xml

@@ -17,7 +17,7 @@
                 statistics_date >= #{startDate}
             </if>
             <if test="endDate != null">
-                and statistics_date &lt;= #{endDate}
+                and statistics_date &lt; #{endDate}
             </if>
         </where>
         group by goods_id,sku_id

+ 1 - 1
netflix-dao/src/main/resources/mapper/StreamingAccountDataMapper.xml

@@ -18,7 +18,7 @@
                 statistics_date >= #{startDate}
             </if>
             <if test="endDate != null">
-                and statistics_date &lt;= #{endDate}
+                and statistics_date &lt; #{endDate}
             </if>
         </where>
         group by goods_id

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

@@ -18,5 +18,5 @@ public interface CmsAccountService extends IService<Account> {
 
 	List<Account> getNoAppleOneAccount(String appleOne);
 
-	List<OrderDon> getNoAppleOneOrderDon(List<Long> accountIds, Date yesZeroDate, Date thisZeroDate, List<String> noOrderStatus);
+	List<OrderDon> getNoAppleOneOrderDon(List<Long> skuIds, Date yesZeroDate, Date thisZeroDate, List<String> noOrderStatus);
 }

+ 2 - 2
netflix-service/src/main/java/com/cyksj/service/mange/account/CmsAccountServiceImpl.java

@@ -36,8 +36,8 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
 	}
 
 	@Override
-	public List<OrderDon> getNoAppleOneOrderDon(List<Long> accountIds, Date yesZeroDate, Date thisZeroDate, List<String> noOrderStatus) {
-		return accountMapper.getNoAppleOneOrderDon(accountIds, yesZeroDate, thisZeroDate, noOrderStatus);
+	public List<OrderDon> getNoAppleOneOrderDon(List<Long> skuIds, Date yesZeroDate, Date thisZeroDate, List<String> noOrderStatus) {
+		return accountMapper.getNoAppleOneOrderDon(skuIds, yesZeroDate, thisZeroDate, noOrderStatus);
 	}
 
 }

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

@@ -158,7 +158,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		DateTime zero = DateUtil.beginOfDay(now);
 		DateTime fiveDays = DateUtil.offsetDay(zero, 5);
 		//5天后将到期的主账号
-		List<Account> willExpireAccounts = Optional.ofNullable(accountService.list(Wrappers.lambdaQuery(Account.class).ge(Account::getExpiryTime, zero).lt(Account::getExpiryTime, fiveDays))).orElse(new ArrayList<>());
+		List<Account> willExpireAccounts = Optional.ofNullable(accountService.list(Wrappers.lambdaQuery(Account.class).between(Account::getExpiryTime, zero, fiveDays))).orElse(new ArrayList<>());
 		backgroundDataView.setTotalNumOfWillExpireAccount(willExpireAccounts.size());
 		//已到期主账号
 		List<Account> expiredAccounts = Optional.ofNullable(accountService.list(Wrappers.lambdaQuery(Account.class).le(Account::getExpiryTime, now))).orElse(new ArrayList<>());

+ 8 - 7
netflix-service/src/main/java/com/cyksj/task/StatisticsDataScheduler.java

@@ -130,7 +130,7 @@ public class StatisticsDataScheduler {
 			StreamingAccountData streamingAccount = new StreamingAccountData();
 			streamingAccount.setAccountName(accountList.get(0).getTitle());
 			streamingAccount.setGoodsId(goodsId);
-			streamingAccountDataStatistics(accountList, streamingAccount, StreamingAccountDataSave, yesZeroDate, thisZeroDate);
+			streamingAccountDataStatistics(goodsId, streamingAccount, StreamingAccountDataSave, yesZeroDate, thisZeroDate);
 		});
 		for (StreamingAccountData streamingAccountData : StreamingAccountDataSave) {
 			streamingAccountData.setStatisticsDate(yesZeroDate);
@@ -178,17 +178,18 @@ public class StatisticsDataScheduler {
 	}
 
 	/**
-	 * @param accounts             主账号
+	 * @param goodsId             平台id
 	 * @param streamingAccountData
 	 * @param dataSave             入库实体集合
 	 * @param yesZeroDate          昨日零时
 	 * @param thisZeroDate         今日零时
 	 */
-	private void streamingAccountDataStatistics(List<Account> accounts, StreamingAccountData streamingAccountData, List<StreamingAccountData> dataSave, Date yesZeroDate, Date thisZeroDate) {
-		//主账号
-		List<Long> accountIds = accounts.stream().map(Account::getId).collect(Collectors.toList());
-		if (CollUtil.isNotEmpty(accountIds)) {
-			List<OrderDon> orderDons = Optional.ofNullable(accountService.getNoAppleOneOrderDon(accountIds, yesZeroDate, thisZeroDate, noOrderStatus)).orElse(new ArrayList<>());
+	private void streamingAccountDataStatistics(Long goodsId, StreamingAccountData streamingAccountData, List<StreamingAccountData> dataSave, Date yesZeroDate, Date thisZeroDate) {
+		//规格
+		List<GoodsDonSku> list = Optional.ofNullable(goodsDonSkuService.list(Wrappers.lambdaQuery(GoodsDonSku.class).eq(GoodsDonSku::getGoodsId, goodsId).select(GoodsDonSku::getId))).orElse(new ArrayList<>());
+		List<Long> skuIds = list.stream().map(GoodsDonSku::getId).collect(Collectors.toList());
+		if (CollUtil.isNotEmpty(skuIds)) {
+			List<OrderDon> orderDons = Optional.ofNullable(accountService.getNoAppleOneOrderDon(skuIds, yesZeroDate, thisZeroDate, noOrderStatus)).orElse(new ArrayList<>());
 			//用户数
 			streamingAccountData.setNumOfUser(orderDons.stream().map(OrderDon::getUserId).collect(Collectors.toSet()).size());
 			getNumOfOrderByPayType(orderDons, streamingAccountData);