提交 3ec17b41 authored 作者: 133's avatar 133

[用户] [清退] [专管员统计] 代码提交

上级 30f83dbe
...@@ -57,6 +57,17 @@ public interface BlockChainUtil { ...@@ -57,6 +57,17 @@ public interface BlockChainUtil {
*/ */
BcHash sendHash(Integer index,Integer subCode, String content); BcHash sendHash(Integer index,Integer subCode, String content);
/**
* hash 上链
*
* @param subCode 业务代码编号
* @param content 内容哈希,256bits hex编码。 方法可参考本模块HexUtil,方法内已转换,直接传入内容即可
* @return bh
*/
BcHash sendHash(Integer subCode, String content);
/** /**
* 记录查询 * 记录查询
* *
...@@ -113,6 +124,15 @@ public interface BlockChainUtil { ...@@ -113,6 +124,15 @@ public interface BlockChainUtil {
*/ */
BcHash appendHash(Integer index,String content, String recordId); BcHash appendHash(Integer index,String content, String recordId);
/**
* 哈希追加更新
*
* @param content 内容哈希,256bits hex编码,方法内已转换,直接传入内容即可
* @param recordId 本条记录上次上链或追加返回的记录id, 确保顺序追加
* @return bc
*/
BcHash appendHash(String content, String recordId);
/** /**
* 哈希防篡改校验 * 哈希防篡改校验
* *
......
...@@ -27,9 +27,13 @@ import java.util.UUID; ...@@ -27,9 +27,13 @@ import java.util.UUID;
@Component @Component
public class BlockChainUtilImpl implements BlockChainUtil { public class BlockChainUtilImpl implements BlockChainUtil {
public String SECRET_KEY = "3mdeM1dw2FfHrd5h6WAuhB3WYdDG6ZAgz96CcM1nzxbiYA8QaaZHW75Je9xKixTTD2rwujyb1gVUNPYm5W6FPZQ8"; // private static String SECRET_KEY = "3mdeM1dw2FfHrd5h6WAuhB3WYdDG6ZAgz96CcM1nzxbiYA8QaaZHW75Je9xKixTTD2rwujyb1gVUNPYm5W6FPZQ8";
public String SECRET_ID = "3yXRRiL9xsLfbt2kv7qRH2so6ChJX3rFkay7Njcsxfbp"; // private static String SECRET_ID = "3yXRRiL9xsLfbt2kv7qRH2so6ChJX3rFkay7Njcsxfbp";
private final static String BLOCK_CHAIN_URL = "http://10.153.4.12:8076"; //测试环境
public String SECRET_KEY = "3RJWStDCXN7mqJyZAB8rF59f87arGShdk9aKyDN3wKbzq9JnaXom1Hpe6mHT1k2yx9zfE7VFWidqwuxyT7DtPjCs";
public String SECRET_ID = "JAjQyTZdR8bmbHaU6iiFGvrCuUik4cG4U4ostk8KKrbS";
private final static String BLOCK_CHAIN_URL = "http://192.168.0.80:8076";
private final static String BLOCK_CHAIN_URL2 = "http://10.153.8.10:8076"; private final static String BLOCK_CHAIN_URL2 = "http://10.153.8.10:8076";
private final static String BLOCK_CHAIN_URL3 = "http://10.153.8.11:8076"; private final static String BLOCK_CHAIN_URL3 = "http://10.153.8.11:8076";
private final static String BLOCK_CHAIN_URL4 = "http://10.153.110.10:8076"; private final static String BLOCK_CHAIN_URL4 = "http://10.153.110.10:8076";
...@@ -177,6 +181,22 @@ public class BlockChainUtilImpl implements BlockChainUtil { ...@@ -177,6 +181,22 @@ public class BlockChainUtilImpl implements BlockChainUtil {
); );
} }
@Override
public BcHash sendHash(Integer subCode, String content) {
SortedMap<Object, Object> request = getRequest();
request.put("content", HexUtil.hex64(content));
request.put("subCode", subCode);
String s = ApiSignatureUtil.getApiSignature(request, SECRET_KEY);
log.info("apiSignature:{}",s);
request.put("apiSignature", s);
return new RestTemplate().postForObject(
BLOCK_CHAIN_URL + BcUrl.SEND_HASH,
request,
BcHash.class
);
}
@Override @Override
public BcRecord fetchRecord(String recordId) { public BcRecord fetchRecord(String recordId) {
SortedMap<Object, Object> request = getRequest(); SortedMap<Object, Object> request = getRequest();
...@@ -310,6 +330,20 @@ public class BlockChainUtilImpl implements BlockChainUtil { ...@@ -310,6 +330,20 @@ public class BlockChainUtilImpl implements BlockChainUtil {
} }
@Override
public BcHash appendHash(String content, String recordId) {
SortedMap<Object, Object> request = getRequest();
request.put("content", HexUtil.hex64(content));
request.put("recordID", recordId);
String s = ApiSignatureUtil.getApiSignature(request, SECRET_KEY);
request.put("apiSignature", s);
return new RestTemplate().postForObject(
BLOCK_CHAIN_URL + BcUrl.APPEND_HASH,
request,
BcHash.class
);
}
@Override @Override
public BcVerify verifyHash(String content, String recordId) { public BcVerify verifyHash(String content, String recordId) {
SortedMap<Object, Object> request = getRequest(); SortedMap<Object, Object> request = getRequest();
......
...@@ -104,4 +104,7 @@ public class SendBackBill { ...@@ -104,4 +104,7 @@ public class SendBackBill {
@ApiModelProperty(value = "是否完成") @ApiModelProperty(value = "是否完成")
private Integer isComplete; private Integer isComplete;
@ApiModelProperty(value = "区块链RID",name = "recordId")
private String recordId;
} }
...@@ -223,4 +223,7 @@ public class SendBackBillDetail { ...@@ -223,4 +223,7 @@ public class SendBackBillDetail {
@ApiModelProperty(value = "收件单位签章id") @ApiModelProperty(value = "收件单位签章id")
private String rightSignatureId; private String rightSignatureId;
@ApiModelProperty(value = "区块链RID",name = "recordId")
private String recordId;
} }
...@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON; ...@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.github.wenhao.jpa.Specifications; import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.blockcha.subject.entity.BcText;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService; import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService; import com.tykj.dev.device.library.service.DeviceLogService;
...@@ -78,6 +80,9 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -78,6 +80,9 @@ public class SendBackServiceImpl implements SendBackService {
@Autowired @Autowired
Snowflake snowflake; Snowflake snowflake;
@Autowired
BlockChainUtil blockChainUtil;
@Autowired @Autowired
MessageService messageService; MessageService messageService;
/** /**
...@@ -304,7 +309,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -304,7 +309,8 @@ public class SendBackServiceImpl implements SendBackService {
TaskBto parentTask = taskService.get(parentTaskId); TaskBto parentTask = taskService.get(parentTaskId);
SendBackBill parentBillEntity = sendBackBillEntityDao.findById(parentTask.getBillId()).get(); SendBackBill parentBillEntity = sendBackBillEntityDao.findById(parentTask.getBillId()).get();
parentBillEntity.setExceptionDes(JSON.toJSONString(unDeviceDes)); parentBillEntity.setExceptionDes(JSON.toJSONString(unDeviceDes));
sendBackBillEntityDao.save(parentBillEntity);
saveSendBackBill(parentBillEntity);
Set<String> locationKey = locationUnitList.keySet(); Set<String> locationKey = locationUnitList.keySet();
...@@ -401,7 +407,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -401,7 +407,8 @@ public class SendBackServiceImpl implements SendBackService {
} }
sendBackBillEntityDao.save(parentTaskBill); // sendBackBillEntityDao.save(parentTaskBill);
saveSendBackBill(parentTaskBill);
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
if (units.getLevel()==2){ if (units.getLevel()==2){
...@@ -409,7 +416,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -409,7 +416,8 @@ public class SendBackServiceImpl implements SendBackService {
Integer cityTaskBillId = cityTask.getBillId(); Integer cityTaskBillId = cityTask.getBillId();
SendBackBill cityTaskBill = sendBackBillEntityDao.findById(cityTaskBillId).get(); SendBackBill cityTaskBill = sendBackBillEntityDao.findById(cityTaskBillId).get();
parentTaskBill.setInvoleDevice(cityTaskBill.getInvoleDevice()+involeDevice); parentTaskBill.setInvoleDevice(cityTaskBill.getInvoleDevice()+involeDevice);
sendBackBillEntityDao.save(parentTaskBill); saveSendBackBill(parentTaskBill);
// sendBackBillEntityDao.save(parentTaskBill);
} }
return ResponseEntity.ok("异常处理成功"); return ResponseEntity.ok("异常处理成功");
...@@ -518,10 +526,12 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -518,10 +526,12 @@ public class SendBackServiceImpl implements SendBackService {
sendBackBillDetailEntity.setNum("第"+new Date().getYear()+"QT"+taskEntity.getBillId()+"号"); sendBackBillDetailEntity.setNum("第"+new Date().getYear()+"QT"+taskEntity.getBillId()+"号");
sendBackBillDetailEntity.setLeftSignatureId(String.valueOf(snowflake.creatNextId())); sendBackBillDetailEntity.setLeftSignatureId(String.valueOf(snowflake.creatNextId()));
sendBackBillDetailEntity.setRightSignatureId(String.valueOf(snowflake.creatNextId())); sendBackBillDetailEntity.setRightSignatureId(String.valueOf(snowflake.creatNextId()));
SendBackBillDetail backBillDetailEntity = sendBackBillDetailEntityDao.save(sendBackBillDetailEntity); // SendBackBillDetail backBillDetailEntity = sendBackBillDetailEntityDao.save(sendBackBillDetailEntity);
bill.setFormId(backBillDetailEntity.getId()); SendBackBillDetail backBillDetailEntity = saveSendBackBillDetail(sendBackBillDetailEntity);
sendBackBillEntityDao.save(bill);
bill.setFormId(backBillDetailEntity.getId());
// sendBackBillEntityDao.save(bill);
saveSendBackBill(bill);
Units father=fatherUnit.get(0); Units father=fatherUnit.get(0);
taskEntity.setOwnUnit(father.getUnitId()); taskEntity.setOwnUnit(father.getUnitId());
...@@ -595,7 +605,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -595,7 +605,8 @@ public class SendBackServiceImpl implements SendBackService {
Integer billId = taskEntity.getBillId(); Integer billId = taskEntity.getBillId();
SendBackBill bill = sendBackBillEntityDao.findById(billId).get(); SendBackBill bill = sendBackBillEntityDao.findById(billId).get();
bill.setIsComplete(1); bill.setIsComplete(1);
sendBackBillEntityDao.save(bill); // sendBackBillEntityDao.save(bill);
saveSendBackBill(bill);
List<Integer> idList = stringToList(bill.getInvoleDevice()); List<Integer> idList = stringToList(bill.getInvoleDevice());
List<DeviceLibrary> deviceList = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList); List<DeviceLibrary> deviceList = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList);
for (DeviceLibrary d:deviceList) { for (DeviceLibrary d:deviceList) {
...@@ -658,7 +669,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -658,7 +669,8 @@ public class SendBackServiceImpl implements SendBackService {
}else { }else {
sendBackVo.setStatus(0); sendBackVo.setStatus(0);
fatherBill.setSendBackStatistical(JSON.toJSONString(sendBackVo)); fatherBill.setSendBackStatistical(JSON.toJSONString(sendBackVo));
sendBackBillEntityDao.save(fatherBill); // sendBackBillEntityDao.save(fatherBill);
saveSendBackBill(fatherBill);
taskService.moveToSpecial(fatherTaskBto,StatusEnum.SEND_BACK_1201,fatherTaskBto.getCreateUserId()); taskService.moveToSpecial(fatherTaskBto,StatusEnum.SEND_BACK_1201,fatherTaskBto.getCreateUserId());
} }
} }
...@@ -816,8 +828,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -816,8 +828,8 @@ public class SendBackServiceImpl implements SendBackService {
form.setSendedCount(sendBackOut.getShouldOut()); form.setSendedCount(sendBackOut.getShouldOut());
form.setReceiveUserBId(sendBackOut.getReviewerNameId()); form.setReceiveUserBId(sendBackOut.getReviewerNameId());
form.setReceiveUserBName(sendBackOut.getReviewerName()); form.setReceiveUserBName(sendBackOut.getReviewerName());
sendBackBillDetailEntityDao.save(form); // sendBackBillDetailEntityDao.save(form);
saveSendBackBillDetail(form);
Units unit = unitsDao.findById(taskEntity.getOwnUnit()).get(); Units unit = unitsDao.findById(taskEntity.getOwnUnit()).get();
...@@ -829,7 +841,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -829,7 +841,8 @@ public class SendBackServiceImpl implements SendBackService {
修改装备是所属单位 修改装备是所属单位
*/ */
bill.setIsComplete(1); bill.setIsComplete(1);
sendBackBillEntityDao.save(bill); // sendBackBillEntityDao.save(bill);
saveSendBackBill(bill);
List<Integer> idList = stringToList(bill.getInvoleDevice()); List<Integer> idList = stringToList(bill.getInvoleDevice());
List<DeviceLibrary> deviceList = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList); List<DeviceLibrary> deviceList = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList);
for (DeviceLibrary d:deviceList) { for (DeviceLibrary d:deviceList) {
...@@ -949,7 +962,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -949,7 +962,8 @@ public class SendBackServiceImpl implements SendBackService {
sendBackBillEntity.setDeadLine(deadLine); sendBackBillEntity.setDeadLine(deadLine);
sendBackBillEntity.setReviewUserId(startUserId); sendBackBillEntity.setReviewUserId(startUserId);
sendBackBillEntity.setTitle("清退账单"); sendBackBillEntity.setTitle("清退账单");
SendBackBill billEntity = sendBackBillEntityDao.save(sendBackBillEntity); // SendBackBill billEntity = sendBackBillEntityDao.save(sendBackBillEntity);
SendBackBill billEntity = saveSendBackBill(sendBackBillEntity);
//生成省级及以下的Task //生成省级及以下的Task
List<Integer> integers=new ArrayList<>(); List<Integer> integers=new ArrayList<>();
integers= userDao.findAllByUnitsId(unitId).stream().map(User::getUserId).collect(Collectors.toList()); integers= userDao.findAllByUnitsId(unitId).stream().map(User::getUserId).collect(Collectors.toList());
...@@ -979,8 +993,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -979,8 +993,8 @@ public class SendBackServiceImpl implements SendBackService {
sendBackBillEntity.setReviewUserId(startUserId); sendBackBillEntity.setReviewUserId(startUserId);
sendBackBillEntity.setTitle("清退账单"); sendBackBillEntity.setTitle("清退账单");
SendBackBill billEntity = sendBackBillEntityDao.save(sendBackBillEntity); // SendBackBill billEntity = sendBackBillEntityDao.save(sendBackBillEntity);
SendBackBill billEntity = saveSendBackBill(sendBackBillEntity);
/* /*
生成省级及以下的Task 生成省级及以下的Task
*/ */
...@@ -1019,7 +1033,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -1019,7 +1033,8 @@ public class SendBackServiceImpl implements SendBackService {
sendBackBillEntity.setDeadLine(deadLine); sendBackBillEntity.setDeadLine(deadLine);
sendBackBillEntity.setTitle("异常装备处理"); sendBackBillEntity.setTitle("异常装备处理");
SendBackBill billEntity = sendBackBillEntityDao.save(sendBackBillEntity); // SendBackBill billEntity = sendBackBillEntityDao.save(sendBackBillEntity);
SendBackBill billEntity = saveSendBackBill(sendBackBillEntity);
/* /*
生成省级及以下的Task 生成省级及以下的Task
...@@ -1054,7 +1069,9 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -1054,7 +1069,9 @@ public class SendBackServiceImpl implements SendBackService {
sendBackBillEntity.setDeadLine(deadLine); sendBackBillEntity.setDeadLine(deadLine);
sendBackBillEntity.setReviewUserId(startUserId); sendBackBillEntity.setReviewUserId(startUserId);
sendBackBillEntity.setTitle("清退账单"); sendBackBillEntity.setTitle("清退账单");
SendBackBill billEntity = sendBackBillEntityDao.save(sendBackBillEntity); // SendBackBill billEntity = sendBackBillEntityDao.save(sendBackBillEntity);
SendBackBill billEntity = saveSendBackBill(sendBackBillEntity);
/* /*
生成省级及以下的Task 生成省级及以下的Task
*/ */
...@@ -1654,4 +1671,28 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -1654,4 +1671,28 @@ public class SendBackServiceImpl implements SendBackService {
return areaToTaskId; return areaToTaskId;
} }
private SendBackBill saveSendBackBill(SendBackBill sendBackBill){
SendBackBill sendBackBill1 = sendBackBillEntityDao.save(sendBackBill);
if (sendBackBill1.getRecordId()==null || sendBackBill1.getRecordId().equals("")){
BcText bcText=blockChainUtil.sendText(1000,JacksonUtil.toJSon(sendBackBill1));
sendBackBill1.setRecordId(bcText.getData().getRecordID());
return sendBackBillEntityDao.save(sendBackBill1);
}else {
blockChainUtil.appendText(JacksonUtil.toJSon(sendBackBill1),sendBackBill1.getRecordId());
return sendBackBill1;
}
}
private SendBackBillDetail saveSendBackBillDetail(SendBackBillDetail sendBackBillDetail){
SendBackBillDetail sendBackBillDetail1 = sendBackBillDetailEntityDao.save(sendBackBillDetail);
if (sendBackBillDetail1.getRecordId()==null || sendBackBillDetail1.getRecordId().equals("")){
BcText bcText=blockChainUtil.sendText(1000,JacksonUtil.toJSon(sendBackBillDetail1));
sendBackBillDetail1.setRecordId(bcText.getData().getRecordID());
return sendBackBillDetailEntityDao.save(sendBackBillDetail1);
}else {
blockChainUtil.appendText(JacksonUtil.toJSon(sendBackBillDetail1),sendBackBillDetail1.getRecordId());
return sendBackBillDetail1;
}
}
} }
package com.tykj.dev.device.train.controller; package com.tykj.dev.device.train.controller;
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.config.swagger.AutoDocument;
import com.tykj.dev.device.task.service.TaskLogService; import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
...@@ -74,6 +76,9 @@ public class TrainJobController { ...@@ -74,6 +76,9 @@ public class TrainJobController {
@Autowired @Autowired
UserLogService userLogService; UserLogService userLogService;
@Autowired
BlockChainUtil blockChainUtil;
// 发起培训给选中人员都发一个代办任务报名,此任务在发起人跟踪里 // 发起培训给选中人员都发一个代办任务报名,此任务在发起人跟踪里
...@@ -107,7 +112,8 @@ public class TrainJobController { ...@@ -107,7 +112,8 @@ public class TrainJobController {
trainUser.setIsSignUp(2); trainUser.setIsSignUp(2);
trainUser.setIsNotJoinUserId(1); trainUser.setIsNotJoinUserId(1);
trainUser.setTrainId(trainTheme.getTrainId()); trainUser.setTrainId(trainTheme.getTrainId());
trainUserDao.save(trainUser); // trainUserDao.save(trainUser);
saveTrainUser(trainUser);
} }
); );
...@@ -117,7 +123,8 @@ public class TrainJobController { ...@@ -117,7 +123,8 @@ public class TrainJobController {
trainUser.setIsSignUp(2); trainUser.setIsSignUp(2);
trainUser.setIsNotJoinUserId(0); trainUser.setIsNotJoinUserId(0);
trainUser.setTrainId(trainTheme.getTrainId()); trainUser.setTrainId(trainTheme.getTrainId());
trainUserDao.save(trainUser); // trainUserDao.save(trainUser);
saveTrainUser(trainUser);
} }
); );
...@@ -175,7 +182,7 @@ public class TrainJobController { ...@@ -175,7 +182,7 @@ public class TrainJobController {
} }
trainUser.setUnitsName(unitsDao.findById(trainUser.getUnitsId()).get().getName()); trainUser.setUnitsName(unitsDao.findById(trainUser.getUnitsId()).get().getName());
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResponseEntity.ok(trainUserDao.save(trainUser)); return ResponseEntity.ok(saveTrainUser(trainUser));
} }
/** /**
...@@ -194,7 +201,8 @@ public class TrainJobController { ...@@ -194,7 +201,8 @@ public class TrainJobController {
List<Integer> ids= taskBto.getInvolveUserIdList(); List<Integer> ids= taskBto.getInvolveUserIdList();
TrainUser trainUser= trainUserDao.findByUserIdAndTrainId(ids.get(ids.size()-1),trainTheme.getTrainId()); TrainUser trainUser= trainUserDao.findByUserIdAndTrainId(ids.get(ids.size()-1),trainTheme.getTrainId());
trainUser.setIsSignUp(1); trainUser.setIsSignUp(1);
trainUserDao.save(trainUser); // trainUserDao.save(trainUser);
saveTrainUser(trainUser);
userLogService.save(new UserLog(trainUser.getUserId(),new Date(),"报名参加培训")); userLogService.save(new UserLog(trainUser.getUserId(),new Date(),"报名参加培训"));
} }
); );
...@@ -249,7 +257,8 @@ public class TrainJobController { ...@@ -249,7 +257,8 @@ public class TrainJobController {
trainUser.setScore(gradeEntry.getScore()); trainUser.setScore(gradeEntry.getScore());
trainUser.setEvaluation(gradeEntry.getEvaluation()); trainUser.setEvaluation(gradeEntry.getEvaluation());
trainUser.setCertificate(gradeEntry.getCertificate()); trainUser.setCertificate(gradeEntry.getCertificate());
trainUserDao.save(trainUser); // trainUserDao.save(trainUser);
saveTrainUser(trainUser);
} }
); );
trainTheme.setTrainStatus(StatusEnum.TRAIN1005.id); trainTheme.setTrainStatus(StatusEnum.TRAIN1005.id);
...@@ -281,7 +290,8 @@ public class TrainJobController { ...@@ -281,7 +290,8 @@ public class TrainJobController {
trainUser.setScore(gradeEntry.getScore()); trainUser.setScore(gradeEntry.getScore());
trainUser.setEvaluation(gradeEntry.getEvaluation()); trainUser.setEvaluation(gradeEntry.getEvaluation());
trainUser.setCertificate(gradeEntry.getCertificate()); trainUser.setCertificate(gradeEntry.getCertificate());
trainUserDao.save(trainUser); // trainUserDao.save(trainUser);
saveTrainUser(trainUser);
} }
); );
trainTheme.setTrainStatus(StatusEnum.TRAIN1006.id); trainTheme.setTrainStatus(StatusEnum.TRAIN1006.id);
...@@ -310,7 +320,8 @@ public class TrainJobController { ...@@ -310,7 +320,8 @@ public class TrainJobController {
trainUser.setScore(gradeEntry.getScore()); trainUser.setScore(gradeEntry.getScore());
trainUser.setEvaluation(gradeEntry.getEvaluation()); trainUser.setEvaluation(gradeEntry.getEvaluation());
trainUser.setCertificate(gradeEntry.getCertificate()); trainUser.setCertificate(gradeEntry.getCertificate());
trainUserDao.save(trainUser); // trainUserDao.save(trainUser);
saveTrainUser(trainUser);
} }
); );
trainTheme.setTrainStatus(StatusEnum.TRAIN1007.id); trainTheme.setTrainStatus(StatusEnum.TRAIN1007.id);
...@@ -360,7 +371,8 @@ public class TrainJobController { ...@@ -360,7 +371,8 @@ public class TrainJobController {
trainUser.setAttendance(gradeEntry.getAttendance()); trainUser.setAttendance(gradeEntry.getAttendance());
trainUser.setScore(gradeEntry.getScore()); trainUser.setScore(gradeEntry.getScore());
trainUser.setEvaluation(gradeEntry.getEvaluation()); trainUser.setEvaluation(gradeEntry.getEvaluation());
trainUserDao.save(trainUser); // trainUserDao.save(trainUser);
saveTrainUser(trainUser);
} }
); );
trainThemeService.save(trainTheme); trainThemeService.save(trainTheme);
...@@ -442,4 +454,16 @@ public class TrainJobController { ...@@ -442,4 +454,16 @@ public class TrainJobController {
return mapper.map(user,TrainUser.class); return mapper.map(user,TrainUser.class);
} }
private TrainUser saveTrainUser(TrainUser trainUser){
TrainUser trainUser1 = trainUserDao.save(trainUser);
if (trainUser1.getRecordId()==null || trainUser1.getRecordId().equals("")){
BcText bcText=blockChainUtil.sendText(1000,JacksonUtil.toJSon(trainUser1));
trainUser1.setRecordId(bcText.getData().getRecordID());
return trainUserDao.save(trainUser1);
}else {
blockChainUtil.appendText(JacksonUtil.toJSon(trainUser1),trainUser1.getRecordId());
return trainUser1;
}
}
} }
...@@ -176,6 +176,8 @@ public class TrainTheme { ...@@ -176,6 +176,8 @@ public class TrainTheme {
@ApiModelProperty(value = "培训试卷名称", name = "trainPapersName") @ApiModelProperty(value = "培训试卷名称", name = "trainPapersName")
private String trainPapersName; private String trainPapersName;
@ApiModelProperty(value = "区块链RID",name = "recordId")
private String recordId;
public ByTrainingPeople toByTrainingPeople() { public ByTrainingPeople toByTrainingPeople() {
ModelMapper mapper = BeanHelper.getUserMapper(); ModelMapper mapper = BeanHelper.getUserMapper();
......
...@@ -128,6 +128,9 @@ public class TrainUser { ...@@ -128,6 +128,9 @@ public class TrainUser {
@ApiModelProperty(value = "是否必须报名 1.必须 2.不必须", name = "certificate") @ApiModelProperty(value = "是否必须报名 1.必须 2.不必须", name = "certificate")
private Integer isNotJoinUserId; private Integer isNotJoinUserId;
@ApiModelProperty(value = "区块链RID",name = "recordId")
private String recordId;
@Transient @Transient
private Mgrcert mgrcert; private Mgrcert mgrcert;
......
...@@ -81,6 +81,9 @@ public class WorkHandover { ...@@ -81,6 +81,9 @@ public class WorkHandover {
@LastModifiedDate @LastModifiedDate
private Integer updateTime; private Integer updateTime;
@ApiModelProperty(value = "区块链RID",name = "recordId")
private String recordId;
public WorkHandoverVo toWorkHandover() { public WorkHandoverVo toWorkHandover() {
ModelMapper mapper = BeanHelper.getUserMapper(); ModelMapper mapper = BeanHelper.getUserMapper();
WorkHandoverVo workHandoverVo = mapper.map(this, WorkHandoverVo.class); WorkHandoverVo workHandoverVo = mapper.map(this, WorkHandoverVo.class);
......
...@@ -3,6 +3,8 @@ package com.tykj.dev.device.train.service.impl; ...@@ -3,6 +3,8 @@ package com.tykj.dev.device.train.service.impl;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.github.wenhao.jpa.PredicateBuilder; import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications; import com.github.wenhao.jpa.Specifications;
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.task.subject.bto.TaskBto;
import com.tykj.dev.device.train.dao.TrainThemeDao; import com.tykj.dev.device.train.dao.TrainThemeDao;
import com.tykj.dev.device.train.dao.TrainUserDao; import com.tykj.dev.device.train.dao.TrainUserDao;
...@@ -57,10 +59,20 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -57,10 +59,20 @@ public class TrainThemeServiceImpl implements TrainThemeService {
@Autowired @Autowired
TrainUserDao trainUserDao; TrainUserDao trainUserDao;
@Autowired
BlockChainUtil blockChainUtil;
@Override @Override
public TrainTheme save(TrainTheme trainTheme) { public TrainTheme save(TrainTheme trainTheme) {
return trainThemeDao.save(trainTheme); TrainTheme trainTheme1 = trainThemeDao.save(trainTheme);
if (trainTheme1.getRecordId()==null || trainTheme1.getRecordId().equals("")){
BcText bcText=blockChainUtil.sendText(1000,JacksonUtil.toJSon(trainTheme1));
trainTheme1.setRecordId(bcText.getData().getRecordID());
return trainThemeDao.save(trainTheme1);
}else {
blockChainUtil.appendText(JacksonUtil.toJSon(trainTheme1),trainTheme1.getRecordId());
return trainTheme1;
}
} }
@Override @Override
......
...@@ -108,7 +108,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -108,7 +108,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.cors() .cors()
.and() .and()
.authorizeRequests() .authorizeRequests()
.antMatchers( "/** ").permitAll()
.antMatchers(HttpMethod.OPTIONS, "/** ").permitAll() .antMatchers(HttpMethod.OPTIONS, "/** ").permitAll()
// .withObjectPostProcessor(new ObjectPostProcessor<FilterSecurityInterceptor>() { // .withObjectPostProcessor(new ObjectPostProcessor<FilterSecurityInterceptor>() {
// @Override // @Override
...@@ -118,7 +118,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -118,7 +118,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// return o; // return o;
// } // }
// }) // })
.anyRequest().authenticated() // .anyRequest().authenticated()
.and() .and()
.formLogin() .formLogin()
.loginProcessingUrl("/userLogin") .loginProcessingUrl("/userLogin")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论