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 6862e3b..20480c0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,16 +27,8 @@
com.chinaunicom.ebtp
mall-ebtp-cloud-attachment-sdk
-
-
-
- cn.chinaunicom.sdsi
- mall-xxljob-core
- 0.0.1
-
-
-
-
+
+
com.chinaunicom.ebtp
mall-ebtp-cloud-apollo-starter
@@ -101,6 +93,16 @@
system
${basedir}/lib/aspose-words-16.8.0-jdk16.jar
+
+
+
+ cryp.access
+ accessToken
+ 1.0
+ system
+ ${basedir}/lib/access_token1.1.jar
+
+
cn.chinaunicom.sdsi
mall-xxljob-core
@@ -142,10 +144,6 @@
com.e-iceblue
http://repo.e-iceblue.cn/repository/maven-public/
-
- maven-virtual
- http://ccp.tianti.tg.unicom.local/artifactory/maven-virtual
-
diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/BizServiceEbtpExtendApplication.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/BizServiceEbtpExtendApplication.java
index 58a2b47..05651ce 100644
--- a/src/main/java/com/chinaunicom/mall/ebtp/extend/BizServiceEbtpExtendApplication.java
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/BizServiceEbtpExtendApplication.java
@@ -16,6 +16,7 @@ import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
+import org.springframework.scheduling.annotation.EnableAsync;
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class})
@EnableFeignClients
@@ -23,6 +24,7 @@ import org.springframework.context.annotation.ComponentScan;
@MapperScan({"com.chinaunicom.mall.ebtp.extend.**.dao"})
@ComponentScan("com.chinaunicom.mall.ebtp.*")
@EnableApolloConfig
+@EnableAsync
public class BizServiceEbtpExtendApplication {
public static void main(String[] args) {
diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/controller/SupplyBlockChainLogController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/controller/BlockChainLogController.java
similarity index 51%
rename from src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/controller/SupplyBlockChainLogController.java
rename to src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/controller/BlockChainLogController.java
index 5439933..815bc73 100644
--- a/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/controller/SupplyBlockChainLogController.java
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/controller/BlockChainLogController.java
@@ -3,8 +3,8 @@ 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.SupplyBlockChainLog;
-import com.chinaunicom.mall.ebtp.extend.blockchain.service.ISupplyBlockChainLogService;
+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;
@@ -15,24 +15,24 @@ import javax.validation.Valid;
@RestController
@Api(tags = "供应链+区块链接口调用日志")
-@RequestMapping("/v1/supplyblockchainlog")
-public class SupplyBlockChainLogController{
+@RequestMapping("/v1/blockchainlog")
+public class BlockChainLogController {
@Resource
- private ISupplyBlockChainLogService isupplyBlockChainLogService;
+ private IBlockChainLogService iBlockChainLogService;
/**
* 插入新数据
*
- * @param supplyBlockChainLog
+ * @param blockChainLog
*
* @return
*/
@ApiOperation("插入新数据")
@PostMapping("")
- public BaseResponse insert(@ApiParam(value = "对象数据", required = true) @RequestBody @Valid SupplyBlockChainLog supplyBlockChainLog){
- supplyBlockChainLog.setId(PropertyUtils.getSnowflakeId());
- boolean save = isupplyBlockChainLogService.save(supplyBlockChainLog);
+ public BaseResponse insert(@ApiParam(value = "对象数据", required = true) @RequestBody @Valid BlockChainLog blockChainLog){
+ blockChainLog.setId(PropertyUtils.getSnowflakeId());
+ boolean save = iBlockChainLogService.save(blockChainLog);
return BaseResponse.success(save);
}
@@ -47,11 +47,11 @@ public class SupplyBlockChainLogController{
*/
@ApiOperation("查询数据")
@GetMapping("/{id}")
- public BaseResponse get(@ApiParam(value = "主键id", required = true) @PathVariable String id){
+ public BaseResponse get(@ApiParam(value = "主键id", required = true) @PathVariable String id){
- SupplyBlockChainLog supplyBlockChainLog = isupplyBlockChainLogService.getById(id);
+ BlockChainLog blockChainLog = iBlockChainLogService.getById(id);
- return BaseResponse.success(supplyBlockChainLog);
+ 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/SupplyBlockChainLogMapper.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/dao/SupplyBlockChainLogMapper.java
deleted file mode 100644
index 28c830d..0000000
--- a/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/dao/SupplyBlockChainLogMapper.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.chinaunicom.mall.ebtp.extend.blockchain.dao;
-
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.chinaunicom.mall.ebtp.extend.blockchain.entity.SupplyBlockChainLog;
-
-/**
-* @auto.generated
- */
-public interface SupplyBlockChainLogMapper 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/dao/mapper/SupplyBlockChainLogMapper.xml b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/dao/mapper/SupplyBlockChainLogMapper.xml
deleted file mode 100644
index 8760933..0000000
--- a/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/dao/mapper/SupplyBlockChainLogMapper.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 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/SupplyBlockChainLog.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/entity/BlockChainLog.java
similarity index 57%
rename from src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/entity/SupplyBlockChainLog.java
rename to src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/entity/BlockChainLog.java
index 4ce26ec..c099bbd 100644
--- a/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/entity/SupplyBlockChainLog.java
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/entity/BlockChainLog.java
@@ -1,16 +1,25 @@
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;
/**
- * 实体类 SupplyBlockChainLog
+ * 实体类 BlockChainLog
*
* @auto.generated
*/
@@ -18,8 +27,8 @@ import java.io.Serializable;
@Accessors(chain = true)
@ApiModel
@EqualsAndHashCode(callSuper = false)
-@TableName(value = "supply_block_chain_log", autoResultMap = true)
-public class SupplyBlockChainLog implements Serializable {
+@TableName(value = "block_chain_log", autoResultMap = true)
+public class BlockChainLog implements Serializable {
private static final long serialVersionUID = 1L;
@@ -52,6 +61,11 @@ public class SupplyBlockChainLog implements Serializable {
*/
@ApiModelProperty(value = "")
private String turnId;
+ /**
+ *
+ */
+ @ApiModelProperty(value = "调用接口的地址")
+ private String interfaceUrl;
/**
* 传参
@@ -69,8 +83,11 @@ public class SupplyBlockChainLog implements Serializable {
* 0-成功 1-失败
*/
@ApiModelProperty(value = "0-成功 1-失败")
- private String status;
-
-
+ 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/ISupplyBlockChainLogService.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/service/IBlockChainLogService.java
similarity index 57%
rename from src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/service/ISupplyBlockChainLogService.java
rename to src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/service/IBlockChainLogService.java
index 1f78a0b..286128f 100644
--- a/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/service/ISupplyBlockChainLogService.java
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/service/IBlockChainLogService.java
@@ -2,14 +2,14 @@ package com.chinaunicom.mall.ebtp.extend.blockchain.service;
import com.baomidou.mybatisplus.extension.service.IService;
-import com.chinaunicom.mall.ebtp.extend.blockchain.entity.SupplyBlockChainLog;
+import com.chinaunicom.mall.ebtp.extend.blockchain.entity.BlockChainLog;
/**
* 对数据表 supply_block_chain_log 操作的 service
* @author Auto create
*
*/
-public interface ISupplyBlockChainLogService extends IService {
+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/blockchain/service/impl/SupplyBlockChainLogServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/service/impl/SupplyBlockChainLogServiceImpl.java
deleted file mode 100644
index 0d2c2b1..0000000
--- a/src/main/java/com/chinaunicom/mall/ebtp/extend/blockchain/service/impl/SupplyBlockChainLogServiceImpl.java
+++ /dev/null
@@ -1,17 +0,0 @@
-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.SupplyBlockChainLogMapper;
-import com.chinaunicom.mall.ebtp.extend.blockchain.entity.SupplyBlockChainLog;
-import com.chinaunicom.mall.ebtp.extend.blockchain.service.ISupplyBlockChainLogService;
-import org.springframework.stereotype.Service;
-/**
- * 对数据表 supply_block_chain_log 操作的 serviceImpl
- * blockchain
- *
- */
-@Service
-public class SupplyBlockChainLogServiceImpl extends ServiceImpl implements ISupplyBlockChainLogService {
-
-
-}
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..ba1d66b
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/service/impl/CrypConfigureServiceImpl.java
@@ -0,0 +1,301 @@
+package com.chinaunicom.mall.ebtp.extend.crypconfigure.service.impl;
+
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+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.scheduling.annotation.Async;
+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
+ @Async
+ public Boolean callUniInterface(CrypBean bean){
+ log.info("区块链------callUniInterface:---入参-----"+JSON.toJSONString(bean));
+ BlockChainLog blockChainLog = new BlockChainLog();
+ blockChainLog.setId(PropertyUtils.getSnowflakeId());
+ //天擎地址
+ blockChainLog.setInterfaceUrl(bean.getUrl());
+
+ try {
+ Map map = JSONArray.parseObject(JSONArray.toJSONString(bean.getObject()), Map.class);
+
+ //传入数据解密
+ String sign = getSignValue(map);
+
+ 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.info("加密参数1:"+object);
+ String json = JSONArray.toJSONString(object);
+ Map jsonMap = JSONArray.parseObject(json,Map.class);
+ Object signObject = new Object();
+
+ if(jsonMap.get("BODY_LIST")!=null){
+ List jsonList = (List)jsonMap.get("BODY_LIST");
+ log.info("加密参数2:"+jsonList);
+ InputStream is = CrypConfigureServiceImpl.class.getClassLoader().getResourceAsStream(PEM_PATH);
+ signValue = CrypServiceImpl.signObject2(jsonList,IOUtils.toString(is));
+ }else{
+ log.info("加密参数2:"+jsonMap);
+ InputStream is = CrypConfigureServiceImpl.class.getClassLoader().getResourceAsStream(PEM_PATH);
+ signValue = CrypServiceImpl.signObject2(jsonMap,IOUtils.toString(is));
+ }
+
+
+ log.info("加密结果:"+signValue);
+ }catch (Exception e){
+ log.info("---------加密异常-"+e.getMessage());
+ }
+ return signValue;
+ }
+
+ /**
+ * 获取加密签名
+ * @param map
+ * @return
+ */
+ private String getUniBss(String reqName, Map 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().getUserId()!=null?service.getCacheUser().getUserId():"dzztb");
+ //测试写死
+ String accessToken = "MQjkzVoYoSHe6r/3uZm0MV/TLx+n8PS9ivfPhgY4bWmh+8DVxj7vTC15xbBkuV8oujD3XBZPP7PhcWag9UU5IzsUBT7PSwPhqi/fUqa+iAWhCWpvyihG/23BAY3rJyaoa3OdMNSnIh8woPDCJQTzCTpNtg0toKwdWnuc2mig7vI0Lm9lePvrx3XxFLSaFr+jB5C3qnAX4uUBioZzithSjtra1QUK6S1cb9DCmpj6NRI=";
+ //String accessToken = AccessToken.tokenCreate("bidding");
+ reqhead.setAccessToken(accessToken);
+
+
+ log.info("业务参数封装前:"+map);
+ UniCrpyReq req = new UniCrpyReq();
+ req.setBody(map);
+ req.setHead(reqhead);
+ log.info("业务参数封装中:"+req);;
+ Map reqMap = new HashMap();
+ reqMap.put(reqName,req);
+ uniBss.setUniBssBodyMap(reqMap);
+ log.info("业务参数封装后:"+reqMap);;
+
+
+ return JSON.toJSONString(uniBss);
+ }
+ /**
+ * 解密
+ * @param bean
+ * @return
+ */
+ @Override
+ public Boolean verifyObject(CrypBean bean){
+
+ try{
+ log.info("解密参数1:" + bean);
+ String json = JSONArray.toJSONString(bean.getObject());
+ Map jsonMap = JSONArray.parseObject(json, Map.class);
+ if(jsonMap.get("BODY_LIST")!=null){
+ List jsonList = (List)jsonMap.get("BODY_LIST");
+ log.info("解密参数2:"+jsonList);
+ InputStream is = CrypConfigureServiceImpl.class.getClassLoader().getResourceAsStream(CRT_PATH);
+ Boolean b = CrypServiceImpl.verifyValue(bean.getSign(), jsonList, IOUtils.toString(is));
+
+ return b;
+ }else {
+ log.info("解密参数2:" + bean);
+ InputStream is = CrypConfigureServiceImpl.class.getClassLoader().getResourceAsStream(CRT_PATH);
+ Boolean b = CrypServiceImpl.verifyValue(bean.getSign(), jsonMap, IOUtils.toString(is));
+ return b;
+ }
+
+ }catch (Exception e){
+ log.info("-----------解密失败"+e.getMessage());
+ }
+
+ 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);
+ String json = "{\"BODY_LIST\":[{\"AMOUNT\":\"0\",\"SHOPPINGCART_ID\":\"1434792850257195008\",\"TENDERER_ID\":\"100002372\",\"TP_ID\":\"1433613698540576768\",\"SECTION_ID\":\"1433613698543464448\"}]}";
+ Map jsonMap = JSONArray.parseObject(json,Map.class);
+
+
+
+ CrypConfigureServiceImpl crypService = new CrypConfigureServiceImpl();
+
+ CrypBean bean = new CrypBean();
+
+ bean = crypService.signObject(jsonMap);
+ //bean.setObject(jsonMap);
+ //bean.setSign("MEUCIQCqbcS4d8je+XvTwlSJ1/5IEgiZBYgJlQ+nU/oi2ZeLAgIgd+SZ72Hk8xdKhcVnxwrFsIL6gHMKOFDIbo4nLzmYroM=");
+ System.out.println(bean);
+ //System.out.println("signature of Map: "+bean.getSign());
+ //System.out.println("signature object of Map: "+bean.getObject());
+ //byte[] b = JSON.toJSONBytes(bean.getObject(), new SerializerFeature[]{SerializerFeature.MapSortField, SerializerFeature.SortField});
+ //System.out.println("signature object2 of Map: "+new String(b));
+ boolean isOk = crypService.verifyObject(bean);
+ System.out.println("verify result of Map: "+ isOk);
+
+
+
+ }
+}
diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/riskmanage/controller/RiskManageController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/riskmanage/controller/RiskManageController.java
index 19e83ea..b851321 100644
--- a/src/main/java/com/chinaunicom/mall/ebtp/extend/riskmanage/controller/RiskManageController.java
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/riskmanage/controller/RiskManageController.java
@@ -59,6 +59,6 @@ public class RiskManageController {
*/
@PostMapping({"/findApplyRegulation"})
public BaseResponse