| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponRecordMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | |
|
| | | @Service
|
| | | public class UserSystemCouponRecordServiceImpl implements UserSystemCouponRecordService {
|
| | |
|
| | | @Resource
|
| | | private UserSystemCouponRecordMapper userSystemCouponRecordMapper;
|
| | |
|
| | | @Override
|
| | | public int insertSelective(UserSystemCouponRecord record) {
|
| | | return userSystemCouponRecordMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserSystemCouponRecord selectByPrimaryKey(Long id) {
|
| | | return userSystemCouponRecordMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKeySelective(UserSystemCouponRecord record) {
|
| | | return userSystemCouponRecordMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(UserSystemCouponRecord record) {
|
| | | return userSystemCouponRecordMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<UserSystemCouponRecord> getRecordByState(Long uid, Integer state) {
|
| | | return userSystemCouponRecordMapper.getRecordByState(uid, state);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserSystemCouponRecord getRecordByOrderNo(String orderNo, Integer source, Integer state) {
|
| | | return userSystemCouponRecordMapper.getRecordByOrderNo(orderNo, source, state);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<UserSystemCouponRecord> getRecordByOrderNoList(Integer source, List<String> list) {
|
| | | return userSystemCouponRecordMapper.getRecordByOrderNoList(source, list);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean isSuccessMianDan(Integer source, String orderId) {
|
| | | List<String> orderList = new ArrayList<>();
|
| | | orderList.add(orderId);
|
| | | List<UserSystemCouponRecord> list = getRecordByOrderNoList(source, orderList);
|
| | | for (UserSystemCouponRecord record : list) {
|
| | | if (record.getCouponType().equalsIgnoreCase(CouponTypeEnum.freeCoupon.name())
|
| | | || record.getCouponType().equalsIgnoreCase(CouponTypeEnum.welfareFreeCoupon.name())
|
| | | || record.getCouponType().equalsIgnoreCase(CouponTypeEnum.freeCouponBuy.name())) {
|
| | | if (record.getState() == UserSystemCouponRecord.STATE_FREE_ON
|
| | | || record.getState() == UserSystemCouponRecord.STATE_SUCCESS)
|
| | | return true;
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserSystemCouponRecord getNearByUserCouponId(Long userCouponId) {
|
| | | return userSystemCouponRecordMapper.getNearByUserCouponId(userCouponId);
|
| | | }
|
| | | }
|
| | | package com.yeshi.fanli.service.impl.user; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponRecordMapper; |
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord; |
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum; |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService; |
| | | |
| | | @Service |
| | | public class UserSystemCouponRecordServiceImpl implements UserSystemCouponRecordService { |
| | | |
| | | @Resource |
| | | private UserSystemCouponRecordMapper userSystemCouponRecordMapper; |
| | | |
| | | @Override |
| | | public int insertSelective(UserSystemCouponRecord record) { |
| | | return userSystemCouponRecordMapper.insertSelective(record); |
| | | } |
| | | |
| | | @Override |
| | | public UserSystemCouponRecord selectByPrimaryKey(Long id) { |
| | | return userSystemCouponRecordMapper.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | @Override |
| | | public int updateByPrimaryKeySelective(UserSystemCouponRecord record) { |
| | | return userSystemCouponRecordMapper.updateByPrimaryKeySelective(record); |
| | | } |
| | | |
| | | @Override |
| | | public int updateByPrimaryKey(UserSystemCouponRecord record) { |
| | | return userSystemCouponRecordMapper.updateByPrimaryKey(record); |
| | | } |
| | | |
| | | @Override |
| | | public List<UserSystemCouponRecord> getRecordByState(Long uid, Integer state) { |
| | | return userSystemCouponRecordMapper.getRecordByState(uid, state); |
| | | } |
| | | |
| | | @Override |
| | | public UserSystemCouponRecord getRecordByOrderNo(String orderNo, Integer source, Integer state) { |
| | | return userSystemCouponRecordMapper.getRecordByOrderNo(orderNo, source, state); |
| | | } |
| | | |
| | | @Override |
| | | public List<UserSystemCouponRecord> getRecordByOrderNoList(Integer source, List<String> list) { |
| | | return userSystemCouponRecordMapper.getRecordByOrderNoList(source, list); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isSuccessMianDan(Integer source, String orderId) { |
| | | List<String> orderList = new ArrayList<>(); |
| | | orderList.add(orderId); |
| | | List<UserSystemCouponRecord> list = getRecordByOrderNoList(source, orderList); |
| | | for (UserSystemCouponRecord record : list) { |
| | | if (record.getCouponType().equalsIgnoreCase(CouponTypeEnum.freeCoupon.name()) |
| | | || record.getCouponType().equalsIgnoreCase(CouponTypeEnum.welfareFreeCoupon.name()) |
| | | || record.getCouponType().equalsIgnoreCase(CouponTypeEnum.freeCouponBuy.name())) { |
| | | if (record.getState() == UserSystemCouponRecord.STATE_FREE_ON |
| | | || record.getState() == UserSystemCouponRecord.STATE_SUCCESS) |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public UserSystemCouponRecord getNearByUserCouponId(Long userCouponId) { |
| | | return userSystemCouponRecordMapper.getNearByUserCouponId(userCouponId); |
| | | } |
| | | } |