update encourage money head img

master
kira 6 years ago
parent b4123e7f3f
commit bb45fc0483

@ -30,4 +30,6 @@ public interface EncourageService {
JSONObject listReceiveLogs(String eventId, ReceiveLogQueryBean query); JSONObject listReceiveLogs(String eventId, ReceiveLogQueryBean query);
JSONObject listUseLogs(String eventId, int page, int limit); JSONObject listUseLogs(String eventId, int page, int limit);
void prepareUserInfo(JSONObject user, String user_id);
} }

@ -1,32 +1,7 @@
package au.com.royalpay.payment.manage.customers.core.impls; package au.com.royalpay.payment.manage.customers.core.impls;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig; import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig;
import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment; import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment;
import au.com.royalpay.payment.manage.mappers.system.ManagerCustomerRelationAlipayMapper;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import au.com.royalpay.payment.core.TransactionService; import au.com.royalpay.payment.core.TransactionService;
import au.com.royalpay.payment.manage.customers.beans.EncourageEventParameters; import au.com.royalpay.payment.manage.customers.beans.EncourageEventParameters;
import au.com.royalpay.payment.manage.customers.beans.ReceiveLogQueryBean; import au.com.royalpay.payment.manage.customers.beans.ReceiveLogQueryBean;
@ -37,13 +12,38 @@ import au.com.royalpay.payment.manage.mappers.customers.CustomerEncourageMoneyUs
import au.com.royalpay.payment.manage.mappers.customers.CustomerMembershipMapper; import au.com.royalpay.payment.manage.mappers.customers.CustomerMembershipMapper;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper; import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerCustomerRelationAlipayMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper; import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
/** /**
* Created by yixian on 2017-04-24. * Created by yixian on 2017-04-24.
*/ */
@ -168,8 +168,8 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
logger.debug("超出领取次数"); logger.debug("超出领取次数");
return new JSONObject(); return new JSONObject();
} }
int rand = RandomUtils int rand = RandomUtils.nextInt(0,
.nextInt(0,config.getBigDecimal("max_amount").subtract(config.getBigDecimal("min_amount")).multiply(CommonConsts.HUNDRED).intValue()); config.getBigDecimal("max_amount").subtract(config.getBigDecimal("min_amount")).multiply(CommonConsts.HUNDRED).intValue());
BigDecimal amount = config.getBigDecimal("min_amount").add(BigDecimal.valueOf(rand).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_DOWN)); BigDecimal amount = config.getBigDecimal("min_amount").add(BigDecimal.valueOf(rand).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_DOWN));
customerMembershipMapper.addEncourage(memberId, amount); customerMembershipMapper.addEncourage(memberId, amount);
JSONObject customer = customerMembershipMapper.findByMemberId(memberId); JSONObject customer = customerMembershipMapper.findByMemberId(memberId);
@ -329,4 +329,14 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
PageList<JSONObject> receiveLogs = customerEncourageMoneyUseLogMapper.list(params, new PageBounds(page, limit, Order.formString("use_time.desc"))); PageList<JSONObject> receiveLogs = customerEncourageMoneyUseLogMapper.list(params, new PageBounds(page, limit, Order.formString("use_time.desc")));
return PageListUtils.buildPageListResult(receiveLogs); return PageListUtils.buildPageListResult(receiveLogs);
} }
@Override
public void prepareUserInfo(JSONObject user, String user_id) {
if ("wechat".equals(user.getString("channel"))) {
user.put("headimg", customerMapper.findCustomerByOpenId(user_id).getString("headimg"));
}
if ("alipay".equals(user.getString("channel"))) {
user.put("headimg", managerCustomerRelationAlipayMapper.findCustomerByUserId(user_id).getString("headimg"));
}
}
} }

@ -2,6 +2,7 @@ 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.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -27,8 +28,10 @@ public class EncourageMoneyController {
@Resource @Resource
private EncourageService encourageService; private EncourageService encourageService;
@RequestMapping(value = "/orders/{orderId}", method = RequestMethod.PUT) @RequestMapping(value = "/orders/{orderId}", method = RequestMethod.PUT)
public JSONObject takeEncourageMoney(@PathVariable String orderId,@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser,@ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) { public JSONObject takeEncourageMoney(@PathVariable String orderId, @ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser,
@ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) {
String user_id = ""; String user_id = "";
if (wxUser == null) { if (wxUser == null) {
user_id = aliuser.getString("user_id"); user_id = aliuser.getString("user_id");
@ -47,17 +50,25 @@ public class EncourageMoneyController {
return encourageService.doubleEncourageMoney(orderId); return encourageService.doubleEncourageMoney(orderId);
} }
@RequestMapping(value = "/my", method = RequestMethod.GET) @WechatMapping(value = "/my", method = RequestMethod.GET)
public ModelAndView encourageLogs(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser, @ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) { 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); JSONObject user = new JSONObject();
String user_id = ""; String user_id = "";
if (wxUser == null) { if (wxUser == null) {
user.put("headimg", aliuser.getString("avatar"));
user.put("channel","alipay");
user_id = aliuser.getString("user_id"); user_id = aliuser.getString("user_id");
} else { } else {
user.put("headimg", wxUser.getString("headimgurl"));
user.put("channel","wechat");
user_id = wxUser.getString("openid"); user_id = wxUser.getString("openid");
} }
if(StringUtils.isEmpty(user.getString("headimg"))) {
encourageService.prepareUserInfo(user, user_id);
}
JSONObject balanceStatus = encourageService.getBalanceStatus(user_id); JSONObject balanceStatus = encourageService.getBalanceStatus(user_id);
mav.addObject("user", user);
mav.addObject("balance_status", balanceStatus); mav.addObject("balance_status", balanceStatus);
return mav; return mav;
} }

@ -68,9 +68,9 @@
鼓励金仅在活动期间有效,活动结束鼓励金自动清零。 鼓励金仅在活动期间有效,活动结束鼓励金自动清零。
</div> </div>
</div> </div>
<a class="merchants-link" href="/act/encourage_money/merchants"> <!--<a class="merchants-link" href="/act/encourage_money/merchants">-->
<span class="text">查看活动商家</span> <!--<span class="text">查看活动商家</span>-->
</a> <!--</a>-->
<div class="remark">本活动的最终解释权归RoyalPay所有</div> <div class="remark">本活动的最终解释权归RoyalPay所有</div>
</div> </div>
</body> </body>

@ -1,5 +1,5 @@
<!doctype html> <!doctype html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0"> <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
@ -19,6 +19,9 @@
</head> </head>
<body> <body>
<div class="main-container"> <div class="main-container">
<div class="banner">
<img class="head-box" data-th-src="@{${user['headimg']}}">
</div>
<div class="desc">活动期间任意消费满10澳币获随机鼓励金</div> <div class="desc">活动期间任意消费满10澳币获随机鼓励金</div>
<div class="detail-box"> <div class="detail-box">
<div class="detail-heading"> <div class="detail-heading">

Loading…
Cancel
Save