yujian
2019-02-27 ed9e2fdb519f36c743a10f0a1de48ad5f87604d6
券状态更新
3个文件已修改
54 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponRecordMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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} ; 
         <![CDATA[ AND UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(cp.`usc_use_time`) > #{seconds} ]]> 
  </select>
  
</mapper>
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) {
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;
    
}