From 495bf22196e2c1e07e3acb8c7fb2a5496841b5e2 Mon Sep 17 00:00:00 2001 From: yangkai Date: Fri, 31 Aug 2018 10:47:47 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E5=8D=A1=E5=88=B8=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=8E=A5=E5=8F=A3=202.=E6=9F=A5=E8=AF=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6(client?= =?UTF-8?q?=5Fmoniker)=20=E3=80=81=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../appclient/core/RetailAppService.java | 3 ++ .../core/impls/RetailAppServiceImp.java | 32 +++++++++++++++++++ .../appclient/web/RetailAppController.java | 10 ++++++ .../mappers/log/CouponAccuessLogMapper.java | 5 +++ 4 files changed, 50 insertions(+) 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 b59deeae7..b0138c63c 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 @@ -160,4 +160,7 @@ public interface RetailAppService { JSONObject ctripCouponInfo(JSONObject device,String coupon_id); + JSONObject getCouponCusCouponLog(String client_moniker, AppQueryBean appQueryBean); + + void saveCouponAccuessLog(int client_id, String coupon_id); } 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 90341fb31..1efb6cd7c 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 @@ -172,6 +172,8 @@ public class RetailAppServiceImp implements RetailAppService { private ClearingLogMapper clearingLogMapper; @Resource private CustomerServiceService customerServiceService; + @Resource + private CouponAccuessLogMapper couponAccuessLogMapper; private Map senderMap = new HashMap<>(); private final String fileName[] = { "client_bank_file", "client_id_file", "client_company_file" }; @@ -451,6 +453,36 @@ public class RetailAppServiceImp implements RetailAppService { } + @Override + public JSONObject getCouponCusCouponLog(String client_moniker, AppQueryBean appQueryBean) { + JSONObject client = clientMapper.findClientByMoniker(client_moniker); + if (client == null) { + throw new BadRequestException("Partner not exists"); + } + PageList cusCouponLog = couponAccuessLogMapper.getCouponAccuessLog( + client.getIntValue("client_id"), new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("creation_date.desc"))); + return PageListUtils.buildPageListResult(cusCouponLog); + } + + @Override + public void saveCouponAccuessLog(int client_id, String coupon_id) { + JSONObject client = clientMapper.findClient(client_id); + if (client == null) { + throw new BadRequestException("Partner not exists"); + } + JSONObject couponAccuessLog = new JSONObject(); + couponAccuessLog.put("client_id", client_id); + couponAccuessLog.put("order_id", "非平台订单"); + couponAccuessLog.put("coupon_id", coupon_id); + couponAccuessLog.put("customer_openid", "非平台订单"); + couponAccuessLog.put("coupon_deal_amount", 0); + couponAccuessLog.put("currency", "AUD"); + couponAccuessLog.put("creation_date", new Date()); + couponAccuessLog.put("last_update_date", new Date()); + couponAccuessLog.put("is_valid", 1); + couponAccuessLogMapper.save(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 56bd28d16..524fcb020 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 @@ -564,4 +564,14 @@ public class RetailAppController { return retailAppService.ctripCouponInfo(device,couponId); } + @RequestMapping(value = "/cus/coupon_accuess_log/{client_moniker}", method = RequestMethod.GET) + public JSONObject getCouponLogByClientMoniker(@PathVariable String client_moniker, AppQueryBean appQueryBean) { + return retailAppService.getCouponCusCouponLog(client_moniker, appQueryBean); + } + + @RequestMapping(value = "/cus/coupon_accuess_log/{client_id}/save", method = RequestMethod.POST) + public void saveCouponAccuessLog(@PathVariable int client_id, @RequestParam String coupon_id) { + retailAppService.saveCouponAccuessLog(client_id, coupon_id); + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/log/CouponAccuessLogMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/log/CouponAccuessLogMapper.java index e4e593ccc..6aa29ddaa 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/log/CouponAccuessLogMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/log/CouponAccuessLogMapper.java @@ -2,6 +2,8 @@ package au.com.royalpay.payment.manage.mappers.log; import java.util.List; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import com.github.miemiedev.mybatis.paginator.domain.PageList; import org.apache.ibatis.annotations.Param; import com.alibaba.fastjson.JSONObject; @@ -26,4 +28,7 @@ public interface CouponAccuessLogMapper { @AutoSql(type = SqlType.SELECT) List findCouponByOrderId(@Param("order_id") String order_id); + + @AutoSql(type = SqlType.SELECT) + PageList getCouponAccuessLog(@Param("client_id")int client_id, PageBounds pageBounds); }