diff --git a/open-api/src/main/java/com/api/controller/v1/TradeProfitSharingController.java b/open-api/src/main/java/com/api/controller/v1/TradeProfitSharingController.java index fdacbc8..2624aed 100644 --- a/open-api/src/main/java/com/api/controller/v1/TradeProfitSharingController.java +++ b/open-api/src/main/java/com/api/controller/v1/TradeProfitSharingController.java @@ -1,6 +1,7 @@ package com.api.controller.v1; 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; @@ -13,8 +14,8 @@ import com.hfkj.entity.BsTradeOrderRefund; import com.hfkj.model.ResponseData; import com.hfkj.openapi.v1.model.TradeBillsModel; 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.model.response.*; +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; @@ -24,6 +25,7 @@ import com.hfkj.service.BsTradeOrderProfitSharingService; import com.hfkj.sysenum.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; @@ -50,6 +52,8 @@ public class TradeProfitSharingController { @Resource private OpenApiTradeOrderService openApiTradeOrderService; @Resource + private OpenApiTradeOrderProfitSharingService openApiTradeOrderProfitSharingService; + @Resource private BsTradeOrderProfitSharingService tradeOrderProfitSharingService; @Resource private BsMerLedgerService merLedgerService; @@ -94,6 +98,10 @@ public class TradeProfitSharingController { throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "商户分账权限未开通"); } for (RequestSeparateModel.RequestSeparateRecvDataModel recvData : body.getRecvDatas()) { + // 校验接收方 + if (recvData.getRecvMerchantNo().equals(body.getMerchantNo())) { + throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "接收方不能与分账方主体相同"); + } // 查询接收方信息 BsMer recvMer = merService.getMer(recvData.getRecvMerchantNo()); if (recvMer == null) { @@ -102,12 +110,19 @@ public class TradeProfitSharingController { if (!recvMer.getMerStatus().equals(MerStatusEnum.status1.getNumber())) { throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "接收方状态异常"); } + // 接收方分账信息 + BsMerLedger ledger = merLedgerService.getMerLedger(recvMer.getId(), PlatformTypeEnum.type1); + if (ledger == null) { + throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "接收方状态异常"); + } + if (StringUtils.isBlank(ledger.getReceiverNo())) { + throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "接收方状态异常"); + } } - - - log.info("返回参数:" + JSONObject.toJSONString(null)); - return ResponseMsgUtil.success(null); + ResponseSeparateModel responseSeparateModel = openApiTradeOrderProfitSharingService.separate(body); + log.info("返回参数:" + JSONObject.toJSONString(responseSeparateModel)); + return ResponseMsgUtil.success(responseSeparateModel); } catch (Exception e) { log.info("出现异常:", e); @@ -120,17 +135,19 @@ public class TradeProfitSharingController { @RequestMapping(value="/cancel",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "分账撤销") - public ResponseData cancel(@Validated @RequestBody RequestTradePreorderModel body) { + public ResponseData cancel(@Validated @RequestBody RequestSeparateCancelModel 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); +*/ + ResponseSeparateCancelModel responseSeparateCancelModel = openApiTradeOrderProfitSharingService.cancel(body); + log.info("返回参数:" + JSONObject.toJSONString(responseSeparateCancelModel)); + return ResponseMsgUtil.success(responseSeparateCancelModel); } catch (Exception e) { log.info("出现异常:", e); @@ -140,43 +157,21 @@ public class TradeProfitSharingController { } } - @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) { + public ResponseData query(@Validated @RequestBody RequestSeparateQueryModel 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); + ResponseSeparateQueryModel query = openApiTradeOrderProfitSharingService.query(body); + log.info("返回参数:" + JSONObject.toJSONString(query)); + return ResponseMsgUtil.success(query); } catch (Exception e) { log.info("出现异常:", e); @@ -189,17 +184,19 @@ public class TradeProfitSharingController { @RequestMapping(value="/queryAmt",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "可分账金额查询") - public ResponseData queryAmt(@Validated @RequestBody RequestTradePreorderModel body) { + public ResponseData queryAmt(@Validated @RequestBody RequestSeparateQueryAmtModel 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); +*/ + ResponseSeparateQueryAmtModel responseSeparateQueryAmt = openApiTradeOrderProfitSharingService.queryAmt(body); + log.info("返回参数:" + JSONObject.toJSONString(responseSeparateQueryAmt)); + return ResponseMsgUtil.success(responseSeparateQueryAmt); } catch (Exception e) { log.info("出现异常:", e); diff --git a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaConfigService.java b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaConfigService.java index ee84fef..ff2815a 100644 --- a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaConfigService.java +++ b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaConfigService.java @@ -1,26 +1,15 @@ package com.hfkj.channel.lakala; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hfkj.channel.lakala.config.LaKaLaConfig; -import com.hfkj.channel.saas.utils.SaasCommon; 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.common.utils.GenerateUtil; import com.hfkj.common.utils.HttpsUtils; import com.hfkj.config.CommonSysConst; -import com.hfkj.entity.*; -import com.hfkj.model.MerBasisModel; -import com.hfkj.service.*; -import com.hfkj.sysenum.MerAttachType; -import com.hfkj.sysenum.PlatformTypeEnum; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import java.io.File; import java.util.*; /** diff --git a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeSeparateService.java b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeSeparateService.java index e04d1de..f04cbc9 100644 --- a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeSeparateService.java +++ b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeSeparateService.java @@ -40,7 +40,7 @@ public class LaKaLaTradeSeparateService { * @param profitSharingOrderNo * @return */ - public JSONObject separate(String profitSharingOrderNo) { + public BsTradeOrderProfitSharing separate(String profitSharingOrderNo) { // 交易分账 BsTradeOrderProfitSharing tradeOrderProfitSharing = tradeOrderProfitSharingService.getDetailByProfitSharingOrderNo(profitSharingOrderNo); if (null == tradeOrderProfitSharing) { @@ -92,7 +92,7 @@ public class LaKaLaTradeSeparateService { System.out.println("response:" + responseBody.toJSONString()); if (!responseBody.getString("code").equals("SACS0000")) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg")); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("msg")); } JSONObject respData = responseBody.getJSONObject("resp_data"); @@ -109,6 +109,7 @@ public class LaKaLaTradeSeparateService { } else if (statusCode.equals("FAIL")) { tradeOrderProfitSharing.setStatus(ProfitSharingStatusEnum.status4.getNumber()); } + tradeOrderProfitSharing.setProfitSharingOrderNo(respData.getString("separate_no")); tradeOrderProfitSharingService.editData(tradeOrderProfitSharing); // 处理接收方数据 @@ -121,7 +122,7 @@ public class LaKaLaTradeSeparateService { } } - return responseBody; + return tradeOrderProfitSharing; } public JSONObject queryAmt(String profitSharingOrderNo) { @@ -156,7 +157,7 @@ public class LaKaLaTradeSeparateService { } tradeOrderProfitSharing.setStatus(ProfitSharingStatusEnum.status2.getNumber()); tradeOrderProfitSharingService.editData(tradeOrderProfitSharing); - return responseBody; + return responseBody.getJSONObject("resp_data"); } /** @@ -176,8 +177,8 @@ public class LaKaLaTradeSeparateService { Map map = new HashMap<>(); map.put("merchant_no", tradeOrderProfitSharing.getPlatformMerNo()); - map.put("origin_out_separate_no", tradeOrderProfitSharing.getProfitSharingOrderNo()); - map.put("out_separate_no", tradeOrderProfitSharing.getProfitSharingOrderNo()+"1"); + map.put("origin_out_separate_no", tradeOrderProfitSharing.getOriginProfitSharingOrderNo()); + map.put("out_separate_no", tradeOrderProfitSharing.getProfitSharingOrderNo()); map.put("total_amt", tradeOrderProfitSharing.getProfitSharingAmoun().multiply(new BigDecimal("100")).longValue()); commonParam.put("req_data", map); diff --git a/service/src/main/java/com/hfkj/dao/BsTradeOrderMapper.java b/service/src/main/java/com/hfkj/dao/BsTradeOrderMapper.java index 8c85b6e..3a25f41 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeOrderMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeOrderMapper.java @@ -65,7 +65,8 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt { "card_type, `status`, ", "profit_sharing_status, pay_time, ", "timeout_express, subject, ", - "pay_notify_url, attach, ", + "pay_notify_url, shd_fee_amt, ", + "fee_rate, attach, ", "refund_type, refund_price, ", "create_type, create_time, ", "cancel_time, update_time, ", @@ -96,7 +97,8 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt { "#{cardType,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", "#{profitSharingStatus,jdbcType=BIT}, #{payTime,jdbcType=TIMESTAMP}, ", "#{timeoutExpress,jdbcType=INTEGER}, #{subject,jdbcType=VARCHAR}, ", - "#{payNotifyUrl,jdbcType=VARCHAR}, #{attach,jdbcType=VARCHAR}, ", + "#{payNotifyUrl,jdbcType=VARCHAR}, #{shdFeeAmt,jdbcType=DECIMAL}, ", + "#{feeRate,jdbcType=DECIMAL}, #{attach,jdbcType=VARCHAR}, ", "#{refundType,jdbcType=INTEGER}, #{refundPrice,jdbcType=DECIMAL}, ", "#{createType,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", "#{cancelTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", @@ -166,6 +168,8 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt { @Result(column="timeout_express", property="timeoutExpress", jdbcType=JdbcType.INTEGER), @Result(column="subject", property="subject", jdbcType=JdbcType.VARCHAR), @Result(column="pay_notify_url", property="payNotifyUrl", jdbcType=JdbcType.VARCHAR), + @Result(column="shd_fee_amt", property="shdFeeAmt", jdbcType=JdbcType.DECIMAL), + @Result(column="fee_rate", property="feeRate", jdbcType=JdbcType.DECIMAL), @Result(column="attach", property="attach", jdbcType=JdbcType.VARCHAR), @Result(column="refund_type", property="refundType", jdbcType=JdbcType.INTEGER), @Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL), @@ -191,9 +195,9 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt { "user_discount_id, user_discount_name, user_discount_type, user_discount_price, ", "user_discount_actual_price, trade_actual_amount, income_amout, acc_trade_no, ", "acc_mdiscount_amount, acc_discount_amount, acc_payment_code, card_type, `status`, ", - "profit_sharing_status, pay_time, timeout_express, subject, pay_notify_url, attach, ", - "refund_type, refund_price, create_type, create_time, cancel_time, update_time, ", - "ext_1, ext_2, ext_3", + "profit_sharing_status, pay_time, timeout_express, subject, pay_notify_url, shd_fee_amt, ", + "fee_rate, attach, refund_type, refund_price, create_type, create_time, cancel_time, ", + "update_time, ext_1, ext_2, ext_3", "from bs_trade_order", "where id = #{id,jdbcType=BIGINT}" }) @@ -253,6 +257,8 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt { @Result(column="timeout_express", property="timeoutExpress", jdbcType=JdbcType.INTEGER), @Result(column="subject", property="subject", jdbcType=JdbcType.VARCHAR), @Result(column="pay_notify_url", property="payNotifyUrl", jdbcType=JdbcType.VARCHAR), + @Result(column="shd_fee_amt", property="shdFeeAmt", jdbcType=JdbcType.DECIMAL), + @Result(column="fee_rate", property="feeRate", jdbcType=JdbcType.DECIMAL), @Result(column="attach", property="attach", jdbcType=JdbcType.VARCHAR), @Result(column="refund_type", property="refundType", jdbcType=JdbcType.INTEGER), @Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL), @@ -331,6 +337,8 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt { "timeout_express = #{timeoutExpress,jdbcType=INTEGER},", "subject = #{subject,jdbcType=VARCHAR},", "pay_notify_url = #{payNotifyUrl,jdbcType=VARCHAR},", + "shd_fee_amt = #{shdFeeAmt,jdbcType=DECIMAL},", + "fee_rate = #{feeRate,jdbcType=DECIMAL},", "attach = #{attach,jdbcType=VARCHAR},", "refund_type = #{refundType,jdbcType=INTEGER},", "refund_price = #{refundPrice,jdbcType=DECIMAL},", diff --git a/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingMapper.java b/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingMapper.java index 0e695de..b93088d 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingMapper.java @@ -45,18 +45,20 @@ public interface BsTradeOrderProfitSharingMapper extends BsTradeOrderProfitShari "platform_profit_sharing_order_no, platform_mer_no, ", "platform_trade_no, platform_appid, ", "ratio, profit_sharing_amoun, ", - "`status`, create_time, ", - "profit_sharing_time, finish_time, ", - "ext_1, ext_2, ext_3)", + "`status`, create_type, ", + "create_time, profit_sharing_time, ", + "finish_time, ext_1, ", + "ext_2, ext_3)", "values (#{cmdType,jdbcType=INTEGER}, #{tradeOrderId,jdbcType=BIGINT}, ", "#{tradeOrderNo,jdbcType=VARCHAR}, #{originProfitSharingOrderNo,jdbcType=VARCHAR}, ", "#{profitSharingOrderNo,jdbcType=VARCHAR}, #{platformType,jdbcType=INTEGER}, ", "#{platformProfitSharingOrderNo,jdbcType=VARCHAR}, #{platformMerNo,jdbcType=VARCHAR}, ", "#{platformTradeNo,jdbcType=VARCHAR}, #{platformAppid,jdbcType=VARCHAR}, ", "#{ratio,jdbcType=DECIMAL}, #{profitSharingAmoun,jdbcType=DECIMAL}, ", - "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{profitSharingTime,jdbcType=TIMESTAMP}, #{finishTime,jdbcType=TIMESTAMP}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{status,jdbcType=INTEGER}, #{createType,jdbcType=INTEGER}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{profitSharingTime,jdbcType=TIMESTAMP}, ", + "#{finishTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(BsTradeOrderProfitSharing record); @@ -81,6 +83,7 @@ public interface BsTradeOrderProfitSharingMapper extends BsTradeOrderProfitShari @Result(column="ratio", property="ratio", jdbcType=JdbcType.DECIMAL), @Result(column="profit_sharing_amoun", property="profitSharingAmoun", jdbcType=JdbcType.DECIMAL), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="create_type", property="createType", jdbcType=JdbcType.INTEGER), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="profit_sharing_time", property="profitSharingTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP), @@ -94,8 +97,8 @@ public interface BsTradeOrderProfitSharingMapper extends BsTradeOrderProfitShari "select", "id, cmd_type, trade_order_id, trade_order_no, origin_profit_sharing_order_no, ", "profit_sharing_order_no, platform_type, platform_profit_sharing_order_no, platform_mer_no, ", - "platform_trade_no, platform_appid, ratio, profit_sharing_amoun, `status`, create_time, ", - "profit_sharing_time, finish_time, ext_1, ext_2, ext_3", + "platform_trade_no, platform_appid, ratio, profit_sharing_amoun, `status`, create_type, ", + "create_time, profit_sharing_time, finish_time, ext_1, ext_2, ext_3", "from bs_trade_order_profit_sharing", "where id = #{id,jdbcType=BIGINT}" }) @@ -114,6 +117,7 @@ public interface BsTradeOrderProfitSharingMapper extends BsTradeOrderProfitShari @Result(column="ratio", property="ratio", jdbcType=JdbcType.DECIMAL), @Result(column="profit_sharing_amoun", property="profitSharingAmoun", jdbcType=JdbcType.DECIMAL), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="create_type", property="createType", jdbcType=JdbcType.INTEGER), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="profit_sharing_time", property="profitSharingTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP), @@ -147,6 +151,7 @@ public interface BsTradeOrderProfitSharingMapper extends BsTradeOrderProfitShari "ratio = #{ratio,jdbcType=DECIMAL},", "profit_sharing_amoun = #{profitSharingAmoun,jdbcType=DECIMAL},", "`status` = #{status,jdbcType=INTEGER},", + "create_type = #{createType,jdbcType=INTEGER},", "create_time = #{createTime,jdbcType=TIMESTAMP},", "profit_sharing_time = #{profitSharingTime,jdbcType=TIMESTAMP},", "finish_time = #{finishTime,jdbcType=TIMESTAMP},", diff --git a/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingReceiverMapper.java b/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingReceiverMapper.java index 3b46d25..188999e 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingReceiverMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingReceiverMapper.java @@ -42,19 +42,21 @@ public interface BsTradeOrderProfitSharingReceiverMapper extends BsTradeOrderPro "insert into bs_trade_order_profit_sharing_receiver (trade_order_profit_sharing_id, trade_order_id, ", "trade_order_no, profit_sharing_amount, ", "ratio, receiver_object_type, ", - "receiver_object_id, receiver_account, ", - "receiver_name, receiver_amount, ", - "`status`, create_time, ", - "profit_sharing_time, finish_time, ", - "ext_1, ext_2, ext_3)", + "receiver_object_id, receiver_no, ", + "receiver_account, receiver_name, ", + "receiver_amount, `status`, ", + "create_time, profit_sharing_time, ", + "finish_time, ext_1, ", + "ext_2, ext_3)", "values (#{tradeOrderProfitSharingId,jdbcType=BIGINT}, #{tradeOrderId,jdbcType=BIGINT}, ", "#{tradeOrderNo,jdbcType=VARCHAR}, #{profitSharingAmount,jdbcType=DECIMAL}, ", "#{ratio,jdbcType=DECIMAL}, #{receiverObjectType,jdbcType=INTEGER}, ", - "#{receiverObjectId,jdbcType=VARCHAR}, #{receiverAccount,jdbcType=VARCHAR}, ", - "#{receiverName,jdbcType=VARCHAR}, #{receiverAmount,jdbcType=DECIMAL}, ", - "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{profitSharingTime,jdbcType=TIMESTAMP}, #{finishTime,jdbcType=TIMESTAMP}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{receiverObjectId,jdbcType=VARCHAR}, #{receiverNo,jdbcType=VARCHAR}, ", + "#{receiverAccount,jdbcType=VARCHAR}, #{receiverName,jdbcType=VARCHAR}, ", + "#{receiverAmount,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{profitSharingTime,jdbcType=TIMESTAMP}, ", + "#{finishTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(BsTradeOrderProfitSharingReceiver record); @@ -73,6 +75,7 @@ public interface BsTradeOrderProfitSharingReceiverMapper extends BsTradeOrderPro @Result(column="ratio", property="ratio", jdbcType=JdbcType.DECIMAL), @Result(column="receiver_object_type", property="receiverObjectType", jdbcType=JdbcType.INTEGER), @Result(column="receiver_object_id", property="receiverObjectId", jdbcType=JdbcType.VARCHAR), + @Result(column="receiver_no", property="receiverNo", jdbcType=JdbcType.VARCHAR), @Result(column="receiver_account", property="receiverAccount", jdbcType=JdbcType.VARCHAR), @Result(column="receiver_name", property="receiverName", jdbcType=JdbcType.VARCHAR), @Result(column="receiver_amount", property="receiverAmount", jdbcType=JdbcType.DECIMAL), @@ -89,9 +92,9 @@ public interface BsTradeOrderProfitSharingReceiverMapper extends BsTradeOrderPro @Select({ "select", "id, trade_order_profit_sharing_id, trade_order_id, trade_order_no, profit_sharing_amount, ", - "ratio, receiver_object_type, receiver_object_id, receiver_account, receiver_name, ", - "receiver_amount, `status`, create_time, profit_sharing_time, finish_time, ext_1, ", - "ext_2, ext_3", + "ratio, receiver_object_type, receiver_object_id, receiver_no, receiver_account, ", + "receiver_name, receiver_amount, `status`, create_time, profit_sharing_time, ", + "finish_time, ext_1, ext_2, ext_3", "from bs_trade_order_profit_sharing_receiver", "where id = #{id,jdbcType=BIGINT}" }) @@ -104,6 +107,7 @@ public interface BsTradeOrderProfitSharingReceiverMapper extends BsTradeOrderPro @Result(column="ratio", property="ratio", jdbcType=JdbcType.DECIMAL), @Result(column="receiver_object_type", property="receiverObjectType", jdbcType=JdbcType.INTEGER), @Result(column="receiver_object_id", property="receiverObjectId", jdbcType=JdbcType.VARCHAR), + @Result(column="receiver_no", property="receiverNo", jdbcType=JdbcType.VARCHAR), @Result(column="receiver_account", property="receiverAccount", jdbcType=JdbcType.VARCHAR), @Result(column="receiver_name", property="receiverName", jdbcType=JdbcType.VARCHAR), @Result(column="receiver_amount", property="receiverAmount", jdbcType=JdbcType.DECIMAL), @@ -135,6 +139,7 @@ public interface BsTradeOrderProfitSharingReceiverMapper extends BsTradeOrderPro "ratio = #{ratio,jdbcType=DECIMAL},", "receiver_object_type = #{receiverObjectType,jdbcType=INTEGER},", "receiver_object_id = #{receiverObjectId,jdbcType=VARCHAR},", + "receiver_no = #{receiverNo,jdbcType=VARCHAR},", "receiver_account = #{receiverAccount,jdbcType=VARCHAR},", "receiver_name = #{receiverName,jdbcType=VARCHAR},", "receiver_amount = #{receiverAmount,jdbcType=DECIMAL},", diff --git a/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingReceiverSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingReceiverSqlProvider.java index fe9c753..98d1bab 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingReceiverSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingReceiverSqlProvider.java @@ -56,6 +56,10 @@ public class BsTradeOrderProfitSharingReceiverSqlProvider { sql.VALUES("receiver_object_id", "#{receiverObjectId,jdbcType=VARCHAR}"); } + if (record.getReceiverNo() != null) { + sql.VALUES("receiver_no", "#{receiverNo,jdbcType=VARCHAR}"); + } + if (record.getReceiverAccount() != null) { sql.VALUES("receiver_account", "#{receiverAccount,jdbcType=VARCHAR}"); } @@ -113,6 +117,7 @@ public class BsTradeOrderProfitSharingReceiverSqlProvider { sql.SELECT("ratio"); sql.SELECT("receiver_object_type"); sql.SELECT("receiver_object_id"); + sql.SELECT("receiver_no"); sql.SELECT("receiver_account"); sql.SELECT("receiver_name"); sql.SELECT("receiver_amount"); @@ -172,6 +177,10 @@ public class BsTradeOrderProfitSharingReceiverSqlProvider { sql.SET("receiver_object_id = #{record.receiverObjectId,jdbcType=VARCHAR}"); } + if (record.getReceiverNo() != null) { + sql.SET("receiver_no = #{record.receiverNo,jdbcType=VARCHAR}"); + } + if (record.getReceiverAccount() != null) { sql.SET("receiver_account = #{record.receiverAccount,jdbcType=VARCHAR}"); } @@ -228,6 +237,7 @@ public class BsTradeOrderProfitSharingReceiverSqlProvider { sql.SET("ratio = #{record.ratio,jdbcType=DECIMAL}"); sql.SET("receiver_object_type = #{record.receiverObjectType,jdbcType=INTEGER}"); sql.SET("receiver_object_id = #{record.receiverObjectId,jdbcType=VARCHAR}"); + sql.SET("receiver_no = #{record.receiverNo,jdbcType=VARCHAR}"); sql.SET("receiver_account = #{record.receiverAccount,jdbcType=VARCHAR}"); sql.SET("receiver_name = #{record.receiverName,jdbcType=VARCHAR}"); sql.SET("receiver_amount = #{record.receiverAmount,jdbcType=DECIMAL}"); @@ -276,6 +286,10 @@ public class BsTradeOrderProfitSharingReceiverSqlProvider { sql.SET("receiver_object_id = #{receiverObjectId,jdbcType=VARCHAR}"); } + if (record.getReceiverNo() != null) { + sql.SET("receiver_no = #{receiverNo,jdbcType=VARCHAR}"); + } + if (record.getReceiverAccount() != null) { sql.SET("receiver_account = #{receiverAccount,jdbcType=VARCHAR}"); } diff --git a/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingSqlProvider.java index f9a40ba..46b6dc0 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeOrderProfitSharingSqlProvider.java @@ -80,6 +80,10 @@ public class BsTradeOrderProfitSharingSqlProvider { sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); } + if (record.getCreateType() != null) { + sql.VALUES("create_type", "#{createType,jdbcType=INTEGER}"); + } + if (record.getCreateTime() != null) { sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); } @@ -127,6 +131,7 @@ public class BsTradeOrderProfitSharingSqlProvider { sql.SELECT("ratio"); sql.SELECT("profit_sharing_amoun"); sql.SELECT("`status`"); + sql.SELECT("create_type"); sql.SELECT("create_time"); sql.SELECT("profit_sharing_time"); sql.SELECT("finish_time"); @@ -206,6 +211,10 @@ public class BsTradeOrderProfitSharingSqlProvider { sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); } + if (record.getCreateType() != null) { + sql.SET("create_type = #{record.createType,jdbcType=INTEGER}"); + } + if (record.getCreateTime() != null) { sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); } @@ -252,6 +261,7 @@ public class BsTradeOrderProfitSharingSqlProvider { sql.SET("ratio = #{record.ratio,jdbcType=DECIMAL}"); sql.SET("profit_sharing_amoun = #{record.profitSharingAmoun,jdbcType=DECIMAL}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + sql.SET("create_type = #{record.createType,jdbcType=INTEGER}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("profit_sharing_time = #{record.profitSharingTime,jdbcType=TIMESTAMP}"); sql.SET("finish_time = #{record.finishTime,jdbcType=TIMESTAMP}"); @@ -320,6 +330,10 @@ public class BsTradeOrderProfitSharingSqlProvider { sql.SET("`status` = #{status,jdbcType=INTEGER}"); } + if (record.getCreateType() != null) { + sql.SET("create_type = #{createType,jdbcType=INTEGER}"); + } + if (record.getCreateTime() != null) { sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); } diff --git a/service/src/main/java/com/hfkj/dao/BsTradeOrderSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsTradeOrderSqlProvider.java index 3eff2b1..b445041 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeOrderSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeOrderSqlProvider.java @@ -244,6 +244,14 @@ public class BsTradeOrderSqlProvider { sql.VALUES("pay_notify_url", "#{payNotifyUrl,jdbcType=VARCHAR}"); } + if (record.getShdFeeAmt() != null) { + sql.VALUES("shd_fee_amt", "#{shdFeeAmt,jdbcType=DECIMAL}"); + } + + if (record.getFeeRate() != null) { + sql.VALUES("fee_rate", "#{feeRate,jdbcType=DECIMAL}"); + } + if (record.getAttach() != null) { sql.VALUES("attach", "#{attach,jdbcType=VARCHAR}"); } @@ -348,6 +356,8 @@ public class BsTradeOrderSqlProvider { sql.SELECT("timeout_express"); sql.SELECT("subject"); sql.SELECT("pay_notify_url"); + sql.SELECT("shd_fee_amt"); + sql.SELECT("fee_rate"); sql.SELECT("attach"); sql.SELECT("refund_type"); sql.SELECT("refund_price"); @@ -595,6 +605,14 @@ public class BsTradeOrderSqlProvider { sql.SET("pay_notify_url = #{record.payNotifyUrl,jdbcType=VARCHAR}"); } + if (record.getShdFeeAmt() != null) { + sql.SET("shd_fee_amt = #{record.shdFeeAmt,jdbcType=DECIMAL}"); + } + + if (record.getFeeRate() != null) { + sql.SET("fee_rate = #{record.feeRate,jdbcType=DECIMAL}"); + } + if (record.getAttach() != null) { sql.SET("attach = #{record.attach,jdbcType=VARCHAR}"); } @@ -698,6 +716,8 @@ public class BsTradeOrderSqlProvider { sql.SET("timeout_express = #{record.timeoutExpress,jdbcType=INTEGER}"); sql.SET("subject = #{record.subject,jdbcType=VARCHAR}"); sql.SET("pay_notify_url = #{record.payNotifyUrl,jdbcType=VARCHAR}"); + sql.SET("shd_fee_amt = #{record.shdFeeAmt,jdbcType=DECIMAL}"); + sql.SET("fee_rate = #{record.feeRate,jdbcType=DECIMAL}"); sql.SET("attach = #{record.attach,jdbcType=VARCHAR}"); sql.SET("refund_type = #{record.refundType,jdbcType=INTEGER}"); sql.SET("refund_price = #{record.refundPrice,jdbcType=DECIMAL}"); @@ -934,6 +954,14 @@ public class BsTradeOrderSqlProvider { sql.SET("pay_notify_url = #{payNotifyUrl,jdbcType=VARCHAR}"); } + if (record.getShdFeeAmt() != null) { + sql.SET("shd_fee_amt = #{shdFeeAmt,jdbcType=DECIMAL}"); + } + + if (record.getFeeRate() != null) { + sql.SET("fee_rate = #{feeRate,jdbcType=DECIMAL}"); + } + if (record.getAttach() != null) { sql.SET("attach = #{attach,jdbcType=VARCHAR}"); } diff --git a/service/src/main/java/com/hfkj/entity/BsTradeOrder.java b/service/src/main/java/com/hfkj/entity/BsTradeOrder.java index 19e8ae0..8a0b90d 100644 --- a/service/src/main/java/com/hfkj/entity/BsTradeOrder.java +++ b/service/src/main/java/com/hfkj/entity/BsTradeOrder.java @@ -293,6 +293,16 @@ public class BsTradeOrder implements Serializable { */ private String payNotifyUrl; + /** + * 交易手续费 + */ + private BigDecimal shdFeeAmt; + + /** + * 费率 + */ + private BigDecimal feeRate; + /** * 附加域 */ @@ -776,6 +786,22 @@ public class BsTradeOrder implements Serializable { this.payNotifyUrl = payNotifyUrl; } + public BigDecimal getShdFeeAmt() { + return shdFeeAmt; + } + + public void setShdFeeAmt(BigDecimal shdFeeAmt) { + this.shdFeeAmt = shdFeeAmt; + } + + public BigDecimal getFeeRate() { + return feeRate; + } + + public void setFeeRate(BigDecimal feeRate) { + this.feeRate = feeRate; + } + public String getAttach() { return attach; } @@ -923,6 +949,8 @@ public class BsTradeOrder implements Serializable { && (this.getTimeoutExpress() == null ? other.getTimeoutExpress() == null : this.getTimeoutExpress().equals(other.getTimeoutExpress())) && (this.getSubject() == null ? other.getSubject() == null : this.getSubject().equals(other.getSubject())) && (this.getPayNotifyUrl() == null ? other.getPayNotifyUrl() == null : this.getPayNotifyUrl().equals(other.getPayNotifyUrl())) + && (this.getShdFeeAmt() == null ? other.getShdFeeAmt() == null : this.getShdFeeAmt().equals(other.getShdFeeAmt())) + && (this.getFeeRate() == null ? other.getFeeRate() == null : this.getFeeRate().equals(other.getFeeRate())) && (this.getAttach() == null ? other.getAttach() == null : this.getAttach().equals(other.getAttach())) && (this.getRefundType() == null ? other.getRefundType() == null : this.getRefundType().equals(other.getRefundType())) && (this.getRefundPrice() == null ? other.getRefundPrice() == null : this.getRefundPrice().equals(other.getRefundPrice())) @@ -994,6 +1022,8 @@ public class BsTradeOrder implements Serializable { result = prime * result + ((getTimeoutExpress() == null) ? 0 : getTimeoutExpress().hashCode()); result = prime * result + ((getSubject() == null) ? 0 : getSubject().hashCode()); result = prime * result + ((getPayNotifyUrl() == null) ? 0 : getPayNotifyUrl().hashCode()); + result = prime * result + ((getShdFeeAmt() == null) ? 0 : getShdFeeAmt().hashCode()); + result = prime * result + ((getFeeRate() == null) ? 0 : getFeeRate().hashCode()); result = prime * result + ((getAttach() == null) ? 0 : getAttach().hashCode()); result = prime * result + ((getRefundType() == null) ? 0 : getRefundType().hashCode()); result = prime * result + ((getRefundPrice() == null) ? 0 : getRefundPrice().hashCode()); @@ -1068,6 +1098,8 @@ public class BsTradeOrder implements Serializable { sb.append(", timeoutExpress=").append(timeoutExpress); sb.append(", subject=").append(subject); sb.append(", payNotifyUrl=").append(payNotifyUrl); + sb.append(", shdFeeAmt=").append(shdFeeAmt); + sb.append(", feeRate=").append(feeRate); sb.append(", attach=").append(attach); sb.append(", refundType=").append(refundType); sb.append(", refundPrice=").append(refundPrice); diff --git a/service/src/main/java/com/hfkj/entity/BsTradeOrderExample.java b/service/src/main/java/com/hfkj/entity/BsTradeOrderExample.java index ae05523..29ac44f 100644 --- a/service/src/main/java/com/hfkj/entity/BsTradeOrderExample.java +++ b/service/src/main/java/com/hfkj/entity/BsTradeOrderExample.java @@ -3646,6 +3646,126 @@ public class BsTradeOrderExample { return (Criteria) this; } + public Criteria andShdFeeAmtIsNull() { + addCriterion("shd_fee_amt is null"); + return (Criteria) this; + } + + public Criteria andShdFeeAmtIsNotNull() { + addCriterion("shd_fee_amt is not null"); + return (Criteria) this; + } + + public Criteria andShdFeeAmtEqualTo(BigDecimal value) { + addCriterion("shd_fee_amt =", value, "shdFeeAmt"); + return (Criteria) this; + } + + public Criteria andShdFeeAmtNotEqualTo(BigDecimal value) { + addCriterion("shd_fee_amt <>", value, "shdFeeAmt"); + return (Criteria) this; + } + + public Criteria andShdFeeAmtGreaterThan(BigDecimal value) { + addCriterion("shd_fee_amt >", value, "shdFeeAmt"); + return (Criteria) this; + } + + public Criteria andShdFeeAmtGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("shd_fee_amt >=", value, "shdFeeAmt"); + return (Criteria) this; + } + + public Criteria andShdFeeAmtLessThan(BigDecimal value) { + addCriterion("shd_fee_amt <", value, "shdFeeAmt"); + return (Criteria) this; + } + + public Criteria andShdFeeAmtLessThanOrEqualTo(BigDecimal value) { + addCriterion("shd_fee_amt <=", value, "shdFeeAmt"); + return (Criteria) this; + } + + public Criteria andShdFeeAmtIn(List values) { + addCriterion("shd_fee_amt in", values, "shdFeeAmt"); + return (Criteria) this; + } + + public Criteria andShdFeeAmtNotIn(List values) { + addCriterion("shd_fee_amt not in", values, "shdFeeAmt"); + return (Criteria) this; + } + + public Criteria andShdFeeAmtBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("shd_fee_amt between", value1, value2, "shdFeeAmt"); + return (Criteria) this; + } + + public Criteria andShdFeeAmtNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("shd_fee_amt not between", value1, value2, "shdFeeAmt"); + return (Criteria) this; + } + + public Criteria andFeeRateIsNull() { + addCriterion("fee_rate is null"); + return (Criteria) this; + } + + public Criteria andFeeRateIsNotNull() { + addCriterion("fee_rate is not null"); + return (Criteria) this; + } + + public Criteria andFeeRateEqualTo(BigDecimal value) { + addCriterion("fee_rate =", value, "feeRate"); + return (Criteria) this; + } + + public Criteria andFeeRateNotEqualTo(BigDecimal value) { + addCriterion("fee_rate <>", value, "feeRate"); + return (Criteria) this; + } + + public Criteria andFeeRateGreaterThan(BigDecimal value) { + addCriterion("fee_rate >", value, "feeRate"); + return (Criteria) this; + } + + public Criteria andFeeRateGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("fee_rate >=", value, "feeRate"); + return (Criteria) this; + } + + public Criteria andFeeRateLessThan(BigDecimal value) { + addCriterion("fee_rate <", value, "feeRate"); + return (Criteria) this; + } + + public Criteria andFeeRateLessThanOrEqualTo(BigDecimal value) { + addCriterion("fee_rate <=", value, "feeRate"); + return (Criteria) this; + } + + public Criteria andFeeRateIn(List values) { + addCriterion("fee_rate in", values, "feeRate"); + return (Criteria) this; + } + + public Criteria andFeeRateNotIn(List values) { + addCriterion("fee_rate not in", values, "feeRate"); + return (Criteria) this; + } + + public Criteria andFeeRateBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("fee_rate between", value1, value2, "feeRate"); + return (Criteria) this; + } + + public Criteria andFeeRateNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("fee_rate not between", value1, value2, "feeRate"); + return (Criteria) this; + } + public Criteria andAttachIsNull() { addCriterion("attach is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharing.java b/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharing.java index 40f83eb..c1eb118 100644 --- a/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharing.java +++ b/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharing.java @@ -21,7 +21,7 @@ public class BsTradeOrderProfitSharing implements Serializable { /** * 指令类型 1:分账 2:分账撤销 -3:分账回退 + 3:分账回退 */ private Integer cmdType; @@ -81,10 +81,15 @@ public class BsTradeOrderProfitSharing implements Serializable { private BigDecimal profitSharingAmoun; /** - * 分账状态 0:未分账 1:已分账 2:处理中 3:已受理 4:分账失败 + * 分账状态 0:待处理 1:已完成 2:处理中 3:已受理 4:失败 */ private Integer status; + /** + * 创建方式 1:系统 2:API + */ + private Integer createType; + /** * 创建时间 */ @@ -220,6 +225,14 @@ public class BsTradeOrderProfitSharing implements Serializable { this.status = status; } + public Integer getCreateType() { + return createType; + } + + public void setCreateType(Integer createType) { + this.createType = createType; + } + public Date getCreateTime() { return createTime; } @@ -294,6 +307,7 @@ public class BsTradeOrderProfitSharing implements Serializable { && (this.getRatio() == null ? other.getRatio() == null : this.getRatio().equals(other.getRatio())) && (this.getProfitSharingAmoun() == null ? other.getProfitSharingAmoun() == null : this.getProfitSharingAmoun().equals(other.getProfitSharingAmoun())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) + && (this.getCreateType() == null ? other.getCreateType() == null : this.getCreateType().equals(other.getCreateType())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getProfitSharingTime() == null ? other.getProfitSharingTime() == null : this.getProfitSharingTime().equals(other.getProfitSharingTime())) && (this.getFinishTime() == null ? other.getFinishTime() == null : this.getFinishTime().equals(other.getFinishTime())) @@ -320,6 +334,7 @@ public class BsTradeOrderProfitSharing implements Serializable { result = prime * result + ((getRatio() == null) ? 0 : getRatio().hashCode()); result = prime * result + ((getProfitSharingAmoun() == null) ? 0 : getProfitSharingAmoun().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); + result = prime * result + ((getCreateType() == null) ? 0 : getCreateType().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getProfitSharingTime() == null) ? 0 : getProfitSharingTime().hashCode()); result = prime * result + ((getFinishTime() == null) ? 0 : getFinishTime().hashCode()); @@ -349,6 +364,7 @@ public class BsTradeOrderProfitSharing implements Serializable { sb.append(", ratio=").append(ratio); sb.append(", profitSharingAmoun=").append(profitSharingAmoun); sb.append(", status=").append(status); + sb.append(", createType=").append(createType); sb.append(", createTime=").append(createTime); sb.append(", profitSharingTime=").append(profitSharingTime); sb.append(", finishTime=").append(finishTime); diff --git a/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharingExample.java b/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharingExample.java index 3423091..75f50db 100644 --- a/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharingExample.java +++ b/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharingExample.java @@ -1036,6 +1036,66 @@ public class BsTradeOrderProfitSharingExample { return (Criteria) this; } + public Criteria andCreateTypeIsNull() { + addCriterion("create_type is null"); + return (Criteria) this; + } + + public Criteria andCreateTypeIsNotNull() { + addCriterion("create_type is not null"); + return (Criteria) this; + } + + public Criteria andCreateTypeEqualTo(Integer value) { + addCriterion("create_type =", value, "createType"); + return (Criteria) this; + } + + public Criteria andCreateTypeNotEqualTo(Integer value) { + addCriterion("create_type <>", value, "createType"); + return (Criteria) this; + } + + public Criteria andCreateTypeGreaterThan(Integer value) { + addCriterion("create_type >", value, "createType"); + return (Criteria) this; + } + + public Criteria andCreateTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("create_type >=", value, "createType"); + return (Criteria) this; + } + + public Criteria andCreateTypeLessThan(Integer value) { + addCriterion("create_type <", value, "createType"); + return (Criteria) this; + } + + public Criteria andCreateTypeLessThanOrEqualTo(Integer value) { + addCriterion("create_type <=", value, "createType"); + return (Criteria) this; + } + + public Criteria andCreateTypeIn(List values) { + addCriterion("create_type in", values, "createType"); + return (Criteria) this; + } + + public Criteria andCreateTypeNotIn(List values) { + addCriterion("create_type not in", values, "createType"); + return (Criteria) this; + } + + public Criteria andCreateTypeBetween(Integer value1, Integer value2) { + addCriterion("create_type between", value1, value2, "createType"); + return (Criteria) this; + } + + public Criteria andCreateTypeNotBetween(Integer value1, Integer value2) { + addCriterion("create_type not between", value1, value2, "createType"); + return (Criteria) this; + } + public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharingReceiver.java b/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharingReceiver.java index 83029a4..e79b487 100644 --- a/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharingReceiver.java +++ b/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharingReceiver.java @@ -45,7 +45,7 @@ public class BsTradeOrderProfitSharingReceiver implements Serializable { private BigDecimal ratio; /** - * 分账接收方类型 1. 运营公司 2. 分公司 3. 代理商 + * 分账接收方类型 1. 运营公司 2. 分公司 3. 代理商 4. 商户 */ private Integer receiverObjectType; @@ -54,6 +54,11 @@ public class BsTradeOrderProfitSharingReceiver implements Serializable { */ private String receiverObjectId; + /** + * 分账接收方账户编号 + */ + private String receiverNo; + /** * 分账接收方账户 */ @@ -70,7 +75,7 @@ public class BsTradeOrderProfitSharingReceiver implements Serializable { private BigDecimal receiverAmount; /** - * 分账状态 0:未分账 1:已分账 2:已完成 + * 分账状态 0:未分账 1:已分账 */ private Integer status; @@ -161,6 +166,14 @@ public class BsTradeOrderProfitSharingReceiver implements Serializable { this.receiverObjectId = receiverObjectId; } + public String getReceiverNo() { + return receiverNo; + } + + public void setReceiverNo(String receiverNo) { + this.receiverNo = receiverNo; + } + public String getReceiverAccount() { return receiverAccount; } @@ -261,6 +274,7 @@ public class BsTradeOrderProfitSharingReceiver implements Serializable { && (this.getRatio() == null ? other.getRatio() == null : this.getRatio().equals(other.getRatio())) && (this.getReceiverObjectType() == null ? other.getReceiverObjectType() == null : this.getReceiverObjectType().equals(other.getReceiverObjectType())) && (this.getReceiverObjectId() == null ? other.getReceiverObjectId() == null : this.getReceiverObjectId().equals(other.getReceiverObjectId())) + && (this.getReceiverNo() == null ? other.getReceiverNo() == null : this.getReceiverNo().equals(other.getReceiverNo())) && (this.getReceiverAccount() == null ? other.getReceiverAccount() == null : this.getReceiverAccount().equals(other.getReceiverAccount())) && (this.getReceiverName() == null ? other.getReceiverName() == null : this.getReceiverName().equals(other.getReceiverName())) && (this.getReceiverAmount() == null ? other.getReceiverAmount() == null : this.getReceiverAmount().equals(other.getReceiverAmount())) @@ -285,6 +299,7 @@ public class BsTradeOrderProfitSharingReceiver implements Serializable { result = prime * result + ((getRatio() == null) ? 0 : getRatio().hashCode()); result = prime * result + ((getReceiverObjectType() == null) ? 0 : getReceiverObjectType().hashCode()); result = prime * result + ((getReceiverObjectId() == null) ? 0 : getReceiverObjectId().hashCode()); + result = prime * result + ((getReceiverNo() == null) ? 0 : getReceiverNo().hashCode()); result = prime * result + ((getReceiverAccount() == null) ? 0 : getReceiverAccount().hashCode()); result = prime * result + ((getReceiverName() == null) ? 0 : getReceiverName().hashCode()); result = prime * result + ((getReceiverAmount() == null) ? 0 : getReceiverAmount().hashCode()); @@ -312,6 +327,7 @@ public class BsTradeOrderProfitSharingReceiver implements Serializable { sb.append(", ratio=").append(ratio); sb.append(", receiverObjectType=").append(receiverObjectType); sb.append(", receiverObjectId=").append(receiverObjectId); + sb.append(", receiverNo=").append(receiverNo); sb.append(", receiverAccount=").append(receiverAccount); sb.append(", receiverName=").append(receiverName); sb.append(", receiverAmount=").append(receiverAmount); diff --git a/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharingReceiverExample.java b/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharingReceiverExample.java index aaca2c9..1de494f 100644 --- a/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharingReceiverExample.java +++ b/service/src/main/java/com/hfkj/entity/BsTradeOrderProfitSharingReceiverExample.java @@ -626,6 +626,76 @@ public class BsTradeOrderProfitSharingReceiverExample { return (Criteria) this; } + public Criteria andReceiverNoIsNull() { + addCriterion("receiver_no is null"); + return (Criteria) this; + } + + public Criteria andReceiverNoIsNotNull() { + addCriterion("receiver_no is not null"); + return (Criteria) this; + } + + public Criteria andReceiverNoEqualTo(String value) { + addCriterion("receiver_no =", value, "receiverNo"); + return (Criteria) this; + } + + public Criteria andReceiverNoNotEqualTo(String value) { + addCriterion("receiver_no <>", value, "receiverNo"); + return (Criteria) this; + } + + public Criteria andReceiverNoGreaterThan(String value) { + addCriterion("receiver_no >", value, "receiverNo"); + return (Criteria) this; + } + + public Criteria andReceiverNoGreaterThanOrEqualTo(String value) { + addCriterion("receiver_no >=", value, "receiverNo"); + return (Criteria) this; + } + + public Criteria andReceiverNoLessThan(String value) { + addCriterion("receiver_no <", value, "receiverNo"); + return (Criteria) this; + } + + public Criteria andReceiverNoLessThanOrEqualTo(String value) { + addCriterion("receiver_no <=", value, "receiverNo"); + return (Criteria) this; + } + + public Criteria andReceiverNoLike(String value) { + addCriterion("receiver_no like", value, "receiverNo"); + return (Criteria) this; + } + + public Criteria andReceiverNoNotLike(String value) { + addCriterion("receiver_no not like", value, "receiverNo"); + return (Criteria) this; + } + + public Criteria andReceiverNoIn(List values) { + addCriterion("receiver_no in", values, "receiverNo"); + return (Criteria) this; + } + + public Criteria andReceiverNoNotIn(List values) { + addCriterion("receiver_no not in", values, "receiverNo"); + return (Criteria) this; + } + + public Criteria andReceiverNoBetween(String value1, String value2) { + addCriterion("receiver_no between", value1, value2, "receiverNo"); + return (Criteria) this; + } + + public Criteria andReceiverNoNotBetween(String value1, String value2) { + addCriterion("receiver_no not between", value1, value2, "receiverNo"); + return (Criteria) this; + } + public Criteria andReceiverAccountIsNull() { addCriterion("receiver_account is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/openapi/v1/model/request/RequestSeparateCancelModel.java b/service/src/main/java/com/hfkj/openapi/v1/model/request/RequestSeparateCancelModel.java new file mode 100644 index 0000000..ce4ef12 --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/v1/model/request/RequestSeparateCancelModel.java @@ -0,0 +1,53 @@ +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; + +/** + * 请求分账 + * @className: RequestSeparateModel + * @author: HuRui + * @date: 2023/5/26 + **/ +@Data +public class RequestSeparateCancelModel { + + /** + * 商户号 + */ + @NotBlank(message = "商户号必填项") + private String merchantNo; + + /** + * 原分账指令流水号 + */ + @NotBlank(message = "原分账指令流水号必填项") + @Length(min = 6, max = 50, message = "原分账指令流水号限制6至50位字符串长度") + private String originOutSeparateNo; + + /** + * 商户分账指令流水号 + */ + @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 String totalAmount; + + /** + * 签名参数 + */ + @NotBlank(message = "签名必填项") + private String sign; + +} diff --git a/service/src/main/java/com/hfkj/openapi/v1/model/request/RequestSeparateQueryAmtModel.java b/service/src/main/java/com/hfkj/openapi/v1/model/request/RequestSeparateQueryAmtModel.java new file mode 100644 index 0000000..acb4c46 --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/v1/model/request/RequestSeparateQueryAmtModel.java @@ -0,0 +1,36 @@ +package com.hfkj.openapi.v1.model.request; + +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; + +/** + * 请求分账 + * @className: RequestSeparateModel + * @author: HuRui + * @date: 2023/5/26 + **/ +@Data +public class RequestSeparateQueryAmtModel { + + /** + * 商户号 + */ + @NotBlank(message = "商户号必填项") + private String merchantNo; + + /** + * 分账流水号 + */ + @NotBlank(message = "分账流水号必填项") + @Length(min = 6, max = 50, message = "分账流水号限制6至50位字符串长度") + private String outSeparateNo; + + /** + * 签名参数 + */ + @NotBlank(message = "签名必填项") + private String sign; + +} diff --git a/service/src/main/java/com/hfkj/openapi/v1/model/request/RequestSeparateQueryModel.java b/service/src/main/java/com/hfkj/openapi/v1/model/request/RequestSeparateQueryModel.java new file mode 100644 index 0000000..38e3b51 --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/v1/model/request/RequestSeparateQueryModel.java @@ -0,0 +1,41 @@ +package com.hfkj.openapi.v1.model.request; + +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.Valid; +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * 请求分账 + * @className: RequestSeparateModel + * @author: HuRui + * @date: 2023/5/26 + **/ +@Data +public class RequestSeparateQueryModel { + + /** + * 商户号 + */ + @NotBlank(message = "商户号必填项") + private String merchantNo; + + /** + * 分账流水号 + */ + @NotBlank(message = "分账流水号必填项") + @Length(min = 6, max = 50, message = "分账流水号限制6至50位字符串长度") + private String outSeparateNo; + + /** + * 签名参数 + */ + @NotBlank(message = "签名必填项") + private String sign; + +} diff --git a/service/src/main/java/com/hfkj/openapi/v1/model/response/ResponseSeparateCancelModel.java b/service/src/main/java/com/hfkj/openapi/v1/model/response/ResponseSeparateCancelModel.java new file mode 100644 index 0000000..8393bec --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/v1/model/response/ResponseSeparateCancelModel.java @@ -0,0 +1,39 @@ +package com.hfkj.openapi.v1.model.response; + +import lombok.Data; + +/** + * 请求分账 + * @className: RequestSeparateModel + * @author: HuRui + * @date: 2023/5/26 + **/ +@Data +public class ResponseSeparateCancelModel { + + /** + * 商户号 + */ + private String merchantNo; + + /** + * 分账流水号 + */ + private String outSeparateNo; + + /** + * 分账系统生成唯一流水 + */ + private String separateNo; + + /** + * 撤销金额 + */ + private String totalAmount; + + /** + * 签名参数 + */ + private String sign; + +} diff --git a/service/src/main/java/com/hfkj/openapi/v1/model/response/ResponseSeparateModel.java b/service/src/main/java/com/hfkj/openapi/v1/model/response/ResponseSeparateModel.java new file mode 100644 index 0000000..e7b35d2 --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/v1/model/response/ResponseSeparateModel.java @@ -0,0 +1,54 @@ +package com.hfkj.openapi.v1.model.response; + +import com.hfkj.entity.BsTradeOrderProfitSharing; +import com.hfkj.sysenum.ProfitSharingStatusEnum; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.Valid; +import javax.validation.constraints.DecimalMax; +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * 请求分账 + * @className: RequestSeparateModel + * @author: HuRui + * @date: 2023/5/26 + **/ +@Data +public class ResponseSeparateModel { + + /** + * 商户号 + */ + private String merchantNo; + + /** + * 分账流水号 + */ + private String outSeparateNo; + + /** + * 分账系统生成唯一流水 + */ + private String separateNo; + + /** + * 分账总金额 + */ + private String totalAmount; + + /** + * 分账状态 + */ + private Integer status; + + /** + * 签名参数 + */ + private String sign; + +} diff --git a/service/src/main/java/com/hfkj/openapi/v1/model/response/ResponseSeparateQueryAmtModel.java b/service/src/main/java/com/hfkj/openapi/v1/model/response/ResponseSeparateQueryAmtModel.java new file mode 100644 index 0000000..6a420bc --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/v1/model/response/ResponseSeparateQueryAmtModel.java @@ -0,0 +1,38 @@ +package com.hfkj.openapi.v1.model.response; + +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.math.BigDecimal; + +/** + * 请求分账 + * @className: RequestSeparateModel + * @author: HuRui + * @date: 2023/5/26 + **/ +@Data +public class ResponseSeparateQueryAmtModel { + + /** + * 商户号 + */ + private String merchantNo; + + /** + * 总分账金额 + */ + private BigDecimal totalSeparateAmt; + + /** + * 可分账金额 + */ + private BigDecimal canSeparateAmt; + + /** + * 签名参数 + */ + private String sign; + +} diff --git a/service/src/main/java/com/hfkj/openapi/v1/model/response/ResponseSeparateQueryModel.java b/service/src/main/java/com/hfkj/openapi/v1/model/response/ResponseSeparateQueryModel.java new file mode 100644 index 0000000..4556813 --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/v1/model/response/ResponseSeparateQueryModel.java @@ -0,0 +1,82 @@ +package com.hfkj.openapi.v1.model.response; + +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.Date; +import java.util.List; + +/** + * 请求分账 + * @className: RequestSeparateModel + * @author: HuRui + * @date: 2023/5/26 + **/ +@Data +public class ResponseSeparateQueryModel { + + /** + * 指令类型 + */ + private Integer cmdType; + + /** + * 分账流水号 + */ + private String outSeparateNo; + + /** + * 分账系统生成唯一流水 + */ + private String separateNo; + + /** + * 分账时间 + */ + private Date separateDate; + + /** + * 完成时间 + */ + private Date finishDate; + + /** + * 金额 + */ + private BigDecimal totalAmount; + + /** + * 状态 + */ + private Integer status; + + /** + * 接收方 + */ + private List recvDataList; + + /** + * 签名参数 + */ + private String sign; + + + @Data + public static class ResponseSeparateRecvDataModel { + + /** + * 分账接收方商户号 + */ + private String recvMerchantNo; + + /** + * 分账金额 + */ + private BigDecimal separateAmount; + + } +} diff --git a/service/src/main/java/com/hfkj/openapi/v1/service/OpenApiTradeOrderProfitSharingService.java b/service/src/main/java/com/hfkj/openapi/v1/service/OpenApiTradeOrderProfitSharingService.java index 330ed15..348ae09 100644 --- a/service/src/main/java/com/hfkj/openapi/v1/service/OpenApiTradeOrderProfitSharingService.java +++ b/service/src/main/java/com/hfkj/openapi/v1/service/OpenApiTradeOrderProfitSharingService.java @@ -1,6 +1,13 @@ package com.hfkj.openapi.v1.service; +import com.hfkj.openapi.v1.model.request.RequestSeparateCancelModel; import com.hfkj.openapi.v1.model.request.RequestSeparateModel; +import com.hfkj.openapi.v1.model.request.RequestSeparateQueryAmtModel; +import com.hfkj.openapi.v1.model.request.RequestSeparateQueryModel; +import com.hfkj.openapi.v1.model.response.ResponseSeparateCancelModel; +import com.hfkj.openapi.v1.model.response.ResponseSeparateModel; +import com.hfkj.openapi.v1.model.response.ResponseSeparateQueryAmtModel; +import com.hfkj.openapi.v1.model.response.ResponseSeparateQueryModel; import java.util.Map; @@ -16,6 +23,26 @@ public interface OpenApiTradeOrderProfitSharingService { * 分账 * @param separateModel */ - Map separate(RequestSeparateModel separateModel); + ResponseSeparateModel separate(RequestSeparateModel separateModel) throws Exception; + /** + * 撤销 + * @param separateCancelModel + * @return + */ + ResponseSeparateCancelModel cancel(RequestSeparateCancelModel separateCancelModel) throws Exception; + /** + * 分账查询 + * @param separateQueryModel + * @return + */ + ResponseSeparateQueryModel query(RequestSeparateQueryModel separateQueryModel) throws Exception; + + /** + * 可分账金额查询 + * @param separateQueryAmtModel + * @return + * @throws Exception + */ + ResponseSeparateQueryAmtModel queryAmt(RequestSeparateQueryAmtModel separateQueryAmtModel) throws Exception; } diff --git a/service/src/main/java/com/hfkj/openapi/v1/service/impl/OpenApiTradeOrderProfitSharingServiceImpl.java b/service/src/main/java/com/hfkj/openapi/v1/service/impl/OpenApiTradeOrderProfitSharingServiceImpl.java index 748c25c..67bc9cc 100644 --- a/service/src/main/java/com/hfkj/openapi/v1/service/impl/OpenApiTradeOrderProfitSharingServiceImpl.java +++ b/service/src/main/java/com/hfkj/openapi/v1/service/impl/OpenApiTradeOrderProfitSharingServiceImpl.java @@ -1,26 +1,21 @@ package com.hfkj.openapi.v1.service.impl; import com.alibaba.fastjson.JSONObject; +import com.hfkj.channel.lakala.LaKaLaTradeSeparateService; 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.entity.*; 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.model.request.*; +import com.hfkj.openapi.v1.model.response.*; 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.service.*; import com.hfkj.sysenum.*; import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; @@ -29,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -43,18 +39,30 @@ public class OpenApiTradeOrderProfitSharingServiceImpl implements OpenApiTradeOr @Resource private BsTradeOrderProfitSharingService tradeOrderProfitSharingService; - + @Resource + private BsTradeOrderProfitSharingReceiverService tradeOrderProfitSharingReceiverService; + @Resource + private BsMerService merService; + @Resource + private BsMerKeyService merKeyService; + @Resource + private BsMerLedgerService merLedgerService; @Resource private OpenApiTradeOrderService openApiTradeOrderService; + @Resource + private LaKaLaTradeSeparateService laKaLaTradeSeparateService; @Override @Transactional(propagation= Propagation.REQUIRES_NEW, timeout = 20) - public Map separate(RequestSeparateModel separateModel) { + public ResponseSeparateModel separate(RequestSeparateModel separateModel) throws Exception { // 查询交易订单 BsTradeOrder tradeOrder = openApiTradeOrderService.getOrderByOutTradeNo(separateModel.getOutTradeNo()); if (tradeOrder == null) { throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的交易单号"); } + if (!tradeOrder.getMerNo().equals(separateModel.getMerchantNo())) { + 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, "交易订单不处于已支付"); } @@ -72,7 +80,133 @@ public class OpenApiTradeOrderProfitSharingServiceImpl implements OpenApiTradeOr tradeOrderProfitSharing.setPlatformAppid(tradeOrder.getPlatformAppid()); tradeOrderProfitSharing.setProfitSharingAmoun(new BigDecimal(separateModel.getTotalAmount())); tradeOrderProfitSharing.setStatus(ProfitSharingStatusEnum.status0.getNumber()); + tradeOrderProfitSharing.setCreateType(TradeOrderProfitSharingCreateType.type2.getNumber()); tradeOrderProfitSharingService.editData(tradeOrderProfitSharing); - return null; + + for (RequestSeparateModel.RequestSeparateRecvDataModel recvData : separateModel.getRecvDatas()) { + BsMer recvMer = merService.getMer(recvData.getRecvMerchantNo()); + BsMerLedger merLedger = merLedgerService.getMerLedger(recvMer.getId(), PlatformTypeEnum.type1); + BsTradeOrderProfitSharingReceiver profitSharingReceiver = new BsTradeOrderProfitSharingReceiver(); + profitSharingReceiver.setTradeOrderProfitSharingId(tradeOrderProfitSharing.getId()); + profitSharingReceiver.setTradeOrderId(tradeOrder.getId()); + profitSharingReceiver.setTradeOrderNo(tradeOrder.getOutTradeNo()); + profitSharingReceiver.setProfitSharingAmount(tradeOrderProfitSharing.getProfitSharingAmoun()); + profitSharingReceiver.setReceiverObjectType(ProfitSharingReceiverObjectType.mer.getType()); + profitSharingReceiver.setReceiverObjectId(recvMer.getId().toString()); + profitSharingReceiver.setReceiverAccount(merLedger.getReceiverNo()); + profitSharingReceiver.setReceiverName(recvMer.getMerName()); + profitSharingReceiver.setReceiverAmount(new BigDecimal(recvData.getSeparateAmount())); + tradeOrderProfitSharingReceiverService.editData(profitSharingReceiver); + } + + // 调用第三方分账 + BsTradeOrderProfitSharing profitSharing = laKaLaTradeSeparateService.separate(tradeOrderProfitSharing.getProfitSharingOrderNo()); + + ResponseSeparateModel responseSeparate = new ResponseSeparateModel(); + responseSeparate.setMerchantNo(separateModel.getMerchantNo()); + responseSeparate.setOutSeparateNo(separateModel.getOutSeparateNo()); + responseSeparate.setSeparateNo(profitSharing.getPlatformProfitSharingOrderNo()); + responseSeparate.setStatus(profitSharing.getStatus()); + responseSeparate.setTotalAmount(separateModel.getTotalAmount()); + responseSeparate.setSign(SignatureUtil.createSign(responseSeparate, merKeyService.getKeyByMerNo(responseSeparate.getMerchantNo()))); + return responseSeparate; } + + @Override + @Transactional(propagation= Propagation.REQUIRES_NEW, timeout = 20) + public ResponseSeparateCancelModel cancel(RequestSeparateCancelModel separateCancelModel) throws Exception { + // 查询分账流水号是否存在 + if (tradeOrderProfitSharingService.getDetailByProfitSharingOrderNo(separateCancelModel.getOriginOutSeparateNo()) != null) { + throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "原分账指令流水号重复"); + } + // 查询分账 + BsTradeOrderProfitSharing tradeOrderProfitSharing = tradeOrderProfitSharingService.getDetailByProfitSharingOrderNo(separateCancelModel.getOutSeparateNo()); + if (tradeOrderProfitSharing == null) { + throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的分商户分账指令"); + } + /*if (tradeOrderProfitSharing.getProfitSharingAmoun()) { + + }*/ + // 交易订单 + BsTradeOrder tradeOrder = openApiTradeOrderService.getOrderByOutTradeNo(tradeOrderProfitSharing.getTradeOrderNo()); + if (tradeOrder == null) { + throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的商户分账指令"); + } + if (!separateCancelModel.getMerchantNo().equals(tradeOrder.getMerNo())) { + throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的商户分账指令"); + } + + // laKaLaTradeSeparateService.cancel(); + + ResponseSeparateCancelModel responseSeparateCancel = new ResponseSeparateCancelModel(); + responseSeparateCancel.setSign(SignatureUtil.createSign(separateCancelModel, merKeyService.getKeyByMerNo(separateCancelModel.getMerchantNo()))); + return responseSeparateCancel; + } + + @Override + public ResponseSeparateQueryModel query(RequestSeparateQueryModel separateQueryModel) throws Exception { + // 查询分账 + BsTradeOrderProfitSharing tradeOrderProfitSharing = tradeOrderProfitSharingService.getDetailByProfitSharingOrderNo(separateQueryModel.getOutSeparateNo()); + if (tradeOrderProfitSharing == null) { + throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的分账流水号"); + } + // 交易订单 + BsTradeOrder tradeOrder = openApiTradeOrderService.getOrderByOutTradeNo(tradeOrderProfitSharing.getTradeOrderNo()); + if (tradeOrder == null) { + throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的交易流水号"); + } + if (!separateQueryModel.getMerchantNo().equals(tradeOrder.getMerNo())) { + throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的分账流水号"); + }/* + // 第三方接口查询 + JSONObject queryProfitSharing = laKaLaTradeSeparateService.query(separateQueryModel.getOutSeparateNo());*/ + + ResponseSeparateQueryModel responseSeparateQueryModel = new ResponseSeparateQueryModel(); + responseSeparateQueryModel.setCmdType(tradeOrderProfitSharing.getCmdType()); + responseSeparateQueryModel.setOutSeparateNo(tradeOrderProfitSharing.getProfitSharingOrderNo()); + responseSeparateQueryModel.setSeparateNo(tradeOrderProfitSharing.getPlatformProfitSharingOrderNo()); + responseSeparateQueryModel.setSeparateDate(tradeOrderProfitSharing.getProfitSharingTime()); + responseSeparateQueryModel.setFinishDate(tradeOrderProfitSharing.getFinishTime()); + responseSeparateQueryModel.setTotalAmount(tradeOrderProfitSharing.getProfitSharingAmoun()); + responseSeparateQueryModel.setStatus(tradeOrderProfitSharing.getStatus()); + // 接收方 + List recvDataList = new ArrayList<>(); + List receiverList = tradeOrderProfitSharingReceiverService.getReceiverListByProfitSharingId(tradeOrderProfitSharing.getId()); + for (BsTradeOrderProfitSharingReceiver receiver : receiverList) { + ResponseSeparateQueryModel.ResponseSeparateRecvDataModel recvData = new ResponseSeparateQueryModel.ResponseSeparateRecvDataModel(); + recvData.setRecvMerchantNo(receiver.getReceiverNo()); + recvData.setSeparateAmount(receiver.getReceiverAmount()); + recvDataList.add(recvData); + } + responseSeparateQueryModel.setRecvDataList(recvDataList); + responseSeparateQueryModel.setSign(SignatureUtil.createSign(responseSeparateQueryModel, merKeyService.getKeyByMerNo(separateQueryModel.getMerchantNo()))); + return responseSeparateQueryModel; + } + + @Override + public ResponseSeparateQueryAmtModel queryAmt(RequestSeparateQueryAmtModel separateQueryAmtModel) throws Exception { + // 查询分账 + BsTradeOrderProfitSharing tradeOrderProfitSharing = tradeOrderProfitSharingService.getDetailByProfitSharingOrderNo(separateQueryAmtModel.getOutSeparateNo()); + if (tradeOrderProfitSharing == null) { + throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的分账流水号"); + } + // 交易订单 + BsTradeOrder tradeOrder = openApiTradeOrderService.getOrderByOutTradeNo(tradeOrderProfitSharing.getTradeOrderNo()); + if (tradeOrder == null) { + throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的交易流水号"); + } + if (!separateQueryAmtModel.getMerchantNo().equals(tradeOrder.getMerNo())) { + throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的分账流水号"); + } + + // 第三方查询 + JSONObject queryAmt = laKaLaTradeSeparateService.queryAmt(separateQueryAmtModel.getOutSeparateNo()); + ResponseSeparateQueryAmtModel responseSeparateQueryAmtModel = new ResponseSeparateQueryAmtModel(); + responseSeparateQueryAmtModel.setMerchantNo(separateQueryAmtModel.getMerchantNo()); + responseSeparateQueryAmtModel.setTotalSeparateAmt(queryAmt.getBigDecimal("total_separate_amt").divide(new BigDecimal("100"))); + responseSeparateQueryAmtModel.setCanSeparateAmt(queryAmt.getBigDecimal("can_separate_amt").divide(new BigDecimal("100"))); + responseSeparateQueryAmtModel.setSign(SignatureUtil.createSign(responseSeparateQueryAmtModel, merKeyService.getKeyByMerNo(separateQueryAmtModel.getMerchantNo()))); + return responseSeparateQueryAmtModel; + } + } diff --git a/service/src/main/java/com/hfkj/sysenum/ProfitSharingReceiverObjectType.java b/service/src/main/java/com/hfkj/sysenum/ProfitSharingReceiverObjectType.java index b6ed457..d5b72c2 100644 --- a/service/src/main/java/com/hfkj/sysenum/ProfitSharingReceiverObjectType.java +++ b/service/src/main/java/com/hfkj/sysenum/ProfitSharingReceiverObjectType.java @@ -12,6 +12,7 @@ public enum ProfitSharingReceiverObjectType { company(2, "公司"), agent(3, "代理商"), + mer(4, "商户"), ; private Integer type; diff --git a/service/src/main/java/com/hfkj/sysenum/TradeOrderProfitSharingCreateType.java b/service/src/main/java/com/hfkj/sysenum/TradeOrderProfitSharingCreateType.java new file mode 100644 index 0000000..0694a16 --- /dev/null +++ b/service/src/main/java/com/hfkj/sysenum/TradeOrderProfitSharingCreateType.java @@ -0,0 +1,37 @@ +package com.hfkj.sysenum; + +/** + * @className: TradeOrderProfitSharingCreateType + * @author: HuRui + * @date: 2023/5/31 + **/ +public enum TradeOrderProfitSharingCreateType { + type1(1, "系统"), + type2(2, "API"), + ; + + private Integer number; + + private String name; + + TradeOrderProfitSharingCreateType(int number, String name) { + this.number = number; + this.name = name; + } + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + this.number = number; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +}