Commit 2022189d authored by david.zhong's avatar david.zhong

提交

parent e546c87e
......@@ -28,7 +28,6 @@ import java.util.List;
import java.util.Map;
/**
* @author david.zhong
* @Title: PaymentServiceClient
* @ProjectName micro-root
* @Description: 远程调用底层逻辑
......
......@@ -44,6 +44,11 @@ public class ServiceUrl {
String serviceUrl = null;
switch (environmentValue) {
case "dev":
serviceUrl = LOCAL_DEV_URL_AS_SERVICE;
break;
case "devv2":
serviceUrl = LOCAL_DEV_URL_AS_SERVICE;
break;
case "test":
case "sit":
serviceUrl = LOCAL_DEV_URL_AS_SERVICE;
......
package com.ost.micro.provider.controller;
import com.ost.micro.core.aop.DataToUnderline;
import com.ost.micro.core.context.model.response.DataResponse;
import com.ost.micro.core.pay.form.EditForm;
......@@ -31,7 +32,7 @@ import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/mch/biz")
@RequestMapping("/provider/biz")
@Api(tags = "商家管理接口")
public class BizController {
......@@ -53,6 +54,7 @@ public class BizController {
@ApiOperation("查询商家列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "keyword", value = "关键字,如:商家编号/法人姓名/手机号码/公司名称", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "bizIds", value = "商家id", required = false, allowMultiple = true,dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "audit_status", value = "资料认证状态", required = false, dataType = "int"),
@ApiImplicitParam(paramType = "query", name = "status", value = "启用状态", required = false, dataType = "int"),
@ApiImplicitParam(paramType = "query", name = "comp_id", value = "签约公司id", required = false, dataType = "long"),
......@@ -62,16 +64,16 @@ public class BizController {
public DataResponse searchBiz(@RequestParam(required = false, name = "keyword") String keyword,
@RequestParam(required = false, name = "status") Integer status,
@RequestParam(required = false, name = "audit_status") Integer auditStatus,
@RequestParam(required = false) String[] bizIds,
@RequestParam(required = false, name = "comp_id") Long compId,
@RequestParam(name = "page_index") Integer pageIndex,
@RequestParam(name = "page_size") Integer pageSize) {
if (bizUrl == null) {
bizUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz";
}
bizUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz";
Map params = new HashMap();
params.put("keyword", keyword);
params.put("auditStatus", auditStatus);
params.put("status", status);
params.put("bizIds", bizIds);
params.put("compId", compId);
params.put("pageIndex", pageIndex);
params.put("pageSize", pageSize);
......@@ -81,20 +83,22 @@ public class BizController {
@PostMapping("")
@ApiOperation("添加商家")
@DataToUnderline()
public DataResponse add(@RequestBody(required = false) BizDto dto) {
if (bizUrl == null) {
bizUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz";
}
public DataResponse add(@RequestBody(required = false) BizDto dto,@RequestParam("current_biz_id") String currentBiz) {
bizUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz";
dto.setCreateBy(currentBiz);
dto.setUpdateBy(currentBiz);
return paymentServiceClient.post(bizUrl, dto);
}
@PutMapping("")
@ApiOperation("编辑商家信息")
@DataToUnderline()
public DataResponse edit(@RequestBody EditForm bizForm) {
if (bizUrl == null) {
bizUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz";
}
public DataResponse edit(@RequestBody EditForm bizForm,@RequestParam("current_biz_id") String currentBiz) {
bizUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz";
EditForm.UpdData updData = new EditForm.UpdData();
updData.setKey("update_by");
updData.setValue(currentBiz);
bizForm.getLst().add(updData);
paymentServiceClient.put(bizUrl, bizForm);
return ResponseUtils.getInstance().success(null);
}
......@@ -104,9 +108,7 @@ public class BizController {
@ApiImplicitParam(paramType = "path", name = "biz_id", value = "商家id", required = true, dataType = "Long")
@DataToUnderline()
public DataResponse bizDetail(@PathVariable("biz_id") Long bizId) {
if (bizUrl == null) {
bizUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz";
}
bizUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz";
return paymentServiceClient.get(bizUrl, bizId);
}
......@@ -120,9 +122,7 @@ public class BizController {
public DataResponse bizDetailOrderList(@RequestParam(name = "biz_id") Long bizId,
@RequestParam(name = "page_index") Integer pageIndex,
@RequestParam(name = "page_size") Integer pageSize) {
if (orderUrl == null) {
orderUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz/order/page";
}
orderUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz/order/page";
Map<String, Object> params = new HashMap<>();
params.put("bizId", bizId);
params.put("pageIndex", pageIndex);
......@@ -139,7 +139,7 @@ public class BizController {
public DataResponse getPassage(@RequestParam(name = "biz_id") Long bizId,
@RequestParam Integer plat) {
if (psgUrl == null) {
psgUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz/psg";
psgUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz/psg";
}
Map<String, Object> params = new HashMap<>();
params.put("bizId", bizId);
......@@ -153,7 +153,7 @@ public class BizController {
@DataToUnderline()
public DataResponse editBizPassage(@RequestBody EditBizPsgDto editBizPsgForm) {
if (psgUrl == null) {
psgUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz/psg";
psgUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz/psg";
}
paymentServiceClient.put(psgUrl, editBizPsgForm);
return ResponseUtils.getInstance().success(null);
......@@ -164,7 +164,7 @@ public class BizController {
@DataToUnderline()
public DataResponse addBizPassage(@RequestBody EditBizPsgDto editBizPsgForm) {
if (psgUrl == null) {
psgUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz/psg";
psgUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz/psg";
}
paymentServiceClient.post(psgUrl, editBizPsgForm);
return ResponseUtils.getInstance().success(null);
......@@ -176,7 +176,7 @@ public class BizController {
@DataToUnderline()
public DataResponse restBizPassage(@PathVariable("biz_id") Long bizId) {
if (psgUrl == null) {
psgUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz/psg";
psgUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz/psg";
}
Map<String, Object> params = new HashMap<>();
params.put("bizId", bizId);
......@@ -190,7 +190,7 @@ public class BizController {
@DataToUnderline()
public DataResponse getPsgGroup(@PathVariable("biz_id") Long bizId) {
if (psgGroupUrl == null) {
psgGroupUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz/psg/group";
psgGroupUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz/psg/group";
}
return paymentServiceClient.get(psgGroupUrl, bizId);
}
......@@ -200,7 +200,7 @@ public class BizController {
@DataToUnderline()
public DataResponse addCertiFile(@RequestBody BizAuditmpDto dto) {
if (certiUrl == null) {
certiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz/certifile";
certiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz/certifile";
}
return paymentServiceClient.post(certiUrl, dto);
}
......@@ -211,7 +211,7 @@ public class BizController {
@DataToUnderline()
public DataResponse getCertiFile(@PathVariable("biz_id") Long bizId) {
if (certiUrl == null) {
certiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz/certifile";
certiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz/certifile";
}
return paymentServiceClient.get(certiUrl, bizId);
}
......@@ -221,7 +221,7 @@ public class BizController {
@DataToUnderline()
public DataResponse editCertiFile(@RequestBody EditForm editForm) {
if (certiUrl == null) {
certiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz/certifile";
certiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz/certifile";
}
paymentServiceClient.put(certiUrl, editForm);
return ResponseUtils.getInstance().success(null);
......@@ -233,7 +233,7 @@ public class BizController {
@ApiImplicitParam(paramType = "path", name = "biz_id", value = "商家id", required = true, dataType = "long")
@DataToUnderline()
public DataResponse getParams(@PathVariable("biz_id") Long bizId) {
String paramsUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz/params";
String paramsUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz/params";
return paymentServiceClient.get(paramsUrl, bizId);
}
......@@ -242,7 +242,7 @@ public class BizController {
@DataToUnderline()
public DataResponse addParams(@RequestBody BizParamsDto bizParamsDto) {
String paramsUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz/params";
String paramsUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz/params";
//调用as-service服务
DataResponse backResponse = paymentServiceClient.post(paramsUrl, bizParamsDto);
log.info("添加交易参数 as-service 响应结果为:", GsonUtil.toJson(backResponse, true));
......@@ -255,7 +255,7 @@ public class BizController {
public DataResponse editParams(@RequestBody EditForm editForm) {
//调用as-service服务
String paramsUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz/params";
String paramsUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz/params";
DataResponse backResponse = paymentServiceClient.putForEntity(paramsUrl, editForm);
log.info("编辑交易参数 as-service 响应结果为:", GsonUtil.toJson(backResponse, true));
return backResponse;
......@@ -267,7 +267,7 @@ public class BizController {
@DataToUnderline()
public DataResponse getTradeDetail(@PathVariable Long id) {
if (transactionUrl == null) {
transactionUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/biz/transaction";
transactionUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/biz/transaction";
}
return paymentServiceClient.get(transactionUrl, id);
}
......
......@@ -32,7 +32,7 @@ import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/mch/trade/calculate")
@RequestMapping("/provider/trade/calculate")
@Api(tags = "交易统计")
@Slf4j
public class BizTradeStaticsController {
......@@ -72,7 +72,7 @@ public class BizTradeStaticsController {
@RequestParam(required = false) Integer currency,
@RequestParam(name = "page_index") Integer pageIndex,
@RequestParam(name = "page_size") Integer pageSize) {
staticUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/statics";
staticUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/statics";
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(serviceUrl.getAsServiceUrl(consulDiscoveryClient));
urlBuilder.append("/api/statics");
......@@ -121,7 +121,7 @@ public class BizTradeStaticsController {
@RequestParam(required = false) Integer currency,
@RequestParam(name = "page_index") Integer pageIndex,
@RequestParam(name = "page_size") Integer pageSize) {
staticUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/statics/tradePage";
staticUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/statics/tradePage";
Map<String, Object> params = new HashMap<>();
params.put("keyword", keyword);
params.put("tradeType", tradeType);
......@@ -160,7 +160,7 @@ public class BizTradeStaticsController {
@RequestParam(required = false, name = "page_size") Integer pageSize,
HttpServletResponse response) {
staticUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/statics/exportTradeStatic";
staticUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/statics/exportTradeStatic";
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(serviceUrl.getAsServiceUrl(consulDiscoveryClient));
......@@ -217,7 +217,7 @@ public class BizTradeStaticsController {
@RequestParam(required = false, name = "page_index") Integer pageIndex,
@RequestParam(required = false, name = "page_size") Integer pageSize,
HttpServletResponse response) {
staticUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/statics/exportTradePage";
staticUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/statics/exportTradePage";
Map<String, Object> params = new HashMap<>();
params.put("keyword", keyword);
params.put("tradeType", tradeType);
......
......@@ -20,7 +20,7 @@ import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/mch/common")
@RequestMapping("/provider/common")
@Api(tags = "通用接口")
@Slf4j
public class CommonController {
......@@ -31,7 +31,7 @@ public class CommonController {
@Autowired
private ServiceUrl serviceUrl;
private static final String BASE_URL = "/api/common";
private static final String BASE_URL = "/api/provider/common";
@GetMapping("supplier")
@ApiOperation("获取供应商列表")
......
......@@ -28,7 +28,7 @@ import java.io.*;
* @author Yubo
*/
@RestController
@RequestMapping("/mch/company")
@RequestMapping("/provider/company")
@Api(tags = "签约公司接口")
@Slf4j
public class CompanyController {
......@@ -40,7 +40,7 @@ public class CompanyController {
@Autowired
private ServiceUrl serviceUrl;
private static final String BASE_URL = "/api/company";
private static final String BASE_URL = "/api/provider/company";
private static final String CASHIER_BASE_URL = "/cashier/company";
......
package com.ost.micro.provider.controller;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.ost.micro.core.aop.DataToUnderline;
import com.ost.micro.core.context.model.response.DataResponse;
import com.ost.micro.core.pay.form.EditForm;
import com.ost.micro.core.pay.modules.sys.dto.BizTradeDetailDto;
import com.ost.micro.core.pay.modules.sys.excel.BizTradeDetailBean;
import com.ost.micro.core.utils.DateUtil;
import com.ost.micro.core.utils.ExcelUtils;
import com.ost.micro.core.utils.ResponseUtils;
import com.ost.micro.provider.common.PaymentServiceClient;
import com.ost.micro.provider.common.ServiceUrl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.consul.discovery.ConsulDiscoveryClient;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
/**
* @author Yubo
*/
@RestController
@RequestMapping("/provider/order")
@Api(tags = "交易明细接口")
@Slf4j
public class OrderController {
@Autowired
private PaymentServiceClient paymentServiceClient;
@Autowired
private ConsulDiscoveryClient consulDiscoveryClient;
@Autowired
private ServiceUrl serviceUrl;
private static final String BASE_URL = "/api/provider/order";
@GetMapping("")
@ApiOperation("查询交易明细列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "keyword", value = "关键字", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "amount", value = "金额", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "name", value = "姓名", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "remark", value = "附言", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "biz_id", value = "商家id", required = false, dataType = "long"),
@ApiImplicitParam(paramType = "query", name = "biz_ids", value = "商家id", required = false, allowMultiple = true, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "status", value = "状态", required = false, dataType = "int"),
@ApiImplicitParam(paramType = "query", name = "currency", value = "0人民币1美元", required = false, dataType = "int"),
@ApiImplicitParam(paramType = "query", name = "from_date", value = "起始日期", required = false, dataType = "Long"),
@ApiImplicitParam(paramType = "query", name = "to_date", value = "结束日期", required = false, dataType = "Long"),
@ApiImplicitParam(paramType = "query", name = "page_index", value = "页码", required = true, dataType = "int"),
@ApiImplicitParam(paramType = "query", name = "page_size", value = "每页数码条数", required = true, dataType = "int")})
@DataToUnderline()
public DataResponse search(@RequestParam(required = false) String keyword,
@RequestParam(required = false) String amount,
@RequestParam(required = false) String name,
@RequestParam(required = false) String remark,
@RequestParam(required = false, name = "biz_id") Long bizId,
@RequestParam(required = false, name = "biz_ids") String[] bizIds,
@RequestParam(required = false) Integer status,
@RequestParam(required = false) Integer currency,
@RequestParam(required = false, name = "from_date") Long fromDate,
@RequestParam(required = false, name = "to_date") Long toDate,
@RequestParam(name = "page_index") Integer pageIndex,
@RequestParam(name = "page_size") Integer pageSize) {
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(serviceUrl.getAsServiceUrl(consulDiscoveryClient));
urlBuilder.append(BASE_URL);
urlBuilder.append("?keyword={keyword}");
urlBuilder.append("&amount={amount}");
urlBuilder.append("&name={name}");
urlBuilder.append("&remark={remark}");
urlBuilder.append("&bizId={bizId}");
urlBuilder.append("&bizIds={bizIds}");
urlBuilder.append("&status={status}");
urlBuilder.append("&currency={currency}");
urlBuilder.append("&fromDate={fromDate}");
urlBuilder.append("&toDate={toDate}");
urlBuilder.append("&pageIndex={pageIndex}");
urlBuilder.append("&pageSize={pageSize}");
ResponseEntity<DataResponse> result = paymentServiceClient.getRestTemplate().getForEntity(
urlBuilder.toString(), DataResponse.class, keyword, amount, name, remark, bizId, bizIds, status, currency, fromDate, toDate,
pageIndex, pageSize);
return result.getBody();
}
@PutMapping("")
@ApiOperation("编辑订单")
@DataToUnderline()
public DataResponse edit(@RequestBody EditForm editForm) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<EditForm> entity = new HttpEntity<EditForm>(editForm, headers);
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(serviceUrl.getAsServiceUrl(consulDiscoveryClient));
urlBuilder.append(BASE_URL);
ResponseEntity<DataResponse> result = paymentServiceClient.getRestTemplate()
.exchange(urlBuilder.toString(), HttpMethod.PUT, entity, DataResponse.class);
return result.getBody();
}
@GetMapping("/{id}")
@ApiOperation("获取交易详情")
@ApiImplicitParam(paramType = "path", name = "id", value = "订单id", required = true, dataType = "long")
@DataToUnderline()
public DataResponse getTradeDetail(@PathVariable Long id) {
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(serviceUrl.getAsServiceUrl(consulDiscoveryClient));
urlBuilder.append(BASE_URL);
urlBuilder.append("/{id}");
ResponseEntity<DataResponse> result = paymentServiceClient.getRestTemplate()
.getForEntity(urlBuilder.toString(), DataResponse.class, id);
return result.getBody();
}
@PostMapping("notify")
@ApiOperation("发送通知")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "order_id", value = "订单id", required = true, dataType = "int"),
@ApiImplicitParam(paramType = "query", name = "biz_id", value = "商家id", required = true, dataType = "int")})
@DataToUnderline()
public DataResponse notify(@RequestParam Integer orderId, @RequestParam Integer bizId) {
return ResponseUtils.getInstance().success(null);
}
@GetMapping("/export")
@ApiOperation("导出交易流水")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "keyword", value = "关键字", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "amount", value = "金额", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "name", value = "姓名", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "remark", value = "附言", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "biz_id", value = "商家id", required = true, dataType = "long"),
@ApiImplicitParam(paramType = "query", name = "biz_ids", value = "商家id集合", required = false, allowMultiple = true, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "type", value = "交易类型", required = false, dataType = "int"),
@ApiImplicitParam(paramType = "query", name = "status", value = "状态", required = false, dataType = "int"),
@ApiImplicitParam(paramType = "query", name = "currency", value = "0人民币1美元", required = false, dataType = "int"),
@ApiImplicitParam(paramType = "query", name = "from_date", value = "起始日期", required = false, dataType = "Long"),
@ApiImplicitParam(paramType = "query", name = "to_date", value = "结束日期", required = false, dataType = "Long")
})
public void export(@RequestParam(required = false) String keyword,
@RequestParam(required = false) String amount,
@RequestParam(required = false) String name,
@RequestParam(required = false) String remark,
@RequestParam(required = false, name = "biz_id") Long bizId,
@RequestParam(required = false, name = "biz_ids") String[] bizIds,
@RequestParam(required = false) Integer type,
@RequestParam(required = false) Integer status,
@RequestParam(required = false) Integer currency,
@RequestParam(required = false, name = "from_date") Long fromDate,
@RequestParam(required = false, name = "to_date") Long toDate,
HttpServletResponse response) {
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(serviceUrl.getAsServiceUrl(consulDiscoveryClient));
urlBuilder.append("/api/order/export");
urlBuilder.append("?keyword={keyword}");
urlBuilder.append("&amount={amount}");
urlBuilder.append("&name={name}");
urlBuilder.append("&remark={remark}");
urlBuilder.append("&bizId={bizId}");
urlBuilder.append("&bizIds={bizIds}");
urlBuilder.append("&type={type}");
urlBuilder.append("&status={status}");
urlBuilder.append("&currency={currency}");
urlBuilder.append("&fromDate={fromDate}");
urlBuilder.append("&toDate={toDate}");
ResponseEntity<DataResponse> result = paymentServiceClient.getRestTemplate().getForEntity(urlBuilder.toString(),
DataResponse.class, keyword, amount, name, remark, bizId, bizIds, type, status, currency, fromDate, toDate);
DataResponse dataResponse = result.getBody();
if (null != dataResponse && null != dataResponse.getData()) {
Object obj = dataResponse.getData().getList();
Gson gson = new Gson();
if (null != obj && obj instanceof List) {
List<BizTradeDetailDto> dataList = gson.fromJson(gson.toJson(obj), new TypeToken<List<BizTradeDetailDto>>() {
}.getType());
try {
ExcelUtils.exportExcelToTarget(response, "交易明细_" + DateUtil.format(new Date(), "yyyyMMddHHmmss"), dataList, BizTradeDetailBean.class);
} catch (Exception e) {
log.error("export 导出交易流水 error", e);
}
}
}
}
}
package com.ost.micro.provider.controller;
import com.ost.micro.core.aop.DataToUnderline;
import com.ost.micro.core.context.model.response.DataResponse;
import com.ost.micro.core.pay.form.EditForm;
......@@ -27,7 +28,7 @@ import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/mch/supplier")
@RequestMapping("/provider/supplier")
@Api(tags = "支付供应商接口")
public class SupplierController {
......@@ -64,9 +65,7 @@ public class SupplierController {
@RequestParam(required = false) Integer status,
@RequestParam(name = "page_index") Integer pageIndex,
@RequestParam(name = "page_size") Integer pageSize) {
if (url == null) {
url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier";
}
url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier";
Map params = new HashMap();
params.put("name", name);
params.put("type", type);
......@@ -81,9 +80,7 @@ public class SupplierController {
@ApiOperation("添加支付供应商")
@DataToUnderline()
public DataResponse add(@RequestBody(required = false) MchPaySupplierDto params) {
if (url == null) {
url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier";
}
url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier";
return paymentServiceClient.post(url, params);
}
......@@ -92,9 +89,7 @@ public class SupplierController {
@ApiImplicitParam(paramType = "path", name = "id", value = "支付供应商_id", required = true, dataType = "Long")
@DataToUnderline()
public DataResponse detail(@PathVariable Long id) {
if (url == null) {
url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier";
}
url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier";
return paymentServiceClient.get(url, id);
}
......@@ -103,9 +98,7 @@ public class SupplierController {
@ApiImplicitParam(paramType = "path", name = "id", value = "支付供应商_id", required = true, dataType = "Long")
@DataToUnderline()
public DataResponse delete(@PathVariable Long id) {
if (url == null) {
url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier";
}
url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier";
paymentServiceClient.delete(url, id);
return ResponseUtils.getInstance().success(null);
}
......@@ -114,9 +107,7 @@ public class SupplierController {
@ApiOperation("编辑支付供应商")
@DataToUnderline()
public DataResponse edit(@RequestBody EditForm editForm) {
if (url == null) {
url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier";
}
url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier";
return paymentServiceClient.putForEntity(url, editForm);
// return ResponseUtils.getInstance().success(null);
}
......@@ -148,7 +139,7 @@ public class SupplierController {
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(serviceUrl.getAsServiceUrl(consulDiscoveryClient));
urlBuilder.append("/api/supplier/merchant");
urlBuilder.append("/api/provider/supplier/merchant");
urlBuilder.append("?supId={supId}");
urlBuilder.append("&keyword={keyword}");
urlBuilder.append("&isEntryInfo={isEntryInfo}");
......@@ -180,7 +171,7 @@ public class SupplierController {
@RequestParam(required = false, name = "biz_ids") String[] bizIds) {
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(serviceUrl.getAsServiceUrl(consulDiscoveryClient));
urlBuilder.append("/api/supplier/merchant/info");
urlBuilder.append("/api/provider/supplier/merchant/info");
urlBuilder.append("?id={id}");
urlBuilder.append("&bizId={bizId}");
urlBuilder.append("&bizIds={bizIds}");
......@@ -194,9 +185,7 @@ public class SupplierController {
@ApiOperation("添加商户")
@DataToUnderline()
public DataResponse add(@RequestBody(required = false) MchPayDto params, @RequestParam(required = false, name = "biz_id") Long bizId) {
if (merchantUrl == null) {
merchantUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/merchant";
}
params.setCreateBy(bizId + "");
DataResponse dataResponse = paymentServiceClient.post(merchantUrl, params);
return dataResponse;
......@@ -208,7 +197,7 @@ public class SupplierController {
public DataResponse delMerchant(@RequestParam("mch_id") Long id) {
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(serviceUrl.getAsServiceUrl(consulDiscoveryClient));
urlBuilder.append("/api/supplier");
urlBuilder.append("/api/provider/supplier");
ResponseEntity<DataResponse> resp = paymentServiceClient.getRestTemplate().exchange(urlBuilder + "/delMerchant?mchId={id}", HttpMethod.DELETE, null, DataResponse.class, id);
DataResponse dataResponse = resp.getBody();
return dataResponse;
......@@ -218,9 +207,7 @@ public class SupplierController {
@ApiOperation("编辑商户详情")
@DataToUnderline()
public DataResponse editMerchant(@RequestBody EditForm editForm) {
if (merchantUrl == null) {
merchantUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/merchant";
}
merchantUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/merchant";
DataResponse dataResponse = paymentServiceClient.putForEntity(merchantUrl, editForm);
return dataResponse;
}
......@@ -230,13 +217,12 @@ public class SupplierController {
@ApiImplicitParam(paramType = "path", name = "id", value = "支付供应商户详情表_id", required = true, dataType = "Long")
@RequiresPermissions("supplier:merchant:delete")
public DataResponse merchantDelete(@PathVariable Long id) {
if (merchantUrl == null) {
merchantUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/merchant";
}
merchantUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/merchant";
paymentServiceClient.delete(merchantUrl, id);
return ResponseUtils.getInstance().success(null);
}
@GetMapping("payapi")
@ApiOperation("查询支付接口列表")
@ApiImplicitParams({
......@@ -249,9 +235,7 @@ public class SupplierController {
@RequestParam(required = false, name = "api_name") String apiName,
@RequestParam(name = "page_index") Integer pageIndex,
@RequestParam(name = "page_size") Integer pageSize) {
if (payapiUrl == null) {
payapiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/payapi";
}
payapiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/payapi";
Map params = new HashMap();
params.put("supId", supId);
params.put("apiName", apiName);
......@@ -265,9 +249,7 @@ public class SupplierController {
@ApiImplicitParam(paramType = "path", name = "id", value = "支付接口id", required = true, dataType = "long")
@DataToUnderline()
public DataResponse getPayapi(@PathVariable Long id) {
if (payapiUrl == null) {
payapiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/payapi";
}
payapiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/payapi";
return paymentServiceClient.get(payapiUrl, id);
}
......@@ -275,9 +257,7 @@ public class SupplierController {
@ApiOperation("编辑支付接口详情")
@RequiresPermissions("supplier:payapi:edit")
public DataResponse editPayapi(@RequestBody MchPayApiDto mchPayApiFrom) {
if (payapiUrl == null) {
payapiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/payapi";
}
payapiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/payapi";
paymentServiceClient.put(payapiUrl, mchPayApiFrom);
return ResponseUtils.getInstance().success(null);
}
......@@ -286,9 +266,7 @@ public class SupplierController {
@ApiOperation("添加支付接口详情")
@DataToUnderline()
public DataResponse add(@RequestBody(required = false) MchPayApiDto params) {
if (payapiUrl == null) {
payapiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/payapi";
}
payapiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/payapi";
DataResponse dataResponse = paymentServiceClient.post(payapiUrl, params);
return dataResponse;
}
......@@ -298,9 +276,7 @@ public class SupplierController {
@ApiImplicitParam(paramType = "path", name = "id", value = "支付接口_id", required = true, dataType = "Long")
@DataToUnderline()
public DataResponse payapiDelete(@PathVariable Long id) {
if (payapiUrl == null) {
payapiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/payapi";
}
payapiUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/payapi";
paymentServiceClient.delete(payapiUrl, id);
return ResponseUtils.getInstance().success(null);
}
......@@ -312,9 +288,7 @@ public class SupplierController {
@ApiImplicitParam(paramType = "query", name = "page_size", value = "每页数码条数", required = true, dataType = "int")})
@DataToUnderline()
public DataResponse allPaytmpl(@RequestParam(name = "page_index") Integer pageIndex, @RequestParam(name = "page_size") Integer pageSize) {
if (tmlpUrl == null) {
tmlpUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/paytmpl";
}
tmlpUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/paytmpl";
Map params = new HashMap();
params.put("pageIndex", pageIndex);
params.put("pageSize", pageSize);
......@@ -328,9 +302,7 @@ public class SupplierController {
@ApiOperation("添加支付接口模板")
@DataToUnderline()
public DataResponse addPaytmpl(@RequestBody(required = false) MchPayApiTmplDto params) {
if (tmlpUrl == null) {
tmlpUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/paytmpl";
}
tmlpUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/paytmpl";
return paymentServiceClient.post(tmlpUrl, params);
}
......@@ -339,9 +311,7 @@ public class SupplierController {
@ApiImplicitParam(paramType = "path", name = "id", value = "支付接口模板_id", required = true, dataType = "Long")
@DataToUnderline()
public DataResponse getPaytmpl(@PathVariable Long id) {
if (tmlpUrl == null) {
tmlpUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/paytmpl";
}
tmlpUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/paytmpl";
return paymentServiceClient.get(tmlpUrl, id);
}
......@@ -350,9 +320,7 @@ public class SupplierController {
@ApiImplicitParam(paramType = "path", name = "id", value = "支付接口模板_id", required = true, dataType = "Long")
@DataToUnderline()
public DataResponse deletePaytmpl(@PathVariable Long id) {
if (tmlpUrl == null) {
tmlpUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/paytmpl";
}
tmlpUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/paytmpl";
paymentServiceClient.delete(tmlpUrl, id);
return ResponseUtils.getInstance().success(null);
}
......@@ -361,9 +329,7 @@ public class SupplierController {
@ApiOperation("编辑支付接口模板")
@DataToUnderline()
public DataResponse editPaytmpl(@RequestBody MchPayApiTmplDto form) {
if (tmlpUrl == null) {
tmlpUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/paytmpl";
}
tmlpUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/paytmpl";
paymentServiceClient.put(tmlpUrl, form);
return ResponseUtils.getInstance().success(null);
}
......@@ -382,9 +348,7 @@ public class SupplierController {
@RequestParam(required = false, name = "enable") Integer enable,
@RequestParam(name = "page_index") Integer pageIndex,
@RequestParam(name = "page_size") Integer pageSize) {
if (bankUrl == null) {
bankUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/bank";
}
bankUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/bank";
Map params = new HashMap();
params.put("supplierId", supplierId);
params.put("bankName", bankName);
......@@ -399,9 +363,7 @@ public class SupplierController {
@ApiOperation("添加银行")
@DataToUnderline()
public DataResponse addBank(@RequestBody MchPayBankDtoExt params) {
if (bankUrl == null) {
bankUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/bank";
}
bankUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/bank";
return paymentServiceClient.post(bankUrl, params);
}
......@@ -410,9 +372,7 @@ public class SupplierController {
@ApiImplicitParam(paramType = "path", name = "id", value = "银行id", required = true, dataType = "Long")
@DataToUnderline()
public DataResponse getBank(@PathVariable Long id) {
if (bankUrl == null) {
bankUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/bank";
}
bankUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/bank";
return paymentServiceClient.get(bankUrl, id);
}
......@@ -420,9 +380,7 @@ public class SupplierController {
@ApiOperation("编辑银行详情")
@DataToUnderline()
public DataResponse editBank(@RequestBody MchPayBankDtoExt editForm) {
if (bankUrl == null) {
bankUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/bank";
}
bankUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/bank";
paymentServiceClient.put(bankUrl, editForm);
return ResponseUtils.getInstance().success(null);
}
......@@ -432,9 +390,7 @@ public class SupplierController {
@ApiImplicitParam(paramType = "path", name = "id", value = " 支付通道支持的银行_id", required = true, dataType = "Long")
@DataToUnderline()
public DataResponse deleteBank(@PathVariable Long id) {
if (bankUrl == null) {
bankUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/bank";
}
bankUrl = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/bank";
paymentServiceClient.delete(bankUrl, id);
return ResponseUtils.getInstance().success(null);
}
......@@ -448,7 +404,7 @@ public class SupplierController {
@ApiOperation("支付接口费率设置")
@DataToUnderline()
public DataResponse postPayApiRate(@RequestBody EditPayApiRateDto editPayApiRateForm) {
String url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/api/rate";
String url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/api/rate";
return paymentServiceClient.post(url, editPayApiRateForm);
}
......@@ -467,7 +423,7 @@ public class SupplierController {
})
@DataToUnderline()
public DataResponse getPayApiRate(@RequestParam(name = "pay_api_id") Long payApiId, @RequestParam(name = "rent_type") Integer rentType) {
String url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/api/rate";
String url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/api/rate";
Map params = new HashMap();
params.put("payApiId", payApiId);
params.put("rentType", rentType);
......@@ -484,7 +440,7 @@ public class SupplierController {
@ApiOperation("编辑支付接口费率")
@DataToUnderline()
public DataResponse edit(@RequestBody(required = false) EditPayApiRateForm entity) {
String url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/supplier/api/rate";
String url = serviceUrl.getAsServiceUrl(consulDiscoveryClient) + "/api/provider/supplier/api/rate";
return paymentServiceClient.putForEntity(url, entity);
}
......
package com.ost.micro.provider.controller;
import com.ost.micro.core.aop.DataToUnderline;
import com.ost.micro.core.context.model.response.DataResponse;
import com.ost.micro.core.pay.modules.sys.excel.BizBean;
......@@ -20,7 +21,7 @@ import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/mch/tool")
@RequestMapping("/provider/tool")
@Api(tags = "查询工具接口")
public class ToolController {
@Autowired
......@@ -40,7 +41,7 @@ public class ToolController {
public DataResponse queryPayOrder(@RequestParam(name = "order_no") String orderNo, @RequestParam(required = false, name = "biz_id") Long bizId) {
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(serviceUrl.getAsServiceUrl(consulDiscoveryClient));
urlBuilder.append("/api/tool/payorder");
urlBuilder.append("/api/provider/tool/payorder");
Map<String, Object> params = new HashMap<>();
params.put("orderNo", orderNo);
return paymentServiceClient.get(urlBuilder.toString(), params);
......@@ -65,7 +66,7 @@ public class ToolController {
public DataResponse queryBankCard(@RequestParam(name = "card_no") String cardNo) {
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(serviceUrl.getAsServiceUrl(consulDiscoveryClient));
urlBuilder.append("/api/tool/bankcard");
urlBuilder.append("/api/provider/tool/bankcard");
Map<String, Object> params = new HashMap<>();
params.put("cardNo", cardNo);
return paymentServiceClient.get(urlBuilder.toString(), params);
......
......@@ -2,3 +2,6 @@ server:
port: 6019
tomcat:
basedir: /web/temp_upload
services:
as-service:
micro-project-domain-as-service-v2
\ 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