diff --git a/DockerFile b/DockerFile
index f01ee85..f8087ac 100644
--- a/DockerFile
+++ b/DockerFile
@@ -1,4 +1,4 @@
-FROM openjdk:8-jre
+FROM openjdk:8-alpine
LABEL name="hoperun-custom-sign"
MAINTAINER li@2ha.me
WORKDIR /
diff --git a/pom.xml b/pom.xml
index be3be00..c3c975d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
UTF-8
official
1.8
- 2.0.20
+ 2.2.0
@@ -44,26 +44,6 @@
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- compile
- compile
-
- compile
-
-
-
- testCompile
- test-compile
-
- testCompile
-
-
-
-
org.jetbrains.kotlin
@@ -89,6 +69,34 @@
1.8
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ compile
+ compile
+
+ compile
+
+
+
+ testCompile
+ test-compile
+
+ testCompile
+
+
+
+ default-compile
+ none
+
+
+ default-testCompile
+ none
+
+
+
@@ -123,6 +131,17 @@
jsoup
1.15.3
+
+ org.jetbrains.kotlin
+ kotlin-stdlib-jdk8
+ ${kotlin.version}
+
+
+ org.jetbrains.kotlin
+ kotlin-test
+ ${kotlin.version}
+ test
+
diff --git a/settings.xml b/settings.xml
index 75e7680..8d6958f 100644
--- a/settings.xml
+++ b/settings.xml
@@ -131,6 +131,11 @@ under the License.
optional; leave empty if not used.
-->
+
+ mirror-all
+ jimlee
+ wysnih-dybbyQ-0rigti
+
2ha
jimlee
@@ -176,7 +181,7 @@ under the License.
mirror-all
*
2ha mirror
- https://2ha.me:18082/repository/maven-public/
+ https://maven.2ha.me/repository/maven-public/
@@ -272,7 +277,7 @@ under the License.
2ha
2ha.me nexus private
- https://2ha.me:18082/repository/maven-public/
+ https://maven.2ha.me/repository/maven-public/
true
@@ -284,12 +289,12 @@ under the License.
maven-releases
Nexus Release Repository
- https://2ha.me:18082/repository/private/
+ https://maven.2ha.me/repository/private/
maven-snapshots
Nexus Snapshot Repository
- https://2ha.me:18082/repository/private/
+ https://maven.2ha.me/repository/private/
diff --git a/src/main/kotlin/com/pomelotea/hoperun/sign/api/model/ScNotifyRequest.kt b/src/main/kotlin/com/pomelotea/hoperun/sign/api/model/ScNotifyRequest.kt
new file mode 100644
index 0000000..d216337
--- /dev/null
+++ b/src/main/kotlin/com/pomelotea/hoperun/sign/api/model/ScNotifyRequest.kt
@@ -0,0 +1,14 @@
+package com.pomelotea.hoperun.sign.api.model
+
+data class ScNotifyRequest(
+ val title: String,
+ val desp: String?,
+ val tags: String?,
+ val short: String?
+)
+
+data class ScNotifyResponse(
+ val code: Int,
+ val message: String,
+ val data: String?
+)
\ No newline at end of file
diff --git a/src/main/kotlin/com/pomelotea/hoperun/sign/scheduler/AutoDakaScheduler.kt b/src/main/kotlin/com/pomelotea/hoperun/sign/scheduler/AutoDakaScheduler.kt
index a631738..4b57070 100644
--- a/src/main/kotlin/com/pomelotea/hoperun/sign/scheduler/AutoDakaScheduler.kt
+++ b/src/main/kotlin/com/pomelotea/hoperun/sign/scheduler/AutoDakaScheduler.kt
@@ -1,9 +1,15 @@
package com.pomelotea.hoperun.sign.scheduler
+import com.alibaba.fastjson.JSON
+import com.alibaba.fastjson.JSONObject
import com.pomelotea.hoperun.sign.api.DakaResponse
+import com.pomelotea.hoperun.sign.api.model.ScNotifyResponse
import com.pomelotea.hoperun.sign.common.*
import com.pomelotea.hoperun.sign.config.HoperunUserConfig
import com.pomelotea.hoperun.sign.config.UserConfig
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.Request
+import okhttp3.RequestBody.Companion.toRequestBody
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.time.LocalDateTime
@@ -45,6 +51,34 @@ class AutoDakaScheduler {
if (daka == null) {
daka = generateDakaInfo(v, dakaDate)
dakaQueue.add(daka)
+ val notifyRequest = Request.Builder()
+ .url("https://7248.push.ft07.com/send/sctp7248ta-yehg0lpo6cr9xl6ikqwbpn4l.send")
+ .post(
+ JSON.toJSONString(
+ mapOf(
+ "title" to "添加打卡任务:${v.username}, $daka",
+ "desp" to "添加打卡任务:${v.username}, $daka"
+ )
+ ).toRequestBody("application/json;charset=utf-8".toMediaTypeOrNull())
+ )
+ .build()
+ val result: String? = client.newCall(notifyRequest).execute().body?.string()
+ val resp = JSONObject.parseObject(result, ScNotifyResponse::class.java)
+ if (resp.code != 0) {
+ val notifyRequest = Request.Builder()
+ .url("https://7248.push.ft07.com/send/sctp7248ta-yehg0lpo6cr9xl6ikqwbpn4l.send")
+ .post(
+ JSON.toJSONString(
+ mapOf(
+ "title" to "添加打卡任务失败:${v.username}, $daka",
+ "desp" to "添加打卡任务失败:${v.username}, $daka"
+ )
+ ).toRequestBody("application/json;charset=utf-8".toMediaTypeOrNull())
+ )
+ .build()
+ val result: String? = client.newCall(notifyRequest).execute().body?.string()
+ logger.info(result)
+ }
logger.info("添加打卡任务: ${v.username}, $daka")
}
}
@@ -96,7 +130,33 @@ class AutoDakaScheduler {
beginTime(employeeNo = daka.employeeNo, date = daka.dakaDate, time = daka.beginTime)
if (resp.result != "success") {
logger.error("打上班卡失败")
+ val notifyRequest = Request.Builder()
+ .url("https://7248.push.ft07.com/send/sctp7248ta-yehg0lpo6cr9xl6ikqwbpn4l.send")
+ .post(
+ JSON.toJSONString(
+ mapOf(
+ "title" to "打上班卡失败:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.beginTime}",
+ "desp" to "打上班卡失败:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.beginTime}"
+ )
+ ).toRequestBody("application/json;charset=utf-8".toMediaTypeOrNull())
+ )
+ .build()
+ val result: String? = client.newCall(notifyRequest).execute().body?.string()
+ logger.info(result)
} else {
+ val notifyRequest = Request.Builder()
+ .url("https://7248.push.ft07.com/send/sctp7248ta-yehg0lpo6cr9xl6ikqwbpn4l.send")
+ .post(
+ JSON.toJSONString(
+ mapOf(
+ "title" to "打上班卡成功:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.beginTime}",
+ "desp" to "打上班卡成功:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.beginTime}"
+ )
+ ).toRequestBody("application/json;charset=utf-8".toMediaTypeOrNull())
+ )
+ .build()
+ val result: String? = client.newCall(notifyRequest).execute().body?.string()
+ logger.info(result)
logger.info("打上班卡成功")
}
} catch (e: Exception) {
@@ -116,7 +176,33 @@ class AutoDakaScheduler {
val resp: DakaResponse = endTime(employeeNo = daka.employeeNo, date = daka.dakaDate, time = daka.endTime)
if (resp.result != "success") {
logger.error("打下班卡失败")
+ val notifyRequest = Request.Builder()
+ .url("https://7248.push.ft07.com/send/sctp7248ta-yehg0lpo6cr9xl6ikqwbpn4l.send")
+ .post(
+ JSON.toJSONString(
+ mapOf(
+ "title" to "打下班卡失败:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.beginTime}",
+ "desp" to "打下班卡失败:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.beginTime}"
+ )
+ ).toRequestBody("application/json;charset=utf-8".toMediaTypeOrNull())
+ )
+ .build()
+ val result: String? = client.newCall(notifyRequest).execute().body?.string()
+ logger.info(result)
} else {
+ val notifyRequest = Request.Builder()
+ .url("https://7248.push.ft07.com/send/sctp7248ta-yehg0lpo6cr9xl6ikqwbpn4l.send")
+ .post(
+ JSON.toJSONString(
+ mapOf(
+ "title" to "打下班卡成功:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.beginTime}",
+ "desp" to "打下班卡成功:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.beginTime}"
+ )
+ ).toRequestBody("application/json;charset=utf-8".toMediaTypeOrNull())
+ )
+ .build()
+ val result: String? = client.newCall(notifyRequest).execute().body?.string()
+ logger.info(result)
logger.info("打下班卡成功")
}
} catch (e: Exception) {