Просмотр исходного кода

update:平衡关系定时任务

yonge 2 месяцев назад
Родитель
Сommit
8f3b9ac81a

+ 16 - 1
mec-application/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -31,6 +31,8 @@ import org.springframework.web.bind.annotation.RestController;
 
 
 import java.io.File;
 import java.io.File;
 import java.net.URL;
 import java.net.URL;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeUnit;
@@ -144,6 +146,8 @@ public class TaskController extends BaseController {
     private UserMusicService userMusicService;
     private UserMusicService userMusicService;
     @Autowired
     @Autowired
     private MusicGroupPaymentCalenderRepairService musicGroupPaymentCalenderRepairService;
     private MusicGroupPaymentCalenderRepairService musicGroupPaymentCalenderRepairService;
+    
+    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
 
 
 	@GetMapping(value = "/initSysMusicCompareDayData")
 	@GetMapping(value = "/initSysMusicCompareDayData")
 	public void initSysMusicCompareDayData(){
 	public void initSysMusicCompareDayData(){
@@ -771,6 +775,17 @@ public class TaskController extends BaseController {
      */
      */
     @GetMapping("/balanceRelation")
     @GetMapping("/balanceRelation")
 	public void balanceRelation(){
 	public void balanceRelation(){
-		studentService.balanceRelation();
+    	Date now = new Date();
+		studentService.balanceRelation(now);
+	}
+
+    /**
+     * 平衡关系定时任务
+     * @throws ParseException 
+     */
+    @GetMapping("/updateBalanceRelation")
+	public void updateBalanceRelation(String dateStr) throws ParseException{
+    	
+		studentService.balanceRelation(sdf.parse(dateStr));
 	}
 	}
 }
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/StudentService.java

@@ -252,5 +252,5 @@ public interface StudentService extends BaseService<Integer, Student> {
     /**
     /**
      * 平衡关系定时任务
      * 平衡关系定时任务
      */
      */
-    void balanceRelation();
+    void balanceRelation(Date now);
 }
 }

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -1670,8 +1670,8 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
     }
     }
 
 
     @Override
     @Override
-    public void balanceRelation() {
-        Date now = new Date();
+    public void balanceRelation(Date now) {
+        
         //获取上个月最后一天
         //获取上个月最后一天
         String lastDayOfLastMonth = DateUtil.format(DateUtil.getLastDayOfMonth(DateUtil.addMonths(now, -1)), DateUtil.ISO_EXPANDED_DATE_FORMAT);
         String lastDayOfLastMonth = DateUtil.format(DateUtil.getLastDayOfMonth(DateUtil.addMonths(now, -1)), DateUtil.ISO_EXPANDED_DATE_FORMAT);
         //获取上个月第一天
         //获取上个月第一天