parent
9f1a566193
commit
0fdba9757b
@ -0,0 +1,21 @@ |
|||||||
|
package com.hfkj.openapi.v1.service; |
||||||
|
|
||||||
|
import com.hfkj.openapi.v1.model.request.RequestSeparateModel; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 开放api 交易利润分享 |
||||||
|
* @className: OpenApiTradeOrderProfitSharingService |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2023/5/23 |
||||||
|
**/ |
||||||
|
public interface OpenApiTradeOrderProfitSharingService { |
||||||
|
|
||||||
|
/** |
||||||
|
* 分账 |
||||||
|
* @param separateModel |
||||||
|
*/ |
||||||
|
Map<String, Object> separate(RequestSeparateModel separateModel); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,78 @@ |
|||||||
|
package com.hfkj.openapi.v1.service.impl; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.hfkj.channel.lakala.LaKaLaTradeService; |
||||||
|
import com.hfkj.common.exception.ErrorCode; |
||||||
|
import com.hfkj.common.exception.ErrorHelp; |
||||||
|
import com.hfkj.common.exception.SysCode; |
||||||
|
import com.hfkj.common.utils.DateUtil; |
||||||
|
import com.hfkj.dao.OpenApiTradeOrderMapper; |
||||||
|
import com.hfkj.entity.BsTradeOrder; |
||||||
|
import com.hfkj.entity.BsTradeOrderProfitSharing; |
||||||
|
import com.hfkj.entity.BsTradeOrderRefund; |
||||||
|
import com.hfkj.openapi.v1.model.TradeBillsModel; |
||||||
|
import com.hfkj.openapi.v1.model.request.RequestRefundTradeModel; |
||||||
|
import com.hfkj.openapi.v1.model.request.RequestSeparateModel; |
||||||
|
import com.hfkj.openapi.v1.model.response.ResponseRefundTradeModel; |
||||||
|
import com.hfkj.openapi.v1.service.OpenApiTradeOrderProfitSharingService; |
||||||
|
import com.hfkj.openapi.v1.service.OpenApiTradeOrderService; |
||||||
|
import com.hfkj.openapi.v1.utils.SignatureUtil; |
||||||
|
import com.hfkj.service.BsMerKeyService; |
||||||
|
import com.hfkj.service.BsTradeOrderProfitSharingService; |
||||||
|
import com.hfkj.service.BsTradeOrderRefundService; |
||||||
|
import com.hfkj.service.BsTradeOrderService; |
||||||
|
import com.hfkj.sysenum.*; |
||||||
|
import org.apache.commons.collections4.MapUtils; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
import org.springframework.transaction.annotation.Propagation; |
||||||
|
import org.springframework.transaction.annotation.Transactional; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.math.BigDecimal; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @className: TradeOrderServiceImpl |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2023/5/24 |
||||||
|
**/ |
||||||
|
@Service("openApiTradeOrderProfitSharingService") |
||||||
|
public class OpenApiTradeOrderProfitSharingServiceImpl implements OpenApiTradeOrderProfitSharingService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private BsTradeOrderProfitSharingService tradeOrderProfitSharingService; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private OpenApiTradeOrderService openApiTradeOrderService; |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional(propagation= Propagation.REQUIRES_NEW, timeout = 20) |
||||||
|
public Map<String, Object> separate(RequestSeparateModel separateModel) { |
||||||
|
// 查询交易订单
|
||||||
|
BsTradeOrder tradeOrder = openApiTradeOrderService.getOrderByOutTradeNo(separateModel.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, "交易订单不处于已支付"); |
||||||
|
} |
||||||
|
if (tradeOrder.getProfitSharingStatus().equals(false)) { |
||||||
|
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "交易订单不支持分账"); |
||||||
|
} |
||||||
|
BsTradeOrderProfitSharing tradeOrderProfitSharing = new BsTradeOrderProfitSharing(); |
||||||
|
tradeOrderProfitSharing.setCmdType(ProfitSharingCmdTypeEnum.CMD_TYPE_1.getNumber()); |
||||||
|
tradeOrderProfitSharing.setTradeOrderId(tradeOrder.getId()); |
||||||
|
tradeOrderProfitSharing.setTradeOrderNo(tradeOrder.getOutTradeNo()); |
||||||
|
tradeOrderProfitSharing.setProfitSharingOrderNo(separateModel.getOutSeparateNo()); |
||||||
|
tradeOrderProfitSharing.setPlatformType(tradeOrder.getPlatformType()); |
||||||
|
tradeOrderProfitSharing.setPlatformMerNo(tradeOrder.getPlatformMerNo()); |
||||||
|
tradeOrderProfitSharing.setPlatformTradeNo(tradeOrder.getPlatformTradeNo()); |
||||||
|
tradeOrderProfitSharing.setPlatformAppid(tradeOrder.getPlatformAppid()); |
||||||
|
tradeOrderProfitSharing.setProfitSharingAmoun(separateModel.getTotalAmount()); |
||||||
|
tradeOrderProfitSharing.setStatus(ProfitSharingStatusEnum.status0.getNumber()); |
||||||
|
tradeOrderProfitSharingService.editData(tradeOrderProfitSharing); |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue