From f67f010eebb10d5097fc54146bcf042b6a1d7e82 Mon Sep 17 00:00:00 2001 From: zhangqinbin <181961702@qq.com> Date: Thu, 2 Sep 2021 16:43:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=9D=97=E9=93=BE=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blockchain/entity/BlockChainLog.java | 12 ++++++++ .../impl/CrypConfigureServiceImpl.java | 30 +++++++++++-------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/entity/BlockChainLog.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/entity/BlockChainLog.java index 2da0cae..c099bbd 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/entity/BlockChainLog.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/entity/BlockChainLog.java @@ -1,15 +1,22 @@ package com.chinaunicom.mall.ebtp.extend.blockchain.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; +import com.chinaunicom.mall.ebtp.common.config.CustomLocalDateTimeTypeHandler; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; /** * 实体类 BlockChainLog @@ -77,5 +84,10 @@ public class BlockChainLog implements Serializable { */ @ApiModelProperty(value = "0-成功 1-失败") private Integer status; + @TableField(fill = FieldFill.INSERT,typeHandler = CustomLocalDateTimeTypeHandler.class) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("创建时间") + private LocalDateTime createDate; } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/service/impl/CrypConfigureServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/service/impl/CrypConfigureServiceImpl.java index 4746bf2..4975969 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/service/impl/CrypConfigureServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/service/impl/CrypConfigureServiceImpl.java @@ -22,6 +22,7 @@ import com.chinaunicom.mall.ebtp.extend.crypconfigure.dao.CrypConfigureMapper; import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypBean; import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypConfigure; import com.chinaunicom.mall.ebtp.extend.crypconfigure.service.ICrypConfigureService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -41,6 +42,7 @@ import static com.chinaunicom.mall.ebtp.common.uniBss.service.UniBssServiceImpl. * @author yss * */ +@Slf4j @Service public class CrypConfigureServiceImpl extends BaseServiceImpl implements ICrypConfigureService { @@ -68,10 +70,10 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl map = JSONArray.parseObject(JSONArray.toJSONString(bean.getObject()), LinkedHashMap.class); @@ -89,34 +91,36 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl rspMap = JSONArray.parseObject(JSONArray.toJSONString(rspObject), LinkedHashMap.class); + if(rspMap.get("Code")!=null&&"200".equals(rspMap.get("Code").toString())){ - log.setStatus(0);//成功 - this.iBlockChainLogService.save(log); + log.debug("请求成功:"+rspMap); + blockChainLog.setStatus(0);//成功 + this.iBlockChainLogService.save(blockChainLog); return true; }else{ - log.setStatus(1);//失败 + blockChainLog.setStatus(1);//失败 } } else { - log.setStatus(1);//失败 + blockChainLog.setStatus(1);//失败 CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.assertStringNotNullByKey("天擎接口调用错误," + "RESP_CODE:" + uniBssRsp.getUniBssHead().getRespCode() + "" + "(" + UniBssConstant.getRESP_CODE_Map(uniBssRsp.getUniBssHead().getRespCode()) + ")。" + "RESP_DESC:" + uniBssRsp.getUniBssHead().getRespDesc(), bean); } }catch (Exception e){ - log.setStatus(1); - log.setResult(e.getMessage()); + blockChainLog.setStatus(1); + blockChainLog.setResult(e.getMessage()); } - this.iBlockChainLogService.save(log); + this.iBlockChainLogService.save(blockChainLog); return false; }