From 9b4900cfe01a756541d92899047bd9feb744f097 Mon Sep 17 00:00:00 2001 From: yangkai Date: Tue, 9 Oct 2018 12:05:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=BA=E7=A8=8B=E5=8D=A1=E5=88=B8=E6=A0=B8?= =?UTF-8?q?=E9=94=80=E6=B7=BB=E5=8A=A0=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../appclient/core/RetailAppService.java | 4 +++- .../core/impls/RetailAppServiceImp.java | 19 ++++++++++++++++--- .../appclient/web/RetailAppController.java | 17 ++++++++--------- .../mappers/log/CouponAccuessLogMapper.xml | 2 +- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java index 3236e16dc..94850ee79 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java @@ -162,7 +162,9 @@ public interface RetailAppService { JSONObject getCouponCusCouponLog(String client_moniker, AppQueryBean appQueryBean); - void saveCouponAccuessLog(int client_id, String coupon_id); + void saveCouponAccuessLog(int client_id, String coupon_id, String remark); JSONObject getStyle(); + + void cancelCouponAccuessLog(String accuess_id, String remark); } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 375d3d42d..f682cf30a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -479,7 +479,7 @@ public class RetailAppServiceImp implements RetailAppService { } @Override - public void saveCouponAccuessLog(int client_id, String coupon_id) { + public void saveCouponAccuessLog(int client_id, String coupon_id, String remark) { JSONObject client = clientMapper.findClient(client_id); if (client == null) { throw new BadRequestException("Partner not exists"); @@ -487,14 +487,15 @@ public class RetailAppServiceImp implements RetailAppService { JSONObject couponAccuessLog = new JSONObject(); Date date = new Date(); couponAccuessLog.put("client_id", client_id); - couponAccuessLog.put("order_id", "非平台订单"); + couponAccuessLog.put("order_id", "NON_PLATFORM_ORDER"); couponAccuessLog.put("coupon_id", "CTRIP_"+coupon_id); - couponAccuessLog.put("customer_openid", "非平台订单"); + couponAccuessLog.put("customer_openid", "NON_PLATFORM_ORDER"); couponAccuessLog.put("coupon_deal_amount", 0); couponAccuessLog.put("currency", "AUD"); couponAccuessLog.put("creation_date", date); couponAccuessLog.put("last_update_date", date); couponAccuessLog.put("is_valid", 1); + couponAccuessLog.put("remark", remark); couponAccuessLogMapper.save(couponAccuessLog); } @@ -503,6 +504,18 @@ public class RetailAppServiceImp implements RetailAppService { return royalPayCMSSupport.getStyle(); } + @Override + public void cancelCouponAccuessLog(String accuess_id, String remark) { + JSONObject couponAccuessLog = new JSONObject(); + couponAccuessLog.put("accuess_id", accuess_id); + couponAccuessLog.put("is_valid", 0); + couponAccuessLog.put("last_update_date", new Date()); + if (StringUtils.isNotEmpty(remark)) { + couponAccuessLog.put("remark", remark); + } + couponAccuessLogMapper.update(couponAccuessLog); + } + @Override public void updateClient(JSONObject device, AppClientBean appClientBean) { String clientType = device.getString("client_type"); diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java index d8cf99f17..2b0c92902 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java @@ -33,13 +33,7 @@ import org.apache.commons.lang3.time.DateUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.validation.Errors; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; @@ -557,8 +551,8 @@ public class RetailAppController { } @RequestMapping(value = "/cus/coupon_accuess_log/{coupon_id}", method = RequestMethod.POST) - public void saveCouponAccuessLog(@PathVariable String coupon_id, @RequestParam int client_id) { - retailAppService.saveCouponAccuessLog(client_id, coupon_id); + public void saveCouponAccuessLog(@PathVariable String coupon_id, @RequestParam int client_id, String remark) { + retailAppService.saveCouponAccuessLog(client_id, coupon_id, remark); } @RequestMapping(value = "/style", method = RequestMethod.GET) @@ -566,4 +560,9 @@ public class RetailAppController { return retailAppService.getStyle(); } + @RequestMapping(value = "/cus/coupon_accuess_log/{accuess_id}", method = RequestMethod.PUT) + public void updateCouponAccuessLog(@PathVariable String accuess_id, String remark) { + retailAppService.cancelCouponAccuessLog(accuess_id, remark); + } + } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/log/CouponAccuessLogMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/CouponAccuessLogMapper.xml index 784d34e3b..0e9155385 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/log/CouponAccuessLogMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/CouponAccuessLogMapper.xml @@ -6,7 +6,7 @@ accuess_id,client_id,customer_openid,order_id, TRIM(LEADING #{keyword} FROM coupon_id) coupon_id, coupon_deal_amount,min_pay_amount,currency,creation_date, - last_update_date,is_valid,transaction_id,transaction_refund_id,refund_id + last_update_date,is_valid,transaction_id,transaction_refund_id,refund_id,remark FROM cus_coupon_accuess_log WHERE locate(#{keyword},coupon_id) = 1 AND client_id = #{client_id}