diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java index 095428ac..437debc3 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java @@ -196,6 +196,8 @@ public class OrderController { // 是否分账 String profitSharing = "N"; + BigDecimal profitSharingRatio = new BigDecimal("1"); + //微信支付 String nonce_str = MD5Util.MD5Encode(String.valueOf(ThreadLocalRandom.current().nextInt(10000)), "UTF-8"); int total_fee = MathUtils.objectConvertBigDecimal(map.get("payPrice")).multiply(new BigDecimal("100")).intValue(); @@ -226,7 +228,9 @@ public class OrderController { HighMerchantTripartitePlatform merTripartitePlatform = tripartitePlatformService.getDetail(store.getId(), 1); if (merTripartitePlatform != null) { weChatPayReqInfo.setSub_mch_id(merTripartitePlatform.getPlatformMerNumber()); - profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true)?"Y":"N"; + if (merTripartitePlatform.getProfitSharingRatio().compareTo(new BigDecimal("0")) == 1) { + profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true)?"Y":"N"; + } } } if (store.getPrestoreType().equals(1)) { @@ -258,6 +262,7 @@ public class OrderController { payMap.put("unified_order_url",SysConst.getSysConfig().getWxUnifiedOrderUrl()); SortedMap sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo,payMap); + order.setProfitSharingRatio(profitSharingRatio); order.setProfitSharingStatus(profitSharing.equals("y")?true:false); order.setAccountMerchantNum(weChatPayReqInfo.getSub_mch_id()); order.setExt1(weChatPayReqInfo.getSub_appid()); diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java index 8c8a611c..3cdc4d3e 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java @@ -54,8 +54,8 @@ public interface HighOrderMapper extends HighOrderMapperExt { "refund_time, refund_price, ", "refund_content, refusal_refund_content, ", "Identification_code, profit_sharing_status, ", - "account_merchant_num, ext_1, ", - "ext_2, ext_3)", + "profit_sharing_ratio, account_merchant_num, ", + "ext_1, ext_2, ext_3)", "values (#{orderNo,jdbcType=VARCHAR}, #{memDiscountId,jdbcType=BIGINT}, ", "#{memDiscountName,jdbcType=VARCHAR}, #{memId,jdbcType=BIGINT}, ", "#{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ", @@ -71,8 +71,8 @@ public interface HighOrderMapper extends HighOrderMapperExt { "#{refundTime,jdbcType=TIMESTAMP}, #{refundPrice,jdbcType=DECIMAL}, ", "#{refundContent,jdbcType=VARCHAR}, #{refusalRefundContent,jdbcType=VARCHAR}, ", "#{identificationCode,jdbcType=BIGINT}, #{profitSharingStatus,jdbcType=BIT}, ", - "#{accountMerchantNum,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ", - "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{profitSharingRatio,jdbcType=DECIMAL}, #{accountMerchantNum,jdbcType=VARCHAR}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighOrder record); @@ -114,6 +114,7 @@ public interface HighOrderMapper extends HighOrderMapperExt { @Result(column="refusal_refund_content", property="refusalRefundContent", jdbcType=JdbcType.VARCHAR), @Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT), @Result(column="profit_sharing_status", property="profitSharingStatus", jdbcType=JdbcType.BIT), + @Result(column="profit_sharing_ratio", property="profitSharingRatio", jdbcType=JdbcType.DECIMAL), @Result(column="account_merchant_num", property="accountMerchantNum", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @@ -128,7 +129,7 @@ public interface HighOrderMapper extends HighOrderMapperExt { "pay_real_price, pay_serial_no, deduction_price, order_status, total_price, create_time, ", "pay_time, cancel_time, cancel_remarks, finish_time, remarks, refund_time, refund_price, ", "refund_content, refusal_refund_content, Identification_code, profit_sharing_status, ", - "account_merchant_num, ext_1, ext_2, ext_3", + "profit_sharing_ratio, account_merchant_num, ext_1, ext_2, ext_3", "from high_order", "where id = #{id,jdbcType=BIGINT}" }) @@ -164,6 +165,7 @@ public interface HighOrderMapper extends HighOrderMapperExt { @Result(column="refusal_refund_content", property="refusalRefundContent", jdbcType=JdbcType.VARCHAR), @Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT), @Result(column="profit_sharing_status", property="profitSharingStatus", jdbcType=JdbcType.BIT), + @Result(column="profit_sharing_ratio", property="profitSharingRatio", jdbcType=JdbcType.DECIMAL), @Result(column="account_merchant_num", property="accountMerchantNum", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @@ -212,6 +214,7 @@ public interface HighOrderMapper extends HighOrderMapperExt { "refusal_refund_content = #{refusalRefundContent,jdbcType=VARCHAR},", "Identification_code = #{identificationCode,jdbcType=BIGINT},", "profit_sharing_status = #{profitSharingStatus,jdbcType=BIT},", + "profit_sharing_ratio = #{profitSharingRatio,jdbcType=DECIMAL},", "account_merchant_num = #{accountMerchantNum,jdbcType=VARCHAR},", "ext_1 = #{ext1,jdbcType=VARCHAR},", "ext_2 = #{ext2,jdbcType=VARCHAR},", diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java index c3aba52d..9e5a74ab 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java @@ -148,6 +148,10 @@ public class HighOrderSqlProvider { sql.VALUES("profit_sharing_status", "#{profitSharingStatus,jdbcType=BIT}"); } + if (record.getProfitSharingRatio() != null) { + sql.VALUES("profit_sharing_ratio", "#{profitSharingRatio,jdbcType=DECIMAL}"); + } + if (record.getAccountMerchantNum() != null) { sql.VALUES("account_merchant_num", "#{accountMerchantNum,jdbcType=VARCHAR}"); } @@ -204,6 +208,7 @@ public class HighOrderSqlProvider { sql.SELECT("refusal_refund_content"); sql.SELECT("Identification_code"); sql.SELECT("profit_sharing_status"); + sql.SELECT("profit_sharing_ratio"); sql.SELECT("account_merchant_num"); sql.SELECT("ext_1"); sql.SELECT("ext_2"); @@ -349,6 +354,10 @@ public class HighOrderSqlProvider { sql.SET("profit_sharing_status = #{record.profitSharingStatus,jdbcType=BIT}"); } + if (record.getProfitSharingRatio() != null) { + sql.SET("profit_sharing_ratio = #{record.profitSharingRatio,jdbcType=DECIMAL}"); + } + if (record.getAccountMerchantNum() != null) { sql.SET("account_merchant_num = #{record.accountMerchantNum,jdbcType=VARCHAR}"); } @@ -404,6 +413,7 @@ public class HighOrderSqlProvider { sql.SET("refusal_refund_content = #{record.refusalRefundContent,jdbcType=VARCHAR}"); sql.SET("Identification_code = #{record.identificationCode,jdbcType=BIGINT}"); sql.SET("profit_sharing_status = #{record.profitSharingStatus,jdbcType=BIT}"); + sql.SET("profit_sharing_ratio = #{record.profitSharingRatio,jdbcType=DECIMAL}"); sql.SET("account_merchant_num = #{record.accountMerchantNum,jdbcType=VARCHAR}"); sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); @@ -538,6 +548,10 @@ public class HighOrderSqlProvider { sql.SET("profit_sharing_status = #{profitSharingStatus,jdbcType=BIT}"); } + if (record.getProfitSharingRatio() != null) { + sql.SET("profit_sharing_ratio = #{profitSharingRatio,jdbcType=DECIMAL}"); + } + if (record.getAccountMerchantNum() != null) { sql.SET("account_merchant_num = #{accountMerchantNum,jdbcType=VARCHAR}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighOrder.java b/hai-service/src/main/java/com/hai/entity/HighOrder.java index f26e5068..3dd4b8d0 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrder.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrder.java @@ -170,6 +170,11 @@ public class HighOrder implements Serializable { */ private Boolean profitSharingStatus; + /** + * 分账比例 + */ + private BigDecimal profitSharingRatio; + /** * 进账商户号 */ @@ -203,11 +208,11 @@ public class HighOrder implements Serializable { this.highDiscount = highDiscount; } - public Boolean getTyAgent() { + public Boolean getIsTyAgent() { return isTyAgent; } - public void setTyAgent(Boolean tyAgent) { + public void setIsTyAgent(Boolean tyAgent) { isTyAgent = tyAgent; } @@ -461,6 +466,14 @@ public class HighOrder implements Serializable { this.profitSharingStatus = profitSharingStatus; } + public BigDecimal getProfitSharingRatio() { + return profitSharingRatio; + } + + public void setProfitSharingRatio(BigDecimal profitSharingRatio) { + this.profitSharingRatio = profitSharingRatio; + } + public String getAccountMerchantNum() { return accountMerchantNum; } @@ -536,6 +549,7 @@ public class HighOrder implements Serializable { && (this.getRefusalRefundContent() == null ? other.getRefusalRefundContent() == null : this.getRefusalRefundContent().equals(other.getRefusalRefundContent())) && (this.getIdentificationCode() == null ? other.getIdentificationCode() == null : this.getIdentificationCode().equals(other.getIdentificationCode())) && (this.getProfitSharingStatus() == null ? other.getProfitSharingStatus() == null : this.getProfitSharingStatus().equals(other.getProfitSharingStatus())) + && (this.getProfitSharingRatio() == null ? other.getProfitSharingRatio() == null : this.getProfitSharingRatio().equals(other.getProfitSharingRatio())) && (this.getAccountMerchantNum() == null ? other.getAccountMerchantNum() == null : this.getAccountMerchantNum().equals(other.getAccountMerchantNum())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) @@ -577,6 +591,7 @@ public class HighOrder implements Serializable { result = prime * result + ((getRefusalRefundContent() == null) ? 0 : getRefusalRefundContent().hashCode()); result = prime * result + ((getIdentificationCode() == null) ? 0 : getIdentificationCode().hashCode()); result = prime * result + ((getProfitSharingStatus() == null) ? 0 : getProfitSharingStatus().hashCode()); + result = prime * result + ((getProfitSharingRatio() == null) ? 0 : getProfitSharingRatio().hashCode()); result = prime * result + ((getAccountMerchantNum() == null) ? 0 : getAccountMerchantNum().hashCode()); result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); @@ -621,6 +636,7 @@ public class HighOrder implements Serializable { sb.append(", refusalRefundContent=").append(refusalRefundContent); sb.append(", identificationCode=").append(identificationCode); sb.append(", profitSharingStatus=").append(profitSharingStatus); + sb.append(", profitSharingRatio=").append(profitSharingRatio); sb.append(", accountMerchantNum=").append(accountMerchantNum); sb.append(", ext1=").append(ext1); sb.append(", ext2=").append(ext2); diff --git a/hai-service/src/main/java/com/hai/entity/HighOrderExample.java b/hai-service/src/main/java/com/hai/entity/HighOrderExample.java index 1d21409a..a7de7e76 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrderExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrderExample.java @@ -2086,6 +2086,66 @@ public class HighOrderExample { return (Criteria) this; } + public Criteria andProfitSharingRatioIsNull() { + addCriterion("profit_sharing_ratio is null"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioIsNotNull() { + addCriterion("profit_sharing_ratio is not null"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioEqualTo(BigDecimal value) { + addCriterion("profit_sharing_ratio =", value, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioNotEqualTo(BigDecimal value) { + addCriterion("profit_sharing_ratio <>", value, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioGreaterThan(BigDecimal value) { + addCriterion("profit_sharing_ratio >", value, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("profit_sharing_ratio >=", value, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioLessThan(BigDecimal value) { + addCriterion("profit_sharing_ratio <", value, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioLessThanOrEqualTo(BigDecimal value) { + addCriterion("profit_sharing_ratio <=", value, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioIn(List values) { + addCriterion("profit_sharing_ratio in", values, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioNotIn(List values) { + addCriterion("profit_sharing_ratio not in", values, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("profit_sharing_ratio between", value1, value2, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("profit_sharing_ratio not between", value1, value2, "profitSharingRatio"); + return (Criteria) this; + } + public Criteria andAccountMerchantNumIsNull() { addCriterion("account_merchant_num is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java index 7c167757..446e9862 100644 --- a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java @@ -440,7 +440,6 @@ public class GoodsOrderServiceImpl implements PayService { highOrderService.updateOrder(order); - if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) { // 加油站 HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId()); @@ -463,7 +462,7 @@ public class GoodsOrderServiceImpl implements PayService { new Thread(() -> { try { Thread.sleep(120*1000); - BigDecimal rake = new BigDecimal("0.01"); + BigDecimal rake = order.getProfitSharingRatio().divide(new BigDecimal("100")); // 计算微信收取的手续费 支付金额 * 0.002 注:如果与两个相邻数字的距离相等,则为上舍入的舍入模式。 BigDecimal wxHandlingFee = order.getPayRealPrice().multiply(new BigDecimal("0.002")).setScale(2,BigDecimal.ROUND_HALF_DOWN);