|
|
|
@@ -5,6 +5,7 @@ import com.iformall.annotation.RedisCache; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.WxCUser; |
|
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
|
import com.iformall.domain.po.base.BaseEntity; |
|
|
|
import com.iformall.domain.po.WxCouponOrder; |
|
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
|
@@ -163,6 +164,49 @@ public class WxCouponOrderController extends BaseController { |
|
|
|
return new ResultData(wxCouponOrderCVo); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value = "卡券富文本接口") |
|
|
|
@GetMapping("html") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "couponOrderId", value = "券ID", dataType = "string", paramType = "query", required = true) |
|
|
|
}) |
|
|
|
public ResultData getHtml(String couponOrderId) { |
|
|
|
if (couponOrderId == null) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
} |
|
|
|
WxCouponOrderCVo wxCouponOrderCVo = null; |
|
|
|
try { |
|
|
|
wxCouponOrderCVo = wxCouponOrderService.simpleDetailCUserVo(couponOrderId); |
|
|
|
} catch (Exception e) { |
|
|
|
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); |
|
|
|
} |
|
|
|
if (wxCouponOrderCVo == null) { |
|
|
|
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); |
|
|
|
} |
|
|
|
WxCouponCVo wxCouponCVo = null; |
|
|
|
String key = "ch:" + wxCouponOrderCVo.getCouponId(); |
|
|
|
ValueOperations<String, WxCouponCVo> operations = cdRedisTemplate.opsForValue(); |
|
|
|
// 缓存 |
|
|
|
boolean hasKey = cdRedisTemplate.hasKey(key); |
|
|
|
if (hasKey) { |
|
|
|
// 从缓存获取用户信息 |
|
|
|
wxCouponCVo = operations.get(key); |
|
|
|
if (wxCouponCVo == null) { |
|
|
|
return new ResultData(ErrorCode.COUPON_IS_EMPTY); |
|
|
|
} |
|
|
|
} else { |
|
|
|
WxCoupon wxCoupon = wxCouponService.getHtmlById(wxCouponOrderCVo.getCouponId()); |
|
|
|
if (wxCoupon == null) { |
|
|
|
return new ResultData(ErrorCode.COUPON_IS_EMPTY); |
|
|
|
} |
|
|
|
wxCouponCVo = new WxCouponCVo(); |
|
|
|
wxCouponCVo.setId(wxCouponOrderCVo.getCouponId()); |
|
|
|
wxCouponCVo.setHtml(wxCoupon.getHtml()); |
|
|
|
// 插入缓存 |
|
|
|
operations.set(key, wxCouponCVo, 3600, TimeUnit.SECONDS); |
|
|
|
} |
|
|
|
return new ResultData(wxCouponOrderCVo); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value = "卡券状态接口") |
|
|
|
@GetMapping("getStatus") |
|
|
|
@ApiImplicitParams({ |
|
|
|
|