健步走提交
This commit is contained in:
+6
-6
@@ -69,7 +69,7 @@ public class FitnessWalkStepRankingController {
|
|||||||
* @param unitId 单位ID,空字符串表示全部单位
|
* @param unitId 单位ID,空字符串表示全部单位
|
||||||
* @param mode 排行范围:today、oneMonth、halfYear、oneYear、activity;all 兼容原活动期间参数
|
* @param mode 排行范围:today、oneMonth、halfYear、oneYear、activity;all 兼容原活动期间参数
|
||||||
* @param sex 性别:空字符串表示全部,男或女表示指定性别
|
* @param sex 性别:空字符串表示全部,男或女表示指定性别
|
||||||
* @param ageRange 年龄段:空字符串表示全体,under40、41to50、51to55 表示指定年龄段
|
* @param ageRange 年龄段:空字符串表示全体,under40、41to50、51to55、over55 表示指定年龄段;over55 表示年龄大于55岁
|
||||||
* @return Result,data.list 为排行榜数据,data.totalCount 为符合条件的总人数
|
* @return Result,data.list 为排行榜数据,data.totalCount 为符合条件的总人数
|
||||||
*/
|
*/
|
||||||
@At
|
@At
|
||||||
@@ -84,7 +84,7 @@ public class FitnessWalkStepRankingController {
|
|||||||
if (Strings.isNotBlank(sex) && !List.of("男", "女").contains(sex)) {
|
if (Strings.isNotBlank(sex) && !List.of("男", "女").contains(sex)) {
|
||||||
return Result.error("性别筛选参数不正确");
|
return Result.error("性别筛选参数不正确");
|
||||||
}
|
}
|
||||||
if (Strings.isNotBlank(ageRange) && !List.of("under40", "41to50", "51to55").contains(ageRange)) {
|
if (Strings.isNotBlank(ageRange) && !List.of("under40", "41to50", "51to55", "over55").contains(ageRange)) {
|
||||||
return Result.error("年龄段筛选参数不正确");
|
return Result.error("年龄段筛选参数不正确");
|
||||||
}
|
}
|
||||||
String actualMode = Strings.isBlank(mode) ? "today" : mode;
|
String actualMode = Strings.isBlank(mode) ? "today" : mode;
|
||||||
@@ -110,7 +110,7 @@ public class FitnessWalkStepRankingController {
|
|||||||
* @param userId 当前登录用户ID,用于返回“我的指标”和“我的名次”
|
* @param userId 当前登录用户ID,用于返回“我的指标”和“我的名次”
|
||||||
* @param rankingType 排行指标:totalSteps 累计步数、completionRate 目标完成率、complianceDays 达标天数
|
* @param rankingType 排行指标:totalSteps 累计步数、completionRate 目标完成率、complianceDays 达标天数
|
||||||
* @param sex 性别筛选:空字符串表示全部,男或女表示指定性别
|
* @param sex 性别筛选:空字符串表示全部,男或女表示指定性别
|
||||||
* @param ageRange 年龄段:空字符串表示全体,under40、41to50、51to55 表示指定年龄段
|
* @param ageRange 年龄段:空字符串表示全体,under40、41to50、51to55、over55 表示指定年龄段;over55 表示年龄大于55岁
|
||||||
* @param timeRange 时间范围:today 当日、oneMonth 近1个月、halfYear 近半年、oneYear 近1年、activity 活动开始至今
|
* @param timeRange 时间范围:today 当日、oneMonth 近1个月、halfYear 近半年、oneYear 近1年、activity 活动开始至今
|
||||||
* @param pageNumber 页码,从1开始
|
* @param pageNumber 页码,从1开始
|
||||||
* @param pageSize 每页条数,最大50条
|
* @param pageSize 每页条数,最大50条
|
||||||
@@ -138,7 +138,7 @@ public class FitnessWalkStepRankingController {
|
|||||||
if (Strings.isNotBlank(sex) && !List.of("男", "女").contains(sex)) {
|
if (Strings.isNotBlank(sex) && !List.of("男", "女").contains(sex)) {
|
||||||
return Result.error("性别筛选参数不正确");
|
return Result.error("性别筛选参数不正确");
|
||||||
}
|
}
|
||||||
if (Strings.isNotBlank(ageRange) && !List.of("under40", "41to50", "51to55").contains(ageRange)) {
|
if (Strings.isNotBlank(ageRange) && !List.of("under40", "41to50", "51to55", "over55").contains(ageRange)) {
|
||||||
return Result.error("年龄段筛选参数不正确");
|
return Result.error("年龄段筛选参数不正确");
|
||||||
}
|
}
|
||||||
String actualTimeRange = Strings.isBlank(timeRange) ? "today" : timeRange;
|
String actualTimeRange = Strings.isBlank(timeRange) ? "today" : timeRange;
|
||||||
@@ -230,7 +230,7 @@ public class FitnessWalkStepRankingController {
|
|||||||
* @param unitId 单位ID,空字符串表示全部
|
* @param unitId 单位ID,空字符串表示全部
|
||||||
* @param mode 排行范围:today、oneMonth、halfYear、oneYear、activity;all 兼容原活动期间参数
|
* @param mode 排行范围:today、oneMonth、halfYear、oneYear、activity;all 兼容原活动期间参数
|
||||||
* @param sex 性别:空字符串表示全部,男或女表示指定性别
|
* @param sex 性别:空字符串表示全部,男或女表示指定性别
|
||||||
* @param ageRange 年龄段:空字符串表示全部,under40、41to50、51to55表示指定年龄段
|
* @param ageRange 年龄段:空字符串表示全部,under40、41to50、51to55、over55表示指定年龄段;over55 表示年龄大于55岁
|
||||||
* @param response HTTP响应,返回XSSF格式的Excel文件流
|
* @param response HTTP响应,返回XSSF格式的Excel文件流
|
||||||
*/
|
*/
|
||||||
@At
|
@At
|
||||||
@@ -249,7 +249,7 @@ public class FitnessWalkStepRankingController {
|
|||||||
if (Strings.isNotBlank(sex) && !List.of("男", "女").contains(sex)) {
|
if (Strings.isNotBlank(sex) && !List.of("男", "女").contains(sex)) {
|
||||||
throw new IllegalArgumentException("性别筛选参数不正确");
|
throw new IllegalArgumentException("性别筛选参数不正确");
|
||||||
}
|
}
|
||||||
if (Strings.isNotBlank(ageRange) && !List.of("under40", "41to50", "51to55").contains(ageRange)) {
|
if (Strings.isNotBlank(ageRange) && !List.of("under40", "41to50", "51to55", "over55").contains(ageRange)) {
|
||||||
throw new IllegalArgumentException("年龄段筛选参数不正确");
|
throw new IllegalArgumentException("年龄段筛选参数不正确");
|
||||||
}
|
}
|
||||||
String actualMode = Strings.isBlank(mode) ? "today" : mode;
|
String actualMode = Strings.isBlank(mode) ? "today" : mode;
|
||||||
|
|||||||
+1
-1
@@ -92,7 +92,7 @@ public interface FitnessWalkCommonService extends BaseService<FitnessWalkAwardUs
|
|||||||
* @param unitId 单位ID,空字符串表示全部
|
* @param unitId 单位ID,空字符串表示全部
|
||||||
* @param mode 排行范围:today、oneMonth、halfYear、oneYear、activity;all兼容活动期间
|
* @param mode 排行范围:today、oneMonth、halfYear、oneYear、activity;all兼容活动期间
|
||||||
* @param sex 性别:空字符串表示全部,男或女表示指定性别
|
* @param sex 性别:空字符串表示全部,男或女表示指定性别
|
||||||
* @param ageRange 年龄段:空字符串表示全部,under40、41to50、51to55表示指定年龄段
|
* @param ageRange 年龄段:空字符串表示全部,under40、41to50、51to55、over55表示指定年龄段;over55 表示年龄大于55岁
|
||||||
* @return 排行榜导出数据,包含页面表格展示的用户资料、步数和达标天数
|
* @return 排行榜导出数据,包含页面表格展示的用户资料、步数和达标天数
|
||||||
*/
|
*/
|
||||||
List<NutMap> getStepRankingList(String searchName,
|
List<NutMap> getStepRankingList(String searchName,
|
||||||
|
|||||||
+6
-2
@@ -481,7 +481,7 @@ public class FitnessWalkCommonServiceImpl extends BaseServiceImpl<FitnessWalkAwa
|
|||||||
* @param userId 当前登录用户ID,用于定位当前用户行和名次
|
* @param userId 当前登录用户ID,用于定位当前用户行和名次
|
||||||
* @param rankingType totalSteps、completionRate 或 complianceDays
|
* @param rankingType totalSteps、completionRate 或 complianceDays
|
||||||
* @param sex 空字符串、男或女
|
* @param sex 空字符串、男或女
|
||||||
* @param ageRange 空字符串、under40、41to50 或 51to55
|
* @param ageRange 空字符串、under40、41to50、51to55 或 over55;over55 表示年龄大于55岁
|
||||||
* @param timeRange today、oneMonth、halfYear、oneYear 或 activity
|
* @param timeRange today、oneMonth、halfYear、oneYear 或 activity
|
||||||
* @param pageNumber 页码,从1开始
|
* @param pageNumber 页码,从1开始
|
||||||
* @param pageSize 每页条数
|
* @param pageSize 每页条数
|
||||||
@@ -683,6 +683,8 @@ public class FitnessWalkCommonServiceImpl extends BaseServiceImpl<FitnessWalkAwa
|
|||||||
ageCondition = "AND u.birthday IS NOT NULL AND TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) BETWEEN 41 AND 50";
|
ageCondition = "AND u.birthday IS NOT NULL AND TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) BETWEEN 41 AND 50";
|
||||||
} else if ("51to55".equals(ageRange)) {
|
} else if ("51to55".equals(ageRange)) {
|
||||||
ageCondition = "AND u.birthday IS NOT NULL AND TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) BETWEEN 51 AND 55";
|
ageCondition = "AND u.birthday IS NOT NULL AND TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) BETWEEN 51 AND 55";
|
||||||
|
} else if ("over55".equals(ageRange)) {
|
||||||
|
ageCondition = "AND u.birthday IS NOT NULL AND TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) > 55";
|
||||||
}
|
}
|
||||||
|
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
@@ -919,7 +921,7 @@ public class FitnessWalkCommonServiceImpl extends BaseServiceImpl<FitnessWalkAwa
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成PC端排行榜查询。性别使用用户资料中的 sex 字段,年龄根据 birthday 实时计算;
|
* 生成PC端排行榜查询。性别使用用户资料中的 sex 字段,年龄根据 birthday 实时计算;
|
||||||
* ageRange 为空时不限制年龄,under40、41to50、51to55 分别对应页面的三个年龄段。
|
* ageRange 为空时不限制年龄,under40、41to50、51to55、over55 分别对应页面的四个年龄段;over55 表示年龄大于55岁。
|
||||||
* mode 控制今日、近1个月、近半年、近1年或活动开始至今,并始终限制在活动有效期内。
|
* mode 控制今日、近1个月、近半年、近1年或活动开始至今,并始终限制在活动有效期内。
|
||||||
*/
|
*/
|
||||||
private Sql rankingListSql(String searchName,
|
private Sql rankingListSql(String searchName,
|
||||||
@@ -1023,6 +1025,8 @@ public class FitnessWalkCommonServiceImpl extends BaseServiceImpl<FitnessWalkAwa
|
|||||||
} else if ("51to55".equals(ageRange)) {
|
} else if ("51to55".equals(ageRange)) {
|
||||||
cnd.and(ageExpression, ">=", 51);
|
cnd.and(ageExpression, ">=", 51);
|
||||||
cnd.and(ageExpression, "<=", 55);
|
cnd.and(ageExpression, "<=", 55);
|
||||||
|
} else if ("over55".equals(ageRange)) {
|
||||||
|
cnd.and(ageExpression, ">", 55);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ layout("/layouts/platform.html"){
|
|||||||
<el-option label="40岁及以下" value="under40"></el-option>
|
<el-option label="40岁及以下" value="under40"></el-option>
|
||||||
<el-option label="41-50岁" value="41to50"></el-option>
|
<el-option label="41-50岁" value="41to50"></el-option>
|
||||||
<el-option label="51-55岁" value="51to55"></el-option>
|
<el-option label="51-55岁" value="51to55"></el-option>
|
||||||
|
<el-option label="55岁以上" value="over55"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user