| | |
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.user.invite.TeamDailyRecordDao;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TeamDailyRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.invite.TeamDailyRecord;
|
| | | import com.yeshi.fanli.exception.user.TeamDailyRecordException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.invite.TeamDailyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | |
|
| | | @Service
|
| | | public class TeamDailyRecordServiceImpl implements TeamDailyRecordService {
|
| | |
| | |
|
| | | // id
|
| | | record.setId(id);
|
| | | TeamDailyRecord teamDaily = teamDailyRecordDao.getById(id);
|
| | | TeamDailyRecord teamDaily = teamDailyRecordDao.get(id);
|
| | | if (teamDaily != null) {
|
| | | teamDailyRecordDao.updateSelective(record);
|
| | | } else {
|
| | |
| | | teamDailyRecordDao.save(record);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String createId(Long uid, Date date) {
|
| | | String gernalTime = TimeUtil.getGernalTime(date.getTime());
|
| | | return StringUtil.Md5(uid + "#" + gernalTime);
|
| | | }
|
| | |
|
| | |
|
| | | |
| | | @Override
|
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | public void addDailyRecord(Long uid) {
|
| | | // 重新统计队员等级数量
|
| | | recountRecord(uid);
|
| | |
|
| | | // 统计上级队员数量
|
| | | ThreeSale threeSale = threeSaleSerivce.getByWorkerId(uid);
|
| | | if (threeSale != null) {
|
| | | recountRecord(threeSale.getBoss().getId());
|
| | | }
|
| | | }
|
| | |
|
| | | private void recountRecord(Long uid) {
|
| | | try {
|
| | | // 直接粉丝
|
| | | int firstCount = (int) threeSaleSerivce.countFirstTeamByDate(uid, 1);
|
| | | // 间接粉丝
|
| | | int secondCount = (int) threeSaleSerivce.countSecondTeamByDate(uid, 1);
|
| | |
|
| | | int secondBeyond = 0;
|
| | | |
| | | |
| | | } catch (Exception e) {
|
| | | e.getSuppressed();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TeamDailyRecord> getbyUid(Long uid) {
|
| | | return teamDailyRecordDao.getbyUid(uid);
|
| | | public TeamDailyRecord getById(String id) {
|
| | | return teamDailyRecordDao.get(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TeamDailyRecord> getbyUid(Long uid, Date minTime) {
|
| | | return teamDailyRecordDao.getbyUid(uid, minTime);
|
| | | public List<TeamDailyRecord> getByUid(Long uid) {
|
| | | return teamDailyRecordDao.getByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TeamDailyRecord> listByUid(Long uid, Date minTime, Date maxTime) {
|
| | | return teamDailyRecordDao.listByUid(uid, minTime, maxTime);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<TeamDailyRecord> sumGroupByYearMonth(Long uid, Date minTime, Date maxTime) {
|
| | | return teamDailyRecordDao.sumGroupByYearMonth(uid, minTime, maxTime);
|
| | | }
|
| | | }
|