万圣节添加活动次数

master
james.zhao 6 years ago
parent 4158922e7c
commit c3ddf0e5d5

@ -2,6 +2,8 @@ package au.com.royalpay.payment.manage.customers.core;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.util.List;
/** /**
* Created by yuan on 2017/10/10. * Created by yuan on 2017/10/10.
*/ */
@ -21,4 +23,6 @@ public interface CouponValidateService {
JSONObject ctripCouponInfo(String coupon_log_id,int client_id,boolean is_expiry); JSONObject ctripCouponInfo(String coupon_log_id,int client_id,boolean is_expiry);
JSONObject ctripCouponLogNotice(String coupon_log_id,String order_id,String open_id,String status); JSONObject ctripCouponLogNotice(String coupon_log_id,String order_id,String open_id,String status);
JSONObject getHalloweenOrderInfo(String customerId, String transactionDate);
} }

@ -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.customers.core.CouponValidateService;
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.system.CustomerMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
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;
@ -51,6 +53,12 @@ public class CouponValidateServiceImpl implements CouponValidateService {
@Resource @Resource
private ClientManager clientManager; private ClientManager clientManager;
@Resource
private OrderMapper orderMapper;
@Resource
private CustomerMapper customerMapper;
@Override @Override
public JSONObject getCoupon(JSONObject partner,int page,int limit) { public JSONObject getCoupon(JSONObject partner,int page,int limit) {
String timestamp = System.currentTimeMillis() + ""; String timestamp = System.currentTimeMillis() + "";
@ -217,6 +225,50 @@ public class CouponValidateServiceImpl implements CouponValidateService {
return null; 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);
JSONObject result = null;
if (orderList != null && orderList.size() > 0) {
result = new JSONObject();
result.put("orderList", orderList);
for (JSONObject order : orderList) {
String redpackOpenId = getRedpackId(order);
if (redpackOpenId != null) {
result.put("redpackOpenId", redpackOpenId);
break;
}
}
}
return result;
}
// 获取该笔订单的redpackOpenId
// TODO: 2018/10/28 有待商榷
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"));
} else {
redpackOpenId = customerRelation.getString("redpack_openid");
if (customerRelation.getString("kanga_openid") == null) {
redpackOpenId = null;
}
}
}
return redpackOpenId;
}
private String signUrl(UriComponentsBuilder uriComponentsBuilder) { private String signUrl(UriComponentsBuilder uriComponentsBuilder) {
String timestamp = System.currentTimeMillis() + ""; String timestamp = System.currentTimeMillis() + "";
String base = CUSTOMER_APP_ID + timestamp + CUSTOMER_AUTH_CODE; String base = CUSTOMER_APP_ID + timestamp + CUSTOMER_AUTH_CODE;

@ -10,6 +10,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* Created by yuan on 2017/10/10. * Created by yuan on 2017/10/10.
@ -40,4 +41,17 @@ public class CouponValidateController {
throw new BadRequestException("卡券核销失败"); throw new BadRequestException("卡券核销失败");
} }
} }
/**
*
* @param customerId
* @param actDate
* @return
*/
@GetMapping(value = "/payment/halloween")
@ResponseBody
public JSONObject getHalloweenActOrderInfo(@RequestParam("customer_id") String customerId,
@RequestParam("act_date") String actDate) {
return couponVerificationService.getHalloweenOrderInfo(customerId, actDate);
}
} }

@ -79,4 +79,9 @@ public interface OrderMapper {
List<JSONObject> listAnalysisClientCustomer(JSONObject params); List<JSONObject> listAnalysisClientCustomer(JSONObject params);
PageList<JSONObject> listTransactionsForApp(JSONObject params, PageBounds pageBounds); PageList<JSONObject> listTransactionsForApp(JSONObject params, PageBounds pageBounds);
JSONObject findOrderById(@Param("order_id") String orderId);
@AutoSql(type = SqlType.SELECT)
List<JSONObject> listHalloweenActOrder(JSONObject param);
} }

Loading…
Cancel
Save