| | |
| | | package com.yeshi.fanli.service.impl.money;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserMoneyExtraMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralTaskRecordService;
|
| | |
|
| | | @Service
|
| | | public class UserMoneyExtraServiceImpl implements UserMoneyExtraService {
|
| | |
| | | @Resource
|
| | | private UserMoneyExtraMapper userMoneyExtraMapper;
|
| | |
|
| | | @Resource
|
| | | private IntegralTaskRecordService integralTaskRecordService;
|
| | |
|
| | | @Override
|
| | | public UserMoneyExtra selectByPrimaryKey(Long uid) {
|
| | |
| | | public List<UserMoneyExtra> listValid(int page, int count) {
|
| | | return userMoneyExtraMapper.listValid((page-1) * count, count);
|
| | | }
|
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void taoLiJinExchange(int page, int count) {
|
| | | List<UserMoneyExtra> listValid = userMoneyExtraMapper.listValid((page-1) * count, count);
|
| | | if (listValid == null || listValid.isEmpty())
|
| | | return;
|
| | | |
| | | BigDecimal zero = new BigDecimal(0);
|
| | | for (UserMoneyExtra moneyExtra: listValid) {
|
| | | BigDecimal tlj = moneyExtra.getTlj();
|
| | | BigDecimal tljSelf = moneyExtra.getTljSelf();
|
| | | if (tlj == null || tlj.compareTo(zero) <= 0 || tljSelf == null || tljSelf.intValue() <= 0)
|
| | | continue;
|
| | | |
| | | integralTaskRecordService.taoLiJinExchange(moneyExtra.getUid(), tljSelf.intValue(), tlj);
|
| | | |
| | | moneyExtra.setTlj(zero);
|
| | | moneyExtra.setTljSelf(zero);
|
| | | userMoneyExtraMapper.updateByPrimaryKeySelective(moneyExtra);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|