|
|
|
@ -156,24 +156,52 @@ object AccountService : AbstractService() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun refreshInfo(_token: OnlyToken): UserVo { |
|
|
|
|
fun uploadHeadImg(data: List<PartData>){ |
|
|
|
|
val userId=data.getFormParam("id").toInt() |
|
|
|
|
transaction { |
|
|
|
|
val fileIds =FileService.storeFile(data) |
|
|
|
|
if(fileIds?.isNotEmpty()==true){ |
|
|
|
|
val fileId=fileIds.first() |
|
|
|
|
val user=User.findById(userId)?:throw UserIdError(userId) |
|
|
|
|
user.apply { |
|
|
|
|
headImg=ImageFile.findById(fileId)?:throw FileIdError(fileId) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun refreshInfo(vo: InfoUpdateVo): PersonInfoVo { |
|
|
|
|
return transaction { |
|
|
|
|
val matchUser = User.findById(_token.token.id) ?: throw UserIdError(_token.token.id) |
|
|
|
|
when(vo.clientType){ |
|
|
|
|
ClientType.Foreground->{ |
|
|
|
|
val matchUser = User.findById(vo.token.id) ?: throw UserIdError(vo.token.id) |
|
|
|
|
matchUser.apply { |
|
|
|
|
vo.name?.let { |
|
|
|
|
matchUser.name=it |
|
|
|
|
} |
|
|
|
|
vo.desc?.let { |
|
|
|
|
matchUser.desc=it |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
val token = UserToken.find { UserTokens.userId eq matchUser.id }.firstOrNull() |
|
|
|
|
?: throw IllegalArgumentException("无法根据[userId=${matchUser.id}]找到token") |
|
|
|
|
val associationMember = |
|
|
|
|
AssociationMember.find { AssociationMembers.userId eq matchUser.id }.firstOrNull() |
|
|
|
|
UserVo( |
|
|
|
|
studentId = matchUser.studentId, token = |
|
|
|
|
Token( |
|
|
|
|
id = matchUser.id.value, token = token.token, |
|
|
|
|
createTime = token.createTime.toLong() |
|
|
|
|
), name = matchUser.name, |
|
|
|
|
headImg = matchUser.headImg?.filepath, |
|
|
|
|
desc = matchUser.desc, |
|
|
|
|
associationVo = associationMember?.let { AssociationService.toAssociationVo(it.association) }, |
|
|
|
|
isHead = associationMember?.isHead |
|
|
|
|
) |
|
|
|
|
tokenRes(token=token,matchUser = matchUser) |
|
|
|
|
} |
|
|
|
|
ClientType.Background->{ |
|
|
|
|
val matchManager = Manager.findById(vo.token.id)?:throw ManagerIdError(vo.token.id) |
|
|
|
|
matchManager.apply { |
|
|
|
|
vo.name?.let { |
|
|
|
|
matchManager.name=it |
|
|
|
|
} |
|
|
|
|
vo.desc?.let { |
|
|
|
|
matchManager.desc=it |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
val token=ManagerToken.find { ManagerTokens.managerId eq matchManager.id }.firstOrNull() |
|
|
|
|
?: throw IllegalArgumentException("无法根据[matchId=${matchManager.id}]找到token") |
|
|
|
|
tokenRes(token=token,matchManager=matchManager) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -629,17 +657,22 @@ abstract class AuditService<T, E, F> : AbstractService() { |
|
|
|
|
fun read(vo: OnlyToken, table: IntIdTable): F? { |
|
|
|
|
return transaction { |
|
|
|
|
if (isFilter) { |
|
|
|
|
val nextAudit = AuditLeggings.alias("nextAudit") |
|
|
|
|
table.innerJoin(AuditLeggings) |
|
|
|
|
.innerJoin(nextAudit, { AuditLeggings.nextAudit }, { nextAudit[AuditLeggings.id] }) |
|
|
|
|
// val nextAudit = AuditLeggings.alias("nextAudit") |
|
|
|
|
val c=table.innerJoin(AuditLeggings) |
|
|
|
|
// .innerJoin(nextAudit, { AuditLeggings.nextAudit }, { nextAudit[AuditLeggings.id] }) |
|
|
|
|
.innerJoin(Users) |
|
|
|
|
.slice(listOf(table.id)) |
|
|
|
|
.select { Users.id eq vo.token.id and (nextAudit[AuditLeggings.result] neq true) } |
|
|
|
|
.firstOrNull() |
|
|
|
|
?.let { it -> |
|
|
|
|
getCheckVo(id = it[table.id]) |
|
|
|
|
.slice(listOf(table.id,AuditLeggings.result,AuditLeggings.nextAudit)) |
|
|
|
|
.select { Users.id eq vo.token.id} |
|
|
|
|
.filter { |
|
|
|
|
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 |
|
|
|
|
} |
|
|
|
|
log.info("size:${c.size}") |
|
|
|
|
if(c.size==1){ |
|
|
|
|
getCheckVo(c.first()[table.id]) |
|
|
|
|
}else{ |
|
|
|
|
null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
table.innerJoin(AuditLeggings).innerJoin(Users) |
|
|
|
|
.slice(listOf(table.id)) |
|
|
|
|