|
|
@ -665,7 +665,11 @@ abstract class AuditService<T, E, F> : AbstractService() { |
|
|
|
.select { Users.id eq vo.token.id } |
|
|
|
.select { Users.id eq vo.token.id } |
|
|
|
.filter { |
|
|
|
.filter { |
|
|
|
log.info("it[AuditLeggings.result]=${it[AuditLeggings.result]},it[AuditLeggings.nextAudit]=${it[AuditLeggings.nextAudit]}") |
|
|
|
log.info("it[AuditLeggings.result]=${it[AuditLeggings.result]},it[AuditLeggings.nextAudit]=${it[AuditLeggings.nextAudit]}") |
|
|
|
it[AuditLeggings.result]==null|| it[AuditLeggings.nextAudit]?.let { it1 -> AuditLogging.findById(it1)?.result } ==null |
|
|
|
it[AuditLeggings.result] == null || it[AuditLeggings.nextAudit]?.let { it1 -> |
|
|
|
|
|
|
|
AuditLogging.findById( |
|
|
|
|
|
|
|
it1 |
|
|
|
|
|
|
|
)?.result |
|
|
|
|
|
|
|
} == null |
|
|
|
} |
|
|
|
} |
|
|
|
log.info("size:${c.size}") |
|
|
|
log.info("size:${c.size}") |
|
|
|
if (c.size == 1) { |
|
|
|
if (c.size == 1) { |
|
|
@ -810,8 +814,15 @@ object AssociationService : AuditService<AssociationRegVo, AuditAssociationVo, A |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun toExamVo(question: Question): ExamVo { |
|
|
|
private fun toExamVo(question: Question): ExamVo { |
|
|
|
return ExamVo(questionId = question.id.value,question=question.question,optionsA = question.optionsA, |
|
|
|
return ExamVo( |
|
|
|
optionsB = question.optionsB,optionsC = question.optionsC,optionsD = question.optionsD,rightOption = question.answer) |
|
|
|
questionId = question.id.value, |
|
|
|
|
|
|
|
question = question.question, |
|
|
|
|
|
|
|
optionsA = question.optionsA, |
|
|
|
|
|
|
|
optionsB = question.optionsB, |
|
|
|
|
|
|
|
optionsC = question.optionsC, |
|
|
|
|
|
|
|
optionsD = question.optionsD, |
|
|
|
|
|
|
|
rightOption = question.answer |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -855,9 +866,11 @@ object AssociationService : AuditService<AssociationRegVo, AuditAssociationVo, A |
|
|
|
|
|
|
|
|
|
|
|
private fun toJoinVo(join: JoinAssociation): JoinAssociationVo { |
|
|
|
private fun toJoinVo(join: JoinAssociation): JoinAssociationVo { |
|
|
|
val hasPaper = Answer.find { Answers.joinId eq join.id.value }.count() > 0 |
|
|
|
val hasPaper = Answer.find { Answers.joinId eq join.id.value }.count() > 0 |
|
|
|
return JoinAssociationVo(id=join.id.value,user = AccountService.toUserInfo(join.user), |
|
|
|
return JoinAssociationVo( |
|
|
|
|
|
|
|
id = join.id.value, user = AccountService.toUserInfo(join.user), |
|
|
|
associationVo = toAssociationVo(join.association), hasPaper = hasPaper, result = join.result, |
|
|
|
associationVo = toAssociationVo(join.association), hasPaper = hasPaper, result = join.result, |
|
|
|
applyTime = join.applyTime.toLong(),auditTime = join.auditTime?.toLong()) |
|
|
|
applyTime = join.applyTime.toLong(), auditTime = join.auditTime?.toLong() |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -908,8 +921,10 @@ object AssociationService : AuditService<AssociationRegVo, AuditAssociationVo, A |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun createJoinNotification(user: User, association: Association) { |
|
|
|
private fun createJoinNotification(user: User, association: Association) { |
|
|
|
AssociationMember.find { AssociationMembers.associationId eq association.id and |
|
|
|
AssociationMember.find { |
|
|
|
(AssociationMembers.isHead eq true) }.firstOrNull()?.apply { |
|
|
|
AssociationMembers.associationId eq association.id and |
|
|
|
|
|
|
|
(AssociationMembers.isHead eq true) |
|
|
|
|
|
|
|
}.firstOrNull()?.apply { |
|
|
|
Notification.new { |
|
|
|
Notification.new { |
|
|
|
this.title = "入团申请通知" |
|
|
|
this.title = "入团申请通知" |
|
|
|
this.content = "用户${user.name}申请加入社团" |
|
|
|
this.content = "用户${user.name}申请加入社团" |
|
|
@ -927,7 +942,8 @@ object AssociationService : AuditService<AssociationRegVo, AuditAssociationVo, A |
|
|
|
return transaction { |
|
|
|
return transaction { |
|
|
|
val user = User.findById(vo.token.id) ?: throw UserIdError(vo.token.id) |
|
|
|
val user = User.findById(vo.token.id) ?: throw UserIdError(vo.token.id) |
|
|
|
val association = Association.findById(vo.associationId) ?: throw AssociationIdError(vo.associationId) |
|
|
|
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 { |
|
|
|
JoinAssociation.find { JoinAssociations.userId eq vo.token.id and (JoinAssociations.result eq null) } |
|
|
|
|
|
|
|
.firstOrNull().let { |
|
|
|
if (it != null) { |
|
|
|
if (it != null) { |
|
|
|
return@transaction ApplyAssociationResultVo(associationVo = toAssociationVo(it.association)) |
|
|
|
return@transaction ApplyAssociationResultVo(associationVo = toAssociationVo(it.association)) |
|
|
|
} |
|
|
|
} |
|
|
@ -955,7 +971,8 @@ object AssociationService : AuditService<AssociationRegVo, AuditAssociationVo, A |
|
|
|
fun joinAssociation(vo: SearchExamVo): List<JoinAssociationVo> { |
|
|
|
fun joinAssociation(vo: SearchExamVo): List<JoinAssociationVo> { |
|
|
|
return transaction { |
|
|
|
return transaction { |
|
|
|
val association = Association.findById(vo.associationId) ?: throw AssociationIdError(vo.associationId) |
|
|
|
val association = Association.findById(vo.associationId) ?: throw AssociationIdError(vo.associationId) |
|
|
|
JoinAssociation.find { JoinAssociations.associationId eq association.id }.sortedByDescending { it.applyTime }.map { |
|
|
|
JoinAssociation.find { JoinAssociations.associationId eq association.id } |
|
|
|
|
|
|
|
.sortedByDescending { it.applyTime }.map { |
|
|
|
toJoinVo(join = it) |
|
|
|
toJoinVo(join = it) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1015,8 +1032,7 @@ object AssociationService : AuditService<AssociationRegVo, AuditAssociationVo, A |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
vo.questions.forEach { |
|
|
|
vo.questions.forEach { exam -> |
|
|
|
exam-> |
|
|
|
|
|
|
|
exam.questionId.let { |
|
|
|
exam.questionId.let { |
|
|
|
if (it == null) { |
|
|
|
if (it == null) { |
|
|
|
Question.new { |
|
|
|
Question.new { |
|
|
@ -1228,6 +1244,52 @@ object ActivityService : AuditService<ActivityApplyVo, AuditActVo, ActivityCheck |
|
|
|
return testFind(Activities, Activity, auditId) |
|
|
|
return testFind(Activities, Activity, auditId) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun checkTendency(userId:Int, activityId:Int, type:TendencyType): SizedIterable<Tendency> { |
|
|
|
|
|
|
|
val user=User.findById(userId)?:throw UserIdError(userId) |
|
|
|
|
|
|
|
val activity=Activity.findById(activityId)?:throw ActivityIdError(activityId) |
|
|
|
|
|
|
|
return Tendency.find { Tendencies.userId eq user.id and (Tendencies.activityId eq activity.id) and |
|
|
|
|
|
|
|
(Tendencies.type eq type.ordinal) } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun checkTendency(vo: CheckTendencyVo):CheckTendencyResVo{ |
|
|
|
|
|
|
|
return transaction { |
|
|
|
|
|
|
|
val hasLike= checkTendency(userId = vo.token.id,activityId = vo.activityId,type = TendencyType.Like).count()==1L |
|
|
|
|
|
|
|
val hasCollect=checkTendency(userId = vo.token.id,activityId = vo.activityId,type = TendencyType.Collect).count()==1L |
|
|
|
|
|
|
|
CheckTendencyResVo(hasLike=hasLike,hasCollect=hasCollect) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun findTendency(vo:FindTendencyVo):List<ActivityVo>{ |
|
|
|
|
|
|
|
return transaction { |
|
|
|
|
|
|
|
val user=User.findById(vo.token.id)?:throw UserIdError(vo.token.id) |
|
|
|
|
|
|
|
Tendency.find { Tendencies.userId eq user.id and (Tendencies.type eq vo.type.ordinal) }.map { |
|
|
|
|
|
|
|
toActivityVo(activity = it.activity) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 活动倾向 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
fun tendency(vo: TendencyVo) { |
|
|
|
|
|
|
|
transaction { |
|
|
|
|
|
|
|
checkTendency(userId = vo.token.id,activityId = vo.activityId,type = vo.type).apply { |
|
|
|
|
|
|
|
if (count() == 1L) { |
|
|
|
|
|
|
|
first().delete() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Tendency.new { |
|
|
|
|
|
|
|
this.user= User[vo.token.id] |
|
|
|
|
|
|
|
this.activity= Activity[vo.activityId] |
|
|
|
|
|
|
|
this.type=vo.type.ordinal |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查看活动信息 |
|
|
|
* 查看活动信息 |
|
|
|
* |
|
|
|
* |
|
|
|