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

上链

上级 d1d6a84f
......@@ -1259,5 +1259,24 @@ public class AllotBillController {
}
/**
* 区块验证
*/
@GetMapping(value ="/checkTrueData/{billId}")
@ApiOperation(value = "根据业务id进行对应业务的验证", notes = "根据业务id进行对应业务的验证")
public ResponseEntity checkTrueData( @PathVariable Integer billId){
return ResponseEntity.ok(allotBillService.checkTrueData(billId));
}
/**
* 区块溯源
*/
@GetMapping(value ="/traceabilityParsing/{billId}")
@ApiOperation(value = "根据业务id进行对应业务的溯源", notes = "根据业务id进行对应业务的溯源")
public ResponseEntity traceabilityParsing( @PathVariable Integer billId){
return ResponseEntity.ok(allotBillService.traceabilityParsing(billId));
}
}
......@@ -170,8 +170,8 @@ public class AllotBackBillServiceImpl implements AllotBackBillService {
@Override
public BlockTraceabilityParsing traceabilityParsing(Integer billId) {
BlockData billTypeAndBillId = blockDataService.findBillTypeAndBillId(BusinessEnum.ALLOT.id, billId);
BcRecord bcRecord = blockService.fetchRecord(BlockBusinessEnum.ALLOT.subCode, billTypeAndBillId.getRecordID());
BlockData billTypeAndBillId = blockDataService.findBillTypeAndBillId(BusinessEnum.ALLOT_BACK.id, billId);
BcRecord bcRecord = blockService.fetchRecord(BlockBusinessEnum.ALLOT_BACK.subCode, billTypeAndBillId.getRecordID());
AllotBackBill allotBackBill = queryAllotBill(billId);
AllotBackBill allotBackBill1 = JSON.parseObject(bcRecord.getData().getContent(), AllotBackBill.class);
BlockTraceabilityParsing blockTraceabilityParsing = bcRecord.getData().toBlockTraceabilityParsing();
......@@ -245,6 +245,11 @@ public class AllotBackBillServiceImpl implements AllotBackBillService {
allotBackBill.setApplyFileList(FilesUtil.stringFileToList(allotBackBill.getApplyFiles()));
allotBackBill.setSendFileList(FilesUtil.stringFileToList(allotBackBill.getSendFiles()));
allotBackBill.setReceiveFileList(FilesUtil.stringFileToList(allotBackBill.getReceiveFiles()));
allotBackBill.setSenderUserA(userPublicService.getOne(allotBackBill.getSendUseraId()).getName());
allotBackBill.setSenderUserB(userPublicService.getOne(allotBackBill.getSendUserbId()).getName());
allotBackBill.setReceiveUserA(userPublicService.getOne(allotBackBill.getReceiveUseraId()).getName());
allotBackBill.setReceiveUserB(userPublicService.getOne(allotBackBill.getReceiveUserbId()).getName());
allotBackBill.setScripts(JacksonUtil.readValue(allotBackBill.getScriptJson(), new TypeReference<List<ScriptSaveVo>>() {
}));
return allotBackBill;
......
......@@ -235,7 +235,7 @@ public class AllotBillServiceImpl implements AllotBillService {
taskLogBto.setOldStatus(taskBto.getBillStatus());
taskLogBto.setTaskId(taskId);
taskLogService.addLog(taskLogBto);
return update;
return update;
}
@Override
......@@ -321,6 +321,10 @@ public class AllotBillServiceImpl implements AllotBillService {
allotBill.setApplyFileList(FilesUtil.stringFileToList(allotBill.getApplyFiles()));
allotBill.setSendFileList(FilesUtil.stringFileToList(allotBill.getSendFiles()));
allotBill.setReceiveFileList(FilesUtil.stringFileToList(allotBill.getReceiveFiles()));
allotBill.setSenderUserA(userPublicService.getOne(allotBill.getSendUseraId()).getName());
allotBill.setSenderUserB(userPublicService.getOne(allotBill.getSendUserbId()).getName());
allotBill.setReceiveUserA(userPublicService.getOne(allotBill.getReceiveUseraId()).getName());
allotBill.setReceiveUserB(userPublicService.getOne(allotBill.getReceiveUserbId()).getName());
allotBill.setScripts(JacksonUtil.readValue(allotBill.getScriptJson(), new TypeReference<List<ScriptSaveVo>>() {
}));
return allotBill;
......@@ -329,6 +333,7 @@ public class AllotBillServiceImpl implements AllotBillService {
/**
* @param allotBillSelectVo 查询vo
* 查询统一筛选器
......
......@@ -24,6 +24,11 @@
<groupId>com.tykj</groupId>
<artifactId>dev-allot</artifactId>
</dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-block</artifactId>
</dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-library</artifactId>
......
......@@ -980,4 +980,23 @@ public class DeviceApplyController {
// }
/**
* 区块验证
*/
@GetMapping(value ="/checkTrueData/{billId}")
@ApiOperation(value = "根据业务id进行对应业务的验证", notes = "根据业务id进行对应业务的验证")
public ResponseEntity checkTrueData( @PathVariable Integer billId){
return ResponseEntity.ok(deviceApplyBillService.checkTrueData(billId));
}
/**
* 区块溯源
*/
@GetMapping(value ="/traceabilityParsing/{billId}")
@ApiOperation(value = "根据业务id进行对应业务的溯源", notes = "根据业务id进行对应业务的溯源")
public ResponseEntity traceabilityParsing( @PathVariable Integer billId){
return ResponseEntity.ok(deviceApplyBillService.traceabilityParsing(billId));
}
}
......@@ -3,6 +3,7 @@ package com.tykj.dev.device.apply.service;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import com.tykj.dev.device.apply.subject.vo.*;
import com.tykj.dev.device.block.entity.vo.BlockTraceabilityParsing;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import java.util.List;
......@@ -46,4 +47,21 @@ public interface DeviceApplyBillService {
ApplyRemoveSeqVo removeSameSeq(RemoveSameSeqVo removeSameSeqVo);
/**
* 溯源接口
* @param billId 业务id
* @return 溯源信息实体
*/
BlockTraceabilityParsing traceabilityParsing(Integer billId);
/**
* 历史数据上链
*/
void historyUpperChain();
boolean checkTrueData(Integer billId);
}
package com.tykj.dev.device.apply.service.impl;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
......@@ -8,6 +9,12 @@ import com.tykj.dev.device.apply.repository.DeviceApplyBillDao;
import com.tykj.dev.device.apply.service.DeviceApplyBillService;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import com.tykj.dev.device.apply.subject.vo.*;
import com.tykj.dev.device.block.entity.BlockData;
import com.tykj.dev.device.block.entity.bc.BcRecord;
import com.tykj.dev.device.block.entity.vo.BlockTraceabilityParsing;
import com.tykj.dev.device.block.entity.vo.TraceabilityParsingData;
import com.tykj.dev.device.block.service.BlockDataService;
import com.tykj.dev.device.block.service.BlockService;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.impl.CacheLibraryServiceImpl;
......@@ -21,11 +28,10 @@ import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.bto.MessageBto;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BlockBusinessEnum;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.DeviceSeqUtil;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.StringSplitUtil;
import com.tykj.dev.misc.utils.StringUtils;
import com.tykj.dev.misc.utils.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
......@@ -43,6 +49,12 @@ import static java.util.stream.Collectors.groupingBy;
@Service
public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
@Autowired
BlockService blockService;
@Autowired
BlockDataService blockDataService;
@Autowired
private DeviceApplyBillDao deviceApplyBillDao;
......@@ -73,18 +85,7 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
@Override
public DeviceApplyBill addEntity(DeviceApplyBill deviceApplyBillEntity) {
DeviceApplyBill deviceApplyBill = deviceApplyBillDao.save(deviceApplyBillEntity);
CompletableFuture.runAsync(()->{
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
DeviceApplyBill deviceApplyBill1 = getOne(deviceApplyBill.getId());
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(deviceApplyBill1));
String recordId = bcText.getData().getRecordID();
deviceApplyBill1.setRecordId(recordId);
deviceApplyBillDao.save(deviceApplyBill1);
}, TaskBeanConfig.getThreadPoolTaskScheduler());
sendText(deviceApplyBill.getId());
return deviceApplyBill;
}
......@@ -318,4 +319,88 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
applyRemoveSeqVo.setCount(selectDeviceSeqs.size());
return applyRemoveSeqVo;
}
/**
* 验证接口
*/
@Override
public BlockTraceabilityParsing traceabilityParsing(Integer billId) {
BlockData billTypeAndBillId = blockDataService.findBillTypeAndBillId(BusinessEnum.APPLY.id, billId);
BcRecord bcRecord = blockService.fetchRecord(BlockBusinessEnum.APPLY.subCode, billTypeAndBillId.getRecordID());
DeviceApplyBill deviceApplyBill = queryDeviceApplyBill(billId);
DeviceApplyBill deviceApplyBill1 = JSON.parseObject(bcRecord.getData().getContent(), DeviceApplyBill.class);
BlockTraceabilityParsing blockTraceabilityParsing = bcRecord.getData().toBlockTraceabilityParsing();
blockTraceabilityParsing.setBusinessTraceabilityParsingData(TraceabilityParsingData.builder()
.billTypeName("申请")
.applyNumber(deviceApplyBill.getApplyNumber())
.replayNumber(deviceApplyBill.getReplayNumber())
.fileMd5(deviceApplyBill.getFileMd5())
.unitName(deviceApplyBill.getApplyUnit())
.operationTime(DateUtil.getLocalDateTime(deviceApplyBill.getCreateTime()))
.operatorUserName(operatorName(deviceApplyBill))
.build());
blockTraceabilityParsing.setBlockTraceabilityParsingData(TraceabilityParsingData.builder()
.billTypeName("申请")
.applyNumber(deviceApplyBill1.getApplyNumber())
.replayNumber(deviceApplyBill1.getReplayNumber())
.fileMd5(deviceApplyBill1.getFileMd5())
.unitName(deviceApplyBill1.getApplyUnit())
.operationTime(DateUtil.getLocalDateTime(deviceApplyBill1.getCreateTime()))
.operatorUserName(operatorName(deviceApplyBill1))
.build());
blockTraceabilityParsing.setBlockData(deviceApplyBill1);
blockTraceabilityParsing.setCurrentData(deviceApplyBill);
return blockTraceabilityParsing;
}
@Override
public void historyUpperChain() {
}
private String operatorName(DeviceApplyBill deviceApplyBill) {
StringBuffer buf = new StringBuffer();
buf.append(deviceApplyBill.getApplyUser())
.append(",")
.append(deviceApplyBill.getAgent());
return buf.toString();
}
//验真
@Override
public boolean checkTrueData(Integer billId) {
BlockTraceabilityParsing blockTraceabilityParsing = traceabilityParsing(billId);
boolean contrast = blockDataService.contrast(blockTraceabilityParsing);
return contrast;
}
/**
* 上链接口
*/
public void sendText(Integer id){
DeviceApplyBill deviceApplyBill = queryDeviceApplyBill(id);
blockService.sendText(BlockBusinessEnum.APPLY.subCode, JacksonUtil.toJSon(deviceApplyBill), BusinessEnum.APPLY.id,id,deviceApplyBill.getApplyUnit());
}
private DeviceApplyBill queryDeviceApplyBill(Integer billId){
//获取账单
DeviceApplyBill deviceApplyBillEntity = getOne(billId);
if (deviceApplyBillEntity.getApplyUseraId() != null) {
deviceApplyBillEntity.setApplyUser(userPublicService.getOne(deviceApplyBillEntity.getApplyUseraId()).getName());
}
List<ApplyBillDetailVo> applyBillDetailVos = Objects.requireNonNull(JacksonUtil.readValue(deviceApplyBillEntity.getApplyStat(), new TypeReference<List<ApplyBillDetailVo>>() {
}));
deviceApplyBillEntity.setApplyBillDetailVos(applyBillDetailVos);
return deviceApplyBillEntity;
}
}
......@@ -181,4 +181,9 @@ public class DeviceApplyBill {
@ApiModelProperty(value = "申请装备序列号信息vo")
@Transient
private List<ApplyBillDetailVo> applyBillDetailVos = new ArrayList<>();
@Transient
@ApiModelProperty(value = "文件md5")
private String fileMd5;
}
......@@ -21,12 +21,10 @@ public class BlockRun implements CommandLineRunner {
BlockService blockService;
@Override
public void run(String... args) throws Exception {
// log.info("添加区块业务类型开始");
//// for (BlockBusinessEnum value : BlockBusinessEnum.values()) {
//// if (value.subCode>19) {
//// blockService.subRegister(value.name);
//// }
//// }
// log.info("添加区块业务类型结束");
log.info("添加区块业务类型开始");
for (BlockBusinessEnum value : BlockBusinessEnum.values()) {
blockService.subRegister(value.name);
}
log.info("添加区块业务类型结束");
}
}
......@@ -41,6 +41,10 @@
<groupId>com.tykj</groupId>
<artifactId>dev-file</artifactId>
</dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-block</artifactId>
</dependency>
</dependencies>
......
......@@ -1276,4 +1276,22 @@ public class SelfCheckController {
return ResultUtil.success("1");
}
/**
* 区块验证
*/
@GetMapping(value ="/checkTrueData/{billId}")
@ApiOperation(value = "根据业务id进行对应业务的验证", notes = "根据业务id进行对应业务的验证")
public ResponseEntity checkTrueData( @PathVariable Integer billId){
return ResponseEntity.ok(selfCheckBillService.checkTrueData(billId));
}
/**
* 区块溯源
*/
@GetMapping(value ="/traceabilityParsing/{billId}")
@ApiOperation(value = "根据业务id进行对应业务的溯源", notes = "根据业务id进行对应业务的溯源")
public ResponseEntity traceabilityParsing( @PathVariable Integer billId){
return ResponseEntity.ok(selfCheckBillService.traceabilityParsing(billId));
}
}
......@@ -2,6 +2,7 @@ package com.tykj.dev.device.selfcheck.service;
import com.tykj.dev.config.domin.CheckUnitInfo;
import com.tykj.dev.device.block.entity.vo.BlockTraceabilityParsing;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
......@@ -68,4 +69,20 @@ public interface SelfCheckBillService {
* 只要2周后未完成
*/
List<CheckUnitInfo> selectNoFinSh2Weeks();
/**
* 溯源接口
* @param billId 业务id
* @return 溯源信息实体
*/
BlockTraceabilityParsing traceabilityParsing(Integer billId);
/**
* 历史数据上链
*/
void historyUpperChain();
boolean checkTrueData(Integer billId);
}
package com.tykj.dev.device.selfcheck.service.impl;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.core.type.TypeReference;
import com.github.wenhao.jpa.PredicateBuilder;
......@@ -9,13 +10,23 @@ import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.config.base.FileName;
import com.tykj.dev.config.domin.CheckUnitInfo;
import com.tykj.dev.device.block.entity.BlockData;
import com.tykj.dev.device.block.entity.bc.BcRecord;
import com.tykj.dev.device.block.entity.vo.BlockTraceabilityParsing;
import com.tykj.dev.device.block.entity.vo.TraceabilityParsingData;
import com.tykj.dev.device.block.service.BlockDataService;
import com.tykj.dev.device.block.service.BlockService;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.file.util.FileMD5Util;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.selfcheck.config.HistoryDeviceBillRun;
import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao;
import com.tykj.dev.device.selfcheck.service.HistoryDeviceBillService;
import com.tykj.dev.device.selfcheck.service.SelfCheckBillService;
import com.tykj.dev.device.selfcheck.subject.domin.HistoryDeviceBill;
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
import com.tykj.dev.device.selfcheck.subject.vo.SelfCheckSelectVo;
import com.tykj.dev.device.task.service.TaskLogService;
......@@ -23,7 +34,9 @@ import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.vo.TaskLogUserVo;
import com.tykj.dev.device.task.subject.vo.TaskUserVo;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BlockBusinessEnum;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.qrcode.*;
......@@ -32,6 +45,7 @@ import com.tykj.dev.misc.qrcode.vo.TaskData;
import com.tykj.dev.misc.utils.DateUtil;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.misc.utils.StringSplitUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -69,6 +83,11 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
@Autowired
private BlockChainUtil blockChainUtil;
@Resource
private HistoryDeviceBillService historyDeviceBillService;
@Resource
private HistoryDeviceBillRun historyDeviceBillRun;
@Autowired
private TaskService taskService;
......@@ -81,21 +100,19 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
@Resource
private TaskLogService taskLogService;
@Resource
BlockService blockService;
@Resource
BlockDataService blockDataService;
@Resource
UserPublicService userPublicService;
@Override
public SelfCheckBill addEntity(SelfCheckBill selfExaminationBillEntity) {
SelfCheckBill selfCheckBill = selfExaminationBillDao.save(selfExaminationBillEntity);
CompletableFuture.runAsync(() -> {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
SelfCheckBill selfCheckBill1 = getOne(selfCheckBill.getId());
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(selfCheckBill1));
String recordId = bcText.getData().getRecordID();
selfCheckBill1.setRecordId(recordId);
selfExaminationBillDao.save(selfCheckBill1);
}, TaskBeanConfig.getThreadPoolTaskScheduler());
sendText(selfCheckBill.getId());
return selfCheckBill;
}
......@@ -387,4 +404,152 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
TaskData taskData = JacksonUtil.readValue(json, TaskData.class);
}
@Override
public boolean checkTrueData(Integer billId) {
BlockTraceabilityParsing blockTraceabilityParsing = traceabilityParsing(billId);
return blockDataService.contrast(blockTraceabilityParsing);
}
@Override
public BlockTraceabilityParsing traceabilityParsing(Integer billId) {
BlockData billTypeAndBillId = blockDataService.findBillTypeAndBillId(BusinessEnum.SELF_CHECK.id, billId);
BcRecord bcRecord = blockService.fetchRecord(BlockBusinessEnum.SELF_CHECK.subCode, billTypeAndBillId.getRecordID());
SelfCheckBill selfCheckBill = queryDetail(billId);
SelfCheckBill selfCheckBill1 = JSON.parseObject(bcRecord.getData().getContent(), SelfCheckBill.class);
BlockTraceabilityParsing blockTraceabilityParsing = bcRecord.getData().toBlockTraceabilityParsing();
StringBuffer stringBuffer=new StringBuffer();
stringBuffer.append(StringSplitUtil.stringListToString(selfCheckBill.getDeviceLibraries().stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList())))
.append(",")
.append(StringSplitUtil.stringListToString(selfCheckBill.getHistoryDeviceBills().stream().map(HistoryDeviceBill::getSeqNumber).collect(Collectors.toList())));
StringBuffer stringBuffer1=new StringBuffer();
stringBuffer1.append(StringSplitUtil.stringListToString(selfCheckBill1.getDeviceLibraries().stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList())))
.append(",")
.append(StringSplitUtil.stringListToString(selfCheckBill1.getHistoryDeviceBills().stream().map(HistoryDeviceBill::getSeqNumber).collect(Collectors.toList())));
blockTraceabilityParsing.setBusinessTraceabilityParsingData(TraceabilityParsingData.builder()
.billTypeName("自查") //业务名称
// .applyNumber(allotBill.getApplyNumber()) //申请文号
// .replayNumber(allotBill.getReplayNumber()) //批复文号
.fileMd5(selfCheckBill.getFileMd5())
.carrierIds(stringBuffer.toString())//序列号信息
.unitName(selfCheckBill.getCheckUnit())//发起单位
.operationTime(DateUtil.getLocalDateTime(selfCheckBill.getCreateTime()))//发起时间
.operatorUserName(operatorName(selfCheckBill)) //相关人员
.build());
blockTraceabilityParsing.setBlockTraceabilityParsingData(TraceabilityParsingData.builder()
.billTypeName("自查")
.fileMd5(selfCheckBill1.getFileMd5())
.carrierIds(stringBuffer1.toString())//序列号信息
.unitName(selfCheckBill1.getCheckUnit())//发起单位
.operationTime(DateUtil.getLocalDateTime(selfCheckBill1.getCreateTime()))//发起时间
.operatorUserName(operatorName(selfCheckBill1)) //相关人员
.build());
blockTraceabilityParsing.setBlockData(selfCheckBill1);
blockTraceabilityParsing.setCurrentData(selfCheckBill);
return blockTraceabilityParsing;
}
@Override
public void historyUpperChain() {
//历史数据 循环查询数据上链
}
/**
* 拼写相关人员字符
*/
private String operatorName(SelfCheckBill selfCheckBill) {
StringBuffer buf = new StringBuffer();
buf.append(selfCheckBill.getCheckUser())
.append(",")
.append(selfCheckBill.getConfirmUser());
return buf.toString();
}
/**
* 文本上链接口
* @param billId 业务id
*/
private void sendText(Integer billId){
SelfCheckBill selfCheckBill = queryDetail(billId);
// 区块业务状态码,上链json数据,业务类型,业务id,发起单位
blockService.sendText(BlockBusinessEnum.SELF_CHECK.subCode, JacksonUtil.toJSon(selfCheckBill), BusinessEnum.SELF_CHECK.id,billId,selfCheckBill.getCheckUnit());
}
private SelfCheckBill queryDetail(Integer billId){
SelfCheckBill selfExaminationBillEntity = getOne(billId);
if (selfExaminationBillEntity.getUseraId()!=null && selfExaminationBillEntity.getUseraId() != 0) {
selfExaminationBillEntity.setCheckUser(userPublicService.getOne(selfExaminationBillEntity.getUseraId()).getName());
}
if (selfExaminationBillEntity.getUserbId()!=null && selfExaminationBillEntity.getUserbId() != 0) {
selfExaminationBillEntity.setConfirmUser(userPublicService.getOne(selfExaminationBillEntity.getUserbId()).getName());
}
selfExaminationBillEntity.setCheckFileList(FilesUtil.stringFileToList(selfExaminationBillEntity.getCheckFiles()));
selfExaminationBillEntity.setFileMd5(FileMD5Util.fileRetToMd5(selfExaminationBillEntity.getCheckFileList()));
//add
selfExaminationBillEntity.setCheckFileList(FilesUtil.stringFileToList(selfExaminationBillEntity.getCheckFiles()));
//1.实体
//获取自查详情
String str4 = selfExaminationBillEntity.getNewDeviceDetail();
//添加新增不在系统的装备
List<DeviceLibrary> newDeviceList = new ArrayList<>();
if (str4!=null) {
//分隔字符获得rfid卡号
String[] split2 = str4.split("\\.");
newDeviceList = new ArrayList<>();
for (String rfid:split2){
if (rfid.length()>0){
DeviceLibrary d = new DeviceLibrary();
d.setCheckResult(2);
d.setSeqNumber("-");
d.setName("-");
d.setType(0);
d.setRfidSurfaceId("-");
d.setProdNumber("-");
d.setRfidCardId(rfid);
newDeviceList.add(d);
}
}
}
// 2.添加新增不在系统的装备
//根据业务id和业务类型查询
List<HistoryDeviceBill> historyDeviceBillList;
Map<Integer, List<HistoryDeviceBill>> map1 = historyDeviceBillRun.getMap();
if (map1.containsKey(billId)){
historyDeviceBillList = map1.get(billId);
}else {
historyDeviceBillList =
historyDeviceBillService.selectByBillId(billId);
//将数据放在缓存中
map1.put(billId,historyDeviceBillList);
}
//3.添加自查装备
// list.add(libraryEntities1);
selfExaminationBillEntity.setHistoryDeviceBills(historyDeviceBillList);
// 4添加业务日志
if (selfExaminationBillEntity.getUnStockDetail()!=null){
//5 非在库
newDeviceList.addAll(Objects.requireNonNull(JacksonUtil.readValue(selfExaminationBillEntity.getUnStockDetail(), new TypeReference<List<DeviceLibrary>>() {
})));
}
selfExaminationBillEntity.setDeviceLibraries(newDeviceList);
//6.添加task
return selfExaminationBillEntity;
}
}
......@@ -183,4 +183,14 @@ public class SelfCheckBill {
@Transient
private Integer taskId;
@Transient
private List<DeviceLibrary> deviceLibraries;
@Transient
private List<HistoryDeviceBill> historyDeviceBills;
@Transient
@ApiModelProperty(value = "文件md5")
private String fileMd5;
}
......@@ -809,7 +809,7 @@ public class TrainJobController {
@GetMapping(value ="/traceabilityParsing/{billId}")
@ApiOperation(value = "根据业务id进行对应业务的溯源", notes = "根据业务id进行对应业务的溯源")
public BlockTraceabilityParsing traceabilityParsing(Integer billId) {
public BlockTraceabilityParsing traceabilityParsing(@PathVariable Integer billId) {
BlockData billTypeAndBillId = blockDataService.findBillTypeAndBillId(BusinessEnum.TRAIN.id, billId);
BcRecord bcRecord = blockService.fetchRecord(BlockBusinessEnum.TRAIN.subCode, billTypeAndBillId.getRecordID());
TrainDetailsVo trainDetailsVo = trainThemeService.findSelectDetailsVo(billId);
......@@ -857,7 +857,7 @@ public class TrainJobController {
@GetMapping(value ="/checkTrueData/{billId}")
@ApiOperation(value = "根据业务id进行对应业务的验证", notes = "根据业务id进行对应业务的验证")
public boolean checkTrueData(Integer billId) {
public boolean checkTrueData(@PathVariable Integer billId) {
BlockTraceabilityParsing blockTraceabilityParsing = traceabilityParsing(billId);
boolean contrast = blockDataService.contrast(blockTraceabilityParsing);
return contrast;
......
......@@ -11,4 +11,5 @@ block.flag=false
qrcode.path = /opt/qrcode/
qrcode.preview.path=http://10.153.4.11:8088/equipTest/code/
carrier.url = http://10.153.4.11:8088/carrierTest/configuration/saveConfiguration
file.matching.excel=/data/equipTest/matching/excel/
\ No newline at end of file
file.matching.excel=/data/equipTest/matching/excel/
block.carrier.ip=http://10.153.4.11:8088/blockTest
\ No newline at end of file
......@@ -18,4 +18,6 @@ qrcode.preview.path=http://localhost:8088/equip/code/
carrier.url = http://192.168.0.80:8088/carrier/configuration/saveConfiguration
file.matching.excel=/data/equip/excel/
\ No newline at end of file
file.matching.excel=/data/equip/excel/
block.carrier.ip=http://192.168.0.80:8088/block
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论