浏览代码

FTE计划修改4

yusm 1 月之前
父节点
当前提交
3d0b2dcb19

+ 27 - 32
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskController.java

@@ -503,57 +503,52 @@ public class TaskController {
         if (saved&&isInsert==1){
             if (user.getCompanyId()==Constant.MLD_COMPANY_ID&&task.getIsTaskPlan()==1&& org.apache.commons.lang3.StringUtils.isNotEmpty(task.getCheckFirstId())){
                 //给第一审核人发送信息提醒
+                msgRecepientList=new ArrayList<>();
                 log.info("添加工作计划,给第一审核人发送信息提醒");
                 User owner = userMapper.selectById(task.getCheckFirstId());
-                if (wxCorpInfo != null) {
-                    //推送到企业微信
-                    StringBuilder stringBuilder = new StringBuilder();
-                    stringBuilder.append("$userName="+owner.getCorpwxUserid()+"$")
-                            .append(":有新的工作计划待审核");
-                    wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,owner.getCorpwxUserid(), stringBuilder.toString(), "task",
-                            WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_PLAN_NEED_CHECK);
-                }
+                Information information = new Information();
+                information.setMsg("您有工作计划待审核");
+                information.setType(11);
+                information.setUserId(owner.getId());
+                information.setTime(LocalDateTime.now());
+                informationService.save(information);
             }
         } else if (saved && isUpdate > 0) {
+            msgRecepientList=new ArrayList<>();
             //第一审核人修改后, 变成待第二审核人审核
             if (isUpdate==1){
                 User owner = userMapper.selectById(task.getCheckSecondId());
-                if (wxCorpInfo != null) {
-                    //推送到企业微信
-                    StringBuilder stringBuilder = new StringBuilder();
-                    stringBuilder.append("$userName="+owner.getCorpwxUserid()+"$")
-                            .append(":有新的工作计划待审核");
-                    wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,owner.getCorpwxUserid(), stringBuilder.toString(), "task",
-                            WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_PLAN_NEED_CHECK);
-                }
+                Information information = new Information();
+                information.setMsg("您有工作计划待审核");
+                information.setType(11);
+                information.setUserId(owner.getId());
+                information.setTime(LocalDateTime.now());
+                informationService.save(information);
+
             }else if(isUpdate==2){
                 List<TaskExecutor> taskExecutorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().eq("task_id", task.getId()));
                 if(CollectionUtils.isNotEmpty(taskExecutorList)){
                     for (TaskExecutor taskExecutor : taskExecutorList) {
                         //给任务的执行人发送信息提醒
                         User owner = userMapper.selectById(taskExecutor.getExecutorId());
-                        if (wxCorpInfo != null) {
-                            //推送到企业微信
-                            StringBuilder stringBuilder = new StringBuilder();
-                            stringBuilder.append("$userName="+owner.getCorpwxUserid()+"$")
-                                    .append(":有新的任务,请及时查看");
-                            wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,owner.getCorpwxUserid(), stringBuilder.toString(), "task",
-                                    WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_PLAN_NEED_CHECK);
-                        }
+                        Information information = new Information();
+                        information.setMsg("您有新的任务");
+                        information.setType(1);
+                        information.setUserId(owner.getId());
+                        information.setTime(LocalDateTime.now());
+                        informationService.save(information);
                     }
                 }
             } else if (isUpdate==3) {
                 //给第一审核人发送信息提醒
                 log.info("驳回后小组长修改,给第一审核人发送信息提醒");
                 User owner = userMapper.selectById(task.getCheckFirstId());
-                if (wxCorpInfo != null) {
-                    //推送到企业微信
-                    StringBuilder stringBuilder = new StringBuilder();
-                    stringBuilder.append("$userName="+owner.getCorpwxUserid()+"$")
-                            .append(":有工作计划待审核");
-                    wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,owner.getCorpwxUserid(), stringBuilder.toString(), "task",
-                            WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_PLAN_NEED_CHECK);
-                }
+                Information information = new Information();
+                information.setType(11);
+                information.setMsg("您有工作计划待审核");
+                information.setUserId(owner.getId());
+                information.setTime(LocalDateTime.now());
+                informationService.save(information);
             }
         }
         if (task.getExecutorId() == null) {

+ 4 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -4830,8 +4830,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         projectIdList.add(-1);
                         List<Participation> participations = participationMapper.selectList(new QueryWrapper<Participation>().in("project_id", projectIdList));
                         List<String> userProjectIds = participations.stream().distinct().map(Participation::getUserId).collect(Collectors.toList());
-                        userProjectIds.add("-1");
                         userProjectIds.removeAll(userIds);
+                        userProjectIds.add("-1");
                         userIdsExtra.addAll(userProjectIds);
                         List<Map> taskPlanByGeneralMemb = projectMapper.getTaskPlanByGeneralMemb(userProjectIds, startDate, endDate, user.getCompanyId(), user.getId(),targetUserId);
                         for (Map map : taskPlanByGeneralMemb) {
@@ -8768,8 +8768,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
 
             QueryWrapper<User> queryWrapper = new QueryWrapper<User>();
             if (deptIds.size() > 0) {
+                deptIds.add(-1);
+                userIds.add("-1");
                 queryWrapper.in("department_id", deptIds).or().in("id", userIds);
             } else {
+                userIds.add("-1");
                 queryWrapper.in("id", userIds);
             }
 

+ 27 - 33
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java

@@ -37,6 +37,7 @@ import java.io.*;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -100,6 +101,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
 
     @Resource
     private TaskCommentMapper taskCommentMapper;
+    @Autowired
+    private InformationMapper informationMapper;
 
     @Override
     public HttpRespMsg getExecutorPanel(Integer projectId) {
@@ -1058,7 +1061,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
         HttpRespMsg msg = new HttpRespMsg();
         String userId = request.getHeader("Token");
         User user = userMapper.selectById(userId);
-        WxCorpInfo wxCorpInfo = wxCorpInfoService.getOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
 
         Task task = taskMapper.selectById(taskId);
         if (!userId.equals(task.getCheckFirstId())&&!userId.equals(task.getCheckSecondId())){
@@ -1075,14 +1077,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 taskMapper.updateById(task);
                 //给第二审核人发送信息提醒
                 User owner = userMapper.selectById(task.getCheckSecondId());
-                if (wxCorpInfo != null) {
-                    //推送到企业微信
-                    StringBuilder stringBuilder = new StringBuilder();
-                    stringBuilder.append("$userName="+owner.getCorpwxUserid()+"$")
-                            .append(":有新的工作计划待审核");
-                    wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,owner.getCorpwxUserid(), stringBuilder.toString(), "task",
-                            WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_PLAN_NEED_CHECK);
-                }
+                Information information = new Information();
+                information.setMsg("您有工作计划待审核");
+                information.setUserId(owner.getId());
+                information.setType(11);
+                information.setTime(LocalDateTime.now());
+                informationMapper.insert(information);
             }
             //第二审核人通过
             else if (task.getIsTaskPlan() == 1 && task.getTaskStatus() == 4
@@ -1098,14 +1098,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                     for (TaskExecutor taskExecutor : taskExecutorList) {
                         //给任务的执行人发送信息提醒
                         User owner = userMapper.selectById(taskExecutor.getExecutorId());
-                        if (wxCorpInfo != null) {
-                            //推送到企业微信
-                            StringBuilder stringBuilder = new StringBuilder();
-                            stringBuilder.append("$userName="+owner.getCorpwxUserid()+"$")
-                                    .append(":有新的任务,请及时查看");
-                            wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,owner.getCorpwxUserid(), stringBuilder.toString(), "task",
-                                    WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_PLAN_NEED_CHECK);
-                        }
+                        Information information = new Information();
+                        information.setMsg("您有新的任务");
+                        information.setType(1);
+                        information.setUserId(owner.getId());
+                        information.setTime(LocalDateTime.now());
+                        informationMapper.insert(information);
                     }
                 }
             }
@@ -1120,14 +1118,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 taskMapper.updateById(task);
                 //给小组长发送信息提醒
                 User owner = userMapper.selectById(task.getCreaterId());
-                if (wxCorpInfo != null) {
-                    //推送到企业微信
-                    StringBuilder stringBuilder = new StringBuilder();
-                    stringBuilder.append("$userName="+owner.getCorpwxUserid()+"$")
-                            .append(":有工作计划被驳回,请查看");
-                    wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,owner.getCorpwxUserid(), stringBuilder.toString(), "task",
-                            WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_PLAN_NEED_CHECK);
-                }
+                Information information = new Information();
+                information.setMsg("您有工作计划被驳回");
+                information.setType(11);
+                information.setUserId(owner.getId());
+                information.setTime(LocalDateTime.now());
+                informationMapper.insert(information);
             }
             //第二审核人驳回
             else if (task.getIsTaskPlan() == 1 && task.getTaskStatus() == 4
@@ -1139,14 +1135,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
 
                 //给小组长发送信息提醒
                 User owner = userMapper.selectById(task.getCreaterId());
-                if (wxCorpInfo != null) {
-                    //推送到企业微信
-                    StringBuilder stringBuilder = new StringBuilder();
-                    stringBuilder.append("$userName="+owner.getCorpwxUserid()+"$")
-                            .append(":有工作计划被驳回,请查看");
-                    wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,owner.getCorpwxUserid(), stringBuilder.toString(), "task",
-                            WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_PLAN_NEED_CHECK);
-                }
+                Information information = new Information();
+                information.setMsg("您有工作计划被驳回");
+                information.setType(11);
+                information.setUserId(owner.getId());
+                information.setTime(LocalDateTime.now());
+                informationMapper.insert(information);
             }
         }
         return msg;

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml

@@ -2936,7 +2936,7 @@
             AND (t.start_date IS NOT NULL and t.start_date &lt;= #{endDate})
         </if>
     </select>
-    <select id="findRelatedProjectIds" resultType="java.lang.Integer">
+    <select id="getRelatedProjectIds" resultType="java.lang.Integer">
         SELECT DISTINCT pl.project_id
         FROM project_leader pl
         WHERE pl.leader_id = #{userId}