|
@@ -3,8 +3,10 @@ package com.fs.activity.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fs.activity.domain.AccActivity;
|
|
import com.fs.activity.domain.AccActivity;
|
|
|
|
|
+import com.fs.activity.domain.AccPrizeInfo;
|
|
|
import com.fs.activity.domain.AccTeam;
|
|
import com.fs.activity.domain.AccTeam;
|
|
|
import com.fs.activity.domain.AccTeamMember;
|
|
import com.fs.activity.domain.AccTeamMember;
|
|
|
|
|
+import com.fs.activity.mapper.AccPrizeInfoMapper;
|
|
|
import com.fs.activity.mapper.AccTeamMemberMapper;
|
|
import com.fs.activity.mapper.AccTeamMemberMapper;
|
|
|
import com.fs.activity.param.AccTeamMemberRequest;
|
|
import com.fs.activity.param.AccTeamMemberRequest;
|
|
|
import com.fs.activity.service.AccActivityService;
|
|
import com.fs.activity.service.AccActivityService;
|
|
@@ -12,17 +14,23 @@ import com.fs.activity.service.AccTeamService;
|
|
|
import com.fs.activity.mapper.AccTeamMapper;
|
|
import com.fs.activity.mapper.AccTeamMapper;
|
|
|
import com.fs.activity.utils.CodeGenerator;
|
|
import com.fs.activity.utils.CodeGenerator;
|
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
|
|
|
+import com.fs.course.domain.FsUserCompanyUser;
|
|
|
import com.fs.im.service.OpenIMService;
|
|
import com.fs.im.service.OpenIMService;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @author Administrator
|
|
* @author Administrator
|
|
|
* @description 针对表【acc_team(团队表)】的数据库操作Service实现
|
|
* @description 针对表【acc_team(团队表)】的数据库操作Service实现
|
|
|
* @createDate 2026-03-05 14:33:08
|
|
* @createDate 2026-03-05 14:33:08
|
|
|
*/
|
|
*/
|
|
|
@Service
|
|
@Service
|
|
|
|
|
+@Slf4j
|
|
|
public class AccTeamServiceImpl extends ServiceImpl<AccTeamMapper, AccTeam>
|
|
public class AccTeamServiceImpl extends ServiceImpl<AccTeamMapper, AccTeam>
|
|
|
implements AccTeamService{
|
|
implements AccTeamService{
|
|
|
|
|
|
|
@@ -35,6 +43,9 @@ public class AccTeamServiceImpl extends ServiceImpl<AccTeamMapper, AccTeam>
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private OpenIMService openIMService;
|
|
private OpenIMService openIMService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private AccPrizeInfoMapper accPrizeInfoMapper;
|
|
|
|
|
+
|
|
|
private final static Integer TEAM_MAX_MEMBER_COUNT = 26;
|
|
private final static Integer TEAM_MAX_MEMBER_COUNT = 26;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -67,12 +78,18 @@ public class AccTeamServiceImpl extends ServiceImpl<AccTeamMapper, AccTeam>
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public R signUpLeader(AccTeam accTeam) {
|
|
public R signUpLeader(AccTeam accTeam) {
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // 1.检查活动状态
|
|
|
R r=accActivityService.checkActivitySignUpStatus(accTeam.getActivityId());
|
|
R r=accActivityService.checkActivitySignUpStatus(accTeam.getActivityId());
|
|
|
if(!r.get("code").equals(200)){
|
|
if(!r.get("code").equals(200)){
|
|
|
return r;
|
|
return r;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 2.检查是否绑定销售
|
|
|
|
|
+ r=accActivityService.checkBindCompanyUser(accTeam.getLeaderId());
|
|
|
|
|
+ if(!r.get("code").equals(200)){
|
|
|
|
|
+ return r;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
accTeam.setTeamCode(CodeGenerator.generateTeamCode(accTeam.getActivityId()));
|
|
accTeam.setTeamCode(CodeGenerator.generateTeamCode(accTeam.getActivityId()));
|
|
|
accTeam.setMemberCount(1);
|
|
accTeam.setMemberCount(1);
|
|
|
if(baseMapper.insert(accTeam)<=0){
|
|
if(baseMapper.insert(accTeam)<=0){
|
|
@@ -88,6 +105,11 @@ public class AccTeamServiceImpl extends ServiceImpl<AccTeamMapper, AccTeam>
|
|
|
throw new RuntimeException("创建队员失败");
|
|
throw new RuntimeException("创建队员失败");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 申请领取参与奖
|
|
|
|
|
+ List<FsUserCompanyUser> userCompanyUserList = (List<FsUserCompanyUser>)r.get("data");
|
|
|
|
|
+ registerPrizeInfo(accTeam.getActivityId(),accTeam.getLeaderId(),accTeam.getId(), userCompanyUserList);
|
|
|
|
|
+
|
|
|
// 异步发送im消息推送
|
|
// 异步发送im消息推送
|
|
|
String userId=String.valueOf(accTeam.getLeaderId());
|
|
String userId=String.valueOf(accTeam.getLeaderId());
|
|
|
StringBuilder textBuilder=new StringBuilder();
|
|
StringBuilder textBuilder=new StringBuilder();
|
|
@@ -99,6 +121,43 @@ public class AccTeamServiceImpl extends ServiceImpl<AccTeamMapper, AccTeam>
|
|
|
return R.ok().put("data",accTeam);
|
|
return R.ok().put("data",accTeam);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @Description: 登记奖励信息
|
|
|
|
|
+ * @Param:
|
|
|
|
|
+ * @Return:
|
|
|
|
|
+ * @Author xgb
|
|
|
|
|
+ * @Date 2026/3/12 18:18
|
|
|
|
|
+ */
|
|
|
|
|
+ @Async
|
|
|
|
|
+ public void registerPrizeInfo(Long activityId, Long userId, Long teamId, List<FsUserCompanyUser> userCompanyUserList) {
|
|
|
|
|
+ AccPrizeInfo info=accPrizeInfoMapper.selectByUserIdAndActivityId(userId,activityId);
|
|
|
|
|
+ if (info != null ) {
|
|
|
|
|
+ log.error("用户已领取过奖品,不进行重新登记");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 登记信息领取报名奖励
|
|
|
|
|
+ AccPrizeInfo accPrizeInfo = new AccPrizeInfo();
|
|
|
|
|
+ accPrizeInfo.setActivityId(activityId);
|
|
|
|
|
+ accPrizeInfo.setTeamId(teamId);
|
|
|
|
|
+ accPrizeInfo.setUserId(userId);
|
|
|
|
|
+ accPrizeInfo.setPrizeId(0L); // 参与奖登记 0
|
|
|
|
|
+ accPrizeInfo.setPrizeName("健步鞋"); // 健步鞋
|
|
|
|
|
+ accPrizeInfo.setPrizeLevel("参与奖");
|
|
|
|
|
+ accPrizeInfo.setStatus(0);// 待审核
|
|
|
|
|
+ if(userCompanyUserList.size()>1){
|
|
|
|
|
+ String auditRemark="该用户为多项目用户,请审核!";
|
|
|
|
|
+ accPrizeInfo.setAuditRemark(auditRemark);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ accPrizeInfo.setCompanyId(userCompanyUserList.get(0).getCompanyId());
|
|
|
|
|
+ accPrizeInfo.setCompanyUserId(userCompanyUserList.get(0).getCompanyUserId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(accPrizeInfoMapper.insert(accPrizeInfo)<=0){
|
|
|
|
|
+ throw new RuntimeException("创建报名奖励失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @Description: 普通队员报名
|
|
* @Description: 普通队员报名
|
|
|
* @Param:
|
|
* @Param:
|
|
@@ -114,6 +173,12 @@ public class AccTeamServiceImpl extends ServiceImpl<AccTeamMapper, AccTeam>
|
|
|
return r;
|
|
return r;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 2.检查是否绑定销售
|
|
|
|
|
+ r=accActivityService.checkBindCompanyUser(accTeam.getUserId());
|
|
|
|
|
+ if(!r.get("code").equals(200)){
|
|
|
|
|
+ return r;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 获取领队信息 更具队伍码
|
|
// 获取领队信息 更具队伍码
|
|
|
AccTeam team=baseMapper.selectOne(new LambdaQueryWrapper<AccTeam>()
|
|
AccTeam team=baseMapper.selectOne(new LambdaQueryWrapper<AccTeam>()
|
|
|
.eq(AccTeam::getTeamCode, accTeam.getTeamCode()));
|
|
.eq(AccTeam::getTeamCode, accTeam.getTeamCode()));
|
|
@@ -173,6 +238,11 @@ public class AccTeamServiceImpl extends ServiceImpl<AccTeamMapper, AccTeam>
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 申请领取参与奖
|
|
|
|
|
+ List<FsUserCompanyUser> userCompanyUserList = (List<FsUserCompanyUser>)r.get("data");
|
|
|
|
|
+ registerPrizeInfo(accTeam.getActivityId(),accTeam.getUserId(),team.getId(), userCompanyUserList);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// 异步发送im消息推送
|
|
// 异步发送im消息推送
|
|
|
String userId=String.valueOf(accTeam.getUserId());
|
|
String userId=String.valueOf(accTeam.getUserId());
|
|
|
StringBuilder textBuilder=new StringBuilder();
|
|
StringBuilder textBuilder=new StringBuilder();
|
|
@@ -200,7 +270,8 @@ public class AccTeamServiceImpl extends ServiceImpl<AccTeamMapper, AccTeam>
|
|
|
|
|
|
|
|
AccTeam team=baseMapper.selectTeamByUserIdAndActivityId(userId,activityId);
|
|
AccTeam team=baseMapper.selectTeamByUserIdAndActivityId(userId,activityId);
|
|
|
if (team== null){
|
|
if (team== null){
|
|
|
- return R.error().put("msg","您没有加入任何队伍");
|
|
|
|
|
|
|
+ // 前端需要通过201状态区分队伍是否创建
|
|
|
|
|
+ return R.error(201,"您没有加入任何队伍");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return R.ok().put("team",team);
|
|
return R.ok().put("team",team);
|