Browse Source

1.更新了月工时标准化、更新方法

verguenza 4 years ago
parent
commit
c96d67d4d1

+ 30 - 34
src/main/java/com/galaxis/manatee/configuration/SpringAsyncConfiguration.java

@@ -1,11 +1,7 @@
 package com.galaxis.manatee.configuration;
 
-import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.annotation.EnableAsync;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-
-import java.util.concurrent.Executor;
 
 /**
  * @author zcj
@@ -16,34 +12,34 @@ import java.util.concurrent.Executor;
 @EnableAsync
 public class SpringAsyncConfiguration {
 
-    @Bean(name = "taskExecutor")
-    public Executor taskExecutor()
-    {
-        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
-        return executor;
-    }
-
-    @Bean(name = "updateExecutor")
-    public Executor updateExecutor()
-    {
-        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
-        executor.setCorePoolSize(3);
-        executor.setMaxPoolSize(50000);
-        executor.setQueueCapacity(100);
-        executor.setThreadNamePrefix("updateExecutor-");
-        executor.initialize();
-        return executor;
-    }
-
-    @Bean(name = "standardExecutor")
-    public Executor standardExecutor()
-    {
-        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
-        executor.setCorePoolSize(3);
-        executor.setMaxPoolSize(50000);
-        executor.setQueueCapacity(100);
-        executor.setThreadNamePrefix("standardExecutor-");
-        executor.initialize();
-        return executor;
-    }
+//    @Bean(name = "taskExecutor")
+//    public Executor taskExecutor()
+//    {
+//        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+//        return executor;
+//    }
+//
+//    @Bean(name = "updateExecutor")
+//    public Executor updateExecutor()
+//    {
+//        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+//        executor.setCorePoolSize(3);
+//        executor.setMaxPoolSize(50000);
+//        executor.setQueueCapacity(100);
+//        executor.setThreadNamePrefix("updateExecutor-");
+//        executor.initialize();
+//        return executor;
+//    }
+//
+//    @Bean(name = "standardExecutor")
+//    public Executor standardExecutor()
+//    {
+//        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+//        executor.setCorePoolSize(3);
+//        executor.setMaxPoolSize(50000);
+//        executor.setQueueCapacity(100);
+//        executor.setThreadNamePrefix("standardExecutor-");
+//        executor.initialize();
+//        return executor;
+//    }
 }

+ 9 - 9
src/main/java/com/galaxis/manatee/controller/GetController.java

@@ -39,7 +39,7 @@ public class GetController {
     /**
      * 手动更新chuanyunPayRoll
      */
-    @Async("taskExecutor")
+    @Async
     @GetMapping("/test/getChuanyunPayroll")
     public void getChuanyunPayroll(){
         chuanyunHumanResourceScheduledTask.getPayrollManually();
@@ -48,7 +48,7 @@ public class GetController {
     /**
      * 手动更新日志
      */
-    @Async("taskExecutor")
+    @Async
     @GetMapping("/test/getUpdateLog")
     public void getUpdateLog() {
         chuanyunHumanResourceScheduledTask.getUpdateLog();
@@ -57,7 +57,7 @@ public class GetController {
     /**
      * 手动更新项目组成员
      */
-    @Async("taskExecutor")
+    @Async
     @GetMapping("/test/getProjectMember")
     public void getProjectMember() {
         chuanyunService.updateProjectMember();
@@ -66,7 +66,7 @@ public class GetController {
     /**
      * 手动更新人员-归属公司
      */
-    @Async("taskExecutor")
+    @Async
     @GetMapping("/test/getUserCompany")
     public void getUserCompanyManually() {
         chuanyunBasicDataScheduledTask.getUserCompanyManually();
@@ -75,7 +75,7 @@ public class GetController {
     /**
      * 手动更新人员信息
      */
-    @Async("taskExecutor")
+    @Async
     @GetMapping("/test/getUserList")
     public void getUserListManually() {
         chuanyunBasicDataScheduledTask.getUserListManually();
@@ -84,7 +84,7 @@ public class GetController {
     /**
      * 手动更新公司信息
      */
-    @Async("taskExecutor")
+    @Async
     @GetMapping("/test/getCompany")
     public void getCompanyManually() {
         chuanyunBasicDataScheduledTask.getCompanyManually();
@@ -93,19 +93,19 @@ public class GetController {
     /**
      * 手动更新集团项目信息
      */
-    @Async("taskExecutor")
+    @Async
     @GetMapping("/test/getGroupProject")
     public void getGroupProjectManually() {
         chuanyunBasicDataScheduledTask.getGroupProjectManually();
     }
 
-    @Async("taskExecutor")
+    @Async
     @GetMapping("/test/getCostCollectionManually")
     public void getCostCollectionManually() {
         chuanyunBasicDataScheduledTask.getCostCollectionManually();
     }
 
-    @Async("taskExecutor")
+    @Async
     @GetMapping("/test/getReimbursementItemsManually")
     public void getReimbursementItemsManually() {
         chuanyunBasicDataScheduledTask.getReimbursementItemsManually();

+ 5 - 5
src/main/java/com/galaxis/manatee/service/DataArcherService.java

@@ -34,7 +34,7 @@ public class DataArcherService {
     /**
      * 异步更新每日工时
      */
-    @Async("updateExecutor")
+    @Async
     public void updateSelfWorkHour(ChuanyunSelfWorkHourDTO chuanyunSelfWorkHourDTO) {
         ObjectMapper objectMapper = new ObjectMapper();
         try {
@@ -75,7 +75,7 @@ public class DataArcherService {
      *
      * @param chuanyunWeekMemberHourDTO 每周工时数据对象
      */
-    @Async("updateExecutor")
+    @Async
     public void updateWeekMemberHour(ChuanyunWeekMemberHourDTO chuanyunWeekMemberHourDTO) {
         ObjectMapper objectMapper = new ObjectMapper();
         try {
@@ -112,7 +112,7 @@ public class DataArcherService {
      *
      * @param chuanyunSelfCostDTO 每周工时数据对象
      */
-    @Async("updateExecutor")
+    @Async
     public void updateChuanyunSelfCost(ChuanyunSelfCostDTO chuanyunSelfCostDTO) {
         ObjectMapper objectMapper = new ObjectMapper();
         try {
@@ -147,7 +147,7 @@ public class DataArcherService {
      * 删除审核中的每月工时
      * @param chuanyunSelfCostDO    氚云每月工时
      */
-    @Async("updateExecutor")
+    @Async
     public void deleteSelfCostInProcess(ChuanyunSelfCostDO chuanyunSelfCostDO) {
         ObjectMapper objectMapper=new ObjectMapper();
         //删除氚云中的在审核工时
@@ -180,7 +180,7 @@ public class DataArcherService {
     /**
      * 删除状态为审核中数据
      */
-    @Async("updateExecutor")
+    @Async
     public void deleteExamineStatus(String schemaCode, String statusCode, String projectCode, String projectId, String userCode, String userId, String yearCode, String year, String monthCode, String month, String weekCode, String week, String typeCode, String projectType) {
         ObjectMapper objectMapper = new ObjectMapper();
         try {

+ 4 - 4
src/main/java/com/galaxis/manatee/service/LogStandardService.java

@@ -50,7 +50,7 @@ public class LogStandardService {
      * @param isRecent              是否只标准化最近一个月的数据
      * @param chuanyunUserCompanyDO 员工信息
      */
-    @Async("standardExecutor")
+    @Async
     public void standardHourByUserCompanyAndIsRecent(ChuanyunUserCompanyDO chuanyunUserCompanyDO, boolean isRecent) {
         if (!StringUtils.isEmpty(chuanyunUserCompanyDO.getUserId())) {
             long start = Instant.now().getEpochSecond();
@@ -68,7 +68,7 @@ public class LogStandardService {
      * 根据用户Id标准化某个人的日工时
      * @param userId    用户Id
      */
-    @Async("standardExecutor")
+    @Async
     public void standardSelfWorkHourByUserId(String userId){
         if (!StringUtils.isEmpty(userId)) {
             //从日志原始数据中获取每人每个项目每天工时。
@@ -83,7 +83,7 @@ public class LogStandardService {
      * 根据用户Id标准化某个人的工时
      * @param userId    用户Id
      */
-    @Async("standardExecutor")
+    @Async
     public void standardWeekMemberHourByUserId(String userId){
         if (!StringUtils.isEmpty(userId)) {
             long start=Instant.now().getEpochSecond();
@@ -102,7 +102,7 @@ public class LogStandardService {
      * 2.将新工时数据保存在manatee中
      * @param userId    用户Id
      */
-    @Async("standardExecutor")
+    @Async
     public void standardSelfCostByUserId(String userId){
         long start=Instant.now().getEpochSecond();
         //删除上一次状态为审核中,但本次已经审核通过的数据

+ 3 - 3
src/main/java/com/galaxis/manatee/service/ProjectMemberService.java

@@ -31,7 +31,7 @@ public class ProjectMemberService {
         this.chuanyunGroupProjectDao = chuanyunGroupProjectDao;
     }
 
-    @Async("taskExecutor")
+    @Async
     public void updateManagerMember(String param) throws InterruptedException {
         TimeUnit.SECONDS.sleep(5);
         log.info("同步管理项目组成员");
@@ -63,7 +63,7 @@ public class ProjectMemberService {
         }
     }
 
-    @Async("taskExecutor")
+    @Async
     public void updateSaleMember(String param) throws InterruptedException {
         TimeUnit.SECONDS.sleep(5);
         log.info("同步销售项目组成员");
@@ -91,7 +91,7 @@ public class ProjectMemberService {
         }
     }
 
-    @Async("taskExecutor")
+    @Async
     public void updateDevelopMember(String param) throws InterruptedException {
         TimeUnit.SECONDS.sleep(5);
         log.info("同步研发项目组成员");