|
|
@ -199,7 +199,6 @@ object AccountService : AbstractService() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun getManagerVo(token: Token): ManagerVo { |
|
|
|
fun getManagerVo(token: Token): ManagerVo { |
|
|
|
return transaction { |
|
|
|
return transaction { |
|
|
|
val c = ManagerToken.find { |
|
|
|
val c = ManagerToken.find { |
|
|
@ -343,7 +342,8 @@ object FileService : AbstractService() { |
|
|
|
super.init(environment) |
|
|
|
super.init(environment) |
|
|
|
this.uploadDir = environment.config.property("ktor.deployment.filePath").getString() |
|
|
|
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 { |
|
|
|
File(filePath).let { |
|
|
|
when { |
|
|
|
when { |
|
|
|
it.exists() -> log.info("上传路径[${filePath}]已存在") |
|
|
|
it.exists() -> log.info("上传路径[${filePath}]已存在") |
|
|
@ -482,7 +482,11 @@ abstract class AuditService<T, E, F> : AbstractService() { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
abstract fun findEntity(auditId: Int): AbstractAudit |
|
|
|
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) |
|
|
|
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( |
|
|
|
val auditLogging = AuditLoggingVo( |
|
|
|
id = logging.id.value, |
|
|
|
id = logging.id.value, |
|
|
|
user = |
|
|
|
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(), |
|
|
|
applyTime = logging.applyTime.toLong(), |
|
|
|
manager = logging.manager?.let { |
|
|
|
manager = logging.manager?.let { |
|
|
|
ManagerInfoVo( |
|
|
|
ManagerInfoVo( |
|
|
@ -752,6 +760,11 @@ object AssociationService : AuditService<AssociationRegVo, AuditAssociationVo, A |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 加载所有社团 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
fun loadAll(): List<AssociationVo> { |
|
|
|
fun loadAll(): List<AssociationVo> { |
|
|
|
return transaction { |
|
|
|
return transaction { |
|
|
|
Association.all().map { |
|
|
|
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) { |
|
|
|
fun update(vo: AssociationVo) { |
|
|
|
transaction { |
|
|
|
transaction { |
|
|
|
Association.findById(vo.associationId).let { |
|
|
|
Association.findById(vo.associationId).let { |
|
|
@ -825,7 +1090,8 @@ object AssociationService : AuditService<AssociationRegVo, AuditAssociationVo, A |
|
|
|
.select { |
|
|
|
.select { |
|
|
|
nextAudit[AuditLeggings.result] eq true and (Associations.name like "%${vo.name}%") and (Associations.desc like "%${vo.desc}%") |
|
|
|
nextAudit[AuditLeggings.result] eq true and (Associations.name like "%${vo.name}%") and (Associations.desc like "%${vo.desc}%") |
|
|
|
}.map { |
|
|
|
}.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) |
|
|
|
toAssociationVo(association) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -945,8 +1211,10 @@ object ActivityService : AuditService<ActivityApplyVo, AuditActVo,ActivityCheckV |
|
|
|
fun listAll(): List<ManagerActVo> { |
|
|
|
fun listAll(): List<ManagerActVo> { |
|
|
|
return transaction { |
|
|
|
return transaction { |
|
|
|
Activity.all().map { |
|
|
|
Activity.all().map { |
|
|
|
ManagerActVo(association = AssociationService.toAssociationVo(it.association), |
|
|
|
ManagerActVo( |
|
|
|
score = (1..5).random(),activityVo = toActivityVo(it)) |
|
|
|
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> { |
|
|
|
fun random(): List<MainActivityPhotoVo> { |
|
|
|
return transaction { |
|
|
|
return transaction { |
|
|
|
PhotoAlbum.all().shuffled().map { |
|
|
|
PhotoAlbum.all().shuffled().map { |
|
|
|
MainActivityPhotoVo(url=it.photo.filepath, |
|
|
|
MainActivityPhotoVo( |
|
|
|
|
|
|
|
url = it.photo.filepath, |
|
|
|
activityVo = toActivityVo(it.activity), |
|
|
|
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> { |
|
|
|
fun loadComment(vo: SearchCommentVo): List<BBSVo> { |
|
|
|
return transaction { |
|
|
|
return transaction { |
|
|
|
ActivityComment.find { ActivityComments.activityId eq vo.activityId }.map { |
|
|
|
ActivityComment.find { ActivityComments.activityId eq vo.activityId }.map { |
|
|
|
BBSVo(user = UserInfoVo(name=it.user.name,headImg = it.user.headImg?.filepath,desc = it.user.desc), |
|
|
|
BBSVo( |
|
|
|
createTime = it.createTime.toLong(),content = it.content) |
|
|
|
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 { |
|
|
|
.select { |
|
|
|
nextAudit[AuditLeggings.result] eq true and (Activities.associationId eq vo.associationId) |
|
|
|
nextAudit[AuditLeggings.result] eq true and (Activities.associationId eq vo.associationId) |
|
|
|
}.map { |
|
|
|
}.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) |
|
|
|
toActivityVo(activity = activity) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1065,13 +1337,15 @@ object ActivityService : AuditService<ActivityApplyVo, AuditActVo,ActivityCheckV |
|
|
|
fun show(vo: ShowActivityVo): ActivityDetailVo { |
|
|
|
fun show(vo: ShowActivityVo): ActivityDetailVo { |
|
|
|
return transaction { |
|
|
|
return transaction { |
|
|
|
(Activity.findById(vo.activityId) ?: throw ActivityIdError(vo.activityId)).let { |
|
|
|
(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) { |
|
|
|
fun Activity.set(activityVo: ActivityVo, user: User) { |
|
|
|
activityName = activityVo.activityName |
|
|
|
activityName = activityVo.activityName |
|
|
|
activityTime = activityVo.activityTime.toLocalDateTime() |
|
|
|
activityTime = activityVo.activityTime.toLocalDateTime() |
|
|
@ -1106,7 +1380,8 @@ object ActivityService : AuditService<ActivityApplyVo, AuditActVo,ActivityCheckV |
|
|
|
else -> { |
|
|
|
else -> { |
|
|
|
Activity.new { |
|
|
|
Activity.new { |
|
|
|
set(vo.activityVo, user = user) |
|
|
|
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 { |
|
|
|
override fun findEntity(auditId: Int): AbstractAudit { |
|
|
|
return testFind(Renames, Rename, auditId) |
|
|
|
return testFind(Renames, Rename, auditId) |
|
|
|
} |
|
|
|
} |
|
|
@ -1219,7 +1493,11 @@ object RenameService : AuditService<RenameApplyVo,AuditRenameVo,RenameCheckVo>() |
|
|
|
return transaction { |
|
|
|
return transaction { |
|
|
|
return@transaction createSortedBy(Rename).map { |
|
|
|
return@transaction createSortedBy(Rename).map { |
|
|
|
val audit = toAuditLoggingVo(it.audit) ?: throw IllegalArgumentException("转换审核记录出错!!!!") |
|
|
|
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 { |
|
|
|
}.apply { |
|
|
|
log.info("找到${this.size}份${ActivityService.dataType}") |
|
|
|
log.info("找到${this.size}份${ActivityService.dataType}") |
|
|
|
} |
|
|
|
} |
|
|
@ -1310,12 +1588,13 @@ object BackgroundService : AbstractService() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun toManagerVo(manager: Manager): ManagerInfoVo { |
|
|
|
fun toManagerVo(manager: Manager): ManagerInfoVo { |
|
|
|
return ManagerInfoVo(duty = manager.duty.let { Duty.valueOf(it) },name=manager.name, |
|
|
|
return ManagerInfoVo( |
|
|
|
headImg = manager.headImg?.filepath,desc = manager.desc) |
|
|
|
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 propagandaCount = Manager.find { Managers.duty eq Duty.PublicityDepartmentOfficer.name }.count() |
|
|
|
val publicRelationsDepartment = Manager.find { Managers.duty eq Duty.LiaisonMinister.name }.first() |
|
|
|
val publicRelationsDepartment = Manager.find { Managers.duty eq Duty.LiaisonMinister.name }.first() |
|
|
|
val publicRelationsDepartmentCount = Manager.find { Managers.duty eq Duty.LiaisonOfficer.name }.count() |
|
|
|
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()), |
|
|
|
propaganda = ManagerDutyVo(manager = toManagerVo(propaganda), people = propagandaCount.toInt()), |
|
|
|
publicRelationsDepartment = ManagerDutyVo(manager = toManagerVo(publicRelationsDepartment), |
|
|
|
publicRelationsDepartment = ManagerDutyVo( |
|
|
|
people=publicRelationsDepartmentCount.toInt())) |
|
|
|
manager = toManagerVo(publicRelationsDepartment), |
|
|
|
|
|
|
|
people = publicRelationsDepartmentCount.toInt() |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1351,7 +1634,11 @@ object BackgroundService : AbstractService() { |
|
|
|
val publicRelationsDepartment = Manager.find { Managers.duty eq Duty.LiaisonOfficer.name }.map { |
|
|
|
val publicRelationsDepartment = Manager.find { Managers.duty eq Duty.LiaisonOfficer.name }.map { |
|
|
|
toManagerVo(it) |
|
|
|
toManagerVo(it) |
|
|
|
} |
|
|
|
} |
|
|
|
AllOfficerVo(secretariat=secretariat,propaganda = propaganda,publicRelationsDepartment=publicRelationsDepartment) |
|
|
|
AllOfficerVo( |
|
|
|
|
|
|
|
secretariat = secretariat, |
|
|
|
|
|
|
|
propaganda = propaganda, |
|
|
|
|
|
|
|
publicRelationsDepartment = publicRelationsDepartment |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|