commit
This commit is contained in:
+17
-1
@@ -118,7 +118,12 @@ public class ClientGroupController {
|
||||
@At("/apply-leader/?")
|
||||
@AdaptBy(type = JsonAdaptor.class)
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
public Result applyLeader(Long groupId) {
|
||||
public synchronized Result applyLeader(Long groupId) {
|
||||
int count = clientActivityService.dao().count(ActGroupUser.class, Cnd.where(ActGroupUser::getGroupId, "=", groupId)
|
||||
.and(ActGroupUser::getIsLeader, "=", 1));
|
||||
if (count > 0){
|
||||
return Result.error("该团队已有队长!");
|
||||
}
|
||||
clientActivityService.dao().update(ActGroupUser.class,
|
||||
Chain.make("isLeader", true),
|
||||
Cnd.where(ActGroupUser::getGroupId, "=", groupId)
|
||||
@@ -126,6 +131,17 @@ public class ClientGroupController {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At("/cancel-leader/?")
|
||||
@AdaptBy(type = JsonAdaptor.class)
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
public synchronized Result cancelLeader(Long groupId) {
|
||||
clientActivityService.dao().update(ActGroupUser.class,
|
||||
Chain.make("isLeader", false),
|
||||
Cnd.where(ActGroupUser::getGroupId, "=", groupId)
|
||||
.and(ActGroupUser::getUserId, "=", StpClientUtil.STP.getLoginIdAsLong()));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At("/list-team/?")
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
public Result listTeam(Long activityId) {
|
||||
|
||||
+7
-3
@@ -167,6 +167,7 @@ public class ActScoreEnterController {
|
||||
List<NutMap> listMap = activityService.listMap(sql);
|
||||
List<ActivityItem> itemList = activityService.dao().query(ActivityItem.class, Cnd.where(ActivityItem::getActivityId, "=", activityId).asc(ActivityItem::getSort));
|
||||
itemList.forEach(item -> {
|
||||
item.setCjName("成绩");
|
||||
item.setScoreName("得分");
|
||||
item.setRankingName("名次");
|
||||
});
|
||||
@@ -181,10 +182,12 @@ public class ActScoreEnterController {
|
||||
Map<String, Object> itemListMap = new HashMap<>();
|
||||
itemList.forEach(item -> {
|
||||
itemListMap.put("name",item.getName());
|
||||
itemListMap.put("scoreName","成绩");
|
||||
itemListMap.put("cjName","成绩");
|
||||
itemListMap.put("rankingName","名次");
|
||||
itemListMap.put("scoreVal","t." + item.getName() + ".score");
|
||||
itemListMap.put("scoreName","积分");
|
||||
itemListMap.put("cjVal","t." + item.getName() + ".cj");
|
||||
itemListMap.put("rankingVal","t." + item.getName() + ".ranking");
|
||||
itemListMap.put("scoreVal","t." + item.getName() + ".score");
|
||||
itemLists.add(itemListMap);
|
||||
});
|
||||
for (int j = 0; j < listMap.size(); j++) {
|
||||
@@ -198,8 +201,9 @@ public class ActScoreEnterController {
|
||||
ActItemGroupScore itemGroupScore = scoreList.stream().filter(score ->
|
||||
score.getGroupId().equals(group.getLong("id"))
|
||||
&& score.getItemId().equals(item.getId())).findFirst().orElse(null);
|
||||
group.put("score", itemGroupScore.getScore());
|
||||
group.put("cj", itemGroupScore.getCj());
|
||||
group.put("ranking", itemGroupScore.getRanking());
|
||||
group.put("score", itemGroupScore.getScore());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-6
@@ -95,15 +95,21 @@ public class ActScoreEntryController {
|
||||
@At("/save-score")
|
||||
@SaCheckPermission("activity.group")
|
||||
@ApiOperation(value = "保存成绩", nickname = "/save-score", httpMethod = "POST")
|
||||
public Result saveScore(@Param("scores") ActItemGroupScore[] actItemGroupScore) {
|
||||
public Result saveScore(@Param("scores") ActItemGroupScore[] actItemGroupScore, @Param("activityId") String activityId) {
|
||||
// 更新分数和名次
|
||||
dao.updateIgnoreNull(actItemGroupScore);
|
||||
|
||||
// 更新总得分
|
||||
// ActGroup actGroup = dao.fetch(ActGroup.class, actItemGroupScore.getGroupId());
|
||||
// BigDecimal newTotalScore = actGroup.getTotalScore().add(actItemGroupScore.getScore());
|
||||
// actGroup.setTotalScore(newTotalScore);
|
||||
// dao.update(actGroup);
|
||||
//查询这个活动所有成绩
|
||||
List<ActItemGroupScore> scoreList = dao.query(ActItemGroupScore.class, Cnd.where(ActItemGroupScore::getActivityId, "=", activityId));
|
||||
for (ActItemGroupScore score : actItemGroupScore) {
|
||||
Long groupId = score.getGroupId();
|
||||
//在找出这个队伍下面所有的分数
|
||||
List<ActItemGroupScore> groupScoreList = scoreList.stream().filter(itemScore -> itemScore.getGroupId().equals(groupId)).toList();
|
||||
BigDecimal totalScore = groupScoreList.stream()
|
||||
.map(ActItemGroupScore::getScore) // 提取每个 score(BigDecimal)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
dao.update(ActGroup.class, Chain.make("totalScore", totalScore), Cnd.where(ActGroup::getId, "=", groupId));
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -47,4 +47,9 @@ public class ActItemGroupScore extends BaseModel {
|
||||
@Comment("队伍排名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String ranking;
|
||||
|
||||
@Column
|
||||
@Comment("成绩")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String cj;
|
||||
}
|
||||
|
||||
@@ -27,4 +27,5 @@ public class ActRankScore extends BaseModel {
|
||||
@ColDefine(customType = "decimal", width = 10, precision = 2)
|
||||
private BigDecimal score;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -166,4 +166,9 @@ public class ActUser extends BaseModel {
|
||||
@Default("0")
|
||||
private Boolean isParty;
|
||||
|
||||
@Column
|
||||
@Comment("体重KG")
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
private Double weight;
|
||||
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ public class ActivityItem extends BaseModel {
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer sort;
|
||||
private String cjName;
|
||||
private String scoreName;
|
||||
private String rankingName;
|
||||
private String scoreVal;
|
||||
|
||||
Binary file not shown.
@@ -42,25 +42,28 @@ layout("/layouts/platform_1.html"){
|
||||
<el-button type="primary" size="small" @click="openBigScreen">打开成绩大屏</el-button>
|
||||
<el-button type="primary" size="small" @click="doExport">导出</el-button>
|
||||
</el-row>
|
||||
<el-table v-loading="tableLoading" show-overflow-tooltip :data="tableData" @cell-click="cellClick">
|
||||
<el-table v-loading="tableLoading" show-overflow-tooltip :data="tableData" @cell-click="cellClick" style="width: 100%">
|
||||
<el-table-column label="队伍" prop="groupName" fixed="left" width="100px"></el-table-column>
|
||||
|
||||
<el-table-column v-for="item in itemOptions" :key="item.id" :label="item.name" show-overflow-tooltip
|
||||
width="10%">
|
||||
<el-table-column v-for="item in itemOptions" :key="item.id" :label="item.name" >
|
||||
<template slot="header" slot-scope="scope">
|
||||
<span v-html="formatName(item.name)"></span>
|
||||
</template>
|
||||
<el-table-column label="成绩" :prop="item.id+item.name" min-width="50px">
|
||||
<el-table-column label="成绩" :prop="item.id+item.name" min-width="50px" v-if="item.id!=='all'">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row[item.id]['totalScore']}}
|
||||
{{scope.row[item.id]['totalCj']}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="名次" :prop="item.id+item.name" min-width="50px" v-if="item.id!=='all'">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row[item.id]['totalRank']}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="积分" :prop="item.id+item.name" min-width="50px">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row[item.id]['totalScore']}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- <el-row type="flex" justify="end" class="mt-3">
|
||||
@@ -96,7 +99,8 @@ layout("/layouts/platform_1.html"){
|
||||
// 格式化名称
|
||||
formatName(name) {
|
||||
if (!name) return ""
|
||||
return name.match(/.{1,4}/g)?.join("<br>") || ""
|
||||
// return name.match(/.{1,4}/g)?.join("<br>") || ""
|
||||
return name
|
||||
},
|
||||
// 获取活动
|
||||
listAct() {
|
||||
@@ -183,7 +187,8 @@ layout("/layouts/platform_1.html"){
|
||||
row[item.id] = {
|
||||
id: data.id,
|
||||
totalScore: data.score ? data.score : null,
|
||||
totalRank: data.ranking ? data.ranking : null
|
||||
totalRank: data.ranking ? data.ranking : null,
|
||||
totalCj: data.cj ? data.cj : null
|
||||
}
|
||||
} else {
|
||||
row[item.id] = {
|
||||
|
||||
@@ -92,6 +92,15 @@ layout("/layouts/platform_1.html"){
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成绩" width="250">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="getScoreRecord(item.id, scope.row.id).cj"
|
||||
placeholder="请输入成绩"
|
||||
class="remark-input">
|
||||
</el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="名次设置" width="220">
|
||||
<template slot-scope="scope">
|
||||
<el-select
|
||||
@@ -108,7 +117,7 @@ layout("/layouts/platform_1.html"){
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="得分">
|
||||
<el-table-column label="积分">
|
||||
<template slot-scope="scope">
|
||||
<div class="score-value"
|
||||
:class="{'has-score': getScoreRecord(item.id, scope.row.id).score}">
|
||||
@@ -273,11 +282,13 @@ layout("/layouts/platform_1.html"){
|
||||
itemId: score.itemId,
|
||||
groupId: score.groupId,
|
||||
score: score.score,
|
||||
cj: score.cj,
|
||||
ranking: score.ranking
|
||||
}))
|
||||
|
||||
const { code, msg } = await $.post("/platform/activity/scoreEntry/save-score", {
|
||||
scores: JSON.stringify(postData)
|
||||
scores: JSON.stringify(postData),
|
||||
activityId: this.pageForm.activityId
|
||||
})
|
||||
|
||||
if (code === 0) {
|
||||
|
||||
Reference in New Issue
Block a user