|
@@ -118,15 +118,70 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
log.setUpdateTime(DateUtil.now());
|
|
|
logs.add(log);
|
|
|
if (task.getOrgDeptId() != null) {
|
|
|
- TaskLog taskLog = new TaskLog();
|
|
|
- taskLog.setTaskId(task.getId());
|
|
|
- taskLog.setContent(userR.getData().getName() + " 指定了执行单位");
|
|
|
- taskLog.setCreateDept(task.getCreateDept());
|
|
|
- taskLog.setCreateUser(task.getCreateUser());
|
|
|
- taskLog.setUpdateUser(task.getUpdateUser());
|
|
|
- taskLog.setCreateTime(DateUtil.now());
|
|
|
- taskLog.setUpdateTime(DateUtil.now());
|
|
|
- logs.add(log);
|
|
|
+ Long orgDeptId = task.getOrgDeptId();
|
|
|
+ R<Dept> dept = sysClient.getDept(orgDeptId);
|
|
|
+ if (dept.isSuccess()) {
|
|
|
+ TaskLog taskLog = new TaskLog();
|
|
|
+ taskLog.setTaskId(task.getId());
|
|
|
+ taskLog.setContent(userR.getData().getName() + " 指定了执行单位为" + dept.getData().getDeptName());
|
|
|
+ taskLog.setCreateDept(task.getCreateDept());
|
|
|
+ taskLog.setCreateUser(task.getCreateUser());
|
|
|
+ taskLog.setUpdateUser(task.getUpdateUser());
|
|
|
+ taskLog.setCreateTime(DateUtil.now());
|
|
|
+ taskLog.setUpdateTime(DateUtil.now());
|
|
|
+ logs.add(log);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (task.getExecuteDept() != null) {
|
|
|
+ Long executeDept = task.getExecuteDept();
|
|
|
+ R<Dept> dept = sysClient.getDept(executeDept);
|
|
|
+ if (dept.isSuccess()) {
|
|
|
+ TaskLog taskLog = new TaskLog();
|
|
|
+ taskLog.setTaskId(task.getId());
|
|
|
+ taskLog.setContent(userR.getData().getName() + " 指定了任务执行部门为" + dept.getData().getDeptName());
|
|
|
+ taskLog.setCreateDept(task.getCreateDept());
|
|
|
+ taskLog.setCreateUser(task.getCreateUser());
|
|
|
+ taskLog.setUpdateUser(task.getUpdateUser());
|
|
|
+ taskLog.setCreateTime(DateUtil.now());
|
|
|
+ taskLog.setUpdateTime(DateUtil.now());
|
|
|
+ logs.add(log);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (task.getProjectManager() != null) {
|
|
|
+ Long projectManager = task.getProjectManager();
|
|
|
+ R<User> userR1 = userClient.userInfoById(projectManager);
|
|
|
+ if (userR1.isSuccess()) {
|
|
|
+ TaskLog taskLog = new TaskLog();
|
|
|
+ taskLog.setTaskId(task.getId());
|
|
|
+ taskLog.setContent(userR.getData().getName() + " 指定了项目经理为 " + userR1.getData().getName());
|
|
|
+ taskLog.setCreateDept(task.getCreateDept());
|
|
|
+ taskLog.setCreateUser(task.getCreateUser());
|
|
|
+ taskLog.setUpdateUser(task.getUpdateUser());
|
|
|
+ taskLog.setCreateTime(DateUtil.now());
|
|
|
+ taskLog.setUpdateTime(DateUtil.now());
|
|
|
+ logs.add(log);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (task.getExecuteUser() != null) {
|
|
|
+ List<Long> userIds = Func.toLongList(task.getExecuteUser());
|
|
|
+ List<String> str = new ArrayList<>();
|
|
|
+ userIds.forEach(userId -> {
|
|
|
+ R<User> rpc = userClient.userInfoById(userId);
|
|
|
+ if (rpc.isSuccess()) {
|
|
|
+ str.add(rpc.getData().getName());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (!CollectionUtils.isEmpty(str)) {
|
|
|
+ TaskLog taskLog = new TaskLog();
|
|
|
+ taskLog.setTaskId(task.getId());
|
|
|
+ taskLog.setContent(userR.getData().getName() + " 指定了任务执行者 " + Func.join(str));
|
|
|
+ taskLog.setCreateDept(task.getCreateDept());
|
|
|
+ taskLog.setCreateUser(task.getCreateUser());
|
|
|
+ taskLog.setUpdateUser(task.getUpdateUser());
|
|
|
+ taskLog.setCreateTime(DateUtil.now());
|
|
|
+ taskLog.setUpdateTime(DateUtil.now());
|
|
|
+ logs.add(log);
|
|
|
+ }
|
|
|
}
|
|
|
taskLogService.saveBatch(logs);
|
|
|
}
|
|
@@ -135,18 +190,80 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void submitTaskOrgDept(Long userId, Task task) {
|
|
|
+ public void updateTask(Integer type, Long userId, Task task) {
|
|
|
R<User> userR = userClient.userInfoById(userId);
|
|
|
if (userR.isSuccess()) {
|
|
|
- TaskLog log = new TaskLog();
|
|
|
- log.setTaskId(task.getId());
|
|
|
- log.setContent(userR.getData().getName() + " 指定了执行单位");
|
|
|
- log.setCreateDept(task.getCreateDept());
|
|
|
- log.setCreateUser(task.getCreateUser());
|
|
|
- log.setUpdateUser(task.getUpdateUser());
|
|
|
- log.setCreateTime(DateUtil.now());
|
|
|
- log.setUpdateTime(DateUtil.now());
|
|
|
- taskLogService.save(log);
|
|
|
+ List<TaskLog> logs = new ArrayList<>();
|
|
|
+ switch (type) {
|
|
|
+ case 1:
|
|
|
+ Long orgDeptId = task.getOrgDeptId();
|
|
|
+ R<Dept> dept = sysClient.getDept(orgDeptId);
|
|
|
+ if (dept.isSuccess()) {
|
|
|
+ TaskLog log = new TaskLog();
|
|
|
+ log.setTaskId(task.getId());
|
|
|
+ log.setContent(userR.getData().getName() + " 指定了执行单位为" + dept.getData().getDeptName());
|
|
|
+ log.setCreateDept(task.getCreateDept());
|
|
|
+ log.setCreateUser(task.getCreateUser());
|
|
|
+ log.setUpdateUser(task.getUpdateUser());
|
|
|
+ log.setCreateTime(DateUtil.now());
|
|
|
+ log.setUpdateTime(DateUtil.now());
|
|
|
+ logs.add(log);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ Long executeDept = task.getExecuteDept();
|
|
|
+ R<Dept> dept1 = sysClient.getDept(executeDept);
|
|
|
+ if (dept1.isSuccess()) {
|
|
|
+ TaskLog log1 = new TaskLog();
|
|
|
+ log1.setTaskId(task.getId());
|
|
|
+ log1.setContent(userR.getData().getName() + " 指定了任务执行部门为" + dept1.getData().getDeptName());
|
|
|
+ log1.setCreateDept(task.getCreateDept());
|
|
|
+ log1.setCreateUser(task.getCreateUser());
|
|
|
+ log1.setUpdateUser(task.getUpdateUser());
|
|
|
+ log1.setCreateTime(DateUtil.now());
|
|
|
+ log1.setUpdateTime(DateUtil.now());
|
|
|
+ logs.add(log1);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ Long projectManager = task.getProjectManager();
|
|
|
+ R<User> userR1 = userClient.userInfoById(projectManager);
|
|
|
+ if (userR1.isSuccess()) {
|
|
|
+ TaskLog log2 = new TaskLog();
|
|
|
+ log2.setTaskId(task.getId());
|
|
|
+ log2.setContent(userR.getData().getName() + " 指定了项目经理为 " + userR1.getData().getName());
|
|
|
+ log2.setCreateDept(task.getCreateDept());
|
|
|
+ log2.setCreateUser(task.getCreateUser());
|
|
|
+ log2.setUpdateUser(task.getUpdateUser());
|
|
|
+ log2.setCreateTime(DateUtil.now());
|
|
|
+ log2.setUpdateTime(DateUtil.now());
|
|
|
+ logs.add(log2);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ List<Long> userIds = Func.toLongList(task.getExecuteUser());
|
|
|
+ List<String> str = new ArrayList<>();
|
|
|
+ userIds.forEach(id -> {
|
|
|
+ R<User> rpc = userClient.userInfoById(id);
|
|
|
+ if (rpc.isSuccess()) {
|
|
|
+ str.add(rpc.getData().getName());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (!CollectionUtils.isEmpty(str)) {
|
|
|
+ TaskLog log3 = new TaskLog();
|
|
|
+ log3.setTaskId(task.getId());
|
|
|
+ log3.setContent(userR.getData().getName() + " 指定了任务执行者 " + Func.join(str));
|
|
|
+ log3.setCreateDept(task.getCreateDept());
|
|
|
+ log3.setCreateUser(task.getCreateUser());
|
|
|
+ log3.setUpdateUser(task.getUpdateUser());
|
|
|
+ log3.setCreateTime(DateUtil.now());
|
|
|
+ log3.setUpdateTime(DateUtil.now());
|
|
|
+ logs.add(log3);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ taskLogService.saveBatch(logs);
|
|
|
}
|
|
|
}
|
|
|
|