commit
This commit is contained in:
@@ -5,15 +5,11 @@ import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.expression.ExpressionUtil;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.flow.engine.core.Execution;
|
||||
import com.budwk.app.flow.engine.handlers.IHandler;
|
||||
import com.budwk.app.flow.engine.model.TaskModel;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.enums.CountersignTypeEnum;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -85,6 +81,13 @@ public class CountersignHandler implements IHandler {
|
||||
if (!isMerged && CountersignTypeEnum.PARALLEL.toString().equalsIgnoreCase(countersignType)) {
|
||||
// 是否所有会签任务已完成
|
||||
boolean finished = execution.getEngine().processTaskService().getDoingTaskList(execution.getProcessInstanceId(), new String[]{taskModel.getName()}).size() == 0;
|
||||
|
||||
if(StrUtil.isNotBlank(countersignCompletionCondition) && finished) {
|
||||
execution.getEngine().processTaskService().rejectTask(execution.getProcessModel(), execution.getProcessTask());
|
||||
} else {
|
||||
isMerged = finished;
|
||||
}
|
||||
|
||||
if (!isMerged) {
|
||||
// 未通过,更新已完成实例数量
|
||||
Dict addVariable = Dict.create();
|
||||
@@ -92,9 +95,6 @@ public class CountersignHandler implements IHandler {
|
||||
addVariable.put(prefix + FlowConst.NR_OF_COMPLETED_AGREE_INSTANCES, execution.getArgs().get(prefix + FlowConst.NR_OF_COMPLETED_AGREE_INSTANCES));
|
||||
execution.getEngine().processInstanceService().addVariable(execution.getProcessInstanceId(), addVariable);
|
||||
}
|
||||
if(finished) {
|
||||
execution.getEngine().processTaskService().rejectTask(execution.getProcessModel(), execution.getProcessTask());
|
||||
}
|
||||
}
|
||||
if (isMerged) {
|
||||
// 获取所有会签参数键值
|
||||
|
||||
+305
@@ -0,0 +1,305 @@
|
||||
package com.budwk.app.zhgh.activity.sports.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
import com.budwk.app.sys.services.SysUnionService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2021/5/27 15:57
|
||||
* @description 奖品名单
|
||||
*/
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/activity/prize/list")
|
||||
public class ActivityPrizeListController {
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:platform/zhgh/activity/sports/ActivityPrize/index.html")
|
||||
@SaCheckPermission("activity.prize.list")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@Inject
|
||||
private SysUnionService sysUnionService;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
/**
|
||||
* 各个分工会奖品
|
||||
*
|
||||
* @param activityId
|
||||
* @param unionId
|
||||
* @return
|
||||
*/
|
||||
|
||||
@At
|
||||
@ApiOperation("获取各个分工会每个项目前八名")
|
||||
@SaCheckPermission("activity.prize.list")
|
||||
public Result getPrizes(Integer year, String activityId, String unionId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
acr.activityId,
|
||||
ace.allName,
|
||||
acr.userId,
|
||||
acr.ranking,
|
||||
acr.numberOfPeople,
|
||||
ace.isMenWomen,
|
||||
acs.`name` as activityName,
|
||||
u.username,
|
||||
RIGHT(ace.allName,4) xmlx,
|
||||
LEFT(ace.allName,2) xblx
|
||||
FROM activity_school_event acse
|
||||
left join activity_school acs on acs.id = acse.activityId
|
||||
left join activity_event ace on ace.id = acse.eventId
|
||||
left join activity_results acr on acr.eventId = acse.eventId
|
||||
left join sys_user u on u.id = acr.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("acr.activityId", "=", activityId);
|
||||
cnd.and("YEAR(acs.applyStartTime)", "=", year);
|
||||
// cnd.and("ace.isInterest", "=", 0);
|
||||
cnd.and("acr.unionId", "=", unionId);
|
||||
cnd.asc("ace.allName").asc("acr.ranking");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> allList = baseService.listMap(sql);
|
||||
if (Lang.isEmpty(allList)) {
|
||||
return Result.success(Map.of("团体项目", Map.of(), "男子项目", Map.of(), "女子项目", Map.of(), "其他", Map.of()));
|
||||
}
|
||||
|
||||
Map maleMap = NutMap.NEW();
|
||||
Map femaleMap = NutMap.NEW();
|
||||
Map teamMap = NutMap.NEW();
|
||||
Map otherMap = NutMap.NEW();
|
||||
|
||||
Map<String, List<NutMap>> xmlxList = allList.stream().collect(Collectors.groupingBy(v -> v.getString("xmlx")));
|
||||
|
||||
if (Lang.isNotEmpty(xmlxList.get("(团体)"))) {
|
||||
teamMap = xmlxList.get("(团体)").stream().collect(Collectors.groupingBy(v -> v.getString("allName")));
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(xmlxList.get("(单项)")) && xmlxList.get("(单项)").stream().anyMatch(v -> v.getString("xblx").equals("男子"))) {
|
||||
maleMap = xmlxList.get("(单项)").stream().filter(v -> v.getString("xblx").equals("男子")).collect(Collectors.groupingBy(h -> h.getString("allName")));
|
||||
}
|
||||
|
||||
if (Lang.isNotEmpty(xmlxList.get("(单项)")) && xmlxList.get("(单项)").stream().anyMatch(v -> v.getString("xblx").equals("女子"))) {
|
||||
femaleMap = xmlxList.get("(单项)").stream().filter(v -> v.getString("xblx").equals("女子")).collect(Collectors.groupingBy(h -> h.getString("allName")));
|
||||
}
|
||||
return Result.success(Map.of("团体项目", teamMap, "男子项目", maleMap, "女子项目", femaleMap, "其他", otherMap));
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("获取每一年每个项目前八都是谁")
|
||||
@SaCheckPermission("activity.prize.list")
|
||||
public Result getSummaryYearPrizes(Integer year, String sex) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ace.projectCode,
|
||||
acs.id activityId,
|
||||
ace.allName,
|
||||
acr.userId,
|
||||
acr.ranking,
|
||||
acr.numberOfPeople,
|
||||
acr.integral,
|
||||
ace.isMenWomen,
|
||||
acs.`name` AS activityName,
|
||||
CONCAT(u.username,'/',u.unionname) username,
|
||||
un.name unionname,
|
||||
ace.isInterest,
|
||||
bszb.`code` bszbCode,
|
||||
bszb.`name` bszbName,
|
||||
RIGHT ( ace.allName, 4 ) xmlx,
|
||||
LEFT ( ace.allName, 2 ) xblx
|
||||
FROM
|
||||
activity_school_event acse
|
||||
LEFT JOIN activity_school acs ON acs.id = acse.activityId
|
||||
LEFT JOIN activity_event ace ON ace.id = acse.eventId
|
||||
LEFT JOIN activity_basic_settings bszb ON bszb.id=ace.competitionCategory
|
||||
LEFT JOIN activity_results acr ON acr.eventId = acse.eventId
|
||||
AND acr.activityId = acs.id
|
||||
LEFT JOIN sys_union un ON un.id=acr.unionId
|
||||
LEFT JOIN `vw_user` u ON u.id = acr.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("YEAR(acs.startTime)", "=", year);
|
||||
if ("男".equals(sex)) {
|
||||
cnd.and(Cnd.exps("ace.isMenWomen", "=", "1").or("ace.isMenWomen", "is", null));
|
||||
} else {
|
||||
cnd.and(Cnd.exps("ace.isMenWomen", "=", "2").or("ace.isMenWomen", "is", null));
|
||||
}
|
||||
cnd.asc("ace.projectCode").asc("acr.ranking");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> allList =baseService.listMap( sql);
|
||||
if (Lang.isEmpty(allList)) {
|
||||
return Result.success(Map.of("甲组", Map.of(), "乙组", Map.of(), "丙组", Map.of(), "丁组", Map.of(), "集体项目", Map.of()));
|
||||
}
|
||||
allList.forEach(a -> {
|
||||
a.setv("allName", a.getString("allName").replaceAll("男子|女子|\\(单项\\)|\\(团体\\)|甲组|乙组|丙组|丁组|团体", ""));
|
||||
});
|
||||
|
||||
Map oneMap = NutMap.NEW();
|
||||
Map twoMap = NutMap.NEW();
|
||||
Map threeMap = NutMap.NEW();
|
||||
Map fourMap = NutMap.NEW();
|
||||
Map fiveMap = NutMap.NEW();
|
||||
|
||||
//甲组
|
||||
List<NutMap> oneList = allList.stream().filter(a -> a.getString("bszbName").equals("甲组")).collect(toList());
|
||||
if (Lang.isNotEmpty(oneList)) {
|
||||
oneMap = oneList.stream().collect(Collectors.groupingBy(v -> v.getString("allName")));
|
||||
}
|
||||
|
||||
//乙组
|
||||
List<NutMap> twoList = allList.stream().filter(a -> a.getString("bszbName").equals("乙组")).collect(toList());
|
||||
if (Lang.isNotEmpty(twoList)) {
|
||||
twoMap = twoList.stream().collect(Collectors.groupingBy(v -> v.getString("allName")));
|
||||
}
|
||||
|
||||
|
||||
//丙组
|
||||
List<NutMap> threeList = allList.stream().filter(a -> a.getString("bszbName").equals("丙组")).collect(toList());
|
||||
if (Lang.isNotEmpty(threeList)) {
|
||||
threeMap = threeList.stream().collect(Collectors.groupingBy(v -> v.getString("allName")));
|
||||
}
|
||||
|
||||
|
||||
//丁组
|
||||
List<NutMap> fourList = allList.stream().filter(a -> a.getString("bszbName").equals("丁组")).collect(toList());
|
||||
if (Lang.isNotEmpty(fourList)) {
|
||||
fourMap = fourList.stream().collect(Collectors.groupingBy(v -> v.getString("allName")));
|
||||
}
|
||||
|
||||
//团体
|
||||
List<NutMap> fiveList = allList.stream().filter(a -> a.getString("bszbName").equals("团体")).collect(toList());
|
||||
if (Lang.isNotEmpty(fiveList)) {
|
||||
fiveMap = fiveList.stream().collect(Collectors.groupingBy(v -> v.getString("allName")));
|
||||
}
|
||||
NutMap map = new NutMap();
|
||||
map.put("甲组", oneMap);
|
||||
map.put("乙组", twoMap);
|
||||
map.put("丙组", threeMap);
|
||||
map.put("丁组", fourMap);
|
||||
map.put("集体项目", fiveMap);
|
||||
return Result.success(map);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("获取各个分工会年度前八名的个数")
|
||||
@SaCheckPermission("activity.prize.list")
|
||||
public Result summary(String activityId) {
|
||||
|
||||
NutMap map = new NutMap();
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
|
||||
//查询所有的工会
|
||||
List<Sys_union> query = sysUnionService.query();
|
||||
for (Sys_union sys_union : query) {
|
||||
NutMap nutMap = new NutMap();
|
||||
|
||||
//记录总人数
|
||||
int totalPeople = 0;
|
||||
nutMap.setv("unionname", sys_union.getName());
|
||||
for (int i = 1; i <= 8; i++) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
IFNULL((
|
||||
SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
activity_results ar1
|
||||
WHERE
|
||||
ar1.activityId = ar2.activityId
|
||||
AND ar1.ranking = ar2.ranking
|
||||
AND ar1.isTeamPersonal = 1
|
||||
AND ar1.unionId = ar2.unionId
|
||||
),
|
||||
0
|
||||
) num,
|
||||
IFNULL( SUM( numberOfPeople ), 0 ) numberOfPeople
|
||||
FROM
|
||||
activity_results ar2 $condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("ar2.activityId", "=", activityId);
|
||||
cnd.and("ar2.ranking", "=", i);
|
||||
cnd.and("ar2.unionId", "=", sys_union.getId());
|
||||
cnd.and("ar2.isTeamPersonal", "in", "1,2");
|
||||
sql.setCondition(cnd);
|
||||
int number = 0;
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
if (!list.isEmpty()) {
|
||||
number = list.get(0).getInt("num") + list.get(0).getInt("numberOfPeople");
|
||||
}
|
||||
totalPeople += number;
|
||||
if (i == 1) {
|
||||
nutMap.setv("one", number);
|
||||
} else if (i == 2) {
|
||||
nutMap.setv("two", number);
|
||||
} else if (i == 3) {
|
||||
nutMap.setv("three", number);
|
||||
} else if (i == 4) {
|
||||
nutMap.setv("four", number);
|
||||
} else if (i == 5) {
|
||||
nutMap.setv("fives", number);
|
||||
} else if (i == 6) {
|
||||
nutMap.setv("six", number);
|
||||
} else if (i == 7) {
|
||||
nutMap.setv("seven", number);
|
||||
} else if (i == 8) {
|
||||
nutMap.setv("eight", number);
|
||||
}
|
||||
|
||||
}
|
||||
nutMap.setv("totalPeople", totalPeople);
|
||||
result.add(nutMap);
|
||||
|
||||
|
||||
}
|
||||
map.put("score", result);
|
||||
return Result.success(map);
|
||||
}
|
||||
|
||||
@Data
|
||||
private class Ranking {
|
||||
|
||||
private int one;
|
||||
private int two;
|
||||
private int three;
|
||||
private int four;
|
||||
private int fives;
|
||||
private int six;
|
||||
private int seven;
|
||||
private int eight;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+2
-3
@@ -222,16 +222,15 @@ public class ActivitySportsResultsController {
|
||||
|
||||
SELECT
|
||||
un.id,
|
||||
un.unionname
|
||||
un.name unionname
|
||||
FROM
|
||||
activity_school_apply asa
|
||||
LEFT JOIN sys_union un ON un.id = asa.unionId
|
||||
WHERE
|
||||
asa.activityId = @activityId
|
||||
AND asa.eventId = @eventId
|
||||
|
||||
GROUP BY
|
||||
un.unionname
|
||||
un.name
|
||||
""").setParam("activityId", activityId).setParam("eventId", eventId);
|
||||
return Result.success(activitySchoolApplyViService.list(sql));
|
||||
}
|
||||
|
||||
+23
-135
@@ -13,6 +13,7 @@ import com.budwk.app.sys.models.Sys_union;
|
||||
import com.budwk.app.sys.services.SysUnionService;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchool;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchoolEvent;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
@@ -64,7 +65,8 @@ public class ActivitySportsScoreStatisticsController {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("activity.score.statistics")
|
||||
@ApiOperation("男子项目分工会积分/女子项目分工会积分")
|
||||
public Result isMaleFemale(String activityId, String sex, Integer awardsMode) {
|
||||
|
||||
NutMap map = new NutMap();
|
||||
@@ -91,13 +93,13 @@ public class ActivitySportsScoreStatisticsController {
|
||||
if (awardsMode < 3) {
|
||||
cndX.and("eve.projectType", "=", awardsMode);
|
||||
cndX.and("eve.isInterest", "=", false);
|
||||
cndX.and("eve.isMenWomen", "=", sex.equals("男性") ? 1 : 2);
|
||||
cndX.and("eve.isMenWomen", "=", sex.equals("男") ? 1 : 2);
|
||||
}
|
||||
if (awardsMode == 3) {
|
||||
cndX.and("eve.isInterest", "=", true);
|
||||
}
|
||||
if (awardsMode == 4) {
|
||||
cndX.and(Cnd.exps("eve.isMenWomen", "=", sex.equals("男性") ? 1 : 2).or("eve.isMenWomen", "is", null));
|
||||
cndX.and(Cnd.exps("eve.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("eve.isMenWomen", "is", null));
|
||||
}
|
||||
cndX.and(new Static("1=1 order by case ba.`name` when '甲组' then 1 when '乙组' then 2 when '丙组' then 3 when '丁组' then 4 when '团体' then 5 end"));
|
||||
sqlX.setCondition(cndX);
|
||||
@@ -122,11 +124,11 @@ public class ActivitySportsScoreStatisticsController {
|
||||
Cnd cndC = Cnd.NEW();
|
||||
if ((awardsMode == 1 && event.getString("awardsMode").equals("1")) || (awardsMode == 2 && event.getString("awardsMode").equals("2"))) {
|
||||
cndC.and("ev.isInterest", "=", false);
|
||||
cndC.and("ev.isMenWomen", "=", sex.equals("男性") ? 1 : 2);
|
||||
cndC.and("ev.isMenWomen", "=", sex.equals("男") ? 1 : 2);
|
||||
} else if (awardsMode == 3) {
|
||||
cndC.and("ev.isInterest", "=", true);
|
||||
} else if (awardsMode == 4) {
|
||||
cndC.and(Cnd.exps("ev.isMenWomen", "=", sex.equals("男性") ? 1 : 2).or("ev.isMenWomen", "is", null));
|
||||
cndC.and(Cnd.exps("ev.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("ev.isMenWomen", "is", null));
|
||||
}
|
||||
cndC.and("ar.eventId", "=", event.getString("eventid"));
|
||||
cndC.and("ar.unionid", "=", sys_union.getId());
|
||||
@@ -165,7 +167,8 @@ public class ActivitySportsScoreStatisticsController {
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("activity.score.statistics")
|
||||
@ApiOperation("单子单项前八/女子单项前八/团体项目前八")
|
||||
public Result isTopEight(String activityId, String sex, Integer awardsMode) {
|
||||
NutMap map = new NutMap();
|
||||
Cnd cndX = Cnd.NEW();
|
||||
@@ -184,7 +187,7 @@ public class ActivitySportsScoreStatisticsController {
|
||||
""");
|
||||
cndX.and("ev.activityId", "=", activityId);
|
||||
if (awardsMode == 1) {
|
||||
cndX.and("eve.isMenWomen", "!=", sex.equals("男性") ? 2 : 1);
|
||||
cndX.and("eve.isMenWomen", "!=", sex.equals("男") ? 2 : 1);
|
||||
cndX.and("eve.projectType", "=", 1);
|
||||
|
||||
} else {
|
||||
@@ -249,7 +252,8 @@ public class ActivitySportsScoreStatisticsController {
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("activity.score.statistics")
|
||||
@ApiOperation("男子总分前八/女子总分前八")
|
||||
public Result isScoreTopEight(String activityId, String sex) {
|
||||
|
||||
NutMap map = new NutMap();
|
||||
@@ -269,7 +273,7 @@ public class ActivitySportsScoreStatisticsController {
|
||||
LEFT JOIN activity_basic_settings ba ON eve.competitionCategory = ba.id $condition
|
||||
""");
|
||||
cndX.and("ev.activityId", "=", activityId);
|
||||
cndX.and(Cnd.exps("eve.isMenWomen", "=", sex.equals("男性") ? 1 : 2).or("eve.isMenWomen", "is", null));
|
||||
cndX.and(Cnd.exps("eve.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("eve.isMenWomen", "is", null));
|
||||
cndX.and(new Static("1=1 order by case ba.`name` when '甲组' then 1 when '乙组' then 2 when '丙组' then 3 when '丁组' then 4 when '团体' then 5 end"));
|
||||
sqlX.setCondition(cndX);
|
||||
List<Record> eventList = baseService.list(sqlX);
|
||||
@@ -293,7 +297,7 @@ public class ActivitySportsScoreStatisticsController {
|
||||
LEFT JOIN activity_event ev ON ar.eventId = ev.id $condition
|
||||
""");
|
||||
Cnd cndC = Cnd.NEW();
|
||||
cndC.and(Cnd.exps("ev.isMenWomen", "=", sex.equals("男性") ? 1 : 2).or("ev.isMenWomen", "is", null));
|
||||
cndC.and(Cnd.exps("ev.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("ev.isMenWomen", "is", null));
|
||||
cndC.and("ar.unionid", "=", sys_union.getId());
|
||||
cndC.and("ar.eventId", "=", event.getString("eventid"));
|
||||
cndC.and("ar.activityId", "=", activityId);
|
||||
@@ -318,7 +322,8 @@ public class ActivitySportsScoreStatisticsController {
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("activity.score.statistics")
|
||||
@ApiOperation("年度团体总分")
|
||||
public Result getAnnualResults(Integer year) {
|
||||
|
||||
ArrayList<Map> resultMap = new ArrayList<>();
|
||||
@@ -349,7 +354,7 @@ public class ActivitySportsScoreStatisticsController {
|
||||
unionMap.put(x.getName(), score);
|
||||
});
|
||||
unionMap.put("总分", scoreSum.get());
|
||||
unionMap.put("分工会", unionMap.getString("unionname"));
|
||||
unionMap.put("分工会", unionMap.getString("name"));
|
||||
resultMap.add(unionMap);
|
||||
});
|
||||
labelList.add("总分");
|
||||
@@ -359,11 +364,12 @@ public class ActivitySportsScoreStatisticsController {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("年度男子团体总分/年度女子团体总分")
|
||||
@SaCheckPermission("activity.score.statistics")
|
||||
public Result getYear8(Integer isMenWomen, Integer year) {
|
||||
ArrayList<Map> resultMap = new ArrayList<>();
|
||||
|
||||
// int isMenWomen = sex.equals("男性") ? 1 : 2;
|
||||
// int isMenWomen = sex.equals("男") ? 1 : 2;
|
||||
|
||||
Dao dao = sysUnionService.dao();
|
||||
List<Sys_union> unionList = sysUnionService.query();
|
||||
@@ -408,7 +414,7 @@ public class ActivitySportsScoreStatisticsController {
|
||||
unionMap.put(a.getName(), sexScore + (qwScore * 0.5));
|
||||
});
|
||||
unionMap.put("总分", scoreSum.get());
|
||||
unionMap.put("分工会", unionMap.getString("unionname"));
|
||||
unionMap.put("分工会", unionMap.getString("name"));
|
||||
resultMap.add(unionMap);
|
||||
|
||||
});
|
||||
@@ -416,139 +422,21 @@ public class ActivitySportsScoreStatisticsController {
|
||||
return Result.success(Map.of("label", activityNameList, "score", resultMap));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@Ok("void")
|
||||
public void doGetYear8(HttpServletResponse response, Integer isMenWomen, Integer year) throws Exception {
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
|
||||
List<Sys_union> unionList = sysUnionService.query();
|
||||
|
||||
unionList.forEach(u -> {
|
||||
NutMap nutMap = new NutMap();
|
||||
nutMap.setv("unionname", u.getName());
|
||||
double score = 0;
|
||||
for (int i = 1; i <= 2; i++) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
SUM( ar.integral ) score
|
||||
FROM
|
||||
activity_results ar
|
||||
LEFT JOIN activity_event eve ON ar.eventId = eve.id
|
||||
LEFT JOIN activity_school `as` ON `as`.id = ar.activityId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("YEAR ( `as`.applyStartTime )", "=", year);
|
||||
cnd.and("ar.unionId", "=", u.getId());
|
||||
if (i == 1) {
|
||||
cnd.and("eve.isMenWomen", "=", isMenWomen);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
score += list.get(0).getDouble("score");
|
||||
} else {
|
||||
cnd.and("eve.isInterest", "=", 1);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
score += list.get(0).getDouble("score") * 0.5;
|
||||
}
|
||||
}
|
||||
nutMap.setv("score", score);
|
||||
result.add(nutMap);
|
||||
});
|
||||
List<NutMap> scoreList = result.stream().sorted(Comparator.comparing(ActivitySportsScoreStatisticsController::getDouble).reversed()).collect(Collectors.toList()).subList(0, 8);
|
||||
|
||||
for (int i = 0; i < scoreList.size(); i++) {
|
||||
scoreList.get(i).put("ranking", i + 1);
|
||||
}
|
||||
|
||||
|
||||
/* HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
Configure config = Configure.newBuilder().bind("scoreList", policy).build();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("year", year);
|
||||
map.put("sex", isMenWomen == 1 ? '男性' : '女');
|
||||
map.put("scoreList", scoreList);
|
||||
String fileName = "%s年运动会%s子积分表".formatted(year, isMenWomen == 1 ? '男性' : '女');
|
||||
|
||||
response.addHeader("Content-Type", "application/octet-stream");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
||||
XWPFTemplate.compile(officeTemplateUtil.getPath("activity_getYear8"), config).render(map).writeAndClose(response.getOutputStream());*/
|
||||
}
|
||||
|
||||
public static Double getDouble(NutMap o) {
|
||||
return o.getDouble("score");
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckLogin
|
||||
public void doExport8ByActivity(HttpServletResponse response, String activityId, Integer isMenWomen) throws Exception {
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
|
||||
List<Sys_union> unionList = sysUnionService.query();
|
||||
unionList.forEach(u -> {
|
||||
NutMap nutMap = new NutMap();
|
||||
nutMap.setv("unionname", u.getName());
|
||||
double score = 0;
|
||||
for (int i = 1; i <= 2; i++) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
SUM( ar.integral ) score
|
||||
FROM
|
||||
activity_results ar
|
||||
LEFT JOIN activity_event eve ON ar.eventId = eve.id
|
||||
LEFT JOIN activity_school `as` ON `as`.id = ar.activityId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("activityId", "=", activityId);
|
||||
cnd.and("ar.unionId", "=", u.getId());
|
||||
if (i == 1) {
|
||||
cnd.and("eve.isMenWomen", "=", isMenWomen);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
score += list.get(0).getDouble("score");
|
||||
} else {
|
||||
cnd.and("eve.isInterest", "=", 1);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = baseService.listMap(sql);
|
||||
score += list.get(0).getDouble("score") * 0.5;
|
||||
}
|
||||
}
|
||||
nutMap.setv("score", score);
|
||||
result.add(nutMap);
|
||||
});
|
||||
List<NutMap> scoreList = result.stream().sorted(Comparator.comparing(ActivitySportsScoreStatisticsController::getDouble).reversed()).collect(Collectors.toList()).subList(0, 8);
|
||||
|
||||
for (int i = 0; i < scoreList.size(); i++) {
|
||||
scoreList.get(i).put("ranking", i + 1);
|
||||
}
|
||||
|
||||
/*HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||
Configure config = Configure.newBuilder().bind("scoreList", policy).build();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("sex", isMenWomen == 1 ? '男性' : '女');
|
||||
map.put("scoreList", scoreList);
|
||||
String fileName = "%s子积分表".formatted(isMenWomen == 1 ? '男性' : '女');
|
||||
|
||||
response.addHeader("Content-Type", "application/octet-stream");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
|
||||
XWPFTemplate.compile(officeTemplateUtil.getPath("activity_getYear8"), config).render(map, response.getOutputStream());*/
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("activity.score.statistics")
|
||||
public void doExcelCj(String activityId, String unionId, HttpServletResponse response) throws IOException {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
un.unioncode,
|
||||
un.unionname,
|
||||
un.name unionname,
|
||||
us.loginname,
|
||||
us.username,
|
||||
us.sex,
|
||||
|
||||
+24
-17
@@ -6,12 +6,14 @@ 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.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
import com.budwk.app.sys.services.SysUnionService;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchool;
|
||||
import com.budwk.app.zhgh.activity.sports.models.ActivitySchoolEvent;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
@@ -48,7 +50,8 @@ public class ActivitySportsStatisticsTypeExportController {
|
||||
|
||||
@Ok("void")
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("年度男子团体总分/年度女子团体总分")
|
||||
@SaCheckPermission("activity.score.statistics")
|
||||
public void getYear8(Integer isMenWomen, Integer year, HttpServletResponse response) {
|
||||
ArrayList<Map> resultMap = new ArrayList<>();
|
||||
List<Sys_union> unionList = sysUnionService.query();
|
||||
@@ -90,7 +93,7 @@ public class ActivitySportsStatisticsTypeExportController {
|
||||
unionMap.put(a.getName(), sexScore + (qwScore * 0.5));
|
||||
});
|
||||
unionMap.put("总分", scoreSum.get());
|
||||
unionMap.put("分工会", unionMap.getString("unionname"));
|
||||
unionMap.put("分工会", unionMap.getString("name"));
|
||||
resultMap.add(unionMap);
|
||||
|
||||
});
|
||||
@@ -120,7 +123,8 @@ public class ActivitySportsStatisticsTypeExportController {
|
||||
|
||||
@Ok("void")
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("年度团体总分")
|
||||
@SaCheckPermission("activity.score.statistics")
|
||||
public void getAnnualResults(Integer year, HttpServletResponse response) {
|
||||
ArrayList<Map> resultMap = new ArrayList<>();
|
||||
|
||||
@@ -150,7 +154,7 @@ public class ActivitySportsStatisticsTypeExportController {
|
||||
unionMap.put(x.getName(), score);
|
||||
});
|
||||
unionMap.put("总分", scoreSum.get());
|
||||
unionMap.put("分工会", unionMap.getString("unionname"));
|
||||
unionMap.put("分工会", unionMap.getString("name"));
|
||||
resultMap.add(unionMap);
|
||||
});
|
||||
labelList.add("总分");
|
||||
@@ -180,6 +184,8 @@ public class ActivitySportsStatisticsTypeExportController {
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("activity.score.statistics")
|
||||
@ApiOperation("男子项目分工会积分/女子项目分工会积分")
|
||||
public void isMaleFemale(String activityId, String sex, Integer awardsMode, HttpServletResponse response) {
|
||||
NutMap map = new NutMap();
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
@@ -205,13 +211,13 @@ public class ActivitySportsStatisticsTypeExportController {
|
||||
if (awardsMode < 3) {
|
||||
cndX.and("eve.projectType", "=", awardsMode);
|
||||
cndX.and("eve.isInterest", "=", false);
|
||||
cndX.and("eve.isMenWomen", "=", sex.equals("男性") ? 1 : 2);
|
||||
cndX.and("eve.isMenWomen", "=", sex.equals("男") ? 1 : 2);
|
||||
}
|
||||
if (awardsMode == 3) {
|
||||
cndX.and("eve.isInterest", "=", true);
|
||||
}
|
||||
if (awardsMode == 4) {
|
||||
cndX.and(Cnd.exps("eve.isMenWomen", "=", sex.equals("男性") ? 1 : 2).or("eve.isMenWomen", "is", null));
|
||||
cndX.and(Cnd.exps("eve.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("eve.isMenWomen", "is", null));
|
||||
}
|
||||
cndX.and(new Static("1=1 order by case ba.`name` when '甲组' then 1 when '乙组' then 2 when '丙组' then 3 when '丁组' then 4 when '团体' then 5 end"));
|
||||
sqlX.setCondition(cndX);
|
||||
@@ -236,11 +242,11 @@ public class ActivitySportsStatisticsTypeExportController {
|
||||
Cnd cndC = Cnd.NEW();
|
||||
if ((awardsMode == 1 && event.getString("awardsMode").equals("1")) || (awardsMode == 2 && event.getString("awardsMode").equals("2"))) {
|
||||
cndC.and("ev.isInterest", "=", false);
|
||||
cndC.and("ev.isMenWomen", "=", sex.equals("男性") ? 1 : 2);
|
||||
cndC.and("ev.isMenWomen", "=", sex.equals("男") ? 1 : 2);
|
||||
} else if (awardsMode == 3) {
|
||||
cndC.and("ev.isInterest", "=", true);
|
||||
} else if (awardsMode == 4) {
|
||||
cndC.and(Cnd.exps("ev.isMenWomen", "=", sex.equals("男性") ? 1 : 2).or("ev.isMenWomen", "is", null));
|
||||
cndC.and(Cnd.exps("ev.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("ev.isMenWomen", "is", null));
|
||||
}
|
||||
cndC.and("ar.eventId", "=", event.getString("eventid"));
|
||||
cndC.and("ar.unionid", "=", sys_union.getId());
|
||||
@@ -296,9 +302,9 @@ public class ActivitySportsStatisticsTypeExportController {
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("activity.score.statistics")
|
||||
@ApiOperation("单子单项前八/女子单项前八/团体项目前八")
|
||||
public void isTopEight(String activityId, String sex, Integer awardsMode, HttpServletResponse response) {
|
||||
NutMap map = new NutMap();
|
||||
List<Record> result = new ArrayList<>();
|
||||
Cnd cndX = Cnd.NEW();
|
||||
//查询所有的项目
|
||||
Sql sqlX = Sqls.create("""
|
||||
@@ -315,7 +321,7 @@ public class ActivitySportsStatisticsTypeExportController {
|
||||
""");
|
||||
cndX.and("ev.activityId", "=", activityId);
|
||||
if (awardsMode == 1) {
|
||||
cndX.and("eve.isMenWomen", "!=", sex.equals("男性") ? 2 : 1);
|
||||
cndX.and("eve.isMenWomen", "!=", sex.equals("男") ? 2 : 1);
|
||||
cndX.and("eve.projectType", "=", 1);
|
||||
|
||||
} else {
|
||||
@@ -330,7 +336,7 @@ public class ActivitySportsStatisticsTypeExportController {
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
NutMap nutMap = new NutMap();
|
||||
Sql sqlC = Sqls.create("");
|
||||
Sql sqlC;
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (awardsMode == 1) {
|
||||
sqlC = Sqls.create("""
|
||||
@@ -386,12 +392,12 @@ public class ActivitySportsStatisticsTypeExportController {
|
||||
eventList.forEach(v -> {
|
||||
entityList.add(new ExcelExportEntity(v.getString("label"), v.getString("label"), 40));
|
||||
});
|
||||
String sex2 = awardsMode == 2 ? "团体" : sex.equals("男性") ? "男子" : "女子";
|
||||
String sex2 = awardsMode == 2 ? "团体" : sex.equals("男") ? "男子" : "女子";
|
||||
try {
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, nutMaps);
|
||||
CommonDownloadUtil.download("项目前八.xlsx", workbook, response);
|
||||
CommonDownloadUtil.download(sex2 + "项目前八.xlsx", workbook, response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -402,9 +408,10 @@ public class ActivitySportsStatisticsTypeExportController {
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("activity.score.statistics")
|
||||
@ApiOperation("男子总分前八/女子总分前八")
|
||||
public void isScoreTopEight(String activityId, String sex, HttpServletResponse response) {
|
||||
|
||||
NutMap map = new NutMap();
|
||||
List<NutMap> result = new ArrayList<>();
|
||||
Cnd cndX = Cnd.NEW();
|
||||
//查询所有的项目
|
||||
@@ -421,7 +428,7 @@ public class ActivitySportsStatisticsTypeExportController {
|
||||
LEFT JOIN activity_basic_settings ba ON eve.competitionCategory = ba.id $condition
|
||||
""");
|
||||
cndX.and("ev.activityId", "=", activityId);
|
||||
cndX.and(Cnd.exps("eve.isMenWomen", "=", sex.equals("男性") ? 1 : 2).or("eve.isMenWomen", "is", null));
|
||||
cndX.and(Cnd.exps("eve.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("eve.isMenWomen", "is", null));
|
||||
cndX.and(new Static("1=1 order by case ba.`name` when '甲组' then 1 when '乙组' then 2 when '丙组' then 3 when '丁组' then 4 when '团体' then 5 end"));
|
||||
sqlX.setCondition(cndX);
|
||||
List<Record> eventList = baseService.list(sqlX);
|
||||
@@ -445,7 +452,7 @@ public class ActivitySportsStatisticsTypeExportController {
|
||||
LEFT JOIN activity_event ev ON ar.eventId = ev.id $condition
|
||||
""");
|
||||
Cnd cndC = Cnd.NEW();
|
||||
cndC.and(Cnd.exps("ev.isMenWomen", "=", sex.equals("男性") ? 1 : 2).or("ev.isMenWomen", "is", null));
|
||||
cndC.and(Cnd.exps("ev.isMenWomen", "=", sex.equals("男") ? 1 : 2).or("ev.isMenWomen", "is", null));
|
||||
cndC.and("ar.unionid", "=", sys_union.getId());
|
||||
cndC.and("ar.eventId", "=", event.getString("eventid"));
|
||||
cndC.and("ar.activityId", "=", activityId);
|
||||
|
||||
Reference in New Issue
Block a user