修改区块链日志,使用mongdb存储,只记录错误日志

This commit is contained in:
zhangqinbin
2022-04-22 16:23:07 +08:00
parent fe0365cce6
commit 044a876440

View File

@ -10,6 +10,9 @@ import com.chinaunicom.baas.util.AccessToken;
import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService;
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl;
import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum;
import com.chinaunicom.mall.ebtp.common.log.enums.EbtpLogBusinessModule;
import com.chinaunicom.mall.ebtp.common.log.enums.EbtpLogType;
import com.chinaunicom.mall.ebtp.common.log.service.OperationLogService;
import com.chinaunicom.mall.ebtp.common.uniBss.constant.UniBssConstant;
import com.chinaunicom.mall.ebtp.common.uniBss.entity.UniBss;
import com.chinaunicom.mall.ebtp.common.uniBss.entity.UniBssAttached;
@ -53,6 +56,9 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl<CrypConfigureMappe
private @Autowired
IBaseCacheUserService service;
@Autowired
private OperationLogService operationLogService;
// 测试 PEM_PATH = "admin_certPrivateNew.pem" CRT_PATH = "adminNew.crt"
// 生产 PEM_PATH = "bidding_certPrivate.pem" CRT_PATH = "bidding.crt"
// 私钥文件路径 - 加密
@ -97,7 +103,8 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl<CrypConfigureMappe
log.info("解密文件:" + CRT_PATH);
log.info("请求路径:" + bean.getUrl());
blockChainLog.setInterfaceUrl(bean.getUrl());
String json = "";
String str = "";
try {
Map<String, Object> map = JSONArray.parseObject(JSONArray.toJSONString(bean.getObject()), Map.class);
@ -106,10 +113,10 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl<CrypConfigureMappe
map.put("SIGN", sign);
String json = getUniBss(bean.getReqName(), map);
json = getUniBss(bean.getReqName(), map);
blockChainLog.setParam(json);//请求参数
String str = UniBssServiceImpl.uniBssHttpPost(bean.getUrl(), json);
str = UniBssServiceImpl.uniBssHttpPost(bean.getUrl(), json);
blockChainLog.setResult(str);//返回参数
UniBss uniBssRsp = JSONArray.parseObject(str, UniBss.class);
if (uniBssRsp != null && UniBssConstant.RESP_CODE_00000.equals(uniBssRsp.getUniBssHead().getRespCode())) {
@ -132,9 +139,10 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl<CrypConfigureMappe
} catch (Exception e) {
blockChainLog.setStatus(1);
blockChainLog.setResult(e.getMessage());
operationLogService.addOperationLog("区块链同步失败信息,参数{}"+json+"返回信息{}"+str,false, EbtpLogBusinessModule.CRYPT_DECRYPT, EbtpLogType.INSERT);
}
this.iBlockChainLogService.save(blockChainLog);
//this.iBlockChainLogService.save(blockChainLog);
return false;
}