|
@@ -18,7 +18,8 @@ object CompanyCourtAnnouncement {
|
|
|
val tabMapping: Map[String, (String, String, String, String)] =
|
|
|
Map("ads_company_court_announcement_list" -> ("1", "publish_date", "法律风险", "法院公告"), //法院公告
|
|
|
"ads_company_court_open_announcement_list" -> ("2", "start_date", "法律风险", "开庭公告"), //开庭公告
|
|
|
- "ads_company_court_register_list" -> ("3", "filing_date", "法律风险", "立案信息") //立案信息
|
|
|
+ "ads_company_court_register_list" -> ("3", "filing_date", "法律风险", "立案信息"), //立案信息
|
|
|
+ "ads_company_lawsuit_list" -> ("4", "judge_time", "法律风险", "裁判文书") //裁判文书
|
|
|
)
|
|
|
|
|
|
def main(args: Array[String]): Unit = {
|
|
@@ -61,6 +62,11 @@ case class CompanyCourtAnnouncement(s: SparkSession, sourceTable: String,
|
|
|
def calc(): Unit = {
|
|
|
println(s"company ${this.getClass.getSimpleName} calc start! " + new Date().toString)
|
|
|
|
|
|
+ var sqlapp = ""
|
|
|
+ if (!"4".equals(flag)) {
|
|
|
+ sqlapp = s"and $time >= '${BaseUtil.atMonthsBefore(3)}'"
|
|
|
+ }
|
|
|
+
|
|
|
val df = sql(
|
|
|
s"""
|
|
|
|SELECT *
|
|
@@ -71,14 +77,14 @@ case class CompanyCourtAnnouncement(s: SparkSession, sourceTable: String,
|
|
|
| ,row_number() OVER(PARTITION BY new_cid ORDER BY $time DESC) AS num
|
|
|
| FROM $sourceTable
|
|
|
| WHERE ds = '${BaseUtil.getPartion(sourceTable, spark)}' and new_cid is not null
|
|
|
- | and $time >= '${BaseUtil.atMonthsBefore(3)}'
|
|
|
+ | ${sqlapp}
|
|
|
| ) a
|
|
|
|WHERE num = 1
|
|
|
|""".stripMargin)
|
|
|
|
|
|
df.map(r => {
|
|
|
trans(r, flag, kind, project)
|
|
|
- }).toDF("id", "cid", "name", "kind", "kind_code", "project", "project_code", "type",
|
|
|
+ }).toDF("id", "cid", "kind", "kind_code", "project", "project_code", "type",
|
|
|
"score", "total", "extraScore")
|
|
|
.createOrReplaceTempView(s"${sourceTable}_tmp_view")
|
|
|
|
|
@@ -98,18 +104,18 @@ case class CompanyCourtAnnouncement(s: SparkSession, sourceTable: String,
|
|
|
def trans(r: Row, flag: String, kind: String, prpject: String) = {
|
|
|
val id = r.getAs[Long]("id")
|
|
|
val cid = r.getAs[Long]("new_cid").toString
|
|
|
- val name = r.getAs[String]("new_cname")
|
|
|
val cnt1 = r.getAs[Long]("cnt1")
|
|
|
val cnt2 = r.getAs[Long]("cnt2")
|
|
|
flag match {
|
|
|
- case "1" => getInfoAnnouncement(id, cid, name, cnt1, cnt2, kind, prpject)
|
|
|
- case "2" => getInfoOpenAnnouncement(id, cid, name, cnt1, cnt2, kind, prpject)
|
|
|
- case "3" => getInforegister(id, cid, name, cnt1, cnt2, kind, prpject)
|
|
|
+ case "1" => getInfoAnnouncement(id, cid, cnt1, cnt2, kind, prpject)
|
|
|
+ case "2" => getInfoOpenAnnouncement(id, cid, cnt1, cnt2, kind, prpject)
|
|
|
+ case "3" => getInforegister(id, cid, cnt1, cnt2, kind, prpject)
|
|
|
+ case "4" => getRefereeScore(id, cid, cnt1, cnt2, kind, prpject)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//法院公告
|
|
|
- def getInfoAnnouncement(id: Long, cid: String, name: String, cnt1: Long, cnt2: Long, kind: String, project: String) = {
|
|
|
+ def getInfoAnnouncement(id: Long, cid: String, cnt1: Long, cnt2: Long, kind: String, project: String) = {
|
|
|
var score = 0f
|
|
|
val total = 5f
|
|
|
val extraScore = 0f
|
|
@@ -127,12 +133,12 @@ case class CompanyCourtAnnouncement(s: SparkSession, sourceTable: String,
|
|
|
score = 0f
|
|
|
ty = "近3个月有法院公告,作为被告人/被告/被上诉人/被申请人的数量大于作为公诉人/原告/上诉人/申请人的数量"
|
|
|
}
|
|
|
- (id, cid, name, kind, DimScoreV2.newsEventMap.get(kind), project, DimScoreV2.newsEventMap.get(project), ty,
|
|
|
+ (id, cid, kind, DimScoreV2.newsEventMap.get(kind), project, DimScoreV2.newsEventMap.get(project), ty,
|
|
|
score, total, extraScore)
|
|
|
}
|
|
|
|
|
|
//开庭公告
|
|
|
- def getInfoOpenAnnouncement(id: Long, cid: String, name: String, cnt1: Long, cnt2: Long, kind: String, project: String) = {
|
|
|
+ def getInfoOpenAnnouncement(id: Long, cid: String, cnt1: Long, cnt2: Long, kind: String, project: String) = {
|
|
|
var score = 0f
|
|
|
val total = 5f
|
|
|
val extraScore = 0f
|
|
@@ -150,12 +156,12 @@ case class CompanyCourtAnnouncement(s: SparkSession, sourceTable: String,
|
|
|
score = 0f
|
|
|
ty = "近3个月有开庭公告,作为被告的数量大于作为原告的数量"
|
|
|
}
|
|
|
- (id, cid, name, kind, DimScoreV2.newsEventMap.get(kind), project, DimScoreV2.newsEventMap.get(project), ty,
|
|
|
+ (id, cid, kind, DimScoreV2.newsEventMap.get(kind), project, DimScoreV2.newsEventMap.get(project), ty,
|
|
|
score, total, extraScore)
|
|
|
}
|
|
|
|
|
|
//立案信息
|
|
|
- def getInforegister(id: Long, cid: String, name: String, cnt1: Long, cnt2: Long, kind: String, project: String) = {
|
|
|
+ def getInforegister(id: Long, cid: String, cnt1: Long, cnt2: Long, kind: String, project: String) = {
|
|
|
var score = 0f
|
|
|
val total = 5f
|
|
|
val extraScore = 0f
|
|
@@ -173,7 +179,33 @@ case class CompanyCourtAnnouncement(s: SparkSession, sourceTable: String,
|
|
|
score = 0f
|
|
|
ty = "近3个月有立案信息,作为被告人/被告/被上诉人/被申请人的数量大于作为公诉人/原告/上诉人/申请人的数量"
|
|
|
}
|
|
|
- (id, cid, name, kind, DimScoreV2.newsEventMap.get(kind), project, DimScoreV2.newsEventMap.get(project), ty,
|
|
|
+ (id, cid, kind, DimScoreV2.newsEventMap.get(kind), project, DimScoreV2.newsEventMap.get(project), ty,
|
|
|
+ score, total, extraScore)
|
|
|
+ }
|
|
|
+
|
|
|
+ //裁判文书
|
|
|
+ def getRefereeScore(id: Long, cid: String, cnt1: Long, cnt2: Long, kind: String, project: String) = {
|
|
|
+ var score = 0f
|
|
|
+ val total = 8f
|
|
|
+ val extraScore = 0f
|
|
|
+ var ty = ""
|
|
|
+ if (cnt1 == 0 && cnt2 == 0) {
|
|
|
+ score = 8f
|
|
|
+ ty = "无涉诉情况"
|
|
|
+ } else if (cnt1 > 0 && cnt2 == 0) {
|
|
|
+ score = 8f
|
|
|
+ ty = "有涉诉情况,均为原告"
|
|
|
+ } else if (cnt1 == 0 && cnt2 > 0) {
|
|
|
+ score = 0f
|
|
|
+ ty = "有涉诉情况,均为被告"
|
|
|
+ } else if (cnt1 > cnt2) {
|
|
|
+ score = 5f
|
|
|
+ ty = "有涉诉情况,作为原告的案件数量大于作为被告的案件数量"
|
|
|
+ } else if (cnt1 <= cnt2) {
|
|
|
+ score = 0f
|
|
|
+ ty = "有涉诉情况,作为被告的案件数量大于作为原告的案件数量"
|
|
|
+ }
|
|
|
+ (id, cid, kind, DimScoreV2.newsEventMap.get(kind), project, DimScoreV2.newsEventMap.get(project), ty,
|
|
|
score, total, extraScore)
|
|
|
}
|
|
|
}
|