1修改企业退款接口
This commit is contained in:
parent
2bd7a84f9e
commit
90d0c7457b
@ -1,18 +1,16 @@
|
||||
package com.xhpc.payment.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xhpc.common.core.constant.HttpStatus;
|
||||
import com.xhpc.common.core.listener.ConfigListener;
|
||||
import com.xhpc.common.core.utils.DateUtils;
|
||||
import com.xhpc.common.core.utils.HttpUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.utils.WXPayUtil;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.payment.domain.XhpcInternetUser;
|
||||
import com.xhpc.payment.domain.XhpcAppUser;
|
||||
import com.xhpc.payment.domain.XhpcRechargeOrder;
|
||||
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
|
||||
import com.xhpc.payment.service.IXhpcRechargeOrderService;
|
||||
import com.xhpc.payment.service.IXhpcRefundOrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.http.HttpEntity;
|
||||
@ -26,7 +24,10 @@ import org.apache.http.ssl.SSLContexts;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.servlet.ServletInputStream;
|
||||
@ -59,6 +60,10 @@ public class WxPaymentController {
|
||||
@Autowired
|
||||
private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper;
|
||||
|
||||
@Autowired
|
||||
private IXhpcRefundOrderService iXhpcRefundOrderService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
|
||||
@ -86,7 +91,7 @@ public class WxPaymentController {
|
||||
return AjaxResult.error(HttpStatus.BAD_REQUEST, "充值金额不能为0");
|
||||
}
|
||||
//生成充值订单
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId, BigDecimal.valueOf(amount1), "1", orderNumber);
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId, BigDecimal.valueOf(Double.parseDouble(amount)), "1", orderNumber);
|
||||
//附加数据(否)
|
||||
String attach = attachYu(StringUtils.valueOf(xhpcRechargeOrder.getRechargeOrderId()), StringUtils.valueOf(amount), null, orderNumber);
|
||||
//商品描述(是)
|
||||
@ -346,11 +351,15 @@ public class WxPaymentController {
|
||||
//修改充值订单状态
|
||||
iXhpcRechargeOrderService.updateRechargeOrder(xhpcRechargeOrder.getRechargeOrderId(), "1", "1", transaction_id);
|
||||
}
|
||||
//增加用户余额
|
||||
XhpcInternetUser xhpcInternetUser = new XhpcInternetUser();
|
||||
xhpcInternetUser.setInternetUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcInternetUser.setBalance(xhpcInternetUser.getBalance().add(xhpcRechargeOrder.getAmount()));
|
||||
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcInternetUser);
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(xhpcRechargeOrder.getUserId());
|
||||
if (StringUtils.isNotNull(appUserInfo)) {
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
//增加用户余额
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcAppUser.setBalance(BigDecimal.valueOf(Double.valueOf(balance)).add(xhpcRechargeOrder.getAmount()));
|
||||
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -424,24 +433,15 @@ public class WxPaymentController {
|
||||
@PostMapping("/enterpriseCheckOut")
|
||||
@ApiOperation(value = "企业退款")
|
||||
public Object enterpriseCheckOut(@RequestBody Map<String, Object> map) {
|
||||
String openid = StringUtils.valueOf(map.get("openid"));
|
||||
if (StringUtils.isNull(openid)) {
|
||||
return AjaxResult.error(HttpStatus.BAD_REQUEST, "openid不能为空");
|
||||
//用户信息id
|
||||
String refundOrderId = StringUtils.valueOf(map.get("refundOrderId"));
|
||||
if (StringUtils.isNull(refundOrderId)) {
|
||||
return AjaxResult.error(HttpStatus.BAD_REQUEST, "订单信息不能为空");
|
||||
}
|
||||
//总金额(是)订单总金额,单位为分
|
||||
String amount = StringUtils.valueOf(map.get("amount"));
|
||||
if (StringUtils.isNull(amount)) {
|
||||
return AjaxResult.error(HttpStatus.BAD_REQUEST, "充值金额不能为空");
|
||||
Map<String, Object> xhpcRefundOrder = iXhpcRefundOrderService.info(Long.parseLong(refundOrderId));
|
||||
if (StringUtils.isNull(xhpcRefundOrder)) {
|
||||
return AjaxResult.error("订单不存在");
|
||||
}
|
||||
String reason = "退款申请";
|
||||
return enterpriseOut(Double.parseDouble(amount), openid, reason);
|
||||
}
|
||||
|
||||
|
||||
public Object enterpriseOut(double amount, String openid, String reason) {
|
||||
//生成退款订单
|
||||
//OrderVO orderInfo = orderService.selectOrderNumber(orderNumber);
|
||||
String orderOutNumber = "wxOut" + DateUtils.timePath();
|
||||
CloseableHttpClient httpClient = null;
|
||||
try {
|
||||
//证书的地址
|
||||
@ -451,16 +451,19 @@ public class WxPaymentController {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
String orderOutNumber = StringUtils.valueOf(xhpcRefundOrder.get("refundOrderNumber"));
|
||||
String openId = StringUtils.valueOf(xhpcRefundOrder.get("openId"));
|
||||
Double amount = Double.parseDouble(StringUtils.valueOf(xhpcRefundOrder.get("amount")));
|
||||
//退款金额单位为分
|
||||
Double value = amount * 100;
|
||||
Integer refund_fee = value.intValue();
|
||||
if (refund_fee <= 0) {
|
||||
return "订单金额出错";
|
||||
}
|
||||
|
||||
String result = "";
|
||||
HttpPost httpPost = new HttpPost("https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers");
|
||||
AjaxResult successResponseData = new AjaxResult();
|
||||
StringEntity postEntity = new StringEntity(creatXMLParam(orderOutNumber, refund_fee.toString(), reason, openid), "UTF-8");
|
||||
HttpPost httpPost = new HttpPost(environment.getProperty("WXTRANSFERS"));
|
||||
StringEntity postEntity = new StringEntity(creatXMLParam(orderOutNumber, refund_fee.toString(), "退款申请", openId), "UTF-8");
|
||||
httpPost.addHeader("Content-Type", "text/xml");
|
||||
httpPost.setEntity(postEntity);
|
||||
try {
|
||||
@ -479,7 +482,7 @@ public class WxPaymentController {
|
||||
} finally {
|
||||
httpPost.abort();
|
||||
}
|
||||
return parseXml(result, successResponseData, "orderId", amount);
|
||||
return parseXml(result, Long.parseLong(refundOrderId), amount);
|
||||
}
|
||||
|
||||
|
||||
@ -562,47 +565,24 @@ public class WxPaymentController {
|
||||
/**
|
||||
* 解析xml字符串
|
||||
*
|
||||
* @param result 请求后的结果
|
||||
* @param jsonObject json对象
|
||||
* @param result 请求后的结果
|
||||
* @return
|
||||
*/
|
||||
private AjaxResult parseXml(String result, AjaxResult jsonObject, String id, Double amount) {
|
||||
private AjaxResult parseXml(String result, Long id, Double amount) {
|
||||
try {
|
||||
Map<String, String> map = WXPayUtil.xmlToMap(result);
|
||||
String return_code = map.get("return_code");
|
||||
if ("FAIL".equals(return_code)) {
|
||||
jsonObject.error(map.get("return_msg"));
|
||||
return AjaxResult.error(map.get("return_msg"));
|
||||
} else {
|
||||
//退款成功修改订单
|
||||
//orderService.checkOut(id, amount);
|
||||
jsonObject.success(map);
|
||||
iXhpcRefundOrderService.updateRefundOrder(id, "1", "1");
|
||||
return AjaxResult.success(map);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
jsonObject.error(e.getMessage());
|
||||
AjaxResult.error(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@GetMapping("/payment1")
|
||||
@ApiOperation(value = "微信支付")
|
||||
public AjaxResult payment1() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
JSONObject amount = new JSONObject();
|
||||
JSONObject payer = new JSONObject();
|
||||
String orderNumber = "wx" + DateUtils.timePath();
|
||||
jsonObject.put("mchid", environment.getProperty("MCHID"));
|
||||
jsonObject.put("out_trade_no", orderNumber);
|
||||
jsonObject.put("appid", environment.getProperty("APPID"));
|
||||
jsonObject.put("description", "微信支付");
|
||||
jsonObject.put("notify_url", environment.getProperty("SERVERDOMAIN"));
|
||||
amount.put("total", 1);
|
||||
amount.put("currency", "CNY");
|
||||
jsonObject.put("amount", amount);
|
||||
payer.put("openid", "ot6ul4rpKdrLdeu8EgXNiQyxV-yU");
|
||||
jsonObject.put("payer", payer);
|
||||
String result = HttpUtils.postBody("https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi", jsonObject);
|
||||
JSONObject json = JSON.parseObject(result);
|
||||
return AjaxResult.success(json);
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
package com.xhpc.payment.controller;
|
||||
|
||||
import com.xhpc.common.core.constant.HttpStatus;
|
||||
import com.xhpc.common.core.utils.DateUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
@ -7,11 +10,9 @@ import com.xhpc.payment.service.IXhpcRefundOrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -23,6 +24,38 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
@Autowired
|
||||
private IXhpcRefundOrderService iXhpcRefundOrderService;
|
||||
|
||||
/**
|
||||
* 退款
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/checkOut")
|
||||
@ApiOperation(value = "退款")
|
||||
public AjaxResult enterpriseCheckOut(@RequestBody Map<String, Object> map) {
|
||||
String amount = StringUtils.valueOf(map.get("amount"));
|
||||
if (StringUtils.isNull(amount)) {
|
||||
return AjaxResult.error(HttpStatus.BAD_REQUEST, "充值金额不能为空");
|
||||
}
|
||||
//用户信息id
|
||||
String userId = StringUtils.valueOf(map.get("userId"));
|
||||
if (StringUtils.isNull(userId)) {
|
||||
return AjaxResult.error(HttpStatus.BAD_REQUEST, "用户信息不能为空");
|
||||
}
|
||||
//openid
|
||||
String openid = StringUtils.valueOf(map.get("openid"));
|
||||
if (StringUtils.isNull(userId)) {
|
||||
return AjaxResult.error(HttpStatus.BAD_REQUEST, "用户信息不能为空");
|
||||
}
|
||||
String type = StringUtils.valueOf(map.get("type"));
|
||||
if (StringUtils.isNull(type)) {
|
||||
return AjaxResult.error(HttpStatus.BAD_REQUEST, "退款渠道不能为空");
|
||||
}
|
||||
//生成退款订单
|
||||
String orderOutNumber = "wxOut" + DateUtils.timePath();
|
||||
iXhpcRefundOrderService.addRefundOrder(userId, BigDecimal.valueOf(Double.parseDouble(amount)), type, orderOutNumber, openid);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款订单详情
|
||||
*
|
||||
|
||||
@ -0,0 +1,162 @@
|
||||
package com.xhpc.payment.domain;
|
||||
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* C端用户 xhpc_app_user
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class XhpcAppUser extends BaseEntity {
|
||||
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long appUserId;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
@Length(max = 11, message = "手机号码不能超过11位")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* weixin_open_id
|
||||
*/
|
||||
@Length(max = 50, message = "openId不能超过50位")
|
||||
private String weixinOpenId;
|
||||
|
||||
/**
|
||||
* alipay_open_id
|
||||
*/
|
||||
@Length(max = 50, message = "openId不能超过50位")
|
||||
private String alipayOpenId;
|
||||
|
||||
/**
|
||||
* 微信是否登录(0未登录 1已登录)
|
||||
*/
|
||||
private Integer weixinLogin;
|
||||
|
||||
/**
|
||||
* 支付宝是否登录(0未登录 1已登录)
|
||||
*/
|
||||
private Integer alipayLogin;
|
||||
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 余额
|
||||
*/
|
||||
private BigDecimal balance;
|
||||
|
||||
/**
|
||||
* 密码(加密)
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 帐号状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
public Long getAppUserId() {
|
||||
return appUserId;
|
||||
}
|
||||
|
||||
public void setAppUserId(Long appUserId) {
|
||||
this.appUserId = appUserId;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getWeixinOpenId() {
|
||||
return weixinOpenId;
|
||||
}
|
||||
|
||||
public void setWeixinOpenId(String weixinOpenId) {
|
||||
this.weixinOpenId = weixinOpenId;
|
||||
}
|
||||
|
||||
public String getAlipayOpenId() {
|
||||
return alipayOpenId;
|
||||
}
|
||||
|
||||
public void setAlipayOpenId(String alipayOpenId) {
|
||||
this.alipayOpenId = alipayOpenId;
|
||||
}
|
||||
|
||||
public Integer getWeixinLogin() {
|
||||
return weixinLogin;
|
||||
}
|
||||
|
||||
public void setWeixinLogin(Integer weixinLogin) {
|
||||
this.weixinLogin = weixinLogin;
|
||||
}
|
||||
|
||||
public Integer getAlipayLogin() {
|
||||
return alipayLogin;
|
||||
}
|
||||
|
||||
public void setAlipayLogin(Integer alipayLogin) {
|
||||
this.alipayLogin = alipayLogin;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public BigDecimal getBalance() {
|
||||
return balance;
|
||||
}
|
||||
|
||||
public void setBalance(BigDecimal balance) {
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
}
|
||||
@ -1,286 +0,0 @@
|
||||
package com.xhpc.payment.domain;
|
||||
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 流量用户 xhpc_internet_user
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class XhpcInternetUser extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long internetUserId;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@NotBlank(message = "名称不能为空")
|
||||
@Length(max = 12, message = "名称不能超过12位")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 手机号码(帐号)
|
||||
*/
|
||||
@NotBlank(message = "手机号码不能为空")
|
||||
@Length(max = 11, message = "手机号码不能超过11位")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
@NotBlank(message = "联系人不能为空")
|
||||
@Length(max = 12, message = "联系人不能超过12位")
|
||||
private String contactName;
|
||||
|
||||
/**
|
||||
* 联系人电话
|
||||
*/
|
||||
@NotBlank(message = "联系人电话不能为空")
|
||||
@Length(max = 11, message = "联系人电话不能超过11位")
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 开户行
|
||||
*/
|
||||
@NotBlank(message = "开户行不能为空")
|
||||
@Length(max = 20, message = "开户行电话不能超过20位")
|
||||
private String openBank;
|
||||
|
||||
/**
|
||||
* 卡号
|
||||
*/
|
||||
@NotNull(message = "卡号不能为空")
|
||||
@Length(max = 20, message = "卡号不能超过20位")
|
||||
private String cardNumber;
|
||||
|
||||
/**
|
||||
* 合作开始时间
|
||||
*/
|
||||
private Date cooperationStartTime;
|
||||
|
||||
/**
|
||||
* 合作结束时间
|
||||
*/
|
||||
private Date cooperationEndTime;
|
||||
|
||||
/**
|
||||
* 余额
|
||||
*/
|
||||
private BigDecimal balance;
|
||||
|
||||
/**
|
||||
* 地址code
|
||||
*/
|
||||
@NotNull(message = "地址不能为空")
|
||||
private Integer areaCode;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
@NotBlank(message = "地址不能为空")
|
||||
@Length(max = 50, message = "地址不能超过50位")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
@NotBlank(message = "详细地址不能为空")
|
||||
@Length(max = 50, message = "详细地址不能超过50位")
|
||||
private String detailedAddress;
|
||||
|
||||
/**
|
||||
* 提成类型(0总金额提成 1服务费提成)
|
||||
*/
|
||||
@NotNull(message = "提成类型不能为空")
|
||||
private Integer commissionType;
|
||||
|
||||
/**
|
||||
* 提成率
|
||||
*/
|
||||
@NotNull(message = "提成率不能为空")
|
||||
private Double commissionRate;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@NotBlank(message = "经度不能为空")
|
||||
private String longitude;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
@NotBlank(message = "纬度不能为空")
|
||||
private String latitude;
|
||||
|
||||
/**
|
||||
* 帐号状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
public Long getInternetUserId() {
|
||||
return internetUserId;
|
||||
}
|
||||
|
||||
public void setInternetUserId(Long internetUserId) {
|
||||
this.internetUserId = internetUserId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getContactName() {
|
||||
return contactName;
|
||||
}
|
||||
|
||||
public void setContactName(String contactName) {
|
||||
this.contactName = contactName;
|
||||
}
|
||||
|
||||
public String getContactPhone() {
|
||||
return contactPhone;
|
||||
}
|
||||
|
||||
public void setContactPhone(String contactPhone) {
|
||||
this.contactPhone = contactPhone;
|
||||
}
|
||||
|
||||
public String getOpenBank() {
|
||||
return openBank;
|
||||
}
|
||||
|
||||
public void setOpenBank(String openBank) {
|
||||
this.openBank = openBank;
|
||||
}
|
||||
|
||||
public String getCardNumber() {
|
||||
return cardNumber;
|
||||
}
|
||||
|
||||
public void setCardNumber(String cardNumber) {
|
||||
this.cardNumber = cardNumber;
|
||||
}
|
||||
|
||||
public Date getCooperationStartTime() {
|
||||
return cooperationStartTime;
|
||||
}
|
||||
|
||||
public void setCooperationStartTime(Date cooperationStartTime) {
|
||||
this.cooperationStartTime = cooperationStartTime;
|
||||
}
|
||||
|
||||
public Date getCooperationEndTime() {
|
||||
return cooperationEndTime;
|
||||
}
|
||||
|
||||
public void setCooperationEndTime(Date cooperationEndTime) {
|
||||
this.cooperationEndTime = cooperationEndTime;
|
||||
}
|
||||
|
||||
public BigDecimal getBalance() {
|
||||
return balance;
|
||||
}
|
||||
|
||||
public void setBalance(BigDecimal balance) {
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
public Integer getAreaCode() {
|
||||
return areaCode;
|
||||
}
|
||||
|
||||
public void setAreaCode(Integer areaCode) {
|
||||
this.areaCode = areaCode;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getDetailedAddress() {
|
||||
return detailedAddress;
|
||||
}
|
||||
|
||||
public void setDetailedAddress(String detailedAddress) {
|
||||
this.detailedAddress = detailedAddress;
|
||||
}
|
||||
|
||||
public Integer getCommissionType() {
|
||||
return commissionType;
|
||||
}
|
||||
|
||||
public void setCommissionType(Integer commissionType) {
|
||||
this.commissionType = commissionType;
|
||||
}
|
||||
|
||||
public Double getCommissionRate() {
|
||||
return commissionRate;
|
||||
}
|
||||
|
||||
public void setCommissionRate(Double commissionRate) {
|
||||
this.commissionRate = commissionRate;
|
||||
}
|
||||
|
||||
public String getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(String longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public String getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(String latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
}
|
||||
@ -31,12 +31,12 @@ public class XhpcRefundOrder extends BaseEntity {
|
||||
/**
|
||||
* 微信支付订单号
|
||||
*/
|
||||
private String prepayId;
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
* 支付宝订单编号
|
||||
*/
|
||||
private String alipayNumber;
|
||||
private String alipayId;
|
||||
|
||||
/**
|
||||
* 充值金额
|
||||
@ -87,20 +87,20 @@ public class XhpcRefundOrder extends BaseEntity {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getPrepayId() {
|
||||
return prepayId;
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
|
||||
public void setPrepayId(String prepayId) {
|
||||
this.prepayId = prepayId;
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
|
||||
public String getAlipayNumber() {
|
||||
return alipayNumber;
|
||||
public String getAlipayId() {
|
||||
return alipayId;
|
||||
}
|
||||
|
||||
public void setAlipayNumber(String alipayNumber) {
|
||||
this.alipayNumber = alipayNumber;
|
||||
public void setAlipayId(String alipayId) {
|
||||
this.alipayId = alipayId;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.xhpc.payment.mapper;
|
||||
|
||||
import com.xhpc.payment.domain.XhpcInternetUser;
|
||||
import com.xhpc.payment.domain.XhpcAppUser;
|
||||
import com.xhpc.payment.domain.XhpcUserAccountStatement;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -42,8 +42,8 @@ public interface XhpcUserAccountStatementMapper {
|
||||
/**
|
||||
* 更新C端用户余额
|
||||
*
|
||||
* @param xhpcInternetUser C端用户
|
||||
* @param xhpcAppUser C端用户
|
||||
* @return
|
||||
*/
|
||||
public int updateAppUserBalance(XhpcInternetUser xhpcInternetUser);
|
||||
public int updateAppUserBalance(XhpcAppUser xhpcAppUser);
|
||||
}
|
||||
|
||||
@ -45,18 +45,18 @@ public interface IXhpcRefundOrderService {
|
||||
*
|
||||
* @param appUserId C端用户id
|
||||
* @param amount 充值金额
|
||||
* @param type 充值渠道(1微信 2支付宝)
|
||||
* @param type 退款渠道(1微信 2支付宝)
|
||||
* @return
|
||||
*/
|
||||
public XhpcRefundOrder addRefundOrder(String appUserId, BigDecimal amount, String type);
|
||||
public XhpcRefundOrder addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid);
|
||||
|
||||
/**
|
||||
* 修改订单状态 退款订单
|
||||
*
|
||||
* @param refundOrderId 退款订单id
|
||||
* @param status 状态(0待支付 1充值成功,2充值失败)
|
||||
* @param type 充值渠道(1微信 2支付宝)
|
||||
* @param type 退款渠道(1微信 2支付宝)
|
||||
* @return
|
||||
*/
|
||||
public void updateRefundOrder(Long refundOrderId, String type, String status, String paymentNumber);
|
||||
public void updateRefundOrder(Long refundOrderId, String type, String status);
|
||||
}
|
||||
@ -99,11 +99,11 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService {
|
||||
} else {
|
||||
xhpcRechargeOrder.setAlipayNumber(paymentNumber);
|
||||
}
|
||||
if ("1".equals(xhpcRechargeOrder.getStatus())) {
|
||||
if (1 == xhpcRechargeOrder.getStatus()) {
|
||||
Map<String, Object> map = xhpcRechargeOrderMapper.info(rechargeOrderId);
|
||||
String amount = StringUtils.valueOf(map.get("amount"));
|
||||
String userId = StringUtils.valueOf(map.get("userId"));
|
||||
xhpcUserAccountStatementService.add(rechargeOrderId, amount, userId, 1);
|
||||
xhpcUserAccountStatementService.add(rechargeOrderId, amount, userId, Integer.parseInt(type));
|
||||
}
|
||||
xhpcRechargeOrderMapper.update(xhpcRechargeOrder);
|
||||
}
|
||||
|
||||
@ -63,15 +63,21 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
*
|
||||
* @param appUserId C端用户id
|
||||
* @param amount 充值金额
|
||||
* @param type 充值渠道(1微信 2支付宝)
|
||||
* @param type 退款渠道(1微信 2支付宝)
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public XhpcRefundOrder addRefundOrder(String appUserId, BigDecimal amount, String type) {
|
||||
public XhpcRefundOrder addRefundOrder(String appUserId, BigDecimal amount, String type, String refundOrderNumber, String openid) {
|
||||
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
|
||||
xhpcRefundOrder.setUserId(Long.parseLong(appUserId));
|
||||
xhpcRefundOrder.setAmount(amount);
|
||||
xhpcRefundOrder.setRefundOrderNumber(refundOrderNumber);
|
||||
xhpcRefundOrder.setType(Integer.parseInt(type));
|
||||
if (1 == Integer.parseInt(type)) {
|
||||
xhpcRefundOrder.setOpenId(openid);
|
||||
} else {
|
||||
xhpcRefundOrder.setAlipayId(openid);
|
||||
}
|
||||
xhpcRefundOrderMapper.insert(xhpcRefundOrder);
|
||||
return xhpcRefundOrder;
|
||||
}
|
||||
@ -81,20 +87,14 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
*
|
||||
* @param refundOrderId 退款订单id
|
||||
* @param status 状态(0待支付 1充值成功,2充值失败)
|
||||
* @param type 充值渠道(1微信 2支付宝)
|
||||
* @param type 退款渠道(1微信 2支付宝)
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void updateRefundOrder(Long refundOrderId, String type, String status, String paymentNumber) {
|
||||
public void updateRefundOrder(Long refundOrderId, String type, String status) {
|
||||
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
|
||||
xhpcRefundOrder.setRefundOrderId(refundOrderId);
|
||||
xhpcRefundOrder.setStatus(Integer.parseInt(status));
|
||||
if ("1".equals(type)) {
|
||||
xhpcRefundOrder.setPrepayId(paymentNumber);
|
||||
} else {
|
||||
xhpcRefundOrder.setAlipayNumber(paymentNumber);
|
||||
}
|
||||
|
||||
xhpcRefundOrderMapper.update(xhpcRefundOrder);
|
||||
}
|
||||
}
|
||||
@ -43,6 +43,9 @@ KEY: "sichuanxianghuakejiyouxiangongsi"
|
||||
WXPAYUNIFIEDORDER: "https://api.mch.weixin.qq.com/pay/unifiedorder"
|
||||
#微信支付回调地址
|
||||
SERVERDOMAIN: "http://cdz.project2.tingsun.net/prod-api/xhpc-payment/wx/paymentCallback"
|
||||
#微信小程序支付地址
|
||||
WXTRANSFERS: "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"
|
||||
|
||||
#支付宝支付回调地址
|
||||
ALIPAYPSERVERDOMAIN: "https://cdz.project2.tingsun.net/alipay/paymentCallback"
|
||||
#支付宝公钥
|
||||
|
||||
@ -166,7 +166,7 @@
|
||||
ORDER BY xro.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="infoRechargeOrderNumber" parameterType="java.lang.Long" resultMap="XhpcRechargeOrderResult">
|
||||
<select id="infoRechargeOrderNumber" parameterType="java.lang.String" resultMap="XhpcRechargeOrderResult">
|
||||
select *
|
||||
from xhpc_recharge_order xro
|
||||
where xro.del_flag = 0 and xro.recharge_order_number = #{rechargeOrderNumber}
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
<result column="refund_order_id" property="refundOrderId"/>
|
||||
<result column="refund_order_number" property="refundOrderNumber"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="prepay_id" property="prepayId"/>
|
||||
<result column="alipay_number" property="alipayNumber"/>
|
||||
<result column="open_id" property="openId"/>
|
||||
<result column="alipay_id" property="alipayId"/>
|
||||
<result column="amount" property="amount"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="examine_status" property="examineStatus"/>
|
||||
@ -32,11 +32,11 @@
|
||||
<if test="null != userId and '' != userId">
|
||||
user_id,
|
||||
</if>
|
||||
<if test="null != prepayId and '' != prepayId">
|
||||
prepay_id,
|
||||
<if test="null != openId and '' != openId">
|
||||
open_id,
|
||||
</if>
|
||||
<if test="null != alipayNumber and '' != alipayNumber">
|
||||
alipay_number,
|
||||
<if test="null != alipayId and '' != alipayId">
|
||||
alipay_id,
|
||||
</if>
|
||||
<if test="null != amount and '' != amount">
|
||||
amount,
|
||||
@ -76,11 +76,11 @@
|
||||
<if test="null != userId and '' != userId">
|
||||
#{userId},
|
||||
</if>
|
||||
<if test="null != prepayId and '' != prepayId">
|
||||
#{prepayId},
|
||||
<if test="null != openId and '' != openId">
|
||||
#{openId},
|
||||
</if>
|
||||
<if test="null != alipayNumber and '' != alipayNumber">
|
||||
#{alipayNumber},
|
||||
<if test="null != alipayId and '' != alipayId">
|
||||
#{alipayId},
|
||||
</if>
|
||||
<if test="null != amount and '' != amount">
|
||||
#{amount},
|
||||
@ -122,8 +122,8 @@
|
||||
#{refundOrderNumber},
|
||||
</if>
|
||||
<if test="null != userId and '' != userId">user_id = #{userId},</if>
|
||||
<if test="null != prepayId and '' != prepayId">prepay_id = #{prepayId},</if>
|
||||
<if test="null != alipayNumber and '' != alipayNumber">alipay_number = #{alipayNumber},</if>
|
||||
<if test="null != openId and '' != openId">open_id = #{openId},</if>
|
||||
<if test="null != alipayId and '' != alipayId">alipay_id = #{alipayId},</if>
|
||||
<if test="null != amount ">amount = #{amount},</if>
|
||||
<if test="null != type ">type = #{type},</if>
|
||||
<if test="null != examineStatus ">examine_status = #{examineStatus},</if>
|
||||
@ -140,7 +140,7 @@
|
||||
|
||||
<select id="info" parameterType="java.lang.Long" resultType="java.util.Map">
|
||||
select xro.refund_order_id refundOrderId ,xro.refund_order_number refundOrderNumber,
|
||||
xro.alipay_number alipayNumber ,xro.prepay_id prepayid,xro.user_id userId,xro.amount,
|
||||
xro.alipay_id alipayId ,xro.open_id openId,xro.user_id userId,xro.amount,
|
||||
xro.type,xro.examine_status examineStatus,xro.`status`,xro.create_time createTime,xau.phone,
|
||||
sdd.dict_label statusName,sdds.dict_label examineStatusName
|
||||
from xhpc_refund_order xro
|
||||
@ -152,7 +152,7 @@
|
||||
|
||||
<select id="page" parameterType="java.lang.String" resultType="java.util.Map">
|
||||
select xro.refund_order_id refundOrderId ,xro.refund_order_number refundOrderNumber,
|
||||
xro.alipay_number alipayNumber ,xro.prepay_id prepayid,xro.user_id userId,xro.amount,
|
||||
xro.alipay_id alipayId ,xro.open_id openId,xro.user_id userId,xro.amount,
|
||||
xro.type,xro.examine_status examineStatus,xro.`status`,xro.create_time createTime,
|
||||
xau.phone,sdd.dict_label statusName,sdds.dict_label examineStatusName
|
||||
from xhpc_refund_order xro
|
||||
|
||||
@ -141,7 +141,7 @@
|
||||
WHERE del_flag = 0 and app_user_id = #{appUserId}
|
||||
</select>
|
||||
|
||||
<update id="updateAppUserBalance" parameterType="com.xhpc.payment.domain.XhpcInternetUser">
|
||||
<update id="updateAppUserBalance" parameterType="com.xhpc.payment.domain.XhpcAppUser">
|
||||
UPDATE xhpc_app_user
|
||||
<set>
|
||||
<if test="null != balance">balance = #{balance},</if>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user