提交 ffa39774 authored 作者: 邓砥奕's avatar 邓砥奕

更新

上级 a92b5723
......@@ -94,6 +94,8 @@ public class AllotBackBillController {
@PostMapping(value = "/back")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity allotBack(@RequestBody @Validated AllotBackBillSaveVo allotBackBillSaveVo) {
List<AllotBackBill> allotBackBills = new ArrayList<>();
List<TaskBto> taskBtos = new ArrayList<>();
//获取当前配发退回task
TaskBto taskBto = taskService.get(allotBackBillSaveVo.getTaskId());
//获取父配发业务
......@@ -128,11 +130,12 @@ public class AllotBackBillController {
int year = calendar.get(Calendar.YEAR);
String num = "NO:第" + year + "TH" + allotBackBill1.getId() + "号";
allotBackBill1.setNum(num);
allotBackBillService.update(allotBackBill1);
allotBackBills.add(allotBackBillService.update(allotBackBill1));
//发起子任务
taskBto.setBillId(allotBackBill1.getId());
taskBto.setOwnUnit(userPublicService.findUnitIdByName(allotBackBill1.getReceiveUnit()));
TaskBto taskBto1 = taskService.moveToNext(taskBto, allotBackBill1.getReceiveUseraId());
taskBtos.add(taskBto1);
//改变装备状态
List<FileVo> fileVoList = new ArrayList<>();
if (allotBackBillSaveVo.getFileName() != null && allotBackBillSaveVo.getFileUrl() != null) {
......@@ -157,6 +160,8 @@ public class AllotBackBillController {
inputOutputDeviceService.addWhiteDevices(ids,userUtils.getCurrentUnitId(),1);
log.info("[配发模块]:配发退回出库");
myWebSocket.sendMessage1();
allotBackBillService.sendHash(allotBackBills);
taskService.sendHash(taskBtos);
return ResponseEntity.ok(new ResultObj<>(taskBto1, signId.toString()));
}
......
......@@ -2,6 +2,8 @@ package com.tykj.dev.device.allot.service;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import java.util.List;
/**
* @author dengdiyi
*/
......@@ -9,6 +11,11 @@ public interface AllotBackBillService {
AllotBackBill addEntity(AllotBackBill allotBackBill);
/**
* @param allotBackBills 异步上链
*/
void sendHash(List<AllotBackBill> allotBackBills);
AllotBackBill update(AllotBackBill allotBackBill);
AllotBackBill getOne(Integer id);
......
......@@ -14,6 +14,11 @@ public interface AllotBillService {
AllotBill addEntity(AllotBill allotBillEntity);
/**
* @param allotBills 异步上链
*/
void sendHash(List<AllotBill> allotBills);
AllotBill update(AllotBill allotBillEntity);
Page<AllotBill> getPage(AllotBillSelectVo allotBillSelectVo, Pageable pageable);
......
......@@ -9,8 +9,10 @@ import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
......@@ -27,11 +29,21 @@ public class AllotBackBillServiceImpl implements AllotBackBillService {
@Override
public AllotBackBill addEntity(AllotBackBill allotBackBill) {
AllotBackBill allotBackBill1 = allotBackBillDao.save(allotBackBill);
return allotBackBillDao.save(allotBackBill);
}
/**
* @param allotBackBills 异步上链
*/
@Override
@Async
public void sendHash(List<AllotBackBill> allotBackBills) {
allotBackBills.forEach(allotBackBill1 -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(allotBackBill1));
String recordId = bcText.getData().getRecordID();
allotBackBill1.setRecordId(recordId);
return allotBackBillDao.save(allotBackBill1);
allotBackBillDao.save(allotBackBill1);
});
}
@Override
......
......@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
......@@ -38,11 +39,21 @@ public class AllotBillServiceImpl implements AllotBillService {
@Override
public AllotBill addEntity(AllotBill allotBillEntity) {
AllotBill allotBill = allotBillDao.save(allotBillEntity);
return allotBillDao.save(allotBillEntity);
}
/**
* @param allotBills 异步上链
*/
@Override
@Async
public void sendHash(List<AllotBill> allotBills) {
allotBills.forEach(allotBill -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(allotBill));
String recordId = bcText.getData().getRecordID();
allotBill.setRecordId(recordId);
return update(allotBill);
update(allotBill);
});
}
@Override
......
......@@ -3,6 +3,8 @@ package com.tykj.dev.device.apply.service;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import java.util.List;
/**
* @author dengdiyi
*/
......@@ -10,6 +12,11 @@ public interface DeviceApplyBillService {
DeviceApplyBill addEntity(DeviceApplyBill deviceApplyBillEntity);
/**
* @param deviceApplyBills 异步上链
*/
void sendHash(List<DeviceApplyBill> deviceApplyBills);
DeviceApplyBill update(DeviceApplyBill deviceApplyBillEntity);
DeviceApplyBill getOne(Integer id);
......
......@@ -7,8 +7,10 @@ import com.tykj.dev.device.apply.service.DeviceApplyBillService;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import com.tykj.dev.misc.utils.JacksonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
......@@ -25,11 +27,21 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
@Override
public DeviceApplyBill addEntity(DeviceApplyBill deviceApplyBillEntity) {
DeviceApplyBill deviceApplyBill = deviceApplyBillDao.save(deviceApplyBillEntity);
return deviceApplyBillDao.save(deviceApplyBillEntity);
}
/**
* @param deviceApplyBills 异步上链
*/
@Override
@Async
public void sendHash(List<DeviceApplyBill> deviceApplyBills) {
deviceApplyBills.forEach(deviceApplyBill -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(deviceApplyBill));
String recordId = bcText.getData().getRecordID();
deviceApplyBill.setRecordId(recordId);
return update(deviceApplyBill);
update(deviceApplyBill);
});
}
@Override
......
......@@ -65,6 +65,9 @@ public class DeviceCheckBill extends BaseEntity {
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "区块链记录id")
private String recordId;
public DeviceCheckBill(Integer userAId, Integer userBId, Integer checkStatus, String checkDetail, String checkTitle, Date completeTime, String remark) {
this.userAId = userAId;
this.userBId = userBId;
......
......@@ -127,6 +127,9 @@ public class DeviceCheckDetail extends BaseEntity {
@ApiModelProperty(value = "预留字段2")
private String var2;
@ApiModelProperty(value = "区块链记录id")
private String recordId;
/**
* 用于生成市级的核查详情账单的构造函数
*/
......
......@@ -3,6 +3,7 @@ package com.tykj.dev.device.confirmcheck.entity.domain;
import com.tykj.dev.device.confirmcheck.common.CheckType;
import com.tykj.dev.misc.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
......@@ -74,6 +75,9 @@ public class DeviceCheckStat extends BaseEntity {
@Column(name = "check_userB_id")
private Integer checkUserBId;
@ApiModelProperty(value = "区块链记录id")
private String recordId;
/**
* 备注信息
*/
......
package com.tykj.dev.device.confirmcheck.service;
import com.tykj.dev.device.confirmcheck.common.TaskPeriod;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckBill;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckPeriod;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat;
import com.tykj.dev.device.confirmcheck.entity.vo.CheckStatTableVo;
import org.springframework.data.domain.Page;
......@@ -68,5 +71,21 @@ public interface ConfirmCheckService {
*/
boolean stopAutoCheckCron();
/**
* @param deviceCheckBills
* DeviceCheckBill异步上链
*/
void sendHash1(List<DeviceCheckBill> deviceCheckBills);
/**
* @param deviceCheckDetails
* DeviceCheckDetail异步上链
*/
void sendHash2(List<DeviceCheckDetail> deviceCheckDetails);
/**
* @param deviceCheckStats
* DeviceCheckStat异步上链
*/
void sendHash3(List<DeviceCheckStat> deviceCheckStats);
}
package com.tykj.dev.device.confirmcheck.service.impl;
import com.google.common.collect.Lists;
import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.device.confirmcheck.common.CheckType;
import com.tykj.dev.device.confirmcheck.common.TaskPeriod;
import com.tykj.dev.device.confirmcheck.entity.cache.AreaCache;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckBill;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckPeriod;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat;
import com.tykj.dev.device.confirmcheck.entity.vo.CheckDeviceStatVo;
import com.tykj.dev.device.confirmcheck.entity.vo.CheckStatTableVo;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckBillDao;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckPeriodDao;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckStatDao;
......@@ -35,12 +39,16 @@ import org.springframework.context.annotation.Bean;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -96,6 +104,12 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine
@Autowired
private ThreadPoolTaskScheduler threadPoolTaskScheduler;
@Autowired
private BlockChainUtil blockChainUtil;
@Autowired
private DeviceCheckBillDao deviceCheckBillDao;
//实例化一个线程池任务调度类,可以使用自定义的ThreadPoolTaskScheduler
@Bean
public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
......@@ -406,6 +420,48 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine
return flag;
}
/**
* @param deviceCheckBills DeviceCheckBill异步上链
*/
@Override
@Async
public void sendHash1(List<DeviceCheckBill> deviceCheckBills) {
deviceCheckBills.forEach(deviceCheckBill -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(deviceCheckBill));
String recordId = bcText.getData().getRecordID();
deviceCheckBill.setRecordId(recordId);
deviceCheckBillDao.save(deviceCheckBill);
});
}
/**
* @param deviceCheckDetails DeviceCheckDetail异步上链
*/
@Override
@Async
public void sendHash2(List<DeviceCheckDetail> deviceCheckDetails) {
deviceCheckDetails.forEach(deviceCheckDetail -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(deviceCheckDetail));
String recordId = bcText.getData().getRecordID();
deviceCheckDetail.setRecordId(recordId);
detailRepo.save(deviceCheckDetail);
});
}
/**
* @param deviceCheckStats DeviceCheckStat异步上链
*/
@Override
@Async
public void sendHash3(List<DeviceCheckStat> deviceCheckStats) {
deviceCheckStats.forEach(deviceCheckStat -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(deviceCheckStat));
String recordId = bcText.getData().getRecordID();
deviceCheckStat.setRecordId(recordId);
statDao.save(deviceCheckStat);
});
}
/**
* 关键字过滤器
*
......
......@@ -7,6 +7,7 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.text.ParseException;
import java.util.List;
/**
* @author dengdiyi
......@@ -15,6 +16,11 @@ public interface DeviceDestroyBillService {
DeviceDestroyBill addEntity(DeviceDestroyBill deviceDestoryBillEntity);
/**
* @param deviceDestroyBills 异步上链
*/
void sendHash(List<DeviceDestroyBill> deviceDestroyBills);
Page<DeviceDestroyBill> getPage(DeviceDestroyBillSelectVo deviceDestoryBillSelectVo, Pageable pageable);
DeviceDestroyBill getOne(Integer id);
......
......@@ -20,6 +20,7 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
......@@ -47,11 +48,21 @@ public class DeviceDestroyBillServiceImpl implements DeviceDestroyBillService {
@Override
public DeviceDestroyBill addEntity(DeviceDestroyBill deviceDestroyBillEntity) {
DeviceDestroyBill deviceDestroyBill = deviceDestroyBillDao.save(deviceDestroyBillEntity);
return deviceDestroyBillDao.save(deviceDestroyBillEntity);
}
/**
* @param deviceDestroyBills 异步上链
*/
@Override
@Async
public void sendHash(List<DeviceDestroyBill> deviceDestroyBills) {
deviceDestroyBills.forEach(deviceDestroyBill -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(deviceDestroyBill));
String recordId = bcText.getData().getRecordID();
deviceDestroyBill.setRecordId(recordId);
return updateEntity(deviceDestroyBill);
updateEntity(deviceDestroyBill);
});
}
@Override
......
......@@ -18,6 +18,11 @@ public interface DeviceLibraryService {
*/
DeviceLibrary addEntity(DeviceLibrary deviceLibraryEntity);
/**
* @param deviceLibraries 异步上链
*/
void sendHash(List<DeviceLibrary> deviceLibraries);
/**
* @param deviceLibrarySelectVo 装备查询vo
* @param pageable 获取装备分页
......
......@@ -16,6 +16,11 @@ public interface DeviceLogService {
*/
DeviceLogDto addLog(DeviceLogDto deviceLogDto);
/**
* @param deviceLogDtos 异步上链
*/
void sendHash(List<DeviceLogDto> deviceLogDtos);
DeviceLogDto getOne(Integer id);
void saveAllLog(List<DeviceLog> deviceLogList);
......
......@@ -21,6 +21,7 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
......@@ -48,11 +49,21 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
@Override
public DeviceLibrary addEntity(DeviceLibrary deviceLibraryEntity) {
DeviceLibrary deviceLibrary = deviceLibraryDao.save(deviceLibraryEntity);
return deviceLibraryDao.save(deviceLibraryEntity);
}
/**
* @param deviceLibraries 异步上链
*/
@Override
@Async
public void sendHash(List<DeviceLibrary> deviceLibraries) {
deviceLibraries.forEach(deviceLibrary -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(deviceLibrary));
String recordId = bcText.getData().getRecordID();
deviceLibrary.setRecordId(recordId);
return update(deviceLibrary);
update(deviceLibrary);
});
}
@Override
......
......@@ -10,6 +10,7 @@ import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -30,12 +31,22 @@ public class DeviceLogServiceImpl implements DeviceLogService {
@Override
public DeviceLogDto addLog(DeviceLogDto deviceLogDto) {
DeviceLog deviceLogEntity = deviceLogDao.save(deviceLogDto.toDo());
return deviceLogDao.save(deviceLogDto.toDo()).parse2Dto();
}
/**
* @param deviceLogDtos 异步上链
*/
@Override
@Async
public void sendHash(List<DeviceLogDto> deviceLogDtos) {
deviceLogDtos.forEach(deviceLogDto -> {
DeviceLog deviceLogEntity = deviceLogDto.toDo();
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(deviceLogEntity));
String recordId = bcText.getData().getRecordID();
deviceLogEntity.setRecordId(recordId);
// blockChainUtil.appendHash(JacksonUtil.toJSon(deviceLogEntity),deviceLogEntity.getRecordId());
return deviceLogDao.save(deviceLogEntity).parse2Dto();
deviceLogDao.save(deviceLogEntity);
});
}
@Override
......
......@@ -3,6 +3,8 @@ package com.tykj.dev.device.matching.service;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceBill;
import java.util.List;
/**
* @author dengdiyi
*/
......@@ -13,6 +15,11 @@ public interface MatchingDeviceBillService {
*/
MatchingDeviceBill addEntity(MatchingDeviceBill matchingDeviceBillEntity);
/**
* @param matchingDeviceBills 异步上链
*/
void sendHash(List<MatchingDeviceBill> matchingDeviceBills);
/**
* @param id 通过id查找账单
*/
......
......@@ -17,6 +17,11 @@ public interface MatchingDeviceLibraryService {
*/
MatchingDeviceLibrary addEntity(MatchingDeviceLibrary matchingDeviceLibraryEntity);
/**
* @param matchingDeviceLibraries 异步上链
*/
void sendHash(List<MatchingDeviceLibrary> matchingDeviceLibraries);
/**
* @param id 通过id查询配套设备
*/
......
......@@ -7,8 +7,10 @@ import com.tykj.dev.device.matching.service.MatchingDeviceBillService;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceBill;
import com.tykj.dev.misc.utils.JacksonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
......@@ -25,11 +27,21 @@ public class MatchingDeviceBillServiceImpl implements MatchingDeviceBillService
@Override
public MatchingDeviceBill addEntity(MatchingDeviceBill matchingDeviceBillEntity) {
MatchingDeviceBill matchingDeviceBill = matchingDeviceBillDao.save(matchingDeviceBillEntity);
return matchingDeviceBillDao.save(matchingDeviceBillEntity);
}
/**
* @param matchingDeviceBills 异步上链
*/
@Override
@Async
public void sendHash(List<MatchingDeviceBill> matchingDeviceBills) {
matchingDeviceBills.forEach(matchingDeviceBill -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(matchingDeviceBill));
String recordId = bcText.getData().getRecordID();
matchingDeviceBill.setRecordId(recordId);
return update(matchingDeviceBill);
update(matchingDeviceBill);
});
}
@Override
......
......@@ -17,6 +17,7 @@ import com.tykj.dev.misc.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
......@@ -44,11 +45,21 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
@Override
public MatchingDeviceLibrary addEntity(MatchingDeviceLibrary matchingDeviceLibraryEntity) {
MatchingDeviceLibrary matchingDeviceLibrary = matchingDeviceLibraryDao.save(matchingDeviceLibraryEntity);
return matchingDeviceLibraryDao.save(matchingDeviceLibraryEntity);
}
/**
* @param matchingDeviceLibraries 异步上链
*/
@Override
@Async
public void sendHash(List<MatchingDeviceLibrary> matchingDeviceLibraries) {
matchingDeviceLibraries.forEach(matchingDeviceLibrary -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(matchingDeviceLibrary));
String recordId = bcText.getData().getRecordID();
matchingDeviceLibrary.setRecordId(recordId);
return update(matchingDeviceLibrary);
update(matchingDeviceLibrary);
});
}
@Override
......
......@@ -58,10 +58,12 @@ public class PackingController {
@PostMapping("/addPackingLibrary")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity addPackingLibrary(@RequestBody @Validated PackingLibrarySaveVo packingLibrarySaveVo) {
List<PackingLibrary> packingLibraries = new ArrayList<>();
//添加列装装备信息
PackingLibrary p = packingLibrarySaveVo.toDo();
p.setUseraId(userUtils.getCurrentUserId());
PackingLibrary packingLibraryEntity = packingLibraryService.addEntity(p);
packingLibraries.add(packingLibraryEntity);
//添加列装配件信息
for (PartSaveVo part : packingLibrarySaveVo.getPartList()) {
PackingLibrary p2 = new PackingLibrary();
......@@ -70,7 +72,7 @@ public class PackingController {
p2.setId(null);
p2.setIsPart(1);
p2.setPartParentId(packingLibraryEntity.getId());
packingLibraryService.addEntity(p2);
packingLibraries.add(packingLibraryService.addEntity(p2));
}
//发起业务
Integer userId = userUtils.getCurrentUserId();
......@@ -80,6 +82,7 @@ public class PackingController {
TaskBto taskBto = new TaskBto(StatusEnum.PACKING_CONFIRM.id, "列装业务", null, ".", packingLibraryEntity.getId(), 1, userUtils.getCurrentUnitId(), 1, null, userIds);
TaskBto saveEntity = taskService.start(taskBto);
myWebSocket.sendMessage1();
packingLibraryService.sendHash(packingLibraries);
return ResultUtil.success(saveEntity);
}
......@@ -145,12 +148,14 @@ public class PackingController {
@ApiOperation(value = "添加列装型号")
@PostMapping("/add/model")
public ResponseEntity addModel(@RequestBody @Validated AddModel addModel){
List<PackingLibrary> packingLibraries = new ArrayList<>();
PackingLibrary packingLibrary = new PackingLibrary();
BeanUtils.copyProperties(addModel,packingLibrary);
packingLibrary.setIsRoot(1);
packingLibrary.setName(addModel.getModel());
packingLibrary.setPackingStatus(2);
packingLibraryService.addEntity(packingLibrary);
packingLibraries.add(packingLibraryService.addEntity(packingLibrary));
packingLibraryService.sendHash(packingLibraries);
return ResponseEntity.ok("添加成功");
}
......
......@@ -18,6 +18,11 @@ public interface PackingLibraryService {
*/
PackingLibrary addEntity(PackingLibrary packingLibraryEntity);
/**
* @param packingLibraries 列装异步上链
*/
void sendHash(List<PackingLibrary> packingLibraries);
/**
* @param packingLibrarySelectVo 列装查询vo
* @param pageable 获取列装库分页
......
......@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
......@@ -43,11 +44,21 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
@Override
public PackingLibrary addEntity(PackingLibrary packingLibraryEntity) {
PackingLibrary packingLibrary = packingLibraryDao.save(packingLibraryEntity);
return packingLibraryDao.save(packingLibraryEntity);
}
/**
* @param packingLibraries 列装异步上链
*/
@Override
@Async
public void sendHash(List<PackingLibrary> packingLibraries) {
packingLibraries.forEach(packingLibrary -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(packingLibrary));
String recordId = bcText.getData().getRecordID();
packingLibrary.setRecordId(recordId);
return update(packingLibrary);
update(packingLibrary);
});
}
@Override
......
......@@ -3,7 +3,14 @@ package com.tykj.dev.device.repair.service;
import com.tykj.dev.device.repair.subject.domin.RepairBackBill;
import java.util.List;
public interface RepairBackBillService extends RepairPublicService<RepairBackBill> {
RepairBackBill getOne(Integer id);
/**
* @param repairBackBills 异步上链
*/
void sendHash(List<RepairBackBill> repairBackBills);
}
......@@ -5,6 +5,8 @@ import com.tykj.dev.device.repair.subject.vo.RepairBillSelectVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* @author dengdiyi
*/
......@@ -12,6 +14,11 @@ public interface RepairBillService {
RepairBill addEntity(RepairBill deviceRepairBillEntity);
/**
* @param repairBills 异步上链
*/
void sendHash(List<RepairBill> repairBills);
Page<RepairBill> getPage(RepairBillSelectVo deviceRepairBillSelectVo, Pageable pageable);
RepairBill getOne(Integer id);
......
......@@ -38,4 +38,9 @@ public interface RepairDetailService extends RepairPublicService<RepairDetail> {
*/
RepairDetail getOne(Integer id);
/**
* @param repairDetails 异步上链
*/
void sendHash(List<RepairDetail> repairDetails);
}
......@@ -5,6 +5,8 @@ import com.tykj.dev.device.repair.subject.vo.RepairBillSelectVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* @author dengdiyi
*/
......@@ -12,6 +14,11 @@ public interface RepairSendBillService {
RepairSendBill addEntity(RepairSendBill deviceRepairSendBillEntity);
/**
* @param repairSendBills 异步上链
*/
void sendHash(List<RepairSendBill> repairSendBills);
Page<RepairSendBill> getPage(RepairBillSelectVo deviceRepairBillSelectVo, Pageable pageable);
RepairSendBill getOne(Integer id);
......
......@@ -9,6 +9,7 @@ import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -31,11 +32,7 @@ public class RepairBackBillServiceImpl implements RepairBackBillService {
@Override
public RepairBackBill save(RepairBackBill deviceRepairBackBillEntity) {
RepairBackBill repairBackBill = deviceRepairBackBillDao.save(deviceRepairBackBillEntity);
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(repairBackBill));
String recordId = bcText.getData().getRecordID();
repairBackBill.setRecordId(recordId);
return update(repairBackBill);
return deviceRepairBackBillDao.save(deviceRepairBackBillEntity);
}
@Override
......@@ -63,4 +60,18 @@ public class RepairBackBillServiceImpl implements RepairBackBillService {
throw new ApiException(ResultUtil.failed("所查询的Id不存在"));
}
}
/**
* @param repairBackBills 异步上链
*/
@Override
@Async
public void sendHash(List<RepairBackBill> repairBackBills) {
repairBackBills.forEach(repairBackBill -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(repairBackBill));
String recordId = bcText.getData().getRecordID();
repairBackBill.setRecordId(recordId);
update(repairBackBill);
});
}
}
......@@ -14,10 +14,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Optional;
/**
......@@ -37,11 +39,21 @@ public class RepairBillServiceImpl implements RepairBillService {
@Override
public RepairBill addEntity(RepairBill deviceRepairBillEntity) {
RepairBill repairBill = deviceRepairBillDao.save(deviceRepairBillEntity);
return deviceRepairBillDao.save(deviceRepairBillEntity);
}
/**
* @param repairBills 异步上链
*/
@Override
@Async
public void sendHash(List<RepairBill> repairBills) {
repairBills.forEach(repairBill -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(repairBill));
String recordId = bcText.getData().getRecordID();
repairBill.setRecordId(recordId);
return update(repairBill);
update(repairBill);
});
}
@Override
......
......@@ -9,6 +9,7 @@ import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -31,11 +32,7 @@ public class RepairDetailServiceImpl implements RepairDetailService {
@Override
public RepairDetail save(RepairDetail deviceRepairDetailEntity) {
RepairDetail repairDetail = deviceRepairDetailDao.save(deviceRepairDetailEntity);
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(repairDetail));
String recordId = bcText.getData().getRecordID();
repairDetail.setRecordId(recordId);
return update(repairDetail);
return deviceRepairDetailDao.save(deviceRepairDetailEntity);
}
@Override
......@@ -85,4 +82,18 @@ public class RepairDetailServiceImpl implements RepairDetailService {
throw new ApiException(ResultUtil.failed("所查询ID不存在"));
}
}
/**
* @param repairDetails 异步上链
*/
@Override
@Async
public void sendHash(List<RepairDetail> repairDetails) {
repairDetails.forEach(repairDetail -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(repairDetail));
String recordId = bcText.getData().getRecordID();
repairDetail.setRecordId(recordId);
update(repairDetail);
});
}
}
......@@ -14,10 +14,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Optional;
/**
......@@ -37,11 +39,21 @@ public class RepairSendBillServiceImpl implements RepairSendBillService {
@Override
public RepairSendBill addEntity(RepairSendBill deviceRepairSendBillEntity) {
RepairSendBill repairSendBill = deviceRepairSendBillDao.save(deviceRepairSendBillEntity);
return deviceRepairSendBillDao.save(deviceRepairSendBillEntity);
}
/**
* @param repairSendBills 异步上链
*/
@Override
@Async
public void sendHash(List<RepairSendBill> repairSendBills) {
repairSendBills.forEach(repairSendBill -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(repairSendBill));
String recordId = bcText.getData().getRecordID();
repairSendBill.setRecordId(recordId);
return update(repairSendBill);
update(repairSendBill);
});
}
@Override
......
......@@ -2,6 +2,8 @@ package com.tykj.dev.device.retired.service;
import com.tykj.dev.device.retired.entity.domain.DeviceRetiredBill;
import java.util.List;
/**
* @author HuangXiahao
* @version V1.0
......@@ -12,6 +14,11 @@ public interface DeviceRetiredBillService {
DeviceRetiredBill addEntity(DeviceRetiredBill deviceRetiredBillEntity);
/**
* @param deviceRetiredBills 异步上链
*/
void sendHash(List<DeviceRetiredBill> deviceRetiredBills);
DeviceRetiredBill getOne(Integer id);
DeviceRetiredBill update(DeviceRetiredBill deviceRetiredBillEntity);
......
......@@ -11,8 +11,10 @@ import com.tykj.dev.device.retired.repository.DeviceRetiredBillDao;
import com.tykj.dev.device.retired.service.DeviceRetiredBillService;
import com.tykj.dev.misc.utils.JacksonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
......@@ -35,11 +37,21 @@ public class DeviceRetiredBillServiceImpl implements DeviceRetiredBillService {
@Override
public DeviceRetiredBill addEntity(DeviceRetiredBill deviceRetiredBillEntity) {
DeviceRetiredBill deviceRetiredBill = deviceRetiredBillDao.save(deviceRetiredBillEntity);
return deviceRetiredBillDao.save(deviceRetiredBillEntity);
}
/**
* @param deviceRetiredBills 异步上链
*/
@Override
@Async
public void sendHash(List<DeviceRetiredBill> deviceRetiredBills) {
deviceRetiredBills.forEach(deviceRetiredBill -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(deviceRetiredBill));
String recordId = bcText.getData().getRecordID();
deviceRetiredBill.setRecordId(recordId);
return update(deviceRetiredBill);
update(deviceRetiredBill);
});
}
......
......@@ -19,6 +19,11 @@ public interface InputOutputDeviceService {
*/
InputOutputDevice addEntity(InputOutputDevice inputOutputDevice);
/**
* @param inputOutputDevices 异步上链
*/
void sendHash(List<InputOutputDevice> inputOutputDevices);
List<InputOutputDevice> getByUnitIdAndDirection(Integer unitId,Integer direction);
void deleteAll(List<InputOutputDevice> inputOutputDevices);
......
......@@ -2,6 +2,8 @@ package com.tykj.dev.rfid.service;
import com.tykj.dev.rfid.entity.domin.LibraryWarningLogDetail;
import java.util.List;
/**
* @author HuangXiahao
* @version V1.0
......@@ -12,5 +14,8 @@ public interface LibraryWarningLogDetailService {
LibraryWarningLogDetail addEntity(LibraryWarningLogDetail libraryWarningLogDetail);
/**
* @param libraryWarningLogDetails 异步上链
*/
void sendHash(List<LibraryWarningLogDetail> libraryWarningLogDetails);
}
......@@ -17,6 +17,11 @@ public interface LibraryWarningLogService {
LibraryWarningLog addEntity(LibraryWarningLog libraryWarningLog);
/**
* @param libraryWarningLogs 异步上链
*/
void sendHash(List<LibraryWarningLog> libraryWarningLogs);
Page<LibraryWarningLog> getPage(LibraryWarningLogSelectVo libraryWarningLogSelectVo) throws ParseException;
List<WarningDetailListVo> getWarningDetail(Integer warningId, Boolean isHandle);
......
......@@ -2,6 +2,8 @@ package com.tykj.dev.rfid.service;
import com.tykj.dev.rfid.entity.domin.RfidChangeBill;
import java.util.List;
/**
* @author HuangXiahao
* @version V1.0
......@@ -12,6 +14,11 @@ public interface RfidChangeBillService {
RfidChangeBill addEntity(RfidChangeBill libraryWarningLogEntity);
/**
* @param rfidChangeBills 异步上链
*/
void sendHash(List<RfidChangeBill> rfidChangeBills);
RfidChangeBill getOne(Integer id);
RfidChangeBill updateEntity(RfidChangeBill rfidChangeBill);
......
......@@ -19,6 +19,11 @@ public interface RfidChangeLogService {
RfidChangeLog addEntity(RfidChangeLog rfidChangeLog);
/**
* @param rfidChangeLogs 异步上链
*/
void sendHash(List<RfidChangeLog> rfidChangeLogs);
RfidChangeLog updateEntity(RfidChangeLog rfidChangeLog);
}
......@@ -9,6 +9,7 @@ import com.tykj.dev.rfid.entity.domin.InputOutputDevice;
import com.tykj.dev.rfid.repository.InputOutputDeviceDao;
import com.tykj.dev.rfid.service.InputOutputDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -34,12 +35,21 @@ public class InputOutputDeviceServiceImpl implements InputOutputDeviceService {
@Override
public InputOutputDevice addEntity(InputOutputDevice inputOutputDevice) {
InputOutputDevice inputOutputDevice1 = inputOutputDeviceDao.save(inputOutputDevice);
return inputOutputDeviceDao.save(inputOutputDevice);
}
/**
* @param inputOutputDevices 异步上链
*/
@Override
@Async
public void sendHash(List<InputOutputDevice> inputOutputDevices) {
inputOutputDevices.forEach(inputOutputDevice1 -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(inputOutputDevice1));
String recordId = bcText.getData().getRecordID();
inputOutputDevice1.setRecordId(recordId);
// blockChainUtil.appendHash(JacksonUtil.toJSon(inputOutputDevice1),inputOutputDevice1.getRecordId());
return inputOutputDeviceDao.save(inputOutputDevice1);
inputOutputDeviceDao.save(inputOutputDevice1);
});
}
@Override
......
......@@ -7,8 +7,11 @@ import com.tykj.dev.rfid.entity.domin.LibraryWarningLogDetail;
import com.tykj.dev.rfid.repository.LibraryWarningLogDetailDao;
import com.tykj.dev.rfid.service.LibraryWarningLogDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author HuangXiahao
* @version V1.0
......@@ -26,11 +29,20 @@ public class LibraryWarningLogDetailServiceImp implements LibraryWarningLogDetai
@Override
public LibraryWarningLogDetail addEntity(LibraryWarningLogDetail libraryWarningLogDetail) {
LibraryWarningLogDetail libraryWarningLogDetail1 = libraryWarningLogDetailDao.save(libraryWarningLogDetail);
return libraryWarningLogDetailDao.save(libraryWarningLogDetail);
}
/**
* @param libraryWarningLogDetails 异步上链
*/
@Override
@Async
public void sendHash(List<LibraryWarningLogDetail> libraryWarningLogDetails) {
libraryWarningLogDetails.forEach(libraryWarningLogDetail1 -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(libraryWarningLogDetail1));
String recordId = bcText.getData().getRecordID();
libraryWarningLogDetail1.setRecordId(recordId);
// blockChainUtil.appendHash(JacksonUtil.toJSon(libraryWarningLogDetail1),libraryWarningLogDetail1.getRecordId());
return libraryWarningLogDetailDao.save(libraryWarningLogDetail1);
libraryWarningLogDetailDao.save(libraryWarningLogDetail1);
});
}
}
......@@ -22,6 +22,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -51,11 +52,21 @@ public class LibraryWarningLogServiceImpl implements LibraryWarningLogService {
@Override
public LibraryWarningLog addEntity(LibraryWarningLog libraryWarningLog) {
LibraryWarningLog libraryWarningLog1 = libraryWarningLogDao.save(libraryWarningLog);
return libraryWarningLogDao.save(libraryWarningLog);
}
/**
* @param libraryWarningLogs 异步上链
*/
@Override
@Async
public void sendHash(List<LibraryWarningLog> libraryWarningLogs) {
libraryWarningLogs.forEach(libraryWarningLog1 -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(libraryWarningLog1));
String recordId = bcText.getData().getRecordID();
libraryWarningLog1.setRecordId(recordId);
return update(libraryWarningLog1);
update(libraryWarningLog1);
});
}
@Override
......
......@@ -8,8 +8,11 @@ import com.tykj.dev.rfid.repository.RfidChangeBillDao;
import com.tykj.dev.rfid.repository.RfidChangeLogDao;
import com.tykj.dev.rfid.service.RfidChangeBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author HuangXiahao
* @version V1.0
......@@ -30,11 +33,21 @@ public class RfidChangeBillServiceImpl implements RfidChangeBillService {
@Override
public RfidChangeBill addEntity(RfidChangeBill libraryWarningLogEntity) {
RfidChangeBill rfidChangeBill = rfidChangeBillDao.save(libraryWarningLogEntity);
return rfidChangeBillDao.save(libraryWarningLogEntity);
}
/**
* @param rfidChangeBills 异步上链
*/
@Override
@Async
public void sendHash(List<RfidChangeBill> rfidChangeBills) {
rfidChangeBills.forEach(rfidChangeBill -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(rfidChangeBill));
String recordId = bcText.getData().getRecordID();
rfidChangeBill.setRecordId(recordId);
return updateEntity(rfidChangeBill);
updateEntity(rfidChangeBill);
});
}
@Override
......
......@@ -11,6 +11,7 @@ import com.tykj.dev.rfid.repository.RfidChangeLogDao;
import com.tykj.dev.rfid.service.RfidChangeLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -43,11 +44,21 @@ public class RfidChangeLogServiceImpl implements RfidChangeLogService {
@Override
public RfidChangeLog addEntity(RfidChangeLog rfidChangeLog) {
RfidChangeLog rfidChangeLog1 = rfidChangeLogDao.save(rfidChangeLog);
return rfidChangeLogDao.save(rfidChangeLog);
}
/**
* @param rfidChangeLogs 异步上链
*/
@Override
@Async
public void sendHash(List<RfidChangeLog> rfidChangeLogs) {
rfidChangeLogs.forEach(rfidChangeLog1 -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(rfidChangeLog1));
String recordId = bcText.getData().getRecordID();
rfidChangeLog1.setRecordId(recordId);
return updateEntity(rfidChangeLog1);
updateEntity(rfidChangeLog1);
});
}
@Override
......
......@@ -4,6 +4,8 @@ import com.tykj.dev.device.scrap.subject.domin.ScrapBill;
import com.tykj.dev.device.scrap.subject.vo.ScrapSelectVo;
import org.springframework.data.domain.Page;
import java.util.List;
/**
* @author dengdiyi
*/
......@@ -11,6 +13,11 @@ public interface ScrapBillService {
ScrapBill add(ScrapBill scrapBill);
/**
* @param scrapBills 异步上链
*/
void sendHash(List<ScrapBill> scrapBills);
ScrapBill getOne(Integer id);
ScrapBill update(ScrapBill scrapBill);
......
......@@ -13,10 +13,12 @@ import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Optional;
/**
......@@ -33,11 +35,21 @@ public class ScrapBillServiceImpl implements ScrapBillService {
@Override
public ScrapBill add(ScrapBill scrapBill) {
ScrapBill scrapBill1 = scrapBillDao.save(scrapBill);
return scrapBillDao.save(scrapBill);
}
/**
* @param scrapBills 异步上链
*/
@Override
@Async
public void sendHash(List<ScrapBill> scrapBills) {
scrapBills.forEach(scrapBill1 -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(scrapBill1));
String recordId = bcText.getData().getRecordID();
scrapBill1.setRecordId(recordId);
return update(scrapBill1);
update(scrapBill1);
});
}
@Override
......
......@@ -115,9 +115,9 @@ public class SelfCheckController {
public ResponseEntity setCycle(@PathVariable("type") int type){
if (selfCheckSchedulerTask!=null) {
String corn = "0 0 0 1 1/"+type+" ? ";
selfCheckSchedulerTask.setCron(corn);
ScheduledFuture scheduledFuture = selfCheckSchedulerTask.getScheduledFuture();
scheduledFuture.cancel(true);
selfCheckSchedulerTask.setCron(corn);
selfCheckSchedulerTask.startTask();
systemVariableService.setVaule("selfCheckCycle",corn);
log.info("[自查模块]:自查周期更改为"+type+"个月");
......
......@@ -6,6 +6,8 @@ import com.tykj.dev.device.selfcheck.subject.vo.SelfCheckSelectVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* @author dengdiyi
*/
......@@ -13,6 +15,11 @@ public interface SelfCheckBillService {
SelfCheckBill addEntity(SelfCheckBill selfExaminationBillEntity);
/**
* @param selfCheckBills 异步上链
*/
void sendHash(List<SelfCheckBill> selfCheckBills);
SelfCheckBill update(SelfCheckBill selfExaminationBillEntity);
SelfCheckBill getOne(Integer id);
......
......@@ -16,10 +16,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Optional;
/**
......@@ -39,11 +41,21 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
@Override
public SelfCheckBill addEntity(SelfCheckBill selfExaminationBillEntity) {
SelfCheckBill selfCheckBill = selfExaminationBillDao.save(selfExaminationBillEntity);
return selfExaminationBillDao.save(selfExaminationBillEntity);
}
/**
* @param selfCheckBills 异步上链
*/
@Override
@Async
public void sendHash(List<SelfCheckBill> selfCheckBills) {
selfCheckBills.forEach(selfCheckBill -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(selfCheckBill));
String recordId = bcText.getData().getRecordID();
selfCheckBill.setRecordId(recordId);
return update(selfCheckBill);
update(selfCheckBill);
});
}
@Override
......
......@@ -28,7 +28,7 @@ public class SelfCheckSaveVo {
@ApiModelProperty(name = "任务id", example = "1")
private Integer taskId;
@NotNull(message = "userbId不能为空")
// @NotNull(message = "userbId不能为空")
@Min(value = 1,message = "userbId不能小于1")
@ApiModelProperty(name = "审核人ID", example = "1")
private Integer userbId;
......
......@@ -13,6 +13,11 @@ public interface StorageBillService {
StorageBill addEntity(StorageBill storageBillEntity);
/**
* @param storageBills 异步上链
*/
void sendHash(List<StorageBill> storageBills);
Page<StorageBill> getPage(StorageBill storageBillEntity, Pageable pageable);
List<StorageBill> getList(StorageBill storageBillEntity);
......
......@@ -9,6 +9,7 @@ import com.tykj.dev.misc.utils.JacksonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -28,11 +29,21 @@ public class StorageBillServiceImpl implements StorageBillService {
@Override
public StorageBill addEntity(StorageBill storageBillEntity) {
StorageBill storageBill = storageBillDao.save(storageBillEntity);
return storageBillDao.save(storageBillEntity);
}
/**
* @param storageBills 异步上链
*/
@Override
@Async
public void sendHash(List<StorageBill> storageBills) {
storageBills.forEach(storageBill -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(storageBill));
String recordId = bcText.getData().getRecordID();
storageBill.setRecordId(recordId);
return update(storageBill);
update(storageBill);
});
}
@Override
......
......@@ -99,6 +99,11 @@ public interface TaskService {
*/
TaskBto start(TaskBto taskBto);
/**
* @param taskBtos 异步上链
*/
void sendHash(List<TaskBto> taskBtos);
/**
* 更新Task
*/
......
......@@ -2,6 +2,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.service.BlockChainUtil;
import com.tykj.dev.config.GlobalMap;
import com.tykj.dev.config.Log;
......@@ -20,10 +21,12 @@ import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.socket.MyWebSocket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
......@@ -288,6 +291,20 @@ public class TaskServiceImpl implements TaskService {
return task.parse2Bto();
}
/**
* @param taskBtos 异步上链
*/
@Override
@Async
public void sendHash(List<TaskBto> taskBtos) {
taskBtos.forEach(taskBto -> {
Task task = taskBto.toDo();
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(task));
String recordId = bcText.getData().getRecordID();
task.setRecordId(recordId);
});
}
/**
* 更新Task
*/
......
......@@ -16,6 +16,11 @@ public interface TrainThemeService {
TrainTheme save(TrainTheme trainTheme);
/**
* @param trainThemes 异步上链
*/
void sendHash(List<TrainTheme> trainThemes);
TrainTheme findById(Integer trainThemeId);
List<TrainTheme> findAllStatus(Integer status);
......
package com.tykj.dev.device.train.service.impl;
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.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.train.dao.TrainThemeDao;
......@@ -19,16 +17,14 @@ import com.tykj.dev.device.user.subject.service.UserService;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.StringSplitUtil;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
......@@ -65,12 +61,21 @@ public class TrainThemeServiceImpl implements TrainThemeService {
@Override
public TrainTheme save(TrainTheme trainTheme) {
TrainTheme trainTheme1 = trainThemeDao.save(trainTheme);
return trainThemeDao.save(trainTheme);
}
/**
* @param trainThemes 异步上链
*/
@Override
@Async
public void sendHash(List<TrainTheme> trainThemes) {
trainThemes.forEach(trainTheme1 -> {
BcHash bcHash=blockChainUtil.sendHash(1000,JacksonUtil.toJSon(trainTheme1));
trainTheme1.setRecordId(bcHash.getData().getRecordID());
trainThemeDao.save(trainTheme1);
return trainTheme1;
});
}
@Override
......
......@@ -301,12 +301,17 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public Units save(Units units) {
if (units.getAreaId()!=null&&units.getAreaId()!=0) {
Optional<Area> optionalArea = areaDao.findById(units.getAreaId());
if (optionalArea.isPresent()){
if (optionalArea.isPresent()) {
units.setLevel(optionalArea.get().getType());
}else {
} else {
throw new ApiException(ResponseEntity.ok("[单位] 没找到对应的区域,请检查"));
}
}
else {
units.setLevel(4);
}
return unitsDao.save(units);
}
......
......@@ -17,6 +17,11 @@ public interface DeviceUseReportService {
DeviceUseReport addEntity(DeviceUseReport deviceUseReportEntity);
/**
* @param deviceUseReports 异步上链
*/
void sendHash(List<DeviceUseReport> deviceUseReports);
Page<DeviceUseReport> getPage(DeviceUseReportSelectVo deviceUseReportSelectVo, Pageable pageable);
DeviceUseReport getOne(Integer id);
......
......@@ -37,6 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
......@@ -88,11 +89,21 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
@Override
public DeviceUseReport addEntity(DeviceUseReport deviceUseReportEntity) {
DeviceUseReport deviceUseReport = deviceUseReportDao.save(deviceUseReportEntity);
return deviceUseReportDao.save(deviceUseReportEntity);
}
/**
* @param deviceUseReports 异步上链
*/
@Override
@Async
public void sendHash(List<DeviceUseReport> deviceUseReports) {
deviceUseReports.forEach(deviceUseReport -> {
BcHash bcText = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(deviceUseReport));
String recordId = bcText.getData().getRecordID();
deviceUseReport.setRecordId(recordId);
return update(deviceUseReport);
update(deviceUseReport);
});
}
@Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论