Commit 4df50558 by chongli

修复重复注册问题;微信退款通知调整

parent d1732c0b
......@@ -46,8 +46,8 @@ public abstract class AbstractNotifyController {
@ResponseBody
@RequestMapping(value = "/weiXinRefoundNotifyUrl", method = RequestMethod.POST)
public String weiXinRefoundNotifyUrl(@RequestBody String xml) throws Exception {
return this.getNotifyService().notifyForWeiXinRefound(xml);
public String weiXinRefoundNotify(@RequestBody String xml) throws Exception {
return this.getNotifyService().weiXinRefoundNotify(xml);
}
}
......@@ -34,6 +34,8 @@ import com.ctrip.fun.golf.domain.integral.UserMemberIntegralLog;
import com.ctrip.fun.golf.domain.order.Invoiceinfo;
import com.ctrip.fun.golf.domain.order.Order;
import com.ctrip.fun.golf.domain.order.OrderProcessLog;
import com.ctrip.fun.golf.domain.payment.AESUtil;
import com.ctrip.fun.golf.domain.payment.Configure;
import com.ctrip.fun.golf.domain.payment.PaymentResult;
import com.ctrip.fun.golf.domain.payment.WXUtil;
import com.ctrip.fun.golf.exceptions.OrderException;
......@@ -124,47 +126,6 @@ public abstract class AbstractNotifyService extends CorePaymentService {
logger.info("sign=" + notifyResponseBean.getSign());
return notifyResponseBean;
}
public String weiXinRefoundNotifyUrl(String xml) throws Exception{
System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
System.out.println(xml);
Map<String,Object> notifyMap = WXUtil.doXMLParse(xml);
if(notifyMap.get("return_code").equals("SUCCESS")){
String orderNo = notifyMap.get("out_trade_no").toString();//商户订单号
int settlement_refund_fee = (Integer)notifyMap.get("settlement_refund_fee");//实际退款金额*100
Order order = this.orderDao.getAndLockOrderByOrderNo(Long.parseLong(orderNo));
BigDecimal bigDecimal = new BigDecimal(settlement_refund_fee);
NotifyRequestBean notifyRequestBean = new NotifyRequestBean();
notifyRequestBean.setAmount(bigDecimal.divide(new BigDecimal("100"),2));
order.setProcessStatus(order.getProcessStatus()
| OrderStatusBitEnum.REFUNDED.getValue());
order.setOrderStatus("U");
order.setProcessStatus(order.getProcessStatus()
| OrderStatusBitEnum.UNSUBSCRIBED.getValue());
if (this.isAllRefund(notifyRequestBean, order)) {
order.setProcessStatus(order.getProcessStatus()
| OrderStatusBitEnum.ALL_UNSUBSCRIBED.getValue());
order.setProcessStatus(order.getProcessStatus()
| OrderStatusBitEnum.BARGAINED.getValue());
updateEventCustomersInvalid(order.getOrderId());
order.setOrderUserStatus(6);
} else {
order.setProcessStatus(order.getProcessStatus()
| OrderStatusBitEnum.PART_UNSUBSCRIBED.getValue());
order.setOrderUserStatus(6);
}
BigDecimal oldRefundAmount = BigDecimal.ZERO;
if (order.getRefundAmount() != null) {
oldRefundAmount = oldRefundAmount.add(order.getRefundAmount());
}
order.setRefundAmount(oldRefundAmount.add(notifyRequestBean.getAmount()));
this.doSuccessRefund(order);
}
return xml;
}
public String notifyForWeiXinPay(String xml) throws Exception{
Map<String,Object> notifyMap = WXUtil.doXMLParse(xml);
if(notifyMap.get("return_code").equals("SUCCESS")){
......@@ -207,10 +168,43 @@ public abstract class AbstractNotifyService extends CorePaymentService {
public String notifyForWeiXinRefound(String xml) throws Exception{
logger.error("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
logger.error(xml);
public String weiXinRefoundNotify(String xml) throws Exception{
Map<String,Object> notifyMap = WXUtil.doXMLParse(xml);
if(notifyMap.get("return_code").equals("SUCCESS")){
Map<String,Object> reqInfoMap = WXUtil.doXMLParse(AESUtil.getRefundDecrypt(notifyMap.get("req_info").toString(), Configure.getKey()));
String orderNo = reqInfoMap.get("out_trade_no").toString();//商户订单号
int settlement_refund_fee = (Integer)reqInfoMap.get("settlement_refund_fee");//实际退款金额*100
Order order = this.orderDao.getAndLockOrderByOrderNo(Long.parseLong(orderNo));
BigDecimal bigDecimal = new BigDecimal(settlement_refund_fee);
NotifyRequestBean notifyRequestBean = new NotifyRequestBean();
notifyRequestBean.setAmount(bigDecimal.divide(new BigDecimal("100"),2));
order.setProcessStatus(order.getProcessStatus()
| OrderStatusBitEnum.REFUNDED.getValue());
order.setOrderStatus("U");
order.setProcessStatus(order.getProcessStatus()
| OrderStatusBitEnum.UNSUBSCRIBED.getValue());
if (this.isAllRefund(notifyRequestBean, order)) {
order.setProcessStatus(order.getProcessStatus()
| OrderStatusBitEnum.ALL_UNSUBSCRIBED.getValue());
order.setProcessStatus(order.getProcessStatus()
| OrderStatusBitEnum.BARGAINED.getValue());
updateEventCustomersInvalid(order.getOrderId());
order.setOrderUserStatus(6);
} else {
order.setProcessStatus(order.getProcessStatus()
| OrderStatusBitEnum.PART_UNSUBSCRIBED.getValue());
order.setOrderUserStatus(6);
}
BigDecimal oldRefundAmount = BigDecimal.ZERO;
if (order.getRefundAmount() != null) {
oldRefundAmount = oldRefundAmount.add(order.getRefundAmount());
}
order.setRefundAmount(oldRefundAmount.add(notifyRequestBean.getAmount()));
this.doSuccessRefund(order);
}
return null;
}
......
......@@ -1054,9 +1054,9 @@ public class UserService {
userExt.setHandicap(23);
if (checkValidMobileNo(request.getMobilePhone())) {
try {
UserPhoneBean userPhoneBean = this.getCity(request.getMobilePhone());
userExt.setCity(userPhoneBean.getCity());
userExt.setProvince(userPhoneBean.getProvince());
//UserPhoneBean userPhoneBean = this.getCity(request.getMobilePhone());
userExt.setCity("其它");
userExt.setProvince("其它");
} catch (Exception e) {
logger.error(e.getMessage());
}
......
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 sign in to comment