Commit 8a3abdeb authored by ysongq's avatar ysongq

commit

parent b2b3b68e
...@@ -65,7 +65,7 @@ public class AuthFilter extends AbstractFilter { ...@@ -65,7 +65,7 @@ public class AuthFilter extends AbstractFilter {
protected void internalDoFilter(GatewayRequest request, GatewayResponse response, protected void internalDoFilter(GatewayRequest request, GatewayResponse response,
FilterChain chain) { FilterChain chain) {
try { try {
ApiInterface apiInterface = apiInterfaceService.getApiInfo(request.getAppKey()); ApiInterface apiInterface = apiInterfaceService.getApiInfo(request.getApiKey());
if (null == apiInterface) { if (null == apiInterface) {
throw new GatewayException(GatewayResultCode.ILLEGAL_REQUEST); throw new GatewayException(GatewayResultCode.ILLEGAL_REQUEST);
} }
...@@ -111,7 +111,7 @@ public class AuthFilter extends AbstractFilter { ...@@ -111,7 +111,7 @@ public class AuthFilter extends AbstractFilter {
} }
//查询数据银行银行余额是否充足 //查询数据银行银行余额是否充足
try { //记录请求次数(每天限制请求次数) try { //记录请求次数(每天限制请求次数)
String limitKey = request.getAppKey() + LoggingConstants.AND_SPILT + authCode; String limitKey = request.getApiKey() + LoggingConstants.AND_SPILT + authCode;
String reqKey = redisUtils.get(limitKey); String reqKey = redisUtils.get(limitKey);
long timeOut = DateUtil.calculateNowResidueTime(); long timeOut = DateUtil.calculateNowResidueTime();
if (null != reqKey) { if (null != reqKey) {
......
...@@ -31,7 +31,7 @@ public class CheckArgsFilter extends AbstractFilter { ...@@ -31,7 +31,7 @@ public class CheckArgsFilter extends AbstractFilter {
protected void internalDoFilter(GatewayRequest request, GatewayResponse response, protected void internalDoFilter(GatewayRequest request, GatewayResponse response,
FilterChain chain) { FilterChain chain) {
// 校验参数非空 // 校验参数非空
if (StringUtil.isEmpty(request.getAppKey()) || StringUtil.isEmpty(request.getMethod()) if (StringUtil.isEmpty(request.getApiKey()) || StringUtil.isEmpty(request.getMethod())
|| StringUtil.isEmpty(request.getSignType())|| StringUtil.isEmpty(request.getSign()) || StringUtil.isEmpty(request.getSignType())|| StringUtil.isEmpty(request.getSign())
|| StringUtil.isEmpty(request.getTimestamp())|| StringUtil.isEmpty(request.getParams())) { || StringUtil.isEmpty(request.getTimestamp())|| StringUtil.isEmpty(request.getParams())) {
throw new GatewayException(GatewayResultCode.ILLEGAL_ARGUMENT); //无效参数 throw new GatewayException(GatewayResultCode.ILLEGAL_ARGUMENT); //无效参数
......
...@@ -54,7 +54,7 @@ public class InvokeRouteFilter extends AbstractFilter { ...@@ -54,7 +54,7 @@ public class InvokeRouteFilter extends AbstractFilter {
//} //}
DispatchContext context = new DispatchContext(); DispatchContext context = new DispatchContext();
context.setAppKey(request.getAppKey());//apiKey context.setAppKey(request.getApiKey());//apiKey
context.setOpenApiMethod(request.getMethod()); //方法 例如:tradd.add context.setOpenApiMethod(request.getMethod()); //方法 例如:tradd.add
context.setOpenApiParams(request.getParams());//入参 context.setOpenApiParams(request.getParams());//入参
context.setOpenApiVersion(request.getVersion()); //版本号 context.setOpenApiVersion(request.getVersion()); //版本号
......
...@@ -50,7 +50,7 @@ public class VerifySignFilter extends AbstractFilter { ...@@ -50,7 +50,7 @@ public class VerifySignFilter extends AbstractFilter {
if (CollectionUtils.isNotEmpty(signParams)){ if (CollectionUtils.isNotEmpty(signParams)){
JSONObject jsonObject = JSONObject.parseObject(request.getParams()); JSONObject jsonObject = JSONObject.parseObject(request.getParams());
//需要传入授权码 //需要传入授权码
ApiAuth apiAuthInfo = apiInterfaceService.getApiAuthInfo(request.getAppKey(), jsonObject.getString("authCode")); ApiAuth apiAuthInfo = apiInterfaceService.getApiAuthInfo(request.getApiKey(), jsonObject.getString("authCode"));
if (null == apiAuthInfo){ if (null == apiAuthInfo){
throw new GatewayException(GatewayResultCode.ILLEGAL_REQUEST); throw new GatewayException(GatewayResultCode.ILLEGAL_REQUEST);
} }
......
...@@ -107,10 +107,10 @@ public class MallCustomerServiceImpl implements MallCustomerService { ...@@ -107,10 +107,10 @@ public class MallCustomerServiceImpl implements MallCustomerService {
String telephone = customerRequest.getTelephone(); String telephone = customerRequest.getTelephone();
// 从redis获取验证码 // 从redis获取验证码
// String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone; String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
String key = "18179617425"; // String key = "18179617425";
// String codeInRedis = (String) redisTemplate.opsForValue().get(key); String codeInRedis = (String) redisTemplate.opsForValue().get(key);
String codeInRedis = "147826"; // String codeInRedis = "147826";
if (codeInRedis.equals(vailCode)) { if (codeInRedis.equals(vailCode)) {
mallCustomer.setCustomerAccount(username); mallCustomer.setCustomerAccount(username);
mallCustomer.setPassword(customerRequest.getPassword()); mallCustomer.setPassword(customerRequest.getPassword());
......
...@@ -18,6 +18,7 @@ import com.jz.dm.mall.moduls.mapper.*; ...@@ -18,6 +18,7 @@ import com.jz.dm.mall.moduls.mapper.*;
import com.jz.dm.mall.moduls.service.PayService; import com.jz.dm.mall.moduls.service.PayService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -56,6 +57,10 @@ public class PayServiceImpl implements PayService { ...@@ -56,6 +57,10 @@ public class PayServiceImpl implements PayService {
@Autowired @Autowired
private RestTemplate restTemplate; private RestTemplate restTemplate;
@Value("${domain.apigateway}")
private String apiGateway;
/** /**
* 新增订单 * 新增订单
* *
...@@ -126,7 +131,7 @@ public class PayServiceImpl implements PayService { ...@@ -126,7 +131,7 @@ public class PayServiceImpl implements PayService {
} }
BigDecimal subtract = bigDecimal.subtract(bigDecima2); BigDecimal subtract = bigDecimal.subtract(bigDecima2);
String uri = "http://47.115.53.1:8088/api/auth/mall-user-auth-api"; // TODO
AuthMallUserApiReq apiReq = new AuthMallUserApiReq(); AuthMallUserApiReq apiReq = new AuthMallUserApiReq();
if ("04".equals(payDto.getPurchaseMethod())) { if ("04".equals(payDto.getPurchaseMethod())) {
apiReq.setAuthMode(AuthModeEnum.RECORD_TIME_MODE); apiReq.setAuthMode(AuthModeEnum.RECORD_TIME_MODE);
...@@ -140,7 +145,7 @@ public class PayServiceImpl implements PayService { ...@@ -140,7 +145,7 @@ public class PayServiceImpl implements PayService {
apiReq.setUserId(payDto.getCustomerId() + ""); apiReq.setUserId(payDto.getCustomerId() + "");
apiReq.setValidStartTime(order.getTakeEffectTime()); apiReq.setValidStartTime(order.getTakeEffectTime());
apiReq.setValidEndTime(order.getInvalidTime()); apiReq.setValidEndTime(order.getInvalidTime());
String post = RestTemplateUtils.post(uri, JSON.toJSONString(apiReq)); String post = RestTemplateUtils.post(apiGateway, JSON.toJSONString(apiReq));
JSONObject params = JSONObject.parseObject(post); JSONObject params = JSONObject.parseObject(post);
if (!params.get("code").equals(200) || StringUtils.isEmpty(params.get("data"))){ if (!params.get("code").equals(200) || StringUtils.isEmpty(params.get("data"))){
......
# 测试环境配置 # 测试环境配置
server: server:
port: 8081 port: 8081
#contextPath: /resource contextPath: /mall
management: management:
port: 54001 port: 54001
...@@ -45,18 +45,18 @@ spring: ...@@ -45,18 +45,18 @@ spring:
public-key: rajZdV0xpCox+2vEHFLsKq2o2XVdMaQq public-key: rajZdV0xpCox+2vEHFLsKq2o2XVdMaQq
redis: redis:
# database: 0 # database: 0
host: 47.115.53.1 # host: 47.115.53.1
port: 6379 # port: 6379
password: 123456 # password: 123456
# timeout: 5000 # timeout: 5000
# cluster: cluster:
# nodes: nodes:
# - 192.168.31.167:6379 - 192.168.1.146:6379
# - 192.168.31.167:6380 - 192.168.1.146:6380
# - 192.168.31.167:6381 - 192.168.1.146:6381
# - 192.168.31.167:6382 - 192.168.1.146:6382
# - 192.168.31.167:6383 - 192.168.1.146:6383
# - 192.168.31.167:6384 - 192.168.1.146:6384
#mybatis的配置 #mybatis的配置
mybatis: mybatis:
...@@ -68,3 +68,6 @@ mybatis: ...@@ -68,3 +68,6 @@ mybatis:
logging: logging:
level: level:
com.jz.dm.mall: debug com.jz.dm.mall: debug
domain:
apigateway: http://47.115.53.1:8088/api/auth/mall-user-auth-api
\ No newline at end of file
...@@ -67,7 +67,7 @@ public class FinanceCustomerBalanceController extends BaseController { ...@@ -67,7 +67,7 @@ public class FinanceCustomerBalanceController extends BaseController {
* @author Bellamy * @author Bellamy
* @since 2020-12-06 * @since 2020-12-06
*/ */
@PostMapping(value = "/balanceInfoById") @GetMapping(value = "/balanceInfoById")
@ApiOperation(value = "充值管理--充值详情", notes = "充值详情") @ApiOperation(value = "充值管理--充值详情", notes = "充值详情")
public Result<BalanceInfoDto> getFinanceBalanceInfoById(@RequestParam(value = "customerBalanceId") String customerBalanceId, HttpServletRequest httpRequest) throws Exception { public Result<BalanceInfoDto> getFinanceBalanceInfoById(@RequestParam(value = "customerBalanceId") String customerBalanceId, HttpServletRequest httpRequest) throws Exception {
Result<BalanceInfoDto> result = new Result<>(); Result<BalanceInfoDto> result = new Result<>();
......
...@@ -45,4 +45,5 @@ public class DataGoodsApiController extends BaseController { ...@@ -45,4 +45,5 @@ public class DataGoodsApiController extends BaseController {
return new Result<>(false, "查询商品详情失败!", StatusCode.ERROR); return new Result<>(false, "查询商品详情失败!", StatusCode.ERROR);
} }
} }
\ No newline at end of file
...@@ -55,8 +55,10 @@ public class DataGoodsController extends BaseController { ...@@ -55,8 +55,10 @@ public class DataGoodsController extends BaseController {
return pageInfo; return pageInfo;
} }
/**主键查询数据商品 /**主键查询数据商品
* @param DataGoodsRequest * @param DataGoodsRequest
* @return * @return
......
...@@ -39,6 +39,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -39,6 +39,7 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
...@@ -69,6 +70,10 @@ public class DataGoodsServiceImpl implements DataGoodsService { ...@@ -69,6 +70,10 @@ public class DataGoodsServiceImpl implements DataGoodsService {
@Autowired @Autowired
private HttpsUtils httpsUtils; private HttpsUtils httpsUtils;
@Value("${domain.apigateway}")
private String apiGateway;
/** /**
* 条件分页查询数据列表 * 条件分页查询数据列表
* *
...@@ -297,10 +302,10 @@ public class DataGoodsServiceImpl implements DataGoodsService { ...@@ -297,10 +302,10 @@ public class DataGoodsServiceImpl implements DataGoodsService {
} }
apiReq.setApiExample(dataApiUpReq.getReturnDataExample()); apiReq.setApiExample(dataApiUpReq.getReturnDataExample());
String url= "http://47.115.53.1:8088/api/producer/addDataBankApiInfo"; // String url= "http://47.115.53.1:8088/api/producer/addDataBankApiInfo";
// String url= "http://127.0.0.1:8088/api/producer/addDataBankApiInfo"; // String url= "http://127.0.0.1:8088/api/producer/addDataBankApiInfo";
String post = httpsUtils.submitPost(url, JSON.toJSONString(apiReq)); String post = httpsUtils.submitPost(apiGateway, JSON.toJSONString(apiReq));
System.out.println(post); System.out.println(post);
JSONObject result = JSON.parseObject(post); JSONObject result = JSON.parseObject(post);
if (!result.get("code").equals(200) || org.springframework.util.StringUtils.isEmpty(result.get("data"))){ if (!result.get("code").equals(200) || org.springframework.util.StringUtils.isEmpty(result.get("data"))){
......
# 测试环境配置 # 测试环境配置
server: server:
port: 8082 port: 8082
#contextPath: /resource contextPath: /manage
management: management:
port: 54001 port: 54002
health: health:
mail: mail:
enabled: false enabled: false
...@@ -45,18 +45,18 @@ spring: ...@@ -45,18 +45,18 @@ spring:
public-key: rajZdV0xpCox+2vEHFLsKq2o2XVdMaQq public-key: rajZdV0xpCox+2vEHFLsKq2o2XVdMaQq
redis: redis:
#database: 0 #database: 0
host: 47.115.53.1 # host: 47.115.53.1
port: 6379 # port: 6379
timeout: 5000 # timeout: 5000
password: 123456 # password: 123456
# cluster: cluster:
# nodes: nodes:
# - 192.168.31.167:6379 - 192.168.1.146:6379
# - 192.168.31.167:6380 - 192.168.1.146:6380
# - 192.168.31.167:6381 - 192.168.1.146:6381
# - 192.168.31.167:6382 - 192.168.1.146:6382
# - 192.168.31.167:6383 - 192.168.1.146:6383
# - 192.168.31.167:6384 - 192.168.1.146:6384
#使用redis管理session设置为redis,否则none #使用redis管理session设置为redis,否则none
session: session:
store-type: none store-type: none
...@@ -69,4 +69,7 @@ mybatis: ...@@ -69,4 +69,7 @@ mybatis:
logging: logging:
level: level:
com.jz.manage: debug com.jz.manage: debug
\ No newline at end of file
domain:
apigateway: http://47.115.53.1:8088/api/producer/addDataBankApiInfo
\ No newline at end of file
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