From dcd5d07d5d648b48f6f04cd79b6e8c5b780dcff7 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 27 二月 2019 16:59:40 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java | 67 ++++++++++++++++++++++++++++++--- 1 files changed, 60 insertions(+), 7 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java index 2e81e87..8adeccd 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java @@ -11,6 +11,7 @@ import javax.annotation.Resource; +import org.springframework.core.task.TaskExecutor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.yeshi.utils.DateUtil; @@ -27,6 +28,7 @@ import com.yeshi.fanli.entity.order.CommonOrder; import com.yeshi.fanli.entity.system.SystemCoupon; import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum; +import com.yeshi.fanli.exception.user.UserInfoExtraException; import com.yeshi.fanli.exception.user.UserSystemCouponException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; @@ -58,6 +60,9 @@ @Service public class UserSystemCouponServiceImpl implements UserSystemCouponService { + @Resource(name = "taskExecutor") + private TaskExecutor executor; + @Resource private UserSystemCouponMapper userSystemCouponMapper; @@ -185,6 +190,22 @@ // 鎻掑叆鏁版嵁搴� insertSelective(userCoupon); + executor.execute(new Runnable() { + @Override + public void run() { + UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); + // 娣诲姞涓�鏉℃秷鎭� + if (userInfoExtra != null) { + userInfoExtra.setCouponNews(userInfoExtra.getCouponNews() + 1); + try { + userInfoExtraService.saveUserInfoExtra(userInfoExtra); + } catch (UserInfoExtraException e) { + e.printStackTrace(); + } + } + + } + }); // 娑堟伅鎺ㄩ�� try { @@ -990,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) { @@ -1040,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; } @@ -1085,10 +1142,6 @@ @Override public boolean updateCouponRecordUsed(Long uid, String orderNo, BigDecimal payment, Long auctionId) throws Exception{ - - //鍙鐞嗕粯娆鹃噾棰濆皬浜�10鐨� - if(payment==null||payment.compareTo(new BigDecimal(10))<0) - return false; boolean isfree = false; -- Gitblit v1.8.0