Commit 41bdc245 authored by 赵威's avatar 赵威

update id type

parent 757e8c9f
package com.gmei.up.utils
case class Content(id: Long, index: String, serviceId: Option[Long], projects: String)
case class Content(id: Long, index: String, serviceId: Option[String], projects: String)
......@@ -57,7 +57,7 @@ object ES {
implicit object ContentHitReader extends HitReader[Content] {
override def read(hit: Hit): Try[Content] = {
val source = hit.sourceAsMap
val serviceId = source.getOrElse("service", Map[String, Long]()).asInstanceOf[Map[String, Long]].get("id")
val serviceId = source.getOrElse("service", Map[String, String]()).asInstanceOf[Map[String, String]].get("id")
Try(
Content(source("id").toString.toLong, hit.index, serviceId, source("tags_v3").toString)
)
......
......@@ -71,10 +71,11 @@ object Redis {
case Right(contentFuture) =>
pRc4.withClient { client =>
contentFuture.foreach { seq =>
val idPaids = seq.map(c => (c.id, c.serviceId.getOrElse(-1L)))
if (idPaids.size > 0) {
val idPairs = seq.map(c => (c.id, c.serviceId.getOrElse("-1")))
println(idPairs)
if (idPairs.size > 0) {
client.del(key)
idPaids.foreach { pair =>
idPairs.foreach { pair =>
client.rpush(key, pair)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment