提交代码

dev-discount
胡锐 3 years ago
parent c31310be74
commit ce2bd83e61
  1. 9
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  2. 13
      hai-service/src/main/java/com/hai/dao/HighOrderMapper.java
  3. 14
      hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java
  4. 16
      hai-service/src/main/java/com/hai/entity/HighOrder.java
  5. 60
      hai-service/src/main/java/com/hai/entity/HighOrderExample.java
  6. 3
      hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java

@ -196,6 +196,8 @@ public class OrderController {
// 是否分账 // 是否分账
String profitSharing = "N"; String profitSharing = "N";
BigDecimal profitSharingRatio = new BigDecimal("1");
//微信支付 //微信支付
String nonce_str = MD5Util.MD5Encode(String.valueOf(ThreadLocalRandom.current().nextInt(10000)), "UTF-8"); 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(); int total_fee = MathUtils.objectConvertBigDecimal(map.get("payPrice")).multiply(new BigDecimal("100")).intValue();
@ -226,7 +228,11 @@ public class OrderController {
HighMerchantTripartitePlatform merTripartitePlatform = tripartitePlatformService.getDetail(store.getId(), 1); HighMerchantTripartitePlatform merTripartitePlatform = tripartitePlatformService.getDetail(store.getId(), 1);
if (merTripartitePlatform != null) { if (merTripartitePlatform != null) {
weChatPayReqInfo.setSub_mch_id(merTripartitePlatform.getPlatformMerNumber()); weChatPayReqInfo.setSub_mch_id(merTripartitePlatform.getPlatformMerNumber());
profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true)?"Y":"N"; if (merTripartitePlatform.getProfitSharingRatio().compareTo(new BigDecimal("0")) == 1) {
profitSharing = "N";
} else {
profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true)?"Y":"N";
}
} }
} }
if (store.getPrestoreType().equals(1)) { if (store.getPrestoreType().equals(1)) {
@ -258,6 +264,7 @@ public class OrderController {
payMap.put("unified_order_url",SysConst.getSysConfig().getWxUnifiedOrderUrl()); payMap.put("unified_order_url",SysConst.getSysConfig().getWxUnifiedOrderUrl());
SortedMap<Object, Object> sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo,payMap); SortedMap<Object, Object> sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo,payMap);
order.setProfitSharingRatio(profitSharingRatio);
order.setProfitSharingStatus(profitSharing.equals("y")?true:false); order.setProfitSharingStatus(profitSharing.equals("y")?true:false);
order.setAccountMerchantNum(weChatPayReqInfo.getSub_mch_id()); order.setAccountMerchantNum(weChatPayReqInfo.getSub_mch_id());
order.setExt1(weChatPayReqInfo.getSub_appid()); order.setExt1(weChatPayReqInfo.getSub_appid());

@ -54,8 +54,8 @@ public interface HighOrderMapper extends HighOrderMapperExt {
"refund_time, refund_price, ", "refund_time, refund_price, ",
"refund_content, refusal_refund_content, ", "refund_content, refusal_refund_content, ",
"Identification_code, profit_sharing_status, ", "Identification_code, profit_sharing_status, ",
"account_merchant_num, ext_1, ", "profit_sharing_ratio, account_merchant_num, ",
"ext_2, ext_3)", "ext_1, ext_2, ext_3)",
"values (#{orderNo,jdbcType=VARCHAR}, #{memDiscountId,jdbcType=BIGINT}, ", "values (#{orderNo,jdbcType=VARCHAR}, #{memDiscountId,jdbcType=BIGINT}, ",
"#{memDiscountName,jdbcType=VARCHAR}, #{memId,jdbcType=BIGINT}, ", "#{memDiscountName,jdbcType=VARCHAR}, #{memId,jdbcType=BIGINT}, ",
"#{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ", "#{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ",
@ -71,8 +71,8 @@ public interface HighOrderMapper extends HighOrderMapperExt {
"#{refundTime,jdbcType=TIMESTAMP}, #{refundPrice,jdbcType=DECIMAL}, ", "#{refundTime,jdbcType=TIMESTAMP}, #{refundPrice,jdbcType=DECIMAL}, ",
"#{refundContent,jdbcType=VARCHAR}, #{refusalRefundContent,jdbcType=VARCHAR}, ", "#{refundContent,jdbcType=VARCHAR}, #{refusalRefundContent,jdbcType=VARCHAR}, ",
"#{identificationCode,jdbcType=BIGINT}, #{profitSharingStatus,jdbcType=BIT}, ", "#{identificationCode,jdbcType=BIGINT}, #{profitSharingStatus,jdbcType=BIT}, ",
"#{accountMerchantNum,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ", "#{profitSharingRatio,jdbcType=DECIMAL}, #{accountMerchantNum,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighOrder record); 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="refusal_refund_content", property="refusalRefundContent", jdbcType=JdbcType.VARCHAR),
@Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT), @Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT),
@Result(column="profit_sharing_status", property="profitSharingStatus", jdbcType=JdbcType.BIT), @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="account_merchant_num", property="accountMerchantNum", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", 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_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, ", "pay_time, cancel_time, cancel_remarks, finish_time, remarks, refund_time, refund_price, ",
"refund_content, refusal_refund_content, Identification_code, profit_sharing_status, ", "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", "from high_order",
"where id = #{id,jdbcType=BIGINT}" "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="refusal_refund_content", property="refusalRefundContent", jdbcType=JdbcType.VARCHAR),
@Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT), @Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT),
@Result(column="profit_sharing_status", property="profitSharingStatus", jdbcType=JdbcType.BIT), @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="account_merchant_num", property="accountMerchantNum", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", 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},", "refusal_refund_content = #{refusalRefundContent,jdbcType=VARCHAR},",
"Identification_code = #{identificationCode,jdbcType=BIGINT},", "Identification_code = #{identificationCode,jdbcType=BIGINT},",
"profit_sharing_status = #{profitSharingStatus,jdbcType=BIT},", "profit_sharing_status = #{profitSharingStatus,jdbcType=BIT},",
"profit_sharing_ratio = #{profitSharingRatio,jdbcType=DECIMAL},",
"account_merchant_num = #{accountMerchantNum,jdbcType=VARCHAR},", "account_merchant_num = #{accountMerchantNum,jdbcType=VARCHAR},",
"ext_1 = #{ext1,jdbcType=VARCHAR},", "ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},", "ext_2 = #{ext2,jdbcType=VARCHAR},",

@ -148,6 +148,10 @@ public class HighOrderSqlProvider {
sql.VALUES("profit_sharing_status", "#{profitSharingStatus,jdbcType=BIT}"); sql.VALUES("profit_sharing_status", "#{profitSharingStatus,jdbcType=BIT}");
} }
if (record.getProfitSharingRatio() != null) {
sql.VALUES("profit_sharing_ratio", "#{profitSharingRatio,jdbcType=DECIMAL}");
}
if (record.getAccountMerchantNum() != null) { if (record.getAccountMerchantNum() != null) {
sql.VALUES("account_merchant_num", "#{accountMerchantNum,jdbcType=VARCHAR}"); sql.VALUES("account_merchant_num", "#{accountMerchantNum,jdbcType=VARCHAR}");
} }
@ -204,6 +208,7 @@ public class HighOrderSqlProvider {
sql.SELECT("refusal_refund_content"); sql.SELECT("refusal_refund_content");
sql.SELECT("Identification_code"); sql.SELECT("Identification_code");
sql.SELECT("profit_sharing_status"); sql.SELECT("profit_sharing_status");
sql.SELECT("profit_sharing_ratio");
sql.SELECT("account_merchant_num"); sql.SELECT("account_merchant_num");
sql.SELECT("ext_1"); sql.SELECT("ext_1");
sql.SELECT("ext_2"); sql.SELECT("ext_2");
@ -349,6 +354,10 @@ public class HighOrderSqlProvider {
sql.SET("profit_sharing_status = #{record.profitSharingStatus,jdbcType=BIT}"); 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) { if (record.getAccountMerchantNum() != null) {
sql.SET("account_merchant_num = #{record.accountMerchantNum,jdbcType=VARCHAR}"); 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("refusal_refund_content = #{record.refusalRefundContent,jdbcType=VARCHAR}");
sql.SET("Identification_code = #{record.identificationCode,jdbcType=BIGINT}"); sql.SET("Identification_code = #{record.identificationCode,jdbcType=BIGINT}");
sql.SET("profit_sharing_status = #{record.profitSharingStatus,jdbcType=BIT}"); 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("account_merchant_num = #{record.accountMerchantNum,jdbcType=VARCHAR}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,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}"); sql.SET("profit_sharing_status = #{profitSharingStatus,jdbcType=BIT}");
} }
if (record.getProfitSharingRatio() != null) {
sql.SET("profit_sharing_ratio = #{profitSharingRatio,jdbcType=DECIMAL}");
}
if (record.getAccountMerchantNum() != null) { if (record.getAccountMerchantNum() != null) {
sql.SET("account_merchant_num = #{accountMerchantNum,jdbcType=VARCHAR}"); sql.SET("account_merchant_num = #{accountMerchantNum,jdbcType=VARCHAR}");
} }

@ -170,6 +170,11 @@ public class HighOrder implements Serializable {
*/ */
private Boolean profitSharingStatus; private Boolean profitSharingStatus;
/**
* 分账比例
*/
private BigDecimal profitSharingRatio;
/** /**
* 进账商户号 * 进账商户号
*/ */
@ -461,6 +466,14 @@ public class HighOrder implements Serializable {
this.profitSharingStatus = profitSharingStatus; this.profitSharingStatus = profitSharingStatus;
} }
public BigDecimal getProfitSharingRatio() {
return profitSharingRatio;
}
public void setProfitSharingRatio(BigDecimal profitSharingRatio) {
this.profitSharingRatio = profitSharingRatio;
}
public String getAccountMerchantNum() { public String getAccountMerchantNum() {
return accountMerchantNum; return accountMerchantNum;
} }
@ -536,6 +549,7 @@ public class HighOrder implements Serializable {
&& (this.getRefusalRefundContent() == null ? other.getRefusalRefundContent() == null : this.getRefusalRefundContent().equals(other.getRefusalRefundContent())) && (this.getRefusalRefundContent() == null ? other.getRefusalRefundContent() == null : this.getRefusalRefundContent().equals(other.getRefusalRefundContent()))
&& (this.getIdentificationCode() == null ? other.getIdentificationCode() == null : this.getIdentificationCode().equals(other.getIdentificationCode())) && (this.getIdentificationCode() == null ? other.getIdentificationCode() == null : this.getIdentificationCode().equals(other.getIdentificationCode()))
&& (this.getProfitSharingStatus() == null ? other.getProfitSharingStatus() == null : this.getProfitSharingStatus().equals(other.getProfitSharingStatus())) && (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.getAccountMerchantNum() == null ? other.getAccountMerchantNum() == null : this.getAccountMerchantNum().equals(other.getAccountMerchantNum()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) && (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 + ((getRefusalRefundContent() == null) ? 0 : getRefusalRefundContent().hashCode());
result = prime * result + ((getIdentificationCode() == null) ? 0 : getIdentificationCode().hashCode()); result = prime * result + ((getIdentificationCode() == null) ? 0 : getIdentificationCode().hashCode());
result = prime * result + ((getProfitSharingStatus() == null) ? 0 : getProfitSharingStatus().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 + ((getAccountMerchantNum() == null) ? 0 : getAccountMerchantNum().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().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(", refusalRefundContent=").append(refusalRefundContent);
sb.append(", identificationCode=").append(identificationCode); sb.append(", identificationCode=").append(identificationCode);
sb.append(", profitSharingStatus=").append(profitSharingStatus); sb.append(", profitSharingStatus=").append(profitSharingStatus);
sb.append(", profitSharingRatio=").append(profitSharingRatio);
sb.append(", accountMerchantNum=").append(accountMerchantNum); sb.append(", accountMerchantNum=").append(accountMerchantNum);
sb.append(", ext1=").append(ext1); sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2); sb.append(", ext2=").append(ext2);

@ -2086,6 +2086,66 @@ public class HighOrderExample {
return (Criteria) this; 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<BigDecimal> values) {
addCriterion("profit_sharing_ratio in", values, "profitSharingRatio");
return (Criteria) this;
}
public Criteria andProfitSharingRatioNotIn(List<BigDecimal> 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() { public Criteria andAccountMerchantNumIsNull() {
addCriterion("account_merchant_num is null"); addCriterion("account_merchant_num is null");
return (Criteria) this; return (Criteria) this;

@ -440,7 +440,6 @@ public class GoodsOrderServiceImpl implements PayService {
highOrderService.updateOrder(order); highOrderService.updateOrder(order);
if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) { if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) {
// 加油站 // 加油站
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId()); HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId());
@ -463,7 +462,7 @@ public class GoodsOrderServiceImpl implements PayService {
new Thread(() -> { new Thread(() -> {
try { try {
Thread.sleep(120*1000); Thread.sleep(120*1000);
BigDecimal rake = new BigDecimal("0.01"); BigDecimal rake = order.getProfitSharingRatio().divide(new BigDecimal("100"));
// 计算微信收取的手续费 支付金额 * 0.002 注:如果与两个相邻数字的距离相等,则为上舍入的舍入模式。 // 计算微信收取的手续费 支付金额 * 0.002 注:如果与两个相邻数字的距离相等,则为上舍入的舍入模式。
BigDecimal wxHandlingFee = order.getPayRealPrice().multiply(new BigDecimal("0.002")).setScale(2,BigDecimal.ROUND_HALF_DOWN); BigDecimal wxHandlingFee = order.getPayRealPrice().multiply(new BigDecimal("0.002")).setScale(2,BigDecimal.ROUND_HALF_DOWN);

Loading…
Cancel
Save