Commit 6bc16645 authored by 郑建's avatar 郑建

修改为异步进行

parent acb7c5b0
...@@ -14,7 +14,8 @@ import java.util.concurrent.TimeUnit; ...@@ -14,7 +14,8 @@ import java.util.concurrent.TimeUnit;
* @date 2021/3/2 - 18:43 * @date 2021/3/2 - 18:43
**/ **/
@Slf4j @Slf4j
@RestController("/zhudai") @RestController
@RequestMapping("/manualtool/zhudainew")
public class RepairController { public class RepairController {
...@@ -27,14 +28,8 @@ public class RepairController { ...@@ -27,14 +28,8 @@ public class RepairController {
@RequestMapping("/repair") @RequestMapping("/repair")
public String mainLoanInfoSend(int startPage){ public String mainLoanInfoSend(int startPage){
try{ try{
Stopwatch stopwatch = Stopwatch.createStarted(); repairService.doRepair(startPage);
repairService.doRepair("normal_lh",startPage); return "数据开始补报";
repairService.doRepair("overdue_lh",startPage);
repairService.doRepair("normal",startPage);
repairService.doRepair("overdue",startPage);
log.info("本次测试总耗时 {}",stopwatch.elapsed(TimeUnit.MILLISECONDS));
log.info("数据补报成功");
return "数据补报成功";
}catch(Exception e){ }catch(Exception e){
log.error("数据补报出现异常", e); log.error("数据补报出现异常", e);
return "数据补报出现异常"; return "数据补报出现异常";
......
...@@ -20,6 +20,7 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -20,6 +20,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File; import java.io.File;
...@@ -64,6 +65,17 @@ public class RepairService implements CommonSuperService { ...@@ -64,6 +65,17 @@ public class RepairService implements CommonSuperService {
public static final String errorLog = "/home/quant_group/baihang-report/data/baihang/error.txt"; public static final String errorLog = "/home/quant_group/baihang-report/data/baihang/error.txt";
@Async
public void doRepair(int startPage){
Stopwatch stopwatch = Stopwatch.createStarted();
doRepair("normal_lh",startPage);
doRepair("overdue_lh",startPage);
doRepair("normal",startPage);
doRepair("overdue",startPage);
log.info("本次测试总耗时 {}",stopwatch.elapsed(TimeUnit.MILLISECONDS));
log.info("数据补报成功");
}
public void doRepair(String type,int startPage) { public void doRepair(String type,int startPage) {
Stopwatch stopwatch = Stopwatch.createStarted(); Stopwatch stopwatch = Stopwatch.createStarted();
log.info("开始报送 {}",type); log.info("开始报送 {}",type);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment