fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserSystemCouponRecordMapper.java
@@ -44,6 +44,6 @@ * @param seconds * @return */ List<UserSystemCouponRecord> getCouponByUsingTimeOut(@Param("uid") Long uid,@Param("seconds") long seconds); List<UserSystemCouponRecord> getCouponByUsingTimeOut(@Param("uid") Long uid, @Param("number") Long number); } fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponRecordMapper.xml
@@ -88,7 +88,7 @@ SELECT * FROM `yeshi_ec_user_system_coupon` cp LEFT JOIN `yeshi_ec_user_system_coupon_record` rd ON rd.`ucr_user_coupon_id` = cp.`usc_id` WHERE cp.`usc_uid` = #{uid} AND cp.`usc_state` = 2 AND rd.`ucr_state` = 0 AND UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(cp.`usc_use_time`) > #{seconds} ; AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(cp.`usc_use_time`)) <![CDATA[>]]> #{number}; </select> </mapper> fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponRecordServiceImpl.java
@@ -54,7 +54,7 @@ } @Override public List<UserSystemCouponRecord> getCouponByUsingTimeOut(Long uid, long seconds) { public List<UserSystemCouponRecord> getCouponByUsingTimeOut(Long uid, Long seconds) { return userSystemCouponRecordMapper.getCouponByUsingTimeOut(uid, seconds); } fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -1011,10 +1011,46 @@ } } } } @Override public void updateStateByDrawback(String orderNo) throws Exception { if (orderNo == null || orderNo.trim().length() == 0) { return; } UserSystemCouponRecord record = userSystemCouponRecordService.getRecordByOrderNo(orderNo, null); if (record == null) { return; } record.setOrderNo(orderNo); record.setUpdateTime(new Date()); record.setState(UserSystemCouponRecord.STATE_FAIL_DRAWBACK); userSystemCouponRecordService.updateByPrimaryKeySelective(record); // 券退回 sendBackCoupon(record.getUserSystemCoupon()); } @Override public void updateStateByArrivalAccount(String orderNo) throws Exception { if (orderNo == null || orderNo.trim().length() == 0) { return; } UserSystemCouponRecord record = userSystemCouponRecordService.getRecordByOrderNo(orderNo, 2); if (record == null) { return; } record.setOrderNo(orderNo); record.setUpdateTime(new Date()); record.setState(UserSystemCouponRecord.STATE_SUCCESS); userSystemCouponRecordService.updateByPrimaryKeySelective(record); } @Override public void updateCounponInvalid(Long uid) { @@ -1061,7 +1097,7 @@ @Override public void sendBackTimeOutCoupon(Long uid) { // 超过120秒 未被匹配的券 List<UserSystemCouponRecord> list = userSystemCouponRecordService.getCouponByUsingTimeOut(uid, 120); List<UserSystemCouponRecord> list = userSystemCouponRecordService.getCouponByUsingTimeOut(uid, 120L); if (list == null || list.size() == 0) { return; } fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponRecordService.java
@@ -25,7 +25,7 @@ * @param seconds * @return */ public List<UserSystemCouponRecord> getCouponByUsingTimeOut(Long uid, long seconds); public List<UserSystemCouponRecord> getCouponByUsingTimeOut(Long uid, Long seconds); /** * 查询状态 fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java
@@ -164,5 +164,17 @@ */ public boolean updateCouponRecordUsed(Long uid, String orderNo, BigDecimal payment, Long auctionId) throws Exception; /** * 订单退款更新 券记录状态并退回券 * @param orderNo */ public void updateStateByDrawback(String orderNo) throws Exception; /** * 红包到账 -- 更新券使用状态 -改为使用成功 * @param orderNo * @throws Exception */ public void updateStateByArrivalAccount(String orderNo) throws Exception; }