提交 c570b8fc authored 作者: zjm's avatar zjm

fix(区块链): 任务、培训 使用text上联

任务、培训 使用text上联
上级 c8e12c0f
......@@ -364,7 +364,6 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
deviceLibraryDao.findAllBySeqNumberIn(seqNumbers).forEach(
deviceLibrary -> {
logDtos.add(new DeviceLogDto(deviceLibrary.getId(),remark,null,userId,taskId).toDo());
}
);
......
......@@ -121,6 +121,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
*/
// @Override
// @Transactional(rollbackFor = Exception.class)
//原来的版本
public void initiateRepel1(DeviceRepel deviceRepel, Integer userId,SecurityUser securityUser) {
//生成一个清退任务 省清退任务 类型为 清退统计 17 16清退
//参照选择的范围给单位都发送 市清退任务待执行
......@@ -197,8 +198,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
TaskBto taskBto = statsXTask(units.getUnitId(), deviceRepel1.getId(), "清退型号为" + StringSplitUtil.stringListToString(deviceRepel.getModels().stream()
.distinct()
.collect(Collectors.toList())) + "设备任务", userId);
//给本单位其他专管员阅知
// addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),user.getName()+"发起清退任务["+deviceRepel1.getTitle()+"]",gainThisUser(userId,units.getUnitId())));
List<RepelTaskStatistical> list = new ArrayList<>();
deviceRepel.getTaskScopes().forEach(
unisId -> {
......@@ -207,7 +206,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
if (units1.getType() == 2) {
directlUnderUnit.set(true);
directlUnderUnitNames.add(units1.getName());
// directlUnderUnitDeviceIds.addAll(unitNameMap.get(units1.getName()));
} else if (units1.getType() == 1) {
Area area1 = areaService.findByid(units1.getAreaId());
DeviceRepelDetail deviceRepelDetail = new DeviceRepelDetail();
......@@ -266,7 +264,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
}
//测试版本
//正式版
@Override
@Transactional(rollbackFor = Exception.class)
public void initiateRepel(DeviceRepel deviceRepel, Integer userId,SecurityUser securityUser) {
......
package com.tykj.dev.device.task.service.impl;
import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.entity.BcText;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.device.task.repository.TaskLogDao;
......@@ -47,7 +48,7 @@ public class TaskLogServiceImpl implements TaskLogService {
TaskLog taskLog = taskLogDao.save(taskLogBto.toDo());
CompletableFuture.runAsync(() ->{
TaskLog taskLog1 = taskLogDao.findById(taskLog.getId()).get();
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(taskLog1));
BcText bcText = blockChainUtil.sendText(1000, JacksonUtil.toJSon(taskLog1));
String recordId = bcText.getData().getRecordID();
taskLog1.setRecordId(recordId);
taskLogDao.save(taskLog1);
......@@ -57,7 +58,7 @@ public class TaskLogServiceImpl implements TaskLogService {
@Async("taskScheduler")
public void sendHash(TaskLog taskLog) {
CompletableFuture.runAsync(() ->{
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(taskLog));
BcText bcText = blockChainUtil.sendText(1000, JacksonUtil.toJSon(taskLog));
String recordId = bcText.getData().getRecordID();
taskLog.setRecordId(recordId);
taskLogDao.save(taskLog);
......
......@@ -3,6 +3,7 @@ package com.tykj.dev.device.task.service.impl;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.entity.BcText;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.GlobalMap;
import com.tykj.dev.config.Log;
......@@ -348,7 +349,7 @@ public class TaskServiceImpl implements TaskService {
e.printStackTrace();
}
Task task1 = taskDao.findById(task.getId()).get();
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(task1));
BcText bcText = blockChainUtil.sendText(1000, JacksonUtil.toJSon(task1));
String recordId = bcText.getData().getRecordID();
task1.setRecordId(recordId);
taskDao.save(task1);
......@@ -364,7 +365,7 @@ public class TaskServiceImpl implements TaskService {
public void sendHash(List<TaskBto> taskBtos) {
taskBtos.forEach(taskBto -> {
Task task = taskBto.toDo();
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(task));
BcText bcText = blockChainUtil.sendText(1000, JacksonUtil.toJSon(task));
String recordId = bcText.getData().getRecordID();
task.setRecordId(recordId);
update(task.parse2Bto());
......@@ -378,7 +379,7 @@ public class TaskServiceImpl implements TaskService {
@Async("taskScheduler")
public void sendHash(TaskBto taskBto) {
Task task = taskBto.toDo();
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(task));
BcText bcText = blockChainUtil.sendText(1000, JacksonUtil.toJSon(task));
String recordId = bcText.getData().getRecordID();
task.setRecordId(recordId);
update(task.parse2Bto());
......
......@@ -2,6 +2,7 @@ package com.tykj.dev.device.train.controller;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.entity.BcText;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.file.service.FilesUtil;
......@@ -747,7 +748,7 @@ public class TrainJobController {
TrainUser trainUser1 = trainUserDao.save(trainUser);
//异步线程
CompletableFuture.runAsync(()-> {
BcHash bcHash = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(trainUser1));
BcText bcHash = blockChainUtil.sendText(1000, JacksonUtil.toJSon(trainUser1));
trainUserDao.upDate(bcHash.getData().getRecordID(),trainUser1.getId());
});
}
......
......@@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.entity.BcText;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.device.file.service.FilesUtil;
......@@ -93,7 +94,7 @@ public class TrainThemeServiceImpl implements TrainThemeService {
e.printStackTrace();
}
TrainTheme trainTheme2 = findById(trainTheme1.getTrainId());
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(trainTheme2));
BcText bcText = blockChainUtil.sendText(1000, JacksonUtil.toJSon(trainTheme2));
String recordId = bcText.getData().getRecordID();
trainTheme2.setRecordId(recordId);
trainThemeDao.save(trainTheme2);
......@@ -108,7 +109,7 @@ public class TrainThemeServiceImpl implements TrainThemeService {
@Async
public void sendHash(List<TrainTheme> trainThemes) {
trainThemes.forEach(trainTheme1 -> {
BcHash bcHash=blockChainUtil.sendHash(1000,JacksonUtil.toJSon(trainTheme1));
BcText bcHash=blockChainUtil.sendText(1000,JacksonUtil.toJSon(trainTheme1));
trainTheme1.setRecordId(bcHash.getData().getRecordID());
trainThemeDao.save(trainTheme1);
});
......@@ -379,7 +380,7 @@ public class TrainThemeServiceImpl implements TrainThemeService {
TrainUser trainUser1 = trainUserDao.save(trainUser);
//异步线程
CompletableFuture.runAsync(()-> {
BcHash bcHash = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(trainUser1));
BcText bcHash = blockChainUtil.sendText(1000, JacksonUtil.toJSon(trainUser1));
trainUserDao.upDate(bcHash.getData().getRecordID(),trainUser1.getId());
});
return trainUser1;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论