encourage money

master
kira 6 years ago
parent 4f596ec1d3
commit de82418d70

@ -2,10 +2,17 @@ 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.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.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.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
@ -16,15 +23,22 @@ import javax.annotation.Resource;
@RestController
@RequestMapping("/act/encourage_money")
public class EncourageMoneyController {
Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private EncourageService encourageService;
@RequestMapping(value = "/orders/{orderId}", method = RequestMethod.PUT)
public JSONObject takeEncourageMoney(@PathVariable String orderId, @ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser) {
if (wxUser == null) {
@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(StringUtils.isEmpty(user_id)){
return new JSONObject();
}
return encourageService.takeEncourageMoney(orderId, wxUser.getString("openid"));
return encourageService.takeEncourageMoney(orderId, user_id);
}
@RequestMapping(value = "/orders/{orderId}/crit", method = RequestMethod.PUT)
@ -32,21 +46,27 @@ public class EncourageMoneyController {
return encourageService.doubleEncourageMoney(orderId);
}
@WechatMapping(value = "/my", method = RequestMethod.GET, oauthType = WxOauthType.USERINFO)
public ModelAndView encourageLogs(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser) {
@RequestMapping(value = "/my", method = RequestMethod.GET)
public ModelAndView encourageLogs(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser,@ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) {
ModelAndView mav = new ModelAndView("activity/encourage_money/my");
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);
return mav;
}
@WechatMapping(value = "/desc",method = RequestMethod.GET)
@RequestMapping(value = "/desc",method = RequestMethod.GET)
public ModelAndView descPage(){
return new ModelAndView("activity/encourage_money/desc");
}
@WechatMapping(value = "/merchants",method = RequestMethod.GET)
@RequestMapping(value = "/merchants",method = RequestMethod.GET)
public ModelAndView merchantsPage(){
return new ModelAndView("activity/encourage_money/merchants");
}

Loading…
Cancel
Save