xdd 1 неделя назад
Родитель
Сommit
d04a9e7e6b

+ 20 - 0
fs-admin/src/test/java/com/fs/task/StoreTaskTest.java

@@ -2,6 +2,9 @@ package com.fs.task;
 
 
 import com.fs.FSAdminApplication;
+import com.fs.company.service.ICompanyService;
+import com.fs.company.vo.RedPacketMoneyVO;
+import com.fs.course.mapper.FsCourseRedPacketLogMapper;
 import com.fs.course.service.IFsCourseWatchLogService;
 import com.fs.statis.service.FsStatisSalerWatchService;
 import org.junit.Test;
@@ -9,6 +12,8 @@ import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 
+import java.util.List;
+
 @RunWith(value = org.springframework.test.context.junit4.SpringRunner.class)
 @SpringBootTest(classes = FSAdminApplication.class)
 public class StoreTaskTest {
@@ -18,6 +23,12 @@ public class StoreTaskTest {
     private FsCourseTask fsCourseTask;
     @Autowired
     private FsStatisSalerWatchService fsStatisSalerWatchService;
+
+    @Autowired
+    private FsCourseRedPacketLogMapper fsCourseRedPacketLogMapper;
+
+    @Autowired
+    private ICompanyService companyService;
     @Test
     public void addQwWatchLog() {
         fsCourseWatchLogService.addCourseWatchLogDayNew();
@@ -31,4 +42,13 @@ public class StoreTaskTest {
     public void testWriteData(){
         fsStatisSalerWatchService.writeData();
     }
+
+    @Test
+    public void redPacketSubMoney() throws Exception
+    {
+        List<RedPacketMoneyVO> redPacketMoneyVOS = fsCourseRedPacketLogMapper.selectFsCourseRedPacketLogByCompanyFix();
+        for (RedPacketMoneyVO redPacketMoneyVO : redPacketMoneyVOS) {
+            companyService.subtractCompanyMoney(redPacketMoneyVO.getMoney(),redPacketMoneyVO.getCompanyId());
+        }
+    }
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/course/mapper/FsCourseRedPacketLogMapper.java

@@ -126,6 +126,8 @@ public interface FsCourseRedPacketLogMapper
 
     @Select("SELECT company_id,sum(amount) as money from fs_course_red_packet_log  WHERE status = 1 and  DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) GROUP BY company_id")
     List<RedPacketMoneyVO> selectFsCourseRedPacketLogByCompany();
+    @Select("SELECT company_id,sum(amount) as money from fs_course_red_packet_log  WHERE status = 1 GROUP BY company_id")
+    List<RedPacketMoneyVO> selectFsCourseRedPacketLogByCompanyFix();
 
     List<FsCourseRedPacketLogListPVO> selectFsCourseRedPacketLogListVONew(FsCourseRedPacketLogParam fsCourseRedPacketLog);