社团注册资料审核,增加防输入法遮挡 完善个人名片逻辑 社团接口更新 底部按钮组件更新 Http工具类响应回调逻辑完善 token管理逻辑完善 增加Vo统一管理 社团注册逻辑完善 社团列表逻辑完善master
parent
61671b3f1b
commit
a3e4308037
@ -1,14 +1,20 @@ |
||||
package com.gyf.csams |
||||
|
||||
import android.app.Activity |
||||
import com.google.gson.reflect.TypeToken |
||||
import com.gyf.csams.account.ui.LoginActivity |
||||
import com.gyf.csams.main.ui.MainActivity |
||||
import com.gyf.lib.uikit.AbstractInitActivity |
||||
import com.gyf.lib.util.AccountApi |
||||
import com.gyf.lib.util.ApiResponse |
||||
import com.gyf.lib.util.ManagerVo |
||||
import java.lang.reflect.Type |
||||
|
||||
class InitActivity : AbstractInitActivity() { |
||||
class InitActivity : AbstractInitActivity<ManagerVo>() { |
||||
override val main: Class<out Activity> = MainActivity::class.java |
||||
override val login: Class<out Activity> = LoginActivity::class.java |
||||
|
||||
override val api: AccountApi = AccountApi.BackgroundToken |
||||
|
||||
override val typeToken: Type = object : TypeToken<ApiResponse<ManagerVo>>() {}.type |
||||
} |
@ -0,0 +1,81 @@ |
||||
package com.gyf.csams.main.model |
||||
|
||||
import android.app.Application |
||||
import androidx.lifecycle.viewModelScope |
||||
import com.google.gson.reflect.TypeToken |
||||
import com.gyf.lib.model.ScrollViewModel |
||||
import com.gyf.lib.util.* |
||||
import kotlinx.coroutines.launch |
||||
|
||||
|
||||
class AuditAssociationViewModel(application: Application) : ScrollViewModel<DisposeRegInfoVo>( |
||||
application |
||||
) { |
||||
override val initSize: Int = 10 |
||||
|
||||
init { |
||||
load { } |
||||
} |
||||
|
||||
override fun load(callback: (message: String) -> Unit) { |
||||
viewModelScope.launch { |
||||
HttpClient.post( |
||||
Api.buildUrl(AssociationApi.Audit), HttpCallback<MutableList<DisposeRegInfoVo>>( |
||||
action = "获取审核列表", |
||||
onSuccess = { it -> |
||||
it.body?.let { |
||||
_data.postValue(it) |
||||
} |
||||
}, |
||||
typeToken = object : |
||||
TypeToken<ApiResponse<MutableList<DisposeRegInfoVo>>>() {}.type |
||||
), |
||||
jsonParam = OnlyToken(clientType = ClientType.Background) |
||||
) |
||||
} |
||||
} |
||||
|
||||
override fun loadMore(callback: (message: String) -> Unit) { |
||||
TODO("Not yet implemented") |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 受理注册资料 |
||||
* |
||||
* @param callback |
||||
*/ |
||||
fun accept(regId: Int, isFirstAccept: Boolean, callback: (message: String) -> Unit) { |
||||
viewModelScope.launch { |
||||
HttpClient.post( |
||||
Api.buildUrl(AssociationApi.Accept), |
||||
HttpCallback<Boolean>(action = "受理社团注册资料", onSuccess = { |
||||
callback(it.message) |
||||
}, typeToken = object : TypeToken<ApiResponse<Boolean>>() {}.type), |
||||
jsonParam = AcceptRegAssociation(regId = regId, isFirstAccept = isFirstAccept) |
||||
) |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 提交审核结果 |
||||
* |
||||
* @param regId |
||||
* @param result |
||||
* @param callback |
||||
*/ |
||||
fun check(regId: Int, cause: String, result: Boolean, callback: (message: String) -> Unit) { |
||||
viewModelScope.launch { |
||||
HttpClient.post( |
||||
Api.buildUrl(AssociationApi.Check), |
||||
HttpCallback<Boolean>(action = "提交审核结果", onSuccess = { |
||||
callback(it.message) |
||||
}, typeToken = object : TypeToken<ApiResponse<Boolean>>() {}.type), |
||||
jsonParam = CheckRegVo( |
||||
regId = regId, result = result, |
||||
cause = cause |
||||
) |
||||
) |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,11 @@ |
||||
package com.gyf.csams.main.model |
||||
|
||||
import android.app.Application |
||||
import com.gyf.lib.model.SysMessageViewModel |
||||
import com.gyf.lib.util.ClientType |
||||
|
||||
class BackgroundViewModel(application: Application) : SysMessageViewModel(application) { |
||||
override fun clientType(): ClientType { |
||||
return ClientType.Background |
||||
} |
||||
} |
@ -1,42 +0,0 @@ |
||||
package com.gyf.csams.main.model |
||||
|
||||
import androidx.lifecycle.LiveData |
||||
import androidx.lifecycle.MutableLiveData |
||||
import androidx.lifecycle.ViewModel |
||||
import com.gyf.lib.uikit.PersonInfoVo |
||||
import com.gyf.lib.util.randomChinese |
||||
|
||||
/** |
||||
* 部长 |
||||
* |
||||
* @property name 姓名 |
||||
* @property duty 职务 |
||||
* @property headImg 头像 |
||||
* @property desc 个人简介 |
||||
*/ |
||||
data class MinisterVo( |
||||
override val name: String, |
||||
override val duty: String, |
||||
override val headImg: String, |
||||
override val desc: String |
||||
) : PersonInfoVo() |
||||
|
||||
class MainViewModel : ViewModel() { |
||||
private val _person = MutableLiveData<MinisterVo>() |
||||
val person: LiveData<MinisterVo> = _person |
||||
|
||||
init { |
||||
loadInfo() |
||||
} |
||||
|
||||
private fun loadInfo() { |
||||
_person.postValue( |
||||
MinisterVo( |
||||
name = randomChinese(3), |
||||
duty = "总部长", |
||||
headImg = "", |
||||
desc = randomChinese(8) |
||||
) |
||||
) |
||||
} |
||||
} |
@ -0,0 +1,310 @@ |
||||
package com.gyf.csams.main.ui |
||||
|
||||
import android.os.Bundle |
||||
import androidx.activity.ComponentActivity |
||||
import androidx.activity.compose.setContent |
||||
import androidx.compose.foundation.Image |
||||
import androidx.compose.foundation.border |
||||
import androidx.compose.foundation.layout.* |
||||
import androidx.compose.material.ExperimentalMaterialApi |
||||
import androidx.compose.material.MaterialTheme |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.runtime.ExperimentalComposeApi |
||||
import androidx.compose.runtime.getValue |
||||
import androidx.compose.runtime.livedata.observeAsState |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.unit.dp |
||||
import androidx.core.view.WindowCompat |
||||
import androidx.lifecycle.viewmodel.compose.viewModel |
||||
import com.google.accompanist.coil.rememberCoilPainter |
||||
import com.google.accompanist.insets.ExperimentalAnimatedInsets |
||||
import com.google.accompanist.insets.navigationBarsWithImePadding |
||||
import com.gyf.csams.R |
||||
import com.gyf.csams.main.model.AuditAssociationViewModel |
||||
import com.gyf.csams.uikit.RowItem |
||||
import com.gyf.csams.uikit.TestTableImeSimple |
||||
import com.gyf.lib.uikit.* |
||||
import com.gyf.lib.util.* |
||||
|
||||
class AuditAssociationActivity : ComponentActivity() { |
||||
@ExperimentalMaterialApi |
||||
@ExperimentalAnimatedInsets |
||||
@ExperimentalComposeApi |
||||
override fun onCreate(savedInstanceState: Bundle?) { |
||||
super.onCreate(savedInstanceState) |
||||
WindowCompat.setDecorFitsSystemWindows(window, false) |
||||
setContent { |
||||
ImeBody { |
||||
val model: AuditAssociationViewModel = viewModel() |
||||
val data by model.data.observeAsState() |
||||
TestTableImeSimple( |
||||
title = R.string.association_reg_title |
||||
) { |
||||
data?.forEach { |
||||
item { |
||||
RegisterForm(vo = it) |
||||
Spacer(modifier = Modifier.height(10.dp)) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
@Composable |
||||
private fun CheckForm( |
||||
vo: DisposeRegInfoVo, |
||||
scaffoldModel: ScaffoldModel = viewModel(), |
||||
auditAssociationViewModel: AuditAssociationViewModel = viewModel(), |
||||
first: @Composable () -> Unit, |
||||
last: @Composable () -> Unit |
||||
) { |
||||
val baseHeight = 50.dp |
||||
|
||||
(TokenManager.getOwnInfo() as? ManagerVo)?.let { it -> |
||||
var confirmDesc: Int? = null |
||||
var backDesc: Int? = null |
||||
var onConfirm: (() -> Unit)? = null |
||||
var onBack: (() -> Unit)? = null |
||||
val check: (result: Boolean, cause: StringForm) -> Unit = |
||||
{ result: Boolean, cause: StringForm -> |
||||
scaffoldModel.update( |
||||
message = "确认${if (result) "上报" else "驳回"}?", |
||||
actionLabel = "确认" |
||||
) { |
||||
auditAssociationViewModel.check( |
||||
regId = vo.log.id, |
||||
result = result, |
||||
cause = cause.formValue.value |
||||
?: throw IllegalArgumentException("无法获取审核理由") |
||||
) { |
||||
scaffoldModel.update(message = it, actionLabel = "刷新") { |
||||
auditAssociationViewModel.load { } |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
val accept: (m: String, isFirstAccept: Boolean) -> Unit = |
||||
{ m: String, isFirstAccept: Boolean -> |
||||
scaffoldModel.update("确认${m}?", actionLabel = "确认") { |
||||
auditAssociationViewModel.accept( |
||||
regId = vo.log.id, |
||||
isFirstAccept = isFirstAccept |
||||
) { |
||||
scaffoldModel.update(message = it, actionLabel = "刷新") { |
||||
auditAssociationViewModel.load { } |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
val doCheck: @Composable () -> Unit = { |
||||
val cause = ValidStringForm( |
||||
formDesc = "审核理由", |
||||
textLength = 20 |
||||
) |
||||
val statusForm by cause.statusForm.observeAsState() |
||||
|
||||
onConfirm = { |
||||
if (statusForm == FormStatus.Empty) { |
||||
scaffoldModel.update("${cause.formDesc}不能为空", actionLabel = "知道了") |
||||
} else { |
||||
check(true, cause) |
||||
} |
||||
} |
||||
onBack = { |
||||
if (statusForm == FormStatus.Empty) { |
||||
scaffoldModel.update("${cause.formDesc}不能为空", actionLabel = "知道了") |
||||
} else { |
||||
check(false, cause) |
||||
} |
||||
} |
||||
|
||||
Row( |
||||
modifier = Modifier.fillMaxWidth(), |
||||
horizontalArrangement = Arrangement.Center |
||||
) { |
||||
BaseTextField( |
||||
modifier = Modifier.navigationBarsWithImePadding(), |
||||
form = cause |
||||
) |
||||
} |
||||
} |
||||
|
||||
when { |
||||
//初审记录,负责人为空 等待初审 |
||||
vo.log.nextAudit == null && vo.log.manager == null -> { |
||||
if (it.duty == Duty.PamphaBhusal) { |
||||
confirmDesc = R.string.accept_btn |
||||
onConfirm = { accept("受理", true) } |
||||
} |
||||
first() |
||||
RowItem(key = R.string.first_approver_origin, value = "") |
||||
RowItem(key = R.string.first_result, value = "") |
||||
last() |
||||
RowItem(key = R.string.last_approver_origin, value = "") |
||||
RowItem(key = R.string.last_result, value = "") |
||||
RowItem( |
||||
modifier = Modifier.height(baseHeight), |
||||
key = R.string.audit_phases, value = "等待初审" |
||||
) |
||||
} |
||||
//初审记录,负责人不为空 初审受理 |
||||
vo.log.nextAudit == null && vo.log.manager != null -> { |
||||
|
||||
first() |
||||
if (it.duty == Duty.PamphaBhusal) { |
||||
confirmDesc = R.string.reported_btn |
||||
backDesc = R.string.reject_btn |
||||
|
||||
doCheck() |
||||
} else { |
||||
RowItem(key = R.string.first_approver_origin, value = "") |
||||
} |
||||
RowItem(key = R.string.first_result, value = "") |
||||
last() |
||||
RowItem(key = R.string.last_approver_origin, value = "") |
||||
RowItem(key = R.string.last_result, value = "") |
||||
RowItem( |
||||
modifier = Modifier.height(baseHeight), |
||||
key = R.string.audit_phases, value = "初审受理" |
||||
) |
||||
} |
||||
//初审记录,审核通过(上报) 等待复审 |
||||
vo.log.nextAudit != null && vo.log.nextAudit?.manager == null -> { |
||||
|
||||
if (it.duty == Duty.Teacher) { |
||||
confirmDesc = R.string.recheck_btn |
||||
onConfirm = { accept("复审", false) } |
||||
} |
||||
first() |
||||
RowItem(key = R.string.first_approver_origin, value = vo.log.cause) |
||||
RowItem(key = R.string.first_result, value = "通过") |
||||
last() |
||||
RowItem(key = R.string.last_approver_origin, value = "") |
||||
RowItem(key = R.string.last_result, value = "") |
||||
RowItem( |
||||
modifier = Modifier.height(baseHeight), |
||||
key = R.string.audit_phases, value = "等待复审" |
||||
) |
||||
} |
||||
//复审记录,审核结果为空 复审受理 |
||||
vo.log.nextAudit != null && vo.log.nextAudit?.result == null -> { |
||||
first() |
||||
RowItem(key = R.string.first_approver_origin, value = vo.log.cause) |
||||
RowItem(key = R.string.first_result, value = "通过") |
||||
last() |
||||
if (it.duty == Duty.Teacher) { |
||||
confirmDesc = R.string.allow_btn |
||||
backDesc = R.string.reject_btn |
||||
doCheck() |
||||
} else { |
||||
RowItem(key = R.string.last_approver_origin, value = "") |
||||
} |
||||
RowItem(key = R.string.last_result, value = "") |
||||
RowItem( |
||||
modifier = Modifier.height(baseHeight), |
||||
key = R.string.audit_phases, value = "复审受理" |
||||
) |
||||
} |
||||
else -> { |
||||
first() |
||||
RowItem(key = R.string.first_approver_origin, value = vo.log.cause) |
||||
RowItem( |
||||
key = R.string.first_result, value = when (vo.log.result) { |
||||
null -> "" |
||||
true -> "通过" |
||||
false -> "不通过" |
||||
} |
||||
) |
||||
last() |
||||
RowItem( |
||||
key = R.string.last_approver_origin, |
||||
value = vo.log.nextAudit?.cause ?: "" |
||||
) |
||||
RowItem( |
||||
key = R.string.last_result, value = when (vo.log.nextAudit?.result) { |
||||
null -> "" |
||||
true -> "通过" |
||||
false -> "不通过" |
||||
} |
||||
) |
||||
RowItem( |
||||
modifier = Modifier.height(baseHeight), |
||||
key = R.string.audit_phases, value = "完成审核" |
||||
) |
||||
} |
||||
} |
||||
|
||||
if (confirmDesc != null) { |
||||
BottomButton( |
||||
confirmDesc = confirmDesc, |
||||
backDesc = backDesc, |
||||
modifier = Modifier.fillMaxWidth(), |
||||
onBack = onBack |
||||
) { |
||||
onConfirm?.let { it() } |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Composable |
||||
private fun RegisterForm( |
||||
modifier: Modifier = Modifier, vo: DisposeRegInfoVo |
||||
) { |
||||
Column( |
||||
modifier = modifier.border( |
||||
width = 1.dp, |
||||
color = MaterialTheme.colors.onBackground |
||||
) |
||||
) { |
||||
val baseHeight = 50.dp |
||||
|
||||
RowItem( |
||||
modifier = Modifier.height(baseHeight), |
||||
key = R.string.petitioner, |
||||
value = vo.log.user.name |
||||
) |
||||
|
||||
RowItem( |
||||
modifier = Modifier.height(baseHeight), |
||||
key = R.string.association_name, |
||||
value = vo.name |
||||
) |
||||
|
||||
RowItem( |
||||
modifier = Modifier.height(baseHeight), |
||||
key = R.string.association_desc, |
||||
value = vo.desc |
||||
) |
||||
|
||||
RowItem( |
||||
modifier = Modifier.height(baseHeight * 3), |
||||
key = R.string.association_logo |
||||
) { |
||||
//TODO 图片全屏显示 |
||||
val painter = |
||||
rememberCoilPainter("${com.gyf.lib.BuildConfig.SERVER_ADDRESS}/${vo.logo}") |
||||
Image(painter = painter, contentDescription = null) |
||||
} |
||||
|
||||
CheckForm(vo = vo, first = { |
||||
RowItem( |
||||
modifier = Modifier.height(baseHeight), |
||||
key = R.string.first_approver, |
||||
value = vo.log.manager?.name ?: "" |
||||
) |
||||
}, last = { |
||||
RowItem( |
||||
modifier = Modifier.height(baseHeight), |
||||
key = R.string.last_approver, |
||||
value = vo.log.nextAudit?.manager?.name ?: "" |
||||
) |
||||
}) |
||||
|
||||
} |
||||
} |
||||
} |
@ -0,0 +1,80 @@ |
||||
package com.gyf.csams.main.ui |
||||
|
||||
import android.os.Bundle |
||||
import androidx.activity.ComponentActivity |
||||
import androidx.activity.compose.setContent |
||||
import androidx.compose.foundation.layout.* |
||||
import androidx.compose.foundation.lazy.LazyColumn |
||||
import androidx.compose.material.Card |
||||
import androidx.compose.material.MaterialTheme |
||||
import androidx.compose.material.Text |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.runtime.getValue |
||||
import androidx.compose.runtime.livedata.observeAsState |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.unit.dp |
||||
import androidx.lifecycle.viewmodel.compose.viewModel |
||||
import com.gyf.csams.main.model.BackgroundViewModel |
||||
import com.gyf.lib.uikit.Body |
||||
import com.gyf.lib.uikit.MainColumnFrame |
||||
import com.gyf.lib.util.NotificationVo |
||||
import com.gyf.lib.util.format |
||||
import java.util.* |
||||
|
||||
/** |
||||
* 通知 |
||||
* |
||||
*/ |
||||
class NotificationActivity : ComponentActivity() { |
||||
override fun onCreate(savedInstanceState: Bundle?) { |
||||
super.onCreate(savedInstanceState) |
||||
|
||||
setContent { |
||||
Body { |
||||
val model: BackgroundViewModel = viewModel() |
||||
val data by model.data.observeAsState() |
||||
MainColumnFrame(background = { /*TODO*/ }) { |
||||
if (data?.size == 0) { |
||||
Row( |
||||
modifier = Modifier.fillMaxWidth(), |
||||
horizontalArrangement = Arrangement.Center |
||||
) { |
||||
Text(text = "目前没有收到任何通知") |
||||
} |
||||
} |
||||
LazyColumn { |
||||
data?.forEach { |
||||
item { |
||||
MessageItem(content = it) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Composable |
||||
private fun MessageItem(modifier: Modifier = Modifier, content: NotificationVo) { |
||||
Card(modifier = modifier, backgroundColor = MaterialTheme.colors.background) { |
||||
Column(modifier = Modifier.padding(10.dp)) { |
||||
Text(text = content.title, style = MaterialTheme.typography.h5) |
||||
Spacer(modifier = Modifier.height(5.dp)) |
||||
|
||||
Card( |
||||
backgroundColor = MaterialTheme.colors.background, |
||||
modifier = Modifier |
||||
.fillMaxWidth() |
||||
.padding(10.dp) |
||||
) { |
||||
Text(text = content.content) |
||||
} |
||||
|
||||
Spacer(modifier = Modifier.height(10.dp)) |
||||
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) { |
||||
Text(text = Date(content.createTime).format()) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,14 +1,20 @@ |
||||
package com.gyf.csams |
||||
|
||||
import android.app.Activity |
||||
import com.google.gson.reflect.TypeToken |
||||
import com.gyf.csams.account.ui.AccountActivity |
||||
import com.gyf.csams.main.ui.MainActivity |
||||
import com.gyf.lib.uikit.AbstractInitActivity |
||||
import com.gyf.lib.util.AccountApi |
||||
import com.gyf.lib.util.ApiResponse |
||||
import com.gyf.lib.util.UserVo |
||||
import java.lang.reflect.Type |
||||
|
||||
class InitActivity : AbstractInitActivity() { |
||||
class InitActivity : AbstractInitActivity<UserVo>() { |
||||
override val main: Class<out Activity> = MainActivity::class.java |
||||
override val login: Class<out Activity> = AccountActivity::class.java |
||||
|
||||
override val api: AccountApi = AccountApi.ForegroundToken |
||||
|
||||
override val typeToken: Type = object : TypeToken<ApiResponse<UserVo>>() {}.type |
||||
} |
@ -0,0 +1,11 @@ |
||||
package com.gyf.csams.message.model |
||||
|
||||
import android.app.Application |
||||
import com.gyf.lib.model.SysMessageViewModel |
||||
import com.gyf.lib.util.ClientType |
||||
|
||||
class ForegroundViewModel(application: Application) : SysMessageViewModel(application) { |
||||
override fun clientType(): ClientType { |
||||
return ClientType.Foreground |
||||
} |
||||
} |
@ -0,0 +1,477 @@ |
||||
package com.gyf.lib.util |
||||
|
||||
import androidx.annotation.IntRange |
||||
import com.gyf.lib.uikit.StringForm |
||||
import java.util.* |
||||
|
||||
/** |
||||
* 一般信息 |
||||
* |
||||
*/ |
||||
abstract class PersonInfoVo { |
||||
abstract val name: String |
||||
abstract val headImg: String? |
||||
abstract val desc: String |
||||
} |
||||
|
||||
|
||||
enum class Duty(val desc: String, val level: Int) { |
||||
|
||||
Teacher("老师", 1), |
||||
PamphaBhusal("总部长", 2), |
||||
SecretaryOfTheMinister("秘书部部长", 3), |
||||
PropagandaDepartment("宣传部部长", 3), |
||||
LiaisonMinister("外联部部长", 3), |
||||
SecretaryDepartmentOfficer("秘书部干事", 4), |
||||
PublicityDepartmentOfficer("宣传部干事", 4), |
||||
LiaisonOfficer("外联部干事", 4); |
||||
|
||||
|
||||
/** |
||||
* 是否是部门部长 |
||||
* |
||||
*/ |
||||
fun isMinister(): Boolean { |
||||
return minister.contains(this) |
||||
} |
||||
|
||||
fun isOfficer(): Boolean { |
||||
return officer.contains(this) |
||||
} |
||||
|
||||
} |
||||
|
||||
private val minister = |
||||
arrayOf(Duty.SecretaryOfTheMinister, Duty.LiaisonMinister, Duty.PropagandaDepartment) |
||||
private val officer = |
||||
arrayOf(Duty.SecretaryDepartmentOfficer, Duty.PublicityDepartmentOfficer, Duty.LiaisonOfficer) |
||||
|
||||
/** |
||||
* 个人信息 |
||||
* |
||||
*/ |
||||
abstract class OwnInfoVo : PersonInfoVo() { |
||||
abstract val token: Token |
||||
} |
||||
|
||||
data class ManagerInfoVo( |
||||
val duty: Duty, |
||||
override val name: String, |
||||
override val headImg: String?, |
||||
override val desc: String |
||||
) : PersonInfoVo() |
||||
|
||||
data class UserInfoVo( |
||||
override val name: String, |
||||
override val headImg: String?, |
||||
override val desc: String |
||||
) : PersonInfoVo() |
||||
|
||||
|
||||
/** |
||||
* 管理员个人信息 |
||||
* |
||||
* @property account 管理员账号 |
||||
* @property name 姓名 |
||||
* @property duty 职务 |
||||
* @property headImg 头像 |
||||
* @property desc 个人简介 |
||||
*/ |
||||
data class ManagerVo( |
||||
val account: String, |
||||
val duty: Duty, |
||||
override val token: Token, |
||||
override val name: String, |
||||
override val headImg: String?, |
||||
override val desc: String |
||||
) : OwnInfoVo() |
||||
|
||||
|
||||
/** |
||||
* 用户个人信息 |
||||
* |
||||
* @property studentId 学号 |
||||
* @property name 姓名 |
||||
* @property headImg 头像 |
||||
* @property desc 个人简介 |
||||
*/ |
||||
data class UserVo( |
||||
val studentId: String, |
||||
val manager: ManagerVo? = null, |
||||
override val token: Token, |
||||
override val name: String, |
||||
override val headImg: String?, |
||||
override val desc: String, |
||||
val associationMemberVo: AssociationMemberVo? |
||||
) : OwnInfoVo() |
||||
|
||||
data class PageDto(val currentPage: Long, val pageSize: Int = 10) |
||||
|
||||
data class NotificationDto( |
||||
val receiverId: Int, |
||||
val receiverClient: ClientType, |
||||
val page: PageDto? = null, |
||||
override val clientType: ClientType = receiverClient |
||||
) : ClientBaseVo() |
||||
|
||||
data class UserRegVo(val studentId: String, val name: String) |
||||
|
||||
/** |
||||
* 客户端类型 |
||||
* |
||||
*/ |
||||
enum class ClientType { |
||||
//前台 |
||||
Foreground, |
||||
|
||||
//后台 |
||||
Background |
||||
} |
||||
|
||||
|
||||
data class NotificationVo(val title: String, val content: String, val id: Int, val createTime: Long) |
||||
|
||||
|
||||
/** |
||||
* 响应自动生成密码 |
||||
* |
||||
* @property password |
||||
*/ |
||||
data class UserPasswordVo(val password: String) |
||||
|
||||
|
||||
/** |
||||
* 用户登陆表单 |
||||
* |
||||
* @property studentId 学号 |
||||
* @property password 密码 |
||||
* @property device 设备型号 |
||||
*/ |
||||
data class UserLoginVo(val studentId: String, val password: String, val device: String) |
||||
|
||||
|
||||
/** |
||||
* |
||||
* @property associationName 社团名字 |
||||
* @property activityName 活动名 |
||||
* @property activityTime 活动时间 |
||||
* @property activityLocation 活动地点 |
||||
* @property activityDesc 活动介绍 |
||||
*/ |
||||
data class ActivityDetailVo( |
||||
val associationName: String, val activityName: String, |
||||
val activityTime: Date, val activityLocation: String, |
||||
val activityDesc: String |
||||
) |
||||
|
||||
|
||||
data class ActivityMemberVo(val studentId: String, val name: String) |
||||
|
||||
/** |
||||
* 活动成员 |
||||
* |
||||
* @property organizer |
||||
* @property participant |
||||
*/ |
||||
data class ActivityMembersVo( |
||||
val organizer: ActivityMemberVo, |
||||
val participant: MutableList<ActivityMemberVo>? |
||||
) |
||||
|
||||
|
||||
/** |
||||
* 图片 |
||||
* @property name 文件名 |
||||
* @property size 文件大小 |
||||
* @property url 文件路径 |
||||
* @property md5 文件hash |
||||
* @property createTime 文件创建时间 |
||||
* @property studentId 文件上传人 |
||||
*/ |
||||
data class ActivityPhotoVo( |
||||
val name: String, |
||||
val size: Long, |
||||
val url: String, |
||||
val md5: String, |
||||
val createTime: Date, |
||||
val studentId: String |
||||
) |
||||
|
||||
const val MAX_SCORE = 5L |
||||
|
||||
data class ActivityVo( |
||||
val activityId: Long, val activityName: String, val association: String, |
||||
@IntRange(from = 1, to = MAX_SCORE) val score: Int, val activityTime: Date, val location: String |
||||
) |
||||
|
||||
|
||||
data class AllOfficerVo( |
||||
val secretariat: MutableList<ManagerInfoVo>, |
||||
val propaganda: MutableList<ManagerInfoVo>, |
||||
val publicRelationsDepartment: MutableList<ManagerInfoVo> |
||||
) |
||||
|
||||
|
||||
data class ApplyActVo( |
||||
val activityName: String, val activityTime: String, |
||||
val location: String, val desc: String, |
||||
val size: Int |
||||
) |
||||
|
||||
data class LeaveMessageVo( |
||||
val message: String, |
||||
override val clientType: ClientType = ClientType.Foreground |
||||
) : ClientBaseVo() |
||||
|
||||
/** |
||||
* 社团级别 |
||||
* |
||||
*/ |
||||
enum class AssociationLevel { |
||||
A, |
||||
B, |
||||
C, |
||||
D |
||||
} |
||||
|
||||
/** |
||||
* 所属院系 |
||||
* |
||||
*/ |
||||
enum class AssociationFaculty(val desc: String, val range: kotlin.ranges.IntRange) { |
||||
ForeignLanguageDept("外语系", 0..0), |
||||
CivilEngineeringDept("土木工程", 1..10), |
||||
SEM("经理管理学院", 11..20), |
||||
MechanicalEngineeringDept("机械工程", 21..30), |
||||
TransportationDept("交通运输", 31..40), |
||||
ArchitectureAndArts("建筑与艺术", 41..50), |
||||
ElectricalDept("电气", 51..60), |
||||
MaterialsDept("材料", 61..70), |
||||
MessageDept("信息", 71..80), |
||||
MathematicsDept("数理", 81..90), |
||||
GraduateStudent("研究生", 91..99) |
||||
} |
||||
|
||||
abstract class BaseAssociationVo { |
||||
abstract val id: Int |
||||
abstract val name: String |
||||
abstract val desc: String |
||||
abstract val logo: String |
||||
abstract val faculty: AssociationFaculty |
||||
abstract val level: AssociationLevel? |
||||
} |
||||
|
||||
/** |
||||
* 社团列表 |
||||
* |
||||
*/ |
||||
class AssociationVo( |
||||
override val id: Int, |
||||
override val name: String, |
||||
override val desc: String, |
||||
override val logo: String, |
||||
override val faculty: AssociationFaculty, |
||||
override val level: AssociationLevel? |
||||
) : BaseAssociationVo() |
||||
|
||||
//审核状态 |
||||
enum class CheckStatus(val desc: String) { |
||||
WaitFirst("等待初审"), |
||||
AcceptFirst("初审受理"), |
||||
WaitLast("等待复审"), |
||||
AcceptLast("复审受理"), |
||||
Finish("审核完成") |
||||
} |
||||
|
||||
data class AssociationMemberVo( |
||||
val association: AssociationVo, |
||||
val isHead: Boolean |
||||
) |
||||
|
||||
//用户社团 |
||||
data class AssociationCheckVo( |
||||
override val id: Int, |
||||
override val name: String, |
||||
override val desc: String, |
||||
override val logo: String, |
||||
override val faculty: AssociationFaculty, |
||||
override val level: AssociationLevel?, |
||||
val checkStatus: CheckStatus, |
||||
val applyTime: Long, |
||||
val firstCause: String, |
||||
val lastCause: String?, |
||||
val fileId: Int |
||||
) : BaseAssociationVo() |
||||
|
||||
/** |
||||
* 搜索社团 |
||||
* |
||||
* @property name |
||||
* @property desc |
||||
* @property clientType |
||||
*/ |
||||
data class SearchAssociationVo( |
||||
val name: String, val desc: String, |
||||
override val clientType: ClientType = ClientType.Foreground |
||||
) : ClientBaseVo() |
||||
|
||||
|
||||
data class BBSVo(val studentId: String, val name: String, val createTime: Date, val content: String) |
||||
|
||||
|
||||
/** |
||||
* 题型 |
||||
* |
||||
*/ |
||||
enum class ExamType(val type: String) { |
||||
//选择题 |
||||
CQ("选择题"), |
||||
|
||||
//开放题 |
||||
OQ("开放题") |
||||
} |
||||
|
||||
abstract class Exam { |
||||
abstract val examType: ExamType |
||||
abstract val question: StringForm |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 选择题 |
||||
* |
||||
* @property examType 题型描述 |
||||
* @property answers 答案 |
||||
* @property rightAnswer 正确答案 |
||||
* @property question 问题 |
||||
*/ |
||||
data class ChoiceQuestionVo( |
||||
override val examType: ExamType = ExamType.CQ, |
||||
val answers: List<StringForm>, |
||||
val rightAnswer: Int, |
||||
override val question: StringForm |
||||
) : Exam() |
||||
|
||||
|
||||
data class HistoryActVo(val name: String) |
||||
|
||||
|
||||
/** |
||||
* 开放题 |
||||
* |
||||
* @property examType 题型描述 |
||||
* @property question 问题 |
||||
*/ |
||||
data class OpenQuestionsVo( |
||||
override val examType: ExamType = ExamType.OQ, override val question: StringForm |
||||
) : Exam() |
||||
|
||||
|
||||
data class LeaveMessageFormatVo(val message: String, val user: UserInfoVo) |
||||
|
||||
|
||||
data class ManagerLoginVo(val account: String, val password: String, val device: String) |
||||
|
||||
|
||||
data class MemberVo(val name: String) |
||||
|
||||
data class OngoingActVo(val name: String) |
||||
|
||||
/** |
||||
* 活动质量汇报单 |
||||
* |
||||
* @property applyName 申请人 |
||||
* @property activityName 活动名称 |
||||
* @property merit 优点 |
||||
* @property defect 缺点 |
||||
* @property score 星级评价 |
||||
*/ |
||||
data class QualityReportVo( |
||||
val applyName: String, |
||||
val activityName: String, |
||||
val merit: String, |
||||
val defect: String, |
||||
@IntRange(from = 1L, to = MAX_SCORE) val score: Int |
||||
) |
||||
|
||||
/** |
||||
* 社团注册资料表单 |
||||
* |
||||
* @property name |
||||
* @property desc |
||||
* @property fileId |
||||
*/ |
||||
data class AssociationRegVo( |
||||
val id: Int?, val name: String, val desc: String, val fileId: Int, |
||||
override val clientType: ClientType = ClientType.Foreground |
||||
) : ClientBaseVo() |
||||
|
||||
/** |
||||
* 社团注册审核记录 |
||||
* |
||||
*/ |
||||
data class DisposeRegInfoVo( |
||||
val name: String, |
||||
val desc: String, |
||||
val logo: String, |
||||
val log: AuditLoggingVo |
||||
) |
||||
|
||||
/** |
||||
* 通用审核记录 |
||||
* |
||||
* @property id |
||||
* @property user |
||||
* @property applyTime |
||||
* @property manager |
||||
* @property acceptTime |
||||
* @property cause |
||||
* @property result |
||||
* @property auditTime |
||||
* @property nextAudit |
||||
*/ |
||||
data class AuditLoggingVo( |
||||
val id: Int, val user: UserInfoVo, val applyTime: Long, val manager: ManagerInfoVo?, |
||||
val acceptTime: Long?, val cause: String?, val result: Boolean?, |
||||
val auditTime: Long?, val nextAudit: AuditLoggingVo? |
||||
) |
||||
|
||||
/** |
||||
* 社团注册资料受理 |
||||
* |
||||
* @property regId |
||||
* @property clientType |
||||
*/ |
||||
data class AcceptRegAssociation( |
||||
val regId: Int, |
||||
val isFirstAccept: Boolean, |
||||
override val clientType: ClientType = ClientType.Background |
||||
) : ClientBaseVo() |
||||
|
||||
/** |
||||
* 社团注册资料审核 |
||||
* |
||||
* @property regId |
||||
* @property result |
||||
* @property cause |
||||
* @property clientType |
||||
*/ |
||||
data class CheckRegVo( |
||||
val regId: Int, val result: Boolean, val cause: String, |
||||
override val clientType: ClientType = ClientType.Background |
||||
) : ClientBaseVo() |
||||
|
||||
/** |
||||
* 换名申请表 |
||||
* |
||||
* @property studentId 学号 |
||||
* @property oldName 社团原名 |
||||
* @property newName 社团新名 |
||||
* @property reason 申请理由 |
||||
*/ |
||||
data class RenameVo( |
||||
val studentId: String, |
||||
val oldName: String, |
||||
val newName: String, |
||||
val reason: String |
||||
) |
@ -1,27 +0,0 @@ |
||||
package com.gyf.lib.util |
||||
|
||||
|
||||
data class NotificationVo(val title: String, val content: String, val id: Int) |
||||
|
||||
data class PageDto(val currentPage: Long, val pageSize: Int = 10) |
||||
|
||||
data class NotificationDto( |
||||
val receiverId: Int, |
||||
val receiverClient: ClientType, |
||||
override val token: Token, |
||||
val page: PageDto? = null, |
||||
override val clientType: ClientType = receiverClient |
||||
) : ClientBaseVo() |
||||
|
||||
|
||||
/** |
||||
* 客户端类型 |
||||
* |
||||
*/ |
||||
enum class ClientType { |
||||
//前台 |
||||
Foreground, |
||||
|
||||
//后台 |
||||
Background |
||||
} |
Loading…
Reference in new issue