提交代码

dev-discount
胡锐 3 years ago
parent cdd8718b3d
commit c31310be74
  1. 24
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  2. 17
      hai-service/src/main/java/com/hai/dao/HighOrderMapper.java
  3. 28
      hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java
  4. 50
      hai-service/src/main/java/com/hai/entity/HighOrder.java
  5. 130
      hai-service/src/main/java/com/hai/entity/HighOrderExample.java
  6. 14
      hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java

@ -87,6 +87,9 @@ public class OrderController {
@Resource
private HighMerchantStoreService merchantStoreService;
@Resource
private HighMerchantTripartitePlatformService tripartitePlatformService;
@Resource
private HighQzOrderService highQzOrderService;
@ -211,6 +214,25 @@ public class OrderController {
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 3) {
weChatPayReqInfo.setSub_mch_id("1624126902"); // 浩联商户号
profitSharing = "Y";
// 查询油站
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId());
if (store != null && store.getSourceType().equals(1)) {
// 预存类型 0:非预存 1:预存门店
if (store.getPrestoreType().equals(0)) {
profitSharing = "N";
// 第三方平台
HighMerchantTripartitePlatform merTripartitePlatform = tripartitePlatformService.getDetail(store.getId(), 1);
if (merTripartitePlatform != null) {
weChatPayReqInfo.setSub_mch_id(merTripartitePlatform.getPlatformMerNumber());
profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true)?"Y":"N";
}
}
if (store.getPrestoreType().equals(1)) {
profitSharing = "N";
}
}
} else {
//子商户号
weChatPayReqInfo.setSub_mch_id(SysConst.getSysConfig().getWxSubMchId());
@ -236,6 +258,8 @@ public class OrderController {
payMap.put("unified_order_url",SysConst.getSysConfig().getWxUnifiedOrderUrl());
SortedMap<Object, Object> sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo,payMap);
order.setProfitSharingStatus(profitSharing.equals("y")?true:false);
order.setAccountMerchantNum(weChatPayReqInfo.getSub_mch_id());
order.setExt1(weChatPayReqInfo.getSub_appid());
highOrderService.updateOrderDetail(order);
return ResponseMsgUtil.success(sortedMap);

@ -53,7 +53,8 @@ public interface HighOrderMapper extends HighOrderMapperExt {
"finish_time, remarks, ",
"refund_time, refund_price, ",
"refund_content, refusal_refund_content, ",
"Identification_code, ext_1, ",
"Identification_code, profit_sharing_status, ",
"account_merchant_num, ext_1, ",
"ext_2, ext_3)",
"values (#{orderNo,jdbcType=VARCHAR}, #{memDiscountId,jdbcType=BIGINT}, ",
"#{memDiscountName,jdbcType=VARCHAR}, #{memId,jdbcType=BIGINT}, ",
@ -69,7 +70,8 @@ public interface HighOrderMapper extends HighOrderMapperExt {
"#{finishTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, ",
"#{refundTime,jdbcType=TIMESTAMP}, #{refundPrice,jdbcType=DECIMAL}, ",
"#{refundContent,jdbcType=VARCHAR}, #{refusalRefundContent,jdbcType=VARCHAR}, ",
"#{identificationCode,jdbcType=BIGINT}, #{ext1,jdbcType=VARCHAR}, ",
"#{identificationCode,jdbcType=BIGINT}, #{profitSharingStatus,jdbcType=BIT}, ",
"#{accountMerchantNum,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
@ -111,6 +113,8 @@ public interface HighOrderMapper extends HighOrderMapperExt {
@Result(column="refund_content", property="refundContent", jdbcType=JdbcType.VARCHAR),
@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="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),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
@ -123,7 +127,8 @@ public interface HighOrderMapper extends HighOrderMapperExt {
"mem_card_id, mem_card_type, mem_card_no, pay_model, pay_type, pay_gold, pay_price, ",
"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, ext_1, ext_2, ext_3",
"refund_content, refusal_refund_content, Identification_code, profit_sharing_status, ",
"account_merchant_num, ext_1, ext_2, ext_3",
"from high_order",
"where id = #{id,jdbcType=BIGINT}"
})
@ -158,6 +163,8 @@ public interface HighOrderMapper extends HighOrderMapperExt {
@Result(column="refund_content", property="refundContent", jdbcType=JdbcType.VARCHAR),
@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="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),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
@ -204,12 +211,12 @@ public interface HighOrderMapper extends HighOrderMapperExt {
"refund_content = #{refundContent,jdbcType=VARCHAR},",
"refusal_refund_content = #{refusalRefundContent,jdbcType=VARCHAR},",
"Identification_code = #{identificationCode,jdbcType=BIGINT},",
"profit_sharing_status = #{profitSharingStatus,jdbcType=BIT},",
"account_merchant_num = #{accountMerchantNum,jdbcType=VARCHAR},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(HighOrder record);
}

@ -144,6 +144,14 @@ public class HighOrderSqlProvider {
sql.VALUES("Identification_code", "#{identificationCode,jdbcType=BIGINT}");
}
if (record.getProfitSharingStatus() != null) {
sql.VALUES("profit_sharing_status", "#{profitSharingStatus,jdbcType=BIT}");
}
if (record.getAccountMerchantNum() != null) {
sql.VALUES("account_merchant_num", "#{accountMerchantNum,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
@ -195,6 +203,8 @@ public class HighOrderSqlProvider {
sql.SELECT("refund_content");
sql.SELECT("refusal_refund_content");
sql.SELECT("Identification_code");
sql.SELECT("profit_sharing_status");
sql.SELECT("account_merchant_num");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
@ -335,6 +345,14 @@ public class HighOrderSqlProvider {
sql.SET("Identification_code = #{record.identificationCode,jdbcType=BIGINT}");
}
if (record.getProfitSharingStatus() != null) {
sql.SET("profit_sharing_status = #{record.profitSharingStatus,jdbcType=BIT}");
}
if (record.getAccountMerchantNum() != null) {
sql.SET("account_merchant_num = #{record.accountMerchantNum,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
@ -385,6 +403,8 @@ public class HighOrderSqlProvider {
sql.SET("refund_content = #{record.refundContent,jdbcType=VARCHAR}");
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("account_merchant_num = #{record.accountMerchantNum,jdbcType=VARCHAR}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
@ -514,6 +534,14 @@ public class HighOrderSqlProvider {
sql.SET("Identification_code = #{identificationCode,jdbcType=BIGINT}");
}
if (record.getProfitSharingStatus() != null) {
sql.SET("profit_sharing_status = #{profitSharingStatus,jdbcType=BIT}");
}
if (record.getAccountMerchantNum() != null) {
sql.SET("account_merchant_num = #{accountMerchantNum,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}

@ -71,7 +71,7 @@ public class HighOrder implements Serializable {
private Integer payModel;
/**
* 支付方式 1支付宝 2微信 3金币 4汇联通工会卡
* 支付方式 1支付宝 2微信 3金币 4汇联通工会卡 5银联 6银联分期
*/
private Integer payType;
@ -165,6 +165,16 @@ public class HighOrder implements Serializable {
*/
private Long identificationCode;
/**
* 是否分账
*/
private Boolean profitSharingStatus;
/**
* 进账商户号
*/
private String accountMerchantNum;
private String ext1;
private String ext2;
@ -177,14 +187,6 @@ public class HighOrder implements Serializable {
private Boolean isTyAgent;
public Boolean getIsTyAgent() {
return isTyAgent;
}
public void setIsTyAgent(Boolean tyAgent) {
isTyAgent = tyAgent;
}
public List<HighChildOrder> getHighChildOrderList() {
return highChildOrderList;
}
@ -201,6 +203,14 @@ public class HighOrder implements Serializable {
this.highDiscount = highDiscount;
}
public Boolean getTyAgent() {
return isTyAgent;
}
public void setTyAgent(Boolean tyAgent) {
isTyAgent = tyAgent;
}
private static final long serialVersionUID = 1L;
public Long getId() {
@ -443,6 +453,22 @@ public class HighOrder implements Serializable {
this.identificationCode = identificationCode;
}
public Boolean getProfitSharingStatus() {
return profitSharingStatus;
}
public void setProfitSharingStatus(Boolean profitSharingStatus) {
this.profitSharingStatus = profitSharingStatus;
}
public String getAccountMerchantNum() {
return accountMerchantNum;
}
public void setAccountMerchantNum(String accountMerchantNum) {
this.accountMerchantNum = accountMerchantNum;
}
public String getExt1() {
return ext1;
}
@ -509,6 +535,8 @@ public class HighOrder implements Serializable {
&& (this.getRefundContent() == null ? other.getRefundContent() == null : this.getRefundContent().equals(other.getRefundContent()))
&& (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.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()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
@ -548,6 +576,8 @@ public class HighOrder implements Serializable {
result = prime * result + ((getRefundContent() == null) ? 0 : getRefundContent().hashCode());
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 + ((getAccountMerchantNum() == null) ? 0 : getAccountMerchantNum().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
@ -590,6 +620,8 @@ public class HighOrder implements Serializable {
sb.append(", refundContent=").append(refundContent);
sb.append(", refusalRefundContent=").append(refusalRefundContent);
sb.append(", identificationCode=").append(identificationCode);
sb.append(", profitSharingStatus=").append(profitSharingStatus);
sb.append(", accountMerchantNum=").append(accountMerchantNum);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);

@ -2026,6 +2026,136 @@ public class HighOrderExample {
return (Criteria) this;
}
public Criteria andProfitSharingStatusIsNull() {
addCriterion("profit_sharing_status is null");
return (Criteria) this;
}
public Criteria andProfitSharingStatusIsNotNull() {
addCriterion("profit_sharing_status is not null");
return (Criteria) this;
}
public Criteria andProfitSharingStatusEqualTo(Boolean value) {
addCriterion("profit_sharing_status =", value, "profitSharingStatus");
return (Criteria) this;
}
public Criteria andProfitSharingStatusNotEqualTo(Boolean value) {
addCriterion("profit_sharing_status <>", value, "profitSharingStatus");
return (Criteria) this;
}
public Criteria andProfitSharingStatusGreaterThan(Boolean value) {
addCriterion("profit_sharing_status >", value, "profitSharingStatus");
return (Criteria) this;
}
public Criteria andProfitSharingStatusGreaterThanOrEqualTo(Boolean value) {
addCriterion("profit_sharing_status >=", value, "profitSharingStatus");
return (Criteria) this;
}
public Criteria andProfitSharingStatusLessThan(Boolean value) {
addCriterion("profit_sharing_status <", value, "profitSharingStatus");
return (Criteria) this;
}
public Criteria andProfitSharingStatusLessThanOrEqualTo(Boolean value) {
addCriterion("profit_sharing_status <=", value, "profitSharingStatus");
return (Criteria) this;
}
public Criteria andProfitSharingStatusIn(List<Boolean> values) {
addCriterion("profit_sharing_status in", values, "profitSharingStatus");
return (Criteria) this;
}
public Criteria andProfitSharingStatusNotIn(List<Boolean> values) {
addCriterion("profit_sharing_status not in", values, "profitSharingStatus");
return (Criteria) this;
}
public Criteria andProfitSharingStatusBetween(Boolean value1, Boolean value2) {
addCriterion("profit_sharing_status between", value1, value2, "profitSharingStatus");
return (Criteria) this;
}
public Criteria andProfitSharingStatusNotBetween(Boolean value1, Boolean value2) {
addCriterion("profit_sharing_status not between", value1, value2, "profitSharingStatus");
return (Criteria) this;
}
public Criteria andAccountMerchantNumIsNull() {
addCriterion("account_merchant_num is null");
return (Criteria) this;
}
public Criteria andAccountMerchantNumIsNotNull() {
addCriterion("account_merchant_num is not null");
return (Criteria) this;
}
public Criteria andAccountMerchantNumEqualTo(String value) {
addCriterion("account_merchant_num =", value, "accountMerchantNum");
return (Criteria) this;
}
public Criteria andAccountMerchantNumNotEqualTo(String value) {
addCriterion("account_merchant_num <>", value, "accountMerchantNum");
return (Criteria) this;
}
public Criteria andAccountMerchantNumGreaterThan(String value) {
addCriterion("account_merchant_num >", value, "accountMerchantNum");
return (Criteria) this;
}
public Criteria andAccountMerchantNumGreaterThanOrEqualTo(String value) {
addCriterion("account_merchant_num >=", value, "accountMerchantNum");
return (Criteria) this;
}
public Criteria andAccountMerchantNumLessThan(String value) {
addCriterion("account_merchant_num <", value, "accountMerchantNum");
return (Criteria) this;
}
public Criteria andAccountMerchantNumLessThanOrEqualTo(String value) {
addCriterion("account_merchant_num <=", value, "accountMerchantNum");
return (Criteria) this;
}
public Criteria andAccountMerchantNumLike(String value) {
addCriterion("account_merchant_num like", value, "accountMerchantNum");
return (Criteria) this;
}
public Criteria andAccountMerchantNumNotLike(String value) {
addCriterion("account_merchant_num not like", value, "accountMerchantNum");
return (Criteria) this;
}
public Criteria andAccountMerchantNumIn(List<String> values) {
addCriterion("account_merchant_num in", values, "accountMerchantNum");
return (Criteria) this;
}
public Criteria andAccountMerchantNumNotIn(List<String> values) {
addCriterion("account_merchant_num not in", values, "accountMerchantNum");
return (Criteria) this;
}
public Criteria andAccountMerchantNumBetween(String value1, String value2) {
addCriterion("account_merchant_num between", value1, value2, "accountMerchantNum");
return (Criteria) this;
}
public Criteria andAccountMerchantNumNotBetween(String value1, String value2) {
addCriterion("account_merchant_num not between", value1, value2, "accountMerchantNum");
return (Criteria) this;
}
public Criteria andExt1IsNull() {
addCriterion("ext_1 is null");
return (Criteria) this;

@ -442,6 +442,10 @@ public class GoodsOrderServiceImpl implements PayService {
if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) {
// 加油站
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId());
if (store != null) {
if (store.getSourceType() != null && store.getSourceType().equals(1)) {
new Thread(() -> {
Map<String, Object> pushMsg = new HashMap<>();
pushMsg.put("userId", order.getHighChildOrderList().get(0).getGoodsId());
@ -452,7 +456,10 @@ public class GoodsOrderServiceImpl implements PayService {
pushMsg.put("message", JSONObject.toJSONString(msgContent));
HttpsUtils.doPost("http://127.0.0.1:9901/msg/websocket/websocket", pushMsg, new HashMap<>());
}).start();
}
}
if (order.getProfitSharingStatus() == true) {
new Thread(() -> {
try {
Thread.sleep(120*1000);
@ -464,11 +471,12 @@ public class GoodsOrderServiceImpl implements PayService {
// 计算分账金额 手续费后的价格 * 0.05 注:如果与两个相邻数字的距离相等,则为上舍入的舍入模式。
BigDecimal profitSharingAmount = price.multiply(rake).setScale(2,BigDecimal.ROUND_DOWN);
this.wxGasProfitsharing(order.getExt1(), order.getPaySerialNo(),order.getOrderNo(),profitSharingAmount);
this.wxGasProfitsharing(order.getExt1(), order.getAccountMerchantNum(), order.getPaySerialNo(),order.getOrderNo(),profitSharingAmount);
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
}
} else {
new Thread(() -> {
try {
@ -504,12 +512,12 @@ public class GoodsOrderServiceImpl implements PayService {
System.out.println("实际分账价格:" + profitSharingAmount);
}
public void wxGasProfitsharing(String appid, String transaction_id,String out_order_no, BigDecimal amount) {
public void wxGasProfitsharing(String appid, String subMchId, String transaction_id,String out_order_no, BigDecimal amount) {
try {
Map<String,String> param = new LinkedHashMap<>();
param.put("appid", appid);
param.put("mch_id", "1289663601");
param.put("sub_mch_id" , "1624126902"); // 渝北区浩联物资经营部
param.put("sub_mch_id" , subMchId); // 渝北区浩联物资经营部
param.put("transaction_id" , transaction_id);
param.put("out_order_no" , out_order_no);
param.put("nonce_str" , WxUtils.makeNonStr());

Loading…
Cancel
Save