Commit 0b8198c2 authored by ysongq's avatar ysongq

Merge branch 'dm_dev' of http://gitlab.ioubuy.cn/yaobenzhang/dm_project into dm_dev

parents 97c4eadb fb558686
This diff is collapsed.
......@@ -31,15 +31,19 @@
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.1.1</version>
</dependency>
<!-- 引入Druid依赖,阿里巴巴所提供的数据源 -->
<dependency>
<!-- <dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</dependency>
</dependency>-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.20</version>
</dependency>
<!-- 提供mysql驱动 -->
<dependency>
<groupId>mysql</groupId>
......@@ -74,6 +78,15 @@
<version>1.18.16</version>
<scope>compile</scope>
</dependency>
<!-- swagger2接口文档 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.jz.dm;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
......@@ -11,12 +12,11 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
* @PACKAGE_NAME: com.jz.dm
* @PROJECT_NAME: jz-dm-parent
* @NAME: ApiGatewayApplication
* @USER: key
* @DATE: 2020-12-2/16:03
* @DAY_NAME_SHORT: 周三
* @Description:
**/
@SpringBootApplication
@SpringBootApplication(exclude = DruidDataSourceAutoConfigure.class)
@ComponentScan(basePackages = {"com.jz"})
@MapperScan("com.jz.dm.mapper")
@EnableTransactionManagement
......
package com.jz.dm.constant;
package com.jz.dm.common.constant;
/**
* 常量
......@@ -13,9 +13,6 @@ public class Constants {
*/
public static final String SIGN_TYPE_RSA2 = "RSA2";
public static final String SIGN_ALGORITHMS = "SHA1WithRSA";
public static final String SIGN_SHA256RSA_ALGORITHMS = "SHA256WithRSA";
public static final String ENCRYPT_TYPE_AES = "AES";
......@@ -35,10 +32,6 @@ public class Constants {
public static final String CHARSET = "charset";
//public static final String NOTIFY_URL = "notify_url";
//
//public static final String RETURN_URL = "return_url";
public static final String ENCRYPT_TYPE = "encrypt_type";
public static final String PARAMS = "params";
......
package com.jz.dm.constant;
package com.jz.dm.common.constant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......
package com.jz.dm.common.exception;
import com.jz.dm.common.util.ResultCode;
/**
* 通知异常
*
*/
public class NotifyException extends OpenApiException {
/** 序列号 */
private static final long serialVersionUID = 3391018902219700916L;
/**
* 构造函数
*
* @param resultCode
*/
public NotifyException(ResultCode resultCode) {
super(resultCode);
}
/**
* 构造函数
*
* @param resultCode
* @param cause
*/
public NotifyException(ResultCode resultCode, Throwable cause) {
super(resultCode, cause);
}
/**
* 构造函数
*
* @param resultCode
* @param detailMessage
*/
public NotifyException(ResultCode resultCode, String detailMessage) {
super(resultCode, detailMessage);
}
/**
* 构造函数
*
* @param code
* @param msg
*/
public NotifyException(String code, String msg) {
this(code, msg, (Throwable) null);
}
/**
* 构造函数
*
* @param code
* @param msg
* @param cause
*/
public NotifyException(String code, String msg, Throwable cause) {
super(code, msg, cause);
}
/**
* 构造函数
*
* @param code
* @param msg
* @param detailMessage
*/
public NotifyException(String code, String msg, String detailMessage) {
super(code, msg, detailMessage);
}
}
\ No newline at end of file
package com.jz.dm.common.exception;
import com.jz.dm.common.util.ResultCode;
/**
* 加密异常
*
*/
public class SecretException extends OpenApiException {
private static final long serialVersionUID = -8597436175649786898L;
/**
* 构造函数
* @param resultCode
*/
public SecretException(ResultCode resultCode) {
super(resultCode);
}
/**
* 构造函数
* @param resultCode
* @param detailMessage
*/
public SecretException(ResultCode resultCode, String detailMessage) {
super(resultCode, detailMessage);
}
/**
* 构造函数
* @param resultCode
* @param cause
*/
public SecretException(ResultCode resultCode, Throwable cause) {
super(resultCode, cause);
}
/**
* 构造函数
* @param resultCode
* @param detailMessage
* @param cause
*/
public SecretException(ResultCode resultCode, String detailMessage, Throwable cause) {
super(resultCode, detailMessage, cause);
}
}
/**
* Copyright (c) 2011-2014 All Rights Reserved.
*/
package com.jz.dm.common.util;
/**
* @author Admin
* @version $Id: Constants.java 2014年9月3日 下午9:03:44 $
*/
public class Constants {
/**
* 默认时间格式
**/
public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
public static final String DATE_FORMAT = "yyyyMMdd";
/**
* 密码的正则表达式
*/
public static final String PASSWORD_EXG = "^(?![^a-zA-Z]+$)(?!\\D+$).{8,30}$";
/**
* UTF-8字符集
**/
public static final String CHARSET_UTF8 = "UTF-8";
/**
* Date默认时区
**/
public static final String DATE_TIMEZONE = "GMT+8";
public static final String PRINCIPAL_NAME_ATTRIBUTE_OMSNAME = ".OMS_PRINCIPAL_NAME_ATTRIBUTE_NAME";
public static final String PRINCIPAL_NAME_ATTRIBUTE_MCHNAME = ".MCH_PRINCIPAL_NAME_ATTRIBUTE_NAME";
public static final String PRINCIPAL_NAME_ATTRIBUTE_PROXYNAME = ".PROXY_PRINCIPAL_NAME_ATTRIBUTE_NAME";
public static final String PRINCIPAL_NAME_ATTRIBUTE_SUPNAME = ".SUPPLIER_PRINCIPAL_NAME_ATTRIBUTE_NAME";
public static final String PERMISSIONS = "permissions";
/**
* 登录成功后,继续跳转URL
*/
public static final String GOTO_KEY = "to";
/**
* 记录密码控件的密钥key
*/
public final static String TOKEN = "token_%s";
// http请求头UA参数
public static final String UA = "user-agent";
//缓存名称
public static final String MEMBER_CACHE_NAME = "data:members";
public static final String MERCHANT_CACHE_NAME = "data:merchants";
public static final String SECRET_CACHE_NAME = "data:secret_keys";
public static final String ADDR_CACHE_NAME = "data:addrs";
public static final String PRODUCT_CACHE_NAME = "data:products";
public static final String API_WHITE_CACHE_NAME = "data:apiwhite";
//数据库序列名称
public static final String SEQ_ACCOUNT = "ids:accounts";
public static final String SEQ_ACCOUNT_WATER = "ids:accounts:water";
//public static final String SEQ_MEMBER = "ids:members";
public static final String SEQ_RECHARGE = "ids:recharges:loop:7";
public static final String SEQ_TRADE_ORDER = "ids:tradeorders:loop:7";
public static final String SEQ_PAYMENT = "ids:payment:loop:7";
public static final String SEQ_WITHDRAW = "ids:withdraws:loop:7";
public static final String SEQ_TRANSFER = "ids:transfer:loop:7";
/**
* key = 产线名:服务名:用途:数据类型:key
*/
public static final String VALID_CODE_KEY_PREFIX = "data:merchants:valid:string:";
public static final String VALID_CODE_KEY_COUNT_PREFIX = "data:merchants:valid:long:";
/** 短信签约缓存名称 **/
public static final String SMS_SIGN_KEY_PREFIX = "data:smssign:shortcode:string:";
public static final String SMS_SIGN_VALID_CODE_PREFIX = "data:smssign:validcode:string:";
public static final String SMS_SIGN_VALID_CODE_LIMIT_PREFIX = "data:smssign:validlimit:string:";
public static final String SMS_BROKER_VALID_CODE_PREFIX = "data:smsbroker:valid:string:";
/**
* 发送短信验证
*/
public static final String SEND_PAY_VALID_CODE = "sendPayValidCode";
public static final String SEND_EDIT_PASSWORD_VALID_CODE = "sendPasswordValidCode";
public static final String SEND_SIGN_VALID_CODE = "sendSignValidCode";
public static final String SMS_BROKER_VALID_CODE_TEMPLATE = "sendBrokerValidCode";
/**
* 代理商分润汇总key
*/
public static final String PROXY_ALL_FEE_SUMMARY = "PROXY_ALL_FEE_SUMMARY";
public static final String PROXYER_Fee = "PROXYER_Fee";
public static final String MERCHANT_Fee = "MERCHANT_Fee";
}
package com.jz.dm.common.util;
import java.util.HashMap;
import java.util.Map;
/**
* HDD HashMap
*
*/
public class HddHashMap extends HashMap<String, String> {
private static final long serialVersionUID = -3440305725602261736L;
public HddHashMap() {
super();
}
public HddHashMap(Map<? extends String, ? extends String> map) {
super(map);
}
/**
* if key or value is null, not put into hash map
*
* @see HashMap#put(Object, Object)
*/
@Override
public String put(String key, String value) {
if (StringUtil.isNotEmpty(key, value)) {
return super.put(key, value);
} else {
return null;
}
}
}
......@@ -15,6 +15,15 @@ import java.util.*;
public class JSONWriter {
/**
* 默认时间格式
**/
public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
/**
* Date默认时区
**/
public static final String DATE_TIMEZONE = "GMT+8";
private StringBuffer buf = new StringBuffer();
private Stack<Object> calls = new Stack<Object>();
private boolean emitClassName = true;
......@@ -159,8 +168,8 @@ public class JSONWriter {
private void date(Date date) {
if (this.format == null) {
this.format = new SimpleDateFormat(Constants.DATE_TIME_FORMAT);
this.format.setTimeZone(TimeZone.getTimeZone(Constants.DATE_TIMEZONE));
this.format = new SimpleDateFormat(DATE_TIME_FORMAT);
this.format.setTimeZone(TimeZone.getTimeZone(DATE_TIMEZONE));
}
add("\"");
add(format.format(date));
......
package com.jz.dm.model.signtype;
package com.jz.dm.common.util;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
......
package com.jz.dm.common.util;
import java.util.HashMap;
import java.util.Map;
/**
* 结果码
*
*/
public enum NotifyResultCode implements ResultCode {
/** 处理成功 */
SUCCESS("SUCCESS", "处理成功"),
/** 处理失败 */
FAILED("FAILED", "处理失败"),
/** 未知异常 */
UNKNOWN_EXCEPTION("UNKNOWN_EXCEPTION", "未知异常"),
/** 数据库异常 */
DATABASE_EXCEPTION("DATABASE_EXCEPTION", "数据库异常"),
/** IO异常 */
IO_EXCEPTION("IO_EXCEPTION", "IO异常"),
/** 参数不能为空 */
PARAM_CAN_NOT_NULL("PARAM_CAN_NOT_NULL", "参数不能为空"),
/** 参数不能为空 */
PARAM_CAN_NOT_EMPTY("PARAM_CAN_NOT_EMPTY", "参数不能为空"),
/** 重复发送 */
RETRANSMISSION("RETRANSMISSION", "重复发送"),
/** 无效参数 */
ILLEGAL_ARGUMENT("ILLEGAL_ARGUMENT", "无效参数"),
/** 时间格式不合法*/
ILLEGAL_DATE_FORMAT("ILLEGAL_DATE_FORMAT", "时间格式不合法"),
;
/**
* 初始化保存到map里方便根据code获取
*/
private static Map<String, NotifyResultCode> RESULT_CODES = new HashMap<String, NotifyResultCode>();
static {
for (NotifyResultCode resultCode : NotifyResultCode.values()) {
RESULT_CODES.put(resultCode.code, resultCode);
}
}
/** 结果码 */
private String code;
/** 结果码信息 */
private String msg;
/** 结果分类 */
private NotifyResultCode classification;
/**
* 构造函数
*
* @param code 结果码
* @param msg 结果码信息
*/
private NotifyResultCode(String code, String message) {
this(code, message, null);
}
/**
* 构造函数
*
* @param code 结果码
* @param msg 结果码信息
* @param classification 结果分组
*/
private NotifyResultCode(String code, String msg, NotifyResultCode classification) {
this.code = code;
this.msg = msg;
this.classification = classification;
}
/**
* 通过枚举<code>code</code>获得枚举
*
* @param code 结果码
* @return 枚举
*/
public static NotifyResultCode getResultCode(String code) {
return RESULT_CODES.get(code);
}
/**
* Getter method for property <tt>code</tt>.
*
* @return property value of code
*/
@Override
public String getCode() {
return code;
}
/**
* Setter method for property <tt>code</tt>.
*
* @param code value to be assigned to property code
*/
public void setCode(String code) {
this.code = code;
}
/**
* Getter method for property <tt>msg</tt>.
*
* @return property value of msg
*/
@Override
public String getMsg() {
return msg;
}
/**
* Setter method for property <tt>msg</tt>.
*
* @param msg value to be assigned to property msg
*/
public void setMsg(String msg) {
this.msg = msg;
}
/**
* Getter method for property <tt>classification</tt>.
*
* @return property value of classification
*/
public NotifyResultCode getClassification() {
return classification;
}
/**
* Setter method for property <tt>classification</tt>.
*
* @param classification value to be assigned to property classification
*/
public void setClassification(NotifyResultCode classification) {
this.classification = classification;
}
}
......@@ -16,7 +16,7 @@ import java.util.Map;
*/
public class OpenApiRequest {
private String appKey;
private String appKey; //apiKey
private String openApiParams;
......
package com.jz.dm.common.util;
import org.apache.commons.codec.binary.Base64;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import javax.crypto.Cipher;
import java.io.ByteArrayOutputStream;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.HashMap;
import java.util.Map;
public class RSAUtils {
public static final String CHARSET = "UTF-8";
public static final String RSA_ALGORITHM = "RSA";
public static Map<String, String> createKeys(int keySize){
//为RSA算法创建一个KeyPairGenerator对象
KeyPairGenerator kpg;
try{
kpg = KeyPairGenerator.getInstance(RSA_ALGORITHM);
}catch(NoSuchAlgorithmException e){
throw new IllegalArgumentException("No such algorithm-->[" + RSA_ALGORITHM + "]");
}
//初始化KeyPairGenerator对象,密钥长度
kpg.initialize(keySize);
//生成密匙对
KeyPair keyPair = kpg.generateKeyPair();
//得到公钥
Key publicKey = keyPair.getPublic();
String publicKeyStr =Base64.encodeBase64URLSafeString(publicKey.getEncoded());
//得到私钥
Key privateKey = keyPair.getPrivate();
System.out.println("私钥格式:"+privateKey.getFormat());
String privateKeyStr = Base64.encodeBase64URLSafeString(privateKey.getEncoded());
Map<String, String> keyPairMap = new HashMap<String, String>();
keyPairMap.put("publicKey", publicKeyStr);
keyPairMap.put("privateKey", privateKeyStr);
return keyPairMap;
}
/**
* 得到公钥
* @param publicKey 密钥字符串(经过base64编码)
* @throws Exception
*/
public static RSAPublicKey getPublicKey(String publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
//通过X509编码的Key指令获得公钥对象
KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKey));
RSAPublicKey key = (RSAPublicKey) keyFactory.generatePublic(x509KeySpec);
return key;
}
/**
* 得到私钥
* @param privateKey 密钥字符串(经过base64编码)
* @throws Exception
*/
public static RSAPrivateKey getPrivateKey(String privateKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
//通过PKCS#8编码的Key指令获得私钥对象
KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKey));
RSAPrivateKey key = (RSAPrivateKey) keyFactory.generatePrivate(pkcs8KeySpec);
return key;
}
/**
* 公钥加密
* @param data
* @param publicKey
* @return
*/
public static String publicEncrypt(String data, RSAPublicKey publicKey){
try{
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
return Base64.encodeBase64URLSafeString(rsaSplitCodec(cipher, Cipher.ENCRYPT_MODE, data.getBytes(CHARSET), publicKey.getModulus().bitLength()));
}catch(Exception e){
throw new RuntimeException("加密字符串[" + data + "]时遇到异常", e);
}
}
/**
* 私钥解密
* @param data
* @param privateKey
* @return
*/
public static String privateDecrypt(String data, RSAPrivateKey privateKey){
try{
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, privateKey);
return new String(rsaSplitCodec(cipher, Cipher.DECRYPT_MODE, Base64.decodeBase64(data), privateKey.getModulus().bitLength()), CHARSET);
}catch(Exception e){
throw new RuntimeException("解密字符串[" + data + "]时遇到异常", e);
}
}
/**
* 私钥加密
* @param data
* @param privateKey
* @return
*/
public static String privateEncrypt(String data, RSAPrivateKey privateKey){
try{
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
return Base64.encodeBase64URLSafeString(rsaSplitCodec(cipher, Cipher.ENCRYPT_MODE, data.getBytes(CHARSET), privateKey.getModulus().bitLength()));
}catch(Exception e){
throw new RuntimeException("加密字符串[" + data + "]时遇到异常", e);
}
}
/**
* 公钥解密
* @param data
* @param publicKey
* @return
*/
public static String publicDecrypt(String data, RSAPublicKey publicKey){
try{
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, publicKey);
return new String(rsaSplitCodec(cipher, Cipher.DECRYPT_MODE, Base64.decodeBase64(data), publicKey.getModulus().bitLength()), CHARSET);
}catch(Exception e){
throw new RuntimeException("解密字符串[" + data + "]时遇到异常", e);
}
}
private static byte[] rsaSplitCodec(Cipher cipher, int opmode, byte[] datas, int keySize){
int maxBlock = 0;
if(opmode == Cipher.DECRYPT_MODE){
maxBlock = keySize / 8;
}else{
maxBlock = keySize / 8 - 11;
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
int offSet = 0;
byte[] buff;
int i = 0;
try{
while(datas.length > offSet){
if(datas.length-offSet > maxBlock){
buff = cipher.doFinal(datas, offSet, maxBlock);
}else{
buff = cipher.doFinal(datas, offSet, datas.length-offSet);
}
out.write(buff, 0, buff.length);
i++;
offSet = i * maxBlock;
}
}catch(Exception e){
throw new RuntimeException("加解密阀值为["+maxBlock+"]的数据时发生异常", e);
}
byte[] resultDatas = out.toByteArray();
IOUtils.closeQuietly(out);
return resultDatas;
}
}
package com.jz.dm.common.util;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
/**
*
* @author Admin
*/
public final class TtpayUtils {
/**
* 除去数组中的空值和签名参数
* 为了兼容健康商城签名问题,过滤sign2参数
* @param sArray 签名参数组
* @return 去掉空值与签名参数后的新签名参数组
*/
public static Map<String, String> filter(Map<String, String> sArray) {
Map<String, String> result = new HashMap<String, String>();
if (sArray == null || sArray.size() <= 0) {
return result;
}
for (String key : sArray.keySet()) {
String value = sArray.get(key);
if (StringUtils.isEmpty(value) || key.equalsIgnoreCase("sign")) {
continue;
}
result.put(key, value);
}
return result;
}
/**
* 把数组所有元素排序,并按照“参数=参数值”的模式用“&”字符拼接成字符串
* @param params 需要排序并参与字符拼接的参数组
* @return 拼接后字符串
*/
public static String createLinkString(Map<String, String> params) {
// 第一步:把字典按Key的字母顺序排序,参数使用TreeMap已经完成排序
List<String> keys = new ArrayList<String>(params.keySet());
Collections.sort(keys);
// 第二步:把所有参数名和参数值串在一起
StringBuilder sb = new StringBuilder();
for (String key : keys) {
String value = params.get(key);
if (!StringUtils.isEmpty(value)) {
sb.append(key).append("=").append(value);
}
}
return sb.toString();
}
/**
* 方法说明:根据运单号返回还有校验位
*
* @param no
* @return
*/
public static String createId(String mobile, int length) {
int count = 0;
String no = mobile.substring(0, length);//计算前6位校验码
int len = no.length();
for (int i=0;i<len;i++) {
int p = (no.charAt(len - i -1)) * (i * 2 + 1);
int q = divide(p, 10);
int r = p - q * 10;
count += (q + r);
}
return ((divide(count, 10) + 1) * 10 - count) % 10 + mobile.substring(mobile.length() - length + 1);
}
public static int divide(int x, int y) {
if (y == 0) {
return 0;
}
BigDecimal bigX = new BigDecimal(x);
BigDecimal bigY = new BigDecimal(y);
return bigX.divide(bigY, 0, RoundingMode.HALF_UP).intValue();
}
public static void main(String[] args) {
System.out.println(TtpayUtils.createId("15000000013", 7));
}
}
......@@ -9,7 +9,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* @ClassName: MybatisPlusConfig
* @Author Bellamy
* @Author ZC
* @Date 2020/11/27
* @Version 1.0
*/
......@@ -18,7 +18,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@MapperScan("com.jz.dm.mapper")
public class MybatisPlusConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
......@@ -27,9 +26,7 @@ public class MybatisPlusConfig {
// 设置最大单页限制数量,默认 500 条,-1 不受限制
paginationInterceptor.setLimit(500);
// 开启 count 的 join 优化,只针对部分 left join
paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize());
paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true));
return paginationInterceptor;
}
}
package com.jz.dm.config;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* @Description:
* @Author: Mr.zhang
* @Date: 2020-12-23
*/
@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class SwaggerConfiguration {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.jz.dm.mall.controller"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("APi网关 RESTful APIs")
.description("swagger-bootstrap-ui")
.termsOfServiceUrl("http://localhost:8088/")
.contact("ZC")
.version("1.0")
.build();
}
}
package com.jz.dm.controller;
import com.jz.dm.service.AuthService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.controller
* @PROJECT_NAME: jz-dm-parent
* @NAME: AuthController
* @DATE: 2020-12-23/16:38
* @DAY_NAME_SHORT: 周三
* @Description: 授权controller
**/
@RestController
@RequestMapping("auth")
@Api(tags = "授权认证Controller")
public class AuthController {
@Autowired
private AuthService authService;
}
......@@ -5,9 +5,9 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.PropertyNamingStrategy;
import com.jz.dm.common.util.JsonUtil;
import com.jz.dm.gateway.GatewayService;
import com.jz.dm.model.GatewayRequest;
import com.jz.dm.model.GatewayResponse;
import com.jz.dm.model.RequestContext;
import com.jz.dm.models.enity.GatewayRequest;
import com.jz.dm.models.enity.GatewayResponse;
import com.jz.dm.models.enity.RequestContext;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
......@@ -21,7 +21,7 @@ import java.util.Map;
/**
* 网关请求
* @author key
* @author zc
*/
@RestController
public class GatewayController {
......@@ -48,7 +48,6 @@ public class GatewayController {
RequestContext requestContext = RequestContext.getCurrentContext();
requestContext.setRequest(httpServletRequest);
requestContext.setResponse(httpServletResponse);
System.out.println("经过了controller~~~~~~~~~~~~~~~~~~~~");
GatewayResponse gatewayResponse = gatewayService.invoke(gatewayRequest);
JSONObject result = new JSONObject();
convertResponse(result, gatewayResponse);
......
package com.jz.dm.controller;
import com.jz.dm.service.OrganizationManageService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.controller
* @PROJECT_NAME: jz-dm-parent
* @NAME: OrganizationManageController
* @DATE: 2020-12-23/22:00
* @DAY_NAME_SHORT: 周三
* @Description: 组织管理controller
**/
@RestController
@RequestMapping("organization")
@Api(tags = "组织管理Controller")
public class OrganizationManageController {
@Autowired
private OrganizationManageService organizationManageService;
}
package com.jz.dm.controller;
import com.jz.dm.service.ProducerService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.controller
* @PROJECT_NAME: jz-dm-parent
* @NAME: ProducerController
* @DATE: 2020-12-23/16:44
* @DAY_NAME_SHORT: 周三
* @Description:
**/
@RestController
@RequestMapping("producer")
@Api(tags = "Api制作Controller")
public class ProducerController {
@Autowired
private ProducerService producerService;
}
package com.jz.dm.filter;
import com.jz.dm.model.GatewayRequest;
import com.jz.dm.model.GatewayResponse;
import com.jz.dm.model.RequestContext;
import com.jz.dm.models.enity.GatewayRequest;
import com.jz.dm.models.enity.GatewayResponse;
import com.jz.dm.models.enity.RequestContext;
import org.springframework.core.Ordered;
......
......@@ -3,11 +3,11 @@ package com.jz.dm.filter;
import com.jz.dm.common.exception.GatewayException;
import com.jz.dm.common.util.SignType;
import com.jz.dm.common.util.StringUtil;
import com.jz.dm.constant.Constants;
import com.jz.dm.model.GatewayRequest;
import com.jz.dm.model.GatewayResponse;
import com.jz.dm.model.enums.Format;
import com.jz.dm.model.enums.GatewayResultCode;
import com.jz.dm.common.constant.Constants;
import com.jz.dm.models.enity.GatewayRequest;
import com.jz.dm.models.enity.GatewayResponse;
import com.jz.dm.models.enums.Format;
import com.jz.dm.models.enums.GatewayResultCode;
import org.springframework.stereotype.Component;
import java.nio.charset.Charset;
......@@ -46,11 +46,13 @@ public class CheckArgsFilter extends AbstractFilter {
if (StringUtil.isEmpty(request.getFormat())) {
request.setFormat(Format.JSON.name());
}
try {
Format.valueOf(request.getFormat());//格式,目前仅支持JSON
Charset.forName(request.getCharset());//请求使用的编码格式,如UTF-8,GBK,GB2312等
SignType.valueOf(request.getSignType());//生成签名字符串所使用的签名算法类型
//格式,目前仅支持JSON
Format.valueOf(request.getFormat());
//请求使用的编码格式,如UTF-8,GBK,GB2312等
Charset.forName(request.getCharset());
//生成签名字符串所使用的签名算法类型
SignType.valueOf(request.getSignType());
} catch (Exception ex) {
//无效参数
throw new GatewayException(GatewayResultCode.ILLEGAL_ARGUMENT);
......
package com.jz.dm.filter;
import com.jz.dm.common.exception.GatewayException;
import com.jz.dm.constant.Constants;
import com.jz.dm.model.GatewayRequest;
import com.jz.dm.model.GatewayResponse;
import com.jz.dm.model.RequestContext;
import com.jz.dm.model.enums.GatewayResultCode;
import com.jz.dm.common.constant.Constants;
import com.jz.dm.models.enity.GatewayRequest;
import com.jz.dm.models.enity.GatewayResponse;
import com.jz.dm.models.enity.RequestContext;
import com.jz.dm.models.enums.GatewayResultCode;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
......
package com.jz.dm.filter;
import com.jz.dm.common.exception.GatewayException;
import com.jz.dm.constant.Constants;
import com.jz.dm.model.GatewayRequest;
import com.jz.dm.model.GatewayResponse;
import com.jz.dm.model.enums.GatewayResultCode;
import com.jz.dm.common.constant.Constants;
import com.jz.dm.models.enity.GatewayRequest;
import com.jz.dm.models.enity.GatewayResponse;
import com.jz.dm.models.enums.GatewayResultCode;
import org.springframework.stereotype.Component;
/**
......@@ -41,9 +41,9 @@ public class CheckTimestampFilter extends AbstractFilter {
} catch (Exception ex) {
throw new GatewayException(GatewayResultCode.ILLEGAL_ARGUMENT);//无效参数
}
//if (System.currentTimeMillis() - time > max) {
// throw new GatewayException(GatewayResultCode.ILLEGAL_TIMETEMP);//无效时间戳
//}
if (System.currentTimeMillis() - time > max) {
throw new GatewayException(GatewayResultCode.ILLEGAL_TIMETEMP);//无效时间戳
}
chain.doFilter(request, response);
}
......
package com.jz.dm.filter;
import com.jz.dm.model.GatewayRequest;
import com.jz.dm.model.GatewayResponse;
import com.jz.dm.models.enity.GatewayRequest;
import com.jz.dm.models.enity.GatewayResponse;
/**
* 过滤器
......
package com.jz.dm.filter;
import com.jz.dm.model.GatewayRequest;
import com.jz.dm.model.GatewayResponse;
import com.jz.dm.models.enity.GatewayRequest;
import com.jz.dm.models.enity.GatewayResponse;
/**
* 请求过滤链
......
......@@ -3,9 +3,9 @@ package com.jz.dm.filter;
import com.jz.dm.common.exception.OpenApiException;
import com.jz.dm.common.util.LogUtil;
import com.jz.dm.common.util.ResultCode;
import com.jz.dm.model.GatewayRequest;
import com.jz.dm.model.GatewayResponse;
import com.jz.dm.model.enums.GatewayResultCode;
import com.jz.dm.models.enity.GatewayRequest;
import com.jz.dm.models.enity.GatewayResponse;
import com.jz.dm.models.enums.GatewayResultCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......
......@@ -4,12 +4,12 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jz.dm.common.exception.GatewayException;
import com.jz.dm.common.util.LogUtil;
import com.jz.dm.constant.Constants;
import com.jz.dm.constant.LoggingConstants;
import com.jz.dm.common.constant.Constants;
import com.jz.dm.common.constant.LoggingConstants;
import com.jz.dm.gateway.DefaultOpenApiDispatcher;
import com.jz.dm.model.enums.GatewayResultCode;
import com.jz.dm.model.enums.RouteType;
import com.jz.dm.model.*;
import com.jz.dm.models.enity.*;
import com.jz.dm.models.enums.GatewayResultCode;
import com.jz.dm.models.enums.RouteType;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -19,7 +19,7 @@ import org.springframework.stereotype.Component;
*
* @author key
*/
@Component
@Component("invokeRouteFilter")
public class InvokeRouteFilter extends AbstractFilter {
/** openapi dispatcher logger */
......
package com.jz.dm.filter;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.PropertyNamingStrategy;
import com.jz.dm.common.util.*;
import com.jz.dm.common.exception.SignatureException;
import com.jz.dm.common.util.StringUtil;
import com.jz.dm.constant.Constants;
import com.jz.dm.model.GatewayRequest;
import com.jz.dm.model.GatewayResponse;
import com.jz.dm.model.enums.GatewayResultCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.Map;
///**
// * 签名过滤器
// */
//@Component
//public class SignatureFilter extends AbstractFilter {
//
// private static final Logger LOGGER = LoggerFactory.getLogger(SignatureFilter.class);
//
// // @Autowired
// // private IApiWhiteService apiWhiteService;
// // @Value("${secret_private}")
// // private String secretPrivate;
//
// private String encryptData;
//
// @Override
// protected void internalDoFilter(GatewayRequest request, GatewayResponse response,
// FilterChain chain) {
// try {
// chain.doFilter(request, response);
// } finally {
// String responseJson = null;
// String sign = StringUtil.EMPTY_STRING;
// String privatekey = null;
// if (StringUtil.isEmpty(request.getAppKey())) {
// return;
// }
// //ApiWhite apiWhite = apiWhiteService.byMerchantId(request.getAppId());
// //if (apiWhite == null) {
// // return;
// //}
// //是否提供密码
// //boolean providePublicKey = false;
// //if ("0".equals(apiWhite.getProvideSecret())) {
// // privatekey = apiWhite.getSecretKey();
// //} else if ("1".equals(apiWhite.getProvideSecret())) {
// // privatekey = secretPrivate;
// // providePublicKey = true;
// //}
// try {
// responseJson = JsonUtil.toJSONString(response.getResponse(),
// PropertyNamingStrategy.SnakeCase);
// if (StringUtil.isNotEmpty(request.getSignType())) {
// String charset = request.getCharset();
// if (StringUtil.isEmpty(charset)) {
// charset = Constants.CHARSET_UTF8;
// }
//
// //if (providePublicKey) {
// // sign = SignatureUtil.sign(convertResult(response.getResponse(), response, apiWhite), privatekey, charset, SignType.valueOf(request.getSignType()), SignatureUtil.SIGN_REQUEST, providePublicKey);
// //} else {
// // sign = SignatureUtil.sign(convertResult(response.getResponse(), response, apiWhite), privatekey, charset, SignType.valueOf(request.getSignType()), SignatureUtil.SIGN_REQUEST, providePublicKey);
// //}
// }
// } catch (JSONException e) {
// LogUtil.error(LOGGER, e,
// "serializer response to json string error. response=" + response.getResponse());
// response.clearAttributes();
// response.setCode(OpenApiResultCode.RESPONSE_DATA_FORMAT_ERROR.getCode());
// response.setMsg(OpenApiResultCode.RESPONSE_DATA_FORMAT_ERROR.getMsg());
// // sign = signatureException(request, response, privatekey, providePublicKey);
// } catch (SignatureException ex) {
// LogUtil.error(LOGGER, ex,
// "sign response error. response=" + response.getResponse());
// response.clearAttributes();
// response.setCode(ex.getResultCode().getCode());
// response.setMsg(ex.getResultCode().getMsg());
// } catch (Throwable ex) {
// LogUtil.error(LOGGER, ex,
// "signatureFilter doFilter error. response=" + response.getResponse());
// response.clearAttributes();
// response.setCode(GatewayResultCode.UNKNOWN_EXCEPTION.getCode());
// response.setMsg(GatewayResultCode.UNKNOWN_EXCEPTION.getMsg());
// // sign = signatureException(request, response, privatekey, providePublicKey);
// }
// response.setSign(sign);
// //if (apiWhite.getIsEncrypt()) {
// // response.setEncryptData(encryptData);
// //}
// }
// }
//
// private Map<String, Object> convertResult(Map<String, Object> attributes, GatewayResponse response) {
// Map<String, Object> mapResult = new HashMap<>();
// mapResult.put("code", response.getCode());
// mapResult.put("msg", response.getMsg());
// Object code = attributes.get("code");
// Object msg = attributes.get("msg");
// attributes.remove("code");
// attributes.remove("msg");
// if (!CollectionUtils.isEmpty(attributes)) {
// mapResult.put("data", JsonUtil.toJSONString(attributes, PropertyNamingStrategy.SnakeCase));
// //if (apiWhite.getIsEncrypt()) {
// // String string = (String) mapResult.get("data");
// // try {
// // RSAPrivateKey privateKey = RSAUtils.getPrivateKey(secretPrivate);
// // String encrypt = RSAUtils.privateEncrypt(string, privateKey);
// // mapResult.put("data", encrypt);
// // encryptData = encrypt;
// // } catch (Exception e) {
// // e.printStackTrace();
// // }
// //}
// }
// attributes.put("code", code);
// attributes.put("msg", msg);
// return mapResult;
// }
//
// private String signatureException(GatewayRequest request, GatewayResponse response,
// String privateKey, boolean providePublicKey) {
// String responseJson = null;
// String sign = StringUtil.EMPTY_STRING;
// try {
// responseJson = JsonUtil.toJSONString(response.getResponse(),
// PropertyNamingStrategy.SnakeCase);
// } catch (JSONException e1) {
// LogUtil.error(LOGGER, e1,
// "serializer response to json string error. response=" + response.getResponse());
// return sign;
// }
// try {
// sign = SignatureUtil.sign(responseJson, privateKey, request.getCharset(), SignType.valueOf(request.getSignType()), SignatureUtil.SIGN_REQUEST, providePublicKey);
// } catch (SignatureException ex) {
// LogUtil.error(LOGGER, ex, "sign response error. response=" + response.getResponse());
// }
// return sign;
// }
//
// /**
// * @see org.springframework.core.Ordered#getOrder()
// */
// @Override
// public int getOrder() {
// return Constants.FILTER_ORDER_0;
// }
//
// @Override
// public String getFilterName() {
// return "SignatureFilter";
// }
//
//}
package com.jz.dm.filter;
import com.jz.dm.common.util.HddHashMap;
import com.jz.dm.common.util.RSAUtils;
import com.jz.dm.constant.Constants;
import com.jz.dm.model.enums.RouteType;
import com.jz.dm.model.GatewayRequest;
import com.jz.dm.model.GatewayResponse;
import com.jz.dm.model.OpenApi;
import com.jz.dm.model.RequestContext;
import com.jz.dm.common.constant.Constants;
import com.jz.dm.models.enity.GatewayRequest;
import com.jz.dm.models.enity.GatewayResponse;
import com.jz.dm.models.enity.OpenApi;
import com.jz.dm.models.enity.RequestContext;
import com.jz.dm.models.enums.RouteType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.security.interfaces.RSAPublicKey;
/**
* 验签过滤器
* 验签过滤器(验证签名信息)
*/
@Slf4j
@Component
public class VerifySignFilter extends AbstractFilter {
//@Autowired
//private IApiWhiteService apiWhiteService;
private final static String CHARSET = "UTF-8";
@Override
public int getOrder() {
return Constants.FILTER_ORDER_4;
......@@ -38,8 +31,7 @@ public class VerifySignFilter extends AbstractFilter {
// 后期再扩展
OpenApi openApi = new OpenApi();
openApi.setApplication("JZ_API_GATEWAY");//应用
openApi.setRouteType(RouteType.SPRINGBOOT);//漏油类型
//openApi.setRouteType(RouteType.SRPING);//漏油类型
openApi.setRouteType(RouteType.SRPING);//漏油类型
RequestContext.getCurrentContext().set("openApi", openApi);
chain.doFilter(request, response);
......
......@@ -6,7 +6,7 @@ import com.jz.dm.common.util.OpenApiRequest;
import com.jz.dm.common.util.OpenApiResponse;
import com.jz.dm.common.util.OpenApiResultCode;
import com.jz.dm.common.util.StringUtil;
import com.jz.dm.model.DispatchContext;
import com.jz.dm.models.enity.DispatchContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
......@@ -19,7 +19,7 @@ import java.util.concurrent.ConcurrentHashMap;
/**
* 默认openapi分发器
*
* @author key
* @author zc
*/
@Component("defaultOpenApiDispatcher")
public class DefaultOpenApiDispatcher implements OpenApiDispatcher {
......
package com.jz.dm.gateway;
import com.jz.dm.model.GatewayRequest;
import com.jz.dm.model.GatewayResponse;
import com.jz.dm.models.enity.GatewayRequest;
import com.jz.dm.models.enity.GatewayResponse;
/**
* GatewayService
* @author key
* @author zc
*/
public interface GatewayService {
/**
* @param gatewayRequest
* @return
*/
GatewayResponse invoke(GatewayRequest gatewayRequest);
}
package com.jz.dm.gateway;
import com.jz.dm.model.DispatchContext;
import com.jz.dm.models.enity.DispatchContext;
/**
* openapi分发器
*
* @author key
* @author zc
*/
public interface OpenApiDispatcher {
......
......@@ -6,7 +6,7 @@ import com.jz.dm.common.util.OpenApiResponse;
/**
* openapi服务
* @author key
* @author zc
*/
public interface OpenApiService {
......
......@@ -5,8 +5,8 @@ package com.jz.dm.gateway.impl;
import com.jz.dm.filter.FilterChain;
import com.jz.dm.filter.FilterChainFactory;
import com.jz.dm.gateway.GatewayService;
import com.jz.dm.model.GatewayRequest;
import com.jz.dm.model.GatewayResponse;
import com.jz.dm.models.enity.GatewayRequest;
import com.jz.dm.models.enity.GatewayResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -24,7 +24,6 @@ public class GatewayServiceImpl implements GatewayService {
@Override
public GatewayResponse invoke(GatewayRequest gatewayRequest) {
GatewayResponse gatewayResponse = new GatewayResponse();
System.out.println("经过了网关服务~~~~~~~~~~~~~~~~~~~~");
FilterChain filterChain = filterChainFactory.getFilterChain();
filterChain.doFilter(gatewayRequest, gatewayResponse);
return gatewayResponse;
......
package com.jz.dm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jz.dm.models.domian.ApiAuth;
/**api授权信息表 mapper
* @author zc
*
*/
public interface ApiAuthMapper extends BaseMapper<ApiAuth> {
}
package com.jz.dm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jz.dm.models.domian.ApiInterface;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mapper
* @PROJECT_NAME: jz-dm-parent
* @NAME: ApiInterfaceMapper
* @DATE: 2020-12-22/15:05
* @DAY_NAME_SHORT: 周二
* @Description:
**/
public interface ApiInterfaceMapper extends BaseMapper<ApiInterface> {
}
package com.jz.dm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jz.dm.models.domian.ApiOpenApiEsFields;
/**apiEs字段信息表 mapper
* @author ybz
*
*/
public interface ApiOpenApiEsFieldsMapper extends BaseMapper<ApiOpenApiEsFields> {
}
package com.jz.dm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jz.dm.models.domian.ApiOpenApiEsTagconfig;
/**apiEs配置信息表 mapper
* @author ZC
*/
public interface ApiOpenApiEsTagconfigMapper extends BaseMapper<ApiOpenApiEsTagconfig> {
}
package com.jz.dm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jz.dm.models.domian.ApiOrg;
/**api组织信息表 mapper
* @author zc
*
*/
public interface ApiOrgMapper extends BaseMapper<ApiOrg> {
}
package com.jz.dm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jz.dm.models.domian.ApiReqLog;
/**api请求日志表 mapper
* @author ybz
*/
public interface ApiReqLogMapper extends BaseMapper<ApiReqLog> {
}
package com.jz.dm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jz.dm.models.domian.ApiSyncingDatasource;
/**api数据源配置信息表 mapper
* @author ybz
*
*/
public interface ApiSyncingDatasourceMapper extends BaseMapper<ApiSyncingDatasource> {
}
package com.jz.dm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jz.dm.models.domian.ApiSyncingDatasourceType;
/**api数据源类型信息表 mapper
* @author ybz
*
*/
public interface ApiSyncingDatasourceTypeMapper extends BaseMapper<ApiSyncingDatasourceType> {
}
package com.jz.dm.model.signtype;
import com.jz.dm.common.util.Base64;
import com.jz.dm.common.util.StreamUtil;
import org.apache.commons.lang3.StringUtils;
import java.io.*;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.HashMap;
import java.util.Map;
public class SHA256WithRSA {
public static final String SIGN_TYPE_RSA = "RSA";
public static final String SIGN_SHA256RSA_ALGORITHMS = "SHA256WithRSA";
/**
* RSA签名
*
* @param content 待签名数据
* @param privateKey 商户私钥
* @param input_charset 编码格式
* @return 签名值
*/
public static String sign(String content, String privateKey, String input_charset) {
try {
PrivateKey priKey = getPrivateKeyFromPKCS8(SIGN_TYPE_RSA, new ByteArrayInputStream(privateKey.getBytes()));
Signature signature = Signature.getInstance(SIGN_SHA256RSA_ALGORITHMS);
signature.initSign(priKey);
signature.update(content.getBytes(input_charset));
return new String(Base64.encodeBase64(signature.sign()));
} catch (Exception e) {
}
return null;
}
/**
* RSA验签名检查
*
* @param content 待签名数据
* @param sign 签名值
* @param ali_public_key 支付宝公钥
* @param input_charset 编码格式
* @return 布尔值
*/
public static boolean verify(String content, String sign, String publicKey, String input_charset) {
try {
PublicKey pubKey = getPublicKeyFromX509(SIGN_TYPE_RSA, new ByteArrayInputStream(publicKey.getBytes()));
Signature signature = Signature.getInstance(SIGN_SHA256RSA_ALGORITHMS);
signature.initVerify(pubKey);
signature.update(content.getBytes(input_charset));
return signature.verify(Base64.decodeBase64(sign.getBytes()));
} catch (Exception e) {
}
return false;
}
public static PrivateKey getPrivateKeyFromPKCS8(String algorithm, InputStream ins) throws Exception {
if (ins == null || StringUtils.isEmpty(algorithm)) {
return null;
}
KeyFactory keyFactory = KeyFactory.getInstance(algorithm);
byte[] encodedKey = StreamUtil.readText(ins).getBytes();
encodedKey = Base64.decodeBase64(encodedKey);
return keyFactory.generatePrivate(new PKCS8EncodedKeySpec(encodedKey));
}
public static PublicKey getPublicKeyFromX509(String algorithm, InputStream ins) throws Exception {
KeyFactory keyFactory = KeyFactory.getInstance(algorithm);
StringWriter writer = new StringWriter();
StreamUtil.io(new InputStreamReader(ins), writer);
byte[] encodedKey = writer.toString().getBytes();
encodedKey = Base64.decodeBase64(encodedKey);
return keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey));
}
private static java.util.Base64.Decoder decoder = java.util.Base64.getDecoder();
private static java.util.Base64.Encoder encoder = java.util.Base64.getEncoder();
public static Map<String, byte[]> generateKeyBytes() {
try {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(SIGN_TYPE_RSA);
keyPairGenerator.initialize(2048);
KeyPair keyPair = keyPairGenerator.generateKeyPair();
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
Map<String, byte[]> keyMap = new HashMap<String, byte[]>();
keyMap.put("PUBLIC_KEY", publicKey.getEncoded());
keyMap.put("PRIVATE_KEY", privateKey.getEncoded());
return keyMap;
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return null;
}
public static void main(String[] args) throws UnsupportedEncodingException {
Map<String, byte[]> a = generateKeyBytes();
String key = encoder.encodeToString(a.get("PRIVATE_KEY"));
String pkey = encoder.encodeToString(a.get("PUBLIC_KEY"));
String content = "abc";
String sign = SHA1WithRSA.sign(content, key, "utf-8");
System.out.println(SHA1WithRSA.verify(content, sign, pkey, "utf-8"));
}
}
package com.jz.dm.models.domian;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jz.dm.models.enity.BaseObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Description:
* @Author: Mr.zhang
* @Date: 2020-12-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@Accessors(chain = true)
@TableName("t_api_auth")
public class ApiAuth extends BaseObject implements Serializable {
/**
* api信息表id
*/
@TableField("api_interface_id")
private Long apiInterfaceId;
/**
* api组织id
*/
@TableField("api_org_id")
private Long apiOrgId;
/**
* 授权类型:1.数据银行购买 2.dmp授权
*/
@TableField("auth_type")
private String authType;
/**
* 授权码
*/
@TableField("auth_code")
private String authCode;
/**
* 盐值
*/
@TableField("salt")
private String salt;
/**
* 组织id
*/
@TableField("org_id")
private Long orgId;
/**
* 授权方式:1.按次调用 2.按月调用 3.按季调用 4.按年调用
*/
@TableField("auth_mode")
private String authMode;
/**
* 开始时间
*/
@ApiModelProperty("开始时间")
@TableField("valid_start_time")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date validStartTime;
/**
* 结束时间
*/
@ApiModelProperty("结束时间")
@TableField("valid_end_time")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date validEndTime;
/**
* 状态(1-正常 2-作废)
*/
@TableField("status")
private String status;
}
package com.jz.dm.models.domian;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jz.dm.models.enity.BaseObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @Description:
* @Author: Mr.zhang
* @Date: 2020-12-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@Accessors(chain = true)
@TableName("t_api_interface")
public class ApiInterface extends BaseObject implements Serializable {
/**
* api唯一标识
*/
@TableField("api_key")
private String apiKey;
/**
* api名称
*/
@TableField("api_name")
private String apiName;
/**
* api描述
*/
@TableField("api_desc")
private String apiDesc;
/**
* api请求协议:http,https
*/
@TableField("api_protocl")
private String apiProtocl;
/**
* 目标url
*/
@TableField("target_url")
private String targetUrl;
/**
* 状态(1-草稿 2-发布 3-过时 4-冻结 5-失效)
*/
@TableField("status")
private String status;
/**
* 版本号
*/
@TableField("version")
private String version;
/**
* 加密方式: MD5 RSA
*/
@TableField("sign_type")
private String signType;
/**
* 超时时间
*/
@TableField("timeout")
private String timeout;
/**
* 是否测试数据:0 否,1 是
*/
@TableField("is_test")
private Integer isTest;
}
package com.jz.dm.models.domian;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jz.dm.models.enity.BaseObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**apiEs字段信息表
* @author ybz
*
*/
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@Accessors(chain = true)
@TableName("t_api_open_api_es_fields")
public class ApiOpenApiEsFields extends BaseObject implements Serializable {
/**
* 源数据库
*/
@TableField("es_database")
private String esDatabase;
/**
* 源表
*/
@TableField("es_table")
private String esTable;
/**
* 字段名称
*/
@TableField("field_name")
private String fieldName;
/**
* 字段类型
*/
@TableField("field_type")
private String fieldType;
/**
* 字段描述
*/
@TableField("field_desc")
private String fieldDesc;
}
package com.jz.dm.models.domian;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jz.dm.models.enity.BaseObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**apiEs配置信息表
* @author ybz
*
*/
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@Accessors(chain = true)
@TableName("t_api_open_api_es_tagconfig")
public class ApiOpenApiEsTagconfig extends BaseObject implements Serializable {
/**
* 工程id
*/
@TableField("project_id")
private Long projectId;
/**
* app_id
*/
@TableField("app_id")
private String appId;
/**
* api_id
*/
@TableField("api_id")
private String apiId;
/**
* api类型
*/
@TableField("api_type")
private String apiType;
/**
* api唯一标识
*/
@TableField("api_key")
private String apiKey;
/**
* 数据源id
*/
@TableField("es_data_source")
private String esDataSource;
/**
* 源数据库名称
*/
@TableField("es_data_base")
private String esDataBase;
/**
* 源数据表名称
*/
@TableField("es_table")
private String esTable;
/**
* 请求参数集合
*/
@TableField("request_param")
private String requestParam;
/**
* 响应参数集合
*/
@TableField("result_param")
private String resultParam;
/**
* 是否分页
*/
@TableField("page")
private String page;
/**
* 处理类型
*/
@TableField("handle_type")
private String handleType;
}
package com.jz.dm.models.domian;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jz.dm.models.enity.BaseObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @Description:
* @Author: Mr.zhang
* @Date: 2020-12-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@Accessors(chain = true)
@TableName("t_api_org")
public class ApiOrg extends BaseObject implements Serializable {
/**
* 组织编码(组织唯一标识)
*/
@TableField("org_code")
private String orgCode;
/**
* 组织名称
*/
@TableField("org_name")
private String orgName;
/**
* 组织描述
*/
@TableField("org_desc")
private String orgDesc;
/**
* 组织英文名称
*/
@TableField("org_cn_name")
private String orgCnName;
/**
* 状态(1-正常 2-冻结 3-下架)
*/
@TableField("status")
private String status;
/**
* 组织邮箱
*/
@TableField("org_mail")
private String orgMail;
/**
* 组织排序
*/
@TableField("org_sort")
private Integer orgSort;
/**
* 父类组织编码
*/
@TableField("parent_id")
private String parentId;
}
package com.jz.dm.models.domian;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jz.dm.models.enity.BaseObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**api请求日志表
* @author ybz
*
*/
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@Accessors(chain = true)
@TableName("t_api_req_log")
public class ApiReqLog extends BaseObject implements Serializable {
/**
* 请求ip
*/
@TableField("request_ip")
private String requestIp;
/**
* apikey
*/
@TableField("api_key")
private String apiKey;
/**
* 请求参数
*/
@TableField("request_params")
private String requestParams;
/**
* 返回参数
*/
@TableField("response_params")
private String responseParams;
/**
* 请求路径
*/
@TableField("request_url")
private String requestUrl;
/**
* 请求方法
*/
@TableField("request_method")
private String requestMethod;
/**
* 请求类型(方式)
*/
@TableField("request_type")
private String requestType;
/**
* 加密方式:MD5,RSA
*/
@TableField("encry_mode")
private String encryMode;
/**
* 传输方式:POST,GET
*/
@TableField("trans_mode")
private String transMode;
/**
* 客户请求token
*/
@TableField("request_token")
private String requestToken;
/**
* 请求时间
*/
@ApiModelProperty("请求时间")
@TableField("request_time")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date requestTime;
}
package com.jz.dm.models.domian;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jz.dm.models.enity.BaseObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**api数据源配置信息表
* @author ybz
*
*/
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@Accessors(chain = true)
@TableName("t_api_syncing_datasource")
public class ApiSyncingDatasource extends BaseObject implements Serializable {
/**
* 数据源类型ID
*/
@TableField("datasource_type")
private Long datasourceType;
/**
* 数据源名称
*/
@TableField("datasource_name")
private String datasourceName;
/**
* 数据源描述
*/
@TableField("datasource_desc")
private String datasourceDesc;
/**
* 项目编号
*/
@TableField("project_id")
private Long projectId;
/**
* JDBC URL
*/
@TableField("jdbc_url")
private String jdbcUrl;
/**
* 数据库名
*/
@TableField("db_name")
private String dbName;
/**
* 账号
*/
@TableField("user_name")
private String userName;
/**
* 密码
*/
@TableField("password")
private String password;
/**
* 终端信息
*/
@TableField("endpoint")
private String endpoint;
/**
* Bucket信息
*/
@TableField("bucket")
private String bucket;
/**
* accessId
*/
@TableField("access_id")
private String accessId;
/**
* accessKey
*/
@TableField("access_key")
private String accessKey;
/**
* FTP协议
*/
@TableField("protocol")
private String protocol;
/**
* IP
*/
@TableField("host")
private String host;
/**
* 端口
*/
@TableField("port")
private String port;
/**
* NameNode地址
*/
@TableField("default_fs")
private String defaultFs;
/**
* 表空间
*/
@TableField("table_schema")
private String tableSchema;
/**
* 数据状态
*/
@TableField("data_status")
private String dataStatus;
}
package com.jz.dm.models.domian;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jz.dm.models.enity.BaseObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @Description:
* @Author: Mr.zhang
* @Date: 2020-12-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@Accessors(chain = true)
@TableName("t_api_syncing_datasource_type")
public class ApiSyncingDatasourceType extends BaseObject implements Serializable {
/**
* 数据源名称
*/
@TableField("datasource")
private String datasource;
/**
* 数据源分类编码
*/
@TableField("datasource_catecode")
private String datasourceCatecode;
/**
* 数据源分类名称
*/
@TableField("datasource_catename")
private String datasourceCatename;
/**
* 数据源类型
*/
@TableField("datasource_type")
private String datasourceType;
/**
* 数据源图标
*/
@TableField("img_url")
private String imgUrl;
/**
* 状态
*/
@TableField("data_status")
private String dataStatus;
/**
* 是否启用
*/
@TableField("is_enabled")
private String isEnabled;
/**
*
*/
@TableField("datasource_catetype")
private String datasourceCatetype;
/**
*
*/
@TableField("driver_class_name")
private String driverClassName;
/**
* 是否启用测试
*/
@TableField("is_enable_test")
private String isEnableTest;
/**
*
*/
@TableField("default_source_script")
private String defaultSourceScript;
/**
*
*/
@TableField("default_target_script")
private String defaultTargetScript;
/**
* 是否启用源
*/
@TableField("is_enable_source")
private String isEnableSource;
/**
* 是否启用目标
*/
@TableField("is_enable_target")
private String isEnableTarget;
}
package com.jz.dm.models.enity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.enity
* @PROJECT_NAME: jz-dm-parent
* @NAME: BaseObject
* @DATE: 2020-12-22/14:03
* @DAY_NAME_SHORT: 周二
* @Description: 日期处理公共类
**/
@Data
public class BaseObject implements Serializable {
/**
* 主健ID
*/
@ApiModelProperty("主健ID")
@TableId(value = "id", type = IdType.AUTO)
private long id;
/**
* 创建日期
*/
@ApiModelProperty("创建日期")
@TableField("create_date")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createDate;
/**
* 创建人
*/
@ApiModelProperty("创建人")
@TableField("create_user")
private String createUser;
/**
* 更新人
*/
@ApiModelProperty("更新人")
@TableField("update_user")
private String updateUser;
/**
* 更新日期
*/
@ApiModelProperty("更新日期")
@TableField("update_date")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateDate;
/**
* 是否删除
*/
@TableField("is_deleted")
private Integer isDeleted;
/**
* 备注
*/
@TableField("remark")
private String remark;
}
package com.jz.dm.models.enity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.enity
* @PROJECT_NAME: jz-dm-parent
* @NAME: BaseRequest
* @DATE: 2020-12-22/15:14
* @DAY_NAME_SHORT: 周二
* @Description:
**/
@Data
public class BaseRequest {
@ApiModelProperty("当前页码")
private long pageNum = 1;
@ApiModelProperty("每页条数")
private long pageSize = 20;
}
package com.jz.dm.model;
package com.jz.dm.models.enity;
import java.io.Serializable;
import java.util.HashMap;
......
package com.jz.dm.model;
package com.jz.dm.models.enity;
import com.jz.dm.web.annotation.ParamName;
......@@ -10,7 +10,7 @@ import java.util.Map;
/**
* api请求
*
* @author key
* @author ZC
*/
public class GatewayRequest implements Serializable {
......
package com.jz.dm.model;
package com.jz.dm.models.enity;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.annotation.JSONType;
......
package com.jz.dm.model;
package com.jz.dm.models.enity;
import com.alibaba.fastjson.JSON;
import com.jz.dm.model.enums.RouteType;
import com.jz.dm.models.enums.RouteType;
import java.util.Date;
import java.util.HashMap;
......
package com.jz.dm.model;
package com.jz.dm.models.enity;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......
package com.jz.dm.model.enums;
package com.jz.dm.models.enums;
/**
* 数据格式
*
* @author zc
*/
public enum Format {
JSON, XML
JSON,
XML;
}
package com.jz.dm.model.enums;
package com.jz.dm.models.enums;
......@@ -47,14 +47,9 @@ public enum GatewayResultCode implements ResultCode {
/** ip不允许访问 */
IP_NOT_ALLOW_ACCESS("IP_NOT_ALLOW_ACCESS", "ip不允许访问"),
/** ip不允许访问 */
IP_NOT_CONFIG("IP_NOT_CONFIG", "未配置白名单"),
/** 提交数据过大 */
POST_DATA_TOO_LARGE("POST_DATA_TOO_LARGE", "提交数据过大"),
/** 调用转发异常 */
DISPATCHER_EXCEPTION("DISPATCHER_EXCEPTION", "调用转发异常");
POST_DATA_TOO_LARGE("POST_DATA_TOO_LARGE", "提交数据过大");
/**
* 初始化保存到map里方便根据code获取
......
package com.jz.dm.model.enums;
package com.jz.dm.models.enums;
/**
* 路由类型
......@@ -8,9 +8,6 @@ public enum RouteType {
/**
* 漏油类型
*/
SRPING,
/**
* 路由网关
*/
SPRINGBOOT;
SRPING;
}
package com.jz.dm.service;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.service
* @PROJECT_NAME: jz-dm-parent
* @NAME: AuthService
* @DATE: 2020-12-23/16:46
* @DAY_NAME_SHORT: 周三
* @Description:
**/
public interface AuthService {
}
package com.jz.dm.service;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.service
* @PROJECT_NAME: jz-dm-parent
* @NAME: OrganizationManageService
* @DATE: 2020-12-23/16:49
* @DAY_NAME_SHORT: 周三
* @Description:
**/
public interface OrganizationManageService {
}
package com.jz.dm.service;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.service
* @PROJECT_NAME: jz-dm-parent
* @NAME: ProducerService
* @DATE: 2020-12-23/16:56
* @DAY_NAME_SHORT: 周三
* @Description:
**/
public interface ProducerService {
}
package com.jz.dm.service;
package com.jz.dm.service.apirequest;
import com.jz.dm.common.util.OpenApiRequest;
import com.jz.dm.common.util.OpenApiResponse;
......@@ -6,9 +6,18 @@ import com.jz.dm.gateway.OpenApiService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.service.apirequest
* @PROJECT_NAME: jz-dm-parent
* @NAME: ApiQueryService
* @DATE: 2020-12-23/18:10
* @DAY_NAME_SHORT: 周三
* @Description:
**/
@Service("apiQueryService")
@Slf4j
public class AccountAddService implements OpenApiService {
public class ApiQueryService implements OpenApiService {
@Override
public String getOpenApiMethod() {
return "query";
......@@ -16,12 +25,11 @@ public class AccountAddService implements OpenApiService {
@Override
public String getOpenApiVersion() {
return "V1.0.0";
return "1.0.0";
}
@Override
public void doService(OpenApiRequest request, OpenApiResponse response) {
System.out.println("请求过来了。。。。。");
System.out.println(request);
}
}
package com.jz.dm.service.impl;
import com.jz.dm.service.AuthService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.service.impl
* @PROJECT_NAME: jz-dm-parent
* @NAME: AuthServiceImpl
* @DATE: 2020-12-23/16:48
* @DAY_NAME_SHORT: 周三
* @Description:
**/
@Service("authService")
@Slf4j
public class AuthServiceImpl implements AuthService {
}
package com.jz.dm.service.impl;
import com.jz.dm.service.OrganizationManageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.service.impl
* @PROJECT_NAME: jz-dm-parent
* @NAME: OrganizationManageImpl
* @DATE: 2020-12-23/16:50
* @DAY_NAME_SHORT: 周三
* @Description:
**/
@Service("organizationManageService")
@Slf4j
public class OrganizationManageImpl implements OrganizationManageService {
}
package com.jz.dm.service.impl;
import com.jz.dm.service.ProducerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.service.impl
* @PROJECT_NAME: jz-dm-parent
* @NAME: ProducerServiceImpl
* @DATE: 2020-12-23/16:57
* @DAY_NAME_SHORT: 周三
* @Description:
**/
@Service("producerService")
@Slf4j
public class ProducerServiceImpl implements ProducerService {
}
......@@ -4,7 +4,7 @@ spring:
basic:
enabled: false
datasource:
url: jdbc:mysql://rm-wz9n399q2avsy3k6m4o.mysql.rds.aliyuncs.com:3306/wj-mkt-project?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
url: jdbc:mysql://119.23.32.151:3306/api_gateway?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
username: root
password: I%ou$buy!ok
driver-class-name: com.mysql.jdbc.Driver
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.jz.dm.mapper.ApiAuthMapper" >
<sql id="Base_Column_List">
id, api_interface_id, api_org_id, auth_type, auth_code,
salt, org_id, auth_mode, valid_start_time, valid_end_time,
status, remark, create_date, create_user, update_date,
update_user, is_deleted
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jz.dm.mapper.ApiInterfaceMapper">
<sql id="Base_Column_List">
id, api_key, api_name, api_desc, api_protocl,
target_url, status, version, sign_type, timeout,
is_test, remark, create_date, create_user, update_date,
update_user, is_deleted
</sql>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.jz.dm.mapper.ApiOpenApiEsFieldsMapper" >
<sql id="Base_Column_List">
id, es_database, es_table, field_name, field_type,
field_desc, remark, create_date, create_user, update_date,
update_user, is_deleted
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.jz.dm.mapper.ApiOpenApiEsTagconfigMapper" >
<sql id="Base_Column_List">
id, project_id, app_id, api_id, api_type,
api_key, es_data_source, es_data_base, es_table, request_param,
result_param, page, handle_type, remark, create_date,
create_user, update_date, update_user, is_deleted
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jz.dm.mapper.ApiOrgMapper" >
<sql id="Base_Column_List">
id, org_code, org_name, org_desc, org_cn_name,
status, org_mail, org_sort, parent_id, remark,
create_date, create_user, update_date, update_user, is_deleted
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.jz.dm.mapper.ApiReqLogMapper" >
<sql id="Base_Column_List">
id, request_ip, api_key, request_params, response_params,
request_url, request_method, request_type, encry_mode, trans_mode,
request_token, request_time, remark, create_date, create_user,
update_date, update_user, is_deleted
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.jz.dm.mapper.ApiSyncingDatasourceMapper" >
<sql id="Base_Column_List">
id, datasource_type, datasource_name, datasource_desc, project_id,
jdbc_url, db_name, user_name, password, endpoint,
bucket, access_id, access_key, protocol, host,
port, default_fs, table_schema, data_status, remark,
create_date, create_user, update_date, update_user, is_deleted
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.jz.dm.mapper.ApiSyncingDatasourceTypeMapper" >
<sql id="Base_Column_List">
id, datasource, datasource_catecode, datasource_catename, datasource_type,
img_url, data_status, is_enabled, datasource_catetype, driver_class_name,
is_enable_test, default_source_script, default_target_script, is_enable_source, is_enable_target,
remark, create_date, create_user, update_date, update_user,
is_deleted
</sql>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment