commit
This commit is contained in:
+4
-3
@@ -86,7 +86,7 @@ public class ClientGroupController {
|
||||
// return Result.error("您还没加入任何团队");
|
||||
return Result.success();
|
||||
}
|
||||
Sql sql = Sqls.create("select * from act_group where id=@id").setParam("id", groupUser.getGroupId());
|
||||
Sql sql = Sqls.create("select * from act_group where id=@id and isOpen = 1").setParam("id", groupUser.getGroupId());
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
NutMap map = (NutMap) dao.execute(sql).getResult();
|
||||
Sql sqlGroupUser = Sqls.create("""
|
||||
@@ -104,7 +104,7 @@ public class ClientGroupController {
|
||||
WHERE t1.groupId=@groupId
|
||||
ORDER BY
|
||||
t1.isLeader DESC
|
||||
""").setParam("groupId", map.getString("id"));
|
||||
""").setParam("groupId", map.getString("id", ""));
|
||||
List<NutMap> groupUsers = clientActivityService.listMap(sqlGroupUser);
|
||||
map.put("groupUsers", groupUsers);
|
||||
NutMap leader = groupUsers.stream().filter(nutMap -> nutMap.getBoolean("isLeader")).findFirst().orElse(null);
|
||||
@@ -168,7 +168,7 @@ public class ClientGroupController {
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
public Result listGroupRank(Long activityId) {
|
||||
if (activityId == null) {
|
||||
return Result.error("活动ID不能为空");
|
||||
return Result.error("未获取到报名活动");
|
||||
}
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
@@ -183,6 +183,7 @@ public class ClientGroupController {
|
||||
LEFT JOIN act_group t2 ON t2.id = t1.groupId\s
|
||||
WHERE
|
||||
t1.activityId = @activityId
|
||||
AND t2.isOpen = true
|
||||
""");
|
||||
sql.setParam("activityId", activityId);
|
||||
List<NutMap> list = clientActivityService.listMap(sql);
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class ActBigScreenController {
|
||||
@Ok("json:full")
|
||||
public Result score(Long activityId) {
|
||||
if (activityId == null) {
|
||||
return Result.error("活动ID不能为空");
|
||||
return Result.error("未获取到报名活动");
|
||||
}
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
|
||||
+15
@@ -16,6 +16,7 @@ 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.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
@@ -29,6 +30,7 @@ import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -231,6 +233,8 @@ public class ActGroupController {
|
||||
for (int i = 0; i < actGroups.length; i++) {
|
||||
actGroups[i].setActivityId(activityId);
|
||||
actGroups[i].setSort(i + 1);
|
||||
// 设置为非公开
|
||||
actGroups[i].setIsOpen(false);
|
||||
dao.insert(actGroups[i]);
|
||||
for (ActGroupUser user : actGroups[i].getGroupUsers()) {
|
||||
user.setActivityId(activityId);
|
||||
@@ -275,4 +279,15 @@ public class ActGroupController {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("activity.group")
|
||||
@SLog(tag = "活动分组", msg = "发布分组结果")
|
||||
public Result releaseGroupResult(@Valid String activityId){
|
||||
dao.update(ActGroup.class, Chain.make("isOpen", true),
|
||||
Cnd.where(ActGroup::getActivityId, "=", activityId));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-1
@@ -124,7 +124,9 @@ public class ActUserController {
|
||||
user.setActivityId(activityId);
|
||||
user.setUnitName(vo.getUnitName());
|
||||
}
|
||||
dao.insertOrUpdate(doSignUserList);
|
||||
if (Lang.isNotEmpty(doSignUserList)) {
|
||||
dao.insertOrUpdate(doSignUserList);
|
||||
}
|
||||
}
|
||||
|
||||
// 找出不在系统的人,添加到client_user表中,再添加报名记录
|
||||
|
||||
@@ -54,4 +54,8 @@ public class ActGroup extends BaseModel {
|
||||
@Many(field = "groupId")
|
||||
private List<ActGroupUser> groupUsers;
|
||||
|
||||
@Column
|
||||
@Comment("是否公开")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean isOpen;
|
||||
}
|
||||
|
||||
+2
-40
@@ -67,7 +67,7 @@ public class ActGroupServiceImpl extends BaseServiceImpl<ActGroup> implements Ac
|
||||
List<ActUser> males = new ArrayList<>(genderMap.getOrDefault("男", Collections.emptyList()));
|
||||
List<ActUser> females = new ArrayList<>(genderMap.getOrDefault("女", Collections.emptyList()));
|
||||
|
||||
// 不再排序!保持原始顺序或打乱(避免系统性偏差)
|
||||
// 保持原始顺序或打乱(避免系统性偏差)
|
||||
Collections.shuffle(males);
|
||||
Collections.shuffle(females);
|
||||
|
||||
@@ -81,45 +81,6 @@ public class ActGroupServiceImpl extends BaseServiceImpl<ActGroup> implements Ac
|
||||
optimizeBySwapping(groups, maxIterations);
|
||||
|
||||
|
||||
// // 分离男女用户
|
||||
// Map<String, List<ActUser>> genderMap = signUpUserList.stream()
|
||||
// .collect(Collectors.groupingBy(user -> "男".equals(user.getSex()) ? "男" : "女"));
|
||||
//
|
||||
// List<ActUser> males = genderMap.getOrDefault("男", Collections.emptyList());
|
||||
// List<ActUser> females = genderMap.getOrDefault("女", Collections.emptyList());
|
||||
//
|
||||
// // 随机化列表
|
||||
// Collections.shuffle(males);
|
||||
// Collections.shuffle(females);
|
||||
//
|
||||
// // 尝试分配
|
||||
// List<ActUser> unassignedUsers = new ArrayList<>();
|
||||
//
|
||||
// int maleIndex = 0, femaleIndex = 0;
|
||||
// while (maleIndex < males.size() || femaleIndex < females.size()) {
|
||||
// boolean assigned = false;
|
||||
// for (List<ActUser> group : groups) {
|
||||
// if (group.size() < groupVo.getOneGroupLimitUserNum()) {
|
||||
// int currentMaleCount = (int) group.stream().filter(u -> "男".equals(u.getSex())).count();
|
||||
// int currentFemaleCount = (int) group.stream().filter(u -> "女".equals(u.getSex())).count();
|
||||
//
|
||||
// if (maleIndex < males.size() && (groupVo.getManUserNum() == -1 || currentMaleCount < groupVo.getManUserNum())) {
|
||||
// group.add(males.get(maleIndex++));
|
||||
// assigned = true;
|
||||
// } else if (femaleIndex < females.size() && (groupVo.getWomanUserNum() == -1 || currentFemaleCount < groupVo.getWomanUserNum())) {
|
||||
// group.add(females.get(femaleIndex++));
|
||||
// assigned = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (!assigned) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// unassignedUsers.addAll(males.subList(maleIndex, males.size()));
|
||||
// unassignedUsers.addAll(females.subList(femaleIndex, females.size()));
|
||||
//
|
||||
// 往组别表里面添加记录
|
||||
List<ActGroup> groupList = IntStream.range(0, groups.size())
|
||||
.mapToObj(index -> {
|
||||
@@ -136,6 +97,7 @@ public class ActGroupServiceImpl extends BaseServiceImpl<ActGroup> implements Ac
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
actGroup.setGroupUsers(userList);
|
||||
actGroup.setIsOpen(false);
|
||||
return actGroup;
|
||||
}).toList();
|
||||
|
||||
|
||||
@@ -73,6 +73,8 @@ layout("/layouts/platform_1.html"){
|
||||
手动分组
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-button type="primary" size="small" @click="releaseGroupResult" style="margin-left: 10px">发布分组结果</el-button>
|
||||
</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>
|
||||
@@ -91,6 +93,12 @@ layout("/layouts/platform_1.html"){
|
||||
<el-tag v-if="row.leaderPhone">{{row.leaderPhone}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否发布" prop="isOpen">
|
||||
<template #default="{row}">
|
||||
<el-tag v-if="row.isOpen" type="success">已发布</el-tag>
|
||||
<el-tag v-else type="danger">未发布</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="200">
|
||||
<template #default="scope">
|
||||
<el-button type="text" @click="openView(scope.row)">查看</el-button>
|
||||
@@ -139,6 +147,26 @@ layout("/layouts/platform_1.html"){
|
||||
// openAdjustGroup(row){
|
||||
//
|
||||
// },
|
||||
/**
|
||||
* 发布分组结果
|
||||
*/
|
||||
releaseGroupResult() {
|
||||
this.$confirm('确定要发布分组结果吗?', '提示', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消'
|
||||
}).then(async ()=> {
|
||||
const resp = await $.post('/platform/activity/group/releaseGroupResult', {
|
||||
activityId: this.pageForm.activityId
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
await this.pageData()
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
async doRemove(row) {
|
||||
this.$confirm('此操作将会删除与该小队相关的所有信息,确定要删除吗?', '提示', {
|
||||
type: 'warning',
|
||||
|
||||
Reference in New Issue
Block a user