| | |
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.integral.CodePublishRecordMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.integral.CodePublishRecord;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.CodePublishRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private CodePublishRecordMapper codePublishRecordMapper;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Override
|
| | | public CodePublishRecord selectByPrimaryKey(Long id) {
|
| | | return codePublishRecordMapper.selectByPrimaryKey(id);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void publishInviteCode(Long uid) {
|
| | | CodePublishRecord codePublishRecord = new CodePublishRecord();
|
| | |
| | | codePublishRecord.setCreateTime(new Date());
|
| | | codePublishRecordMapper.insertSelective(codePublishRecord);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public long countValidRecord(Long uid){
|
| | | public long countValidRecord(Long uid) {
|
| | | return codePublishRecordMapper.countValidRecord(uid, CodePublishRecord.VALIDTIME);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public List<CodePublishRecord> listValid(long start, int count) {
|
| | | |
| | | List<CodePublishRecord> listValid = codePublishRecordMapper.listValid(start, count, CodePublishRecord.VALIDTIME);
|
| | | public List<CodePublishRecord> listValid(Long uid, long start, int count) {
|
| | |
|
| | | List<CodePublishRecord> listValid = codePublishRecordMapper.listValid(uid, start, count,
|
| | | CodePublishRecord.VALIDTIME);
|
| | | if (listValid == null || listValid.size() == 0) {
|
| | | return listValid;
|
| | | }
|
| | | |
| | | for (int i = 0; i < listValid.size(); i ++) {
|
| | |
|
| | | for (int i = 0; i < listValid.size(); i++) {
|
| | | CodePublishRecord codePublishRecord = listValid.get(i);
|
| | | String inviteCode = codePublishRecord.getInviteCode();
|
| | | if (StringUtil.isNullOrEmpty(inviteCode)) {
|
| | |
| | | i--;
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | String index = inviteCode.substring(0, 1);
|
| | | String end = inviteCode.substring(inviteCode.length()-1, inviteCode.length());
|
| | | String end = inviteCode.substring(inviteCode.length() - 1, inviteCode.length());
|
| | | codePublishRecord.setInviteCode("TA的邀请码:" + index + "****" + end);
|
| | | |
| | |
|
| | | String nickName = codePublishRecord.getNickName();
|
| | | if(StringUtil.isNullOrEmpty(nickName)) {
|
| | | if (StringUtil.isNullOrEmpty(nickName)) {
|
| | | nickName = "K****6";
|
| | | } else if (nickName.length() == 1) {
|
| | | // 一个字
|
| | |
| | | } else {
|
| | | // 两个字及其以上
|
| | | String index2 = nickName.substring(0, 1);
|
| | | String end2 = nickName.substring(nickName.length()-1, nickName.length());
|
| | | String end2 = nickName.substring(nickName.length() - 1, nickName.length());
|
| | | nickName = index2 + "****" + end2;
|
| | | }
|
| | | codePublishRecord.setNickName(nickName);
|
| | | |
| | | long firstTeam = threeSaleSerivce.countFirstTeam(codePublishRecord.getUid(), 1);
|
| | | long secondTeam = threeSaleSerivce.countSecondTeam(codePublishRecord.getUid(), 1);
|
| | |
|
| | | UserInfo user = userInfoService.selectByPKey(codePublishRecord.getUid());
|
| | |
|
| | | long firstTeam = threeSaleSerivce.countFirstTeam(codePublishRecord.getUid());
|
| | | long secondTeam = threeSaleSerivce.countSecondTeam(codePublishRecord.getUid());
|
| | | codePublishRecord.setTeam(firstTeam + secondTeam);
|
| | | if (user != null && user.getType() == 1) {// 假用户
|
| | | long s = Integer
|
| | | .parseInt((180 * (6365705L - codePublishRecord.getUid()) / (6365705L - 6315822L) + 20) + "");
|
| | | codePublishRecord.setTeam(s + codePublishRecord.getTeam());
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | return listValid;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CodePublishRecord> listByMinTime(long start, int count, Date minTime) {
|
| | | return codePublishRecordMapper.listByMinTime(start, count, minTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countValid() {
|
| | | return codePublishRecordMapper.countValid(CodePublishRecord.VALIDTIME);
|
| | | }
|
| | |
|
| | | |
| | | }
|