| | |
| | | package com.yeshi.fanli.service.impl.goods;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.transaction.Transactional;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.hongbao.HongBaoDao;
|
| | | import com.yeshi.fanli.dao.mybatis.share.ShareMapper;
|
| | | import com.yeshi.fanli.dao.order.PidOrderDao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.taobao.PidOrder;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.ShareTaoPassword;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | |
|
| | | @Service
|
| | | public class ShareServiceImpl implements ShareService {
|
| | |
|
| | | @Resource
|
| | | private ShareMapper shareMapper;
|
| | | |
| | | @Resource
|
| | | private HongBaoDao hongBaoDao;
|
| | | |
| | | @Resource
|
| | | private PidOrderDao pidOrderDao;
|
| | | |
| | |
|
| | | @Override
|
| | | public String getRandomPid() {
|
| | | return shareMapper.getRandomPid();
|
| | |
| | | public int getCount(long uid) {
|
| | | return shareMapper.getCount(uid);
|
| | | }
|
| | | |
| | | @Override
|
| | | public int getCountByKey(String key) {
|
| | | if (NumberUtil.isNumeric(key)) {
|
| | | |
| | | if (key.trim().length() < 18) {
|
| | | long lk = Long.parseLong(key);
|
| | | return (int) pidOrderDao.getCount(
|
| | | "select count(*) from PidOrder po where po.userInfo.id = ? ",
|
| | | new Serializable[] {lk});
|
| | | } else {
|
| | | return (int) pidOrderDao.getCount("select count(*) from PidOrder po where po.orderId like ? ",
|
| | | new Serializable[] { "%" + key + "%" });
|
| | | }
|
| | | |
| | | } else {
|
| | | |
| | | return (int) pidOrderDao.getCount("select count(*) from PidOrder po where po.userInfo.nickName like ? ",
|
| | | new Serializable[] { "%" + key + "%" });
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<HongBao> getShareList(int pageIndex, long uid) {
|
| | | List<HongBao> shareList = hongBaoDao.list("from HongBao hb where hb.userInfo.id = ? and hb.type = '20' order by hb.createtime desc",
|
| | | (pageIndex - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, new Serializable[] { uid });
|
| | | return shareList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getInviteCount(long uid) {
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<HongBao> getInviteList(int pageIndex, long uid) {
|
| | | List<HongBao> shareList = hongBaoDao.list("from HongBao hb where (hb.type = '6' or hb.type = '7') and hb.userInfo.id = ? order by hb.createtime desc",
|
| | | (pageIndex - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, new Serializable[] { uid });
|
| | | return shareList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getShareMoneyCount() {
|
| | | return shareMapper.getShareMoneyCount();
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public List<PidOrder> getShareMoneyList(int pageIndex, String key) {
|
| | | |
| | | if(NumberUtil.isNumeric(key)) {
|
| | | |
| | | if(key.length() < 18 ) {
|
| | | long uid = Long.parseLong(key);
|
| | | List<PidOrder> shareMoneyList = pidOrderDao.list("from PidOrder po where po.userInfo.id = ? order by po.orderCreateTime desc",
|
| | | (pageIndex - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, new Serializable[] {uid});
|
| | | return shareMoneyList;
|
| | | } else {
|
| | | List<PidOrder> shareMoneyList = pidOrderDao.list("from PidOrder po where po.orderId like ? order by po.orderCreateTime desc",
|
| | | (pageIndex - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, new Serializable[] {"%" + key + "%"});
|
| | | return shareMoneyList;
|
| | | }
|
| | | |
| | | }
|
| | | List<PidOrder> shareMoneyList = pidOrderDao.list("from PidOrder po where po.userInfo.nickName like ? order by po.orderCreateTime desc",
|
| | | (pageIndex - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, new Serializable[] {"%" + key + "%"});
|
| | | return shareMoneyList;
|
| | | }
|
| | |
|
| | | }
|