Commit ac81c85f by giaogiao

完成捐款支付调用

parent 7475d6d9
...@@ -36,7 +36,6 @@ public class DonationRecordController extends BaseController { ...@@ -36,7 +36,6 @@ public class DonationRecordController extends BaseController {
@Autowired @Autowired
private DonationRecordService donationRecordService; private DonationRecordService donationRecordService;
/** /**
* 添加捐款记录 * 添加捐款记录
*/ */
......
//package com.sien.common.controller; package com.sien.common.controller;
//
//import com.github.binarywang.wxpay.bean.coupon.WxPayCouponInfoQueryRequest; import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
//import com.github.binarywang.wxpay.bean.coupon.WxPayCouponInfoQueryResult; import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
//import com.github.binarywang.wxpay.bean.coupon.WxPayCouponSendRequest; import com.github.binarywang.wxpay.exception.WxPayException;
//import com.github.binarywang.wxpay.bean.coupon.WxPayCouponSendResult; import com.github.binarywang.wxpay.service.WxPayService;
//import com.github.binarywang.wxpay.bean.coupon.WxPayCouponStockQueryRequest; import com.sien.common.service.DonationRecordService;
//import com.github.binarywang.wxpay.bean.coupon.WxPayCouponStockQueryResult; import io.swagger.annotations.ApiOperation;
//import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse; import lombok.AllArgsConstructor;
//import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; import org.springframework.beans.factory.annotation.Autowired;
//import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult; import org.springframework.web.bind.annotation.PostMapping;
//import com.github.binarywang.wxpay.bean.notify.WxScanPayNotifyResult; import org.springframework.web.bind.annotation.RequestBody;
//import com.github.binarywang.wxpay.bean.request.*; import org.springframework.web.bind.annotation.RequestMapping;
//import com.github.binarywang.wxpay.bean.result.*; import org.springframework.web.bind.annotation.RestController;
//import com.github.binarywang.wxpay.exception.WxPayException;
//import com.github.binarywang.wxpay.service.WxPayService;
//import io.swagger.annotations.ApiOperation; /**
//import lombok.AllArgsConstructor; * @author Binary Wang
//import org.springframework.beans.factory.annotation.Autowired; */
//import org.springframework.web.bind.annotation.GetMapping; //@Api(value = "微信支付", hidden = true)
//import org.springframework.web.bind.annotation.PathVariable; @RestController
//import org.springframework.web.bind.annotation.PostMapping; @RequestMapping("/pay")
//import org.springframework.web.bind.annotation.RequestBody; @AllArgsConstructor
//import org.springframework.web.bind.annotation.RequestMapping; public class WxPayController {
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController; @Autowired
// private WxPayService wxService;
//import java.io.File;
//import java.util.Date; @Autowired
// private DonationRecordService donationRecordService;
//
///** @ApiOperation(value = "捐款支付回调通知处理")
// * @author Binary Wang @PostMapping("/notify/donationOrder")
// */ public String parseDonationOrderNotifyResult(@RequestBody String xmlData) throws WxPayException {
////@Api(value = "微信支付", hidden = true) return donationRecordService.parseDonationOrderNotifyResult(xmlData);
//@RestController
//@RequestMapping("/pay")
//@AllArgsConstructor }
//public class WxPayController {
// @ApiOperation(value = "会员充值支付回调通知处理")
// @Autowired @PostMapping("/notify/vipOrder")
// private WxPayService wxService; public String parseVipOrderNotifyResult(@RequestBody String xmlData) throws WxPayException {
final WxPayOrderNotifyResult notifyResult = this.wxService.parseOrderNotifyResult(xmlData);
// TODO 根据自己业务场景需要构造返回对象
return WxPayNotifyResponse.success("成功");
}
// //
// /** // /**
// * <pre> // * <pre>
...@@ -395,6 +399,6 @@ ...@@ -395,6 +399,6 @@
// public String queryComment(Date beginDate, Date endDate, Integer offset, Integer limit) throws WxPayException { // public String queryComment(Date beginDate, Date endDate, Integer offset, Integer limit) throws WxPayException {
// return this.wxService.queryComment(beginDate, endDate, offset, limit); // return this.wxService.queryComment(beginDate, endDate, offset, limit);
// } // }
//
//} }
//
...@@ -57,4 +57,14 @@ public class DonationRecord extends BaseEntity { ...@@ -57,4 +57,14 @@ public class DonationRecord extends BaseEntity {
@ApiModelProperty("是否为别人替我捐款") @ApiModelProperty("是否为别人替我捐款")
private Integer isReplace; private Integer isReplace;
@ApiModelProperty("微信商家订单id")
private String wxMerPayId;
@ApiModelProperty("支付状态,1已支付, 0未支付")
private Integer payStatus;
@ApiModelProperty("支付时间")
private Date payTime;
} }
...@@ -64,4 +64,13 @@ public class VipRecord extends BaseEntity { ...@@ -64,4 +64,13 @@ public class VipRecord extends BaseEntity {
@ApiModelProperty("修改时间") @ApiModelProperty("修改时间")
private Date updateTime; private Date updateTime;
@ApiModelProperty("微信商家订单id")
private String wxMerPayId;
@ApiModelProperty("支付状态,1已支付, 0未支付")
private Integer payStatus;
@ApiModelProperty("支付时间")
private Date payTime;
} }
...@@ -36,7 +36,7 @@ public interface DonationRecordMapper extends BaseMapper<DonationRecord> { ...@@ -36,7 +36,7 @@ public interface DonationRecordMapper extends BaseMapper<DonationRecord> {
* @param donationRecordPageParam * @param donationRecordPageParam
* @return * @return
*/ */
IPage<DonationRecordQueryVo> getDonationRecordPageList(@Param("page") Page page, @Param("param") DonationRecordPageParam donationRecordPageParam); IPage<DonationRecordQueryVo> getDonationRecordPageList(@Param("page") Page page, @Param("param") DonationRecordPageParam donationRecordPageParam, @Param("userId") Long userId);
/** /**
......
package com.sien.common.param; package com.sien.common.param;
import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam;
/** /**
* <pre> * <pre>
...@@ -18,6 +18,6 @@ import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam; ...@@ -18,6 +18,6 @@ import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam;
@Accessors(chain = true) @Accessors(chain = true)
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "捐款记录分页参数") @ApiModel(value = "捐款记录分页参数")
public class DonationRecordPageParam extends BasePageOrderParam{ public class DonationRecordPageParam extends BasePageOrderParam {
private static final long serialVersionUID=1L; private static final long serialVersionUID = 1L;
} }
...@@ -30,7 +30,7 @@ public class VipRecordOpenParam extends BasePageOrderParam { ...@@ -30,7 +30,7 @@ public class VipRecordOpenParam extends BasePageOrderParam {
private BigDecimal money; private BigDecimal money;
@NotNull(message = "开通多久不能为空") @NotNull(message = "开通多久不能为空")
@ApiModelProperty("开通多") @ApiModelProperty("开通多少年")
private Integer years; private Integer years;
@NotBlank(message = "会员等级不能为空") @NotBlank(message = "会员等级不能为空")
...@@ -38,11 +38,17 @@ public class VipRecordOpenParam extends BasePageOrderParam { ...@@ -38,11 +38,17 @@ public class VipRecordOpenParam extends BasePageOrderParam {
private String vipLevel; private String vipLevel;
@NotBlank(message = "不能为空") @NotBlank(message = "不能为空")
@ApiModelProperty("是否代替他人捐款") @ApiModelProperty("是否代替他人开通")
private Boolean isAgent; private Boolean isReplace;
@NotBlank(message = "不能为空") // @NotBlank(message = "不能为空")
@ApiModelProperty("替他人捐款,接收人userId, 当isAgent=1为必填") // @ApiModelProperty("替他人开通,接收人userId, ")
private Long agentUserId; // private Long agentUserId;
@ApiModelProperty("捐款接收用户手机号,当isAgent=1为必填")
private String userPhone;
@ApiModelProperty("手机区号,当isAgent=1为必填")
private String phoneArea;
} }
...@@ -16,18 +16,21 @@ import java.math.BigDecimal; ...@@ -16,18 +16,21 @@ import java.math.BigDecimal;
public class DonationRecordAdd implements Serializable { public class DonationRecordAdd implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty("捐款金额") @ApiModelProperty(value = "捐款金额", required = true)
private BigDecimal money; private BigDecimal money;
@ApiModelProperty("捐款用途;直接录入字符串: 助学助教,资助病残;慰问孤老,其他") @ApiModelProperty(value = "捐款用途;直接录入字符串: 助学助教,资助病残;慰问孤老,其他", required = true)
private String purpose; private String purpose;
@ApiModelProperty("捐款方式;1正常,2匿名") @ApiModelProperty(value = "捐款方式;1正常,2匿名", required = true)
private Integer way; private Integer way;
@ApiModelProperty("是否替别人捐款") @ApiModelProperty(value = "是否替别人捐款,1是,0不是", required = true)
private Integer isReplace; private Integer isReplace;
@ApiModelProperty("捐款接收用户手机号") @ApiModelProperty("捐款接收用户手机号,isReplace=1时必传")
private String userPhone; private String userPhone;
@ApiModelProperty("手机区号,isReplace=1时必传")
private String phoneArea;
} }
...@@ -37,6 +37,10 @@ public interface DonationRecordService extends BaseService<DonationRecord> { ...@@ -37,6 +37,10 @@ public interface DonationRecordService extends BaseService<DonationRecord> {
boolean saveDonationRecord(DonationRecord donationRecord) throws Exception; boolean saveDonationRecord(DonationRecord donationRecord) throws Exception;
// 回调
String parseDonationOrderNotifyResult(String xmlData);
ApiResult<WxPayMpOrderResult> add(DonationRecordAdd donationRecordAdd) throws Exception; ApiResult<WxPayMpOrderResult> add(DonationRecordAdd donationRecordAdd) throws Exception;
/** /**
......
...@@ -60,8 +60,8 @@ public class VipRecordServiceImpl extends BaseServiceImpl<VipRecordMapper, VipRe ...@@ -60,8 +60,8 @@ public class VipRecordServiceImpl extends BaseServiceImpl<VipRecordMapper, VipRe
// vipRecord.setUpdateTime(new Date()); // vipRecord.setUpdateTime(new Date());
// 判断是否为替他人 // 判断是否为替他人
if (vipRecordOpenParam.getIsAgent()) { if (vipRecordOpenParam.getIsReplace()) {
vipRecord.setFkRechargeUser(vipRecordOpenParam.getAgentUserId()); // vipRecord.setFkRechargeUser(vipRecordOpenParam.getAgentUserId());
} }
return super.save(vipRecord); return super.save(vipRecord);
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id id
, fk_user_id, money, purpose, way, remark, create_time, update_time, is_replace , fk_user_id, money, purpose, way, remark, create_time, update_time, is_replace,wx_mer_pay_id,pay_status,pay_time
</sql> </sql>
<select id="getDonationRecordById" resultType="com.sien.common.vo.DonationRecordQueryVo"> <select id="getDonationRecordById" resultType="com.sien.common.vo.DonationRecordQueryVo">
select select
...@@ -19,13 +19,15 @@ ...@@ -19,13 +19,15 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from donation_record from donation_record
where pay_status=1
and fk_user_id=#{userId}
</select> </select>
<select id="getDonationRankAndTotal" resultType="com.sien.common.vo.DonationRankAndTotal"> <select id="getDonationRankAndTotal" resultType="com.sien.common.vo.DonationRankAndTotal">
SELECT SELECT
tb.*, tb.*,
@curRank := @curRank + 1 AS rank @curRank := @curRank + 1 AS rank
FROM FROM
( SELECT fk_user_id, sum( money ) AS drTotal FROM donation_record GROUP BY fk_user_id ORDER BY drTotal DESC ) AS tb, ( SELECT fk_user_id, sum( money ) AS drTotal FROM donation_record WHERE donation_record.pay_status = 1 GROUP BY fk_user_id ORDER BY drTotal DESC ) AS tb,
( SELECT @curRank := 0 ) r ( SELECT @curRank := 0 ) r
WHERE WHERE
fk_user_id = #{userId} fk_user_id = #{userId}
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, fk_user_id, fk_recharge_user, money, expired_at, years, vip_level, remark, create_time, update_time id, fk_user_id, fk_recharge_user, money, expired_at, years, vip_level, remark, create_time, update_time,wx_mer_pay_id,pay_status,pay_time
</sql> </sql>
<select id="getVipRecordById" resultType="com.sien.common.vo.VipRecordQueryVo"> <select id="getVipRecordById" resultType="com.sien.common.vo.VipRecordQueryVo">
select select
......
...@@ -195,6 +195,9 @@ spring-boot-plus: ...@@ -195,6 +195,9 @@ spring-boot-plus:
# - /actuator/** # - /actuator/**
- # 排除首页 - # 排除首页
- /,/index.html - /,/index.html
# 微信支付回调
- /pay/notify/donationOrder
- /pay/notify/vipOrder
# 多行字符串权限配置 # 多行字符串权限配置
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment