commit
This commit is contained in:
+24
-7
@@ -166,14 +166,31 @@ public class ActScoreEnterController {
|
||||
""").setParam("activityId", activityId);
|
||||
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.setScoreName("得分");
|
||||
item.setRankingName("名次");
|
||||
});
|
||||
ActivityItem activityItem = new ActivityItem();
|
||||
activityItem.setName("总分");
|
||||
activityItem.setId(0L);
|
||||
itemList.add(activityItem);
|
||||
List<ActItemGroupScore> scoreList = dao.query(ActItemGroupScore.class, Cnd.where(ActItemGroupScore::getActivityId, "=", activityId));
|
||||
|
||||
listMap.stream().forEach(group -> {
|
||||
itemList.forEach(item -> {
|
||||
List<Map<String, Object>> itemLists = new ArrayList<>();
|
||||
|
||||
Map<String, Object> itemListMap = new HashMap<>();
|
||||
itemList.forEach(item -> {
|
||||
itemListMap.put("name",item.getName());
|
||||
itemListMap.put("scoreName","成绩");
|
||||
itemListMap.put("rankingName","名次");
|
||||
itemListMap.put("scoreVal","t." + item.getName() + ".score");
|
||||
itemListMap.put("rankingVal","t." + item.getName() + ".ranking");
|
||||
itemLists.add(itemListMap);
|
||||
});
|
||||
for (int j = 0; j < listMap.size(); j++) {
|
||||
NutMap group = listMap.get(j);
|
||||
for (int i = 0; i < itemList.size(); i++) {
|
||||
ActivityItem item = itemList.get(i);
|
||||
if (item.getId() == 0) {
|
||||
BigDecimal totalScore = scoreList.stream().filter(score -> score.getGroupId().equals(group.getLong("id")) && score.getScore() != null).map(ActItemGroupScore::getScore).reduce(BigDecimal::add).orElse(new BigDecimal(0));
|
||||
group.put("totalScore", totalScore);
|
||||
@@ -181,14 +198,14 @@ 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(item.getName() + "score", itemGroupScore.getScore());
|
||||
group.put(item.getName() + "ranking", itemGroupScore.getRanking());
|
||||
group.put("score", itemGroupScore.getScore());
|
||||
group.put("ranking", itemGroupScore.getRanking());
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("mapList", listMap);
|
||||
map.put("title", activity.getTitle());
|
||||
map.put("activityName", activity.getTitle());
|
||||
map.put("itemList", itemList);
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String((activity.getTitle() + "评分表.xlsx").getBytes(StandardCharsets.UTF_8), "ISO8859-1"));
|
||||
|
||||
@@ -55,4 +55,8 @@ public class ActivityItem extends BaseModel {
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer sort;
|
||||
private String scoreName;
|
||||
private String rankingName;
|
||||
private String scoreVal;
|
||||
private String rankingVal;
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user