|
|
|
@ -2,6 +2,8 @@ package au.com.royalpay.payment.manage.customers.core.impls;
|
|
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.customers.core.CouponValidateService;
|
|
|
|
|
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.system.CustomerMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
|
|
|
|
@ -51,6 +53,12 @@ public class CouponValidateServiceImpl implements CouponValidateService {
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientManager clientManager;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private OrderMapper orderMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private CustomerMapper customerMapper;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getCoupon(JSONObject partner,int page,int limit) {
|
|
|
|
|
String timestamp = System.currentTimeMillis() + "";
|
|
|
|
@ -217,6 +225,45 @@ public class CouponValidateServiceImpl implements CouponValidateService {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getHalloweenOrderInfo(String customerId, String transactionDate) {
|
|
|
|
|
|
|
|
|
|
JSONObject param = new JSONObject();
|
|
|
|
|
param.put("customer_id", customerId);
|
|
|
|
|
param.put("transaction_date", transactionDate);
|
|
|
|
|
param.put("status", 5);
|
|
|
|
|
List<JSONObject> orderList = orderMapper.listHalloweenActOrder(param);
|
|
|
|
|
if (orderList != null && orderList.size() > 0) {
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
result.put("orderList", orderList);
|
|
|
|
|
for (JSONObject order : orderList) {
|
|
|
|
|
String redpackOpenId = getRedpackId(order);
|
|
|
|
|
if (redpackOpenId != null) {
|
|
|
|
|
result.put("redpackOpenId", redpackOpenId);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取该笔订单的redpackOpenId
|
|
|
|
|
private String getRedpackId(JSONObject order) {
|
|
|
|
|
String redpackOpenId = null;
|
|
|
|
|
String channel = order.getString("channel");
|
|
|
|
|
if ("Wechat".equals(channel)) {
|
|
|
|
|
JSONObject customerRelation = customerMapper.findCustomerByOpenId(order.getString("customer_id"));
|
|
|
|
|
if (customerRelation == null) {
|
|
|
|
|
customerRelation = customerMapper.findCustomerGlobalpayByOpenId(order.getString("customer_id"));
|
|
|
|
|
}
|
|
|
|
|
redpackOpenId = customerRelation.getString("redpack_openid");
|
|
|
|
|
if (customerRelation.getString("kanga_openid") == null) {
|
|
|
|
|
redpackOpenId = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return redpackOpenId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String signUrl(UriComponentsBuilder uriComponentsBuilder) {
|
|
|
|
|
String timestamp = System.currentTimeMillis() + "";
|
|
|
|
|
String base = CUSTOMER_APP_ID + timestamp + CUSTOMER_AUTH_CODE;
|
|
|
|
|