| | |
| | | package com.yeshi.fanli.service.impl.money;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | 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.util.MoneyBigDecimalUtil;
|
| | |
|
| | | @Service
|
| | | public class UserMoneyExtraServiceImpl implements UserMoneyExtraService {
|
| | |
|
| | | @Resource
|
| | | private UserMoneyExtraMapper userMoneyExtraMapper;
|
| | | |
| | |
|
| | | @Override
|
| | | public UserMoneyExtra selectByPrimaryKey(Long uid) {
|
| | |
| | | userMoneyExtraMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public void addTaoLiJin(Long uid, BigDecimal money, boolean canSelf) {
|
| | | if (uid == null || money == null) {
|
| | | return;
|
| | | }
|
| | | |
| | | UserMoneyExtra record = new UserMoneyExtra();
|
| | | record.setUid(uid);
|
| | | |
| | | UserMoneyExtra existExtra = userMoneyExtraMapper.selectByPrimaryKey(record.getUid());
|
| | | if (existExtra == null) {
|
| | | record.setTlj(money);
|
| | | |
| | | if (canSelf) {
|
| | | record.setTljSelf(money);
|
| | | } else {
|
| | | record.setTljSelf(new BigDecimal(0));
|
| | | }
|
| | | |
| | | record.setCreateTime(new Date());
|
| | | record.setUpdateTime(new Date());
|
| | | userMoneyExtraMapper.insertSelective(record);
|
| | | } else {
|
| | | BigDecimal tlj = existExtra.getTlj();
|
| | | record.setTlj(MoneyBigDecimalUtil.add(tlj, money));
|
| | | |
| | | if (canSelf) {
|
| | | BigDecimal tljSelf = existExtra.getTljSelf();
|
| | | record.setTljSelf(MoneyBigDecimalUtil.add(tljSelf, money));
|
| | | }
|
| | | |
| | | record.setUpdateTime(new Date());
|
| | | userMoneyExtraMapper.updateByPrimaryKeySelective(record); |
| | | }
|
| | | public List<UserMoneyExtra> listValid(int page, int count) {
|
| | | return userMoneyExtraMapper.listValid((page-1) * count, count);
|
| | | }
|
| | | |
| | | |
| | | }
|