提交代码

yy_dev
胡锐 2 years ago
parent a5be76e1d4
commit 407e746d57
  1. 218
      open-api/src/main/java/com/api/controller/v1/LedgerController.java
  2. 14
      open-api/src/main/java/com/api/controller/v1/NotifyController.java
  3. 4
      open-api/src/main/java/com/api/controller/v1/TradeController.java
  4. 2
      service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeSeparateService.java
  5. 2
      service/src/main/java/com/hfkj/openapi/v1/model/request/RequestQueryRefundModel.java
  6. 2
      service/src/main/java/com/hfkj/openapi/v1/model/request/RequestQueryTradeModel.java
  7. 2
      service/src/main/java/com/hfkj/openapi/v1/model/request/RequestRefundTradeModel.java
  8. 62
      service/src/main/java/com/hfkj/openapi/v1/model/request/RequestSeparateModel.java
  9. 29
      service/src/main/java/com/hfkj/openapi/v1/model/request/RequestSeparateRecvDataModel.java
  10. 2
      service/src/main/java/com/hfkj/openapi/v1/model/request/RequestTradeBillsModel.java
  11. 2
      service/src/main/java/com/hfkj/openapi/v1/model/request/RequestTradePreorderModel.java
  12. 2
      service/src/main/java/com/hfkj/openapi/v1/model/response/ResponseQueryTradeModel.java
  13. 2
      service/src/main/java/com/hfkj/openapi/v1/model/response/ResponseRefundTradeModel.java
  14. 4
      service/src/main/java/com/hfkj/openapi/v1/service/OpenApiTradeOrderService.java
  15. 4
      service/src/main/java/com/hfkj/openapi/v1/service/impl/OpenApiTradeOrderServiceImpl.java

@ -0,0 +1,218 @@
package com.api.controller.v1;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsTradeOrder;
import com.hfkj.model.ResponseData;
import com.hfkj.openapi.v1.model.request.RequestSeparateModel;
import com.hfkj.openapi.v1.model.request.RequestTradePreorderModel;
import com.hfkj.openapi.v1.service.OpenApiTradeOrderService;
import com.hfkj.openapi.v1.utils.SignatureUtil;
import com.hfkj.service.BsMerKeyService;
import com.hfkj.sysenum.TradeOrderStatusEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
/**
* @className: LedgerController
* @author: HuRui
* @date: 2023/5/26
**/
@Controller
@Api(value = "交易订单")
@RequestMapping(value = "/v1/ledger")
public class LedgerController {
private static Logger log = LoggerFactory.getLogger(TradeController.class);
@Resource
private BsMerKeyService merKeyService;
@Resource
private OpenApiTradeOrderService openApiTradeOrderService;
@RequestMapping(value="/applyBind",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "分账关系申请")
public ResponseData applyBind(@Validated @RequestBody RequestTradePreorderModel body) {
log.info("========= Start 聚合主扫接口 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
try {
// 验证签名
if (!SignatureUtil.checkSign(body.getSign(), body, merKeyService.getKeyByMerNo(body.getMerchantNo()))) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
log.info("返回参数:" + JSONObject.toJSONString(null));
return ResponseMsgUtil.success(null);
} catch (Exception e) {
log.info("出现异常:", e);
return ResponseMsgUtil.exception(e);
} finally {
log.info("========= END 聚合主扫接口 END ===========");
}
}
@RequestMapping(value="/applyUnBind",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "分账关系解绑申请")
public ResponseData applyUnBind(@Validated @RequestBody RequestTradePreorderModel body) {
log.info("========= Start 聚合主扫接口 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
try {
// 验证签名
if (!SignatureUtil.checkSign(body.getSign(), body, merKeyService.getKeyByMerNo(body.getMerchantNo()))) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
log.info("返回参数:" + JSONObject.toJSONString(null));
return ResponseMsgUtil.success(null);
} catch (Exception e) {
log.info("出现异常:", e);
return ResponseMsgUtil.exception(e);
} finally {
log.info("========= END 聚合主扫接口 END ===========");
}
}
@RequestMapping(value="/separate",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "分账发起")
public ResponseData separate(@Validated @RequestBody RequestSeparateModel body) {
log.info("========= Start 分账发起接口 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
try {
// 验证签名
if (!SignatureUtil.checkSign(body.getSign(), body, merKeyService.getKeyByMerNo(body.getMerchantNo()))) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
// 查询交易订单
BsTradeOrder tradeOrder = openApiTradeOrderService.getOrderByOutTradeNo(body.getOutTradeNo());
if (tradeOrder == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的交易单号");
}
if (!tradeOrder.getStatus().equals(TradeOrderStatusEnum.status3.getNumber())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "交易订单不处于已支付");
}
log.info("返回参数:" + JSONObject.toJSONString(null));
return ResponseMsgUtil.success(null);
} catch (Exception e) {
log.info("出现异常:", e);
return ResponseMsgUtil.exception(e);
} finally {
log.info("========= END 分账发起接口 END ===========");
}
}
@RequestMapping(value="/cancel",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "分账撤销")
public ResponseData cancel(@Validated @RequestBody RequestTradePreorderModel body) {
log.info("========= Start 分账撤销接口 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
try {
// 验证签名
if (!SignatureUtil.checkSign(body.getSign(), body, merKeyService.getKeyByMerNo(body.getMerchantNo()))) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
log.info("返回参数:" + JSONObject.toJSONString(null));
return ResponseMsgUtil.success(null);
} catch (Exception e) {
log.info("出现异常:", e);
return ResponseMsgUtil.exception(e);
} finally {
log.info("========= END 分账撤销接口 END ===========");
}
}
@RequestMapping(value="/fallback",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "分账退回")
public ResponseData fallback(@Validated @RequestBody RequestTradePreorderModel body) {
log.info("========= Start 分账退回接口 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
try {
// 验证签名
if (!SignatureUtil.checkSign(body.getSign(), body, merKeyService.getKeyByMerNo(body.getMerchantNo()))) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
log.info("返回参数:" + JSONObject.toJSONString(null));
return ResponseMsgUtil.success(null);
} catch (Exception e) {
log.info("出现异常:", e);
return ResponseMsgUtil.exception(e);
} finally {
log.info("========= END 分账退回接口 END ===========");
}
}
@RequestMapping(value="/query",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "分账结果查询")
public ResponseData query(@Validated @RequestBody RequestTradePreorderModel body) {
log.info("========= Start 分账结果查询接口 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
try {
// 验证签名
if (!SignatureUtil.checkSign(body.getSign(), body, merKeyService.getKeyByMerNo(body.getMerchantNo()))) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
log.info("返回参数:" + JSONObject.toJSONString(null));
return ResponseMsgUtil.success(null);
} catch (Exception e) {
log.info("出现异常:", e);
return ResponseMsgUtil.exception(e);
} finally {
log.info("========= END 分账结果查询接口 END ===========");
}
}
@RequestMapping(value="/queryAmt",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "可分账金额查询")
public ResponseData queryAmt(@Validated @RequestBody RequestTradePreorderModel body) {
log.info("========= Start 可分账金额查询接口 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
try {
// 验证签名
if (!SignatureUtil.checkSign(body.getSign(), body, merKeyService.getKeyByMerNo(body.getMerchantNo()))) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
log.info("返回参数:" + JSONObject.toJSONString(null));
return ResponseMsgUtil.success(null);
} catch (Exception e) {
log.info("出现异常:", e);
return ResponseMsgUtil.exception(e);
} finally {
log.info("========= END 可分账金额查询接口 END ===========");
}
}
}

@ -1,32 +1,20 @@
package com.api.controller.v1; package com.api.controller.v1;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ccb.wlpt.util.StringUtil;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.HttpsUtils; import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsMer;
import com.hfkj.entity.BsTradeOrder; import com.hfkj.entity.BsTradeOrder;
import com.hfkj.entity.BsTradeOrderMsg; import com.hfkj.openapi.v1.model.response.ResponseQueryTradeModel;
import com.hfkj.entity.BsTradeOrderRefund;
import com.hfkj.model.ResponseData;
import com.hfkj.openapi.v1.model.*;
import com.hfkj.openapi.v1.service.OpenApiTradeOrderService; import com.hfkj.openapi.v1.service.OpenApiTradeOrderService;
import com.hfkj.openapi.v1.utils.SignatureUtil; import com.hfkj.openapi.v1.utils.SignatureUtil;
import com.hfkj.service.BsMerKeyService; import com.hfkj.service.BsMerKeyService;
import com.hfkj.service.BsMerService;
import com.hfkj.service.BsTradeOrderService; import com.hfkj.service.BsTradeOrderService;
import com.hfkj.sysenum.*; import com.hfkj.sysenum.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.protocol.HTTP;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;

@ -2,7 +2,6 @@ package com.api.controller.v1;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.api.config.SysConst;
import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
@ -14,6 +13,9 @@ import com.hfkj.entity.BsTradeOrder;
import com.hfkj.entity.BsTradeOrderRefund; import com.hfkj.entity.BsTradeOrderRefund;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.openapi.v1.model.*; import com.hfkj.openapi.v1.model.*;
import com.hfkj.openapi.v1.model.request.*;
import com.hfkj.openapi.v1.model.response.ResponseQueryTradeModel;
import com.hfkj.openapi.v1.model.response.ResponseRefundTradeModel;
import com.hfkj.openapi.v1.service.OpenApiTradeOrderService; import com.hfkj.openapi.v1.service.OpenApiTradeOrderService;
import com.hfkj.openapi.v1.utils.SignatureUtil; import com.hfkj.openapi.v1.utils.SignatureUtil;
import com.hfkj.service.BsMerKeyService; import com.hfkj.service.BsMerKeyService;

@ -36,7 +36,7 @@ public class LaKaLaTradeSeparateService {
private BsTradeOrderProfitSharingReceiverService tradeOrderProfitSharingReceiverService; private BsTradeOrderProfitSharingReceiverService tradeOrderProfitSharingReceiverService;
/** /**
* 创建分账 * 发起分账
* @param profitSharingOrderNo * @param profitSharingOrderNo
* @return * @return
*/ */

@ -1,4 +1,4 @@
package com.hfkj.openapi.v1.model; package com.hfkj.openapi.v1.model.request;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;

@ -1,4 +1,4 @@
package com.hfkj.openapi.v1.model; package com.hfkj.openapi.v1.model.request;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;

@ -1,4 +1,4 @@
package com.hfkj.openapi.v1.model; package com.hfkj.openapi.v1.model.request;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;

@ -0,0 +1,62 @@
package com.hfkj.openapi.v1.model.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.util.List;
/**
* 请求分账
* @className: RequestSeparateModel
* @author: HuRui
* @date: 2023/5/26
**/
@Data
public class RequestSeparateModel {
/**
* 商户号
*/
@NotBlank(message = "商户号必填项")
private String merchantNo;
/**
* 商户交易单号
*/
@Length(min = 6, max = 50, message = "商户交易单号长度限制6至50位字符串长度")
@NotBlank(message = "商户交易单号必填项")
private String outTradeNo;
/**
* 分账流水号
*/
@NotBlank(message = "分账流水号必填项")
@Length(min = 6, max = 50, message = "分账流水号限制6至50位字符串长度")
private String outSeparateNo;
/**
* 分账总金额
*/
@NotBlank(message = "分账总金额必填项")
@DecimalMin(value = "0.01", message = "分账总金额最小0.01")
@DecimalMax(value = "9999999", message = "分账总金额最大9999999")
private BigDecimal totalAmount;
/**
* 分账接收方
*/
@NotBlank(message = "分账接收方必填项")
private List<RequestSeparateRecvDataModel> recvDatas;
/**
* 签名参数
*/
@NotBlank(message = "签名必填项")
private String sign;
}

@ -0,0 +1,29 @@
package com.hfkj.openapi.v1.model.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
/**
* 请求分账接收方
* @className: RequestSeparateModel
* @author: HuRui
* @date: 2023/5/26
**/
@Data
public class RequestSeparateRecvDataModel {
@NotBlank(message = "分账接收方商户号必填项")
private String recvMerchantNo;
@NotBlank(message = "分账接收方金额必填项")
@DecimalMin(value = "0.01", message = "分账总金额最小0.01")
@DecimalMax(value = "9999999", message = "分账总金额最大9999999")
private String separateAmount;
}

@ -1,4 +1,4 @@
package com.hfkj.openapi.v1.model; package com.hfkj.openapi.v1.model.request;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;

@ -1,4 +1,4 @@
package com.hfkj.openapi.v1.model; package com.hfkj.openapi.v1.model.request;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;

@ -1,4 +1,4 @@
package com.hfkj.openapi.v1.model; package com.hfkj.openapi.v1.model.response;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;

@ -1,4 +1,4 @@
package com.hfkj.openapi.v1.model; package com.hfkj.openapi.v1.model.response;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;

@ -2,8 +2,8 @@ package com.hfkj.openapi.v1.service;
import com.hfkj.entity.BsTradeOrder; import com.hfkj.entity.BsTradeOrder;
import com.hfkj.entity.BsTradeOrderRefund; import com.hfkj.entity.BsTradeOrderRefund;
import com.hfkj.openapi.v1.model.RequestRefundTradeModel; import com.hfkj.openapi.v1.model.request.RequestRefundTradeModel;
import com.hfkj.openapi.v1.model.ResponseRefundTradeModel; import com.hfkj.openapi.v1.model.response.ResponseRefundTradeModel;
import com.hfkj.openapi.v1.model.TradeBillsModel; import com.hfkj.openapi.v1.model.TradeBillsModel;
import java.util.List; import java.util.List;

@ -9,8 +9,8 @@ import com.hfkj.common.utils.DateUtil;
import com.hfkj.entity.BsTradeOrder; import com.hfkj.entity.BsTradeOrder;
import com.hfkj.entity.BsTradeOrderRefund; import com.hfkj.entity.BsTradeOrderRefund;
import com.hfkj.dao.OpenApiTradeOrderMapper; import com.hfkj.dao.OpenApiTradeOrderMapper;
import com.hfkj.openapi.v1.model.RequestRefundTradeModel; import com.hfkj.openapi.v1.model.request.RequestRefundTradeModel;
import com.hfkj.openapi.v1.model.ResponseRefundTradeModel; import com.hfkj.openapi.v1.model.response.ResponseRefundTradeModel;
import com.hfkj.openapi.v1.model.TradeBillsModel; import com.hfkj.openapi.v1.model.TradeBillsModel;
import com.hfkj.openapi.v1.service.OpenApiTradeOrderService; import com.hfkj.openapi.v1.service.OpenApiTradeOrderService;
import com.hfkj.openapi.v1.utils.SignatureUtil; import com.hfkj.openapi.v1.utils.SignatureUtil;

Loading…
Cancel
Save