Compare commits
4 Commits
f2dc547739
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| d876caa507 | |||
| 4d79d9a1ee | |||
| 01e6f2437f | |||
| e7a77004c5 |
@@ -26,13 +26,6 @@ configurations {
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = uri("http://localhost:3105/threepartrepo")
|
||||
isAllowInsecureProtocol = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.lanyuanxiaoyao:squirrel-core-jvm:1.0.0-SNAPSHOT") {
|
||||
exclude("commons-logging", "commons-logging")
|
||||
|
||||
@@ -1 +1,26 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven {
|
||||
url = uri("https://maven.lanyuanxiaoyao.com/central")
|
||||
credentials {
|
||||
username = "lanyuanxiaoyao"
|
||||
password = "cL9AFT6VkNlrK8TyYI43RSW8OhtTYzg6GPc1bXzBmnsXeU9T/X6S0q//K5TDZF1g"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
maven {
|
||||
url = uri("https://maven.lanyuanxiaoyao.com/central")
|
||||
credentials {
|
||||
username = "lanyuanxiaoyao"
|
||||
password = "cL9AFT6VkNlrK8TyYI43RSW8OhtTYzg6GPc1bXzBmnsXeU9T/X6S0q//K5TDZF1g"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "digital-market"
|
||||
|
||||
@@ -27,7 +27,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
|
||||
|
||||
@ConfigurationProperties(prefix = "messenger.database")
|
||||
data class DatabaseProperties @ConstructorBinding constructor(
|
||||
val h2Path: String,
|
||||
val jsonPath: String,
|
||||
)
|
||||
|
||||
@@ -90,7 +89,6 @@ class Configuration {
|
||||
).also { management ->
|
||||
logger.info("Loaded driver path: {}", driverProperties.driverPath)
|
||||
logger.info("Loaded binary path: {}", driverProperties.binaryPath)
|
||||
logger.info("Loaded database path: {}", databaseProperties.h2Path)
|
||||
logger.info("Loaded database path: {}", databaseProperties.jsonPath)
|
||||
management
|
||||
.fetchConfiguration()
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.lanyuanxiaoyao.digtal.market
|
||||
|
||||
import com.blinkfox.fenix.jpa.FenixJpaRepository
|
||||
import com.blinkfox.fenix.specification.FenixJpaSpecificationExecutor
|
||||
import jakarta.persistence.Entity
|
||||
import jakarta.persistence.Id
|
||||
import jakarta.persistence.Lob
|
||||
import java.util.Date
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.data.jpa.repository.Modifying
|
||||
import org.springframework.data.jpa.repository.Query
|
||||
import org.springframework.data.repository.query.Param
|
||||
@@ -27,10 +27,15 @@ class Article(
|
||||
var tags: String?,
|
||||
var createTime: Date?,
|
||||
var pushed: Boolean?,
|
||||
)
|
||||
var error: Int?,
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return "Article(id='$id', code='$code', url='$url', title=$title, author=$author, category=$category, text=$text, html=$html, subtitle=$subtitle, description=$description, tags=$tags, createTime=$createTime, pushed=$pushed, error=$error)"
|
||||
}
|
||||
}
|
||||
|
||||
@Repository
|
||||
interface ArticleRepository : JpaRepository<Article, String>, FenixJpaSpecificationExecutor<Article> {
|
||||
interface ArticleRepository : FenixJpaRepository<Article, String>, FenixJpaSpecificationExecutor<Article> {
|
||||
fun findAllByDescriptionIsNullAndTextIsNotNull(): List<Article>
|
||||
fun findAllByHtmlIsNotNull(): List<Article>
|
||||
|
||||
@@ -47,11 +52,14 @@ interface ArticleRepository : JpaRepository<Article, String>, FenixJpaSpecificat
|
||||
@Query("update Article article set article.pushed = :pushed where article.id = :id")
|
||||
fun updatePushedById(@Param("id") id: String, @Param("pushed") pushed: Boolean)
|
||||
|
||||
@Query("select article.id from Article article where article.description is not null and article.text is not null and article.text <> ''")
|
||||
@Query("select article.id from Article article where (article.error is not null and article.error > 3) or (article.description is not null and article.text is not null and article.text <> '')")
|
||||
fun findAllId(): List<String>
|
||||
|
||||
@Query("select new com.lanyuanxiaoyao.digtal.market.CountGroupByString(article.code, count(article.code)) from Article article group by article.code")
|
||||
fun countGroupByCode(): List<CountGroupByString>
|
||||
|
||||
@Query("select article.error from Article article where article.id = :id")
|
||||
fun findErrorById(@Param("id") id: String): Int?
|
||||
}
|
||||
|
||||
data class CountGroupByString(
|
||||
|
||||
@@ -148,6 +148,7 @@ fun parseArticle(management: Management, code: String, url: String, hash: String
|
||||
tags = null,
|
||||
createTime = createTime,
|
||||
pushed = false,
|
||||
error = null,
|
||||
)
|
||||
} ?: return null
|
||||
}
|
||||
@@ -87,6 +87,11 @@ class NewsRunner : Runner {
|
||||
article.subtitle = triple?.subtitle
|
||||
article.description = triple?.description
|
||||
article.tags = triple?.tags
|
||||
|
||||
if (triple == null) {
|
||||
val error = articleRepository.findErrorById(link.hash)
|
||||
article.error = error?.plus(1) ?: 1
|
||||
}
|
||||
}
|
||||
|
||||
article.category = keyword
|
||||
|
||||
@@ -14,7 +14,7 @@ spring:
|
||||
ssl:
|
||||
enable: true
|
||||
datasource:
|
||||
url: jdbc:mysql://frp-air.top:43458/digital_market
|
||||
url: jdbc:mysql://mysql.lanyuanxiaoyao.com:43780/digital_market
|
||||
username: digital_market
|
||||
password: diXe7hS7yETHJGGz
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
@@ -42,7 +42,6 @@ messenger:
|
||||
driver-path: /Users/lanyuanxiaoyao/Downloads/chromium/128/macOS-1289987/chromedriver
|
||||
binary-path: /Users/lanyuanxiaoyao/Downloads/chromium/128/macOS-1289987/Chromium.app/Contents/MacOS/Chromium
|
||||
database:
|
||||
h2-path: ./database/database.db
|
||||
json-path: ./database/database.json
|
||||
fenix:
|
||||
print-banner: false
|
||||
|
||||
Reference in New Issue
Block a user