diff --git a/lib/access_token1.0.jar b/lib/access_token1.0.jar
new file mode 100644
index 0000000..aabd939
Binary files /dev/null and b/lib/access_token1.0.jar differ
diff --git a/pom.xml b/pom.xml
index 80857ba..07daa8b 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.0.jar
+
+
org.apache.velocity
velocity-tools
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..0d60c9e
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/controller/CrypConfigureController.java
@@ -0,0 +1,148 @@
+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 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());
+ }
+}
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..1c6cee4
--- /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 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
+public class CrypBean {
+
+ /**
+ * 签名
+ */
+ @ApiModelProperty(value = "签名")
+ public String sing;
+ /**
+ * 待签名参数
+ */
+ @ApiModelProperty(value = "待签名参数")
+ public Object object;
+
+}
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..663dc6b
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/service/ICrypConfigureService.java
@@ -0,0 +1,28 @@
+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 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..58ddd60
--- /dev/null
+++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/crypconfigure/service/impl/CrypConfigureServiceImpl.java
@@ -0,0 +1,88 @@
+package com.chinaunicom.mall.ebtp.extend.crypconfigure.service.impl;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+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.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 org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 对数据表 biz_bid_cryp_configure 操作的 serviceImpl
+ * @author yss
+ *
+ */
+@Service
+public class CrypConfigureServiceImpl extends BaseServiceImpl implements ICrypConfigureService {
+ /**
+ * 加密
+ * @param object
+ * @return
+ */
+ @Override
+ public CrypBean signObject(Object object){
+ CrypBean bean = new CrypBean();
+ try{
+ bean.setObject(object);
+ //查询
+ LambdaQueryWrapper query = Wrappers.lambdaQuery();
+ query.eq(CrypConfigure::getState,"1")
+ .eq(CrypConfigure::getDeleteFlag, CommonConstants.STATUS_NORMAL)
+ .eq(CrypConfigure::getType,"1")
+ .eq(CrypConfigure::getCCode,"pem_key");
+
+ List list = this.list(query);
+
+ CrypConfigure crypConfigure = list.get(0);
+
+ String signValue = CrypServiceImpl.signObject2(bean.getObject(),crypConfigure.getCValue());
+
+ bean.setSing(signValue);
+
+ return bean;
+ }catch (Exception e){
+ log.error("加密异常:"+e);
+ }
+
+
+ return bean;
+ }
+
+ /**
+ * 解密
+ * @param bean
+ * @return
+ */
+ @Override
+ public Boolean verifyObject(CrypBean bean){
+ try{
+ //查询
+ LambdaQueryWrapper query = Wrappers.lambdaQuery();
+ query.eq(CrypConfigure::getState,"1")
+ .eq(CrypConfigure::getDeleteFlag, CommonConstants.STATUS_NORMAL)
+ .eq(CrypConfigure::getType,"1")
+ .eq(CrypConfigure::getCCode,"crt_key");
+
+ List list = this.list(query);
+ log.debug("---------获取解密秘钥--------");
+ CrypConfigure crypConfigure = list.get(0);
+
+ Boolean b = CrypServiceImpl.verifyValue(bean.getSing(),
+ bean.getObject(),
+ crypConfigure.getCValue());
+ return b;
+ }catch (Exception e){
+
+ }
+
+
+ return false;
+ }
+}