|
|
|
@@ -8,6 +8,7 @@ import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.IdWorker; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.dto.WxCouponMerchantDto; |
|
|
|
import com.iformall.domain.po.*; |
|
|
|
@@ -77,6 +78,9 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxPayAccountMapper payAccountMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxCouponOrderMapper wxCouponOrderMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Qualifier("couponChannelRedisTemplate") |
|
|
|
@@ -742,4 +746,28 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) |
|
|
|
public ResultData cardDefer(Long id,Date validEndDate) { |
|
|
|
WxCoupon coupon = wxCouponMapper.selectById(id); |
|
|
|
if (null == coupon) { |
|
|
|
return new ResultData(Result.ERROR,id+"未查询到券信息."); |
|
|
|
} |
|
|
|
if (new Date().after(validEndDate)) { |
|
|
|
return new ResultData(Result.ERROR,"有效期不能小于当前时间."); |
|
|
|
} |
|
|
|
//更新coupon信息 |
|
|
|
coupon.setValidEndDate(validEndDate); |
|
|
|
coupon.setUpdateDate(new Date()); |
|
|
|
wxCouponMapper.updateValidEndDate(coupon); |
|
|
|
|
|
|
|
//更新coupon_order的状态,已过期的变为使用中 5-->4 |
|
|
|
wxCouponOrderMapper.cardDefer(id); |
|
|
|
|
|
|
|
//更新coupon_passwd |
|
|
|
couponPasswordMapper.updateExpiredTime(id, validEndDate); |
|
|
|
|
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
} |