| | |
| | | package com.yeshi.fanli.service.impl.hongbao;
|
| | |
|
| | | import java.util.Date;
|
| | | 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.money.AccountDetailHongBaoMapMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.money.AccountDetailHongBaoMap;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.service.inter.hongbao.AccountDetailsHongBaoMapService;
|
| | |
|
| | | @Service
|
| | | public class AccountDetailsHongBaoMapServiceImpl implements AccountDetailsHongBaoMapService {
|
| | |
|
| | | @Resource
|
| | | private AccountDetailHongBaoMapMapper accountDetailHongBaoMapMapper;
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void saveAccountDetailsHongBaoMap(Long hongBaoId, Long accountDetailsId) {
|
| | | if (hongBaoId == null || accountDetailsId == null)
|
| | | return;
|
| | |
|
| | | // 保存账户明细与红包的关系
|
| | | AccountDetailHongBaoMap map = new AccountDetailHongBaoMap();
|
| | | map.setUserMoneyDetail(new UserMoneyDetail(accountDetailsId));
|
| | | map.setCreateTime(new Date());
|
| | | map.setHongBao(new HongBao(hongBaoId));
|
| | | map.setUpdateTime(new Date());
|
| | | AccountDetailHongBaoMap oldMap = accountDetailHongBaoMapMapper.selectByHongBaoId(hongBaoId);
|
| | | if (oldMap == null) {
|
| | | accountDetailHongBaoMapMapper.insertSelective(map);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void saveAccountDetailsHongBaoMap(List<Long> hongBaoIdList, Long accountDetailsId) {
|
| | | if (hongBaoIdList != null)
|
| | | for (Long hongBaoId : hongBaoIdList)
|
| | | saveAccountDetailsHongBaoMap(hongBaoId, accountDetailsId);
|
| | | }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.service.impl.hongbao; |
| | | |
| | | import java.util.Date; |
| | | 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.money.AccountDetailHongBaoMapMapper; |
| | | import com.yeshi.fanli.dto.HongBao; |
| | | import com.yeshi.fanli.entity.money.AccountDetailHongBaoMap; |
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail; |
| | | import com.yeshi.fanli.service.inter.hongbao.AccountDetailsHongBaoMapService; |
| | | |
| | | @Service |
| | | public class AccountDetailsHongBaoMapServiceImpl implements AccountDetailsHongBaoMapService { |
| | | |
| | | @Resource |
| | | private AccountDetailHongBaoMapMapper accountDetailHongBaoMapMapper; |
| | | |
| | | @Transactional |
| | | @Override |
| | | public void saveAccountDetailsHongBaoMap(Long hongBaoId, Long accountDetailsId) { |
| | | if (hongBaoId == null || accountDetailsId == null) |
| | | return; |
| | | |
| | | // 保存账户明细与红包的关系 |
| | | AccountDetailHongBaoMap map = new AccountDetailHongBaoMap(); |
| | | map.setUserMoneyDetail(new UserMoneyDetail(accountDetailsId)); |
| | | map.setCreateTime(new Date()); |
| | | map.setHongBao(new HongBao(hongBaoId)); |
| | | map.setUpdateTime(new Date()); |
| | | AccountDetailHongBaoMap oldMap = accountDetailHongBaoMapMapper.selectByHongBaoId(hongBaoId); |
| | | if (oldMap == null) { |
| | | accountDetailHongBaoMapMapper.insertSelective(map); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public void saveAccountDetailsHongBaoMap(List<Long> hongBaoIdList, Long accountDetailsId) { |
| | | if (hongBaoIdList != null) |
| | | for (Long hongBaoId : hongBaoIdList) |
| | | saveAccountDetailsHongBaoMap(hongBaoId, accountDetailsId); |
| | | } |
| | | |
| | | } |