| @@ -68,6 +68,7 @@ public class WxCouponController extends BaseController { | |||||
| if (hasKey) { | if (hasKey) { | ||||
| // 从缓存获取用户信息 | // 从缓存获取用户信息 | ||||
| WxCouponCVo wxCouponCVo = operations.get(key); | WxCouponCVo wxCouponCVo = operations.get(key); | ||||
| // 库存 | |||||
| if (couponIdL > 0L) { | if (couponIdL > 0L) { | ||||
| // 更新状态 | // 更新状态 | ||||
| WxCouponCVo couponCVo = couponService.getVoStatusById(couponIdL); | WxCouponCVo couponCVo = couponService.getVoStatusById(couponIdL); | ||||
| @@ -26,6 +26,9 @@ import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.beans.factory.annotation.Qualifier; | |||||
| import org.springframework.data.redis.core.RedisTemplate; | |||||
| import org.springframework.data.redis.core.ValueOperations; | |||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| @@ -49,6 +52,10 @@ public class WxOrderController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | private WxCUserBasicInfoService wxCUserBasicInfoService; | ||||
| @Autowired | |||||
| @Qualifier("couponDetailRedisTemplate") | |||||
| RedisTemplate<String, WxCouponCVo> cdRedisTemplate; | |||||
| @ApiOperation(value = "下订单", notes = "{\"couponChannelId\":\"String\",\"couponId\":\"String\",\"press\":\"String\",\"orderGroupId\":\"String\",\"formId\":\"String\"}") | @ApiOperation(value = "下订单", notes = "{\"couponChannelId\":\"String\",\"couponId\":\"String\",\"press\":\"String\",\"orderGroupId\":\"String\",\"formId\":\"String\"}") | ||||
| @PostMapping("save") | @PostMapping("save") | ||||
| public ResultData saveOrder(@RequestBody OrderSaveDto orderSaveDto) { | public ResultData saveOrder(@RequestBody OrderSaveDto orderSaveDto) { | ||||
| @@ -71,7 +78,21 @@ public class WxOrderController extends BaseController { | |||||
| return new ResultData(ErrorCode.MEMBER_IS_LOCKED); | return new ResultData(ErrorCode.MEMBER_IS_LOCKED); | ||||
| } | } | ||||
| resultData = couponUserCheck(user, wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId())); | |||||
| WxCouponCVo wxCouponCVo = null; | |||||
| String key = "cc:" + orderSaveDto.getCouponChannelId(); | |||||
| 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); | |||||
| } | |||||
| resultData = couponUserCheck(user, wxCouponCVo); | |||||
| if (resultData != null) return resultData; | if (resultData != null) return resultData; | ||||
| Long couponId = orderSaveDto.getCouponId() == null ? wxCouponChannel.getCouponId() : orderSaveDto.getCouponId(); | Long couponId = orderSaveDto.getCouponId() == null ? wxCouponChannel.getCouponId() : orderSaveDto.getCouponId(); | ||||
| @@ -12,10 +12,7 @@ import com.iformall.domain.dto.WxMerchantDto; | |||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.WxMerchantSimpleVo; | |||||
| import com.iformall.domain.vo.WxMerchantTradeDetailVo; | |||||
| import com.iformall.domain.vo.WxMerchantTradeVo; | |||||
| import com.iformall.domain.vo.WxMerchantVo; | |||||
| import com.iformall.domain.vo.*; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| @@ -274,6 +274,47 @@ | |||||
| </collection> | </collection> | ||||
| </resultMap> | </resultMap> | ||||
| <resultMap id="WxCouponCVoMapL" type="com.iformall.domain.vo.WxCouponCVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||||
| <result column="target_ad" jdbcType="INTEGER" property="targetAd" /> | |||||
| <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime"/> | |||||
| <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||||
| <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/> | |||||
| <result column="detail_picture" jdbcType="VARCHAR" property="detailPicture"/> | |||||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||||
| <result column="use_price" jdbcType="INTEGER" property="usePrice"/> | |||||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/> | |||||
| <result column="send_type" jdbcType="INTEGER" property="sendType"/> | |||||
| <result column="valid_type" jdbcType="INTEGER" property="validType"/> | |||||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/> | |||||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/> | |||||
| <result column="valid_days" jdbcType="INTEGER" property="validDays"/> | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||||
| <result column="unit" jdbcType="INTEGER" property="unit"/> | |||||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/> | |||||
| <result column="inventory" jdbcType="INTEGER" property="inventory"/> | |||||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="business" jdbcType="INTEGER" property="business"/> | |||||
| <result column="subBusiness" jdbcType="INTEGER" property="subBusiness"/> | |||||
| <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/> | |||||
| <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/> | |||||
| <result column="auto_refund" jdbcType="INTEGER" property="autoRefund"/> | |||||
| <result column="qr_code" property="qrCode"/> | |||||
| <result column="conditions" jdbcType="VARCHAR" property="conditions" /> | |||||
| </resultMap> | |||||
| <select id="findVoDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMap"> | <select id="findVoDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMap"> | ||||
| select | select | ||||
| <include refid="WxCouponCVoColumn"/> | <include refid="WxCouponCVoColumn"/> | ||||
| @@ -282,7 +323,7 @@ | |||||
| where cc.id = #{id} | where cc.id = #{id} | ||||
| </select> | </select> | ||||
| <select id="findVoStatusDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMap"> | |||||
| <select id="findVoStatusDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMapL"> | |||||
| select | select | ||||
| <include refid="CVoStatusColumn"/> | <include refid="CVoStatusColumn"/> | ||||
| from wx_coupon c, wx_coupon_channel cc | from wx_coupon c, wx_coupon_channel cc | ||||
| @@ -511,6 +511,42 @@ | |||||
| </collection> | </collection> | ||||
| </resultMap> | </resultMap> | ||||
| <resultMap id="WxCouponCVoMapL" type="com.iformall.domain.vo.WxCouponCVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||||
| <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/> | |||||
| <result column="detail_picture" jdbcType="VARCHAR" property="detailPicture"/> | |||||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||||
| <result column="use_price" jdbcType="INTEGER" property="usePrice"/> | |||||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/> | |||||
| <result column="send_type" jdbcType="INTEGER" property="sendType"/> | |||||
| <result column="valid_type" jdbcType="INTEGER" property="validType"/> | |||||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/> | |||||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/> | |||||
| <result column="valid_days" jdbcType="INTEGER" property="validDays"/> | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||||
| <result column="unit" jdbcType="INTEGER" property="unit"/> | |||||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/> | |||||
| <result column="inventory" jdbcType="INTEGER" property="inventory"/> | |||||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="business" jdbcType="INTEGER" property="business"/> | |||||
| <result column="sub_business" jdbcType="INTEGER" property="subBusiness"/> | |||||
| <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/> | |||||
| <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/> | |||||
| <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/> | |||||
| <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/> | |||||
| <result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/> | |||||
| <result column="conditions" jdbcType="VARCHAR" property="conditions"/> | |||||
| </resultMap> | |||||
| <select id="findVoDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMap"> | <select id="findVoDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMap"> | ||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| @@ -518,7 +554,7 @@ | |||||
| where id = #{id} | where id = #{id} | ||||
| </select> | </select> | ||||
| <select id="findVoStatusDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMap"> | |||||
| <select id="findVoStatusDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMapL"> | |||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_coupon | from wx_coupon | ||||