|
@@ -90,31 +90,6 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //权限
|
|
|
- String deptIdStr = user.getDeptId();
|
|
|
- if (deptIdStr != null) {
|
|
|
- Long deptId = Func.firstLong(deptIdStr);
|
|
|
- ProjectAuth auth = new ProjectAuth();
|
|
|
- auth.setUserId(user.getUserId());
|
|
|
- R<Dept> rpc = sysClient.getDept(deptId);
|
|
|
- if (rpc.isSuccess()) {
|
|
|
- String ancestors = rpc.getData().getAncestors();
|
|
|
- if (ancestors != null && ancestors.contains(String.valueOf(ZERO))) {
|
|
|
- List<Long> parentIds = Func.toLongList(ancestors);
|
|
|
- if (!CollectionUtils.isEmpty(parentIds)) {
|
|
|
- if (parentIds.size() > 1) {
|
|
|
- auth.setTopDept(parentIds.get(1));
|
|
|
- } else {
|
|
|
- auth.setTopDept(Long.valueOf(deptIdStr));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- auth.setUserDept(deptId);
|
|
|
- auth.setProjectId(project.getId());
|
|
|
- projectAuthService.save(auth);
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -156,7 +131,6 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
if (createUser != null) {
|
|
|
R<User> userR = userClient.userInfoById(createUser);
|
|
|
if (userR.isSuccess()) {
|
|
|
- List<TaskLog> logs = new ArrayList<>();
|
|
|
|
|
|
TaskLog log = new TaskLog();
|
|
|
log.setId(IdWorker.getId());
|
|
@@ -169,7 +143,8 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
Date time = DateUtil.now();
|
|
|
log.setCreateTime(time);
|
|
|
log.setUpdateTime(time);
|
|
|
- logs.add(log);
|
|
|
+ taskLogService.save(log);
|
|
|
+
|
|
|
Long orgDeptId = null;
|
|
|
if (task.getOrgDeptId() != null && task.getOrgDeptId() > 0L) {
|
|
|
orgDeptId = task.getOrgDeptId();
|
|
@@ -184,10 +159,9 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
taskLog.setCreateDept(task.getCreateDept());
|
|
|
taskLog.setCreateUser(task.getCreateUser());
|
|
|
taskLog.setUpdateUser(task.getUpdateUser());
|
|
|
- time.setTime(time.getTime() + 1000);
|
|
|
- taskLog.setCreateTime(time);
|
|
|
- taskLog.setUpdateTime(time);
|
|
|
- logs.add(taskLog);
|
|
|
+ taskLog.setCreateTime(DateUtil.now());
|
|
|
+ taskLog.setUpdateTime(DateUtil.now());
|
|
|
+ taskLogService.save(taskLog);
|
|
|
|
|
|
//项目权限
|
|
|
ProjectAuth auth = new ProjectAuth();
|
|
@@ -257,7 +231,6 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- taskLogService.saveBatch(logs);
|
|
|
if (!CollectionUtils.isEmpty(auths)) {
|
|
|
projectAuthService.saveBatch(auths);
|
|
|
}
|
|
@@ -274,7 +247,6 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
public void alterTask(Task afterUpdate, Task beforeUpdate, Long userId) {
|
|
|
R<User> userR = userClient.userInfoById(userId);
|
|
|
if (userR.isSuccess()) {
|
|
|
- List<TaskLog> logs = new ArrayList<>();
|
|
|
List<ProjectAuth> auths = new ArrayList<>();
|
|
|
List<ProjectGroup> groups = new ArrayList<>();
|
|
|
|
|
@@ -298,7 +270,7 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
log.setUpdateUser(afterUpdate.getUpdateUser());
|
|
|
log.setCreateTime(DateUtil.now());
|
|
|
log.setUpdateTime(DateUtil.now());
|
|
|
- logs.add(log);
|
|
|
+ taskLogService.save(log);
|
|
|
|
|
|
ProjectAuth auth = new ProjectAuth();
|
|
|
auth.setTopDept(orgDeptId);
|
|
@@ -320,7 +292,7 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
log1.setUpdateUser(userId);
|
|
|
log1.setCreateTime(DateUtil.now());
|
|
|
log1.setUpdateTime(DateUtil.now());
|
|
|
- logs.add(log1);
|
|
|
+ taskLogService.save(log1);
|
|
|
|
|
|
ProjectAuth auth = new ProjectAuth();
|
|
|
auth.setTopDept(orgDeptId);
|
|
@@ -346,7 +318,7 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
log2.setUpdateUser(userId);
|
|
|
log2.setCreateTime(DateUtil.now());
|
|
|
log2.setUpdateTime(DateUtil.now());
|
|
|
- logs.add(log2);
|
|
|
+ taskLogService.save(log2);
|
|
|
|
|
|
String deptStr = userR1.getData().getDeptId();
|
|
|
if (StringUtil.isNotBlank(deptStr) && orgDeptId != null) {
|
|
@@ -412,7 +384,7 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
log3.setUpdateUser(userId);
|
|
|
log3.setCreateTime(DateUtil.now());
|
|
|
log3.setUpdateTime(DateUtil.now());
|
|
|
- logs.add(log3);
|
|
|
+ taskLogService.save(log3);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -466,7 +438,7 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
log4.setUpdateUser(userId);
|
|
|
log4.setCreateTime(DateUtil.now());
|
|
|
log4.setUpdateTime(DateUtil.now());
|
|
|
- logs.add(log4);
|
|
|
+ taskLogService.save(log4);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -480,6 +452,7 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
log.setUpdateUser(userId);
|
|
|
log.setCreateTime(DateUtil.now());
|
|
|
log.setUpdateTime(DateUtil.now());
|
|
|
+ taskLogService.save(log);
|
|
|
}
|
|
|
|
|
|
//7.审查任务
|
|
@@ -492,6 +465,7 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
log.setUpdateUser(userId);
|
|
|
log.setCreateTime(DateUtil.now());
|
|
|
log.setUpdateTime(DateUtil.now());
|
|
|
+ taskLogService.save(log);
|
|
|
}
|
|
|
|
|
|
//8.二次审查任务
|
|
@@ -504,6 +478,7 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
log.setUpdateUser(userId);
|
|
|
log.setCreateTime(DateUtil.now());
|
|
|
log.setUpdateTime(DateUtil.now());
|
|
|
+ taskLogService.save(log);
|
|
|
}
|
|
|
|
|
|
//9.确认任务
|
|
@@ -516,6 +491,7 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
log.setUpdateUser(userId);
|
|
|
log.setCreateTime(DateUtil.now());
|
|
|
log.setUpdateTime(DateUtil.now());
|
|
|
+ taskLogService.save(log);
|
|
|
|
|
|
//项目下待完成的任务减少
|
|
|
Project project = projectMapper.selectById(projectId);
|
|
@@ -534,6 +510,7 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
log.setUpdateUser(userId);
|
|
|
log.setCreateTime(DateUtil.now());
|
|
|
log.setUpdateTime(DateUtil.now());
|
|
|
+ taskLogService.save(log);
|
|
|
|
|
|
//项目下待完成的任务减少
|
|
|
Project project = projectMapper.selectById(projectId);
|
|
@@ -542,8 +519,6 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
projectMapper.updateById(project);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- taskLogService.saveBatch(logs);
|
|
|
if (!CollectionUtils.isEmpty(auths)) {
|
|
|
projectAuthService.saveBatch(auths);
|
|
|
}
|
|
@@ -919,6 +894,85 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ String executeUser = task.getExecuteUser();
|
|
|
+ if (!StringUtil.isNotBlank(executeUser)) {
|
|
|
+ Date endTime = task.getEndTime();
|
|
|
+ String format = DateUtil.format(endTime, "yyyy-MM-dd");
|
|
|
+ List<Long> users = Func.toLongList(executeUser);
|
|
|
+ if (userR.isSuccess() && project != null) {
|
|
|
+ String name = userR.getData().getName();
|
|
|
+ users.forEach(user -> {
|
|
|
+ R<User> userR1 = userClient.userInfoById(userId);
|
|
|
+ if (userR1.isSuccess()) {
|
|
|
+ String phone = userR1.getData().getPhone();
|
|
|
+ if (StringUtil.isNotBlank(name) && StringUtil.isNotBlank(phone)) {
|
|
|
+ try {
|
|
|
+ //发送短信
|
|
|
+ // 1.创建一个认证对象
|
|
|
+ Credential cred = new Credential(NacosConfigValue.txSecretId, NacosConfigValue.txSecretKey);
|
|
|
+ //2.实例化一个http选项
|
|
|
+ HttpProfile httpProfile = new HttpProfile();
|
|
|
+ httpProfile.setReqMethod("POST");
|
|
|
+ httpProfile.setConnTimeout(60);
|
|
|
+ httpProfile.setEndpoint("sms.tencentcloudapi.com");
|
|
|
+ //3实例化一个客户端配置对象
|
|
|
+ ClientProfile clientProfile = new ClientProfile();
|
|
|
+ clientProfile.setSignMethod("HmacSHA256");
|
|
|
+ clientProfile.setHttpProfile(httpProfile);
|
|
|
+ SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);
|
|
|
+
|
|
|
+ //4.实例化请求对象
|
|
|
+ SendSmsRequest req = new SendSmsRequest();
|
|
|
+ String sdkAppId = "1400785942";
|
|
|
+ req.setSmsSdkAppid(sdkAppId);
|
|
|
+
|
|
|
+ String signName = "梧桐树网";
|
|
|
+ req.setSign(signName);
|
|
|
+
|
|
|
+ //任务下发通知模版id
|
|
|
+ String templateId = "1948622";
|
|
|
+ req.setTemplateID(templateId);
|
|
|
+
|
|
|
+ /* 模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,若无模板参数,则设置为空 */
|
|
|
+ String[] templateParamSet = {name, format};
|
|
|
+ req.setTemplateParamSet(templateParamSet);
|
|
|
+
|
|
|
+ String[] phoneNumberSet = {"+86" + phone};
|
|
|
+ req.setPhoneNumberSet(phoneNumberSet);
|
|
|
+
|
|
|
+ SendSmsResponse res = client.SendSms(req);
|
|
|
+ log.info(SendSmsResponse.toJsonString(res));
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("发送短信失败" + e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ //发送消息到首页
|
|
|
+ List<IndexMessage> messages = new ArrayList<>();
|
|
|
+ IndexMessage msg = new IndexMessage();
|
|
|
+ msg.setToUser(user);
|
|
|
+ msg.setContent(name + "指派" + project.getName() + task.getTitle() + "的任务,请及时完成");
|
|
|
+ msg.setCategory(1);
|
|
|
+ msg.setOpenUrl("/task");
|
|
|
+ msg.setCreateUser(userId);
|
|
|
+ msg.setUpdateUser(userId);
|
|
|
+ messages.add(msg);
|
|
|
+
|
|
|
+ IndexMessage message = new IndexMessage();
|
|
|
+ message.setToUser(user);
|
|
|
+ message.setContent(project.getName() + task.getTitle() + "的任务截至时间为" + format + ",请及时完成");
|
|
|
+ message.setCategory(1);
|
|
|
+ message.setOpenUrl("/task");
|
|
|
+ message.setCreateUser(userId);
|
|
|
+ message.setUpdateUser(userId);
|
|
|
+ messages.add(message);
|
|
|
+ indexMessageService.saveBatch(messages);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|