From 4ee68e191fecb880da2b61c401a694ec8fc35e0b Mon Sep 17 00:00:00 2001 From: hellolujian <1370256381@qq.com> Date: Sun, 28 Oct 2018 16:42:29 +0800 Subject: [PATCH] [fix] --- .../core/impls/CouponValidateServiceImpl.java | 17 +++++++++++------ .../customers/web/CouponValidateController.java | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CouponValidateServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CouponValidateServiceImpl.java index 4bd165c8f..cd92f5482 100644 --- a/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CouponValidateServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CouponValidateServiceImpl.java @@ -228,13 +228,16 @@ public class CouponValidateServiceImpl implements CouponValidateService { @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 orderList = orderMapper.listHalloweenActOrder(param); + + JSONObject result = null; if (orderList != null && orderList.size() > 0) { - JSONObject result = new JSONObject(); + result = new JSONObject(); result.put("orderList", orderList); for (JSONObject order : orderList) { String redpackOpenId = getRedpackId(order); @@ -244,10 +247,11 @@ public class CouponValidateServiceImpl implements CouponValidateService { } } } - return null; + return result; } // 获取该笔订单的redpackOpenId + // TODO: 2018/10/28 有待商榷 private String getRedpackId(JSONObject order) { String redpackOpenId = null; String channel = order.getString("channel"); @@ -255,10 +259,11 @@ public class CouponValidateServiceImpl implements CouponValidateService { 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; + } else { + redpackOpenId = customerRelation.getString("redpack_openid"); + if (customerRelation.getString("kanga_openid") == null) { + redpackOpenId = null; + } } } return redpackOpenId; diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/web/CouponValidateController.java b/src/main/java/au/com/royalpay/payment/manage/customers/web/CouponValidateController.java index d3399b828..6d8cf9443 100644 --- a/src/main/java/au/com/royalpay/payment/manage/customers/web/CouponValidateController.java +++ b/src/main/java/au/com/royalpay/payment/manage/customers/web/CouponValidateController.java @@ -51,7 +51,7 @@ public class CouponValidateController { @GetMapping(value = "/payment/holloween") @ResponseBody public JSONObject getHalloweenActOrderInfo(@RequestParam("customer_id") String customerId, - @RequestParam("act_date") String actDate) { + @RequestParam("act_date") String actDate) { return couponVerificationService.getHalloweenOrderInfo(customerId, actDate); } }