commit
This commit is contained in:
@@ -5,8 +5,11 @@ import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.result.Result;
|
||||
import io.v.nutz.sys.models.Sys_home_activity;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.activity.models.ActivityUserScope;
|
||||
import io.v.nutz.zhgh.checkIn.model.CheckInActivity;
|
||||
import io.v.nutz.zhgh.checkIn.model.CheckInContent;
|
||||
import io.v.nutz.zhgh.checkIn.model.CheckInPraise;
|
||||
@@ -80,6 +83,13 @@ public class CheckInActivityController {
|
||||
activity.setCreatTime(DateUtil.now());
|
||||
}
|
||||
activityService.insertOrUpdate(activity);
|
||||
|
||||
if (activity.getEnable()) {
|
||||
Sys_home_activity sysHomeActivity = activity.covertToSysHomeActivity();
|
||||
dao.insertOrUpdate(sysHomeActivity);
|
||||
} else {
|
||||
dao.delete(Sys_home_activity.class, activity.getId());
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@@ -99,8 +109,13 @@ public class CheckInActivityController {
|
||||
CheckInActivity check = activityService.fetch(id);
|
||||
int count = dao.count(CheckInContent.class, Cnd.where("activityId", "=", id).and("userId", "=", ShiroUtil.getUserId()));
|
||||
|
||||
ActivityUserScope scope = dao.fetch(ActivityUserScope.class, Cnd.where("groupId", "=", check.getGroupId()).and("userId", "=", ShiroUtil.getUserId()));
|
||||
Sys_user user = dao.fetch(Sys_user.class, Cnd.where("id", "=", check.getCreatedBy()));
|
||||
|
||||
NutMap nutMap = Lang.obj2nutmap(check);
|
||||
nutMap.put("checkCount", count);
|
||||
nutMap.put("groupName", scope.getGroupName());
|
||||
nutMap.put("userName", user.getUsername());
|
||||
return Result.success(nutMap);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,8 @@ public class CheckInListController {
|
||||
@At
|
||||
@RequiresAuthentication
|
||||
public Result pageData(PageForm pageForm,
|
||||
@Param(value = "year") Integer year) {
|
||||
@Param(value = "year") Integer year,
|
||||
@Param(value = "id") String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
c.*,
|
||||
@@ -59,6 +60,7 @@ public class CheckInListController {
|
||||
$condition
|
||||
""").setParam("userId", ShiroUtil.getUserId());
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("c.id", "=", id);
|
||||
cnd.and("enable", "=", true);
|
||||
cnd.and(Cnd.likeEX("name", pageForm.getSearchKeyword()));
|
||||
cnd.andEX("year(creatTime)", "=", year);
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
package io.v.nutz.zhgh.checkIn.model;
|
||||
|
||||
import io.v.nutz.base.model.BaseModel;
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.sys.models.Sys_home_activity;
|
||||
import io.v.nutz.sys.services.SysHomeConvert;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @ClassName CheckActivity
|
||||
@@ -18,7 +24,7 @@ import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
@Comment("主题打卡")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class CheckInActivity extends BaseModel {
|
||||
public class CheckInActivity extends BaseModel implements Serializable, SysHomeConvert {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@@ -70,4 +76,23 @@ public class CheckInActivity extends BaseModel {
|
||||
@Comment("分组Id")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer groupId;
|
||||
|
||||
@Override
|
||||
public Sys_home_activity covertToSysHomeActivity() {
|
||||
Sys_home_activity sysHomeActivity = new Sys_home_activity();
|
||||
sysHomeActivity.setId(this.getId());
|
||||
sysHomeActivity.setName(this.getName());
|
||||
sysHomeActivity.setCover(this.getCover());
|
||||
sysHomeActivity.setUrl("");
|
||||
sysHomeActivity.setH5Url("/platform/checkIn/list/h5?id=" + this.getId());
|
||||
if (Lang.isNotEmpty(this.getStartTime())) {
|
||||
sysHomeActivity.setStartDate(cn.hutool.core.date.DateUtil.parseDate(this.getStartTime()));
|
||||
sysHomeActivity.setEndDate(cn.hutool.core.date.DateUtil.parseDate(this.getEndTime()));
|
||||
}
|
||||
sysHomeActivity.setAllowUserGroupId(this.getGroupId());
|
||||
sysHomeActivity.setEnable(this.getEnable());
|
||||
sysHomeActivity.setClassPath(this.getClass().getPackageName() + this.getClass().getName());
|
||||
return sysHomeActivity;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ layout("/mobile/platform.html"){
|
||||
</van-dropdown-menu>
|
||||
</van-sticky>
|
||||
|
||||
<table-list api="/platform/checkIn/list/pageData" title="name" :page_form.sync="pageForm" ref="tableListRef" @ready="doSearch" img="cover">
|
||||
<table-list api="/platform/checkIn/list/pageData" title="name" :page_form.sync="pageForm" ref="tableListRef" @ready="onReady" img="cover">
|
||||
<template v-slot="{index,row}">
|
||||
<table-column label="创建人">{{row.userName}}</table-column>
|
||||
<table-column label="开始时间">{{row.startTime}}</table-column>
|
||||
@@ -83,6 +83,8 @@ layout("/mobile/platform.html"){
|
||||
yearOptions: [],
|
||||
infoVisible: false,
|
||||
infoRow: {},
|
||||
|
||||
id: GetQueryString('id')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -96,7 +98,6 @@ layout("/mobile/platform.html"){
|
||||
this.onView(row)
|
||||
return
|
||||
}
|
||||
vant.Toast.clear
|
||||
this.$axios.post('/platform/checkIn/apply/validate', { activityId: row.id })
|
||||
.then(res => {
|
||||
if(res.code === 0) {
|
||||
@@ -106,6 +107,19 @@ layout("/mobile/platform.html"){
|
||||
vant.Dialog.alert({ title: '温馨提示', message: err.msg })
|
||||
})
|
||||
},
|
||||
fetchOne() {
|
||||
this.$axios.post('/platform/checkIn/manage/selectOne', {id: this.id}).then((res) => {
|
||||
if(res.code === 0) {
|
||||
this.onView(res.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
onReady() {
|
||||
this.doSearch()
|
||||
if(this.id) {
|
||||
this.fetchOne()
|
||||
}
|
||||
},
|
||||
doSearch() {
|
||||
this.$nextTick(() => {
|
||||
this.pageForm.pageNumber = 1
|
||||
|
||||
Reference in New Issue
Block a user