Sfoglia il codice sorgente

新增datax_web数据同步日志记录,新增计算全过程执行日志记录

lw 1 anno fa
parent
commit
6344035d15

+ 9 - 0
module_kzks/src/main/java/org/jeecg/modules/dataSourceSwitch/annotation/UseDataXWebDataSource.java

@@ -0,0 +1,9 @@
+package org.jeecg.modules.dataSourceSwitch.annotation;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE,ElementType.METHOD})//TYPE 用于描述类、接口(包括注解类型) 或enum声明。METHOD:该注解只能声明在一个类的方法前。
+@Retention(RetentionPolicy.RUNTIME)//注解不仅被保存到class文件中,jvm加载class文件之后,仍然存在;
+@Documented//如果一个注解@B,被@Documented标注,那么被@B修饰的类,生成文档时,会显示@B。如果@B没有被@Documented标准,最终生成的文档中就不会显示@B。
+public @interface UseDataXWebDataSource {
+}

+ 9 - 0
module_kzks/src/main/java/org/jeecg/modules/dataSourceSwitch/annotation/UseMasterDataSource.java

@@ -0,0 +1,9 @@
+package org.jeecg.modules.dataSourceSwitch.annotation;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE,ElementType.METHOD})//TYPE 用于描述类、接口(包括注解类型) 或enum声明。METHOD:该注解只能声明在一个类的方法前。
+@Retention(RetentionPolicy.RUNTIME)//注解不仅被保存到class文件中,jvm加载class文件之后,仍然存在;
+@Documented//如果一个注解@B,被@Documented标注,那么被@B修饰的类,生成文档时,会显示@B。如果@B没有被@Documented标准,最终生成的文档中就不会显示@B。
+public @interface UseMasterDataSource {
+}

+ 30 - 0
module_kzks/src/main/java/org/jeecg/modules/dataSourceSwitch/aspect/UseDataXWebDataSourceAspcet.java

@@ -0,0 +1,30 @@
+package org.jeecg.modules.dataSourceSwitch.aspect;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.jeecg.modules.dataSourceSwitch.datasource.DynamicDataSourceContextHolder;
+import org.jeecg.modules.dataSourceSwitch.enums.DataSourceType;
+import org.springframework.stereotype.Component;
+
+@Aspect
+@Component
+public class UseDataXWebDataSourceAspcet {
+
+    @Pointcut("@annotation(org.jeecg.modules.dataSourceSwitch.annotation.UseDataXWebDataSource) || @within(org.jeecg.modules.dataSourceSwitch.annotation.UseDataXWebDataSource)")
+    public void dsPointCut() {
+    }
+
+    @Around("dsPointCut()")
+    public Object around(ProceedingJoinPoint point){
+        DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.DATA_X.name());
+        try {
+            return point.proceed();
+        } catch (Throwable e) {
+            throw new RuntimeException(e);
+        }finally {
+            DynamicDataSourceContextHolder.clearDataSourceType();
+        }
+    }
+}

+ 30 - 0
module_kzks/src/main/java/org/jeecg/modules/dataSourceSwitch/aspect/UseMasterDataSourceAspcet.java

@@ -0,0 +1,30 @@
+package org.jeecg.modules.dataSourceSwitch.aspect;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.jeecg.modules.dataSourceSwitch.datasource.DynamicDataSourceContextHolder;
+import org.jeecg.modules.dataSourceSwitch.enums.DataSourceType;
+import org.springframework.stereotype.Component;
+
+@Aspect
+@Component
+public class UseMasterDataSourceAspcet {
+
+    @Pointcut("@annotation(org.jeecg.modules.dataSourceSwitch.annotation.UseMasterDataSource) || @within(org.jeecg.modules.dataSourceSwitch.annotation.UseMasterDataSource)")
+    public void dsPointCut() {
+    }
+
+    @Around("dsPointCut()")
+    public Object around(ProceedingJoinPoint point){
+        DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
+        try {
+            return point.proceed();
+        } catch (Throwable e) {
+            throw new RuntimeException(e);
+        }finally {
+            DynamicDataSourceContextHolder.clearDataSourceType();
+        }
+    }
+}

+ 293 - 287
module_kzks/src/main/java/org/jeecg/modules/projectPushList/service/impl/ProjectPushListServiceImpl.java

@@ -60,317 +60,323 @@ public class ProjectPushListServiceImpl extends ServiceImpl<ProjectPushListMappe
 
     /**项目成本——查找并更新推送*/
     public Result<String> addAll() throws ExecutionException, InterruptedException {
-        this.truncateTable();//清空原来的数据
-
-        QueryWrapper<ProjectPushSet> queryWrapper = new QueryWrapper<>();
-        List<ProjectPushSet> list2 = projectPushSetService.list(queryWrapper);
-
-
-        CompletableFuture<List<ProjectPushList>> t1 = CompletableFuture.supplyAsync(() -> {
-            // 0材料费
-            QueryWrapper<ProjectPushSet> queryWrapper1 = new QueryWrapper<>();
-            queryWrapper1.eq("cost_type", "0");// 0材料费
-            List<ProjectPushSet> list = projectPushSetService.list(queryWrapper1);
-            List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
-            if (list != null && !list.isEmpty()) {
-                QueryWrapper<ProjectCost> projectCostQueryWrapper;
-                for (ProjectPushSet set : list) {
-                    String stage = set.getStage();
-                    projectCostQueryWrapper = new QueryWrapper<>();
-                    projectCostQueryWrapper.eq("clf", new BigDecimal(0));
-                    projectCostQueryWrapper.ge("processPercent", stage);//
-                    List<ProjectCost> projectCostList1 = costService.projectCostlist(projectCostQueryWrapper);
-
-                    List<String> roleIds = Arrays.asList(set.getPushTo().split(","));
-                    List<UserNameIDVO> userNameIdList = this.userNamesByRoleIds(roleIds);
-
-                    for (ProjectCost cost : projectCostList1) {
-                        for (UserNameIDVO vo : userNameIdList) {
-                            //根据用户id查其所属部门的部门编码
-                            List<String> sysOrgCodeList = this.selectDeptCodeByUserId(vo.getUserId());
-                            String sysOrgCodes = sysOrgCodeList.stream().collect(Collectors.joining(","));
-
-                            //判断是否为组批任务、是组批前还是组批后的任务
-                            String remark = null;
-                            if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "1"))
-                                remark = "(组批之后)";//组批之后
-                            else if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "0"))
-                                remark = "(组批之前)";//组批之前
-                            if (remark == null) remark = "";
-                            //组推送对象
-                            ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
-                                    cost.getTaskno(), cost.getTaskname(), set.getId(), vo.getUsername(), set.getContent() + remark, sysOrgCodes, 0,"0");
-                            pushList.add(push);
+        try {
+            this.truncateTable();//清空原来的数据
+            QueryWrapper<ProjectPushSet> queryWrapper = new QueryWrapper<>();
+            List<ProjectPushSet> list2 = projectPushSetService.list(queryWrapper);
+
+
+            CompletableFuture<List<ProjectPushList>> t1 = CompletableFuture.supplyAsync(() -> {
+                // 0材料费
+                QueryWrapper<ProjectPushSet> queryWrapper1 = new QueryWrapper<>();
+                queryWrapper1.eq("cost_type", "0");// 0材料费
+                List<ProjectPushSet> list = projectPushSetService.list(queryWrapper1);
+                List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
+                if (list != null && !list.isEmpty()) {
+                    QueryWrapper<ProjectCost> projectCostQueryWrapper;
+                    for (ProjectPushSet set : list) {
+                        String stage = set.getStage();
+                        projectCostQueryWrapper = new QueryWrapper<>();
+                        projectCostQueryWrapper.eq("clf", new BigDecimal(0));
+                        projectCostQueryWrapper.ge("processPercent", stage);//
+                        List<ProjectCost> projectCostList1 = costService.projectCostlist(projectCostQueryWrapper);
+
+                        List<String> roleIds = Arrays.asList(set.getPushTo().split(","));
+                        List<UserNameIDVO> userNameIdList = this.userNamesByRoleIds(roleIds);
+
+                        for (ProjectCost cost : projectCostList1) {
+                            for (UserNameIDVO vo : userNameIdList) {
+                                //根据用户id查其所属部门的部门编码
+                                List<String> sysOrgCodeList = this.selectDeptCodeByUserId(vo.getUserId());
+                                String sysOrgCodes = sysOrgCodeList.stream().collect(Collectors.joining(","));
+
+                                //判断是否为组批任务、是组批前还是组批后的任务
+                                String remark = null;
+                                if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "1"))
+                                    remark = "(组批之后)";//组批之后
+                                else if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "0"))
+                                    remark = "(组批之前)";//组批之前
+                                if (remark == null) remark = "";
+                                //组推送对象
+                                ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
+                                        cost.getTaskno(), cost.getTaskname(), set.getId(), vo.getUsername(), set.getContent() + remark, sysOrgCodes, 0, "0");
+                                pushList.add(push);
+                            }
                         }
                     }
                 }
-            }
-            return pushList;
-        });
-
-
-        CompletableFuture<List<ProjectPushList>> t2 = CompletableFuture.supplyAsync(() -> {
-            // 1外协费
-            QueryWrapper<ProjectPushSet> queryWrapper1 = new QueryWrapper<>();
-            queryWrapper1.eq("cost_type", "1");// 1外协费
-            List<ProjectPushSet> list = projectPushSetService.list(queryWrapper1);
-            List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
-            if (list != null && !list.isEmpty()) {
-                QueryWrapper<ProjectCost> projectCostQueryWrapper;
-                for (ProjectPushSet set : list) {
-                    String stage = set.getStage();
-                    projectCostQueryWrapper = new QueryWrapper<>();
-                    projectCostQueryWrapper.eq("wxf", new BigDecimal(0));
-                    projectCostQueryWrapper.ge("processPercent", stage);
-                    List<ProjectCost> projectCostList1 = costService.projectCostlist(projectCostQueryWrapper);
-
-                    List<String> roleIds = Arrays.asList(set.getPushTo().split(","));
-                    List<UserNameIDVO> userNameIdList = this.userNamesByRoleIds(roleIds);
-
-                    for (ProjectCost cost : projectCostList1) {
-                        for (UserNameIDVO vo : userNameIdList) {
-                            //根据用户id查其所属部门的部门编码
-                            List<String> sysOrgCodeList = this.selectDeptCodeByUserId(vo.getUserId());
-                            String sysOrgCodes = sysOrgCodeList.stream().collect(Collectors.joining(","));
-
-                            //判断是否为组批任务、是组批前还是组批后的任务
-                            String remark = null;
-                            if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "1"))
-                                remark = "(组批之后)";//组批之后
-                            else if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "0"))
-                                remark = "(组批之前)";//组批之前
-                            if (remark == null) remark = "";
-                            //组推送对象
-                            ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
-                                    cost.getTaskno(), cost.getTaskname(), set.getId(), vo.getUsername(), set.getContent() + remark, sysOrgCodes, 0,"1");
-                            pushList.add(push);
+                return pushList;
+            });
+
+
+            CompletableFuture<List<ProjectPushList>> t2 = CompletableFuture.supplyAsync(() -> {
+                // 1外协费
+                QueryWrapper<ProjectPushSet> queryWrapper1 = new QueryWrapper<>();
+                queryWrapper1.eq("cost_type", "1");// 1外协费
+                List<ProjectPushSet> list = projectPushSetService.list(queryWrapper1);
+                List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
+                if (list != null && !list.isEmpty()) {
+                    QueryWrapper<ProjectCost> projectCostQueryWrapper;
+                    for (ProjectPushSet set : list) {
+                        String stage = set.getStage();
+                        projectCostQueryWrapper = new QueryWrapper<>();
+                        projectCostQueryWrapper.eq("wxf", new BigDecimal(0));
+                        projectCostQueryWrapper.ge("processPercent", stage);
+                        List<ProjectCost> projectCostList1 = costService.projectCostlist(projectCostQueryWrapper);
+
+                        List<String> roleIds = Arrays.asList(set.getPushTo().split(","));
+                        List<UserNameIDVO> userNameIdList = this.userNamesByRoleIds(roleIds);
+
+                        for (ProjectCost cost : projectCostList1) {
+                            for (UserNameIDVO vo : userNameIdList) {
+                                //根据用户id查其所属部门的部门编码
+                                List<String> sysOrgCodeList = this.selectDeptCodeByUserId(vo.getUserId());
+                                String sysOrgCodes = sysOrgCodeList.stream().collect(Collectors.joining(","));
+
+                                //判断是否为组批任务、是组批前还是组批后的任务
+                                String remark = null;
+                                if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "1"))
+                                    remark = "(组批之后)";//组批之后
+                                else if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "0"))
+                                    remark = "(组批之前)";//组批之前
+                                if (remark == null) remark = "";
+                                //组推送对象
+                                ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
+                                        cost.getTaskno(), cost.getTaskname(), set.getId(), vo.getUsername(), set.getContent() + remark, sysOrgCodes, 0, "1");
+                                pushList.add(push);
+                            }
                         }
                     }
                 }
-            }
-            return pushList;
-        });
-
-
-        CompletableFuture<List<ProjectPushList>> t3 = CompletableFuture.supplyAsync(() -> {
-            // 2人工费(工资及劳务费)
-            QueryWrapper<ProjectPushSet> queryWrapper1 = new QueryWrapper<>();
-            queryWrapper1.eq("cost_type", "2");// 2人工费
-            List<ProjectPushSet> list = projectPushSetService.list(queryWrapper1);
-            List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
-            if (list != null && !list.isEmpty()) {
-                QueryWrapper<ProjectCost> projectCostQueryWrapper;
-                for (ProjectPushSet set : list) {
-                    String stage = set.getStage();
-                    projectCostQueryWrapper = new QueryWrapper<>();
-                    projectCostQueryWrapper.eq("gzjlwf", new BigDecimal(0));
-                    projectCostQueryWrapper.ge("processPercent", stage);
-                    List<ProjectCost> projectCostList1 = costService.projectCostlist(projectCostQueryWrapper);
-
-                    List<String> roleIds = Arrays.asList(set.getPushTo().split(","));
-                    List<UserNameIDVO> userNameIdList = this.userNamesByRoleIds(roleIds);
-
-                    for (ProjectCost cost : projectCostList1) {
-                        for (UserNameIDVO vo : userNameIdList) {
-                            //根据用户id查其所属部门的部门编码
-                            List<String> sysOrgCodeList = this.selectDeptCodeByUserId(vo.getUserId());
-                            String sysOrgCodes = sysOrgCodeList.stream().collect(Collectors.joining(","));
-
-                            //判断是否为组批任务、是组批前还是组批后的任务
-                            String remark = null;
-                            if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "1"))
-                                remark = "(组批之后)";//组批之后
-                            else if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "0"))
-                                remark = "(组批之前)";//组批之前
-                            if (remark == null) remark = "";
-                            //组推送对象
-                            ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
-                                    cost.getTaskno(), cost.getTaskname(), set.getId(), vo.getUsername(), set.getContent() + remark, sysOrgCodes, 0,"2");
-                            pushList.add(push);
+                return pushList;
+            });
+
+
+            CompletableFuture<List<ProjectPushList>> t3 = CompletableFuture.supplyAsync(() -> {
+                // 2人工费(工资及劳务费)
+                QueryWrapper<ProjectPushSet> queryWrapper1 = new QueryWrapper<>();
+                queryWrapper1.eq("cost_type", "2");// 2人工费
+                List<ProjectPushSet> list = projectPushSetService.list(queryWrapper1);
+                List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
+                if (list != null && !list.isEmpty()) {
+                    QueryWrapper<ProjectCost> projectCostQueryWrapper;
+                    for (ProjectPushSet set : list) {
+                        String stage = set.getStage();
+                        projectCostQueryWrapper = new QueryWrapper<>();
+                        projectCostQueryWrapper.eq("gzjlwf", new BigDecimal(0));
+                        projectCostQueryWrapper.ge("processPercent", stage);
+                        List<ProjectCost> projectCostList1 = costService.projectCostlist(projectCostQueryWrapper);
+
+                        List<String> roleIds = Arrays.asList(set.getPushTo().split(","));
+                        List<UserNameIDVO> userNameIdList = this.userNamesByRoleIds(roleIds);
+
+                        for (ProjectCost cost : projectCostList1) {
+                            for (UserNameIDVO vo : userNameIdList) {
+                                //根据用户id查其所属部门的部门编码
+                                List<String> sysOrgCodeList = this.selectDeptCodeByUserId(vo.getUserId());
+                                String sysOrgCodes = sysOrgCodeList.stream().collect(Collectors.joining(","));
+
+                                //判断是否为组批任务、是组批前还是组批后的任务
+                                String remark = null;
+                                if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "1"))
+                                    remark = "(组批之后)";//组批之后
+                                else if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "0"))
+                                    remark = "(组批之前)";//组批之前
+                                if (remark == null) remark = "";
+                                //组推送对象
+                                ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
+                                        cost.getTaskno(), cost.getTaskname(), set.getId(), vo.getUsername(), set.getContent() + remark, sysOrgCodes, 0, "2");
+                                pushList.add(push);
+                            }
                         }
                     }
                 }
-            }
-            return pushList;
-        });
+                return pushList;
+            });
 
 
-        CompletableFuture<List<ProjectPushList>> t4 = CompletableFuture.supplyAsync(() -> {
-            // 3外协预算超限
-            QueryWrapper<ProjectPushSet> queryWrapper1 = new QueryWrapper<>();
-            queryWrapper1 = new QueryWrapper<>();
+            CompletableFuture<List<ProjectPushList>> t4 = CompletableFuture.supplyAsync(() -> {
+                // 3外协预算超限
+                QueryWrapper<ProjectPushSet> queryWrapper1 = new QueryWrapper<>();
+                queryWrapper1 = new QueryWrapper<>();
                 queryWrapper1.eq("cost_type", "3");// 3外协预算超限
-            List<ProjectPushSet> list = projectPushSetService.list(queryWrapper1);
-            List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
-            if (list != null && !list.isEmpty()) {
-                QueryWrapper<ProjectCost> projectCostQueryWrapper;
-                for (ProjectPushSet set : list) {
-                    List<ProjectCost> projectCostList1 = costService.selectProjectCostListWhereWxysGtWxf();
-
-                    List<String> roleIds = Arrays.asList(set.getPushTo().split(","));
-                    List<UserNameIDVO> userNameIdList = this.userNamesByRoleIds(roleIds);
-
-                    for (ProjectCost cost : projectCostList1) {
-                        for (UserNameIDVO vo : userNameIdList) {
-                            //根据用户id查其所属部门的部门编码
-                            List<String> sysOrgCodeList = this.selectDeptCodeByUserId(vo.getUserId());
-                            String sysOrgCodes = String.join(",", sysOrgCodeList);
-
-                            //判断是否为组批任务、是组批前还是组批后的任务
-                            String remark = null;
-                            if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "1"))
-                                remark = "(组批之后)";//组批之后
-                            else if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "0"))
-                                remark = "(组批之前)";//组批之前
-                            if (remark == null) remark = "";
-                            //组推送对象
-                            ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
-                                    cost.getTaskno(), cost.getTaskname(), set.getId(), vo.getUsername(), set.getContent() + remark, sysOrgCodes, 0,"3");
-                            pushList.add(push);
+                List<ProjectPushSet> list = projectPushSetService.list(queryWrapper1);
+                List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
+                if (list != null && !list.isEmpty()) {
+                    QueryWrapper<ProjectCost> projectCostQueryWrapper;
+                    for (ProjectPushSet set : list) {
+                        List<ProjectCost> projectCostList1 = costService.selectProjectCostListWhereWxysGtWxf();
+
+                        List<String> roleIds = Arrays.asList(set.getPushTo().split(","));
+                        List<UserNameIDVO> userNameIdList = this.userNamesByRoleIds(roleIds);
+
+                        for (ProjectCost cost : projectCostList1) {
+                            for (UserNameIDVO vo : userNameIdList) {
+                                //根据用户id查其所属部门的部门编码
+                                List<String> sysOrgCodeList = this.selectDeptCodeByUserId(vo.getUserId());
+                                String sysOrgCodes = String.join(",", sysOrgCodeList);
+
+                                //判断是否为组批任务、是组批前还是组批后的任务
+                                String remark = null;
+                                if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "1"))
+                                    remark = "(组批之后)";//组批之后
+                                else if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "0"))
+                                    remark = "(组批之前)";//组批之前
+                                if (remark == null) remark = "";
+                                //组推送对象
+                                ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
+                                        cost.getTaskno(), cost.getTaskname(), set.getId(), vo.getUsername(), set.getContent() + remark, sysOrgCodes, 0, "3");
+                                pushList.add(push);
+                            }
                         }
                     }
                 }
-            }
-            return pushList;
-        });
-
-
-        CompletableFuture<List<ProjectPushList>> t5 = CompletableFuture.supplyAsync(() -> {
-            // 4材料预算超限
-            QueryWrapper<ProjectPushSet> queryWrapper1 = new QueryWrapper<>();
-            queryWrapper1 = new QueryWrapper<>();
-            queryWrapper1.eq("cost_type", "4");// 4材料预算超限
-            List<ProjectPushSet> list = projectPushSetService.list(queryWrapper1);
-            List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
-            if (list != null && !list.isEmpty()) {
-                QueryWrapper<ProjectCost> projectCostQueryWrapper;
-                for (ProjectPushSet set : list) {
-                    List<ProjectCost> projectCostList1 = costService.selectProjectCostListWhereClysGtCLf();
-
-                    List<String> roleIds = Arrays.asList(set.getPushTo().split(","));
-                    List<UserNameIDVO> userNameIdList = this.userNamesByRoleIds(roleIds);
-
-                    for (ProjectCost cost : projectCostList1) {
-                        for (UserNameIDVO vo : userNameIdList) {
-                            //根据用户id查其所属部门的部门编码
-                            List<String> sysOrgCodeList = this.selectDeptCodeByUserId(vo.getUserId());
-                            String sysOrgCodes = sysOrgCodeList.stream().collect(Collectors.joining(","));
-
-                            //判断是否为组批任务、是组批前还是组批后的任务
-                            String remark = null;
-                            if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "1"))
-                                remark = "(组批之后)";//组批之后
-                            else if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "0"))
-                                remark = "(组批之前)";//组批之前
-                            if (remark == null) remark = "";
-                            //组推送对象
-                            ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
-                                    cost.getTaskno(), cost.getTaskname(), set.getId(), vo.getUsername(), set.getContent() + remark, sysOrgCodes, 1,"4");
-                            pushList.add(push);
+                return pushList;
+            });
+
+
+            CompletableFuture<List<ProjectPushList>> t5 = CompletableFuture.supplyAsync(() -> {
+                // 4材料预算超限
+                QueryWrapper<ProjectPushSet> queryWrapper1 = new QueryWrapper<>();
+                queryWrapper1 = new QueryWrapper<>();
+                queryWrapper1.eq("cost_type", "4");// 4材料预算超限
+                List<ProjectPushSet> list = projectPushSetService.list(queryWrapper1);
+                List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
+                if (list != null && !list.isEmpty()) {
+                    QueryWrapper<ProjectCost> projectCostQueryWrapper;
+                    for (ProjectPushSet set : list) {
+                        List<ProjectCost> projectCostList1 = costService.selectProjectCostListWhereClysGtCLf();
+
+                        List<String> roleIds = Arrays.asList(set.getPushTo().split(","));
+                        List<UserNameIDVO> userNameIdList = this.userNamesByRoleIds(roleIds);
+
+                        for (ProjectCost cost : projectCostList1) {
+                            for (UserNameIDVO vo : userNameIdList) {
+                                //根据用户id查其所属部门的部门编码
+                                List<String> sysOrgCodeList = this.selectDeptCodeByUserId(vo.getUserId());
+                                String sysOrgCodes = sysOrgCodeList.stream().collect(Collectors.joining(","));
+
+                                //判断是否为组批任务、是组批前还是组批后的任务
+                                String remark = null;
+                                if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "1"))
+                                    remark = "(组批之后)";//组批之后
+                                else if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "0"))
+                                    remark = "(组批之前)";//组批之前
+                                if (remark == null) remark = "";
+                                //组推送对象
+                                ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
+                                        cost.getTaskno(), cost.getTaskname(), set.getId(), vo.getUsername(), set.getContent() + remark, sysOrgCodes, 1, "4");
+                                pushList.add(push);
+                            }
                         }
                     }
                 }
-            }
-            return pushList;
-        });
-
-        CompletableFuture<List<ProjectPushList>> t6 = CompletableFuture.supplyAsync(() -> {
-            //5合同额
-            String stage = "100";
-            QueryWrapper<ProjectCost> projectCostQueryWrapper = new QueryWrapper<>();
-            projectCostQueryWrapper.eq("contractfpe", new BigDecimal(0));
-            projectCostQueryWrapper.eq("processPercent", stage);
-
-            List<ProjectCost> projectCostList1 = costService.projectCostlist(projectCostQueryWrapper);
-            List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
-            for (ProjectCost cost : projectCostList1) {
-                String taskno = cost.getTaskno();
-                String orgcode = null;
-                String username = null;
-                if (taskno != null) {
-                    KyTaskInfo kyTaskInfo = kyTaskInfoService.getKyTaskInfoByTaskno(taskno);
-                    if (kyTaskInfo != null) {
-                        if (kyTaskInfo.getJycsid() != null) {//下达部门id
-                            SysDepart sysDepart = departService.getById(kyTaskInfo.getJycsid());
-                            if (sysDepart != null) orgcode = sysDepart.getOrgCode();
-                        }
-                        if (kyTaskInfo.getBusinessmanname() != null) {
-                            QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
-                            wrapper.eq("realname", kyTaskInfo.getBusinessmanname());
-                            SysUser user = sysUserService.getOne(wrapper);
-                            if (user != null) username = user.getUsername();
+                return pushList;
+            });
+
+            CompletableFuture<List<ProjectPushList>> t6 = CompletableFuture.supplyAsync(() -> {
+                //5合同额
+                String stage = "100";
+                QueryWrapper<ProjectCost> projectCostQueryWrapper = new QueryWrapper<>();
+                projectCostQueryWrapper.eq("contractfpe", new BigDecimal(0));
+                projectCostQueryWrapper.eq("processPercent", stage);
+
+                List<ProjectCost> projectCostList1 = costService.projectCostlist(projectCostQueryWrapper);
+                List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
+                for (ProjectCost cost : projectCostList1) {
+                    String taskno = cost.getTaskno();
+                    String orgcode = null;
+                    String username = null;
+                    if (taskno != null) {
+                        KyTaskInfo kyTaskInfo = kyTaskInfoService.getKyTaskInfoByTaskno(taskno);
+                        if (kyTaskInfo != null) {
+                            if (kyTaskInfo.getJycsid() != null) {//下达部门id
+                                SysDepart sysDepart = departService.getById(kyTaskInfo.getJycsid());
+                                if (sysDepart != null) orgcode = sysDepart.getOrgCode();
+                            }
+                            if (kyTaskInfo.getBusinessmanname() != null) {
+                                QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
+                                wrapper.eq("realname", kyTaskInfo.getBusinessmanname());
+                                SysUser user = sysUserService.getOne(wrapper);
+                                if (user != null) username = user.getUsername();
+                            }
                         }
                     }
-                }
 
-                //判断是否为组批任务、是组批前还是组批后的任务
-                String remark = null;
-                if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "1")) remark = "(组批之后)";//组批之后
-                else if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "0")) remark = "(组批之前)";//组批之前
-                if (remark == null) remark = "";
-                ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
-                        cost.getTaskno(), cost.getTaskname(), "", username, "请及时处理合同额" + remark, orgcode, 0,"5");
-                pushList.add(push);
-            }
-            return pushList;
-        });
-
-
-        CompletableFuture<List<ProjectPushList>> t7 = CompletableFuture.supplyAsync(() -> {
-            //6收款额
-            String stage = "100";
-            QueryWrapper<ProjectCost> projectCostQueryWrapper = new QueryWrapper<>();
-            projectCostQueryWrapper.eq("TaskMoney", new BigDecimal(0));
-            projectCostQueryWrapper.eq("processPercent", stage);
-            List<ProjectCost> projectCostList2 = costService.projectCostlist(projectCostQueryWrapper);
-            List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
-            for (ProjectCost cost : projectCostList2) {
-                String taskno = cost.getTaskno();
-                String orgcode = null;
-                String username = null;
-                if (taskno != null) {
-                    KyTaskInfo kyTaskInfo = kyTaskInfoService.getKyTaskInfoByTaskno(taskno);
-                    if (kyTaskInfo != null) {
-                        if (kyTaskInfo.getJycsid() != null) {//下达部门id
-                            SysDepart sysDepart = departService.getById(kyTaskInfo.getJycsid());
-                            if (sysDepart != null) orgcode = sysDepart.getOrgCode();
-                        }
-                        if (kyTaskInfo.getBusinessmanname()!= null) {
-                            QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
-                            wrapper.eq("realname", kyTaskInfo.getBusinessmanname());
-                            SysUser user = sysUserService.getOne(wrapper);
-                            if (user != null) username = user.getUsername();
+                    //判断是否为组批任务、是组批前还是组批后的任务
+                    String remark = null;
+                    if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "1")) remark = "(组批之后)";//组批之后
+                    else if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "0"))
+                        remark = "(组批之前)";//组批之前
+                    if (remark == null) remark = "";
+                    ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
+                            cost.getTaskno(), cost.getTaskname(), "", username, "请及时处理合同额" + remark, orgcode, 0, "5");
+                    pushList.add(push);
+                }
+                return pushList;
+            });
+
+
+            CompletableFuture<List<ProjectPushList>> t7 = CompletableFuture.supplyAsync(() -> {
+                //6收款额
+                String stage = "100";
+                QueryWrapper<ProjectCost> projectCostQueryWrapper = new QueryWrapper<>();
+                projectCostQueryWrapper.eq("TaskMoney", new BigDecimal(0));
+                projectCostQueryWrapper.eq("processPercent", stage);
+                List<ProjectCost> projectCostList2 = costService.projectCostlist(projectCostQueryWrapper);
+                List<ProjectPushList> pushList = new ArrayList<>();//所有的推送列表
+                for (ProjectCost cost : projectCostList2) {
+                    String taskno = cost.getTaskno();
+                    String orgcode = null;
+                    String username = null;
+                    if (taskno != null) {
+                        KyTaskInfo kyTaskInfo = kyTaskInfoService.getKyTaskInfoByTaskno(taskno);
+                        if (kyTaskInfo != null) {
+                            if (kyTaskInfo.getJycsid() != null) {//下达部门id
+                                SysDepart sysDepart = departService.getById(kyTaskInfo.getJycsid());
+                                if (sysDepart != null) orgcode = sysDepart.getOrgCode();
+                            }
+                            if (kyTaskInfo.getBusinessmanname() != null) {
+                                QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
+                                wrapper.eq("realname", kyTaskInfo.getBusinessmanname());
+                                SysUser user = sysUserService.getOne(wrapper);
+                                if (user != null) username = user.getUsername();
+                            }
                         }
                     }
-                }
 
-                //判断是否为组批任务、是组批前还是组批后的任务
-                String remark = null;
-                if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "1")) remark = "(组批之后)";//组批之后
-                else if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "0")) remark = "(组批之前)";//组批之前
-                if (remark == null) remark = "";
-                ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
-                        cost.getTaskno(), cost.getTaskname(), "", username, "请及时处理已收款" + remark, orgcode, 0,"6");
-                pushList.add(push);
-            }
-            return pushList;
-        });
-
-        CompletableFuture<Void> future = CompletableFuture.allOf(t1, t2, t3, t4, t5, t6, t7);
-        future.get();
-        List<ProjectPushList> projectPushLists = t1.get();
-        List<ProjectPushList> projectPushLists1 = t2.get();
-        List<ProjectPushList> projectPushLists2 = t3.get();
-        List<ProjectPushList> projectPushLists3 = t4.get();
-        List<ProjectPushList> projectPushLists4 = t5.get();
-        List<ProjectPushList> projectPushLists5 = t6.get();
-        List<ProjectPushList> projectPushLists6 = t7.get();
-        List<ProjectPushList> mergedList = Stream.of(projectPushLists, projectPushLists1, projectPushLists2, projectPushLists3, projectPushLists4, projectPushLists5, projectPushLists6)
-                .flatMap(java.util.Collection::stream)
-                .collect(Collectors.toList());
-
-        this.saveBatch(mergedList);
-        return Result.OK("添加成功!");
+                    //判断是否为组批任务、是组批前还是组批后的任务
+                    String remark = null;
+                    if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "1")) remark = "(组批之后)";//组批之后
+                    else if (cost.getPccode() != null && Objects.equals(cost.getStatus(), "0"))
+                        remark = "(组批之前)";//组批之前
+                    if (remark == null) remark = "";
+                    ProjectPushList push = ProjectPushListConvert.INSTANCE.toProjectPushList(
+                            cost.getTaskno(), cost.getTaskname(), "", username, "请及时处理已收款" + remark, orgcode, 0, "6");
+                    pushList.add(push);
+                }
+                return pushList;
+            });
+
+            CompletableFuture<Void> future = CompletableFuture.allOf(t1, t2, t3, t4, t5, t6, t7);
+            future.get();
+            List<ProjectPushList> projectPushLists = t1.get();
+            List<ProjectPushList> projectPushLists1 = t2.get();
+            List<ProjectPushList> projectPushLists2 = t3.get();
+            List<ProjectPushList> projectPushLists3 = t4.get();
+            List<ProjectPushList> projectPushLists4 = t5.get();
+            List<ProjectPushList> projectPushLists5 = t6.get();
+            List<ProjectPushList> projectPushLists6 = t7.get();
+            List<ProjectPushList> mergedList = Stream.of(projectPushLists, projectPushLists1, projectPushLists2, projectPushLists3, projectPushLists4, projectPushLists5, projectPushLists6)
+                    .flatMap(java.util.Collection::stream)
+                    .collect(Collectors.toList());
+
+            this.saveBatch(mergedList);
+        }catch (Exception e){
+            e.printStackTrace();
+            return Result.ok("推送失败");
+        }
+        return Result.ok("推送成功");
     }