| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.exception.msg.MsgMoneyDetailException;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgMoneyDetailService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | @Service
|
| | | public class MsgMoneyDetailServiceImpl implements MsgMoneyDetailService {
|
| | |
|
| | | @Resource
|
| | | private MsgMoneyDetailMapper msgMoneyDetailMapper;
|
| | |
|
| | | @Resource
|
| | | private UserMsgReadStateService userMsgReadStateService;
|
| | |
|
| | | @Override
|
| | | public void addMsgMoneyDetail(MsgMoneyDetail detail) throws MsgMoneyDetailException {
|
| | |
| | | }
|
| | |
|
| | | } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.extractValid) {
|
| | | if (detail.getExtract() == null || detail.getUser() == null)
|
| | | if (detail.getAlipayAccountValid() == null || detail.getUser() == null)
|
| | | throw new MsgMoneyDetailException(2, "消息信息不全");
|
| | | MsgMoneyDetail msg = msgMoneyDetailMapper.selectBySourceIdAndMsgType(detail.getExtract().getId(),
|
| | | MsgMoneyDetail msg = msgMoneyDetailMapper.selectBySourceIdAndMsgType(detail.getAlipayAccountValid().getId(),
|
| | | MsgTypeMoneyTypeEnum.extractValid);
|
| | | if (msg == null) {
|
| | | detail.setCreateTime(new Date());
|
| | |
| | | }
|
| | |
|
| | | } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.fanli) {
|
| | | if (detail.getMoney() == null || detail.getGoodsCount() == null || detail.getOrderCount() == null
|
| | | || detail.getOrderId() == null || detail.getBalance() == null)
|
| | | if (detail.getMoney() == null || detail.getGoodsCount() == null || detail.getOrderId() == null
|
| | | || detail.getBalance() == null)
|
| | | throw new MsgMoneyDetailException(2, "消息信息不全");
|
| | |
|
| | | detail.setCreateTime(new Date());
|
| | |
| | | detail.setUpdateTime(new Date());
|
| | | detail.setRead(false);
|
| | | msgMoneyDetailMapper.insertSelective(detail);
|
| | | } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.fanliWeiQuan
|
| | | || detail.getMsgType() == MsgTypeMoneyTypeEnum.inviteWeiQuan
|
| | | || detail.getMsgType() == MsgTypeMoneyTypeEnum.shareWeiQuan) {
|
| | | if (detail.getMoney() == null || detail.getOrderId() == null || detail.getBalance() == null)
|
| | | throw new MsgMoneyDetailException(2, "消息信息不全");
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setRead(false);
|
| | | msgMoneyDetailMapper.insertSelective(detail);
|
| | | } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.orderReward) {
|
| | | if (detail.getMoney() == null || detail.getOrderId() == null || detail.getBalance() == null)
|
| | | throw new MsgMoneyDetailException(2, "消息信息不全");
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setRead(false);
|
| | | msgMoneyDetailMapper.insertSelective(detail);
|
| | | } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.systemEqualize) {
|
| | | if (detail.getMoney() == null || detail.getOrderId() == null || detail.getBalance() == null)
|
| | | throw new MsgMoneyDetailException(2, "消息信息不全");
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setRead(false);
|
| | | msgMoneyDetailMapper.insertSelective(detail);
|
| | | }
|
| | |
|
| | | userMsgReadStateService.addMoneyMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<MsgMoneyDetail> listMsgMoneyDetail(Long uid, int page) {
|
| | | return null;
|
| | | return msgMoneyDetailMapper.listByUid(uid, (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countMsgMoneyDetail(Long uid) {
|
| | | return 0;
|
| | | return msgMoneyDetailMapper.countByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void readMsgByUid(Long uid) {
|
| | | msgMoneyDetailMapper.setMsgReadByUid(uid);
|
| | | }
|
| | |
|
| | | }
|