CmUserbeanshistoryService.java 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package com.caimei.modules.user.service;
  2. import com.caimei.modules.user.dao.CmUserDao;
  3. import com.caimei.modules.user.dao.CmUserbeanshistoryDao;
  4. import com.caimei.modules.user.entity.CmUser;
  5. import com.caimei.modules.user.entity.UserBeansHistory;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Service;
  8. import org.springframework.transaction.annotation.Transactional;
  9. import java.util.List;
  10. /**
  11. * 采美豆记录Service
  12. *
  13. * @author zcp
  14. * @version 2017-10-19
  15. */
  16. @Service
  17. @Transactional(readOnly = true)
  18. public class CmUserbeanshistoryService {
  19. @Autowired
  20. private CmUserbeanshistoryDao cmUserbeanshistoryDao;
  21. @Autowired
  22. private CmUserDao cmUserDao;
  23. public List<CmUser> findUserBeansList(CmUser cmuser) {
  24. return cmUserbeanshistoryDao.findUserBeansList(cmuser);
  25. }
  26. public List<UserBeansHistory> findBeansHistoryList(UserBeansHistory userBeansHistory) {
  27. List<UserBeansHistory> historyList = cmUserbeanshistoryDao.findBeansHistoryList(userBeansHistory);
  28. if (historyList != null && historyList.size() > 0) {
  29. for (UserBeansHistory history : historyList) {
  30. CmUser user = cmUserDao.get(history.getUserId().toString());
  31. history.setClubId(Integer.valueOf(user.getClubID()));
  32. if (6 == history.getBeansType()) {
  33. //收款id
  34. Integer receiptId = cmUserbeanshistoryDao.findOrderReceiptId(history.getOrderId());
  35. history.setReceiptId(receiptId);
  36. }
  37. if (9 == history.getBeansType() || 11 == history.getBeansType()) {
  38. //退款id
  39. Integer returnedId = cmUserbeanshistoryDao.findPurchaseReturnedId(history.getOrderId());
  40. history.setReturnedId(returnedId);
  41. }
  42. }
  43. }
  44. return historyList;
  45. }
  46. }