diff --git a/src/main/java/io/v/nutz/mobile/mine/MobileMineController.java b/src/main/java/io/v/nutz/mobile/mine/MobileMineController.java new file mode 100644 index 0000000..1496a19 --- /dev/null +++ b/src/main/java/io/v/nutz/mobile/mine/MobileMineController.java @@ -0,0 +1,88 @@ +package io.v.nutz.mobile.mine; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import io.v.nutz.annontation.ViReturn; +import io.v.nutz.base.service.BaseService; +import io.v.nutz.trainEducation.models.TrainEduVideoWatchRecord; +import io.v.nutz.trainSignUp.models.TrainSignUpUser; +import io.v.nutz.web.commons.utils.ShiroUtil; +import org.nutz.dao.Cnd; +import org.nutz.dao.Dao; +import org.nutz.ioc.loader.annotation.Inject; +import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.util.NutMap; +import org.nutz.mvc.annotation.At; +import org.nutz.mvc.annotation.Ok; + +import java.util.*; + +@IocBean +@At("/mobile/mine") +@Ok("json:full") +public class MobileMineController { + + @Inject + private BaseService baseService; + + @Inject + private Dao dao; + + @At("") + @Ok("beetl:/mobile/mine/index.html") + public void index() {} + + @At + @ViReturn + public Object getTrainActivity(Integer year) { + + NutMap map = new NutMap(); + //查询当前登录用户报名的所有活动 + List signUpUsers = dao.query(TrainSignUpUser.class, Cnd.where("userId", "=", ShiroUtil.getUserId()) + .groupBy("activityId")); + //根据年份获取 + if(year == null) { + map.put("count", signUpUsers.size()); + year = DateUtil.thisYear(); + } else { + Integer finalYear = year; + long count = signUpUsers.stream().filter(o -> Objects.equals(DateUtil.year(o.getSignUpTime()), finalYear)).count(); + map.put("count", count); + } + List> result = new ArrayList<>(); + int brearYear = year - 5; + for (int i = year; i > brearYear; i--) { + Integer finalYear1 = i; + long count = signUpUsers.stream().filter(o -> Objects.equals(DateUtil.year(o.getSignUpTime()), finalYear1)).count(); + result.add(Map.of("label", i, "value", count)); + } + map.put("result", result); + return map; + } + + @At + @ViReturn + public Object getVideo(Integer year) { + NutMap map = new NutMap(); + List videoWatchRecords = dao.query(TrainEduVideoWatchRecord.class, Cnd.where("userId", "=", ShiroUtil.getUserId()) + .groupBy("videoId")); + //根据年份获取 + if(year == null) { + map.put("count", videoWatchRecords.size()); + year = DateUtil.thisYear(); + } else { + Integer finalYear = year; + long count = videoWatchRecords.stream().filter(o -> Objects.equals(DateUtil.year(o.getWatchTime()), finalYear)).count(); + map.put("count", count); + } + List> result = new ArrayList<>(); + int brearYear = year - 5; + for (int i = year; i > brearYear; i--) { + Integer finalYear1 = i; + long count = videoWatchRecords.stream().filter(o -> Objects.equals(DateUtil.year(o.getWatchTime()), finalYear1)).count(); + result.add(Map.of("label", i, "value", count)); + } + map.put("result", result); + return map; + } +} diff --git a/src/main/resources/static/assets/mobile/img/mine/user_info_back.png b/src/main/resources/static/assets/mobile/img/mine/user_info_back.png new file mode 100644 index 0000000..223c68f Binary files /dev/null and b/src/main/resources/static/assets/mobile/img/mine/user_info_back.png differ diff --git a/src/main/resources/views/mobile/mine/index.html b/src/main/resources/views/mobile/mine/index.html new file mode 100644 index 0000000..3d239bf --- /dev/null +++ b/src/main/resources/views/mobile/mine/index.html @@ -0,0 +1,202 @@ + + + +
+ +
+ +
+ +
品牌活动
+
+ +
培训教育
+
+
+
+ 筛选 + +
+
+ + + + +
+
+
+ 品牌活动 +
+ +
+
+
+ 培训教育 +
+ +
+
+ + +
+ + + +