diff --git a/lib/access_token1.1.jar b/lib/access_token1.1.jar
new file mode 100644
index 0000000..ca28bb3
Binary files /dev/null and b/lib/access_token1.1.jar differ
diff --git a/pom.xml b/pom.xml
index 80857ba..31f7e66 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,13 @@
uboot-core
0.0.1-SNAPSHOT
-
+
+
+ com.chinaunicom.mall.ebtp
+ uboot-common
+ 0.0.19-SNAPSHOT
+
+
com.chinaunicom.ebtp
mall-ebtp-cloud-attachment-sdk
@@ -94,6 +100,15 @@
${basedir}/lib/aspose-words-16.8.0-jdk16.jar
+
+
+ cryp.access
+ accessToken
+ 1.0
+ system
+ ${basedir}/lib/access_token1.1.jar
+
+
org.apache.velocity
velocity-tools
diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/controller/BlockChainLogController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/controller/BlockChainLogController.java
new file mode 100644
index 0000000..815bc73
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/controller/BlockChainLogController.java
@@ -0,0 +1,58 @@
+package com.chinaunicom.mall.ebtp.extend.blockchain.controller;
+
+
+import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
+import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
+import com.chinaunicom.mall.ebtp.extend.blockchain.entity.BlockChainLog;
+import com.chinaunicom.mall.ebtp.extend.blockchain.service.IBlockChainLogService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+
+@RestController
+@Api(tags = "供应链+区块链接口调用日志")
+@RequestMapping("/v1/blockchainlog")
+public class BlockChainLogController {
+
+ @Resource
+ private IBlockChainLogService iBlockChainLogService;
+
+ /**
+ * 插入新数据
+ *
+ * @param blockChainLog
+ *
+ * @return
+ */
+ @ApiOperation("插入新数据")
+ @PostMapping("")
+ public BaseResponse insert(@ApiParam(value = "对象数据", required = true) @RequestBody @Valid BlockChainLog blockChainLog){
+ blockChainLog.setId(PropertyUtils.getSnowflakeId());
+ boolean save = iBlockChainLogService.save(blockChainLog);
+ return BaseResponse.success(save);
+ }
+
+
+
+ /**
+ * 查询数据
+ *
+ * @param id
+ *
+ * @return
+ */
+ @ApiOperation("查询数据")
+ @GetMapping("/{id}")
+ public BaseResponse get(@ApiParam(value = "主键id", required = true) @PathVariable String id){
+
+ BlockChainLog blockChainLog = iBlockChainLogService.getById(id);
+
+ return BaseResponse.success(blockChainLog);
+ }
+
+
+}
diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/dao/BlockChainLogMapper.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/dao/BlockChainLogMapper.java
new file mode 100644
index 0000000..22c42f1
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/dao/BlockChainLogMapper.java
@@ -0,0 +1,13 @@
+package com.chinaunicom.mall.ebtp.extend.blockchain.dao;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.chinaunicom.mall.ebtp.extend.blockchain.entity.BlockChainLog;
+
+/**
+* @auto.generated
+ */
+public interface BlockChainLogMapper extends BaseMapper {
+
+
+}
diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/dao/mapper/BlockChainLogMapper.xml b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/dao/mapper/BlockChainLogMapper.xml
new file mode 100644
index 0000000..6b0433a
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/dao/mapper/BlockChainLogMapper.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ update supply_block_chain_log
+ set
+ delete_flag="deleted"
+ where ID=#{id,jdbcType=BIGINT}
+
+
\ No newline at end of file
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
new file mode 100644
index 0000000..c099bbd
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/entity/BlockChainLog.java
@@ -0,0 +1,93 @@
+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
+ *
+ * @auto.generated
+ */
+@Data
+@Accessors(chain = true)
+@ApiModel
+@EqualsAndHashCode(callSuper = false)
+@TableName(value = "block_chain_log", autoResultMap = true)
+public class BlockChainLog implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String id;
+
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String tpId;
+
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String sectionId;
+
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String assessRoomId;
+
+ /**
+ *
+ */
+ @ApiModelProperty(value = "")
+ private String turnId;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "调用接口的地址")
+ private String interfaceUrl;
+
+ /**
+ * 传参
+ */
+ @ApiModelProperty(value = "传参")
+ private String param;
+
+ /**
+ * 返回的结果或异常
+ */
+ @ApiModelProperty(value = "返回的结果或异常")
+ private String result;
+
+ /**
+ * 0-成功 1-失败
+ */
+ @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/blockchain/service/IBlockChainLogService.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/service/IBlockChainLogService.java
new file mode 100644
index 0000000..286128f
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/service/IBlockChainLogService.java
@@ -0,0 +1,16 @@
+package com.chinaunicom.mall.ebtp.extend.blockchain.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.chinaunicom.mall.ebtp.extend.blockchain.entity.BlockChainLog;
+
+/**
+ * 对数据表 supply_block_chain_log 操作的 service
+ * @author Auto create
+ *
+ */
+public interface IBlockChainLogService extends IService {
+
+
+
+}
diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/service/impl/BlockChainLogServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/service/impl/BlockChainLogServiceImpl.java
new file mode 100644
index 0000000..d990d97
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/service/impl/BlockChainLogServiceImpl.java
@@ -0,0 +1,17 @@
+package com.chinaunicom.mall.ebtp.extend.blockchain.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.chinaunicom.mall.ebtp.extend.blockchain.dao.BlockChainLogMapper;
+import com.chinaunicom.mall.ebtp.extend.blockchain.entity.BlockChainLog;
+import com.chinaunicom.mall.ebtp.extend.blockchain.service.IBlockChainLogService;
+import org.springframework.stereotype.Service;
+/**
+ * 对数据表 supply_block_chain_log 操作的 serviceImpl
+ * blockchain
+ *
+ */
+@Service
+public class BlockChainLogServiceImpl extends ServiceImpl implements IBlockChainLogService {
+
+
+}
diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/controller/CrypConfigureController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/controller/CrypConfigureController.java
new file mode 100644
index 0000000..35e5449
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/controller/CrypConfigureController.java
@@ -0,0 +1,161 @@
+package com.chinaunicom.mall.ebtp.extend.crypconfigure.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.chinaunicom.baas.util.AccessToken;
+import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
+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 org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import javax.annotation.Resource;
+import javax.validation.Valid;
+import java.util.List;
+
+@RestController
+@Api(value = "区块链参数配置表")
+@RequestMapping("/v1/crypconfigure")
+public class CrypConfigureController{
+
+ @Resource
+ private ICrypConfigureService iCrypConfigureService;
+
+// /**
+// * 插入新数据
+// *
+// * @param crypConfigure
+// *
+// * @return
+// */
+// @ApiOperation("插入新数据")
+// @PostMapping
+// public BaseResponse insert(@ApiParam(value = "对象数据", required = true) @RequestBody @Valid CrypConfigure crypConfigure){
+//
+// int i = iCrypConfigureService.insert(crypConfigure);
+//
+// return BaseResponse.success(i);
+// }
+//
+// /**
+// * 修改数据
+// *
+// * @param crypConfigure
+// *
+// * @return
+// */
+// @ApiOperation("修改数据")
+// @PutMapping
+// public BaseResponse update(@ApiParam(value = "对象数据", required = true) @RequestBody CrypConfigure crypConfigure){
+//
+// Boolean i = iCrypConfigureService.updateCrypConfigureById(crypConfigure);
+//
+// return BaseResponse.success(i);
+// }
+//
+// /**
+// * 查询数据
+// *
+// * @param id
+// *
+// * @return
+// */
+// @ApiOperation("根据id查询数据")
+// @GetMapping("/{id}")
+// public BaseResponse get(@ApiParam(value = "主键id", required = true) @PathVariable String id){
+//
+// CrypConfigure crypConfigure = iCrypConfigureService.getById(id);
+//
+// return BaseResponse.success(crypConfigure);
+// }
+//
+// /**
+// * 删除数据
+// * @param id 主键id
+// * @return BaseResponse
+// * @author dino
+// * @date 2020/10/21 14:56
+// */
+// @ApiOperation(value = "delete",notes = "删除数据")
+// @DeleteMapping("/{id}")
+// public BaseResponse delete(@ApiParam(value = "主键id", required = true) @PathVariable Long id) {
+// int i = iCrypConfigureService.deleteById(id);
+// return BaseResponse.success(i);
+// }
+
+ /**
+ * 查询数据
+ *
+ * @param param
+ * @return
+ */
+ @ApiOperation("查询列表数据")
+ @GetMapping("/list")
+ public BaseResponse> list(@ApiParam(value = "查询对象数据", required = false) CrypConfigure param) {
+ //查询
+ LambdaQueryWrapper query = Wrappers.lambdaQuery(param);
+ List list = iCrypConfigureService.list(query);
+ //异常处理
+ //RespsExceptionEnum.FRAME_EXCEPTION_DEMO_NOT_FIND.customValid(list.isEmpty());
+ return BaseResponse.success(list);
+ }
+
+ /**
+ * 调用天擎接口
+ *
+ * @param bean
+ * @return
+ */
+ @ApiOperation("调用天擎接口")
+ @PostMapping("/callUniInterface")
+ public BaseResponse callUniInterface(@RequestBody CrypBean bean) {
+
+ return BaseResponse.success(this.iCrypConfigureService.callUniInterface(bean));
+ }
+
+ /**
+ * 区块链数据加密
+ *
+ * @param object
+ * @return
+ */
+ @ApiOperation("区块链数据加密")
+ @PostMapping("/signObject")
+ public BaseResponse signObject(@RequestBody Object object) {
+
+ return BaseResponse.success(this.iCrypConfigureService.signObject(object));
+ }
+
+ /**
+ * 区块链数据解密
+ *
+ * @param bean
+ * @return
+ */
+ @ApiOperation("区块链数据解密")
+ @PostMapping("/verifyObject")
+ public BaseResponse verifyObject(@RequestBody CrypBean bean) {
+
+ return BaseResponse.success(this.iCrypConfigureService.verifyObject(bean));
+ }
+
+ /**
+ * accessToken获取
+ *
+ * @param
+ * @return
+ */
+ @ApiOperation("accessToken获取")
+ @GetMapping("/getAccessToken")
+ public BaseResponse getAccessToken() {
+
+ return BaseResponse.success( AccessToken.tokenCreate("bidding"));
+ }
+}
diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/dao/CrypConfigureMapper.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/dao/CrypConfigureMapper.java
new file mode 100644
index 0000000..16f76f1
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/dao/CrypConfigureMapper.java
@@ -0,0 +1,10 @@
+package com.chinaunicom.mall.ebtp.extend.crypconfigure.dao;
+
+
+import com.chinaunicom.mall.ebtp.common.base.dao.IBaseMapper;
+import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypConfigure;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface CrypConfigureMapper extends IBaseMapper {
+}
diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/dao/mapper/CrypConfigureMapper.xml b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/dao/mapper/CrypConfigureMapper.xml
new file mode 100644
index 0000000..605fa81
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/dao/mapper/CrypConfigureMapper.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ update biz_bid_cryp_configure
+ set
+ delete_flag="1"
+ where ID=#{id }
+
+
\ No newline at end of file
diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/entity/CrypBean.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/entity/CrypBean.java
new file mode 100644
index 0000000..10a6833
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/entity/CrypBean.java
@@ -0,0 +1,35 @@
+package com.chinaunicom.mall.ebtp.extend.crypconfigure.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* 实体类 CrypConfigure-区块链参数配置表
+*
+* @author yss
+*/
+@Data
+public class CrypBean {
+ /**
+ * 能力req名称
+ * BIDDING_PUBLISH_REQ 发标
+ */
+ @ApiModelProperty(value = "能力req名称")
+ public String reqName;
+ /**
+ * 签名
+ */
+ @ApiModelProperty(value = "签名")
+ public String sign;
+ /**
+ * 待签名参数 Map
+ */
+ @ApiModelProperty(value = "待签名参数")
+ public Object object;
+ /**
+ * 天擎接口地址
+ */
+ @ApiModelProperty(value = "天擎接口地址")
+ public String url;
+
+}
diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/entity/CrypConfigure.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/entity/CrypConfigure.java
new file mode 100644
index 0000000..bcb83cc
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/entity/CrypConfigure.java
@@ -0,0 +1,73 @@
+package com.chinaunicom.mall.ebtp.extend.crypconfigure.entity;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.chinaunicom.mall.ebtp.common.base.entity.BaseEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+* 实体类 CrypConfigure-区块链参数配置表
+*
+* @author yss
+*/
+@Data
+@Accessors(chain = true)
+@TableName(value = "biz_bid_cryp_configure", autoResultMap = true)
+@ApiModel(value = "CrypConfigure对象", description = "区块链参数配置表")
+public class CrypConfigure extends BaseEntity implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId
+ @ApiModelProperty(value = "主键ID")
+ private String id;
+
+ @ApiModelProperty(value = "配置标识")
+ private String cCode;
+
+ @ApiModelProperty(value = "配置说明")
+ private String cShow;
+
+ @ApiModelProperty(value = "配置类型 1-区块链")
+ private Integer type;
+
+ @ApiModelProperty(value = "值")
+ private String cValue;
+
+ @ApiModelProperty(value = "备注")
+ private String remarks;
+
+ @ApiModelProperty(value = "状态 0-失效 1-生效")
+ private Integer state;
+
+
+
+
+
+ @ApiModelProperty(value = "租户ID")
+ private String tenantId;
+
+ @ApiModelProperty(value = "租户名称")
+ private String tenantName;
+
+ @ApiModelProperty(value = "删除标识")
+ private String deleteFlag;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+ @ApiModelProperty(value = "删除标识")
+ private LocalDateTime lastUpdateTime;
+
+ @ApiModelProperty(value = "割接状态;0-割接数据,1-新数据")
+ private Integer cutoverStatus;
+
+
+}
diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/service/ICrypConfigureService.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/service/ICrypConfigureService.java
new file mode 100644
index 0000000..865ffe8
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/service/ICrypConfigureService.java
@@ -0,0 +1,34 @@
+package com.chinaunicom.mall.ebtp.extend.crypconfigure.service;
+
+
+import com.chinaunicom.mall.ebtp.common.base.service.IBaseService;
+import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypBean;
+import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypConfigure;
+
+/**
+ * 对数据表 biz_bid_cryp_configure 操作的 service
+ * @author yss
+ *
+ */
+public interface ICrypConfigureService extends IBaseService {
+ /**
+ * 调用天擎接口
+ * @param bean
+ * @return
+ */
+ Boolean callUniInterface(CrypBean bean);
+
+ /**
+ * 加密
+ * @param object
+ * @return
+ */
+ CrypBean signObject(Object object);
+
+ /**
+ * 解密
+ * @param bean
+ * @return
+ */
+ Boolean verifyObject(CrypBean bean);
+}
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
new file mode 100644
index 0000000..55ee5ae
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/service/impl/CrypConfigureServiceImpl.java
@@ -0,0 +1,269 @@
+package com.chinaunicom.mall.ebtp.extend.crypconfigure.service.impl;
+
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+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.constant.CommonConstants;
+import com.chinaunicom.mall.ebtp.common.crypto.service.CrypServiceImpl;
+import com.chinaunicom.mall.ebtp.common.crypto.tenderfee.test;
+import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum;
+import com.chinaunicom.mall.ebtp.common.uniBss.constant.UniBssConstant;
+import com.chinaunicom.mall.ebtp.common.uniBss.entity.*;
+import com.chinaunicom.mall.ebtp.common.uniBss.service.UniBssServiceImpl;
+import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
+import com.chinaunicom.mall.ebtp.extend.blockchain.entity.BlockChainLog;
+import com.chinaunicom.mall.ebtp.extend.blockchain.service.IBlockChainLogService;
+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;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.stereotype.Service;
+
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+import static com.chinaunicom.mall.ebtp.common.uniBss.service.UniBssServiceImpl.MD5min;
+
+/**
+ * 对数据表 biz_bid_cryp_configure 操作的 serviceImpl
+ * @author yss
+ *
+ */
+@Slf4j
+@Service
+public class CrypConfigureServiceImpl extends BaseServiceImpl implements ICrypConfigureService {
+
+ @Autowired
+ private IBlockChainLogService iBlockChainLogService;
+
+ private @Autowired
+ IBaseCacheUserService service;
+
+ // 私钥文件路径 - 加密
+ private static String PEM_PATH = "admin_certPrivateNew.pem";
+
+ // 证书文件路径 - 解密
+ private static String CRT_PATH = "adminNew.crt";
+
+ @Value("${mconfig.bss.app-id}")
+ private String app_id;
+ @Value("${mconfig.bss.app-secret}")
+ private String app_secret;
+
+ /**
+ * 调用天擎接口
+ * @param bean
+ * @return
+ */
+ @Override
+ public Boolean callUniInterface(CrypBean bean){
+ BlockChainLog blockChainLog = new BlockChainLog();
+ blockChainLog.setId(PropertyUtils.getSnowflakeId());
+ //天擎地址
+ blockChainLog.setInterfaceUrl(bean.getUrl());
+
+ try {
+ LinkedHashMap map = JSONArray.parseObject(JSONArray.toJSONString(bean.getObject()), LinkedHashMap.class);
+ Object signObject = new Object();
+
+ if(map.get("BODY_LIST")!=null){
+ signObject = map.get("BODY_LIST");
+ }else{
+ signObject =map;
+ }
+ //传入数据解密
+ String sign = getSignValue(signObject);
+
+ map.put("SIGN", sign);
+
+ String json = getUniBss(bean.getReqName(),map);
+
+ blockChainLog.setParam(json);//请求参数
+ String 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())) {
+ System.out.println("返回接口:"+uniBssRsp);
+
+ if(str!=null&&!"".equals(str)&&str.indexOf("_RSP\":{\"Code\":200,")>=0){
+ blockChainLog.setStatus(0);//成功
+ this.iBlockChainLogService.save(blockChainLog);
+ return true;
+ }else{
+ blockChainLog.setStatus(1);//失败
+ }
+ } else {
+ 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){
+ blockChainLog.setStatus(1);
+ blockChainLog.setResult(e.getMessage());
+ }
+
+ this.iBlockChainLogService.save(blockChainLog);
+
+ return false;
+ }
+ /**
+ * 加密
+ * @param object
+ * @return
+ */
+ @Override
+ public CrypBean signObject(Object object){
+ CrypBean bean = new CrypBean();
+ try{
+ bean.setObject(object);
+
+ String signValue = getSignValue(bean.getObject());
+
+ bean.setSign(signValue);
+
+ return bean;
+ }catch (Exception e){
+ log.error("加密异常:"+e);
+ }
+
+ return bean;
+ }
+
+ /**
+ * 获取加密签名
+ * @param object
+ * @return
+ */
+ private String getSignValue(Object object){
+ String signValue = "";
+ try{
+ log.debug("加密参数:"+JSONArray.toJSONString(object));
+ InputStream is = CrypConfigureServiceImpl.class.getClassLoader().getResourceAsStream(PEM_PATH);
+ signValue = CrypServiceImpl.signObject2(object,IOUtils.toString(is));
+ log.debug("加密结果:"+signValue);
+ }catch (Exception e){
+
+ }
+ return signValue;
+ }
+
+ /**
+ * 获取加密签名
+ * @param map
+ * @return
+ */
+ private String getUniBss(String reqName, LinkedHashMap map){
+ //获取token
+ Date date = new Date();
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");
+ SimpleDateFormat format2 = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ String TIMESTAMP = format.format(date);
+ String TRANS_ID = format2.format(date) + (int) ((Math.random() * 9 + 1) * 100000);
+ String s = "APP_ID" + app_id + "TIMESTAMP" + TIMESTAMP + "TRANS_ID" + TRANS_ID + app_secret;
+ String token = MD5min(s);
+ UniBss uniBss = new UniBss();
+ uniBss.setUniBssAttached(new UniBssAttached().setMediaInf(""));
+ //天擎部分head
+ UniBssHead head = new UniBssHead();
+ head.setAppId(app_id);
+ head.setTimeStamp(TIMESTAMP);
+ head.setTransId(TRANS_ID);
+ head.setToken(token);
+ uniBss.setUniBssHead(head);
+
+ UniReqHead reqhead = new UniReqHead();
+
+ reqhead.setSystemId("990001");
+ reqhead.setSystemName("bidding");
+ reqhead.setUserId(service.getCacheUser().getUserId()!=null?service.getCacheUser().getUserId():"dzztb");
+ reqhead.setUserName(service.getCacheUser().getFullName()!=null?service.getCacheUser().getFullName():"dzztb");
+ //测试写死
+ String accessToken = "MQjkzVoYoSHe6r/3uZm0MV/TLx+n8PS9ivfPhgY4bWmh+8DVxj7vTC15xbBkuV8oujD3XBZPP7PhcWag9UU5IzsUBT7PSwPhqi/fUqa+iAWhCWpvyihG/23BAY3rJyaoa3OdMNSnIh8woPDCJQTzCTpNtg0toKwdWnuc2mig7vI0Lm9lePvrx3XxFLSaFr+jB5C3qnAX4uUBioZzithSjtra1QUK6S1cb9DCmpj6NRI=";
+ //String accessToken = AccessToken.tokenCreate("bidding");
+ reqhead.setAccessToken(accessToken);
+
+
+ log.debug("业务参数封装前:"+map);
+ UniCrpyReq req = new UniCrpyReq();
+ req.setBody(map);
+ req.setHead(reqhead);
+ log.debug("业务参数封装中:"+req);;
+ Map reqMap = new HashMap();
+ reqMap.put(reqName,req);
+ uniBss.setUniBssBodyMap(reqMap);
+ log.debug("业务参数封装后:"+reqMap);;
+
+
+ return JSON.toJSONString(uniBss);
+ }
+ /**
+ * 解密
+ * @param bean
+ * @return
+ */
+ @Override
+ public Boolean verifyObject(CrypBean bean){
+
+ try{
+ log.debug("解密参数:"+JSONArray.toJSONString(bean.getObject()));
+ InputStream is = CrypConfigureServiceImpl.class.getClassLoader().getResourceAsStream(CRT_PATH);
+ Boolean b = CrypServiceImpl.verifyValue(bean.getSign(),bean.getObject(),IOUtils.toString(is));
+ return b;
+ }catch (Exception e){
+
+ }
+
+ return false;
+ }
+
+
+ public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, UnsupportedEncodingException {
+// String token = AccessToken.tokenCreate("123");
+// System.out.println(token);
+ // example of HashMap entity, treeMap can also work out,
+ // but LinkedHashMap is NOT supported
+// Map mapb= new HashMap<>();
+//
+ Map map = new HashMap<>(1);
+ map.put("TENDERER_ID","8533");
+ map.put("SHOPPINGCART_ID","L3307");
+ map.put("AMOUNT","1000");
+ map.put("TP_ID","L3307A");
+ map.put("SECTION_ID","1111");
+
+ List list = new ArrayList();
+ list.add(map);
+ //mapb.put("BODY_LIST",list);
+
+ CrypConfigureServiceImpl crypService = new CrypConfigureServiceImpl();
+ CrypBean bean = crypService.signObject(list);
+ System.out.println(bean);
+
+// String pkey = "-----BEGIN PRIVATE KEY-----\n" +
+// "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgfb0OcgWWFJGaOmVI\n" +
+// "LxEpIRTsICs0ssgJZqpuZQUhTIGhRANCAAQ8dPtVEfZfm2wXdqoqYpColaJ4MxiJ\n" +
+// "rFoUUMepAwuIQLaSZIH1+YbUkr/P+ybC1cbiBMrZjCxiAimk7dLxmUkx\n" +
+// "-----END PRIVATE KEY-----";
+ //"MEUCIQC0TNG+JlFa2kCwQOdYer69cA4psgDoK9ulqdKyK5BEwQIgFOlVofB+xDVOCSuj7t2Pp3z0fyyiuXPy5dRMsOMoh3U=";
+// String signature = CrypServiceImpl.signObject2(list,pkey);
+// System.out.println("signature of Map: "+signature);
+// boolean isOk = CrypServiceImpl.verifyObject(signature,list,CRT_PATH);
+// System.out.println("verify result of Map: "+ isOk);
+
+ }
+}
diff --git a/src/main/resources/adminNew.crt b/src/main/resources/adminNew.crt
new file mode 100644
index 0000000..08ff361
--- /dev/null
+++ b/src/main/resources/adminNew.crt
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIICgjCCAimgAwIBAgIUYP62P06sD2LqFyrCW8gDB4EvOmowCgYIKoZIzj0EAwIw
+ZzELMAkGA1UEBhMCQ04xETAPBgNVBAgTCFNoYW5Eb25nMQ4wDAYDVQQHEwVKaU5h
+bjEYMBYGA1UEChMPYWRtaW50MDgxMmFvcmczMRswGQYDVQQDExJjYS5hZG1pbnQw
+ODEyYW9yZzMwHhcNMjEwODMxMDYzMDAwWhcNMjIwODMxMDYzNTAwWjAzMRwwDQYD
+VQQLEwZjbGllbnQwCwYDVQQLEwRvcmczMRMwEQYDVQQDDAphZG1pbkBvcmczMFkw
+EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEPHT7VRH2X5tsF3aqKmKQqJWieDMYiaxa
+FFDHqQMLiEC2kmSB9fmG1JK/z/smwtXG4gTK2YwsYgIppO3S8ZlJMaOB5jCB4zAO
+BgNVHQ8BAf8EBAMCB4AwDAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUxhcLh6TJkZkr
+4aj4/P9YvfuSWGwwKwYDVR0jBCQwIoAg39Z8xQV3+pq1DBYm7uNMvAqFNpkbsvGe
+LZX537X16UEwFAYDVR0RBA0wC4IJSlpaSEpTLTcyMGEGCCoDBAUGBwgBBFV7ImF0
+dHJzIjp7ImhmLkFmZmlsaWF0aW9uIjoib3JnMyIsImhmLkVucm9sbG1lbnRJRCI6
+ImFkbWluQG9yZzMiLCJoZi5UeXBlIjoiY2xpZW50In19MAoGCCqGSM49BAMCA0cA
+MEQCIHqfq7vUlpdZUzV/qOeIvmLpom4qKzVuBmp2Bkl5M0LNAiAl7Y9a6TiCMx9/
+0XMXsg5XS07GeLH9e94vY2y5GN/QZA==
+-----END CERTIFICATE-----
diff --git a/src/main/resources/admin_certPrivateNew.pem b/src/main/resources/admin_certPrivateNew.pem
new file mode 100644
index 0000000..d364d17
--- /dev/null
+++ b/src/main/resources/admin_certPrivateNew.pem
@@ -0,0 +1,5 @@
+-----BEGIN PRIVATE KEY-----
+MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgfb0OcgWWFJGaOmVI
+LxEpIRTsICs0ssgJZqpuZQUhTIGhRANCAAQ8dPtVEfZfm2wXdqoqYpColaJ4MxiJ
+rFoUUMepAwuIQLaSZIH1+YbUkr/P+ybC1cbiBMrZjCxiAimk7dLxmUkx
+-----END PRIVATE KEY-----