This commit is contained in:
2025-04-30 14:00:38 +08:00
parent 5ad48c3713
commit 217e6fc628
4 changed files with 12 additions and 9 deletions
@@ -121,9 +121,8 @@ public class ActScoreEnterController {
@Aop(TransAop.READ_COMMITTED)
@ApiOperation(value = "保存成绩", nickname = "/list-activity", httpMethod = "POST")
public Result saveScore(ActItemScoreVo actItemScoreVo) {
List<ActivityItem> itemList = dao.query(ActivityItem.class, Cnd.where(ActivityItem::getActivityId, "=", actItemScoreVo.getActivityId()));
dao.clear(ActItemGroupScore.class, Cnd.where(ActItemGroupScore::getActivityId, "=", actItemScoreVo.getActivityId()));
// dao.clear(ActItemGroupScore.class, Cnd.where(ActItemGroupScore::getActivityId, "=", actItemScoreVo.getActivityId()));
List<ActItemGroupScore> activityItemScores = new ArrayList<>();
actItemScoreVo.getData().forEach(item -> {
itemList.forEach(i -> {
@@ -132,8 +131,9 @@ public class ActScoreEnterController {
if (Lang.isNotEmpty(data)) {
String totalScore = StrUtil.isNotEmpty(data.getString("totalScore")) ? data.getString("totalScore") : "0";
score.setScore(new BigDecimal(totalScore));
int totalRank = data.getInt("totalRank");
int totalRank = data.getInt("totalRank", 0);
score.setRanking(totalRank);
score.setId(data.getLong("id"));
} else {
score.setScore(new BigDecimal(0));
score.setRanking(0);
@@ -145,7 +145,7 @@ public class ActScoreEnterController {
});
});
dao.insert(activityItemScores);
dao.update(activityItemScores);
return Result.success();
}
@@ -163,6 +163,7 @@ layout("/layouts/platform_1.html"){
let data = this.itemScoreList.find(s => s.groupId === group.id && s.itemId === item.id);
if (data) {
row[item.id] = {
id: data.id,
totalScore: data.score ? data.score : null,
totalRank: data.ranking ? data.ranking : null
}