From 037be90c597e30302e70adfda0e0529f47fd8447 Mon Sep 17 00:00:00 2001 From: xhxu Date: Mon, 11 Oct 2021 11:13:13 +0800 Subject: [PATCH] update gift --- .../controller/WxCouponController.java | 87 ++++++++++--------- 1 file changed, 46 insertions(+), 41 deletions(-) diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java index c341d23d7..ffde87f9a 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java @@ -112,7 +112,7 @@ public class WxCouponController extends BaseController { //WxCouponCVo wxCouponCVo = wxCouponChannelService.findDetailVo(couponChannelIdL); WxCouponCVo wxCouponCVo = null; try { - wxCouponCVo = generateWxCouponCVoex(couponChannelIdL,getTenantInfo().getTenantId()); + wxCouponCVo = generateWxCouponCVoex(couponChannelIdL,couponIdL,getTenantInfo().getTenantId()); } catch (IllegalAccessException e) { logger.error("coupon detail fail,copyproperties error" + couponChannelId,e); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "coupon detail fail,copyproperties error" + couponChannelId); @@ -199,52 +199,57 @@ public class WxCouponController extends BaseController { } private WxCouponCVo generateWxCouponCVoForHtml(Long couponChannelIdL, Long couponIdL,String tenantId) { - WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL,tenantId); - if (cc == null) { - return null; - } - - WxCoupon c = couponService.getHtmlById(cc.getCouponId(),cc.getTenantId()); - if (c == null) { - return null; + if(couponChannelIdL != null){ + WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL,tenantId); + if(cc == null){ + return null; + } + WxCoupon c = couponService.getHtmlById(cc.getCouponId(),cc.getTenantId()); + if (c == null) { + return null; + } + WxCouponCVo couponCVo = new WxCouponCVo(); + couponCVo.setId(cc.getId()); + couponCVo.setCouponId(cc.getCouponId()); + couponCVo.setHtml(c.getHtml()); + return couponCVo; + }else if(couponIdL != null){ + WxCoupon c = couponService.getHtmlById(couponIdL,tenantId); + if (c == null) { + return null; + } + WxCouponCVo couponCVo = new WxCouponCVo(); + couponCVo.setCouponId(c.getId()); + couponCVo.setHtml(c.getHtml()); + return couponCVo; } + return null; - WxCouponCVo couponCVo = new WxCouponCVo(); - couponCVo.setId(cc.getId()); - couponCVo.setCouponId(cc.getCouponId()); - couponCVo.setHtml(c.getHtml()); - return couponCVo; } - private WxCouponCVo generateWxCouponCVoex(Long couponChannelIdL,String tenantId) throws IllegalAccessException, InvocationTargetException { - WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL,tenantId); - if (cc == null) { - return null; - } - -// WxCoupon c = couponService.getById(cc.getCouponId(),cc.getTenantId()); -// if (c == null) { -// c = new WxCoupon(); -// } - WxCouponCVo wxcv = couponService.getVoById(cc.getCouponId(),cc.getTenantId()); - if(wxcv == null){ - return null; + private WxCouponCVo generateWxCouponCVoex(Long couponChannelIdL,Long couponIdL,String tenantId) throws IllegalAccessException, InvocationTargetException { + if(couponChannelIdL != null){ + WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL,tenantId); + if(cc == null){ + return null; + } + WxCouponCVo wxcv = couponService.getVoById(cc.getCouponId(),tenantId); + if(wxcv == null){ + return null; + } + wxcv.setId(cc.getId()); + wxcv.setCouponId(cc.getCouponId()); + wxcv.setTargetAd(cc.getTargetAd()); + wxcv.setBeginTime(cc.getBeginTime()); + wxcv.setEndTime(cc.getEndTime()); + wxcv.setQrCode(cc.getQrCode()); + return wxcv; + }else if(couponIdL != null){ + WxCouponCVo wxcv = couponService.getVoById(couponIdL,tenantId); + return wxcv; } -// WxCouponCVo wxcv = new WxCouponCVo(); -// BeanUtils.copyProperties(wxcv, c); - wxcv.setId(cc.getId()); - wxcv.setCouponId(cc.getCouponId()); - wxcv.setTargetAd(cc.getTargetAd()); - wxcv.setBeginTime(cc.getBeginTime()); - wxcv.setEndTime(cc.getEndTime()); - wxcv.setQrCode(cc.getQrCode()); - -// List chantlist = merchantService.findMerchantVoList(cc.getCouponId(),cc.getTenantId()); -// if (null != chantlist && chantlist.size()>0) { -// wxcv.setMerchantVoList(chantlist); -// } - return wxcv; + return null; } private void updateActivityStatus(WxCouponCVo wxCouponCVo) {