|
|
@ -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 { |
|
|
|
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() |
|
|
|
val token = UserToken.find { UserTokens.userId eq matchUser.id }.firstOrNull() |
|
|
|
?: throw IllegalArgumentException("无法根据[userId=${matchUser.id}]找到token") |
|
|
|
?: throw IllegalArgumentException("无法根据[userId=${matchUser.id}]找到token") |
|
|
|
val associationMember = |
|
|
|
tokenRes(token=token,matchUser = matchUser) |
|
|
|
AssociationMember.find { AssociationMembers.userId eq matchUser.id }.firstOrNull() |
|
|
|
} |
|
|
|
UserVo( |
|
|
|
ClientType.Background->{ |
|
|
|
studentId = matchUser.studentId, token = |
|
|
|
val matchManager = Manager.findById(vo.token.id)?:throw ManagerIdError(vo.token.id) |
|
|
|
Token( |
|
|
|
matchManager.apply { |
|
|
|
id = matchUser.id.value, token = token.token, |
|
|
|
vo.name?.let { |
|
|
|
createTime = token.createTime.toLong() |
|
|
|
matchManager.name=it |
|
|
|
), name = matchUser.name, |
|
|
|
} |
|
|
|
headImg = matchUser.headImg?.filepath, |
|
|
|
vo.desc?.let { |
|
|
|
desc = matchUser.desc, |
|
|
|
matchManager.desc=it |
|
|
|
associationVo = associationMember?.let { AssociationService.toAssociationVo(it.association) }, |
|
|
|
} |
|
|
|
isHead = associationMember?.isHead |
|
|
|
} |
|
|
|
) |
|
|
|
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? { |
|
|
|
fun read(vo: OnlyToken, table: IntIdTable): F? { |
|
|
|
return transaction { |
|
|
|
return transaction { |
|
|
|
if (isFilter) { |
|
|
|
if (isFilter) { |
|
|
|
val nextAudit = AuditLeggings.alias("nextAudit") |
|
|
|
// val nextAudit = AuditLeggings.alias("nextAudit") |
|
|
|
table.innerJoin(AuditLeggings) |
|
|
|
val c=table.innerJoin(AuditLeggings) |
|
|
|
.innerJoin(nextAudit, { AuditLeggings.nextAudit }, { nextAudit[AuditLeggings.id] }) |
|
|
|
// .innerJoin(nextAudit, { AuditLeggings.nextAudit }, { nextAudit[AuditLeggings.id] }) |
|
|
|
.innerJoin(Users) |
|
|
|
.innerJoin(Users) |
|
|
|
.slice(listOf(table.id)) |
|
|
|
.slice(listOf(table.id,AuditLeggings.result,AuditLeggings.nextAudit)) |
|
|
|
.select { Users.id eq vo.token.id and (nextAudit[AuditLeggings.result] neq true) } |
|
|
|
.select { Users.id eq vo.token.id} |
|
|
|
.firstOrNull() |
|
|
|
.filter { |
|
|
|
?.let { it -> |
|
|
|
log.info("it[AuditLeggings.result]=${it[AuditLeggings.result]},it[AuditLeggings.nextAudit]=${it[AuditLeggings.nextAudit]}") |
|
|
|
getCheckVo(id = it[table.id]) |
|
|
|
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 { |
|
|
|
} else { |
|
|
|
table.innerJoin(AuditLeggings).innerJoin(Users) |
|
|
|
table.innerJoin(AuditLeggings).innerJoin(Users) |
|
|
|
.slice(listOf(table.id)) |
|
|
|
.slice(listOf(table.id)) |
|
|
|