Commit 0717005a authored by zhangc's avatar zhangc

添加api请求接口

parent a0979d18
......@@ -11,7 +11,7 @@ CREATE TABLE `t_api_interface` (
`api_type` varchar(50) NULL DEFAULT '' COMMENT 'api类型:1 数据银行制作API 2 数据银行制作数据包, 3 API实时接入 6 标签查询 9自定义',
`api_function` varchar(200) DEFAULT NULL COMMENT '接口功能',
`join_type` varchar(50) NULL DEFAULT NULL COMMENT '接入类型:字典表对应key值',
`test_example` varchar(255) NULL DEFAULT NULL COMMENT '测试实例';
`test_example` varchar(255) NULL DEFAULT NULL COMMENT '测试实例',
`status` varchar(50) NOT NULL COMMENT '状态(DRAFT-草稿 ISSUE-发布 OUTMODED-过时 4FREEZE-冻结 EXPIRY-失效)',
`output_type` varchar(50) NULL DEFAULT 'JSON' COMMENT '输出类型:flow 流形式输出, json格式输出',
`page` tinyint(2) NULL DEFAULT '0' COMMENT '是否分页:0 false ,1 true',
......@@ -19,6 +19,8 @@ CREATE TABLE `t_api_interface` (
`sign_type` varchar(50) DEFAULT NULL COMMENT '加密方式: MD5 RSA',
`timeout` varchar(50) DEFAULT NULL COMMENT '超时时间',
`file_id` bigint(20) NOT NULL COMMENT '文件夹id',
`req_type` varchar(20) DEFAULT NULL COMMENT '限制类型:DAY 按天,MONTH 按月, YEAR 按年',
`req_frequency` bigint(20) DEFAULT '100' COMMENT '限制次数',
`is_test` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否测试数据:0 否,1 是',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
......@@ -103,6 +105,8 @@ CREATE TABLE `t_api_auth` (
`api_interface_id` bigint(20) NOT NULL COMMENT 'api信息表id',
`api_org_id` bigint(20) NOT NULL COMMENT 'api组织id',
`auth_type` varchar(20) DEFAULT NULL COMMENT '授权类型:DATA_BANK_AUTH 数据银行购买 DMP_AUTH dmp授权',
`req_type` varchar(20) DEFAULT NULL COMMENT '限制类型:DAY 按天,MONTH 按月, YEAR 按年',
`req_frequency` bigint(20) DEFAULT '100' COMMENT '限制次数',
`auth_code` varchar(100) DEFAULT NULL COMMENT '授权码',
`salt` varchar(200) DEFAULT NULL COMMENT '盐值',
`auth_mode` varchar(50) DEFAULT NULL COMMENT '授权方式:POWER_CALL_MODE 按次调用 ,RECORD_TIME_MODE 按时间调用 PERMANENT_TIME_MODE 永久有效',
......
......@@ -97,18 +97,29 @@
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!-- 校验-->
<!-- validation校验-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!--Sentinel 限流框架依赖-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
<!-- <version>0.9.0.RELEASE</version>-->
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.2.3</version>
<classifier>jdk15</classifier><!-- jdk版本 -->
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -48,4 +48,7 @@ public class LoggingConstants {
/** "&" 符号*/
public static final String AND_SPILT = "&";
/** "=" 符号*/
public static final String AND_EQUAL = "=";
}
......@@ -67,6 +67,11 @@ public enum GatewayResultCode implements ResultCode {
ORG_STATE_EXCEPTION("ORG_STATE_EXCEPTION", "请求组织状态异常"),
/** 请求信息不存在 */
REQUEST_INFO_UNEXIST("REQUEST_INFO_UNEXIST", "请求信息不存在"),
/** 远程请求异常 */
DISTANCE_REQUEST_EXCEPTION("DISTANCE_REQUEST_EXCEPTION", "流形式输出异常"),
/** 单次调用金额不足 */
CALL_AMOUNT_NOT_ENOUGH("CALL_AMOUNT_NOT_ENOUGH", "单次调用金额不足"),
/** 输出类型错误 */
OUTPUT_TYPE_EXCEPTION("OUTPUT_TYPE_EXCEPTION", "输出类型错误!");
......
package com.jz.dm.common.enums.auth;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.common.enums.auth
* @PROJECT_NAME: jz-dm-parent
* @NAME: AuthReqTypeEnum
* @DATE: 2021-1-8/18:44
* @DAY_NAME_SHORT: 周五
* @Description:
**/
public enum AuthReqTypeEnum {
DAY("天"),
MONTH("月"),
YEAR("年");
private String text;
AuthReqTypeEnum(String text) {
this.text = text;
}
public String getText() {
return text;
}
public static AuthReqTypeEnum fromAuthReqTypeEnum(String typeName) {
for (AuthReqTypeEnum type : AuthReqTypeEnum.values()) {
if (type.name().equals(typeName)) {
return type;
}
}
return null;
}
}
package com.jz.dm.common.util;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* @author ZC
......@@ -27,7 +29,44 @@ public class DateUtil {
return (cal.getTimeInMillis() - System.currentTimeMillis()) / 1000;
}
/**
* 计算当前距离下月一号剩余时间
* @return
*/
public static long calculateNowMonthTime(){
Calendar c = Calendar.getInstance();//获取一个Calendar对象
c.setTime(new Date() );
c.add(Calendar.MONTH, 1);
c.set(Calendar.DAY_OF_MONTH, 0);
c.set(Calendar.HOUR_OF_DAY, 23);
c.set(Calendar.MINUTE, 59);
c.set(Calendar.SECOND, 59);
return (c.getTimeInMillis() - System.currentTimeMillis()) / 1000;
}
public static void main(String[] args) {
System.out.println(calculateNowResidueTime());
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//System.out.println(calculateNowResidueTime());
Calendar c = Calendar.getInstance();//获取一个Calendar对象
c.setTime(new Date() );
c.add(Calendar.MONTH, 1);
c.set(Calendar.DAY_OF_MONTH, 0);
c.set(Calendar.HOUR_OF_DAY, 23);
c.set(Calendar.MINUTE, 59);
c.set(Calendar.SECOND, 59);
Date time = c.getTime();
String format = dateFormat.format(time);
System.out.println(format);
Calendar cal = Calendar.getInstance();//获取一个Calendar对象
cal.setTime(new Date() );
cal.add(Calendar.MONTH, 0);//获取当前时间的下一个月
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));//获取下一个月的最后一天
Date preMonth=cal.getTime();//得到下个月的最后一天
String format1 = dateFormat.format(preMonth);
System.out.println(format1);
System.out.println(calculateNowMonthTime()/60/60/24);
}
}
package com.jz.dm.common.util;
import com.alibaba.fastjson.JSON;
import com.jz.dm.common.constant.LoggingConstants;
import org.apache.commons.lang3.StringUtils;
import java.io.UnsupportedEncodingException;
......@@ -30,9 +31,9 @@ public class MapUtil {
*/
public static String getSignValue(String apiKey,String method,String signType,String timestamp){
StringBuilder builder = new StringBuilder();
builder.append("apiKey=").append(apiKey).append("&")
.append("method=").append(method).append("&")
.append("signType=").append(signType).append("&")
builder.append("apiKey=").append(apiKey).append(LoggingConstants.AND_SPILT)
.append("method=").append(method).append(LoggingConstants.AND_SPILT)
.append("signType=").append(signType).append(LoggingConstants.AND_SPILT)
.append("timestamp=").append(timestamp);
return builder.toString();
}
......
package com.jz.dm.common.util.stream;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.*;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
import static com.jz.common.utils.HttpClientPool.getHttpClient;
/**
* @author ZC
* @PACKAGE_NAME: com.sentinel.project.util
* @PROJECT_NAME: jz-dm-parent
* @NAME: HttpDownload
* @DATE: 2021-1-7/18:04
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Slf4j
public class HttpDownload {
public static final int cache = 10 * 1024;
public static final boolean isWindows;
public static final String splash;
public static final String root;
static {
if (System.getProperty("name") != null && System.getProperty("name").toLowerCase().contains("windows")) {
isWindows = true;
splash = "\\";
root = "D:";
} else {
isWindows = false;
splash = "/";
root = "/search";
}
}
/**
* 根据url下载文件,文件名从response header头中获取
*
* @param url
* @return
*/
public static void download(String url) {
download(url, null);
}
/**
* 根据url下载文件,保存到filepath中
*
* @param baseUrl
* @param filepath
* @return
*/
public static void download(String baseUrl, String filepath) {
InputStream is = null;
FileOutputStream fileOut = null;
try {
CloseableHttpClient client = getHttpClient();
HttpGet httpGet = new HttpGet(baseUrl);
HttpResponse response = client.execute(httpGet);
//获取消息头
Header[] headers = response.getAllHeaders();
for (Header header : headers) {
System.out.println(MessageFormat.format("header:{0}={1}", header.getName(), header.getValue()));
}
String fileName = response.getHeaders("Content-Disposition")[0].getValue().split("filename=")[1];
System.out.println("文件名为" + fileName);
HttpEntity entity = response.getEntity();
is = entity.getContent();
if (fileName == null) {
fileName = getFilePath(response);
}
if (filepath != null) {
fileName = filepath + splash + fileName;
}else {
fileName= splash + fileName;
}
File file = new File(fileName);
file.getParentFile().mkdirs();
fileOut = new FileOutputStream(file);
/**
* 根据实际运行效果 设置缓冲区大小
*/
byte[] buffer = new byte[cache];
int ch = 0;
while ((ch = is.read(buffer)) != -1) {
fileOut.write(buffer, 0, ch);
}
fileOut.flush();
log.info("文件下载成功!");
} catch (Exception e) {
log.info("数据下载异常:{}", e.getMessage());
e.printStackTrace();
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (null != fileOut) {
try {
fileOut.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
/**
* 获取response要下载的文件的默认路径
*
* @param response
* @return
*/
public static String getFilePath(HttpResponse response) {
String filepath = root + splash;
String filename = getFileName(response);
if (filename != null) {
filepath += filename;
} else {
filepath += getRandomFileName();
}
return filepath;
}
/**
* 获取response header中Content-Disposition中的filename值
*
* @param response
* @return
*/
public static String getFileName(HttpResponse response) {
Header contentHeader = response.getFirstHeader("Content-Disposition");
String filename = null;
if (contentHeader != null) {
HeaderElement[] values = contentHeader.getElements();
if (values.length == 1) {
NameValuePair param = values[0].getParameterByName("filename");
if (param != null) {
try {
//filename = new String(param.getValue().toString().getBytes(), "utf-8");
//filename=URLDecoder.decode(param.getValue(),"utf-8");
filename = param.getValue();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
return filename;
}
/**
* 获取随机文件名
*
* @return
*/
public static String getRandomFileName() {
return String.valueOf(System.currentTimeMillis());
}
public static void outHeaders(HttpResponse response) {
Header[] headers = response.getAllHeaders();
for (int i = 0; i < headers.length; i++) {
System.out.println(headers[i]);
}
}
public static void main(String[] args) {
String zip = "http://192.168.1.140:8090/api/download/";
String text = "http://192.168.1.140:8090/api/download/txt";
String docx = "http://192.168.1.140:8090/api/download/docx";
String pdf = "http://192.168.1.140:8090/api/download/pdf";
String xlsx = "http://192.168.1.140:8090/api/download/xlsx";
String filepath = "C:\\Users\\key\\Desktop\\ideaIU-2019.3.3";
HttpDownload.download(xlsx, filepath);
}
}
package com.jz.dm.config;
import com.alibaba.csp.sentinel.annotation.aspectj.SentinelResourceAspect;
import com.alibaba.csp.sentinel.slots.block.RuleConstant;
import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRule;
import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRuleManager;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.config
* @PROJECT_NAME: jz-dm-parent
* @NAME: SentinelConfig
* @DATE: 2021-1-7/15:57
* @DAY_NAME_SHORT: 周四
* @Description: 限流熔断初始化配置
**/
@Configuration
public class SentinelConfig {
@Bean
public SentinelResourceAspect sentinelResourceAspect() {
return new SentinelResourceAspect();
}
/**
* 默认最大请求数
*/
@Value("${sentinel.request.max}")
private Integer defaultMaxRequest;
/**
* 限流/熔断资源配置
*/
@Value("${sentinel.resource}")
private String limitSource ;
@PostConstruct
private void initFlowRules() {
List<FlowRule> rules = new ArrayList<>();
FlowRule rule = new FlowRule();
rule.setResource(limitSource);
rule.setGrade(RuleConstant.FLOW_GRADE_QPS);
rule.setCount(defaultMaxRequest); //每秒中可以有多少个请求
rules.add(rule);
FlowRuleManager.loadRules(rules);
//降级规则,可以多个degradeRule rule
//DegradeRuleManager.getRules()可以获取到已经设置的降级规则
List<DegradeRule> degradeRules = new ArrayList<>();
DegradeRule degradeRule = new DegradeRule();
//设置资源名称,sentinel降级都是以资源为单位进行
degradeRule.setResource(limitSource);
//使用异常统计降级,分钟统计,滑动时间窗口
degradeRule.setGrade(RuleConstant.DEGRADE_GRADE_EXCEPTION_COUNT);
//异常数达到的数量阈值
degradeRule.setCount(defaultMaxRequest);
//秒级时间窗口,该值必须有且必须大于零,否则降级将无法生效
degradeRule.setTimeWindow(1);
degradeRules.add(degradeRule);
//重新加载限流规则,此处将覆盖原有的限流,所以如果想要不覆盖
//请使用DegradeRuleManager.getRules()获取到的加入到rules中
DegradeRuleManager.loadRules(degradeRules);
}
}
package com.jz.dm.filter;
import com.alibaba.fastjson.JSONObject;
import com.jz.common.utils.HttpsUtils;
import com.jz.common.utils.RedisUtils;
import com.jz.dm.common.constant.Constants;
import com.jz.dm.common.constant.LoggingConstants;
import com.jz.dm.common.enums.GatewayResultCode;
import com.jz.dm.common.enums.apiInterface.ApiStatusEnum;
import com.jz.dm.common.enums.auth.AuthReqTypeEnum;
import com.jz.dm.common.enums.org.OrgStatusEnum;
import com.jz.dm.common.exception.GatewayException;
import com.jz.dm.common.util.DateUtil;
......@@ -51,9 +53,10 @@ public class AuthFilter extends AbstractFilter {
private ApiInterfaceService apiInterfaceService;
@Autowired
private RedisUtils redisUtils;
@Value("${request.limit.max}")
private Long limit;
@Autowired
private HttpsUtils httpUtils;
@Value("${data.bank.balanceUrl}")
private String balanceUrl;
@Override
public String getFilterName() {
......@@ -124,15 +127,23 @@ public class AuthFilter extends AbstractFilter {
throw new GatewayException(GatewayResultCode.ORG_STATE_EXCEPTION);
}
//查询数据银行银行余额是否充足
getDataAmountResult(request);
try { //记录请求次数(每天限制请求次数)
String limitKey = request.getApiKey() + LoggingConstants.AND_SPILT + authCode;
String reqKey = redisUtils.get(limitKey);
long timeOut = DateUtil.calculateNowResidueTime();
long timeOut =0;
if (AuthReqTypeEnum.DAY.name().equals(authAuth.getReqType())){ //按天
timeOut = DateUtil.calculateNowResidueTime();
}else if (AuthReqTypeEnum.MONTH.name().equals(authAuth.getReqType())){//按月
timeOut=DateUtil.calculateNowMonthTime();
}else if (AuthReqTypeEnum.YEAR.name().equals(authAuth.getReqType())){//按年
//暂时不支持年
}
if (null != reqKey) {
Integer value = Integer.valueOf(reqKey);
if (value > limit) {//超出最大请求次数
if (value > authAuth.getReqFrequency()) {//超出最大请求次数
throw new GatewayException(GatewayResultCode.REQUEST_LIMIT_EXCEPTION);
} else if (value <= limit) {
} else if (value <= authAuth.getReqFrequency()) {
redisUtils.delAndAdd(limitKey, limitKey, value + 1, timeOut);
}
} else {
......@@ -160,4 +171,26 @@ public class AuthFilter extends AbstractFilter {
throw new GatewayException(GatewayResultCode.ILLEGAL_REQUEST);
}
}
/**
* 按次调用检查余额是否充足
* @param request
*/
private void getDataAmountResult(GatewayRequest request) {
JSONObject params = JSONObject.parseObject(request.getParams());
if (null != params){
JSONObject pObject = new JSONObject();
pObject.put("assetsId",params.getInteger("assetsId"));
pObject.put("userId",params.getInteger("userId"));
pObject.put("dataPrice",params.getString("dataPrice"));
String respResult = httpUtils.submitPost(balanceUrl, pObject.toString());
JSONObject result = JSONObject.parseObject(respResult);
if (null != result){
if (200 !=result.getInteger("code")){
log.info("~~~~~~~~~~~~~~~~~~异常信息为:{}",result.getString("message"));
throw new GatewayException(GatewayResultCode.CALL_AMOUNT_NOT_ENOUGH);
}
}
}
}
}
......@@ -41,17 +41,19 @@ public class VerifySignFilter extends AbstractFilter {
protected void internalDoFilter(GatewayRequest request, GatewayResponse response,
FilterChain chain) {
try {
//对签约参数进行字典排序
String signParams = MapUtil.getSignValue(request.getApiKey(),request.getMethod(),
request.getSignType(),String.valueOf(request.getTimestamp()));
if (StringUtils.isNotBlank(signParams)){
JSONObject jsonObject = JSONObject.parseObject(request.getParams());
String authCode = jsonObject.getString("authCode");
//需要传入授权码
ApiAuth apiAuthInfo = apiInterfaceService.getApiAuthInfo(request.getApiKey(), jsonObject.getString("authCode"));
ApiAuth apiAuthInfo = apiInterfaceService.getApiAuthInfo(request.getApiKey(),authCode );
if (null == apiAuthInfo){
throw new GatewayException(GatewayResultCode.ILLEGAL_REQUEST);
}
String salt = Md5.encrypt(signParams, apiAuthInfo.getSalt());
if (!request.getSign().equals(salt)){
String sign = Md5.encrypt(signParams, apiAuthInfo.getSalt());
if (!request.getSign().equals(sign)){
throw new GatewayException(GatewayResultCode.SIGN_ERROR);
}
}else {
......
......@@ -43,6 +43,17 @@ public class ApiAuth extends BaseObject implements Serializable {
*/
@TableField("auth_type")
private String authType;
/**
* 限制类型:DAY 按天,MONTH 按月, YEAR 按年
*/
@TableField("req_type")
private String reqType;
/**
* 限制次数
*/
@TableField("req_frequency")
private Long reqFrequency;
/**
* 授权码
......
......@@ -108,6 +108,17 @@ public class ApiInterface extends BaseObject implements Serializable {
@TableField("sign_type")
private String signType;
/**
* 限制类型:DAY 按天,MONTH 按月, YEAR 按年
*/
@TableField("req_type")
private String reqType;
/**
* 限制次数
*/
@TableField("req_frequency")
private Long reqFrequency;
/**
* 超时时间
*/
......
......@@ -64,5 +64,4 @@ public class ApiInterfaceFile extends BaseObject implements Serializable {
@TableField("status")
private String status;
}
......@@ -46,6 +46,12 @@ public class ApiInterfaceReq implements Serializable {
@NotNull(message="超时时间不能为空")
public String timeout;
@ApiModelProperty(value = "限制类型:DAY 按天,MONTH 按月, YEAR 按年",required = true)
@NotNull(message = "限制类型不能为空")
public String reqType;
@ApiModelProperty(value = "限制次数",required = true)
public Long reqFrequency;
@ApiModelProperty(value = "api描述",required = false)
public String apiFunction;
......
......@@ -40,10 +40,21 @@ public class MakeDataBankApiReq implements Serializable {
@NotNull(message = "输出类型不能为空")
public String outputType;
@ApiModelProperty(value = "是否分页:",required = false)
//@NotNull(message = "是否分页不能为空")
@ApiModelProperty(value = "是否分页:",required = true)
@NotNull(message = "是否分页不能为空")
public Boolean page;
@ApiModelProperty(value = "限制类型:DAY 按天,MONTH 按月",required = true)
@NotNull(message = "限制类型不能为空")
public String reqType;
@ApiModelProperty(value = "文件id",required = true)
@NotNull(message = "文件id不能为空")
public Long fileId;
@ApiModelProperty(value = "限制次数",required = true)
public Long reqFrequency;
@ApiModelProperty(value = "请求地址",required = false)
public String apiPath;
......@@ -74,9 +85,7 @@ public class MakeDataBankApiReq implements Serializable {
@ApiModelProperty(value = "api样例",required = false)
public String apiExample;
@ApiModelProperty(value = "文件id",required = false)
//@NotNull(message = "文件id不能为空")
public Long fileId;
//-------------------------前端无效传参----------------------
//@ApiModelProperty(value = "状态",hidden = true)
......
......@@ -63,4 +63,11 @@ public interface AuthService {
* @return
*/
ApiAuth getAuthUser( String authCode,Long apiId);
/**
* 获取API授权信息
* @param authCode
* @return
*/
ApiAuth getAuthInfo( String authCode);
}
package com.jz.dm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jz.dm.common.enums.apiInterface.ApiStatusEnum;
import com.jz.dm.mapper.ApiAuthMapper;
import com.jz.dm.mapper.ApiInterfaceMapper;
import com.jz.dm.models.domian.ApiAuth;
......@@ -69,6 +70,7 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
public ApiInterface getReqTargetInfo(String apiKey) {
QueryWrapper<ApiInterface> query = new QueryWrapper<>();
query.eq("api_key",apiKey);
query.eq("status", ApiStatusEnum.ISSUE.name());
query.eq("is_deleted",0);
return apiInterfaceMapper.selectOne(query);
}
......
package com.jz.dm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jz.common.utils.Result;
import com.jz.dm.common.enums.GeneralStatusTypeEnum;
import com.jz.dm.config.ReentrantRedisLock;
import com.jz.dm.mapper.ApiReqLogMapper;
import com.jz.dm.models.domian.ApiReqLog;
......@@ -78,16 +80,23 @@ public class ApiLogServiceImpl implements ApiLogService {
@Override
public void updateLog(Long id, JSONObject jsonObject) {
try {
ApiReqLog apiReqLog = apiReqLogMapper.maxId(id);
/*ApiReqLog apiReqLog = apiReqLogMapper.maxId(id);*/
ApiReqLog apiReqLog = apiReqLogMapper.selectById(id);
if (null != apiReqLog){
ApiReqLog reqLog = new ApiReqLog();
reqLog.setId(apiReqLog.getId());
reqLog.setStatus(apiReqLog.getStatus());
reqLog.setResponseParams(jsonObject.toString());
reqLog.setUpdateDate(new Date());
apiReqLogMapper.updateById(reqLog);
UpdateWrapper<ApiReqLog> update = new UpdateWrapper<>();
if (200 == jsonObject.getInt("code")){
update.set("status", GeneralStatusTypeEnum.SUCCEED);
}else {
log.info("id为:{}",id+"-----------------日志信息不存在");
update.set("status", GeneralStatusTypeEnum.FAIL);
}
update.set("response_params",jsonObject.toString());
update.set("update_date",new Date());
update.eq("id",id);
if (apiReqLogMapper.update(null,update) == 0){
log.info("~~~~~~~~~~~更新日志信息失败~~~~~~~~");
}
}else {
log.info("id为:{}",id+"--------------日志信息不存在");
}
}catch (Exception ex){
log.error("更新日志返回信息异常:{}",ex.getMessage());
......
......@@ -189,6 +189,8 @@ public class AuthServiceImpl implements AuthService {
ApiAuth apiAuth = new ApiAuth();
apiAuth.setApiInterfaceId(apiInterface.getId());
apiAuth.setApiOrgId(apiOrg.getId());
apiAuth.setReqType(apiInterface.getReqType());
apiAuth.setReqFrequency(apiInterface.getReqFrequency());
BeanUtils.copyProperties(req, apiAuth);
//商城只有外部授权
String authCode ="";
......@@ -274,8 +276,8 @@ public class AuthServiceImpl implements AuthService {
String salt = RandomUtil.getStringRandom(8);
UpdateWrapper<ApiAuth> update = new UpdateWrapper<>();
update.set("salt", salt);
update.set("create_date", new Date());
update.set("create_user", "");
update.set("update_date", new Date());
update.set("update_user", "");
update.eq("id", apiAuth.getId());
if (apiAuthMapper.update(null, update) > 0) {
response.setSalt(salt);
......@@ -299,6 +301,18 @@ public class AuthServiceImpl implements AuthService {
query.eq("is_deleted",0);
return apiAuthMapper.selectOne(query);
}
/**
* 获取API授权信息
* @param authCode
* @return
*/
@Override
public ApiAuth getAuthInfo(String authCode) {
QueryWrapper<ApiAuth> query = new QueryWrapper<>();
query.eq("auth_code",authCode);
query.eq("is_deleted",0);
return apiAuthMapper.selectOne(query);
}
private ApiInterface getInterface(String apiKey) {
QueryWrapper<ApiInterface> queryInface = new QueryWrapper<>();
......
......@@ -38,6 +38,7 @@ import javax.annotation.Resource;
import java.util.*;
import static com.jz.dm.common.enums.apiInterface.ApiStatusEnum.fromApiStatusName;
import static com.jz.dm.common.enums.auth.AuthReqTypeEnum.fromAuthReqTypeEnum;
/**
* @author ZC
......@@ -133,6 +134,11 @@ public class ProducerServiceImpl implements ProducerService {
!req.getOutputType().contains(ApiInfoOutTypeEnum.FLOW.name()) )){
return Result.of_error("输出类型不存在!");
}
if(StringUtils.isNotBlank(req.getReqType()) ){
if (null == fromAuthReqTypeEnum(req.getReqType())){
return Result.of_error("限制类型不存在!");
}
}
String apiKey ="";
if (StringUtils.isNotBlank(req.getJoinType())
&& "10006".equals(req.getJoinType())) {//数据银行制作API
......@@ -263,6 +269,11 @@ public class ProducerServiceImpl implements ProducerService {
if (null == currentUser) {
return Result.of_error("用户信息不存在");
}
if(StringUtils.isNotBlank(req.getReqType()) ){
if (null == fromAuthReqTypeEnum(req.getReqType())){
return Result.of_error("限制类型不存在!");
}
}
QueryWrapper<ApiInterfaceFile> query = new QueryWrapper<>();
query.eq("project_id", req.getProjectId());
query.eq("parent_id", req.getParentId());
......@@ -329,6 +340,11 @@ public class ProducerServiceImpl implements ProducerService {
if (StringUtils.isBlank(req.getSignType()) || "0".equals(req.getSignType())) {
return Result.of_error("加密类型错误!");
}
if(StringUtils.isNotBlank(req.getReqType()) ){
if (null == fromAuthReqTypeEnum(req.getReqType())){
return Result.of_error("限制类型不存在!");
}
}
apiInterface.setApiType(req.getApiType());
apiInterface.setApiDesc(req.getApiDesc());
apiInterface.setJoinType(req.getJoinType());
......
package com.jz.dm.service.request;
import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.Result;
import com.jz.dm.common.enums.GeneralStatusTypeEnum;
import com.jz.dm.common.enums.apiInterface.ApiStatusEnum;
import com.jz.dm.common.exception.GatewayException;
import com.jz.dm.models.domian.ApiAuth;
import com.jz.dm.models.domian.ApiInterface;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.service.request
* @PROJECT_NAME: jz-dm-parent
* @NAME: ApiParamVerify
* @DATE: 2021-1-9/15:53
* @DAY_NAME_SHORT: 周六
* @Description: api参数验证
**/
public class ApiParamVerify {
/**
* 校验Api信息
* @param apiInterface
* @return
*/
public Result verifyApiInterface(ApiInterface apiInterface){
if (null == apiInterface){
throw new GatewayException("300",ResultMsg.DATA_NOT_FOUND.getMsg());
}
if (!ApiStatusEnum.ISSUE.name().equals(apiInterface.getStatus())){
throw new GatewayException("300","API未发布!");
}
if (1 == apiInterface.getIsDeleted()){
throw new GatewayException("300","API不存在!");
}
return Result.of_success(ResultMsg.SUCCESS);
}
/**
* 校验授权
* @param apiAuth
* @return
*/
public Result verifyAuth(ApiAuth apiAuth){
if (null == apiAuth){
throw new GatewayException("300",ResultMsg.DATA_NOT_FOUND.getMsg());
}
if (!GeneralStatusTypeEnum.VALID.name().equals(apiAuth.getStatus())){
throw new GatewayException("300","无效授权!");
}
if (1 == apiAuth.getIsDeleted()){
throw new GatewayException("300","授权信息无效!");
}
return Result.of_success(ResultMsg.SUCCESS);
}
}
......@@ -4,7 +4,6 @@ package com.jz.dm.web.aspect;
import com.jz.common.utils.IpUtils;
import com.jz.common.utils.JsonUtils;
import com.jz.common.utils.UrlUtil;
import com.jz.dm.common.enums.SignType;
import com.jz.dm.mapper.ApiReqLogMapper;
import com.jz.dm.models.domian.ApiReqLog;
import com.jz.dm.service.ApiLogService;
......@@ -17,7 +16,9 @@ import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
......@@ -36,7 +37,7 @@ import java.util.Map;
* @NAME: SystemLogAspect
* @DATE: 2020-12-25/16:03
* @DAY_NAME_SHORT: 周五
* @Description:
* @Description: 日志收集
**/
@Aspect
......@@ -85,28 +86,30 @@ public class SystemLogAspect {
log.info("around请求参数为{}", joinPoint.getArgs());
//动态修改其参数
//注意,如果调用joinPoint.proceed()方法,则修改的参数值不会生效,必须调用joinPoint.proceed(Object[] args)
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(params);
String paramsList = jsonObject.getString("params");
com.alibaba.fastjson.JSONObject jsonParamsList = com.alibaba.fastjson.JSONObject.parseObject(paramsList);
try {
ApiReqLog reqLog = new ApiReqLog();
reqLog.setRequestIp(ip);
// reqLog.setApiKey(jsonObject.getString("apiKey"));
reqLog.setApiKey(jsonObject.getString("apiKey"));
reqLog.setRequestParams(params);
reqLog.setResponseParams("");//响应参数
reqLog.setRequestUrl(url);
reqLog.setRequestMethod(contextPath);
reqLog.setEncryMode(SignType.MD5.name()); //加密方式:MD5,RSA
reqLog.setEncryMode(jsonObject.getString("signType")); //加密方式:MD5,RSA
reqLog.setTransMode(request.getMethod());//传输方式 GET POST
// reqLog.setRequestToken(token);
reqLog.setRequestToken(jsonParamsList.getString("authCode"));
reqLog.setRequestTime(new Date());
reqLog.setRemark(getServiceMethodDescription(joinPoint));
System.out.println(reqLog);
log.info("请求参数:",reqLog);
if (null != reqLog) {
apiReqLogMapper.insert(reqLog);
}
Object result = joinPoint.proceed(joinPoint.getArgs());
JSONObject jsonObject = JSONObject.fromObject(result);
log.info("around响应结果为{}", jsonObject);
apiLogService.updateLog(reqLog.getId(), jsonObject);
JSONObject jsonResult = JSONObject.fromObject(result);
log.info("around响应结果为{}", jsonResult);
apiLogService.updateLog(reqLog.getId(), jsonResult);
} catch (Throwable throwable) {
throwable.printStackTrace();
}
......
package com.jz.dm.web.interceptor;
import com.jz.common.utils.IpUtils;
import com.jz.common.utils.RedisUtils;
import com.jz.dm.web.annotation.AccessLimit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
......@@ -19,13 +21,12 @@ import java.lang.reflect.Method;
* @NAME: AccessLimitInterceptor
* @DATE: 2020-12-26/17:39
* @DAY_NAME_SHORT: 周六
* @Description:
* @Description: 使用redis限流
**/
public class AccessLimitInterceptor implements HandlerInterceptor {
//使用RedisTemplate操作redis
/* @Autowired
private RedisTemplate<String, Integer> redisTemplate;*/
@Autowired
private RedisUtils redisUtils;
@Override
public boolean preHandle(HttpServletRequest request,
......@@ -44,16 +45,17 @@ public class AccessLimitInterceptor implements HandlerInterceptor {
int limit = accessLimit.limit();
int sec = accessLimit.sec();
String key = IpUtils.getIpAddr(request) + request.getRequestURI();
/*Integer maxLimit = redisTemplate.opsForValue().get(key);
String result = redisUtils.get(key);
Integer maxLimit = Integer.valueOf(result);
if (maxLimit == null) {
//set时一定要加过期时间
redisTemplate.opsForValue().set(key, 1, sec, TimeUnit.SECONDS);
redisUtils.set(key,1,sec);
} else if (maxLimit < limit) {
redisTemplate.opsForValue().set(key, maxLimit + 1, sec, TimeUnit.SECONDS);
redisUtils.set(key, maxLimit + 1, sec);
} else {
output(response, "请求太频繁~!");
return false;
}*/
}
}
return true;
}
......
......@@ -77,6 +77,22 @@ dmp:
timeout:
default: 5000
max: 5000
request: #api请求次数
limit:
max: 10
#流处理配置
windows: #文件流输出地址设置
name: stream
isWindows: true
#sentinel限流配置
sentinel: #sentinel每秒中最大的请求个数
resource: api.gateway
request:
max: 100
#数据银行调用配置
data:
bank:
balanceUrl: http://localhost:8081/mall/financeCustomerAssets/findAssets #余额信息url
withholdUrl: http://localhost:8081/mall/financeCustomerAssets/unfreezeMoney #扣款信通知url
......@@ -19,7 +19,21 @@ spring:
max-request-size: 50MB
profiles:
active: test #默认使用的配置文件
cloud:
sentinel: #sentinel 限流框架配置
transport:
# 项目本地会启动一个服务的端口号,默认8719,用于与sentinel-dashboard通讯
port: 8719
# sentinel-dashboard服务地址 # sentinel-dashboard-1.6.0 的访问路径 ,启动方式java -jar sentinel-dashboard-1.6.0.jar
dashboard: localhost:9090
filter:
# 需要进行限流监控的接口,多个匹配用逗号隔开
url-patterns: /*
servlet:
# 触发限流后重定向的页面
block-page: /sentinel/block
#取消Sentinel控制台懒加载
#eager: true
# ====================MybatisPlus====================
mybatis-plus:
......
package com.jz.dm.gateway.api;
import com.alibaba.fastjson.JSONObject;
import com.jz.common.utils.HttpsUtils;
import com.jz.dm.common.util.MapUtil;
import com.jz.dm.common.util.Md5;
import com.jz.dm.gateway.SpringTestCase;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.gateway.api
* @PROJECT_NAME: jz-dm-parent
* @NAME: ApiReqTest
* @DATE: 2021-1-6/14:13
* @DAY_NAME_SHORT: 周三
* @Description:
**/
public class ApiReqTest extends SpringTestCase {
public static final String url ="";
@Autowired
private HttpsUtils httpsUtils;
@Test
public void TestGatewayReq() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("apiKey", "9jNA1W5Ydn7Stp12");
jsonObject.put("method", "query");
jsonObject.put("signType", "MD5");
long time = System.currentTimeMillis();
jsonObject.put("timestamp", "1609919983045");
JSONObject params = new JSONObject();
params.put("authCode", "20200000000221231111455Jg8ug1621");
params.put("selectType", "10006");
params.put("reqParams", new JSONObject());
jsonObject.put("params",params);
try {
String apiKey = jsonObject.getString("apiKey");
String method = jsonObject.getString("method");
String signType = jsonObject.getString("signType");
String timestamp= jsonObject.getString("timestamp");
String signature = MapUtil.getSignValue(apiKey, method, signType, timestamp);
String salt = Md5.encrypt(signature, "OOmeF1gh");
jsonObject.put("sign", salt);
String response = httpsUtils.submitPost(url, jsonObject.toString());
System.out.println(response);
} catch (Exception e) {
e.printStackTrace();
}
}
}
......@@ -10,7 +10,6 @@ import com.jz.dm.models.req.organizationManage.OrganizationManageDetailQueryReq;
import com.jz.dm.models.req.organizationManage.OrganizationManageListQueryReq;
import com.jz.dm.models.req.organizationManage.OrganizationManageUpdateReq;
import com.jz.dm.service.OrganizationManageService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
/**
......@@ -30,7 +29,7 @@ public class TestOrganizationManage extends SpringTestCase {
/**
* 查询类列表信息
*/
@Test
// @Test
public void getOrgList(){
OrganizationManageListQueryReq req = new OrganizationManageListQueryReq();
req.setPageNum(1);
......@@ -41,7 +40,7 @@ public class TestOrganizationManage extends SpringTestCase {
/**
* 查询详情信息
*/
@Test
// @Test
public void getOrgDetail(){
OrganizationManageDetailQueryReq req = new OrganizationManageDetailQueryReq();
req.setId(1L);
......@@ -52,7 +51,7 @@ public class TestOrganizationManage extends SpringTestCase {
/**
* 添加组织信息
*/
@Test
//@Test
public void addOrg(){
OrganizationManageAddReq req = new OrganizationManageAddReq();
req.setOrgName("数据银行");
......@@ -69,7 +68,7 @@ public class TestOrganizationManage extends SpringTestCase {
/**
* 更新组织信息
*/
@Test
//@Test
public void updateOrg(){
OrganizationManageUpdateReq req = new OrganizationManageUpdateReq();
req.setId(8L);
......
package com.jz.dm.gateway.orther;
import com.alibaba.fastjson.JSONObject;
import com.jz.common.utils.HttpsUtils;
import com.jz.dm.common.enums.GatewayResultCode;
import com.jz.dm.common.exception.GatewayException;
import com.jz.dm.gateway.SpringTestCase;
import org.junit.jupiter.api.Test;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.gateway.orther
* @PROJECT_NAME: jz-dm-parent
* @NAME: TestAmountCall
* @DATE: 2021-1-9/15:04
* @DAY_NAME_SHORT: 周六
* @Description:
**/
public class TestAmountCall extends SpringTestCase {
private static final String baseUrl ="http://192.168.1.139:8081/mall/financeCustomerAssets/findAssets";
private static final String baseUrl2 ="http://192.168.1.139:8081/mall/financeCustomerAssets/unfreezeMoney";
/* @Autowired
private HttpsUtils httpUtils;*/
@Test
public void TestDataBankReq(){
HttpsUtils utils = new HttpsUtils();
JSONObject jsonObject = new JSONObject();
jsonObject.put("assetsId",1);
jsonObject.put("userId",1);
jsonObject.put("dataPrice","50");
String respResult = utils.submitPost(baseUrl, jsonObject.toString());
JSONObject paramsResult = JSONObject.parseObject(respResult);
if (null != paramsResult){
Integer code = paramsResult.getInteger("code");
if (200 != code){
System.out.println("~~~~~~~~~~~~~~~~~~单次调用金额不足~~~~~~~~~~~~~~~");
System.out.println(respResult);
throw new GatewayException(GatewayResultCode.CALL_AMOUNT_NOT_ENOUGH);
}else {
System.out.println(paramsResult.getString("message"));
}
}
}
/**
* 通知扣款
*/
@Test
public void notifierDataBankReq(){
HttpsUtils utils = new HttpsUtils();
JSONObject jsonObject = new JSONObject();
jsonObject.put("assetsId",1);
jsonObject.put("userId",1);
jsonObject.put("dataPrice","50");
jsonObject.put("callStatus",true);//调用成功 扣款 false 调用失败,解冻金额
String respResult = utils.submitPost(baseUrl2, jsonObject.toString());
JSONObject paramsResult = JSONObject.parseObject(respResult);
if (null != paramsResult){
Integer code = paramsResult.getInteger("code");
if (200 != code){
System.out.println("~~~~~~~~~~~~~~~~~~操作失败~~~~~~~~~~~~~~~");
System.out.println(respResult);
throw new GatewayException(GatewayResultCode.CALL_AMOUNT_NOT_ENOUGH);
}else {
System.out.println(paramsResult.getString("message"));
}
}
}
}
......@@ -3,7 +3,7 @@ package com.jz.dm.gateway.orther;
import com.alibaba.fastjson.JSONObject;
import com.jz.common.utils.HttpsUtils;
import com.jz.dm.gateway.SpringTestCase;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
......
......@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.jz.common.utils.HttpsUtils;
import com.jz.dm.gateway.SpringTestCase;
import com.jz.dm.service.ProducerService;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
......
......@@ -2,7 +2,7 @@ package com.jz.dm.gateway.orther;
import com.jz.dm.common.base.BaseCurrentUserObject;
import com.jz.dm.gateway.SpringTestCase;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
......
package com.jz.dm.gateway.orther;
import com.jz.dm.gateway.SpringTestCase;
import lombok.extern.slf4j.Slf4j;
import static com.jz.dm.common.util.stream.HttpDownload.download;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.gateway.orther
* @PROJECT_NAME: jz-dm-parent
* @NAME: TestStreamReq
* @DATE: 2021-1-7/16:51
* @DAY_NAME_SHORT: 周四
* @Description:
**/
@Slf4j
public class TestStreamReq extends SpringTestCase {
private static final String baseUrl ="http://192.168.1.140:8090/api/download";
//@Test
public void testStreamReq() {
download(baseUrl);
}
}
......@@ -195,15 +195,16 @@ public class HttpsUtils {
* @param url
* @throws IOException
*/
public CloseableHttpClient doGetImg(String url) {
public CloseableHttpResponse doGetImg(String url) {
CloseableHttpClient httpClient = getHttpClient();
CloseableHttpResponse response=null;
HttpGet httpGet = new HttpGet(url);
try {
httpClient.execute(httpGet);
response = httpClient.execute(httpGet);
} catch (IOException e) {
log.error("发起http request异常:{}", e);
}
return httpClient;
return response;
}
/**
......
package com.jz.manage;
import com.jz.common.utils.DateUtils;
import com.jz.manage.moduls.controller.goods.bean.request.DataApiUpReq;
import com.jz.manage.moduls.entity.DataGoodsApiParams;
import com.jz.manage.moduls.service.DataGoodsService;
import com.jz.manage.moduls.service.SysUserService;
import com.jz.manage.moduls.service.TestUserService;
......@@ -12,10 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest
public class manageApplicationTests {
......@@ -38,29 +31,29 @@ public class manageApplicationTests {
@Test
public void getUserRoleByAccount() throws Exception {
DataApiUpReq dataApiUpReq = new DataApiUpReq();
dataApiUpReq.setApiName("华为");
dataApiUpReq.setRequestType("的撒旦");
dataApiUpReq.setApiUrl("http://localhost/dataGoods/uploadApi");
dataApiUpReq.setReturnDataExample("dadasdadafaf");
dataApiUpReq.setApiKey("5");
dataApiUpReq.setEncryMode("MD5");
dataApiUpReq.setTransMode("http");
dataApiUpReq.setApiFunction("fafafaffaf");
dataApiUpReq.setVersionNumber("1.0");
dataApiUpReq.setPriceType("01");
dataApiUpReq.setApiType("1");
dataApiUpReq.setApiDesc("fafsafafasff");
dataApiUpReq.setDataPicture("http://wx4.sinaimg.cn/bmiddle/006GJQvhly1gkx4ezwcr4j328g28g1kx.jpg");
dataApiUpReq.setYearType(BigDecimal.valueOf(1));
List<DataGoodsApiParams> paramsList = new ArrayList<>();
for (DataGoodsApiParams params : paramsList) {
params.setParamsDiff("01");
params.setParamsName("xiaomi");
params.setParamsType("哒哒哒");
params.setCreTime(DateUtils.getToday());
}
dataApiUpReq.setParamsList(paramsList);
dataGoodsService.uploadApi(dataApiUpReq);
//DataApiUpReq dataApiUpReq = new DataApiUpReq();
//dataApiUpReq.setApiName("华为");
//dataApiUpReq.setRequestType("的撒旦");
//dataApiUpReq.setApiUrl("http://localhost/dataGoods/uploadApi");
//dataApiUpReq.setReturnDataExample("dadasdadafaf");
//dataApiUpReq.setApiKey("5");
//dataApiUpReq.setEncryMode("MD5");
//dataApiUpReq.setTransMode("http");
//dataApiUpReq.setApiFunction("fafafaffaf");
//dataApiUpReq.setVersionNumber("1.0");
//dataApiUpReq.setPriceType("01");
//dataApiUpReq.setApiType("1");
//dataApiUpReq.setApiDesc("fafsafafasff");
//dataApiUpReq.setDataPicture("http://wx4.sinaimg.cn/bmiddle/006GJQvhly1gkx4ezwcr4j328g28g1kx.jpg");
//dataApiUpReq.setYearType(BigDecimal.valueOf(1));
//List<DataGoodsApiParams> paramsList = new ArrayList<>();
//for (DataGoodsApiParams params : paramsList) {
// params.setParamsDiff("01");
// params.setParamsName("xiaomi");
// params.setParamsType("哒哒哒");
// params.setCreTime(DateUtils.getToday());
//}
//dataApiUpReq.setParamsList(paramsList);
//dataGoodsService.uploadApi(dataApiUpReq);
}
}
......@@ -46,6 +46,7 @@
<springfox-swagger2.version>2.9.2</springfox-swagger2.version>
<swagger-bootstrap-ui.version>1.9.6</swagger-bootstrap-ui.version>
<lombok.version>1.18.16</lombok.version>
<spring-cloud.version>Finchley.SR1</spring-cloud.version>
</properties>
<dependencyManagement>
......@@ -66,6 +67,22 @@
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>0.1.2.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
......@@ -220,58 +237,7 @@
<module>jz-dm-apigateway</module>
</modules>
<!-- <build>-->
<!-- <defaultGoal>compile</defaultGoal>-->
<!-- <finalName>${project.artifactId}</finalName>-->
<!-- <resources>-->
<!-- <resource>-->
<!-- <directory>src/main/resources</directory>-->
<!-- <filtering>true</filtering>-->
<!-- <excludes>-->
<!-- <exclude>disconf.properties</exclude>-->
<!-- </excludes>-->
<!-- </resource>-->
<!-- </resources>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-compiler-plugin</artifactId>-->
<!-- <version>2.3.2</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>default-compile</id>-->
<!-- <phase>compile</phase>-->
<!-- <goals>-->
<!-- <goal>compile</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- <configuration>-->
<!-- <source>1.8</source>-->
<!-- <target>1.8</target>-->
<!-- <encoding>UTF-8</encoding>-->
<!-- </configuration>-->
<!-- </plugin>-->
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-resources-plugin</artifactId>-->
<!-- <version>2.5</version>-->
<!-- <configuration>-->
<!-- <encoding>UTF-8</encoding>-->
<!-- </configuration>-->
<!-- </plugin>-->
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-eclipse-plugin</artifactId>-->
<!-- <version>2.8</version>-->
<!-- <configuration>-->
<!-- <downloadSources>true</downloadSources>-->
<!-- <downloadJavadocs>false</downloadJavadocs>-->
<!-- <wtpversion>2.0</wtpversion>-->
<!-- </configuration>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
......
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