package com.yeshi.fanli.service.impl.user.invite;
|
|
import java.text.SimpleDateFormat;
|
import java.util.ArrayList;
|
import java.util.Calendar;
|
import java.util.Date;
|
import java.util.List;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.context.annotation.Lazy;
|
import org.springframework.core.task.TaskExecutor;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import com.aliyun.openservices.ons.api.Message;
|
import com.aliyun.openservices.ons.api.Producer;
|
import com.google.gson.Gson;
|
import com.yeshi.fanli.dao.mybatis.ThreeSaleMapper;
|
import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
import com.yeshi.fanli.dto.mq.user.body.UserInviteMQMsg;
|
import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
|
import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
import com.yeshi.fanli.entity.bus.user.UserInfo;
|
import com.yeshi.fanli.exception.user.ThreeSaleException;
|
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
import com.yeshi.fanli.service.inter.user.UserInfoService;
|
import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
|
import com.yeshi.fanli.service.inter.user.invite.MsgInviteDetailService;
|
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleExtraInfoSerivce;
|
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
import com.yeshi.fanli.service.inter.user.invite.UserInviteMsgNotificationService;
|
import com.yeshi.fanli.util.Constant;
|
import com.yeshi.fanli.util.StringUtil;
|
import com.yeshi.fanli.util.VersionUtil;
|
import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
|
import net.sf.json.JSONArray;
|
import net.sf.json.JSONObject;
|
|
@Service
|
public class ThreeSaleSerivceImpl implements ThreeSaleSerivce {
|
|
@Resource
|
private HongBaoManageService hongBaoManageService;
|
|
@Resource
|
private UserInfoService userInfoService;
|
|
@Resource
|
private UserInfoMapper userInfoMapper;
|
|
@Resource
|
private ThreeSaleMapper threeSaleMapper;
|
|
@Resource
|
private UserInviteMsgNotificationService userInviteMsgNotificationService;
|
|
@Resource
|
private MsgInviteDetailService msgInviteDetailService;
|
|
@Resource
|
private UserActiveLogService userActiveLogService;
|
|
@Resource
|
private UserInfoExtraService userInfoExtraService;
|
|
@Resource
|
private ThreeSaleExtraInfoSerivce threeSaleExtraInfoSerivce;
|
|
@Lazy
|
@Resource
|
private IntegralGetService integralGetService;
|
|
@Resource(name = "taskExecutor")
|
private TaskExecutor executor;
|
|
@Resource(name = "producer")
|
private Producer producer;
|
|
public UserInfo getBoss(final long uid) {
|
return threeSaleMapper.selectBoss(uid);
|
}
|
|
@Transactional
|
public void bind(UserInfo worker, UserInfo inviter) throws ThreeSaleException {
|
if (worker == null || inviter == null)
|
throw new ThreeSaleException(1, "用户信息为空");
|
|
if (worker.getId() == null)// 该用户还不存在
|
{
|
// 保存用户
|
UserInfo inviteeUser = userInfoService.addUser(worker, Constant.APPID);
|
if (inviteeUser == null)
|
throw new ThreeSaleException(2, "创建用户失败");
|
// 保存关系
|
ThreeSale threeSale = new ThreeSale();
|
threeSale.setBoss(inviter);
|
threeSale.setCreateTime(java.lang.System.currentTimeMillis());
|
threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
|
threeSale.setState(false);
|
threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
threeSale.setWorker(inviteeUser);
|
threeSaleMapper.insertSelective(threeSale);
|
|
List<ThreeSale> listExpire = threeSaleMapper.getExpireRecord(inviter.getId(), inviteeUser.getId());
|
if (listExpire != null && listExpire.size() > 0) {
|
// 删除失效
|
for (ThreeSale saleExpire : listExpire) {
|
msgInviteDetailService.deleteByThreeSale(saleExpire);
|
}
|
// 删除已失效关系
|
threeSaleMapper.deleteExpireRecord(inviter.getId(), inviteeUser.getId());
|
}
|
|
// 创建通知
|
userInviteMsgNotificationService.inviteScan(inviter.getId(), threeSale);
|
|
} else {// 是已经存在的用户
|
if (worker.getId().longValue() == inviter.getId())
|
throw new ThreeSaleException(4, "不能绑定自己");
|
|
worker = userInfoService.selectByPKey(worker.getId());
|
|
// 用户已经存在我们的用户库中
|
if (worker.getLastLoginTime() == null || worker.getLastLoginTime() == 0L) {
|
// 用户未登录
|
int outOfDateCount = 0;// 过期数量
|
// 查询邀请关系
|
List<ThreeSale> list = listByWorkerId(worker.getId());
|
if (list != null && list.size() > 0) {
|
for (ThreeSale ts : list) {
|
if (!ts.getState() && ts.getExpire() == ThreeSale.EXPIRE_OUTOFDATE) {
|
outOfDateCount++;
|
}
|
}
|
// 全部是失效状态
|
if (outOfDateCount == list.size()) {
|
// 可以确定关系
|
ThreeSale threeSale = new ThreeSale();
|
threeSale.setBoss(inviter);
|
threeSale.setCreateTime(java.lang.System.currentTimeMillis());
|
threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
|
threeSale.setState(false);
|
threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
threeSale.setWorker(worker);
|
threeSaleMapper.insertSelective(threeSale);
|
|
// 删除已失效关系
|
threeSaleMapper.deleteExpireRecord(inviter.getId(), worker.getId());
|
|
List<ThreeSale> listExpire = threeSaleMapper.getExpireRecord(inviter.getId(), worker.getId());
|
if (listExpire != null && listExpire.size() > 0) {
|
// 删除历史通知
|
for (ThreeSale saleExpire : listExpire) {
|
msgInviteDetailService.deleteByThreeSale(saleExpire);
|
}
|
// 删除已失效关系
|
threeSaleMapper.deleteExpireRecord(inviter.getId(), worker.getId());
|
}
|
|
userInviteMsgNotificationService.inviteScan(inviter.getId(), threeSale);
|
// threeSaleSerivce.bind(invitee, inviter);
|
|
} else {
|
// 还存在有效的邀请,则不做处理
|
}
|
} else {
|
// 用户未登录,又不存在邀请关系,不做处理
|
}
|
} else {
|
// 已经登录,而且没有上下级关系或者上下级关系未生效,则绑定关系
|
List<ThreeSale> list = threeSaleMapper.listByWorkerId(worker.getId());
|
// 删除无效的
|
if (list != null)
|
for (int i = 0; i < list.size(); i++) {
|
if (list.get(i).getState() != null && list.get(i).getState() == false
|
&& list.get(i).getExpire() == ThreeSale.EXPIRE_OUTOFDATE) {// 过期的
|
list.remove(i);
|
i--;
|
}
|
}
|
// 查询上级是否有和现在上级一样的
|
if (list == null || list.size() == 0)// 尚未确立关系,建立关系
|
{
|
ThreeSale ts = new ThreeSale();
|
ts.setBoss(inviter);
|
ts.setCreateTime(System.currentTimeMillis());
|
ts.setExpire(ThreeSale.EXPIRE_NORMAL);
|
ts.setState(true);
|
ts.setSucceedTime(System.currentTimeMillis());
|
ts.setWorker(worker);
|
threeSaleMapper.insertSelective(ts);
|
inviteSuccess(inviter.getId(), worker.getId(), ts);
|
} else {
|
if (!list.get(0).getState() && list.get(0).getExpire() == ThreeSale.EXPIRE_NORMAL
|
&& list.get(0).getBoss().getId() == inviter.getId().longValue()) {// 未生效的上级和现在上级一样就生效
|
ThreeSale update = new ThreeSale(list.get(0).getId());
|
update.setState(true);
|
update.setSucceedTime(System.currentTimeMillis());
|
threeSaleMapper.updateByPrimaryKeySelective(update);
|
inviteSuccess(list.get(0).getBoss().getId(), list.get(0).getWorker().getId(), list.get(0));
|
}
|
}
|
}
|
}
|
}
|
|
@Transactional
|
public void effective(UserInfo worker) {
|
List<ThreeSale> list = threeSaleMapper.listByWorkerId(worker.getId());
|
if (list != null)
|
for (int i = 0; i < list.size(); i++) {
|
if (list.get(i).getState() != null && list.get(i).getState() == false
|
&& list.get(i).getExpire() == ThreeSale.EXPIRE_NORMAL) {
|
;
|
} else {
|
list.remove(i);
|
i--;
|
}
|
}
|
if (list.size() > 0) {
|
ThreeSale oldSale = list.get(0);
|
|
ThreeSale update = new ThreeSale(list.get(0).getId());
|
update.setState(true);
|
update.setSucceedTime(System.currentTimeMillis());
|
threeSaleMapper.updateByPrimaryKeySelective(update);
|
|
oldSale.setState(update.getState());
|
oldSale.setSucceedTime(update.getSucceedTime());
|
|
// 不以邀请人数计算等级
|
// if (inviter != null)
|
// reComputeUserRank(inviter.getId());
|
// 添加到队列
|
inviteSuccess(oldSale.getBoss().getId(), oldSale.getWorker().getId(), oldSale);
|
}
|
}
|
|
@Override
|
public long getFirstUsersCount(Long uid) {
|
return threeSaleMapper.countFirstTeam(uid, null);
|
}
|
|
@Override
|
public long getSecondUsersCount(Long uid) {
|
return threeSaleMapper.countSecondTeam(uid, null);
|
}
|
|
@Override
|
public List<ThreeSale> queryMyFirstTeamList(int start, int count, String key, Long bossId) {
|
return threeSaleMapper.queryMyFirstTeamList(start, count, key, bossId);
|
}
|
|
@Override
|
public long queryCountMyFirstTeamList(String key, Long bossId) {
|
return threeSaleMapper.queryCountMyFirstTeamList(key, bossId);
|
}
|
|
@Override
|
public List<ThreeSale> queryMySecondTeamList(int start, int count, String key, Long bossId) {
|
return threeSaleMapper.queryMySecondTeamList(start, count, key, bossId);
|
}
|
|
@Override
|
public long queryCountMySecondTeamList(String key, Long bossId) {
|
return threeSaleMapper.queryCountMySecondTeamList(key, bossId);
|
}
|
|
@Override
|
public int deleteByPrimaryKey(Long id) {
|
return threeSaleMapper.deleteByPrimaryKey(id);
|
}
|
|
@Override
|
public List<Long> queryLongTimeFailed(int daysNum) {
|
return threeSaleMapper.queryLongTimeFailed(daysNum);
|
}
|
|
@Override
|
public List<ThreeSale> queryLongTimeSuccess(int daysNum) {
|
return threeSaleMapper.queryLongTimeSuccess(daysNum);
|
}
|
|
@Override
|
public int updateExpire(List<Long> list) {
|
return threeSaleMapper.updateExpire(list);
|
}
|
|
@Override
|
public List<ThreeSale> listFirstTeamQuery(long start, int count, Long uid, Integer state, String startTime,
|
String endTime) {
|
return threeSaleMapper.listFirstTeamQuery(start, count, uid, state, startTime, endTime);
|
}
|
|
@Override
|
public long countFirstTeamQuery(Long uid, Integer state, String startTime, String endTime) {
|
return threeSaleMapper.countFirstTeamQuery(uid, state, startTime, endTime);
|
}
|
|
@Override
|
public List<ThreeSale> listSecondTeamQuery(long start, int count, Long uid, Integer state, String startTime,
|
String endTime) {
|
return threeSaleMapper.listSecondTeamQuery(start, count, uid, state, startTime, endTime);
|
}
|
|
@Override
|
public long countSecondTeamQuery(Long uid, Integer state, String startTime, String endTime) {
|
return threeSaleMapper.countSecondTeamQuery(uid, state, startTime, endTime);
|
}
|
|
@Override
|
public List<ThreeSale> listSuperiorQuery(long start, int count, Integer state, Long uid) {
|
return threeSaleMapper.listSuperiorQuery(start, count, state, uid);
|
}
|
|
@Override
|
public long countSuperiorQuery(Integer state, Long uid) {
|
return threeSaleMapper.countSuperiorQuery(state, uid);
|
}
|
|
@Override
|
public long countFirstTeam(Long uid, Integer state) {
|
return threeSaleMapper.countFirstTeam(uid, state);
|
}
|
|
@Override
|
public long countSecondTeam(Long uid, Integer state) {
|
return threeSaleMapper.countSecondTeam(uid, state);
|
}
|
|
@Override
|
public ThreeSale getMyBoss(Long uid) {
|
return threeSaleMapper.getMyBoss(uid);
|
}
|
|
@Override
|
public ThreeSale selectByPrimaryKey(Long id) {
|
return threeSaleMapper.selectByPrimaryKey(id);
|
}
|
|
@Override
|
public List<ThreeSale> listbyIdAndBossId(Long id, Long uid, Integer expire) {
|
return threeSaleMapper.listbyIdAndBossId(id, uid, expire);
|
}
|
|
@Override
|
public JSONObject getMyFirstTeam(long start, int count, Long uid, Integer state) {
|
|
List<ThreeSale> list = threeSaleMapper.listFirstTeam(start, count, uid, state);
|
if (list == null) {
|
list = new ArrayList<ThreeSale>();
|
}
|
|
long countTotal = threeSaleMapper.countFirstTeam(uid, state);
|
|
return organizeTeam(countTotal, list);
|
}
|
|
@Override
|
public JSONObject getMySecondTeam(long start, int count, Long uid, Integer state) {
|
List<ThreeSale> list = threeSaleMapper.listSecondTeam(start, count, uid, state);
|
if (list == null) {
|
list = new ArrayList<ThreeSale>();
|
}
|
|
long countTotal = threeSaleMapper.countSecondTeam(uid, state);
|
|
return organizeTeam(countTotal, list);
|
}
|
|
public JSONObject organizeTeam(long count, List<ThreeSale> list) {
|
|
JSONObject result = new JSONObject();
|
|
JSONArray resultArray = new JSONArray();
|
|
for (ThreeSale threeSale : list) {
|
JSONObject object = new JSONObject();
|
SimpleDateFormat sdf = new SimpleDateFormat("MM.dd HH:mm");
|
SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
SimpleDateFormat formatYears = new SimpleDateFormat("yyyy");
|
|
Date todayTime = new Date();
|
// 邀请id
|
object.put("inviteId", threeSale.getId());
|
|
// 加入队列时间
|
Long createTime = threeSale.getCreateTime();
|
Date inviteTime = new Date(createTime);
|
object.put("inviteTime", format.format(inviteTime) + " 加入");
|
|
String memoName = "";
|
ThreeSaleExtraInfo threeSaleExtraInfo = threeSale.getThreeSaleExtraInfo();
|
if (threeSaleExtraInfo != null) {
|
if (!StringUtil.isNullOrEmpty(threeSaleExtraInfo.getNickname())) {
|
memoName = threeSaleExtraInfo.getNickname();
|
}
|
}
|
object.put("memoName", memoName);
|
|
String nickName = "";
|
String portrait = "";
|
Long lastLoginTime = null;
|
|
UserInfo worker = threeSale.getWorker();
|
if (worker != null) {
|
portrait = worker.getPortrait();
|
lastLoginTime = worker.getLastLoginTime();
|
nickName = worker.getNickName();
|
}
|
object.put("nickName", nickName);
|
object.put("portrait", portrait);
|
|
int state = 0;
|
String fontColor1 = "#888888";
|
String fontColor2 = "#F14242";
|
|
JSONArray array = new JSONArray();
|
if (threeSale.getState()) {
|
state = 1;
|
if (lastLoginTime == null) {
|
lastLoginTime = threeSale.getCreateTime();
|
}
|
|
JSONObject contentJson = new JSONObject();
|
contentJson.put("color", fontColor1);
|
|
if (formatYears.format(todayTime).equals(formatYears.format(lastLoginTime))) {
|
// 本年
|
contentJson.put("content", "最近登录 " + sdf.format(lastLoginTime));
|
} else {
|
// 往年
|
contentJson.put("content", "最近登录 " + format.format(lastLoginTime));
|
}
|
|
array.add(contentJson);
|
|
} else if (threeSale.getExpire() != null
|
&& (threeSale.getExpire() == 1 || threeSale.getExpire().equals(1))) {
|
state = 2;
|
JSONObject contentJson = new JSONObject();
|
contentJson.put("color", fontColor1);
|
contentJson.put("content", "已经脱离邀请关系");
|
array.add(contentJson);
|
} else {
|
state = 0;
|
|
Calendar c = Calendar.getInstance();
|
c.setTime(inviteTime);
|
c.add(Calendar.DAY_OF_MONTH, 60);// 邀请不超过60天
|
|
long days = (c.getTimeInMillis() - todayTime.getTime()) / (1000 * 3600 * 24);
|
if (days < 0) {
|
days = 0;
|
}
|
|
JSONObject contentJson1 = new JSONObject();
|
contentJson1.put("color", fontColor1);
|
contentJson1.put("content", "将于");
|
|
JSONObject contentJson2 = new JSONObject();
|
contentJson2.put("color", fontColor2);
|
contentJson2.put("content", days + "天");
|
|
JSONObject contentJson3 = new JSONObject();
|
contentJson3.put("color", fontColor1);
|
contentJson3.put("content", "后脱离邀请关系");
|
|
array.add(contentJson1);
|
array.add(contentJson2);
|
array.add(contentJson3);
|
}
|
|
object.put("state", state);
|
object.put("recentMsg", array);
|
|
resultArray.add(object);
|
}
|
|
result.put("count", count);
|
result.put("result_list", resultArray);
|
|
return result;
|
}
|
|
@Override
|
public List<ThreeSale> listByWorkerId(Long workerId) {
|
return threeSaleMapper.listByWorkerId(workerId);
|
}
|
|
@Override
|
public int getSuccessRelationshipNum(Long uid) {
|
return threeSaleMapper.getSuccessRelationshipNum(uid);
|
}
|
|
@Override
|
@Transactional
|
public void bindRelationshipByInviteCode(UserInfo invitee, UserInfo inviter) throws ThreeSaleException {
|
|
if (invitee == null || inviter == null)
|
throw new ThreeSaleException(1, "用户信息为空");
|
|
// 获取有效的邀请关系
|
ThreeSale threeSale = threeSaleMapper.getRelationshipByBossIdAndWorkerId(inviter.getId(), invitee.getId());
|
|
if (threeSale != null) {
|
// 有效关系--生效
|
threeSale.setBoss(inviter);
|
threeSale.setWorker(invitee);
|
threeSale.setState(true);
|
threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
|
threeSale.setSucceedTime(java.lang.System.currentTimeMillis());
|
threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
threeSaleMapper.updateByPrimaryKeySelective(threeSale);
|
} else {
|
// 新建立确定关系
|
threeSale = new ThreeSale();
|
threeSale.setBoss(inviter);
|
threeSale.setWorker(invitee);
|
threeSale.setState(true);
|
threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
|
threeSale.setSucceedTime(java.lang.System.currentTimeMillis());
|
threeSale.setCreateTime(java.lang.System.currentTimeMillis());
|
threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
threeSaleMapper.insertSelective(threeSale);
|
}
|
|
List<ThreeSale> listExpire = threeSaleMapper.getExpireRecord(inviter.getId(), invitee.getId());
|
if (listExpire != null && listExpire.size() > 0) {
|
// 删除历史通知
|
for (ThreeSale saleExpire : listExpire) {
|
msgInviteDetailService.deleteByThreeSale(saleExpire);
|
}
|
// 删除已失效关系
|
threeSaleMapper.deleteExpireRecord(inviter.getId(), invitee.getId());
|
}
|
|
inviteSuccess(inviter.getId(), invitee.getId(), threeSale);
|
}
|
|
@Override
|
@Transactional
|
public void bindRelationshipByWX(UserInfo invitee, Long inviterId, ThreeSale threeSaleOld)
|
throws ThreeSaleException {
|
|
if (invitee == null || (inviterId == null && threeSaleOld == null))
|
throw new ThreeSaleException(1, "用户信息为空");
|
|
ThreeSale threeSale = null;
|
if (inviterId != null) {
|
// 新建立确定关系
|
threeSale = new ThreeSale();
|
threeSale.setBoss(new UserInfo(inviterId));
|
threeSale.setWorker(invitee);
|
threeSale.setState(true);
|
threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
|
threeSale.setSucceedTime(java.lang.System.currentTimeMillis());
|
threeSale.setCreateTime(java.lang.System.currentTimeMillis());
|
threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
threeSaleMapper.insertSelective(threeSale);
|
|
// 邀请关系失效 1.5.3 之前失效
|
if (threeSaleOld != null) {
|
ThreeSale three = new ThreeSale();
|
three.setId(threeSaleOld.getId());
|
three.setExpire(ThreeSale.EXPIRE_OUTOFDATE);
|
three.setUpdateTime(java.lang.System.currentTimeMillis());
|
threeSaleMapper.updateByPrimaryKeySelective(three);
|
}
|
} else if (threeSaleOld != null && inviterId == null) {
|
// 1.5.3 之前生效
|
threeSaleOld.setState(true);
|
threeSaleOld.setExpire(ThreeSale.EXPIRE_NORMAL);
|
threeSaleOld.setSucceedTime(java.lang.System.currentTimeMillis());
|
threeSaleOld.setUpdateTime(java.lang.System.currentTimeMillis());
|
threeSaleMapper.updateByPrimaryKeySelective(threeSaleOld);
|
|
threeSale = threeSaleOld;
|
}
|
|
if (threeSale == null) {
|
throw new ThreeSaleException(1, "关系绑定失败");
|
}
|
|
UserInfo boss = userInfoService.selectByPKey(threeSale.getBoss().getId());
|
threeSale.setBoss(boss);
|
threeSale.setWorker(invitee);
|
|
inviteSuccess(boss.getId(), invitee.getId(), threeSale);
|
|
}
|
|
/**
|
* 邀请成功
|
*/
|
@Transactional
|
private void inviteSuccess(Long bossId, Long workerId, ThreeSale threeSale) {
|
// 邀请消息
|
UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(bossId);
|
if (activeLog != null && VersionUtil.greaterThan_2_1("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android",
|
activeLog.getVersionCode())) { // 2.1版本以上
|
userInviteMsgNotificationService.inviteSuccess2_1(bossId, threeSale);
|
} else { // 最初消息
|
userInviteMsgNotificationService.inviteSuccess(threeSale.getBoss().getId(), threeSale);
|
}
|
|
executor.execute(new Runnable() {
|
@Override
|
public void run() {
|
// 邀请金币
|
integralGetService.addInviteLevelOne(bossId, workerId);
|
}
|
});
|
UserInviteMQMsg msg = new UserInviteMQMsg(bossId, workerId, null, new Date(), UserInviteMQMsg.STATE_SUCCESS);
|
Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.inviteSuccess,
|
msg);
|
producer.send(message);
|
}
|
|
/**
|
* 根据邀请者查询关系
|
*
|
* @param workerId
|
* @return
|
*/
|
@Override
|
public ThreeSale getByWorkerId(Long workerId) {
|
return threeSaleMapper.getByWorkerId(workerId);
|
}
|
|
@Override
|
public long countSuccessFirstTeam(Long uid) {
|
return threeSaleMapper.countFirstTeam(uid, 1);
|
}
|
|
@Override
|
public ThreeSale selectByWorkerId(Long workerId) {
|
return threeSaleMapper.selectSuccessByWorkerId(workerId);
|
}
|
|
@Override
|
public List<ThreeSale> getSuccessByDate(Long bossId, Long minTime, Long maxTime) {
|
return threeSaleMapper.getSuccessByDate(bossId, minTime, maxTime);
|
}
|
|
@Override
|
public List<ThreeSale> listFirstTeam(long start, int count, Long uid, Integer state) {
|
return threeSaleMapper.listFirstTeam(start, count, uid, state);
|
}
|
|
@Override
|
public List<ThreeSale> listSecondTeam(long start, int count, Long uid, Integer state) {
|
return threeSaleMapper.listSecondTeam(start, count, uid, state);
|
}
|
|
@Override
|
public ThreeSale selectLatestByWorkerIdAndState(Long workerId, int state) {
|
return threeSaleMapper.selectLatestByWorkerIdAndState(workerId, state);
|
}
|
|
@Override
|
public ThreeSale getByWorkerIdAndTime(Long workerId, long time) {
|
return threeSaleMapper.getByWorkerIdAndTime(workerId, time);
|
}
|
}
|