提交修改
This commit is contained in:
parent
ea103cacfe
commit
4c90d8ab13
@ -381,7 +381,11 @@ public class ApiConstants {
|
||||
public static final String mobile_verification_3 = "mobile_verification_3";
|
||||
|
||||
public static final String AnonymousUserLogin_pre= "goudezhao$132_";
|
||||
|
||||
public static final String AnonymousUserLogin_aes_password= "qhzhixing";
|
||||
|
||||
|
||||
public static final String PS= "PS";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -100,4 +100,18 @@ public interface VvBuyerDao extends BaseMapper<VvBuyerEntity> {
|
||||
@Sub BigDecimal promoterArriveAccountAmount,
|
||||
Long id);
|
||||
|
||||
|
||||
|
||||
int updateVvBuyerByIdPromoterDrawCashSuccessAmountPromoterArriveAccountAmount(@Plus BigDecimal promoterDrawCashSuccessAmount,
|
||||
@Sub BigDecimal promoterArriveAccountAmount,
|
||||
Long id);
|
||||
|
||||
|
||||
int updateVvBuyerByIdPromoterDrawCashSuccessAmountPromoterApplyDrawCashAmount(@Plus BigDecimal promoterDrawCashSuccessAmount,
|
||||
@Sub BigDecimal promoterApplyDrawCashAmount,
|
||||
Long id);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -21,34 +21,38 @@ private static final long serialVersionUID = 1L;
|
||||
public final static String CLASS_NAME ="com.heyu.api.data.entity.vv.VvPromoterTradeOrderAwardEntity:";
|
||||
|
||||
public final static String all = CLASS_NAME + "*";
|
||||
public final static String id_ = CLASS_NAME + "id"; //
|
||||
public final static String is_delete = CLASS_NAME + "is_delete"; // 是否删除:0 否 1 删除
|
||||
public final static String create_time = CLASS_NAME + "create_time"; // 创建时间
|
||||
public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间
|
||||
public final static String create_timestamp = CLASS_NAME + "create_timestamp"; // 创建时间戳
|
||||
public final static String modify_timestamp = CLASS_NAME + "modify_timestamp"; // 修改时间
|
||||
public final static String activity_id = CLASS_NAME + "activity_id"; // 活动id
|
||||
public final static String activity_name = CLASS_NAME + "activity_name"; // 活动名称
|
||||
public final static String award_amount = CLASS_NAME + "award_amount"; // 奖励金额
|
||||
public final static String promoter_id = CLASS_NAME + "promoter_id"; // 推广者id,唯一值
|
||||
public final static String promoter_buyer_id = CLASS_NAME + "promoter_buyer_id"; //
|
||||
public final static String promoter_buyer_name = CLASS_NAME + "promoter_buyer_name"; // 买家名称
|
||||
public final static String promoter_buyer_weixin = CLASS_NAME + "promoter_buyer_weixin"; // 买家微信
|
||||
public final static String promoter_buyer_phone = CLASS_NAME + "promoter_buyer_phone"; // 买家手机号
|
||||
public final static String was_buyer_id = CLASS_NAME + "was_buyer_id"; // 被推荐者买家id
|
||||
public final static String was_buyer_name = CLASS_NAME + "was_buyer_name"; // 被推荐者买家名称
|
||||
public final static String was_buyer_weixin = CLASS_NAME + "was_buyer_weixin"; // 被推荐者买家微信
|
||||
public final static String was_buyer_phone = CLASS_NAME + "was_buyer_phone"; // 被推荐者买家手机号
|
||||
public final static String trade_order_id = CLASS_NAME + "trade_order_id"; // 订单id
|
||||
public final static String status_ = CLASS_NAME + "status"; // create 创建, canceled 取消 , arrive,到账, apply_draw:买家申请提现,seller_agree_draw: 卖家同意提现,seller_reject_draw:卖家拒绝提现,draw_success:提现成功,draw_failed:提现失败
|
||||
public final static String gmt_canceled = CLASS_NAME + "gmt_canceled"; // 取消时间
|
||||
public final static String gmt_create = CLASS_NAME + "gmt_create"; // 创建时间
|
||||
public final static String gmt_arrive = CLASS_NAME + "gmt_arrive"; // 到账时间
|
||||
public final static String canceled_reason = CLASS_NAME + "canceled_reason"; // 取消原因
|
||||
public final static String reject_reason = CLASS_NAME + "reject_reason"; // 拒绝原因
|
||||
public final static String gmt_reject = CLASS_NAME + "gmt_reject"; // 拒绝时间
|
||||
public final static String gmt_agree = CLASS_NAME + "gmt_agree"; // 同意时间
|
||||
public final static String gmt_apply_draw = CLASS_NAME + "gmt_apply_draw"; // 申请提现
|
||||
public final static String id_ = CLASS_NAME + "id"; //
|
||||
public final static String is_delete = CLASS_NAME + "is_delete"; // 是否删除:0 否 1 删除
|
||||
public final static String create_time = CLASS_NAME + "create_time"; // 创建时间
|
||||
public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间
|
||||
public final static String create_timestamp = CLASS_NAME + "create_timestamp"; // 创建时间戳
|
||||
public final static String modify_timestamp = CLASS_NAME + "modify_timestamp"; // 修改时间
|
||||
public final static String activity_id = CLASS_NAME + "activity_id"; // 活动id
|
||||
public final static String activity_name = CLASS_NAME + "activity_name"; // 活动名称
|
||||
public final static String award_amount = CLASS_NAME + "award_amount"; // 奖励金额
|
||||
public final static String promoter_id = CLASS_NAME + "promoter_id"; // 推广者id,唯一值
|
||||
public final static String promoter_buyer_id = CLASS_NAME + "promoter_buyer_id"; //
|
||||
public final static String promoter_buyer_name = CLASS_NAME + "promoter_buyer_name"; // 买家名称
|
||||
public final static String promoter_buyer_weixin = CLASS_NAME + "promoter_buyer_weixin"; // 买家微信
|
||||
public final static String promoter_buyer_phone = CLASS_NAME + "promoter_buyer_phone"; // 买家手机号
|
||||
public final static String was_buyer_id = CLASS_NAME + "was_buyer_id"; // 被推荐者买家id
|
||||
public final static String was_buyer_name = CLASS_NAME + "was_buyer_name"; // 被推荐者买家名称
|
||||
public final static String was_buyer_weixin = CLASS_NAME + "was_buyer_weixin"; // 被推荐者买家微信
|
||||
public final static String was_buyer_phone = CLASS_NAME + "was_buyer_phone"; // 被推荐者买家手机号
|
||||
public final static String trade_order_id = CLASS_NAME + "trade_order_id"; // 订单id
|
||||
public final static String status_ = CLASS_NAME + "status"; // create 创建, canceled 取消 , arrive,到账, apply_draw:买家申请提现,seller_agree_draw: 卖家同意提现,seller_reject_draw:卖家拒绝提现,draw_success:提现成功,draw_failed:提现失败
|
||||
public final static String gmt_canceled = CLASS_NAME + "gmt_canceled"; // 取消时间
|
||||
public final static String gmt_create = CLASS_NAME + "gmt_create"; // 创建时间
|
||||
public final static String gmt_arrive = CLASS_NAME + "gmt_arrive"; // 到账时间
|
||||
public final static String canceled_reason = CLASS_NAME + "canceled_reason"; // 取消原因
|
||||
public final static String reject_reason = CLASS_NAME + "reject_reason"; // 拒绝原因
|
||||
public final static String gmt_reject = CLASS_NAME + "gmt_reject"; // 拒绝时间
|
||||
public final static String gmt_agree = CLASS_NAME + "gmt_agree"; // 同意时间
|
||||
public final static String gmt_apply_draw = CLASS_NAME + "gmt_apply_draw"; // 申请提现
|
||||
public final static String profit_sharing_result = CLASS_NAME + "profit_sharing_result"; // 分账结果
|
||||
public final static String profit_sharing_fail_reason = CLASS_NAME + "profit_sharing_fail_reason"; // 分账失败原因
|
||||
public final static String gmt_draw_success = CLASS_NAME + "gmt_draw_success"; // 提现成功时间
|
||||
public final static String gmt_draw_failed = CLASS_NAME + "gmt_draw_failed"; // 提现失败时间
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@ -106,6 +110,14 @@ private static final long serialVersionUID = 1L;
|
||||
private Date gmtAgree;
|
||||
//申请提现
|
||||
private Date gmtApplyDraw;
|
||||
//分账结果
|
||||
private String profitSharingResult;
|
||||
//分账失败原因
|
||||
private String profitSharingFailReason;
|
||||
//提现成功时间
|
||||
private Date gmtDrawSuccess;
|
||||
//提现失败时间
|
||||
private Date gmtDrawFailed;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -526,6 +538,66 @@ private static final long serialVersionUID = 1L;
|
||||
this.gmtApplyDraw = gmtApplyDraw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分账结果
|
||||
* @return
|
||||
*/
|
||||
public String getProfitSharingResult() {
|
||||
return profitSharingResult;
|
||||
}
|
||||
/**
|
||||
* 分账结果
|
||||
* @param profitSharingResult
|
||||
*/
|
||||
public void setProfitSharingResult(String profitSharingResult) {
|
||||
this.profitSharingResult = profitSharingResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分账失败原因
|
||||
* @return
|
||||
*/
|
||||
public String getProfitSharingFailReason() {
|
||||
return profitSharingFailReason;
|
||||
}
|
||||
/**
|
||||
* 分账失败原因
|
||||
* @param profitSharingFailReason
|
||||
*/
|
||||
public void setProfitSharingFailReason(String profitSharingFailReason) {
|
||||
this.profitSharingFailReason = profitSharingFailReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现成功时间
|
||||
* @return
|
||||
*/
|
||||
public Date getGmtDrawSuccess() {
|
||||
return gmtDrawSuccess;
|
||||
}
|
||||
/**
|
||||
* 提现成功时间
|
||||
* @param gmtDrawSuccess
|
||||
*/
|
||||
public void setGmtDrawSuccess(Date gmtDrawSuccess) {
|
||||
this.gmtDrawSuccess = gmtDrawSuccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现失败时间
|
||||
* @return
|
||||
*/
|
||||
public Date getGmtDrawFailed() {
|
||||
return gmtDrawFailed;
|
||||
}
|
||||
/**
|
||||
* 提现失败时间
|
||||
* @param gmtDrawFailed
|
||||
*/
|
||||
public void setGmtDrawFailed(Date gmtDrawFailed) {
|
||||
this.gmtDrawFailed = gmtDrawFailed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvPromoterTradeOrderAwardEntity{" +
|
||||
@ -557,6 +629,10 @@ private static final long serialVersionUID = 1L;
|
||||
",gmtReject=" + gmtReject +
|
||||
",gmtAgree=" + gmtAgree +
|
||||
",gmtApplyDraw=" + gmtApplyDraw +
|
||||
",profitSharingResult=" + profitSharingResult +
|
||||
",profitSharingFailReason=" + profitSharingFailReason +
|
||||
",gmtDrawSuccess=" + gmtDrawSuccess +
|
||||
",gmtDrawFailed=" + gmtDrawFailed +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
package com.heyu.api.data.entity.vv;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.lz.mybatis.plugin.annotations.AS;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;import java.util.Date;
|
||||
import java.util.Date;
|
||||
/**
|
||||
*推广者获得奖品名细子单
|
||||
* @author quyixiao
|
||||
@ -51,6 +51,8 @@ private static final long serialVersionUID = 1L;
|
||||
public final static String gmt_reject = CLASS_NAME + "gmt_reject"; // 拒绝时间
|
||||
public final static String gmt_agree = CLASS_NAME + "gmt_agree"; // 同意时间
|
||||
public final static String gmt_apply_draw = CLASS_NAME + "gmt_apply_draw"; // 申请提现
|
||||
public final static String gmt_draw_success = CLASS_NAME + "gmt_draw_success"; // 提现成功时间
|
||||
public final static String gmt_draw_failed = CLASS_NAME + "gmt_draw_failed"; // 提现失败时间
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@ -112,6 +114,10 @@ private static final long serialVersionUID = 1L;
|
||||
private Date gmtAgree;
|
||||
//申请提现
|
||||
private Date gmtApplyDraw;
|
||||
//提现成功时间
|
||||
private Date gmtDrawSuccess;
|
||||
//提现失败时间
|
||||
private Date gmtDrawFailed;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -562,6 +568,36 @@ private static final long serialVersionUID = 1L;
|
||||
this.gmtApplyDraw = gmtApplyDraw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现成功时间
|
||||
* @return
|
||||
*/
|
||||
public Date getGmtDrawSuccess() {
|
||||
return gmtDrawSuccess;
|
||||
}
|
||||
/**
|
||||
* 提现成功时间
|
||||
* @param gmtDrawSuccess
|
||||
*/
|
||||
public void setGmtDrawSuccess(Date gmtDrawSuccess) {
|
||||
this.gmtDrawSuccess = gmtDrawSuccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现失败时间
|
||||
* @return
|
||||
*/
|
||||
public Date getGmtDrawFailed() {
|
||||
return gmtDrawFailed;
|
||||
}
|
||||
/**
|
||||
* 提现失败时间
|
||||
* @param gmtDrawFailed
|
||||
*/
|
||||
public void setGmtDrawFailed(Date gmtDrawFailed) {
|
||||
this.gmtDrawFailed = gmtDrawFailed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvPromoterTradeOrderLineAwardEntity{" +
|
||||
@ -595,6 +631,8 @@ private static final long serialVersionUID = 1L;
|
||||
",gmtReject=" + gmtReject +
|
||||
",gmtAgree=" + gmtAgree +
|
||||
",gmtApplyDraw=" + gmtApplyDraw +
|
||||
",gmtDrawSuccess=" + gmtDrawSuccess +
|
||||
",gmtDrawFailed=" + gmtDrawFailed +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -17,6 +17,8 @@ public enum AwardStatusEnums {
|
||||
|
||||
seller_reject_draw("seller_reject_draw", "卖家拒绝提现"),
|
||||
|
||||
draw_pending("draw_pending", "提现中"),
|
||||
|
||||
draw_success("draw_success", "提现成功"),
|
||||
|
||||
draw_failed("draw_failed", "提现失败"),
|
||||
|
||||
@ -23,7 +23,6 @@ public class SanUtils {
|
||||
try {
|
||||
if (CollectionUtils.isEmpty(values)) {
|
||||
return new HashMap<>();
|
||||
|
||||
}
|
||||
|
||||
Map<R, V> map = new HashMap<>();
|
||||
@ -38,6 +37,27 @@ public class SanUtils {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
|
||||
public static <T, P, K, V> Map<K, V> groupByFiledFiled2Map(List<P> values, LBiFunction0<T, K> keyFunction, LBiFunction0<T, V> valueFunction) {
|
||||
try {
|
||||
if (CollectionUtils.isEmpty(values)) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
Map<K, V> map = new HashMap<>();
|
||||
|
||||
Method keyMethod = getMethod(keyFunction);
|
||||
Method valueMethod = getMethod(valueFunction);
|
||||
for (P value : values) {
|
||||
map.put((K) keyMethod.invoke(value), (V) valueMethod.invoke(value));
|
||||
}
|
||||
return map;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
|
||||
public static <T, R, V> List<R> list2listFilterNull(List<V> values, LBiFunction0<T, R> function) {
|
||||
|
||||
List<R> list = list2FieldList(values, function);
|
||||
|
||||
@ -51,8 +51,6 @@ public class MysqlMain_update {
|
||||
list.add(new TablesBean("vv_promoter_trade_order_award"));
|
||||
list.add(new TablesBean("vv_promoter_trade_order_line_award"));
|
||||
|
||||
|
||||
|
||||
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
TablesBean obj = list.get(i);
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
package com.heyu.api.alibaba.request.mm.order;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
@Data
|
||||
public class ProfitSharingDTO {
|
||||
|
||||
private BigDecimal awardAmount;
|
||||
private String openid;
|
||||
private String buyerName;
|
||||
private Long promoterTradeOrderAwardId;
|
||||
public ProfitSharingDTO() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Long getPromoterTradeOrderAwardId() {
|
||||
return promoterTradeOrderAwardId;
|
||||
}
|
||||
|
||||
public void setPromoterTradeOrderAwardId(Long promoterTradeOrderAwardId) {
|
||||
this.promoterTradeOrderAwardId = promoterTradeOrderAwardId;
|
||||
}
|
||||
|
||||
public BigDecimal getAwardAmount() {
|
||||
return awardAmount;
|
||||
}
|
||||
|
||||
public void setAwardAmount(BigDecimal awardAmount) {
|
||||
this.awardAmount = awardAmount;
|
||||
}
|
||||
|
||||
public String getOpenid() {
|
||||
return openid;
|
||||
}
|
||||
|
||||
public void setOpenid(String openid) {
|
||||
this.openid = openid;
|
||||
}
|
||||
|
||||
public String getBuyerName() {
|
||||
return buyerName;
|
||||
}
|
||||
|
||||
public void setBuyerName(String buyerName) {
|
||||
this.buyerName = buyerName;
|
||||
}
|
||||
}
|
||||
@ -3,13 +3,18 @@ package com.heyu.api.jsapi;
|
||||
// 引用微信支付工具库,参考:https://pay.weixin.qq.com/doc/v3/merchant/4014931831
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.heyu.api.alibaba.request.mm.order.ProfitSharingDTO;
|
||||
import com.heyu.api.data.dao.vv.VvReverseOrderDao;
|
||||
import com.heyu.api.data.dao.vv.VvTradeOrderDao;
|
||||
import com.heyu.api.data.entity.vv.VvReverseOrderEntity;
|
||||
import com.heyu.api.data.entity.vv.VvTradeOrderEntity;
|
||||
import com.heyu.api.data.utils.BigDecimalUtil;
|
||||
import com.heyu.api.data.utils.StringUtils;
|
||||
import com.heyu.api.jsapi.dto.close.CloseOrderRequest;
|
||||
import com.heyu.api.jsapi.dto.pay.*;
|
||||
import com.heyu.api.jsapi.dto.profit.sharing.CreateOrderReceiver;
|
||||
import com.heyu.api.jsapi.dto.profit.sharing.CreateOrderRequest;
|
||||
import com.heyu.api.jsapi.dto.profit.sharing.OrdersEntity;
|
||||
import com.heyu.api.jsapi.dto.refund.AmountReq;
|
||||
import com.heyu.api.jsapi.dto.refund.CreateRequest;
|
||||
import com.heyu.api.jsapi.dto.refund.Refund;
|
||||
@ -31,7 +36,9 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.security.Signature;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -273,6 +280,110 @@ public class JsapiPrepay {
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* https://pay.weixin.qq.com/doc/v3/merchant/4012524936
|
||||
* 分账
|
||||
*/
|
||||
public OrdersEntity profitSharing(
|
||||
String transactionId,
|
||||
String outOrderNo,
|
||||
List<ProfitSharingDTO> profitSharingDTOList
|
||||
) {
|
||||
|
||||
String HOST = "https://api.mch.weixin.qq.com";
|
||||
String METHOD = "POST";
|
||||
CreateOrderRequest request = new CreateOrderRequest();
|
||||
//【公众账号ID】 APPID是微信开放平台(移动应用)或微信公众平台(小程序、公众号)为开发者的应用程序提供的唯一标识。此处,可以填写这三种类型中的任意一种APPID,但请确保该appid与mchid有绑定关系。详见:开发必要参数说明,只有含PERSONAL_OPENID接收方的情况下该参数必填。
|
||||
request.appid = appid;
|
||||
|
||||
// 微信订单号】 微信支付订单号
|
||||
request.transactionId = transactionId;
|
||||
|
||||
// 【商户分账单号】 商户系统内部的分账单号,在商户系统内部唯一,同一分账单号多次请求等同一次。只能是数字、大小写字母_-|*@
|
||||
request.outOrderNo = outOrderNo;
|
||||
//【分账接收方列表】 分账接收方列表,可以设置出资商户作为分账接受方,最多可有50个分账接收方
|
||||
request.receivers = new ArrayList<>();
|
||||
|
||||
for (ProfitSharingDTO profitSharingDTO : profitSharingDTOList) {
|
||||
CreateOrderReceiver receiversItem = new CreateOrderReceiver();
|
||||
/**
|
||||
* type 必填 string(32)
|
||||
*
|
||||
* 【分账接收方类型】
|
||||
*
|
||||
* MERCHANT_ID:商户号
|
||||
*
|
||||
* PERSONAL_OPENID:个人openid(用户在商户appid下的唯一标识,详见 OpenID获取)
|
||||
*/
|
||||
receiversItem.type = "PERSONAL_OPENID";
|
||||
|
||||
|
||||
receiversItem.account = profitSharingDTO.getOpenid();
|
||||
|
||||
/***
|
||||
* name 选填 string(1024)
|
||||
*
|
||||
* 【分账个人接收方姓名】
|
||||
*
|
||||
* 分账接收方类型是MERCHANT_ID时,是商户全称(必传),当商户是小微商户或个体户时,是开户人姓名
|
||||
*
|
||||
* 分账接收方类型是PERSONAL_OPENID时,是个人姓名(选传,传则会检查与 name 是否实名匹配,不匹配会拒绝分账请求)
|
||||
*/
|
||||
//receiversItem.name = client.encrypt("name");
|
||||
/***
|
||||
* account 必填 string(64)
|
||||
*
|
||||
* 【分账接收方帐号】
|
||||
*
|
||||
* 分账接收方类型为MERCHANT_ID时,分账接收方账号为商户号
|
||||
*
|
||||
* 分账接收方类型为PERSONAL_OPENID时,分账接收方账号为个人OpenID(由商户的AppID转换得到)
|
||||
*/
|
||||
receiversItem.amount = profitSharingDTO.getAwardAmount().multiply(new BigDecimal(100)).longValue();
|
||||
|
||||
if (StringUtils.isNotEmpty(profitSharingDTO.getBuyerName())) {
|
||||
receiversItem.description = profitSharingDTO.getBuyerName() + "profitSharing";
|
||||
} else {
|
||||
receiversItem.description = profitSharingDTO.getOpenid() + "openid";
|
||||
}
|
||||
|
||||
request.receivers.add(receiversItem);
|
||||
|
||||
}
|
||||
|
||||
request.unfreezeUnsplit = true;
|
||||
String uri = "/v3/profitsharing/orders";
|
||||
String reqBody = WXPayUtility.toJson(request);
|
||||
|
||||
Request.Builder reqBuilder = new Request.Builder().url(HOST + uri);
|
||||
reqBuilder.addHeader("Accept", "application/json");
|
||||
reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId);
|
||||
reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo, privateKey, METHOD, uri, reqBody));
|
||||
reqBuilder.addHeader("Content-Type", "application/json");
|
||||
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), reqBody);
|
||||
reqBuilder.method(METHOD, requestBody);
|
||||
Request httpRequest = reqBuilder.build();
|
||||
|
||||
// 发送HTTP请求
|
||||
OkHttpClient client = new OkHttpClient.Builder().build();
|
||||
try (Response httpResponse = client.newCall(httpRequest).execute()) {
|
||||
String respBody = WXPayUtility.extractBody(httpResponse);
|
||||
if (httpResponse.code() >= 200 && httpResponse.code() < 300) {
|
||||
// 2XX 成功,验证应答签名
|
||||
WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey,
|
||||
httpResponse.headers(), respBody);
|
||||
// 从HTTP应答报文构建返回数据
|
||||
return WXPayUtility.fromJson(respBody, OrdersEntity.class);
|
||||
} else {
|
||||
throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException("Sending request to " + uri + " failed.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* https://pay.weixin.qq.com/doc/v3/merchant/4012791904
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
package com.heyu.api.jsapi.dto.profit.sharing;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class CreateOrderReceiver {
|
||||
@SerializedName("type")
|
||||
public String type;
|
||||
|
||||
@SerializedName("account")
|
||||
public String account;
|
||||
|
||||
@SerializedName("name")
|
||||
public String name;
|
||||
|
||||
@SerializedName("amount")
|
||||
public Long amount;
|
||||
|
||||
@SerializedName("description")
|
||||
public String description;
|
||||
}
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package com.heyu.api.jsapi.dto.profit.sharing;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CreateOrderRequest {
|
||||
@SerializedName("appid")
|
||||
public String appid;
|
||||
|
||||
@SerializedName("transaction_id")
|
||||
public String transactionId;
|
||||
|
||||
@SerializedName("out_order_no")
|
||||
public String outOrderNo;
|
||||
|
||||
@SerializedName("receivers")
|
||||
public List<CreateOrderReceiver> receivers = new ArrayList<CreateOrderReceiver>();
|
||||
|
||||
@SerializedName("unfreeze_unsplit")
|
||||
public Boolean unfreezeUnsplit;
|
||||
}
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
package com.heyu.api.jsapi.dto.profit.sharing;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/***
|
||||
* fail_reason 选填 string
|
||||
*
|
||||
* 【分账失败原因】 分账失败原因,当分账结果result为CLOSED(已关闭)时,返回该字段,具体处理方案请参考分账失败处理指引。
|
||||
*
|
||||
* 可选取值
|
||||
*
|
||||
* ACCOUNT_ABNORMAL: 分账接收账户异常
|
||||
*
|
||||
* NO_RELATION: 分账关系已解除
|
||||
*
|
||||
* RECEIVER_HIGH_RISK: 高风险接收方
|
||||
*
|
||||
* RECEIVER_REAL_NAME_NOT_VERIFIED: 接收方未实名
|
||||
*
|
||||
* NO_AUTH: 分账权限已解除
|
||||
*
|
||||
* RECEIVER_RECEIPT_LIMIT: 超出用户月收款限额
|
||||
*
|
||||
* PAYER_ACCOUNT_ABNORMAL: 分出方账户异常
|
||||
*
|
||||
* INVALID_REQUEST: 描述参数设置失败
|
||||
*/
|
||||
public enum DetailFailReason {
|
||||
@SerializedName("ACCOUNT_ABNORMAL")
|
||||
ACCOUNT_ABNORMAL,
|
||||
@SerializedName("NO_RELATION")
|
||||
NO_RELATION,
|
||||
@SerializedName("RECEIVER_HIGH_RISK")
|
||||
RECEIVER_HIGH_RISK,
|
||||
@SerializedName("RECEIVER_REAL_NAME_NOT_VERIFIED")
|
||||
RECEIVER_REAL_NAME_NOT_VERIFIED,
|
||||
@SerializedName("NO_AUTH")
|
||||
NO_AUTH,
|
||||
@SerializedName("RECEIVER_RECEIPT_LIMIT")
|
||||
RECEIVER_RECEIPT_LIMIT,
|
||||
@SerializedName("PAYER_ACCOUNT_ABNORMAL")
|
||||
PAYER_ACCOUNT_ABNORMAL,
|
||||
@SerializedName("INVALID_REQUEST")
|
||||
INVALID_REQUEST
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
package com.heyu.api.jsapi.dto.profit.sharing;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public enum DetailStatus {
|
||||
@SerializedName("PENDING")
|
||||
PENDING,
|
||||
@SerializedName("SUCCESS")
|
||||
SUCCESS,
|
||||
@SerializedName("CLOSED")
|
||||
CLOSED
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package com.heyu.api.jsapi.dto.profit.sharing;
|
||||
|
||||
import cn.felord.payment.wechat.enumeration.DetailStatus;
|
||||
import cn.felord.payment.wechat.enumeration.ReceiverType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class OrderReceiverDetail {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
amount 必填 integer
|
||||
|
||||
【分账金额】 分账金额,单位为分,只能为整数,不能超过原订单支付金额及最大分账比例金额
|
||||
*/
|
||||
@SerializedName("amount")
|
||||
public Long amount;
|
||||
|
||||
@SerializedName("description")
|
||||
public String description;
|
||||
|
||||
/**
|
||||
*
|
||||
description 必填 string(80)
|
||||
|
||||
【解冻剩余资金描述】 描述解冻剩余资金的原因
|
||||
|
||||
|
||||
*/
|
||||
@SerializedName("type")
|
||||
public ReceiverType type;
|
||||
/**
|
||||
* account 必填 string(64)
|
||||
*
|
||||
* 【接收方账号】
|
||||
*
|
||||
* 分账接收方类型为MERCHANT_ID时,分账接收方账号为商户号
|
||||
*
|
||||
* 分账接收方类型为PERSONAL_OPENID时,分账接收方账号为个人OpenID(由商户的AppID转换得到)
|
||||
*/
|
||||
|
||||
@SerializedName("account")
|
||||
public String account;
|
||||
/**
|
||||
* result 必填 string
|
||||
*
|
||||
* 【分账结果】 分账结果
|
||||
*
|
||||
* 可选取值
|
||||
*
|
||||
* PENDING: 待分账,非终态
|
||||
*
|
||||
* SUCCESS: 分账成功,终态
|
||||
*
|
||||
* CLOSED: 已关闭,终态
|
||||
*/
|
||||
@SerializedName("result")
|
||||
public DetailStatus result;
|
||||
|
||||
|
||||
|
||||
|
||||
@SerializedName("fail_reason")
|
||||
public DetailFailReason failReason;
|
||||
/**
|
||||
* create_time 必填 string
|
||||
*
|
||||
* 【分账创建时间】 分账创建时间,需遵循 RFC3339 标准格式:yyyy-MM-DDTHH:mm:ss+TIMEZONE。yyyy-MM-DD 表示年月日;T 字符用于分隔日期和时间部分;HH:mm:ss 表示具体的时分秒;TIMEZONE 表示时区(例如,+08:00 对应东八区时间,即北京时间)。示例:2015-05-20T13:29:35+08:00 表示北京时间2015年5月20日13点29分35秒。
|
||||
*/
|
||||
@SerializedName("create_time")
|
||||
public String createTime;
|
||||
|
||||
|
||||
/***
|
||||
* finish_time 必填 string
|
||||
*
|
||||
*
|
||||
* 【分账完成时间】 分账完成时间,需遵循 RFC3339标准格式:yyyy-MM-DDTHH:mm:ss+TIMEZONE。yyyy-MM-DD 表示年月日;T 字符用于分隔日期和时间部分;HH:mm:ss 表示具体的时分秒;TIMEZONE 表示时区(例如,+08:00 对应东八区时间,即北京时间)。示例:2015-05-20T13:29:35+08:00 表示北京时间2015年5月20日13点29分35秒。
|
||||
*/
|
||||
@SerializedName("finish_time")
|
||||
public String finishTime;
|
||||
|
||||
/**
|
||||
* detail_id 必填 string(64)
|
||||
*
|
||||
* 【分账明细单号】 微信分账明细单号,每笔分账业务执行的明细单号,可与资金账单对账使用,对应资金账单中的“业务凭证号”
|
||||
*/
|
||||
@SerializedName("detail_id")
|
||||
public String detailId;
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
package com.heyu.api.jsapi.dto.profit.sharing;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public enum OrderStatus {
|
||||
@SerializedName("PROCESSING")
|
||||
PROCESSING,
|
||||
@SerializedName("FINISHED")
|
||||
FINISHED
|
||||
}
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
package com.heyu.api.jsapi.dto.profit.sharing;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.kuaidi100.sdk.contant.OrderStatus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class OrdersEntity {
|
||||
|
||||
@SerializedName("transaction_id")
|
||||
public String transactionId;
|
||||
|
||||
|
||||
@SerializedName("out_order_no")
|
||||
public String outOrderNo;
|
||||
|
||||
|
||||
@SerializedName("order_id")
|
||||
public String orderId;
|
||||
|
||||
|
||||
@SerializedName("state")
|
||||
public OrderStatus state;
|
||||
|
||||
|
||||
@SerializedName("receivers")
|
||||
public List<OrderReceiverDetail> receivers = new ArrayList<OrderReceiverDetail>();
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package com.heyu.api.jsapi.dto.profit.sharing;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public enum ReceiverType {
|
||||
@SerializedName("MERCHANT_ID")
|
||||
MERCHANT_ID,
|
||||
@SerializedName("PERSONAL_OPENID")
|
||||
PERSONAL_OPENID
|
||||
}
|
||||
@ -1,26 +1,39 @@
|
||||
package com.heyu.api.controller.mm;
|
||||
|
||||
|
||||
import cn.felord.payment.wechat.enumeration.DetailStatus;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.heyu.api.alibaba.request.mm.order.ProfitSharingDTO;
|
||||
import com.heyu.api.alibaba.request.mm.order.resp.VvAdminAgreeDrawRequest;
|
||||
import com.heyu.api.alibaba.request.mm.order.resp.VvAdminRejectDrawRequest;
|
||||
import com.heyu.api.common.annotation.Describe;
|
||||
import com.heyu.api.data.constants.ApiConstants;
|
||||
import com.heyu.api.data.dao.vv.VvBuyerDao;
|
||||
import com.heyu.api.data.dao.vv.VvPromoterTradeOrderAwardDao;
|
||||
import com.heyu.api.data.dao.vv.VvPromoterTradeOrderLineAwardDao;
|
||||
import com.heyu.api.data.dao.vv.VvTradeOrderDao;
|
||||
import com.heyu.api.data.entity.vv.VvBuyerEntity;
|
||||
import com.heyu.api.data.entity.vv.VvPromoterTradeOrderAwardEntity;
|
||||
import com.heyu.api.data.entity.vv.VvPromoterTradeOrderLineAwardEntity;
|
||||
import com.heyu.api.data.entity.vv.VvTradeOrderEntity;
|
||||
import com.heyu.api.data.enums.ActionEnums;
|
||||
import com.heyu.api.data.enums.AwardStatusEnums;
|
||||
import com.heyu.api.data.service.impl.AbstractDrawAction;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.data.utils.SanUtils;
|
||||
import com.heyu.api.jsapi.JsapiPrepay;
|
||||
import com.heyu.api.jsapi.dto.profit.sharing.OrderReceiverDetail;
|
||||
import com.heyu.api.jsapi.dto.profit.sharing.OrdersEntity;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ -40,6 +53,13 @@ public class AdminDrawController {
|
||||
private VvPromoterTradeOrderLineAwardDao vvPromoterTradeOrderLineAwardDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private JsapiPrepay jsapiPrepay;
|
||||
|
||||
@Autowired
|
||||
private VvTradeOrderDao vvTradeOrderDao;
|
||||
|
||||
|
||||
// http://localhost:8888/mm/draw/agree
|
||||
@Describe("同意提现")
|
||||
@RequestMapping("/agree")
|
||||
@ -47,10 +67,22 @@ public class AdminDrawController {
|
||||
List<VvPromoterTradeOrderAwardEntity>
|
||||
vvPromoterTradeOrderAwardEntityList = vvPromoterTradeOrderAwardDao.selectVvPromoterTradeOrderAwardByPromoterId(request.getPromoterTradeOrderIdList());
|
||||
for (VvPromoterTradeOrderAwardEntity vvPromoterTradeOrderAwardEntity : vvPromoterTradeOrderAwardEntityList) {
|
||||
if(AbstractDrawAction.checkFailed(vvPromoterTradeOrderAwardEntity,false, ActionEnums.Admin_Seller_Agree_Draw)){
|
||||
if (AbstractDrawAction.checkFailed(vvPromoterTradeOrderAwardEntity, false, ActionEnums.Admin_Seller_Agree_Draw)) {
|
||||
return R.error("提现状态不对");
|
||||
}
|
||||
}
|
||||
|
||||
List<Long> tradeOrderIdList = SanUtils.getFieldList(vvPromoterTradeOrderAwardEntityList, VvPromoterTradeOrderAwardEntity::getTradeOrderId);
|
||||
List<VvTradeOrderEntity> vvTradeOrderEntities = vvTradeOrderDao.selectVvTradeOrderByTradeOrderIds(tradeOrderIdList);
|
||||
Map<Long, VvTradeOrderEntity> vvTradeOrderEntityMap = SanUtils.groupByFiled2Map(vvTradeOrderEntities, VvTradeOrderEntity::getId);
|
||||
|
||||
List<Long> buyerIdList = SanUtils.getFieldList(vvPromoterTradeOrderAwardEntityList, VvPromoterTradeOrderAwardEntity::getPromoterBuyerId);
|
||||
List<VvBuyerEntity> vvBuyerEntities = vvBuyerDao.selectVvBuyerByIdList(buyerIdList);
|
||||
Map<Long, VvBuyerEntity> vvBuyerEntityMap = SanUtils.groupByFiled2Map(vvBuyerEntities, VvBuyerEntity::getId);
|
||||
|
||||
Map<Long, String> oldIdStatusMap = SanUtils.groupByFiledFiled2Map(vvPromoterTradeOrderAwardEntityList, VvPromoterTradeOrderAwardEntity::getId, VvPromoterTradeOrderAwardEntity::getStatus);
|
||||
|
||||
for (VvPromoterTradeOrderAwardEntity vvPromoterTradeOrderAwardEntity : vvPromoterTradeOrderAwardEntityList) {
|
||||
vvPromoterTradeOrderAwardEntity.setStatus(AwardStatusEnums.seller_agree_draw.getStatus());
|
||||
vvPromoterTradeOrderAwardEntity.setGmtAgree(new Date());
|
||||
vvPromoterTradeOrderAwardDao.updateVvPromoterTradeOrderAwardById(vvPromoterTradeOrderAwardEntity);
|
||||
@ -58,12 +90,112 @@ public class AdminDrawController {
|
||||
|
||||
List<VvPromoterTradeOrderLineAwardEntity> vvPromoterTradeOrderLineAwardEntities = vvPromoterTradeOrderLineAwardDao
|
||||
.selectVvPromoterTradeOrderLineAwardByPromoterIdList(request.getPromoterTradeOrderIdList());
|
||||
|
||||
for (VvPromoterTradeOrderLineAwardEntity vvPromoterTradeOrderLineAwardEntity : vvPromoterTradeOrderLineAwardEntities) {
|
||||
vvPromoterTradeOrderLineAwardEntity.setStatus(AwardStatusEnums.seller_agree_draw.getStatus());
|
||||
vvPromoterTradeOrderLineAwardEntity.setGmtAgree(new Date());
|
||||
vvPromoterTradeOrderLineAwardDao.updateVvPromoterTradeOrderLineAwardById(vvPromoterTradeOrderLineAwardEntity);
|
||||
}
|
||||
|
||||
Map<Long, List<VvPromoterTradeOrderLineAwardEntity>> vvPromoterTradeOrderLineAwardEntityMap =
|
||||
SanUtils.groupByFiled2MapList(vvPromoterTradeOrderLineAwardEntities, VvPromoterTradeOrderLineAwardEntity::getPromoterTradeOrderAwardId);
|
||||
|
||||
Map<Long, List<VvPromoterTradeOrderAwardEntity>> vvPromoterTradeOrderAwardMap =
|
||||
SanUtils.groupByFiled2MapList(vvPromoterTradeOrderAwardEntityList, VvPromoterTradeOrderAwardEntity::getTradeOrderId);
|
||||
|
||||
Map<Long, VvPromoterTradeOrderAwardEntity> vvPromoterTradeOrderAwardMapping =
|
||||
SanUtils.groupByFiled2Map(vvPromoterTradeOrderAwardEntityList, VvPromoterTradeOrderAwardEntity::getId);
|
||||
|
||||
|
||||
for (Map.Entry<Long, List<VvPromoterTradeOrderAwardEntity>> entry : vvPromoterTradeOrderAwardMap.entrySet()) {
|
||||
List<VvPromoterTradeOrderAwardEntity> vvPromoterTradeOrderAwardEntities = entry.getValue();
|
||||
VvTradeOrderEntity vvTradeOrderEntity = vvTradeOrderEntityMap.get(entry.getKey());
|
||||
List<ProfitSharingDTO> profitSharingDTOList = new ArrayList<>();
|
||||
for (VvPromoterTradeOrderAwardEntity vvPromoterTradeOrderAwardEntity : vvPromoterTradeOrderAwardEntities) {
|
||||
ProfitSharingDTO profitSharingDTO = new ProfitSharingDTO();
|
||||
VvBuyerEntity vvBuyerEntity = vvBuyerEntityMap.get(vvPromoterTradeOrderAwardEntity.getPromoterBuyerId());
|
||||
profitSharingDTO.setAwardAmount(vvPromoterTradeOrderAwardEntity.getAwardAmount());
|
||||
profitSharingDTO.setOpenid(vvBuyerEntity.getOpenid());
|
||||
profitSharingDTO.setBuyerName(vvBuyerEntity.getBuyerName());
|
||||
profitSharingDTO.setPromoterTradeOrderAwardId(vvPromoterTradeOrderAwardEntity.getId());
|
||||
profitSharingDTOList.add(profitSharingDTO);
|
||||
}
|
||||
|
||||
/***
|
||||
* https://pay.weixin.qq.com/doc/v3/merchant/4012525210
|
||||
*/
|
||||
OrdersEntity ordersEntity = jsapiPrepay.profitSharing(
|
||||
vvTradeOrderEntity.getTransactionId(),
|
||||
ApiConstants.PS + vvTradeOrderEntity.getId(),
|
||||
profitSharingDTOList
|
||||
);
|
||||
log.info("AdminDrawController agreee :{}", JSON.toJSONString(ordersEntity));
|
||||
Map<String, ProfitSharingDTO> profitSharingDTOMap = SanUtils.groupByFiled2Map(profitSharingDTOList, ProfitSharingDTO::getOpenid);
|
||||
if (ordersEntity != null) {
|
||||
List<OrderReceiverDetail> orderReceiverDetails = ordersEntity.receivers;
|
||||
for (OrderReceiverDetail orderReceiverDetail : orderReceiverDetails) {
|
||||
ProfitSharingDTO profitSharingDTO = profitSharingDTOMap.get(orderReceiverDetail.account);
|
||||
VvPromoterTradeOrderAwardEntity vvPromoterTradeOrderAwardEntity = vvPromoterTradeOrderAwardMapping.get(profitSharingDTO.getPromoterTradeOrderAwardId());
|
||||
vvPromoterTradeOrderAwardEntity.setProfitSharingResult(JSON.toJSONString(ordersEntity));
|
||||
String status = AwardStatusEnums.draw_pending.getStatus();
|
||||
DetailStatus detailStatus = orderReceiverDetail.result;
|
||||
if (detailStatus == DetailStatus.SUCCESS) {
|
||||
status = AwardStatusEnums.draw_success.getStatus();
|
||||
vvPromoterTradeOrderAwardEntity.setGmtDrawSuccess(new Date());
|
||||
|
||||
|
||||
} else if (detailStatus == DetailStatus.FAIL) {
|
||||
status = AwardStatusEnums.draw_failed.getStatus();
|
||||
vvPromoterTradeOrderAwardEntity.setProfitSharingFailReason(orderReceiverDetail.failReason + "");
|
||||
vvPromoterTradeOrderAwardEntity.setGmtDrawFailed(new Date());
|
||||
}
|
||||
vvPromoterTradeOrderAwardEntity.setStatus(status);
|
||||
vvPromoterTradeOrderLineAwardEntityMap.get(profitSharingDTO.getPromoterTradeOrderAwardId());
|
||||
|
||||
String oldStatus = oldIdStatusMap.get(vvPromoterTradeOrderAwardEntity.getId());
|
||||
|
||||
if (AwardStatusEnums.draw_failed.getStatus().equals(status)) {
|
||||
if (AwardStatusEnums.arrive.getStatus().equals(oldStatus)) {
|
||||
vvBuyerDao.updateVvBuyerByIdPromoterDrawCashFailedAmountPromoterArriveAccountAmount(
|
||||
vvPromoterTradeOrderAwardEntity.getAwardAmount()
|
||||
, vvPromoterTradeOrderAwardEntity.getAwardAmount(),
|
||||
vvPromoterTradeOrderAwardEntity.getId());
|
||||
|
||||
} else if (AwardStatusEnums.apply_draw.getStatus().equals(oldStatus)) {
|
||||
vvBuyerDao.updateVvBuyerByIdPromoterDrawCashFailedAmountPromoterApplyDrawCashAmount(
|
||||
vvPromoterTradeOrderAwardEntity.getAwardAmount()
|
||||
, vvPromoterTradeOrderAwardEntity.getAwardAmount(),
|
||||
vvPromoterTradeOrderAwardEntity.getId());
|
||||
}
|
||||
} else if (AwardStatusEnums.draw_success.getStatus().equals(status)) {
|
||||
if (AwardStatusEnums.arrive.getStatus().equals(oldStatus)) {
|
||||
vvBuyerDao.updateVvBuyerByIdPromoterDrawCashSuccessAmountPromoterArriveAccountAmount(
|
||||
vvPromoterTradeOrderAwardEntity.getAwardAmount()
|
||||
, vvPromoterTradeOrderAwardEntity.getAwardAmount(),
|
||||
vvPromoterTradeOrderAwardEntity.getId());
|
||||
} else if (AwardStatusEnums.apply_draw.getStatus().equals(oldStatus)) {
|
||||
vvBuyerDao.updateVvBuyerByIdPromoterDrawCashSuccessAmountPromoterApplyDrawCashAmount(
|
||||
vvPromoterTradeOrderAwardEntity.getAwardAmount()
|
||||
, vvPromoterTradeOrderAwardEntity.getAwardAmount(),
|
||||
vvPromoterTradeOrderAwardEntity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
List<VvPromoterTradeOrderLineAwardEntity> vvPromoterTradeOrderLineAwardEntityList =
|
||||
vvPromoterTradeOrderLineAwardEntityMap.get(profitSharingDTO.getPromoterTradeOrderAwardId());
|
||||
for (VvPromoterTradeOrderLineAwardEntity vvPromoterTradeOrderLineAwardEntity : vvPromoterTradeOrderLineAwardEntityList) {
|
||||
vvPromoterTradeOrderLineAwardEntity.setStatus(status);
|
||||
if (AwardStatusEnums.draw_failed.getStatus().equals(status)) {
|
||||
vvPromoterTradeOrderLineAwardEntity.setGmtDrawSuccess(new Date());
|
||||
} else if (AwardStatusEnums.draw_success.getStatus().equals(status)) {
|
||||
vvPromoterTradeOrderLineAwardEntity.setGmtDrawFailed(new Date());
|
||||
}
|
||||
|
||||
vvPromoterTradeOrderLineAwardDao.updateVvPromoterTradeOrderLineAwardById(vvPromoterTradeOrderLineAwardEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ -75,11 +207,9 @@ public class AdminDrawController {
|
||||
List<VvPromoterTradeOrderAwardEntity>
|
||||
vvPromoterTradeOrderAwardEntityList = vvPromoterTradeOrderAwardDao.selectVvPromoterTradeOrderAwardByPromoterId(request.getPromoterTradeOrderIdList());
|
||||
for (VvPromoterTradeOrderAwardEntity vvPromoterTradeOrderAwardEntity : vvPromoterTradeOrderAwardEntityList) {
|
||||
if(AbstractDrawAction.checkFailed(vvPromoterTradeOrderAwardEntity,false, ActionEnums.Admin_Seller_Reject_Draw)){
|
||||
if (AbstractDrawAction.checkFailed(vvPromoterTradeOrderAwardEntity, false, ActionEnums.Admin_Seller_Reject_Draw)) {
|
||||
return R.error("提现状态不对");
|
||||
}
|
||||
|
||||
|
||||
String status = vvPromoterTradeOrderAwardEntity.getStatus();
|
||||
vvPromoterTradeOrderAwardEntity.setStatus(AwardStatusEnums.seller_reject_draw.getStatus());
|
||||
vvPromoterTradeOrderAwardEntity.setRejectReason(request.getReason());
|
||||
@ -98,6 +228,8 @@ public class AdminDrawController {
|
||||
vvPromoterTradeOrderAwardEntity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<VvPromoterTradeOrderLineAwardEntity> vvPromoterTradeOrderLineAwardEntities = vvPromoterTradeOrderLineAwardDao
|
||||
.selectVvPromoterTradeOrderLineAwardByPromoterIdList(request.getPromoterTradeOrderIdList());
|
||||
for (VvPromoterTradeOrderLineAwardEntity vvPromoterTradeOrderLineAwardEntity : vvPromoterTradeOrderLineAwardEntities) {
|
||||
|
||||
@ -6,6 +6,7 @@ import com.heyu.api.common.annotation.Describe;
|
||||
import com.heyu.api.data.dao.vv.VvBuyerDao;
|
||||
import com.heyu.api.data.dao.vv.VvPromoterTradeOrderAwardDao;
|
||||
import com.heyu.api.data.dao.vv.VvPromoterTradeOrderLineAwardDao;
|
||||
import com.heyu.api.data.dao.vv.VvTradeOrderDao;
|
||||
import com.heyu.api.data.entity.vv.VvPromoterTradeOrderAwardEntity;
|
||||
import com.heyu.api.data.entity.vv.VvPromoterTradeOrderLineAwardEntity;
|
||||
import com.heyu.api.data.enums.ActionEnums;
|
||||
@ -39,6 +40,9 @@ public class AppDrawController {
|
||||
private VvPromoterTradeOrderLineAwardDao vvPromoterTradeOrderLineAwardDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvTradeOrderDao vvTradeOrderDao;
|
||||
|
||||
/***
|
||||
* 奖励 列表
|
||||
* http://localhost:8888/app/draw/apply
|
||||
@ -48,12 +52,15 @@ public class AppDrawController {
|
||||
public R draw(@RequestBody AppPromoterTradeOrderDrawRequest request) {
|
||||
List<VvPromoterTradeOrderAwardEntity>
|
||||
vvPromoterTradeOrderAwardEntityList = vvPromoterTradeOrderAwardDao.selectVvPromoterTradeOrderAwardByPromoterId(request.getPromoterTradeOrderIdList());
|
||||
for (VvPromoterTradeOrderAwardEntity vvPromoterTradeOrderAwardEntity : vvPromoterTradeOrderAwardEntityList) {
|
||||
|
||||
for (VvPromoterTradeOrderAwardEntity vvPromoterTradeOrderAwardEntity : vvPromoterTradeOrderAwardEntityList) {
|
||||
if (AbstractDrawAction.checkFailed(vvPromoterTradeOrderAwardEntity, true, ActionEnums.App_Buyer_Apply_Draw)) {
|
||||
return R.error("提现状态不对");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (VvPromoterTradeOrderAwardEntity vvPromoterTradeOrderAwardEntity : vvPromoterTradeOrderAwardEntityList) {
|
||||
vvPromoterTradeOrderAwardEntity.setStatus(AwardStatusEnums.apply_draw.getStatus());
|
||||
vvPromoterTradeOrderAwardEntity.setGmtApplyDraw(new Date());
|
||||
vvPromoterTradeOrderAwardDao.updateVvPromoterTradeOrderAwardById(vvPromoterTradeOrderAwardEntity);
|
||||
@ -71,6 +78,7 @@ public class AppDrawController {
|
||||
vvPromoterTradeOrderLineAwardEntity.setGmtApplyDraw(new Date());
|
||||
vvPromoterTradeOrderLineAwardDao.updateVvPromoterTradeOrderLineAwardById(vvPromoterTradeOrderLineAwardEntity);
|
||||
}
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@ -361,8 +361,6 @@ public class AppOrderController {
|
||||
vvTradeOrderLineDao.insertOrUpdateVvTradeOrderLine(tradeOrderLineEntity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<VvPromoterBuyerEntity> vvPromoterBuyerList = vvPromoterBuyerDao.selectVvPromoterBuyerByPromoterId(vvActivityDTO.getPromoterId());
|
||||
|
||||
if (CollectionUtils.isNotEmpty(vvPromoterBuyerList)
|
||||
@ -398,6 +396,8 @@ public class AppOrderController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (Map.Entry<Long, List<VvPromoterTradeOrderLineAwardEntity>> entry : vvPromoterTradeOrderLineAwardMap.entrySet()) {
|
||||
VvPromoterTradeOrderAwardEntity vvPromoterTradeOrderAwardEntity = new VvPromoterTradeOrderAwardEntity();
|
||||
VvPromoterTradeOrderLineAwardEntity vvPromoterTradeOrderLineAwardIndex_0 = vvPromoterTradeOrderLineAwardEntityList.get(0);
|
||||
@ -412,6 +412,12 @@ public class AppOrderController {
|
||||
vvPromoterTradeOrderAwardEntity.getAwardAmount(),
|
||||
vvPromoterTradeOrderAwardEntity.getAwardAmount(),
|
||||
vvPromoterTradeOrderAwardEntity.getId());
|
||||
|
||||
|
||||
for (VvPromoterTradeOrderLineAwardEntity vvPromoterTradeOrderLineAwardEntity : vvPromoterTradeOrderLineAwardEntities) {
|
||||
vvPromoterTradeOrderLineAwardEntity.setPromoterTradeOrderAwardId(vvPromoterTradeOrderAwardEntity.getId());
|
||||
vvPromoterTradeOrderLineAwardDao.updateVvPromoterTradeOrderLineAwardById(vvPromoterTradeOrderLineAwardEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -430,6 +436,7 @@ public class AppOrderController {
|
||||
);
|
||||
|
||||
String prepay_id = jsapiPrepayResponse.getPrepayId();
|
||||
|
||||
if (jsapiPrepayResponse != null && jsapiPrepayResponse.getPrepayId() != null) {
|
||||
List<VvTradeOrderLineEntity> vvTradeOrderLineEntities = vvTradeOrderLineDao.selectVvTradeOrderLineByTradeOrderId(vvTradeOrderEntity.getId());
|
||||
for (VvTradeOrderLineEntity vvTradeOrderLineEntity : vvTradeOrderLineEntities) {
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
package com.api.test;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.heyu.api.jsapi.dto.profit.sharing.OrdersEntity;
|
||||
import org.junit.Test;
|
||||
|
||||
public class Test5 {
|
||||
|
||||
|
||||
@ -16,4 +20,10 @@ public class Test5 {
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void test1(){
|
||||
System.out.println(JSON.toJSONString(new OrdersEntity()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user