master
kira 6 years ago
parent ed032015bc
commit b69737a554

@ -3,7 +3,6 @@ package au.com.royalpay.payment.manage.customers.web;
import au.com.royalpay.payment.manage.customers.core.EncourageService; import au.com.royalpay.payment.manage.customers.core.EncourageService;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType; 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 au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -11,7 +10,6 @@ import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -45,48 +43,32 @@ public class EncourageMoneyController {
return encourageService.takeEncourageMoney(orderId, user_id); return encourageService.takeEncourageMoney(orderId, user_id);
} }
@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"));
}
@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"));
}
@RequestMapping(value = "/orders/{orderId}/crit", method = RequestMethod.PUT) @RequestMapping(value = "/orders/{orderId}/crit", method = RequestMethod.PUT)
public JSONObject takeEncourageMoneyCrit(@PathVariable String orderId) { public JSONObject takeEncourageMoneyCrit(@PathVariable String orderId) {
return encourageService.doubleEncourageMoney(orderId); return encourageService.doubleEncourageMoney(orderId);
} }
@WechatMapping(value = "/my", method = RequestMethod.GET, oauthType = WxOauthType.USERINFO) @RequestMapping(value = "/my", method = RequestMethod.GET)
public ModelAndView encourageLogs(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser) { public ModelAndView encourageLogs(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser,@ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) {
ModelAndView mav = new ModelAndView("activity/encourage_money/my"); ModelAndView mav = new ModelAndView("activity/encourage_money/my");
mav.addObject("wxUser", wxUser); mav.addObject("wxUser", wxUser);
JSONObject balanceStatus = encourageService.getBalanceStatus(wxUser.getString("openid")); String user_id = "";
if(wxUser==null){
user_id = aliuser.getString("user_id");
}else {
user_id = wxUser.getString("openid");
}
JSONObject balanceStatus = encourageService.getBalanceStatus(user_id);
mav.addObject("balance_status", balanceStatus); mav.addObject("balance_status", balanceStatus);
return mav; return mav;
} }
@WechatMapping(value = "/desc",method = RequestMethod.GET) @RequestMapping(value = "/desc",method = RequestMethod.GET)
public ModelAndView descPage(){ public ModelAndView descPage(){
return new ModelAndView("activity/encourage_money/desc"); return new ModelAndView("activity/encourage_money/desc");
} }
@WechatMapping(value = "/merchants",method = RequestMethod.GET) @RequestMapping(value = "/merchants",method = RequestMethod.GET)
public ModelAndView merchantsPage(){ public ModelAndView merchantsPage(){
return new ModelAndView("activity/encourage_money/merchants"); return new ModelAndView("activity/encourage_money/merchants");
} }

Loading…
Cancel
Save