commit
This commit is contained in:
+1
@@ -478,6 +478,7 @@ public class UnionActivityRegisterController {
|
||||
activityTissuePerson.setMobile(principal.getMobile());
|
||||
activityTissuePerson.setUnitName(principal.getUnit().getName());
|
||||
activityTissuePerson.setUnionName(principal.getUnion().getUnionname());
|
||||
activityTissuePerson.setSignTime(cn.hutool.core.date.DateUtil.now());
|
||||
simpleService.dao().insert(activityTissuePerson);
|
||||
lock.unlock();
|
||||
return Result.success().addMsg("报名成功!");
|
||||
|
||||
@@ -2,13 +2,18 @@ package io.v.nutz.mobile.mine;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.activity.models.ActivitySchoolApply;
|
||||
import io.v.nutz.activity.models.ActivityTissuePerson;
|
||||
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.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
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.util.NutMap;
|
||||
@@ -34,55 +39,113 @@ public class MobileMineController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getTrainActivity(Integer year) {
|
||||
|
||||
NutMap map = new NutMap();
|
||||
//查询当前登录用户报名的所有活动
|
||||
List<TrainSignUpUser> 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<Map<String, Object>> 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;
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ua.activityName,
|
||||
ua.activityStartTime,
|
||||
ua.activityEndTime,
|
||||
ua.cover
|
||||
FROM
|
||||
train_sign_up_user su
|
||||
LEFT JOIN train_sign_up_activity ua ON su.activityId = ua.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("su.userId", "=", ShiroUtil.getUserId());
|
||||
cnd.andEX("year(signUpTime)", "=", year);
|
||||
cnd.groupBy("su.activityId");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object getVideo(Integer year) {
|
||||
NutMap map = new NutMap();
|
||||
List<TrainEduVideoWatchRecord> 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<Map<String, Object>> 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;
|
||||
@RequiresAuthentication
|
||||
public Object getTrainVideo(Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
ev.title AS activityName,
|
||||
ev.startDate as activityStartTime,
|
||||
ev.endDate as activityEndTime,
|
||||
ev.coverUrl as cover
|
||||
FROM
|
||||
train_edu_video_watch_record wr
|
||||
LEFT JOIN train_edu_video ev ON wr.videoId = ev.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("wr.userId", "=", ShiroUtil.getUserId());
|
||||
cnd.andEX("year(watchTime)", "=", year);
|
||||
cnd.groupBy("wr.videoId");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getSportActivity(Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
sch.name AS activityName,
|
||||
sch.startTime as activityStartTime,
|
||||
sch.endTime as activityEndTime,
|
||||
JSON_EXTRACT(sch.image, '$[0]') as cover
|
||||
FROM
|
||||
activity_school_apply sa
|
||||
LEFT JOIN activity_school sch ON sa.activityId = sch.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("sa.userId", "=", ShiroUtil.getUserId());
|
||||
cnd.andEX("year(applyDate)", "=", year);
|
||||
cnd.groupBy("sa.activityId");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getCultureActivity(Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
at.name AS activityName,
|
||||
at.startTime as activityStartTime,
|
||||
at.endTime as activityEndTime,
|
||||
at.cover as cover
|
||||
FROM
|
||||
activity_tissue_person tp
|
||||
LEFT JOIN activity_tissue at ON tp.tissueId = at.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tp.userId", "=", ShiroUtil.getUserId());
|
||||
cnd.andEX("year(signTime)", "=", year);
|
||||
cnd.groupBy("tp.tissueId");
|
||||
sql.setCondition(cnd);
|
||||
return baseService.listMap(sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object getActivityCount(Integer year) {
|
||||
int trainSignUpCount = dao.count(TrainSignUpUser.class, Cnd.where("userId", "=", ShiroUtil.getUserId())
|
||||
.andEX("year(signUpTime)", "=", year));
|
||||
int trainVideoCount = dao.count(TrainEduVideoWatchRecord.class, Cnd.where("userId", "=", ShiroUtil.getUserId())
|
||||
.andEX("year(watchTime)", "=", year));
|
||||
int sportActivityCount = dao.count(ActivitySchoolApply.class, Cnd.where("userId", "=", ShiroUtil.getUserId())
|
||||
.andEX("year(applyDate)", "=", year));
|
||||
int cultureActivityCount = dao.count(ActivityTissuePerson.class, Cnd.where("userId", "=", ShiroUtil.getUserId())
|
||||
.andEX("year(signTime)", "=", year));
|
||||
return Map.of(
|
||||
"trainSignUpCount", Math.max(trainSignUpCount, 0),
|
||||
"trainVideoCount", Math.max(trainVideoCount, 0),
|
||||
"sportActivityCount", Math.max(sportActivityCount, 0),
|
||||
"cultureActivityCount", Math.max(cultureActivityCount, 0)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ layout("/mobile/platform.html"){
|
||||
padding: 8px 8px;
|
||||
}
|
||||
.main_content {
|
||||
height: 230px;
|
||||
height: calc(100vh - 570px);
|
||||
background: linear-gradient(to top right, rgb(238, 163, 175), rgb(149, 214, 240));
|
||||
border-radius: 0 0 20px 20px;
|
||||
}
|
||||
@@ -24,7 +24,7 @@ layout("/mobile/platform.html"){
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 40px 30px 40px;
|
||||
padding: 40px 30px 20px;
|
||||
}
|
||||
.basic {
|
||||
font-weight: bold;
|
||||
@@ -52,6 +52,46 @@ layout("/mobile/platform.html"){
|
||||
font-size: 14px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
.van-tabs__nav--line {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
.van-tab--active {
|
||||
color: white;
|
||||
}
|
||||
.van-tab {
|
||||
color: white;
|
||||
}
|
||||
.van-cell__title {
|
||||
max-width: 60px;
|
||||
}
|
||||
img {
|
||||
border-radius: 10px;
|
||||
}
|
||||
.van-image__error, .van-image__loading {
|
||||
border-radius: 10px;
|
||||
}
|
||||
.activity_name {
|
||||
font-weight: bold;
|
||||
}
|
||||
.activity_time {
|
||||
color: grey;
|
||||
}
|
||||
.van-empty {
|
||||
position: relative;
|
||||
transform: revert;
|
||||
left: 0;
|
||||
}
|
||||
.activity_tooltip {
|
||||
margin-bottom: 10px;
|
||||
color: white;
|
||||
padding: 0 10px;
|
||||
font-size: 15px;
|
||||
text-indent: 1em;
|
||||
line-height: 20px;
|
||||
}
|
||||
.activity_count {
|
||||
color: #EE0A24;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -67,35 +107,57 @@ layout("/mobile/platform.html"){
|
||||
<div class="avatar">{{getShortName()}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="activity_tooltip">
|
||||
{{pageForm.year ? pageForm.year : '全部'}}年度, 您一共参与了,
|
||||
<span class="activity_count">{{activityCount.trainVideoCount}}</span>次培训教育,
|
||||
<span class="activity_count">{{activityCount.trainSignUpCount}}</span>次品牌活动,
|
||||
<span class="activity_count">{{activityCount.sportActivityCount}}</span>次体育活动,
|
||||
<span class="activity_count">{{activityCount.cultureActivityCount}}</span>次文化活动。
|
||||
</div>
|
||||
<div class="count_content">
|
||||
<van-badge :content="trainActivityCount" style="margin-right: 50px">
|
||||
<div class="activity">品牌活动</div>
|
||||
</van-badge>
|
||||
<van-badge :content="videoCount">
|
||||
<div>培训教育</div>
|
||||
</van-badge>
|
||||
<van-tabs v-model="activeName" @click="tabClick">
|
||||
<van-tab :title="item" :name="index" v-for="(item,index) in itemList"></van-tab>
|
||||
</van-tabs>
|
||||
</div>
|
||||
<div class="query">
|
||||
<span @click="openQuery()">筛选</span>
|
||||
<span @click="openQuery()">年度筛选</span>
|
||||
<van-icon name="exchange" style="position: relative; top: 2px"></van-icon>
|
||||
</div>
|
||||
<div class="van-doc-card" style="margin-top: 6px">
|
||||
<van-cell icon="friends-o" title="性别" value="${@shiro.getPrincipalProperty('sex')}"></van-cell>
|
||||
<van-cell icon="phone-o" title="手机号" value="${@shiro.getPrincipalProperty('mobile')}"></van-cell>
|
||||
<van-cell icon="bar-chart-o" title="所属单位" value="${@shiro.getPrincipalProperty('unit').getName()}"></van-cell>
|
||||
<van-cell icon="cluster-o" title="所属工会" value="${@shiro.getPrincipalProperty('union').getUnionname()}"></van-cell>
|
||||
</div>
|
||||
<div class="summary_content van-doc-card">
|
||||
<div class="van-sidebar-item van-sidebar-item--select ml15 p10">
|
||||
品牌活动
|
||||
<template v-if="activeName === 0">
|
||||
<van-cell icon="coupon-o" title="工号" :value="userInfo.loginname"></van-cell>
|
||||
<van-cell icon="manager-o" title="性别" :value="userInfo.sex"></van-cell>
|
||||
<van-cell icon="phone-o" title="手机号" :value="userInfo.mobile"></van-cell>
|
||||
<van-cell icon="comment-o" title="身份证" :value="userInfo.idcard"></van-cell>
|
||||
<van-cell icon="friends-o" title="民族" :value="userInfo.nation"></van-cell>
|
||||
<van-cell icon="notes-o" title="学历" :value="userInfo.education"></van-cell>
|
||||
<van-cell icon="newspaper-o" title="学位" :value="userInfo.academicDegree"></van-cell>
|
||||
<van-cell icon="credit-pay" title="政治面貌" :value="userInfo.political"></van-cell>
|
||||
<van-cell icon="idcard" title="人员类型" :value="userInfo.personType"></van-cell>
|
||||
<van-cell icon="hotel-o" title="职务" :value="userInfo.position"></van-cell>
|
||||
<van-cell icon="bar-chart-o" title="所属单位" :value="userInfo.unitname"></van-cell>
|
||||
<van-cell icon="cluster-o" title="所属工会" :value="userInfo.unionname"></van-cell>
|
||||
</template>
|
||||
<div style="max-height: calc(100vh - 130px - 44px - 60px); overflow: auto" v-else-if="activeName !== 0">
|
||||
<div v-if="activityData.length > 0" v-for="item in activityData" style="display: flex; padding: 6px">
|
||||
<van-image width="100" height="70"
|
||||
:src="getImageUrl(item.cover)">
|
||||
</van-image>
|
||||
<div class="ml10" style="display: flex; flex-direction: column; justify-content: space-between;">
|
||||
<div class="activity_name">{{ item.activityName }}</div>
|
||||
<div class="activity_time">
|
||||
<div>开始时间:{{ moment(item.activityStartTime).format('YYYY-MM-DD HH:mm') }}</div>
|
||||
<div>结束时间:{{ moment(item.activityEndTime).format('YYYY-MM-DD HH:mm') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<van-empty
|
||||
v-if="activityData.length === 0"
|
||||
class="custom-image"
|
||||
image="/none.svg"
|
||||
description="暂无数据"
|
||||
></van-empty>
|
||||
</div>
|
||||
<canvas id="trainActivity" style="width: 100%; height: 170px"></canvas>
|
||||
</div>
|
||||
<div class="summary_content van-doc-card">
|
||||
<div class="van-sidebar-item van-sidebar-item--select ml15 p10">
|
||||
培训教育
|
||||
</div>
|
||||
<canvas id="trainVideo" style="width: 100%; height: 170px"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -109,7 +171,6 @@ layout("/mobile/platform.html"){
|
||||
></van-action-sheet>
|
||||
</div>
|
||||
|
||||
<script src="https://gw.alipayobjects.com/os/lib/antv/f2/3.7.0/dist/f2.min.js"></script>
|
||||
<script>
|
||||
|
||||
const vue = new Vue({
|
||||
@@ -118,14 +179,51 @@ layout("/mobile/platform.html"){
|
||||
return {
|
||||
yearActions: [],
|
||||
yearShow: false,
|
||||
trainActivityCount: 0,
|
||||
videoCount: 0,
|
||||
pageForm: {
|
||||
year: null,
|
||||
}
|
||||
year: new Date().getFullYear(),
|
||||
},
|
||||
itemList: ['个人信息', '培训教育', '品牌活动', '体育活动', '文化活动'],
|
||||
activeName: 0,
|
||||
userInfo: {},
|
||||
activityData: [],
|
||||
activityCount: {},
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'mobile-member-info': httpVueLoader('/components/mobile/member/MobileMemberInfo.vue?v=' + new Date().getTime()),
|
||||
},
|
||||
methods: {
|
||||
async tabClick(name, title) {
|
||||
if(name === 0) {
|
||||
return
|
||||
}
|
||||
let method
|
||||
switch (name) {
|
||||
case 1:
|
||||
method = '/getTrainVideo'
|
||||
break
|
||||
case 2:
|
||||
method = '/getTrainActivity'
|
||||
break
|
||||
case 3:
|
||||
method = '/getSportActivity'
|
||||
break
|
||||
case 4:
|
||||
method = '/getCultureActivity'
|
||||
break
|
||||
}
|
||||
const resp = await $.post('/mobile/mine' + method, this.pageForm)
|
||||
this.activityData = resp.data
|
||||
this.$forceUpdate()
|
||||
},
|
||||
getImageUrl(url) {
|
||||
try {
|
||||
const u = JSON.parse(url)
|
||||
return FILE_DOMAIN + '/fileStreamPreview?id=' + u?.id
|
||||
}catch (e) {
|
||||
return FILE_DOMAIN + '/fileStreamPreview?id=' + url
|
||||
}
|
||||
},
|
||||
openQuery() {
|
||||
this.yearShow = true
|
||||
},
|
||||
@@ -135,57 +233,24 @@ layout("/mobile/platform.html"){
|
||||
} else {
|
||||
this.pageForm.year = action.name.replaceAll('年', '')
|
||||
}
|
||||
await this.init()
|
||||
await this.tabClick(this.activeName)
|
||||
await this.getActivityCount()
|
||||
},
|
||||
getShortName() {
|
||||
const userName = "${@shiro.getPrincipalProperty('username')}"
|
||||
return userName.length > 2 ? userName.substring(0, 2) : userName.substring(0, 1)
|
||||
},
|
||||
async getTrainActivity() {
|
||||
const resp = await $.get('/mobile/mine/getTrainActivity', this.pageForm)
|
||||
this.trainActivityCount = resp.data.count
|
||||
const chart = new F2.Chart({
|
||||
id: 'trainActivity',
|
||||
pixelRatio: window.devicePixelRatio
|
||||
})
|
||||
chart.source(resp.data.result)
|
||||
chart.scale({
|
||||
label: {
|
||||
range: [0, 1]
|
||||
},
|
||||
value: {
|
||||
tickCount: 5,
|
||||
min: 0
|
||||
}
|
||||
})
|
||||
chart.area().position('label*value').color('l(90) 0:#1890FF 1:#f7f7f7').shape('smooth')
|
||||
chart.line().position('label*value').color('l(90) 0:#1890FF 1:#f7f7f7').shape('smooth')
|
||||
chart.render()
|
||||
async getUserInfo() {
|
||||
const resp = await $.get('/platform/member/common/userInfo', {userId: "${@shiro.getPrincipalProperty('id')}"})
|
||||
this.userInfo = resp.data
|
||||
},
|
||||
async getVideo() {
|
||||
const resp = await $.get('/mobile/mine/getVideo', this.pageForm)
|
||||
this.videoCount = resp.data.count
|
||||
const chart = new F2.Chart({
|
||||
id: 'trainVideo',
|
||||
pixelRatio: window.devicePixelRatio
|
||||
})
|
||||
chart.source(resp.data.result)
|
||||
chart.scale({
|
||||
label: {
|
||||
range: [0, 1]
|
||||
},
|
||||
value: {
|
||||
tickCount: 5,
|
||||
min: 0
|
||||
}
|
||||
})
|
||||
chart.area().position('label*value').color('l(90) 0:#1890FF 1:#f7f7f7').shape('smooth')
|
||||
chart.line().position('label*value').color('l(90) 0:#1890FF 1:#f7f7f7').shape('smooth')
|
||||
chart.render()
|
||||
async getActivityCount() {
|
||||
const resp = await $.post('/mobile/mine/getActivityCount', this.pageForm)
|
||||
this.activityCount = resp.data
|
||||
},
|
||||
async init() {
|
||||
await this.getTrainActivity()
|
||||
await this.getVideo()
|
||||
await this.getUserInfo()
|
||||
await this.getActivityCount()
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
|
||||
Reference in New Issue
Block a user