Merge remote-tracking branch 'origin/main'
This commit is contained in:
+12
-3
@@ -71,6 +71,7 @@ public class ClientGroupController {
|
||||
|
||||
/**
|
||||
* 查询自己在那个团队
|
||||
*
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
@@ -79,7 +80,7 @@ public class ClientGroupController {
|
||||
public Result info(Long activityId) {
|
||||
ActGroupUser groupUser = dao.fetch(ActGroupUser.class, Cnd.where(ActGroupUser::getUserId, "=", StpClientUtil.STP.getLoginIdAsLong())
|
||||
.and(ActGroupUser::getActivityId, "=", activityId));
|
||||
if(Lang.isEmpty(groupUser)){
|
||||
if (Lang.isEmpty(groupUser)) {
|
||||
return Result.error("您还没加入任何团队");
|
||||
}
|
||||
Sql sql = Sqls.create("select * from act_group where id=@id").setParam("id", groupUser.getGroupId());
|
||||
@@ -123,7 +124,7 @@ public class ClientGroupController {
|
||||
|
||||
@At("/list-team/?")
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
public Result listTeam(Long activityId){
|
||||
public Result listTeam(Long activityId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*,
|
||||
@@ -135,8 +136,16 @@ public class ClientGroupController {
|
||||
t1.activityId = @activityId
|
||||
GROUP BY
|
||||
t1.id
|
||||
""").setParam("activityId",activityId);
|
||||
""").setParam("activityId", activityId);
|
||||
List<NutMap> list = clientActivityService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
@At("/list-group-rank/?")
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
public Result listGroupRank(Long activityId) {
|
||||
List<ActGroup> groupList = dao.query(ActGroup.class, Cnd.where(ActGroup::getActivityId, "=", activityId).desc(ActGroup::getTotalScore));
|
||||
return Result.success(groupList);
|
||||
}
|
||||
}
|
||||
|
||||
+85
-3
@@ -1,24 +1,31 @@
|
||||
package com.budwk.app.module.activity.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.module.activity.models.ActGroup;
|
||||
import com.budwk.app.module.activity.models.ActUser;
|
||||
import com.budwk.app.module.activity.models.ActGroupUser;
|
||||
import com.budwk.app.module.activity.models.ActItemGroupScore;
|
||||
import com.budwk.app.module.activity.service.ActGroupService;
|
||||
import com.budwk.app.module.activity.service.ActUserService;
|
||||
import com.budwk.app.module.activity.vo.ActGroupVo;
|
||||
import com.budwk.app.module.activity.vo.ActUnGroupUserVo;
|
||||
import com.budwk.app.web.commons.slog.annotation.SLog;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -52,8 +59,37 @@ public class ActGroupController {
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.group")
|
||||
public Result pageData(PageForm pageForm, String activityId){
|
||||
return null;
|
||||
public Result pageData(PageForm pageForm, String activityId, String groupName){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ag.*,
|
||||
COUNT(agu.userId) AS groupNum,
|
||||
SUM(CASE WHEN u.sex = '男' THEN 1 ELSE 0 END) AS manNum,
|
||||
SUM(CASE WHEN u.sex = '女' THEN 1 ELSE 0 END) AS womanNum,
|
||||
MAX(CASE WHEN agu.isLeader = 1 THEN u.userName END) AS leaderName,
|
||||
MAX(CASE WHEN agu.isLeader = 1 THEN u.phone END) AS leaderPhone
|
||||
FROM
|
||||
act_group ag
|
||||
LEFT JOIN act_group_user agu ON agu.groupId = ag.id
|
||||
LEFT JOIN act_user u ON u.userId = agu.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("ag.activityId", "=", activityId);
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("u.userName", pageForm.getSearchKeyword());
|
||||
seg.orLike("u.phone", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (StrUtil.isNotBlank(groupName)) {
|
||||
cnd.and("ag,groupName", "like", "%" + groupName + "%");
|
||||
}
|
||||
cnd.asc("ag.sort");
|
||||
cnd.groupBy("ag.id");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> nutMaps = actGroupService.listMap(sql);
|
||||
return Result.success().addData(nutMaps);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +121,27 @@ public class ActGroupController {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("activity.group")
|
||||
@SLog(tag = "活动分组", msg = "删除分组")
|
||||
public Result doRemove(String id) {
|
||||
// 删除活动分组及分组的相关表格
|
||||
dao.clear(ActGroup.class, Cnd.where(ActGroup::getId, "=", id));
|
||||
dao.clear(ActGroupUser.class, Cnd.where(ActGroupUser::getGroupId, "=", id));
|
||||
dao.clear(ActItemGroupScore.class, Cnd.where(ActItemGroupScore::getGroupId, "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.group")
|
||||
public Result queryGroupList(String activityId){
|
||||
List<ActGroup> query = dao.query(ActGroup.class, Cnd.where(ActGroup::getActivityId, "=", activityId));
|
||||
return Result.success().addData(query);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.group")
|
||||
@SLog(tag = "活动分组", msg = "随机分组")
|
||||
@@ -93,4 +150,29 @@ public class ActGroupController {
|
||||
actGroupService.groupSetting(actGroupVo);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.group")
|
||||
public Result queryUnGroupUser(String activityId){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.*
|
||||
FROM
|
||||
act_un_group_user augu
|
||||
LEFT JOIN act_user u ON u.userId = augu.userId
|
||||
WHERE augu.activityId = @activityId
|
||||
""").setParam("activityId", activityId);
|
||||
List<NutMap> list = actUserService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.group")
|
||||
@SLog(tag = "活动分组", msg = "设置未分组人员")
|
||||
public Result unGroupUserSetting(ActUnGroupUserVo actUnGroupUserVo){
|
||||
actGroupService.unGroupUserSetting(actUnGroupUserVo);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
package com.budwk.app.module.activity.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.module.activity.models.Activity;
|
||||
import com.budwk.app.module.activity.models.ActivityItem;
|
||||
import com.budwk.app.module.activity.service.ActivitySignInQueryService;
|
||||
import com.budwk.app.module.activity.vo.page.ActSignInUserPageForm;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/4/30 15:29
|
||||
* @description
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/activity/itemApplyQuery")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
public class ActivityItemApplyQueryController {
|
||||
|
||||
@Inject
|
||||
private ActivitySignInQueryService activitySignInQueryService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("activity.itemApplyQuery")
|
||||
@Ok("beetl:/platform/activity/itemApplyQuery/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At()
|
||||
@SaCheckPermission("activity.signInUserQuery")
|
||||
public Result getActivityOptions(Integer year) {
|
||||
return Result.success(activitySignInQueryService.dao().query(Activity.class, Cnd.NEW().andEX("YEAR(startTime)", "=", year)));
|
||||
}
|
||||
|
||||
@At()
|
||||
@SaCheckPermission("activity.signInUserQuery")
|
||||
public Result getActivityItemOptions(Long activityId) {
|
||||
return Result.success(activitySignInQueryService.dao().query(ActivityItem.class, Cnd.where(ActivityItem::getActivityId, "=", activityId)));
|
||||
}
|
||||
|
||||
|
||||
@At()
|
||||
@SaCheckPermission("activity.signInUserQuery")
|
||||
public Result pageData(ActSignInUserPageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
au.*,
|
||||
ai.`name` itemName
|
||||
FROM
|
||||
act_item_user aiu
|
||||
LEFT JOIN activity_item ai ON ai.id = aiu.itemId
|
||||
LEFT JOIN `act_user` au ON aiu.userId = au.userId
|
||||
$condition
|
||||
""");
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.or("au.userName", "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
group.or("au.unitName", "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(group);
|
||||
}
|
||||
cnd.and("au.activityId", "=", pageForm.getActivityId());
|
||||
cnd.andEX("aiu.itemId", "=", pageForm.getItemId());
|
||||
cnd.asc("ai.`name`");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = activitySignInQueryService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("activity.signInUserQuery")
|
||||
public void doExport(ActSignInUserPageForm pageForm, HttpServletResponse response) {
|
||||
try {
|
||||
Activity activity = activitySignInQueryService.dao().fetch(Activity.class, Cnd.NEW().and("id", "=", pageForm.getActivityId()));
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
au.*,
|
||||
ai.`name` itemName
|
||||
FROM
|
||||
act_item_user aiu
|
||||
LEFT JOIN activity_item ai ON ai.id = aiu.itemId
|
||||
LEFT JOIN `act_user` au ON aiu.userId = au.userId
|
||||
$condition
|
||||
""");
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.or("au.userName", "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
group.or("au.unitName", "LIKE", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(group);
|
||||
}
|
||||
cnd.and("au.activityId", "=", pageForm.getActivityId());
|
||||
cnd.andEX("aiu.itemId", "=", pageForm.getItemId());
|
||||
cnd.asc("ai.`name`");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> nutMaps = activitySignInQueryService.listMap(sql);
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>() {{
|
||||
add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
add(new ExcelExportEntity("性别", "sex", 20));
|
||||
add(new ExcelExportEntity("职务", "position", 20));
|
||||
add(new ExcelExportEntity("身份证号码", "idCard", 20));
|
||||
add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
add(new ExcelExportEntity("参加单位名称", "unitName", 20));
|
||||
add(new ExcelExportEntity("参加项目", "itemName", 20));
|
||||
}};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String((activity.getTitle() + "签到数据表.xlsx").getBytes(StandardCharsets.UTF_8), "ISO8859-1"));
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, nutMaps);
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+9
-3
@@ -10,6 +10,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.module.activity.models.Activity;
|
||||
import com.budwk.app.module.activity.models.ActivityItem;
|
||||
import com.budwk.app.module.activity.service.ActivitySignInQueryService;
|
||||
import com.budwk.app.module.activity.vo.page.ActSignInUserPageForm;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -51,6 +52,12 @@ public class ActivitySignInQueryController {
|
||||
return Result.success(activitySignInQueryService.dao().query(Activity.class, Cnd.NEW().andEX("YEAR(startTime)", "=", year)));
|
||||
}
|
||||
|
||||
@At()
|
||||
@SaCheckPermission("activity.signInUserQuery")
|
||||
public Result getActivityItemOptions(Long activityId) {
|
||||
return Result.success(activitySignInQueryService.dao().query(ActivityItem.class, Cnd.where(ActivityItem::getActivityId, "=", activityId)));
|
||||
}
|
||||
|
||||
|
||||
@At()
|
||||
@SaCheckPermission("activity.signInUserQuery")
|
||||
@@ -73,7 +80,7 @@ public class ActivitySignInQueryController {
|
||||
}
|
||||
cnd.and("au.activityId", "=", pageForm.getActivityId());
|
||||
cnd.and("au.isSignIn", "=", 1);
|
||||
cnd.asc("au.actUserNo");
|
||||
cnd.desc("au.signInTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = activitySignInQueryService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
@@ -103,11 +110,10 @@ public class ActivitySignInQueryController {
|
||||
}
|
||||
cnd.and("au.activityId", "=", pageForm.getActivityId());
|
||||
cnd.and("au.isSignIn", "=", 1);
|
||||
cnd.asc("au.actUserNo");
|
||||
cnd.desc("au.signInTime");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> nutMaps = activitySignInQueryService.listMap(sql);
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>() {{
|
||||
add(new ExcelExportEntity("报名号", "actUserNo", 20));
|
||||
add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
add(new ExcelExportEntity("性别", "sex", 20));
|
||||
add(new ExcelExportEntity("职务", "position", 20));
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.budwk.app.module.activity.service;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.module.activity.models.ActGroup;
|
||||
import com.budwk.app.module.activity.vo.ActGroupVo;
|
||||
import com.budwk.app.module.activity.vo.ActUnGroupUserVo;
|
||||
|
||||
/**
|
||||
* @ClassName ActGroupService
|
||||
@@ -14,5 +15,15 @@ import com.budwk.app.module.activity.vo.ActGroupVo;
|
||||
public interface ActGroupService extends BaseService<ActGroup> {
|
||||
|
||||
|
||||
/**
|
||||
* 活动分组
|
||||
* @param groupVo
|
||||
*/
|
||||
void groupSetting(ActGroupVo groupVo);
|
||||
|
||||
/**
|
||||
* 设置未分组人员
|
||||
* @param unGroupUserVo
|
||||
*/
|
||||
void unGroupUserSetting(ActUnGroupUserVo unGroupUserVo);
|
||||
}
|
||||
|
||||
+96
-13
@@ -1,22 +1,19 @@
|
||||
package com.budwk.app.module.activity.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.module.activity.models.ActGroup;
|
||||
import com.budwk.app.module.activity.models.ActGroupUser;
|
||||
import com.budwk.app.module.activity.models.ActUnGroupUser;
|
||||
import com.budwk.app.module.activity.models.ActUser;
|
||||
import com.budwk.app.module.activity.models.*;
|
||||
import com.budwk.app.module.activity.service.ActGroupService;
|
||||
import com.budwk.app.module.activity.vo.ActGroupVo;
|
||||
import com.budwk.app.module.activity.vo.ActUnGroupUserVo;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@@ -42,6 +39,7 @@ public class ActGroupServiceImpl extends BaseServiceImpl<ActGroup> implements Ac
|
||||
dao().clear(ActGroup.class, Cnd.where(ActGroup::getActivityId, "=", groupVo.getActivityId()));
|
||||
dao().clear(ActGroupUser.class, Cnd.where(ActGroupUser::getActivityId, "=", groupVo.getActivityId()));
|
||||
dao().clear(ActUnGroupUser.class, Cnd.where(ActUnGroupUser::getActivityId, "=", groupVo.getActivityId()));
|
||||
dao().clear(ActItemGroupScore.class, Cnd.where(ActItemGroupScore::getActivityId, "=", groupVo.getActivityId()));
|
||||
|
||||
// 查询报名了并且已经完成签到的人员
|
||||
List<ActUser> signUpUserList = dao().query(ActUser.class, Cnd.where(ActUser::getActivityId, "=", groupVo.getActivityId())
|
||||
@@ -52,7 +50,10 @@ public class ActGroupServiceImpl extends BaseServiceImpl<ActGroup> implements Ac
|
||||
|
||||
int result = Math.floorDiv(size, oneGroupLimitUserNum);
|
||||
// 初始化分组
|
||||
List<List<ActUser>> groups = Collections.nCopies(result, new ArrayList<>());
|
||||
List<List<ActUser>> groups = new ArrayList<>();
|
||||
for (int i = 0; i < result; i++) {
|
||||
groups.add(new ArrayList<>());
|
||||
}
|
||||
|
||||
// 分离男女用户
|
||||
Map<String, List<ActUser>> genderMap = signUpUserList.stream()
|
||||
@@ -90,7 +91,6 @@ public class ActGroupServiceImpl extends BaseServiceImpl<ActGroup> implements Ac
|
||||
}
|
||||
}
|
||||
|
||||
// 收集未分配的用户
|
||||
unassignedUsers.addAll(males.subList(maleIndex, males.size()));
|
||||
unassignedUsers.addAll(females.subList(femaleIndex, females.size()));
|
||||
|
||||
@@ -99,11 +99,12 @@ public class ActGroupServiceImpl extends BaseServiceImpl<ActGroup> implements Ac
|
||||
.mapToObj(index -> {
|
||||
ActGroup actGroup = new ActGroup();
|
||||
actGroup.setActivityId(groupVo.getActivityId());
|
||||
actGroup.setGroupName("第" + (index + 1) + "组");
|
||||
actGroup.setGroupName("第" + (index + 1) + "队");
|
||||
actGroup.setSort(index + 1);
|
||||
|
||||
List<ActGroupUser> userList = groups.get(index).stream().map(v -> {
|
||||
ActGroupUser user = new ActGroupUser();
|
||||
user.setUserId(v.getId());
|
||||
user.setUserId(v.getUserId());
|
||||
user.setActivityId(groupVo.getActivityId());
|
||||
return user;
|
||||
}).collect(Collectors.toList());
|
||||
@@ -113,10 +114,25 @@ public class ActGroupServiceImpl extends BaseServiceImpl<ActGroup> implements Ac
|
||||
}).toList();
|
||||
|
||||
|
||||
// 所有项目
|
||||
List<ActivityItem> actItemList = dao().query(ActivityItem.class, Cnd.where(ActivityItem::getActivityId, "=", groupVo.getActivityId()));
|
||||
// 往项目得分表里面插记录
|
||||
List<ActItemGroupScore> itemGroupScoreList = new ArrayList<>();
|
||||
|
||||
for (ActGroup group : groupList) {
|
||||
dao().insertWith(group, "groupUsers");
|
||||
}
|
||||
|
||||
// 构建小组项目得分表
|
||||
List<ActItemGroupScore> groupScoreList = actItemList.stream().map(item -> {
|
||||
ActItemGroupScore itemGroupScore = new ActItemGroupScore();
|
||||
itemGroupScore.setActivityId(groupVo.getActivityId());
|
||||
itemGroupScore.setItemId(item.getId());
|
||||
itemGroupScore.setGroupId(group.getId());
|
||||
return itemGroupScore;
|
||||
}).toList();
|
||||
itemGroupScoreList.addAll(groupScoreList);
|
||||
}
|
||||
dao().insert(itemGroupScoreList);
|
||||
|
||||
// 添加未能正确分组的人员
|
||||
List<ActUnGroupUser> userList = unassignedUsers.stream().map(v -> {
|
||||
@@ -127,4 +143,71 @@ public class ActGroupServiceImpl extends BaseServiceImpl<ActGroup> implements Ac
|
||||
}).toList();
|
||||
dao().insert(userList);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void unGroupUserSetting(ActUnGroupUserVo unGroupUserVo) {
|
||||
// 查询还没有分组的人员
|
||||
List<ActUnGroupUser> query = dao().query(ActUnGroupUser.class, Cnd.where(ActUnGroupUser::getActivityId, "=", unGroupUserVo.getActivityId()));
|
||||
Set<Long> userIds = query.stream().map(ActUnGroupUser::getUserId).collect(Collectors.toSet());
|
||||
// 删除这些人员的分组信息
|
||||
dao().clear(ActGroupUser.class, Cnd.where(ActGroupUser::getActivityId, "=", unGroupUserVo.getActivityId()).and(ActGroupUser::getUserId, "in", userIds));
|
||||
|
||||
if (unGroupUserVo.getIsSeparateGroup() != null && unGroupUserVo.getIsSeparateGroup()) {
|
||||
// 构建分组用户
|
||||
List<ActGroupUser> userList = query.stream().map(v -> {
|
||||
ActGroupUser user = new ActGroupUser();
|
||||
user.setActivityId(unGroupUserVo.getActivityId());
|
||||
user.setUserId(v.getUserId());
|
||||
if (v.getUserId().equals(unGroupUserVo.getLeaderId())) {
|
||||
user.setIsLeader(true);
|
||||
}
|
||||
return user;
|
||||
}).toList();
|
||||
|
||||
// 查询出这个活动下最大的排序
|
||||
ActGroup sort = dao().fetch(ActGroup.class, Cnd.NEW().desc("sort"));
|
||||
|
||||
// 单独分组构建
|
||||
ActGroup actGroup = new ActGroup();
|
||||
actGroup.setActivityId(unGroupUserVo.getActivityId());
|
||||
actGroup.setGroupName(unGroupUserVo.getGroupName());
|
||||
actGroup.setSort(sort.getSort() + 1);
|
||||
actGroup.setGroupUsers(userList);
|
||||
dao().insertWith(actGroup, "groupUsers");
|
||||
|
||||
// 同时还要往小组得分记录表中查活动项目的数据
|
||||
List<ActivityItem> itemList = dao().query(ActivityItem.class, Cnd.where(ActivityItem::getActivityId, "=", unGroupUserVo.getActivityId()));
|
||||
// 构建小组项目得分表
|
||||
List<ActItemGroupScore> scoreList = itemList.stream().map(v -> {
|
||||
ActItemGroupScore itemGroupScore = new ActItemGroupScore();
|
||||
itemGroupScore.setActivityId(unGroupUserVo.getActivityId());
|
||||
itemGroupScore.setItemId(v.getId());
|
||||
itemGroupScore.setGroupId(actGroup.getId());
|
||||
return itemGroupScore;
|
||||
}).toList();
|
||||
dao().insert(scoreList);
|
||||
} else {
|
||||
// 不单独分组,分配到其他队伍
|
||||
List<ActGroupUser> unGroupUser = unGroupUserVo.getUnGroupUser();
|
||||
Map<Long, ActGroupUser> map = unGroupUser.stream().collect(Collectors.toMap(ActGroupUser::getUserId, v -> v));
|
||||
|
||||
List<ActGroupUser> userList = query.stream().map(v -> {
|
||||
// 要保证传递过来的数据中,不在数据表中存储的这些人员不插入
|
||||
ActGroupUser groupUser = map.get(v.getUserId());
|
||||
if (groupUser != null) {
|
||||
groupUser.setUserId(v.getUserId());
|
||||
groupUser.setActivityId(unGroupUserVo.getActivityId());
|
||||
groupUser.setGroupId(groupUser.getGroupId());
|
||||
return groupUser;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}).filter(Objects::nonNull).toList();
|
||||
dao().insert(userList);
|
||||
}
|
||||
// 分完之后,删除这个活动下的未分组人员
|
||||
dao().clear(ActUnGroupUser.class, Cnd.where(ActUnGroupUser::getActivityId, "=", unGroupUserVo.getActivityId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.budwk.app.module.activity.vo;
|
||||
|
||||
import com.budwk.app.module.activity.models.ActGroupUser;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:ActUnGroupUserVo
|
||||
* @Date 2025/4/30 15:01
|
||||
* @注释 :未分组人员
|
||||
*/
|
||||
@Data
|
||||
public class ActUnGroupUserVo {
|
||||
|
||||
// 活动id
|
||||
private Long activityId;
|
||||
|
||||
// 是否单独分组
|
||||
private Boolean isSeparateGroup;
|
||||
|
||||
// 分组名称
|
||||
private String groupName;
|
||||
|
||||
// 领队id
|
||||
private Long leaderId;
|
||||
|
||||
// 未分组人员
|
||||
private List<ActGroupUser> unGroupUser;
|
||||
}
|
||||
@@ -15,6 +15,8 @@ public class ActSignInUserPageForm extends PageForm {
|
||||
|
||||
// 活动ID
|
||||
private Long activityId;
|
||||
// 项目ID
|
||||
private Long itemId;
|
||||
|
||||
// 联系方式
|
||||
private String phone;
|
||||
|
||||
@@ -35,7 +35,6 @@ const GROUP_SETTING = {
|
||||
<el-form-item label="男用户限制人数" prop="manUserNum">
|
||||
<el-input-number style="width: 100%" v-model="form.manUserNum"
|
||||
placeholder="请输入男用户限制人数"></el-input-number>
|
||||
<span style="color: #bc2a25">设-1则标识不限制</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -44,6 +43,7 @@ const GROUP_SETTING = {
|
||||
placeholder="请输入女用户限制人数"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<span style="color: #bc2a25;margin-left: 150px">设置-1,系统会将自动分配,尽可能的保持每队男女运动员数量一致</span>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
@@ -92,6 +92,7 @@ const GROUP_SETTING = {
|
||||
this.groupingDialog = false
|
||||
this.$refs.formRef.resetFields()
|
||||
this.$message.success(resp.msg)
|
||||
this.$emit('success')
|
||||
} else {
|
||||
this.$message.error('操作失败')
|
||||
}
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
<!--#
|
||||
layout("/layouts/platform_1.html"){
|
||||
#-->
|
||||
<style>
|
||||
.un_group_user_span {
|
||||
position: absolute;
|
||||
top: -6px; right: -6px;
|
||||
background-color: #bc2a25;
|
||||
color: white;
|
||||
border-radius: 50%;
|
||||
padding: 2px 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
<div id="app">
|
||||
<el-card shadow="never">
|
||||
<div class="search">
|
||||
@@ -30,36 +41,125 @@ layout("/layouts/platform_1.html"){
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">队伍名称</div>
|
||||
<div class="search-item-option">
|
||||
<el-input v-model="pageForm.groupName" placeholder="请输入队伍名称"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">运动员信息</div>
|
||||
<div class="search-item-option">
|
||||
<el-input v-model="pageForm.searchKeyword" placeholder="请输入运动员姓名、联系方式"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-query">
|
||||
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mt-3">
|
||||
<el-row type="flex" class="mb-3" style="justify-content: flex-end">
|
||||
<el-button icon="el-icon-plus" type="primary" size="small" @click="openGrouping">开始分组</el-button>
|
||||
<el-row type="flex" style="justify-content: flex-start" class="mb-3">
|
||||
<el-button type="primary" size="small" @click="openGrouping">开始分组</el-button>
|
||||
<div v-if="unGroupUser && unGroupUser.length > 0" style="margin-left: 10px; display: inline-block;">
|
||||
<el-button type="warning" size="small" style="position: relative;" @click="doUnGroupUserSetting">
|
||||
未分组人员
|
||||
<span class="un_group_user_span">{{ unGroupUser.length }}</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table v-loading="tableLoading" show-overflow-tooltip :data="tableData">
|
||||
<el-table-column label="序号" type="index" header-align="center" align="center" width="50"></el-table-column>
|
||||
<el-table-column label="队伍名称" prop="groupName"></el-table-column>
|
||||
<el-table-column label="队伍总人数" prop="groupNum"></el-table-column>
|
||||
<el-table-column label="男运动员人数" prop="manNum"></el-table-column>
|
||||
<el-table-column label="女运动员人数" prop="womanNum"></el-table-column>
|
||||
<el-table-column label="领队" prop="leaderName">
|
||||
<template #default="{row}">
|
||||
<el-tag v-if="row.leaderName">{{row.leaderName}}</el-tag>
|
||||
<el-tag v-else type="warning">未设置</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="领队联系方式" prop="leaderPhone">
|
||||
<template #default="{row}">
|
||||
<el-tag v-if="row.leaderPhone">{{row.leaderPhone}}</el-tag>
|
||||
<el-tag v-else type="warning">未设置</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="250">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" size="mini" @click="openView(scope.row)">查看</el-button>
|
||||
<el-button type="primary" size="mini" @click="openAdjustGroup(scope.row)">调整</el-button>
|
||||
<el-button type="danger" size="mini" @click="doRemove(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<group-setting ref="groupSettingRef"></group-setting>
|
||||
<group-setting ref="groupSettingRef" @success="successGroup"></group-setting>
|
||||
|
||||
<un-group-user ref="unGroupUserRef" @success="successGroup"></un-group-user>
|
||||
</div>
|
||||
<script>
|
||||
<!--#include('groupSetting.js'){}#-->
|
||||
<!--#include('unGroupUser.js'){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
"group-setting": GROUP_SETTING
|
||||
"group-setting": GROUP_SETTING,
|
||||
"un-group-user": UN_GROUP_USER
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pageForm: {
|
||||
year: new Date().getFullYear() + ""
|
||||
},
|
||||
activityList: []
|
||||
activityList: [],
|
||||
unGroupUser: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openView(row){
|
||||
|
||||
},
|
||||
openAdjustGroup(row){
|
||||
|
||||
},
|
||||
async doRemove(row) {
|
||||
this.$confirm('此操作将会删除与该小队相关的所有信息,确定要删除吗?', '提示', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消'
|
||||
}).then(async () => {
|
||||
const resp = await $.post('/platform/activity/group/doRemove', {
|
||||
id: row.id
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
await this.pageData()
|
||||
this.$message.success(resp.msg)
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 处理没有分组的人员
|
||||
doUnGroupUserSetting(){
|
||||
if (!this.pageForm.activityId) {
|
||||
this.$message.error("请选择活动")
|
||||
return
|
||||
}
|
||||
const activity = this.activityList.find(v=>v.id === this.pageForm.activityId)
|
||||
this.$nextTick(() => {
|
||||
this.$refs.unGroupUserRef.onOpen({
|
||||
activityId: activity.id,
|
||||
activityName: activity.title,
|
||||
unGroupUser: this.unGroupUser
|
||||
})
|
||||
})
|
||||
},
|
||||
// 开始分组
|
||||
openGrouping(){
|
||||
if (!this.pageForm.activityId) {
|
||||
this.$message.error("请选择活动")
|
||||
@@ -67,6 +167,10 @@ layout("/layouts/platform_1.html"){
|
||||
}
|
||||
this.$refs.groupSettingRef.onOpen(this.pageForm.activityId)
|
||||
},
|
||||
async successGroup(){
|
||||
this.doSearch()
|
||||
await this.getUnGroupUser()
|
||||
},
|
||||
async getActivityList(){
|
||||
const resp = await $.post('/platform/activity/user/getActivityList', {
|
||||
year: this.pageForm.year
|
||||
@@ -77,7 +181,30 @@ layout("/layouts/platform_1.html"){
|
||||
} else {
|
||||
this.$set(this.pageForm, 'activityId', '')
|
||||
}
|
||||
// this.pageData()
|
||||
await this.pageData()
|
||||
await this.getUnGroupUser()
|
||||
},
|
||||
async getUnGroupUser(){
|
||||
const resp = await $.post('/platform/activity/group/queryUnGroupUser', {
|
||||
activityId: this.pageForm.activityId
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.unGroupUser = resp.data
|
||||
} else {
|
||||
this.unGroupUser = []
|
||||
}
|
||||
},
|
||||
doSearch(){
|
||||
this.pageData()
|
||||
this.getUnGroupUser()
|
||||
},
|
||||
async pageData(){
|
||||
const resp = await $.post('/platform/activity/group/pageData', this.pageForm)
|
||||
if (resp.code === 0) {
|
||||
this.tableData = resp.data
|
||||
} else {
|
||||
this.$message.warning('查询失败')
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
const UN_GROUP_USER = {
|
||||
template: /*language=HTML*/ `
|
||||
<el-dialog title="分配小队" :visible.sync="unGroupUserDialog" width="60%">
|
||||
<el-form :model="form" :rules="formRules" ref="formRef" label-width="100px" style="max-height: 600px;overflow-y: auto">
|
||||
<el-form-item label="活动名称" prop="activityName">
|
||||
<el-input v-model="form.activityName" readonly></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="isSeparateGroup">
|
||||
<template slot="label">
|
||||
<el-tooltip class="item" effect="dark" content="单独分组表示:未分组人员单独形成一个小队" placement="top-start">
|
||||
<span>单独分组</span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-radio-group v-model="form.isSeparateGroup" size="small">
|
||||
<el-radio :label="true" border>是</el-radio>
|
||||
<el-radio :label="false" border>否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<template v-if="form.isSeparateGroup">
|
||||
<el-form-item label="队伍名称" prop="groupName">
|
||||
<el-input v-model="form.groupName" placeholder="请输入队伍名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择领队" prop="leaderId">
|
||||
<el-select placeholder="请选择领队"
|
||||
style="width: 100%;"
|
||||
v-model="form.leaderId">
|
||||
<el-option :label="item.userName" :value="item.userId"
|
||||
v-for="item in form.unGroupUser"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<el-form-item label="未分组人员" prop="unGroupUser">
|
||||
<el-table :data="form.unGroupUser" border size="small" width="100%">
|
||||
<el-table-column v-if="form.isSeparateGroup === false" label="设置队伍" prop="groupId" fixed width="200">
|
||||
<template slot-scope="{row}">
|
||||
<el-select placeholder="请选择队伍"
|
||||
style="width: 100%;"
|
||||
v-model="row.groupId">
|
||||
<el-option :label="item.groupName" :value="item.id"
|
||||
v-for="item in groupList"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="姓名" prop="userName"></el-table-column>
|
||||
<el-table-column label="性别" prop="sex"></el-table-column>
|
||||
<el-table-column label="联系方式" prop="phone"></el-table-column>
|
||||
<el-table-column label="身份证件号" prop="idCard"></el-table-column>
|
||||
<el-table-column label="单位名称" prop="unitName"></el-table-column>
|
||||
<el-table-column label="职务" prop="position"></el-table-column>
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="unGroupUserDialog = false">取 消</el-button>
|
||||
<el-button type="primary" @click="doUnGroupUserSetting">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
`,
|
||||
data(){
|
||||
return {
|
||||
unGroupUserDialog: false,
|
||||
form: {
|
||||
activityId: '',
|
||||
activityName: '',
|
||||
unGroupUser: []
|
||||
},
|
||||
formRules: {
|
||||
isSeparateGroup: [{ required: true, message: '请选择是否单独分组', trigger: ['blur', 'change'] }],
|
||||
groupName: [{ required: true, message: '请填写队伍名称', trigger: ['blur', 'change'] }],
|
||||
leaderId: [{ required: true, message: '请选择领队', trigger: ['blur', 'change'] }],
|
||||
},
|
||||
groupList: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async onOpen(formData){
|
||||
this.form = {...formData}
|
||||
await this.getGroupList()
|
||||
this.unGroupUserDialog = true
|
||||
},
|
||||
async getGroupList(){
|
||||
const resp = await $.post('/platform/activity/group/queryGroupList', {
|
||||
activityId: this.form.activityId
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.groupList = resp.data
|
||||
}
|
||||
},
|
||||
async doUnGroupUserSetting(){
|
||||
// 确定要提交吗?
|
||||
this.$refs.formRef.validate(async valid => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
this.$confirm('确定要提交吗?', '提示', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消'
|
||||
}).then(async () => {
|
||||
const formData = JSON.parse(JSON.stringify(this.form))
|
||||
formData.unGroupUser = JSON.stringify(formData.unGroupUser)
|
||||
const resp = await $.post('/platform/activity/group/unGroupUserSetting', formData)
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.unGroupUserDialog = false
|
||||
this.$emit('success')
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
<!--#
|
||||
layout("/layouts/platform_1.html"){
|
||||
#-->
|
||||
|
||||
<div id="app">
|
||||
<el-card shadow="never">
|
||||
<div class="search">
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">年度</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
:clearable="false"
|
||||
placeholder="选择年"
|
||||
style="width: 100%"
|
||||
@change="getActivityOptions"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy"
|
||||
></el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">所属活动</div>
|
||||
<div class="search-item-option">
|
||||
<el-select v-model="pageForm.activityId" placeholder="请选择活动" @change="getActivityItemOptions">
|
||||
<el-option
|
||||
v-for="item in activityOptions"
|
||||
:key="item.id"
|
||||
:label="item.title"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">所属项目</div>
|
||||
<div class="search-item-option">
|
||||
<el-select v-model="pageForm.itemId" placeholder="请选择所属项目" clearable>
|
||||
<el-option
|
||||
v-for="item in activityItemOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">姓名/单位</div>
|
||||
<div class="search-item-option">
|
||||
<el-input v-model="pageForm.searchKeyword" clearable placeholder="请输入姓名/单位"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-query">
|
||||
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mt-3">
|
||||
<el-row type="flex" class="mb-3" style="justify-content: flex-end">
|
||||
<el-button icon="el-icon-plus" type="primary" size="small" @click="doExport">导出</el-button>
|
||||
</el-row>
|
||||
<el-table v-loading="tableLoading" show-overflow-tooltip :data="tableData">
|
||||
<el-table-column label="序号" prop="index" header-align="center" align="center" width="50">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="姓名" prop="userName"width="150"></el-table-column>
|
||||
<el-table-column label="性别" prop="sex"width="150"></el-table-column>
|
||||
<el-table-column label="职务" prop="position"></el-table-column>
|
||||
<el-table-column label="身份证号码" prop="idCard"></el-table-column>
|
||||
<el-table-column label="联系方式" prop="mobile"></el-table-column>
|
||||
<el-table-column label="参加单位名称" prop="unitName"></el-table-column>
|
||||
<el-table-column label="参加项目" prop="itemName"></el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
|
||||
|
||||
</div>
|
||||
<script>
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
pageForm: {
|
||||
year: new Date().getFullYear() + ""
|
||||
},
|
||||
activityOptions: [],
|
||||
activityItemOptions: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doExport() {
|
||||
window.open("/platform/activity/itemApplyQuery/doExport?activityId=" + this.pageForm.activityId + "&searchKeyword=" + this.pageForm.searchKeyword)
|
||||
},
|
||||
getActivityOptions() {
|
||||
$.post("/platform/activity/itemApplyQuery/getActivityOptions", {year: this.pageForm.year}).then(res => {
|
||||
if (res.code === 0) {
|
||||
if (res.data && res.data.length > 0) {
|
||||
this.$set(this.pageForm, "activityId", res.data[0].id)
|
||||
} else {
|
||||
this.$set(this.pageForm, "activityId", "")
|
||||
}
|
||||
this.activityOptions = res.data;
|
||||
this.getActivityItemOptions()
|
||||
this.doSearch()
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
getActivityItemOptions() {
|
||||
$.post("/platform/activity/itemApplyQuery/getActivityItemOptions", {activityId: this.pageForm.activityId}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.activityItemOptions = res.data;
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getActivityOptions()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -55,7 +55,6 @@ layout("/layouts/platform_1.html"){
|
||||
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="报名号" prop="actUserNo"></el-table-column>
|
||||
<el-table-column label="姓名" prop="userName"></el-table-column>
|
||||
<el-table-column label="性别" prop="sex"></el-table-column>
|
||||
<el-table-column label="职务" prop="position"></el-table-column>
|
||||
|
||||
@@ -98,7 +98,7 @@ layout("/layouts/platform_1.html"){
|
||||
<!-- placeholder="请输入姓名"></el-input>-->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="性别" prop="name" width="200">
|
||||
<el-table-column label="性别" prop="sex" width="200">
|
||||
<template slot-scope="{row}">
|
||||
<el-radio-group v-model="row.sex">
|
||||
<el-radio label="男"></el-radio>
|
||||
|
||||
@@ -36,17 +36,17 @@
|
||||
<!-- 队伍信息 -->
|
||||
<view class="rank-team">
|
||||
<view class="team-info">
|
||||
<image class="team-avatar" :src="team.avatar || '/static/team-avatar.png'" mode="aspectFill"></image>
|
||||
<!-- <image class="team-avatar" :src="team.avatar || '/static/team-avatar.png'" mode="aspectFill"></image>-->
|
||||
<view class="team-detail">
|
||||
<view class="team-name-row">
|
||||
<text class="team-name">{{ team.teamName }}</text>
|
||||
<text class="team-name">{{ team.groupName }}</text>
|
||||
<t-tag v-if="team.isMyTeam" theme="primary" variant="light" size="small" class="my-team-tag">我的队伍</t-tag>
|
||||
</view>
|
||||
<view class="progress-bar">
|
||||
<view class="progress-bar-bg"></view>
|
||||
<view
|
||||
class="progress-bar-fill"
|
||||
:style="{width: `${(team.score / 100) * 100}%`}"
|
||||
:style="{width: `${(team.totalScore / 100) * 100}%`}"
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
<!-- 得分 -->
|
||||
<view class="rank-score">
|
||||
<view class="score-value">{{ team.score }}</view>
|
||||
<view class="score-value">{{ team.totalScore }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="empty-container" v-if="!loading && rankList.length === 0">
|
||||
@@ -78,98 +78,25 @@
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { Toast } from 'tdesign-mobile-vue';
|
||||
import { useRequest } from "@/utils/request";
|
||||
import {onLoad} from "@dcloudio/uni-app";
|
||||
|
||||
// 排行榜数据
|
||||
const rankList = ref([]);
|
||||
const activityId = ref([]);
|
||||
const loading = ref(false);
|
||||
const refresherTriggered = ref(false);
|
||||
|
||||
const generateMockData = () => {
|
||||
const teams = [
|
||||
{
|
||||
id: '1',
|
||||
teamName: '闪电队',
|
||||
score: 98,
|
||||
avatar: 'https://tdesign.gtimg.com/mobile/demos/avatar_1.png',
|
||||
isMyTeam: true
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
teamName: '飞鹰战队',
|
||||
score: 96,
|
||||
avatar: 'https://tdesign.gtimg.com/mobile/demos/avatar_2.png',
|
||||
isMyTeam: false
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
teamName: '猎豹小组',
|
||||
score: 90,
|
||||
avatar: 'https://tdesign.gtimg.com/mobile/demos/avatar_3.png',
|
||||
isMyTeam: false
|
||||
},
|
||||
{
|
||||
id: '4',
|
||||
teamName: '雄狮战队',
|
||||
score: 85,
|
||||
avatar: 'https://tdesign.gtimg.com/mobile/demos/avatar_4.png',
|
||||
isMyTeam: false
|
||||
},
|
||||
{
|
||||
id: '5',
|
||||
teamName: '飓风俱乐部',
|
||||
score: 80,
|
||||
avatar: 'https://tdesign.gtimg.com/mobile/demos/avatar_5.png',
|
||||
isMyTeam: false
|
||||
},
|
||||
{
|
||||
id: '6',
|
||||
teamName: '钢铁战士',
|
||||
score: 78,
|
||||
avatar: 'https://tdesign.gtimg.com/mobile/demos/avatar_1.png',
|
||||
isMyTeam: false
|
||||
},
|
||||
{
|
||||
id: '7',
|
||||
teamName: '赤焰战队',
|
||||
score: 75,
|
||||
avatar: 'https://tdesign.gtimg.com/mobile/demos/avatar_2.png',
|
||||
isMyTeam: false
|
||||
},
|
||||
{
|
||||
id: '8',
|
||||
teamName: '金龙小组',
|
||||
score: 68,
|
||||
avatar: 'https://tdesign.gtimg.com/mobile/demos/avatar_3.png',
|
||||
isMyTeam: false
|
||||
},
|
||||
{
|
||||
id: '9',
|
||||
teamName: '星辰队',
|
||||
score: 65,
|
||||
avatar: 'https://tdesign.gtimg.com/mobile/demos/avatar_4.png',
|
||||
isMyTeam: false
|
||||
},
|
||||
{
|
||||
id: '10',
|
||||
teamName: '黑豹战队',
|
||||
score: 62,
|
||||
avatar: 'https://tdesign.gtimg.com/mobile/demos/avatar_5.png',
|
||||
isMyTeam: false
|
||||
}
|
||||
];
|
||||
|
||||
// 按分数排序
|
||||
return teams.sort((a, b) => b.score - a.score);
|
||||
};
|
||||
|
||||
// 获取排行榜数据
|
||||
const getRankData = async () => {
|
||||
loading.value = true;
|
||||
|
||||
// 模拟API请求延迟
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
try {
|
||||
rankList.value = generateMockData();
|
||||
const {code,data, msg} = await useRequest().post('/client/group/list-group-rank/' + activityId.value);
|
||||
if (code === 0) {
|
||||
rankList.value = data;
|
||||
} else {
|
||||
Toast({message: msg, theme: 'error'});
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('获取排行榜数据失败', error);
|
||||
Toast({ message: '获取排行榜数据失败', theme: 'error' });
|
||||
@@ -193,7 +120,11 @@ const handleRefresh = () => {
|
||||
refresherTriggered.value = true;
|
||||
getRankData();
|
||||
};
|
||||
|
||||
onLoad((option) => {
|
||||
if (option.id) {
|
||||
activityId.value=option.id
|
||||
}
|
||||
});
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getRankData();
|
||||
|
||||
@@ -119,17 +119,7 @@ const isSignUp = ref(null)
|
||||
const agreementChecked = ref(false)
|
||||
const formRef = ref(null)
|
||||
const formData = ref({
|
||||
unitName: "测试",
|
||||
contactName: "测试",
|
||||
contactPhone: "18899998888",
|
||||
userList: [{
|
||||
userName: "测试",
|
||||
sex: "男",
|
||||
position: "测试",
|
||||
idCard: "421087200004040010",
|
||||
phone: "18899998888",
|
||||
isStay: true
|
||||
}]
|
||||
userList: [{}]
|
||||
})
|
||||
|
||||
onLoad((option) => {
|
||||
|
||||
@@ -25,16 +25,16 @@
|
||||
<div class="stat-item">
|
||||
<div class="stat-icon"><i class="bi bi-people"></i></div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-value">{{ team.groupUsers?.length }}</div>
|
||||
<div class="stat-label">成员</div>
|
||||
<div class="stat-value">成员:{{ team.groupUsers?.length }}</div>
|
||||
<!-- <div class="stat-label">成员</div>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat-divider"></div>
|
||||
<div class="stat-item">
|
||||
<div class="stat-item" @click="queryRank">
|
||||
<div class="stat-icon"><i class="bi bi-trophy"></i></div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-value">{{ team.totalRank ? team.totalRank : '--' }}</div>
|
||||
<div class="stat-label">排名</div>
|
||||
<div class="stat-value">排名:{{ team.totalRank ? team.totalRank : '--' }}</div>
|
||||
<div class="stat-label">点击查看排行榜</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -240,6 +240,11 @@ const getListAct = async () => {
|
||||
|
||||
};
|
||||
|
||||
// 点击查看成绩排名
|
||||
const queryRank=()=>{
|
||||
uni.navigateTo({url: '/pages/activity/rank/index?id=' + pageForm.actId})
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onLoad(() => {
|
||||
getListAct();
|
||||
|
||||
Reference in New Issue
Block a user