You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
csamsserver/src/Vo.kt

318 lines
8.7 KiB

4 years ago
package com.gyf.csams
data class ApiResponse<T>(val code:Int=200,val message:String,val body:T?=null)
4 years ago
class Simple {
companion object {
fun success(message: String):ApiResponse<Any>{
return ApiResponse(code = 200, message = message, body = null)
}
fun error(message: String): ApiResponse<Any> {
return ApiResponse(code = 500, message = message, body = null)
}
}
}
/**
* 一般信息
*
*/
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)
}
/**
* 个人信息
*
*/
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()
data class UserRegVo(val studentId: String, val name: String)
/**
* 用户个人信息
*
* @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 associationVo: AssociationVo?,
val isHead: Boolean?
) : OwnInfoVo()
4 years ago
sealed class BaseLoginVo{
abstract val password: String
abstract val device: String
abstract val clientType:ClientType
}
sealed class ClientBaseVo {
abstract val token:Token
abstract val clientType:ClientType
}
data class UserLoginVo(val studentId: String,
override val password: String, override val device: String,
override val clientType: ClientType=ClientType.Foreground
):BaseLoginVo()
data class UserResDto(val password:String)
data class ManagerLoginVo(val account:String,
override val password:String, override val device:String):BaseLoginVo() {
override val clientType: ClientType=ClientType.Background
}
data class Token(val token:String, val createTime:Long, val id:Int)
data class LeaveMessageVo(val message: String, override val token:Token,
override val clientType: ClientType=ClientType.Foreground):ClientBaseVo()
data class OnlyToken(override val token: Token, override val clientType: ClientType):ClientBaseVo()
data class LeaveMessageDto(val message: String,val user: UserInfoVo)
/**
* 社团注册资料表单
*
* @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,
override val token: Token
):ClientBaseVo()
data class ImageFileDto(val filepath:String,val md5:String,val createTime: Long,val url:String)
data class RegAssociationDto(val name:String,val desc:String,val logo:ImageFileDto)
data class InitManagerDto(val account: String, val originPassword: String, val duty: Duty)
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?, override val clientType: ClientType=receiverClient
):ClientBaseVo()
data class NotificationVo(val title:String,val content:String,val id:Int,val createTime: Long)
data class SearchAssociationVo(val name:String, val desc:String,
override val clientType: ClientType=ClientType.Foreground, override val token: Token
):ClientBaseVo()
data class ShowAssociationVo(val id: Int,
override val token: Token,
override val clientType: ClientType=ClientType.Foreground):ClientBaseVo()
data class QueryAssociationMembers(val id:Int,
val name:String?=null,
override val token: Token,
override val clientType: ClientType=ClientType.Foreground
):ClientBaseVo()
/**
* 社团级别
*
*/
enum class AssociationLevel {
A,
B,
C,
D
}
/**
* 所属院系
*
*/
enum class AssociationFaculty(val desc: String, val range: 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
)
/**
* 活动照片
*
* @property path
*/
data class AssociationActPhotoVo(val path:String)
data class AssociationMainVo(val associationVo: AssociationVo,val head: UserInfoVo,
val photos:List<AssociationActPhotoVo>?=null)
//前台社团注册资料
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()
val facultyRange=IntRange(4,5)
fun User.faculty():AssociationFaculty{
val num=studentId.substring(facultyRange).toInt()
AssociationFaculty.values().forEach {
if(num in it.range){
return it
}
}
throw IllegalArgumentException("无法根据${facultyRange}对应的num[${num}]找到所属院系")
}
/**
* 通用审核记录
*
* @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,
override val token: Token
):ClientBaseVo()
/**
* 社团注册审核记录
*
*/
data class DisposeRegInfoVo(val name:String,val desc:String,val logo:String,val log:AuditLoggingVo)
/**
* 社团注册资料审核
*
* @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, override val token: Token
):ClientBaseVo()