|
@@ -20,6 +20,7 @@ import org.springblade.business.vo.*;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.common.utils.FileUtils;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
+import org.springblade.core.cloud.feign.EnableBladeFeign;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
@@ -51,6 +52,7 @@ import org.springblade.system.user.cache.UserCache;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.cloud.openfeign.EnableFeignClients;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
@@ -79,6 +81,7 @@ import java.util.stream.Collectors;
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
|
+@EnableFeignClients
|
|
|
public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implements ITaskService {
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(TaskServiceImpl.class);
|
|
@@ -388,7 +391,6 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
|
*/
|
|
|
@Override
|
|
|
public Map<String, String> getTaskCount(String projectId, String contractId, String userId) {
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
if (StringUtils.isNotEmpty(projectId) && StringUtils.isNotEmpty(contractId)) {
|
|
|
List<Task> tasks = this.baseMapper.selectList(Wrappers.<Task>lambdaQuery()
|
|
|
.select(Task::getProcessInstanceId)
|
|
@@ -423,7 +425,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
|
long messageCount3 = messageWarnings.stream().filter(f -> f.getType().equals(3)).count();
|
|
|
long messageCount4 = messageWarnings.stream().filter(f -> f.getType().equals(4)).count();
|
|
|
long messageCount5 = messageWarnings.stream().filter(f -> f.getType().equals(5)).count();
|
|
|
-
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
map.put("allCount", String.valueOf(taskAllCount + messageWarnings.size()));//任务管理
|
|
|
map.put("taskCount", String.valueOf(taskAllCount));//任务查看
|
|
|
map.put("messageCount", String.valueOf(messageWarnings.size()));//消息提醒
|
|
@@ -433,15 +435,14 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
|
map.put("messageCount_4", String.valueOf(messageCount4));//工单反馈
|
|
|
map.put("messageCount_5", String.valueOf(messageCount5));//系统消息
|
|
|
map.put("userId", userId);
|
|
|
- }
|
|
|
- return map;
|
|
|
- /*else {
|
|
|
+ return map;
|
|
|
+ } else {
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
List<BusinessUserOpinionVO> businessUserOpinionVOS = userOpinionService.getBaseMapper().queryManageUserOpinionList(userId).stream().filter(f -> f.getIsCurrent().equals(false)).collect(Collectors.toList());
|
|
|
map.put("myMessageCount", String.valueOf(businessUserOpinionVOS.size()));//后管消息区-我的消息-未处理
|
|
|
map.put("userId", userId);
|
|
|
return map;
|
|
|
- }*/
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -454,7 +455,6 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
|
*/
|
|
|
@Override
|
|
|
public Map<String, String> getTaskCountArchive(String projectId, String contractId, String userId) {
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
if (StringUtils.isNotEmpty(projectId) && StringUtils.isNotEmpty(contractId)) {
|
|
|
List<Task> tasks = this.baseMapper.selectList(Wrappers.<Task>lambdaQuery()
|
|
|
.select(Task::getProcessInstanceId)
|
|
@@ -489,7 +489,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
|
long messageCount3 = messageWarnings.stream().filter(f -> f.getType().equals(3)).count();
|
|
|
long messageCount4 = messageWarnings.stream().filter(f -> f.getType().equals(4)).count();
|
|
|
long messageCount5 = messageWarnings.stream().filter(f -> f.getType().equals(5)).count();
|
|
|
-
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
map.put("allCount", String.valueOf(taskAllCount + messageWarnings.size()));//任务管理
|
|
|
map.put("taskCount", String.valueOf(taskAllCount));//任务查看
|
|
|
map.put("messageCount", String.valueOf(messageWarnings.size()));//消息提醒
|
|
@@ -499,8 +499,14 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
|
map.put("messageCount_4", String.valueOf(messageCount4));//工单反馈
|
|
|
map.put("messageCount_5", String.valueOf(messageCount5));//系统消息
|
|
|
map.put("userId", userId);
|
|
|
+ return map;
|
|
|
+ } else {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ List<BusinessUserOpinionVO> businessUserOpinionVOS = userOpinionService.getBaseMapper().queryManageUserOpinionList(userId).stream().filter(f -> f.getIsCurrent().equals(false)).collect(Collectors.toList());
|
|
|
+ map.put("myMessageCount", String.valueOf(businessUserOpinionVOS.size()));//后管消息区-我的消息-未处理
|
|
|
+ map.put("userId", userId);
|
|
|
+ return map;
|
|
|
}
|
|
|
- return map;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -573,12 +579,12 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
|
}
|
|
|
|
|
|
|
|
|
- // @Scheduled(cron = "0 */1 * * * ?")
|
|
|
+ @Scheduled(cron = "0 */1 * * * ?")
|
|
|
public void SignInfo() {
|
|
|
//执行代码
|
|
|
logger.debug("扫描开始");
|
|
|
List<TaskBatch> maps = taskBatchService.queryDataInfo();
|
|
|
- if (maps != null && maps.size() >= 1) {
|
|
|
+ if (maps != null && maps.size() >= 1 && executor.getQueue().size()<=200) {
|
|
|
for (TaskBatch dataInfo : maps) {
|
|
|
String jsonData = dataInfo.getJsonData();
|
|
|
TaskApprovalVO taskApprovalVO = JSON.parseObject(jsonData, TaskApprovalVO.class);
|
|
@@ -586,36 +592,18 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
|
Long userId = dataInfo.getCreateUser();
|
|
|
String nickName = dataInfo.getNickName();
|
|
|
|
|
|
- Boolean istrue = true;
|
|
|
- try {
|
|
|
- Thread.sleep(500);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
-
|
|
|
Boolean aBoolean = RedisTemplate.hasKey("sign-" + taskApprovalVO.getFormDataId());
|
|
|
- System.out.println(taskApprovalVO.getFormDataId() + "---" + aBoolean);
|
|
|
- if (aBoolean) {
|
|
|
- istrue = false;
|
|
|
- }
|
|
|
- if (istrue) {
|
|
|
- int wtask = executor.getQueue().size();
|
|
|
- if (wtask >= 200) {
|
|
|
- break;
|
|
|
- }
|
|
|
- // taskBatchService.update(Wrappers.<TaskBatch>update().set("is_deleted", 2).eq("id", taskBatchId));
|
|
|
- RedisTemplate.opsForValue().set("sign-" + taskApprovalVO.getFormDataId(), "1", 70, TimeUnit.SECONDS);
|
|
|
+ System.out.println("---------"+aBoolean);
|
|
|
+ if (!aBoolean) {
|
|
|
+ RedisTemplate.opsForValue().set("sign-" + taskApprovalVO.getFormDataId(), "1");
|
|
|
CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
|
|
|
try {
|
|
|
-
|
|
|
/*===============执行批量任务===============*/
|
|
|
this.checkIsExsitTaskBatch(taskApprovalVO, taskBatchId, userId, nickName);
|
|
|
-
|
|
|
} catch (FileNotFoundException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}, executor);
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -639,7 +627,6 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
|
/*===============试验自检任务相关===============*/
|
|
|
this.trialSelfTaskRelated(taskApprovalVO, pdfUrlEVisa, batchId);
|
|
|
|
|
|
- RedisTemplate.delete("sign-" + taskApprovalVO.getFormDataId());
|
|
|
}
|
|
|
|
|
|
// 电签主流程业务
|
|
@@ -659,29 +646,30 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
|
return "无当前分支信息";
|
|
|
}
|
|
|
//获取主流程
|
|
|
- Task masterTask = this.getOne(Wrappers.<Task>lambdaQuery().eq(Task::getIsDeleted, 0).eq(Task::getProcessInstanceId, currentLink.getProcessInstanceId()));
|
|
|
+ Task masterTask = getOne(Wrappers.<Task>lambdaQuery().eq(Task::getIsDeleted, 0).eq(Task::getProcessInstanceId, currentLink.getProcessInstanceId()));
|
|
|
|
|
|
if ("OK".equals(taskApprovalVO.getFlag())) {
|
|
|
//同意,执行签章
|
|
|
//todo ============================ 执行电签区域 ============================
|
|
|
//电签状态
|
|
|
- String eVisaStatus = this.eVisaClient.eVisa(JSONObject.parseObject(JSONObject.toJSONString(taskApprovalVO), EVisaTaskApprovalVO.class));
|
|
|
- System.out.println("+++++" + eVisaStatus);
|
|
|
+ System.out.println("++buess-开始+++" + taskApprovalVO.getFormDataId());
|
|
|
+ String eVisaStatus = eVisaClient.eVisa(JSONObject.parseObject(JSONObject.toJSONString(taskApprovalVO), EVisaTaskApprovalVO.class));
|
|
|
+ System.out.println("+++evsin-返回++"+ taskApprovalVO.getFormDataId()+"--"+ eVisaStatus);
|
|
|
//todo ============================ 执行电签区域 ============================
|
|
|
|
|
|
//电签状态分为success/notPfxOrFile/error,当状态为error时就需要重新提交请求
|
|
|
if (eVisaStatus == null || StringUtils.isEmpty(eVisaStatus)) {
|
|
|
- this.taskBatchService.update(Wrappers.<TaskBatch>lambdaUpdate()
|
|
|
+ taskBatchService.update(Wrappers.<TaskBatch>lambdaUpdate()
|
|
|
.set(TaskBatch::getIsDeleted, 4)
|
|
|
.eq(TaskBatch::getId, taskApprovalVO.getId())
|
|
|
);
|
|
|
-
|
|
|
+ RedisTemplate.delete("sign-" + taskApprovalVO.getFormDataId());
|
|
|
} else if ("success".equals(eVisaStatus) || eVisaStatus.contains("success")) {
|
|
|
//审批通过会返回签章成功的文件,需要设置替换
|
|
|
//完成/审批当前分支流程
|
|
|
// this.newFlowClient.completeApprovalTask(taskId, parallelProcessInstanceId, comment).getData();
|
|
|
//修改分支状态,改为已完成
|
|
|
- this.taskParallelService.update(Wrappers.<TaskParallel>lambdaUpdate()
|
|
|
+ taskParallelService.update(Wrappers.<TaskParallel>lambdaUpdate()
|
|
|
.set(TaskParallel::getStatus, 2)
|
|
|
.set(TaskParallel::getEVisaStatus, 1)
|
|
|
.set(TaskParallel::getEVisaContent, "电签成功")
|
|
@@ -816,9 +804,6 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
|
this.abolishMessage(masterTask, currentLink, comment, taskApprovalVO.getNickName());
|
|
|
}
|
|
|
|
|
|
- /*//return前先删除合同段树redis缓存
|
|
|
- informationQueryService.delAsyncWbsTree(masterTask.getContractId());*/
|
|
|
-
|
|
|
return "";
|
|
|
}
|
|
|
|
|
@@ -931,13 +916,14 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
|
this.iTrialSelfInspectionRecordService.updateTrialSelfInspectionRecordStatus(pdfUrlEVisa, taskApprovalVO);
|
|
|
//executor删除掉对应批次
|
|
|
this.taskBatchService.deletedById(batchId);
|
|
|
+ RedisTemplate.delete("sign-" + taskApprovalVO.getFormDataId());
|
|
|
}
|
|
|
|
|
|
if (!"OK".equals(taskApprovalVO.getFlag())) {
|
|
|
//已废除
|
|
|
this.iTrialSelfInspectionRecordService.updateTrialSelfInspectionRecordStatusFC(taskApprovalVO);
|
|
|
//executor删除掉对应批次
|
|
|
- this.taskBatchService.deletedById(batchId);
|
|
|
+ RedisTemplate.delete("sign-" + taskApprovalVO.getFormDataId());
|
|
|
}
|
|
|
}
|
|
|
|