| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.share.ShareMapper;
|
| | | import com.yeshi.fanli.dto.money.UserMoneyChangeDTO;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyService;
|
| | | import com.yeshi.fanli.util.cmq.UserMoneyChangeCMQManager;
|
| | |
|
| | | @Service
|
| | | public class UserMoneyServiceImpl implements UserMoneyService {
|
| | |
| | | @Resource
|
| | | private ShareMapper shareMapper;
|
| | |
|
| | | @Resource
|
| | | private UserInfoMapper userInfoMapper;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | |
|
| | | @Override
|
| | | public BigDecimal getMoneyToday(Long uid) {
|
| | | return shareMapper.getMoneyToday(uid + "");
|
| | | BigDecimal money = shareMapper.getMoneyToday(uid + "");
|
| | | return money == null ? new BigDecimal(0) : money;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getMoneyMonth(Long uid) {
|
| | | return shareMapper.getMoneyMonth(uid + "");
|
| | | BigDecimal money = shareMapper.getMoneyMonth(uid + "");
|
| | | return money == null ? new BigDecimal(0) : money;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getMoneyLastMonth(Long uid) {
|
| | | return shareMapper.getMoneyLastMonth(uid + "");
|
| | | BigDecimal money = shareMapper.getMoneyLastMonth(uid + "");
|
| | |
|
| | | return money == null ? new BigDecimal(0) : money;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void subUserMoney(Long uid, BigDecimal money, UserMoneyDetail detail) {
|
| | | userMoneyDetailMapper.insertSelective(detail);
|
| | | userInfoMapper.subHongBaoByUid(uid, money);
|
| | | try {
|
| | | UserMoneyChangeCMQManager.getInstance()
|
| | | .addUserMoneyChangeMsg(new UserMoneyChangeDTO(uid, new BigDecimal(0).subtract(money)));
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void addUserMoney(Long uid, BigDecimal money, UserMoneyDetail detail) {
|
| | | userMoneyDetailMapper.insertSelective(detail);
|
| | | userInfoMapper.addHongBaoByUid(uid, money);
|
| | | try {
|
| | | UserMoneyChangeCMQManager.getInstance().addUserMoneyChangeMsg(new UserMoneyChangeDTO(uid, money));
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|