package com.caimei.modules.user.service; import com.caimei.modules.user.dao.CmUserDao; import com.caimei.modules.user.dao.CmUserbeanshistoryDao; import com.caimei.modules.user.entity.CmUser; import com.caimei.modules.user.entity.UserBeansHistory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * 采美豆记录Service * * @author zcp * @version 2017-10-19 */ @Service @Transactional(readOnly = true) public class CmUserbeanshistoryService { @Autowired private CmUserbeanshistoryDao cmUserbeanshistoryDao; @Autowired private CmUserDao cmUserDao; public List findUserBeansList(CmUser cmuser) { return cmUserbeanshistoryDao.findUserBeansList(cmuser); } public List findBeansHistoryList(UserBeansHistory userBeansHistory) { List historyList = cmUserbeanshistoryDao.findBeansHistoryList(userBeansHistory); if (historyList != null && historyList.size() > 0) { for (UserBeansHistory history : historyList) { CmUser user = cmUserDao.get(history.getUserId().toString()); history.setClubId(Integer.valueOf(user.getClubID())); if (6 == history.getBeansType()) { //收款id Integer receiptId = cmUserbeanshistoryDao.findOrderReceiptId(history.getOrderId()); history.setReceiptId(receiptId); } if (9 == history.getBeansType() || 11 == history.getBeansType()) { //退款id Integer returnedId = cmUserbeanshistoryDao.findPurchaseReturnedId(history.getOrderId()); history.setReturnedId(returnedId); } } } return historyList; } }