|
@@ -12,6 +12,7 @@ import cn.hutool.crypto.asymmetric.RSA;
|
|
|
import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.dtflys.forest.Forest;
|
|
|
import com.dtflys.forest.http.ForestRequest;
|
|
|
import com.dtflys.forest.logging.LogConfiguration;
|
|
@@ -468,7 +469,7 @@ public class CaServer implements Assertion {
|
|
|
.execute(String.class);
|
|
|
|
|
|
redisData.setUuid(value.getUuid());
|
|
|
- cache.put("ca-emr-" + value.getDocumentId(), redisData);
|
|
|
+ cache.put("ca-emr-" + value.getDocumentId(), JSONUtil.toJsonStr(redisData));
|
|
|
return getStringResultVo(execute, caDocumentId, value.getUuid());
|
|
|
}
|
|
|
|
|
@@ -481,10 +482,12 @@ public class CaServer implements Assertion {
|
|
|
cache.del(redisKey);
|
|
|
redisData.setPdf(EmrServer.getPdfBase(value.getDocumentId()));
|
|
|
} else {
|
|
|
- redisData = (CaSignClass.H5EventSignRedis) cache.get(redisKey);
|
|
|
- if (redisData == null) {
|
|
|
+ String redisStr = cache.get(redisKey);
|
|
|
+ if (redisStr == null) {
|
|
|
throw new BizException(ExceptionEnum.LOGICAL_ERROR, "签名超时请重新签名。");
|
|
|
}
|
|
|
+ redisData = JSONUtil.toBean(redisStr, CaSignClass.H5EventSignRedis.class);
|
|
|
+
|
|
|
if (!redisData.getUuid().equals(value.getUuid())) {
|
|
|
throw new BizException(ExceptionEnum.LOGICAL_ERROR, "有其他人正在签署,本次签名失效。");
|
|
|
}
|
|
@@ -541,11 +544,14 @@ public class CaServer implements Assertion {
|
|
|
}
|
|
|
JSONObject rst = res.getData();
|
|
|
String key = getRedisKey(documentId);
|
|
|
- CaSignClass.H5EventSignRedis redisData = (CaSignClass.H5EventSignRedis) cache.get(key);
|
|
|
- if (redisData == null) {
|
|
|
+ String redisStr = cache.get(key);
|
|
|
+ if (redisStr == null) {
|
|
|
throw new BizException(ExceptionEnum.LOGICAL_ERROR, "签名错误,文书不存在。");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ CaSignClass.H5EventSignRedis redisData = JSONUtil.toBean(redisStr, CaSignClass.H5EventSignRedis.class);
|
|
|
+
|
|
|
if (!redisData.getUuid().equals(uuid)) {
|
|
|
throw new BizException(ExceptionEnum.LOGICAL_ERROR, "有其他人正在签署,本次签名失效。");
|
|
|
}
|
|
@@ -561,7 +567,7 @@ public class CaServer implements Assertion {
|
|
|
redisData.setData(new ArrayList<>());
|
|
|
}
|
|
|
redisData.getData().add(saveData);
|
|
|
- cache.setData(key, redisData);
|
|
|
+ cache.setData(key, JSON.toJSONString(redisData));
|
|
|
return ResultVoUtil.success(true);
|
|
|
}
|
|
|
|
|
@@ -572,7 +578,14 @@ public class CaServer implements Assertion {
|
|
|
public void completeQrCode(String documentId) {
|
|
|
EmrPatientData data = emrPatientDao.selectById(documentId);
|
|
|
String redisKey = getRedisKey(documentId);
|
|
|
- CaSignClass.H5EventSignRedis redisServerData = (CaSignClass.H5EventSignRedis) cache.get(redisKey);
|
|
|
+
|
|
|
+ String redisStr = cache.get(redisKey);
|
|
|
+
|
|
|
+ if (redisStr == null) {
|
|
|
+ throw new BizException(ExceptionEnum.ERROR_MESSAGE, "文件不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ CaSignClass.H5EventSignRedis redisServerData = JSONUtil.toBean(redisStr, CaSignClass.H5EventSignRedis.class);
|
|
|
CaSignClass.Upload upload = CaSignClass.Upload.builder()
|
|
|
.file(redisServerData.getPdf())
|
|
|
.fileName(documentId)
|