一级需求任务:补充各节点对一级发起人的通知
补充以下节点的一级发起人通知: 1. 子任务被接单 - 同时通知一级发起人 2. 子任务进度更新 - 同时通知一级发起人 3. 流水线任务全部完成 - 同时通知一级发起人 4. 子任务组审核通过并指派 - 通知一级发起人 5. 需求部门审批通过 - 通知一级发起人审核进度 6. 需求部门审批驳回 - 同时通知一级发起人 7. 接单部门审批通过 - 通知一级发起人任务已发布 8. 接单部门审批驳回 - 同时通知一级发起人 确保一级需求发起人能够全程跟踪任务状态变化
This commit is contained in:
parent
dc2cb78b26
commit
a41553fe88
@ -350,6 +350,17 @@ public class TaskApprovalService {
|
||||
taskId
|
||||
);
|
||||
}
|
||||
|
||||
// 🔥 一级需求任务:通知一级发起人需求部门审核已通过
|
||||
if (task.getPrimaryPublisherId() != null) {
|
||||
notificationService.sendNotification(
|
||||
task.getPrimaryPublisherId(),
|
||||
"任务审核进度更新",
|
||||
String.format("您发起的任务【%s】已通过需求部门审核,进入接单部门审核阶段", task.getTitle()),
|
||||
"task_approval_progress",
|
||||
taskId
|
||||
);
|
||||
}
|
||||
|
||||
log.info("需求部门负责人审核通过,任务ID:{},审核人:{},发布类型:{},等待接单部门负责人审核", taskId, approverId, releaseType);
|
||||
}
|
||||
@ -371,7 +382,7 @@ public class TaskApprovalService {
|
||||
|
||||
logApproval(taskId, approverId, 1, "reject", reason);
|
||||
|
||||
// 通知发起人
|
||||
// 通知发起人(明细完善人)
|
||||
notificationService.sendNotification(
|
||||
task.getPublisherId(),
|
||||
"任务已被驳回",
|
||||
@ -380,6 +391,18 @@ public class TaskApprovalService {
|
||||
taskId
|
||||
);
|
||||
|
||||
// 🔥 一级需求任务:同时通知一级发起人
|
||||
if (task.getPrimaryPublisherId() != null
|
||||
&& !task.getPrimaryPublisherId().equals(task.getPublisherId())) {
|
||||
notificationService.sendNotification(
|
||||
task.getPrimaryPublisherId(),
|
||||
"任务已被驳回",
|
||||
String.format("您发起的任务【%s】被需求部门负责人驳回,原因:%s", task.getTitle(), reason),
|
||||
"task_reject",
|
||||
taskId
|
||||
);
|
||||
}
|
||||
|
||||
// 如果任务有指定的处理人,发送群通知告知驳回
|
||||
if (task.getReceiverId() != null) {
|
||||
try {
|
||||
@ -514,6 +537,19 @@ public class TaskApprovalService {
|
||||
"已指定给设计师" + assignNote + ":" + (receiver != null ? receiver.getRealName() : finalReceiverId);
|
||||
}
|
||||
logApproval(taskId, approverId, 2, "approve", logComment);
|
||||
|
||||
// 🔥 一级需求任务:通知一级发起人任务已通过审核并发布
|
||||
if (task.getPrimaryPublisherId() != null) {
|
||||
String statusDesc = finalReceiverId != null ? "已指派给设计师" : "已发布到任务大厅";
|
||||
notificationService.sendNotification(
|
||||
task.getPrimaryPublisherId(),
|
||||
"任务审核通过",
|
||||
String.format("您发起的任务【%s】已通过全部审核,%s", task.getTitle(), statusDesc),
|
||||
"task_approved",
|
||||
taskId
|
||||
);
|
||||
log.info("已通知一级发起人 {} 任务审核通过", task.getPrimaryPublisherId());
|
||||
}
|
||||
|
||||
// 发送钉钉通知
|
||||
// 对于流水线任务,需要给第一个部门的所有子任务设计师发送通知
|
||||
@ -714,7 +750,7 @@ public class TaskApprovalService {
|
||||
|
||||
logApproval(taskId, approverId, 2, "reject", reason);
|
||||
|
||||
// 1. 通知任务发起人
|
||||
// 1. 通知任务发起人(明细完善人)
|
||||
notificationService.sendNotification(
|
||||
task.getPublisherId(),
|
||||
"任务已被驳回",
|
||||
@ -724,6 +760,19 @@ public class TaskApprovalService {
|
||||
);
|
||||
log.info("已通知任务发起人: publisherId={}", task.getPublisherId());
|
||||
|
||||
// 🔥 1.5 一级需求任务:同时通知一级发起人
|
||||
if (task.getPrimaryPublisherId() != null
|
||||
&& !task.getPrimaryPublisherId().equals(task.getPublisherId())) {
|
||||
notificationService.sendNotification(
|
||||
task.getPrimaryPublisherId(),
|
||||
"任务已被驳回",
|
||||
String.format("您发起的任务【%s】被接单部门负责人驳回,原因:%s", task.getTitle(), reason),
|
||||
"task_reject",
|
||||
taskId
|
||||
);
|
||||
log.info("已通知一级发起人: primaryPublisherId={}", task.getPrimaryPublisherId());
|
||||
}
|
||||
|
||||
// 2. 如果需求部门负责人存在且不是发起人,也通知需求部门负责人
|
||||
if (demandDept != null && demandDept.getLeaderId() != null && !demandDept.getLeaderId().equals(task.getPublisherId())) {
|
||||
notificationService.sendNotification(
|
||||
|
||||
@ -429,6 +429,22 @@ public class TaskItemService {
|
||||
notification.setPushDingtalk(1); // 推送到钉钉
|
||||
notificationService.sendNotification(notification);
|
||||
}
|
||||
|
||||
// 🔥 一级需求任务:同时通知一级发起人
|
||||
if (mainTask.getPrimaryPublisherId() != null
|
||||
&& !mainTask.getPrimaryPublisherId().equals(mainTask.getPublisherId())) {
|
||||
Notification notification2 = new Notification();
|
||||
notification2.setReceiverId(mainTask.getPrimaryPublisherId());
|
||||
notification2.setNotificationType("task");
|
||||
notification2.setTitle("子任务已被接单");
|
||||
notification2.setContent(user.getRealName() + " 接单了子任务:" + item.getItemNo());
|
||||
notification2.setRelatedId(itemId);
|
||||
notification2.setRelatedType("task_item");
|
||||
notification2.setPriority(1);
|
||||
notification2.setPushDingtalk(1);
|
||||
notificationService.sendNotification(notification2);
|
||||
log.info("已通知一级发起人 {} 子任务被接单", mainTask.getPrimaryPublisherId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -509,6 +525,21 @@ public class TaskItemService {
|
||||
|
||||
log.info("已通知需求者 {} 任务进度更新: 子任务={}, 进度={}%",
|
||||
mainTask.getPublisherId(), item.getItemNo(), progress);
|
||||
|
||||
// 🔥 一级需求任务:同时通知一级发起人
|
||||
if (mainTask.getPrimaryPublisherId() != null
|
||||
&& !mainTask.getPrimaryPublisherId().equals(mainTask.getPublisherId())) {
|
||||
notificationService.sendNotification(
|
||||
mainTask.getPrimaryPublisherId(),
|
||||
"任务进度已更新",
|
||||
content.toString(),
|
||||
"PROGRESS_UPDATE",
|
||||
"task_item",
|
||||
itemId
|
||||
);
|
||||
log.info("已通知一级发起人 {} 任务进度更新: 子任务={}, 进度={}%",
|
||||
mainTask.getPrimaryPublisherId(), item.getItemNo(), progress);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 通知失败不影响主流程
|
||||
@ -760,6 +791,22 @@ public class TaskItemService {
|
||||
notification.setPushDingtalk(1); // 推送到钉钉
|
||||
notificationService.sendNotification(notification);
|
||||
}
|
||||
|
||||
// 🔥 一级需求任务:同时通知一级发起人
|
||||
if (mainTask.getPrimaryPublisherId() != null
|
||||
&& !mainTask.getPrimaryPublisherId().equals(mainTask.getPublisherId())) {
|
||||
Notification notification2 = new Notification();
|
||||
notification2.setReceiverId(mainTask.getPrimaryPublisherId());
|
||||
notification2.setNotificationType("task");
|
||||
notification2.setTitle("流水线任务已完成");
|
||||
notification2.setContent("您发起的任务《" + mainTask.getTitle() + "》所有子任务已完成!");
|
||||
notification2.setRelatedId(mainTask.getId());
|
||||
notification2.setRelatedType("task");
|
||||
notification2.setPriority(1);
|
||||
notification2.setPushDingtalk(1);
|
||||
notificationService.sendNotification(notification2);
|
||||
log.info("已通知一级发起人 {} 任务全部完成", mainTask.getPrimaryPublisherId());
|
||||
}
|
||||
|
||||
result.put("mainTaskCompleted", true);
|
||||
} else {
|
||||
@ -980,6 +1027,24 @@ public class TaskItemService {
|
||||
notification.setPushDingtalk(1); // 推送到钉钉
|
||||
notificationService.sendNotification(notification);
|
||||
|
||||
// 🔥 一级需求任务:通知一级发起人子任务已指派
|
||||
if (mainTask.getPrimaryPublisherId() != null) {
|
||||
com.designhub.entity.User designer = userService.getUserById(assignedReceiverId);
|
||||
String designerName = designer != null ? designer.getRealName() : "未知";
|
||||
Notification notification2 = new Notification();
|
||||
notification2.setReceiverId(mainTask.getPrimaryPublisherId());
|
||||
notification2.setNotificationType("task");
|
||||
notification2.setTitle("子任务已指派");
|
||||
notification2.setContent("任务《" + mainTask.getTitle() + "》的第 " + groupNo +
|
||||
" 组已指派给设计师 " + designerName);
|
||||
notification2.setRelatedId(taskId);
|
||||
notification2.setRelatedType("task");
|
||||
notification2.setPriority(1);
|
||||
notification2.setPushDingtalk(1);
|
||||
notificationService.sendNotification(notification2);
|
||||
log.info("已通知一级发起人 {} 子任务组已指派", mainTask.getPrimaryPublisherId());
|
||||
}
|
||||
|
||||
// 发送钉钉群通知并@指定的设计师
|
||||
try {
|
||||
java.math.BigDecimal totalScore = groupItems.stream()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user