题库接口

master
pan 4 years ago
parent 99b2545925
commit 484ecc4ad9
  1. 97
      module/src/main/kotlin/com/gyf/csams/module/ShareVo.kt
  2. 0
      resources/static/image/.gitkeep
  3. 95
      src/main/kotlin/com/gyf/csams/Controller.kt
  4. 70
      src/main/kotlin/com/gyf/csams/Dao.kt
  5. 2
      src/main/kotlin/com/gyf/csams/MySQL.kt
  6. 337
      src/main/kotlin/com/gyf/csams/Service.kt
  7. 3
      test/ApplicationTest.kt

@ -624,3 +624,100 @@ data class ManagerDutyVo(val manager: ManagerInfoVo,val people:Int)
data class ManagerDutySumVo(val secretariat:ManagerDutyVo,
val propaganda:ManagerDutyVo,
val publicRelationsDepartment:ManagerDutyVo)
data class ExamVo(val questionId:Int?=null,val question:String,val optionsA:String,val optionsB:String,val optionsC:String,val optionsD:String,val answer:Int)
/**
* 更新题库
*
* @property questions
* @property token
* @property clientType
*/
data class AddExamVo(val questions:List<ExamVo>,
val deleteIds:List<Int>?=null,
override val token: Token,
override val clientType: ClientType=ClientType.Foreground,
val associationId:Int):ClientBaseVo()
data class SearchExamVo(val associationId:Int, override val token: Token, override val clientType: ClientType=ClientType.Foreground):ClientBaseVo()
/**
* 试卷
*
* @property user
* @property createTime
* @property applyTime
*/
data class TestPaperVo(val user: UserInfoVo,val createTime: Long,val applyTime: Long?)
/**
* 试题
*
*/
data class AnswerVo(val examVo: ExamVo,val answer:Int?=null,val paperVo: TestPaperVo)
/**
* 答题记录
*
* @property questionId
* @property paperId
* @property answer
*/
data class ApplyAnswerVo(val questionId:Int,val paperId:Int,val answer:Int)
/**
* 答卷
*
* @property answers
* @property token
* @property clientType
*/
data class AddAnswerVo(val answers:List<ApplyAnswerVo>,
val associationId:Int,
override val token: Token, override val clientType: ClientType=ClientType.Foreground):ClientBaseVo()
data class ShowAnswerVo(val joinId:Int, override val token: Token,
override val clientType: ClientType=ClientType.Foreground):ClientBaseVo()
/**
* 申请入团
*
* @property associationId
* @property token
* @property clientType
*/
data class ApplyAssociationVo(val associationId:Int, override val token: Token, override val clientType: ClientType=ClientType.Foreground):ClientBaseVo()
/**
* 申请入团检查
*/
data class ApplyAssociationResultVo(val result:Boolean?=null,val hasPaper:Boolean?=null,val associationVo: AssociationVo?=null)
/**
* 申请入团记录
*
*/
data class JoinAssociationVo(val id:Int,val user: UserInfoVo,
val associationVo: AssociationVo,
val hasPaper: Boolean,
val result: Boolean?=null,
val applyTime: Long,
val auditTime: Long?=null)
/**
* 审核结果
*
* @property joinId
* @property result
*/
data class AuditJoinVo(val joinId:Int, val result:Boolean,
override val token: Token,
override val clientType: ClientType=ClientType.Foreground
):ClientBaseVo()
const val QUESTION_MIN_SIZE=5

@ -350,6 +350,101 @@ fun Application.AssociationController() {
check(AssociationService)
read(AssociationService,Associations)
post("/update/exam"){
call.withToken<AddExamVo> {
try {
AssociationService.updateExam(vo=it)
call.respond(ApiResponse(message = "题库更新成功",body=true))
} catch (e: Exception) {
log.error(e)
call.respond(ApiResponse(message = "题库更新失败",body=false))
}
}
}
post("/load/exam"){
call.withToken<SearchExamVo> {
try {
call.respond(ApiResponse(message = "加载题库",body = AssociationService.loadExam(vo = it)))
} catch (e: Exception) {
log.error(e)
call.respond(ApiResponse(message = "题库加载失败",body = null))
}
}
}
post("/check/apply"){
call.withToken<ApplyAssociationVo> {
try {
val body=AssociationService.applyAssociation(vo = it)
call.respond(ApiResponse(message = "入团验证信息获取成功",body =body))
} catch (e: Exception) {
log.error(e)
call.respond(ApiResponse(message = "入团验证信息获取失败",body=null))
}
}
}
post("/create/paper"){
call.withToken<ApplyAssociationVo> {
try {
call.respond(ApiResponse(message = "试卷创建成功,请开始作答",body = AssociationService.createPaper(vo=it)))
} catch (e: Exception) {
log.error(e)
call.respond(ApiResponse(message = "试卷创建失败",body=null))
}
}
}
post("/apply/paper"){
call.withToken<AddAnswerVo> {
try {
AssociationService.applyAnswer(vo=it)
call.respond(ApiResponse(message = "提交成功",body = true))
} catch (e: Exception) {
log.error(e)
call.respond(ApiResponse(message = "提交成功",body = false))
}
}
}
post("/check/join"){
call.withToken<ApplyAssociationVo> {
try {
call.respond(ApiResponse(message = "入团记录查询成功",body=AssociationService.joinAssociation(vo=it)))
} catch (e: Exception) {
log.error(e)
call.respond(ApiResponse(message = "入团记录查询失败",body=null))
}
}
}
post("/audit/join"){
call.withToken<AuditJoinVo> {
try {
AssociationService.auditJoin(vo = it)
call.respond(ApiResponse(message = "审核成功",body=true))
} catch (e: Exception) {
log.error(e)
call.respond(ApiResponse(message = "审核失败",body=false))
}
}
}
post("/show/answer"){
call.withToken<ShowAnswerVo> {
try {
call.respond(ApiResponse(message = "查看答案成功",body = AssociationService.showAnswer(vo=it)))
} catch (e: Exception) {
log.error(e)
call.respond(ApiResponse(message = "查看答案失败",body=null))
}
}
}
route("/rename"){
register(RenameService)

@ -1,5 +1,7 @@
package com.gyf.csams
import com.gyf.csams.Notifications.defaultExpression
import com.gyf.csams.TestPapers.defaultExpression
import org.jetbrains.exposed.dao.IntEntity
import org.jetbrains.exposed.dao.IntEntityClass
import org.jetbrains.exposed.dao.id.EntityID
@ -413,6 +415,9 @@ object Questions:IntIdTable(){
@TableComment("选项D")
val optionsD:Column<String> = varchar("optionsD",15)
@TableComment("答案")
val answer:Column<Int> = integer("answer")
@TableComment("所属社团")
val associationId:Column<EntityID<Int>> = reference("association_id",Associations)
}
@ -424,12 +429,77 @@ class Question(id:EntityID<Int>):IntEntity(id){
var optionsB by Questions.optionsB
var optionsC by Questions.optionsC
var optionsD by Questions.optionsD
var answer by Questions.answer
var association by Association referencedOn Questions.associationId
}
@TableComment("试卷")
object TestPapers:IntIdTable(){
@TableComment("答题用户")
val userId:Column<EntityID<Int>> = reference("user_id",Users)
@TableComment("生成时间")
val createTime:Column<LocalDateTime> = datetime("create_time").defaultExpression(CurrentDateTime())
@TableComment("提交时间")
val applyTime:Column<LocalDateTime?> = datetime("apply_time").nullable()
}
class TestPaper(id:EntityID<Int>):IntEntity(id){
companion object:IntEntityClass<TestPaper>(TestPapers)
var user by User referencedOn TestPapers.userId
var createTime by TestPapers.createTime
var applyTime by TestPapers.applyTime
}
@TableComment("试题")
object Answers:IntIdTable(){
@TableComment("问题")
val questionId:Column<EntityID<Int>> = reference("question_id",Questions)
@TableComment("答案")
val answer:Column<Int?> = integer("answer").nullable()
@TableComment("试卷")
val paperId:Column<EntityID<Int>> = reference("paper_id",TestPapers)
}
class Answer(id:EntityID<Int>):IntEntity(id){
companion object:IntEntityClass<Answer>(Answers)
var question by Question referencedOn Answers.questionId
var answer by Answers.answer
var paper by TestPaper referencedOn Answers.paperId
}
@TableComment("入团申请记录")
object JoinAssociations:IntIdTable(){
@TableComment("申请人")
val userId:Column<EntityID<Int>> = reference("user_id",Users)
@TableComment("申请社团")
val associationId:Column<EntityID<Int>> = reference("association_id",Associations)
@TableComment("申请时间")
val applyTime:Column<LocalDateTime> = datetime("create_time").defaultExpression(CurrentDateTime())
@TableComment("审核时间")
val auditTime:Column<LocalDateTime?> = datetime("audit_time").nullable()
@TableComment("试卷")
val paperId:Column<EntityID<Int>?> = reference("paper_id",TestPapers).nullable()
@TableComment("申请结果")
val result:Column<Boolean?> = bool("result").nullable()
}
class JoinAssociation(id:EntityID<Int>):IntEntity(id){
companion object:IntEntityClass<JoinAssociation>(JoinAssociations)
var user by User referencedOn JoinAssociations.userId
var association by Association referencedOn JoinAssociations.associationId
var paper by TestPaper optionalReferencedOn JoinAssociations.paperId
var result by JoinAssociations.result
var applyTime by JoinAssociations.applyTime
var auditTime by JoinAssociations.auditTime
}

@ -42,7 +42,7 @@ fun initTable(){
transaction {
val tableList= arrayOf(Users,UserTokens,Managers,ManagerTokens,AuditLeggings,LeaveMessages,
ImageFiles,Associations,AssociationMembers,Notifications,Activities,PhotoAlbums,ActivityComments,
Renames)
Renames,Questions,TestPapers,Answers,JoinAssociations)
SchemaUtils.createMissingTablesAndColumns(*tableList)
updateComment(*tableList)

@ -199,7 +199,6 @@ object AccountService : AbstractService() {
}
fun getManagerVo(token: Token): ManagerVo {
return transaction {
val c = ManagerToken.find {
@ -343,7 +342,8 @@ object FileService : AbstractService() {
super.init(environment)
this.uploadDir = environment.config.property("ktor.deployment.filePath").getString()
filePath = this::class.java.classLoader.getResource(uploadDir)?.path ?: throw IllegalArgumentException("初始化资源目录失败")
filePath =
this::class.java.classLoader.getResource(uploadDir)?.path ?: throw IllegalArgumentException("初始化资源目录失败")
File(filePath).let {
when {
it.exists() -> log.info("上传路径[${filePath}]已存在")
@ -482,7 +482,11 @@ abstract class AuditService<T, E, F> : AbstractService() {
*/
abstract fun findEntity(auditId: Int): AbstractAudit
protected inline fun <reified E:AbstractAudit,reified Row:IntEntityClass<E>,reified Table:AbstractAudits> testFind(table:Table,row:Row,auditId: Int): E {
protected inline fun <reified E : AbstractAudit, reified Row : IntEntityClass<E>, reified Table : AbstractAudits> testFind(
table: Table,
row: Row,
auditId: Int
): E {
return row.find { table.auditId eq auditId }.firstOrNull() ?: throw AuditIdError(auditId)
}
@ -687,7 +691,11 @@ abstract class AuditService<T, E, F> : AbstractService() {
val auditLogging = AuditLoggingVo(
id = logging.id.value,
user =
UserInfoVo(name = logging.user.name, headImg = logging.user.headImg?.filepath, desc = logging.user.desc),
UserInfoVo(
name = logging.user.name,
headImg = logging.user.headImg?.filepath,
desc = logging.user.desc
),
applyTime = logging.applyTime.toLong(),
manager = logging.manager?.let {
ManagerInfoVo(
@ -752,6 +760,11 @@ object AssociationService : AuditService<AssociationRegVo, AuditAssociationVo, A
}
}
/**
* 加载所有社团
*
* @return
*/
fun loadAll(): List<AssociationVo> {
return transaction {
Association.all().map {
@ -760,6 +773,258 @@ object AssociationService : AuditService<AssociationRegVo, AuditAssociationVo, A
}
}
private fun toExamVo(question:Question):ExamVo{
return ExamVo(questionId = question.id.value,question=question.question,optionsA = question.optionsA,
optionsB = question.optionsB,optionsC = question.optionsC,optionsD = question.optionsD,answer = question.answer)
}
/**
* 加载题库
*
* @param vo
* @return
*/
fun loadExam(vo:SearchExamVo):List<ExamVo>{
return transaction {
Question.find { Questions.associationId eq vo.associationId }.map {
toExamVo(question = it)
}
}
}
/**
* 提交答卷
*
*/
fun applyAnswer(vo:AddAnswerVo){
transaction {
val association= Association.findById(vo.associationId)?:throw AssociationIdError(vo.associationId)
val user=User.findById(vo.token.id)?:throw UserIdError(vo.token.id)
vo.answers.forEach {
val question=Question.findById(it.questionId)?:throw IllegalArgumentException("不存在[id=${it.questionId}]的问题")
val paper=TestPaper.findById(it.paperId)?:throw IllegalArgumentException("不存在[id=${it.paperId}]的问题")
Answer.new {
this.question=question
answer=it.answer
this.paper=paper
}
}
createJoin(association = association,user=user)
}
}
/**
* 显示答卷
*
* @param vo
* @return
*/
fun showAnswer(vo:ShowAnswerVo):List<AnswerVo>{
return transaction {
val join=JoinAssociation.findById(vo.joinId)?:throw IllegalArgumentException("找不到[id=${vo.joinId}]申请记录")
val paperId= join.paper?.id?:throw IllegalArgumentException("[id=${join.id}]没有关联试卷")
val paper=TestPaper.findById(paperId)?:throw IllegalArgumentException("[id=${paperId}]关联的试卷不存在")
Answer.find { Answers.paperId eq paperId}.map {
AnswerVo(examVo = toExamVo(it.question),answer = it.answer,paperVo =
TestPaperVo(user = UserInfoVo(name=join.user.name,headImg = join.user.headImg?.filepath,desc=join.user.desc),
createTime = paper.createTime.toLong(),applyTime = paper.applyTime?.toLong()))
}
}
}
/**
* 创建申请记录
*
* @param association
* @param user
*/
private fun createJoin(association: Association,user:User){
JoinAssociation.new {
this.association=association
this.user=user
}.apply {
//通知团长处理
AssociationMember.find { AssociationMembers.associationId eq association.id and
(AssociationMembers.isHead eq true) }.firstOrNull()?.apply {
Notification.new {
this.title = "入团申请通知"
this.content = "用户${user.name}申请加入社团"
this.receiverId = user.id.value
receiverClient = ClientType.Foreground.name
}
}
}
}
/**
* 生成试卷
*
* @param vo
* @return
*/
fun createPaper(vo:ApplyAssociationVo):List<ExamVo>{
return transaction {
val association= Association.findById(vo.associationId)?:throw AssociationIdError(vo.associationId)
val user=User.findById(vo.token.id)?:throw UserIdError(vo.token.id)
Question.find { Questions.associationId eq association.id }.let { it ->
val paper=TestPaper.new {
this.user=user
this.applyTime= LocalDateTime.now()
}
it.shuffled().apply {
forEach {
Answer.new {
this.paper=paper
this.question=it
}
}
}.map {
toExamVo(question = it)
}
}
}
}
/**
* 申请入团
*
*/
fun applyAssociation(vo:ApplyAssociationVo):ApplyAssociationResultVo{
return transaction {
val user=User.findById(vo.token.id)?:throw UserIdError(vo.token.id)
val association= Association.findById(vo.associationId)?:throw AssociationIdError(vo.associationId)
JoinAssociation.find { JoinAssociations.userId eq vo.token.id and (JoinAssociations.result eq null) }.firstOrNull().let {
if(it!=null){
return@transaction ApplyAssociationResultVo(associationVo = toAssociationVo(it.association))
}
}
Question.find { Questions.associationId eq association.id }.let { it ->
//题库需要满足最少题目数才能生成试卷
if(it.count()>=QUESTION_MIN_SIZE){
ApplyAssociationResultVo(result = true,hasPaper = true)
}
//免试入团申请
else{
createJoin(association=association,user=user)
ApplyAssociationResultVo(result = true,hasPaper = false)
}
}
}
}
/**
* 入团申请记录
*
*/
fun joinAssociation(vo:ApplyAssociationVo):List<JoinAssociationVo>{
return transaction {
val association=Association.findById(vo.associationId)?:throw AssociationIdError(vo.associationId)
val user=User.findById(vo.token.id)?:throw UserIdError(vo.token.id)
JoinAssociation.find { JoinAssociations.associationId eq association.id }.map {
val userInfoVo=UserInfoVo(name = user.name,headImg = user.headImg?.filepath,desc=user.desc)
JoinAssociationVo(user = userInfoVo,
associationVo = toAssociationVo(it.association),
hasPaper = it.paper!=null,result = it.result,
applyTime = it.applyTime.toLong(),
auditTime = it.auditTime?.toLong(),id = it.id.value)
}
}
}
/**
* 审核入团申请
* @param vo
*/
fun auditJoin(vo:AuditJoinVo){
transaction {
val join=JoinAssociation.findById(vo.joinId)?:throw IllegalArgumentException("审核记录不存在")
join.result=vo.result
join.auditTime= LocalDateTime.now()
if(vo.result){
AssociationMember.new {
user=join.user
association=join.association
isHead=false
}
//入团申请通过,通知社团其他人
AssociationMember.find { AssociationMembers.associationId eq join.association.id }.forEach {
Notification.new {
this.title = "入团通知"
this.content = "欢迎新人${join.user.name}加入社团"
this.receiverId = it.user.id.value
receiverClient = ClientType.Foreground.name
}.apply {
log.info("通知前台用户${dataType}处理进度")
}
}
}
//把审核结果发送给申请人
Notification.new{
this.title="入团审核结果"
this.content="您申请加入${join.association.name}社团审核${if(vo.result)"通过" else "不通过"}"
this.receiverId=join.user.id.value
receiverClient=ClientType.Foreground.name
}
}
}
/**
* 更新题库
*
* @param vo
*/
fun updateExam(vo: AddExamVo) {
transaction {
val association=Association.findById(vo.associationId)?:throw IllegalArgumentException("找不到社团信息")
vo.deleteIds?.let {
//删除社团题目
Question.find { Questions.associationId eq association.id and (Questions.id inList it ) }.forEach {
log.info("删除[id=${it.id}]题目")
it.delete()
}
}
vo.questions.forEach {
exam->
exam.questionId.let {
if (it == null) {
Question.new {
question = exam.question
optionsA = exam.optionsA
optionsB = exam.optionsB
optionsC = exam.optionsC
optionsD = exam.optionsD
this.answer = exam.answer
this.association = association
}
} else {
log.info("更新[id=${it}]的题目")
Question.findById(it)?.apply {
question = exam.question
optionsA = exam.optionsA
optionsB = exam.optionsB
optionsC = exam.optionsC
optionsD = exam.optionsD
this.answer = exam.answer
}
}
}
}
}
}
/**
* 更新社团信息
*
* @param vo
*/
fun update(vo: AssociationVo) {
transaction {
Association.findById(vo.associationId).let {
@ -825,7 +1090,8 @@ object AssociationService : AuditService<AssociationRegVo, AuditAssociationVo, A
.select {
nextAudit[AuditLeggings.result] eq true and (Associations.name like "%${vo.name}%") and (Associations.desc like "%${vo.desc}%")
}.map {
val association=Association.findById(it[Associations.id])?:throw AssociationIdError(it[Associations.id].value)
val association =
Association.findById(it[Associations.id]) ?: throw AssociationIdError(it[Associations.id].value)
toAssociationVo(association)
}
}
@ -945,8 +1211,10 @@ object ActivityService : AuditService<ActivityApplyVo, AuditActVo,ActivityCheckV
fun listAll(): List<ManagerActVo> {
return transaction {
Activity.all().map {
ManagerActVo(association = AssociationService.toAssociationVo(it.association),
score = (1..5).random(),activityVo = toActivityVo(it))
ManagerActVo(
association = AssociationService.toAssociationVo(it.association),
score = (1..5).random(), activityVo = toActivityVo(it)
)
}
}
}
@ -959,9 +1227,11 @@ object ActivityService : AuditService<ActivityApplyVo, AuditActVo,ActivityCheckV
fun random(): List<MainActivityPhotoVo> {
return transaction {
PhotoAlbum.all().shuffled().map {
MainActivityPhotoVo(url=it.photo.filepath,
MainActivityPhotoVo(
url = it.photo.filepath,
activityVo = toActivityVo(it.activity),
associationVo = AssociationService.toAssociationVo(it.activity.association))
associationVo = AssociationService.toAssociationVo(it.activity.association)
)
}
}
}
@ -1015,8 +1285,10 @@ object ActivityService : AuditService<ActivityApplyVo, AuditActVo,ActivityCheckV
fun loadComment(vo: SearchCommentVo): List<BBSVo> {
return transaction {
ActivityComment.find { ActivityComments.activityId eq vo.activityId }.map {
BBSVo(user = UserInfoVo(name=it.user.name,headImg = it.user.headImg?.filepath,desc = it.user.desc),
createTime = it.createTime.toLong(),content = it.content)
BBSVo(
user = UserInfoVo(name = it.user.name, headImg = it.user.headImg?.filepath, desc = it.user.desc),
createTime = it.createTime.toLong(), content = it.content
)
}
}
}
@ -1036,7 +1308,6 @@ object ActivityService : AuditService<ActivityApplyVo, AuditActVo,ActivityCheckV
}
/**
* 活动列表
*
@ -1050,7 +1321,8 @@ object ActivityService : AuditService<ActivityApplyVo, AuditActVo,ActivityCheckV
.select {
nextAudit[AuditLeggings.result] eq true and (Activities.associationId eq vo.associationId)
}.map {
val activity=Activity.findById(it[Activities.id])?:throw ActivityIdError(it[Activities.id].value)
val activity =
Activity.findById(it[Activities.id]) ?: throw ActivityIdError(it[Activities.id].value)
toActivityVo(activity = activity)
}
}
@ -1065,13 +1337,15 @@ object ActivityService : AuditService<ActivityApplyVo, AuditActVo,ActivityCheckV
fun show(vo: ShowActivityVo): ActivityDetailVo {
return transaction {
(Activity.findById(vo.activityId) ?: throw ActivityIdError(vo.activityId)).let {
ActivityDetailVo(activityVo = toActivityVo(it),associationVo = AssociationService.toAssociationVo(it.association))
ActivityDetailVo(
activityVo = toActivityVo(it),
associationVo = AssociationService.toAssociationVo(it.association)
)
}
}
}
fun Activity.set(activityVo: ActivityVo, user: User) {
activityName = activityVo.activityName
activityTime = activityVo.activityTime.toLocalDateTime()
@ -1106,7 +1380,8 @@ object ActivityService : AuditService<ActivityApplyVo, AuditActVo,ActivityCheckV
else -> {
Activity.new {
set(vo.activityVo, user = user)
association = Association.findById(vo.associationId) ?: throw AssociationIdError(vo.associationId)
association =
Association.findById(vo.associationId) ?: throw AssociationIdError(vo.associationId)
}
}
}
@ -1200,7 +1475,6 @@ object RenameService : AuditService<RenameApplyVo,AuditRenameVo,RenameCheckVo>()
}
override fun findEntity(auditId: Int): AbstractAudit {
return testFind(Renames, Rename, auditId)
}
@ -1219,7 +1493,11 @@ object RenameService : AuditService<RenameApplyVo,AuditRenameVo,RenameCheckVo>()
return transaction {
return@transaction createSortedBy(Rename).map {
val audit = toAuditLoggingVo(it.audit) ?: throw IllegalArgumentException("转换审核记录出错!!!!")
AuditRenameVo(renameVo = toRenameVo(rename = it),audit = audit,associationVo = AssociationService.toAssociationVo(it.association))
AuditRenameVo(
renameVo = toRenameVo(rename = it),
audit = audit,
associationVo = AssociationService.toAssociationVo(it.association)
)
}.apply {
log.info("找到${this.size}${ActivityService.dataType}")
}
@ -1310,12 +1588,13 @@ object BackgroundService : AbstractService() {
fun toManagerVo(manager: Manager): ManagerInfoVo {
return ManagerInfoVo(duty = manager.duty.let { Duty.valueOf(it) },name=manager.name,
headImg = manager.headImg?.filepath,desc = manager.desc)
return ManagerInfoVo(
duty = manager.duty.let { Duty.valueOf(it) }, name = manager.name,
headImg = manager.headImg?.filepath, desc = manager.desc
)
}
/**
* 加载部门部长和总人数
*
@ -1328,10 +1607,14 @@ object BackgroundService : AbstractService() {
val propagandaCount = Manager.find { Managers.duty eq Duty.PublicityDepartmentOfficer.name }.count()
val publicRelationsDepartment = Manager.find { Managers.duty eq Duty.LiaisonMinister.name }.first()
val publicRelationsDepartmentCount = Manager.find { Managers.duty eq Duty.LiaisonOfficer.name }.count()
ManagerDutySumVo(secretariat = ManagerDutyVo(manager = toManagerVo(secretariat),people = secretariatCount.toInt()),
ManagerDutySumVo(
secretariat = ManagerDutyVo(manager = toManagerVo(secretariat), people = secretariatCount.toInt()),
propaganda = ManagerDutyVo(manager = toManagerVo(propaganda), people = propagandaCount.toInt()),
publicRelationsDepartment = ManagerDutyVo(manager = toManagerVo(publicRelationsDepartment),
people=publicRelationsDepartmentCount.toInt()))
publicRelationsDepartment = ManagerDutyVo(
manager = toManagerVo(publicRelationsDepartment),
people = publicRelationsDepartmentCount.toInt()
)
)
}
}
@ -1351,7 +1634,11 @@ object BackgroundService : AbstractService() {
val publicRelationsDepartment = Manager.find { Managers.duty eq Duty.LiaisonOfficer.name }.map {
toManagerVo(it)
}
AllOfficerVo(secretariat=secretariat,propaganda = propaganda,publicRelationsDepartment=publicRelationsDepartment)
AllOfficerVo(
secretariat = secretariat,
propaganda = propaganda,
publicRelationsDepartment = publicRelationsDepartment
)
}
}

@ -119,7 +119,8 @@ class ApplicationTest {
@Test
fun test(){
println("12345678".substring(IntRange(4,5)))
val c:String?=null
c.let { println(it) }
}
@Test

Loading…
Cancel
Save