Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java
master
eason 6 years ago
commit 7c064c70d8

@ -17,8 +17,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;

@ -3,9 +3,19 @@ package au.com.royalpay.payment.manage.customers.web;
import au.com.royalpay.payment.manage.customers.core.EncourageService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType;
import au.com.royalpay.payment.tools.permission.alipay.AlipayMapping;
import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
@ -13,38 +23,46 @@ import javax.annotation.Resource;
/**
* Created by yixian on 2017-04-28.
*/
@RestController
@Controller
@RequestMapping("/act/encourage_money")
public class EncourageMoneyController {
Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private EncourageService encourageService;
@RequestMapping(value = "/orders/{orderId}", method = RequestMethod.PUT)
public String takeEncourageMoney(@PathVariable String orderId,@RequestHeader("User-Agent") String ua) {
ua = ua.toLowerCase();
if (ua.contains("micromessenger")) {
return "redirect:/act/encourage_money/orders/" + orderId + "/wechat";
@RequestMapping(value = "/orders/{orderId}", method = RequestMethod.GET)
public JSONObject takeEncourageMoney(@PathVariable String orderId,@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser,@ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) {
String user_id = "";
if(wxUser==null){
user_id = aliuser.getString("user_id");
}else {
user_id = wxUser.getString("openid");
}
if (ua.contains("alipayclient")) {
return "redirect:/act/encourage_money/orders/" + orderId + "/alipay";
if(StringUtils.isEmpty(user_id)){
return new JSONObject();
}
return null;
return encourageService.takeEncourageMoney(orderId, user_id);
}
@RequestMapping(value = "/orders/{orderId}/wechat", method = RequestMethod.PUT)
@RequestMapping(value = "/orders/{orderId}/wechat", method = RequestMethod.GET)
public JSONObject takeEncourageMoneyWeChat(@PathVariable String orderId, @ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser) {
logger.info("kiratest---wechat");
if (wxUser == null) {
return new JSONObject();
}
logger.info(wxUser.toJSONString());
return encourageService.takeEncourageMoney(orderId, wxUser.getString("openid"));
}
@RequestMapping(value = "/orders/{orderId}/alipay", method = RequestMethod.PUT)
@AlipayMapping(value = "/orders/{orderId}/alipay", method = RequestMethod.GET)
public JSONObject takeEncourageMoneyAlipay(@PathVariable String orderId, @ModelAttribute(CommonConsts.ALIUSER) JSONObject alipayInfo) {
logger.info("kiratest---alipay");
if (alipayInfo == null) {
return new JSONObject();
}
logger.info(alipayInfo.toJSONString());
return encourageService.takeEncourageMoney(orderId, alipayInfo.getString("user_id"));
}

@ -33,7 +33,7 @@ $(function () {
function loadEncourage() {
$.ajax({
url: '/act/encourage_money/orders/' + window.order_id,
method: 'PUT',
method: 'GET',
dataType: 'json',
success: function (encourage) {
if (encourage.access_amount) {

Loading…
Cancel
Save