Compare commits
16 Commits
dev-202401
...
dev-2025
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4de454f9f0 | ||
| 4845094577 | |||
|
|
1de86a2f46 | ||
|
|
7f7a1c059b | ||
| 4c658628be | |||
| e0a34dbb9c | |||
| 45cd64b284 | |||
| 9cf8e0a47f | |||
| 49e4b473c6 | |||
| 1a06ab6807 | |||
| 615eec3b7a | |||
| fdc23e4326 | |||
| 0c0cb8607e | |||
| 7a2506ff98 | |||
| b782e398fd | |||
| f789b3b255 |
110
DINGTALK_SETUP.md
Normal file
110
DINGTALK_SETUP.md
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
# 钉钉通知集成说明
|
||||||
|
|
||||||
|
## 功能概述
|
||||||
|
|
||||||
|
本项目已成功集成钉钉机器人通知功能,与现有的 ServerChan3 通知系统并存,提供多渠道消息通知能力。
|
||||||
|
|
||||||
|
## 新增文件
|
||||||
|
|
||||||
|
### 1. 配置类
|
||||||
|
- `src/main/kotlin/com/pomelotea/hoperun/sign/config/DingTalkConfig.kt` - 钉钉配置类
|
||||||
|
|
||||||
|
### 2. 数据模型
|
||||||
|
- `src/main/kotlin/com/pomelotea/hoperun/sign/api/model/DingTalkNotifyRequest.kt` - 钉钉消息请求/响应模型
|
||||||
|
|
||||||
|
### 3. 通知助手
|
||||||
|
- `src/main/kotlin/com/pomelotea/hoperun/sign/notify/DingTalkNotifyHelper.kt` - 钉钉通知助手类
|
||||||
|
|
||||||
|
### 4. 统一通知服务
|
||||||
|
- `src/main/kotlin/com/pomelotea/hoperun/sign/service/NotificationService.kt` - 统一管理多种通知方式
|
||||||
|
|
||||||
|
## 配置说明
|
||||||
|
|
||||||
|
### application-dev.yml 配置
|
||||||
|
```yaml
|
||||||
|
dingtalk:
|
||||||
|
enabled: false # 是否启用钉钉通知
|
||||||
|
webhook: https://oapi.dingtalk.com/robot/send?access_token=YOUR_ACCESS_TOKEN
|
||||||
|
secret: YOUR_SECRET # 钉钉机器人密钥(可选)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 获取钉钉机器人信息
|
||||||
|
|
||||||
|
1. 在钉钉群中添加"自定义机器人"
|
||||||
|
2. 安全设置选择"加签",获取密钥
|
||||||
|
3. 获取 Webhook 地址
|
||||||
|
4. 将配置信息填入 `application-dev.yml`
|
||||||
|
|
||||||
|
## API 接口
|
||||||
|
|
||||||
|
### 测试接口
|
||||||
|
- `GET /api/daka/test/dingtalk` - 测试钉钉通知
|
||||||
|
- `GET /api/daka/test/serverchan` - 测试ServerChan3通知
|
||||||
|
- `GET /api/daka/test/all` - 测试所有通知方式
|
||||||
|
|
||||||
|
### 使用示例
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 测试钉钉通知
|
||||||
|
curl http://localhost:8982/api/daka/test/dingtalk
|
||||||
|
|
||||||
|
# 测试ServerChan3通知
|
||||||
|
curl http://localhost:8982/api/daka/test/serverchan
|
||||||
|
|
||||||
|
# 测试所有通知
|
||||||
|
curl http://localhost:8982/api/daka/test/all
|
||||||
|
```
|
||||||
|
|
||||||
|
## 编程接口
|
||||||
|
|
||||||
|
### NotificationService 使用
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
@Autowired
|
||||||
|
private lateinit var notificationService: NotificationService
|
||||||
|
|
||||||
|
// 发送所有类型的通知
|
||||||
|
notificationService.sendAllNotifications("标题", "内容")
|
||||||
|
|
||||||
|
// 只发送钉钉通知
|
||||||
|
val response = notificationService.sendDingTalkNotification("标题", "内容")
|
||||||
|
|
||||||
|
// 只发送ServerChan3通知
|
||||||
|
val response = notificationService.sendServerChanNotification("标题", "内容")
|
||||||
|
|
||||||
|
// 发送钉钉文本消息
|
||||||
|
val response = notificationService.sendDingTalkText("纯文本消息")
|
||||||
|
|
||||||
|
// 发送钉钉Markdown消息
|
||||||
|
val response = notificationService.sendDingTalkMarkdown("标题", "**Markdown** 内容")
|
||||||
|
```
|
||||||
|
|
||||||
|
## 功能特性
|
||||||
|
|
||||||
|
### 消息类型支持
|
||||||
|
- **文本消息**: 简单文本内容
|
||||||
|
- **Markdown消息**: 支持丰富的格式化内容
|
||||||
|
|
||||||
|
### 安全特性
|
||||||
|
- 支持钉钉机器人加签验证
|
||||||
|
- 自动URL签名生成
|
||||||
|
- 错误处理和日志记录
|
||||||
|
|
||||||
|
### 智能切换
|
||||||
|
- 自动检测配置有效性
|
||||||
|
- 支持同时启用多种通知方式
|
||||||
|
- 配置错误时自动跳过对应通知
|
||||||
|
|
||||||
|
## 使用建议
|
||||||
|
|
||||||
|
1. **开发测试**: 先使用测试接口验证配置正确性
|
||||||
|
2. **生产部署**: 确保 `enabled: true` 并填入正确的 webhook 和 secret
|
||||||
|
3. **消息格式**: 建议使用 Markdown 格式,支持更丰富的展示效果
|
||||||
|
4. **监控日志**: 关注应用日志,及时发现通知发送问题
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
1. 确保钉钉机器人在群中有发送消息权限
|
||||||
|
2. Webhook 地址不要泄露到公开仓库
|
||||||
|
3. 消息发送频率不要超过钉钉限制(通常每分钟最多20条)
|
||||||
|
4. 建议在生产环境中配置错误重试机制
|
||||||
8
DockerFile
Normal file
8
DockerFile
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
FROM openjdk:8u212-jre-alpine
|
||||||
|
LABEL name="hoperun-custom-sign"
|
||||||
|
MAINTAINER li@2ha.me
|
||||||
|
WORKDIR /
|
||||||
|
ADD target/hoperun-sign-1.0-SNAPSHOT.jar app.jar
|
||||||
|
EXPOSE 8982
|
||||||
|
ENTRYPOINT ["java", "-jar"]
|
||||||
|
CMD ["app.jar"]
|
||||||
64
pom.xml
64
pom.xml
@@ -21,7 +21,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<kotlin.code.style>official</kotlin.code.style>
|
<kotlin.code.style>official</kotlin.code.style>
|
||||||
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
|
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
|
||||||
<kotlin.version>1.7.22</kotlin.version>
|
<kotlin.version>2.2.0</kotlin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<fork>true</fork>
|
<fork>true</fork>
|
||||||
<outputDirectory>./target</outputDirectory>
|
<outputDirectory>./target</outputDirectory>
|
||||||
<classifier>executable</classifier>
|
<!-- <classifier>executable</classifier>-->
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
@@ -44,26 +44,6 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>compile</id>
|
|
||||||
<phase>compile</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>compile</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
<execution>
|
|
||||||
<id>testCompile</id>
|
|
||||||
<phase>test-compile</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>testCompile</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
@@ -89,6 +69,35 @@
|
|||||||
<jvmTarget>1.8</jvmTarget>
|
<jvmTarget>1.8</jvmTarget>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>compile</id>
|
||||||
|
<phase>compile</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>compile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>testCompile</id>
|
||||||
|
<phase>test-compile</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>testCompile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>default-compile</id>
|
||||||
|
<phase>none</phase>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>default-testCompile</id>
|
||||||
|
<phase>none</phase>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
@@ -122,6 +131,17 @@
|
|||||||
<artifactId>jsoup</artifactId>
|
<artifactId>jsoup</artifactId>
|
||||||
<version>1.15.3</version>
|
<version>1.15.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||||
|
<version>${kotlin.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-test</artifactId>
|
||||||
|
<version>${kotlin.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
|
|||||||
13
settings.xml
13
settings.xml
@@ -131,6 +131,11 @@ under the License.
|
|||||||
<passphrase>optional; leave empty if not used.</passphrase>
|
<passphrase>optional; leave empty if not used.</passphrase>
|
||||||
</server>
|
</server>
|
||||||
-->
|
-->
|
||||||
|
<server>
|
||||||
|
<id>mirror-all</id>
|
||||||
|
<username>jimlee</username>
|
||||||
|
<password>wysnih-dybbyQ-0rigti</password>
|
||||||
|
</server>
|
||||||
<server>
|
<server>
|
||||||
<id>2ha</id>
|
<id>2ha</id>
|
||||||
<username>jimlee</username>
|
<username>jimlee</username>
|
||||||
@@ -176,7 +181,7 @@ under the License.
|
|||||||
<id>mirror-all</id>
|
<id>mirror-all</id>
|
||||||
<mirrorOf>*</mirrorOf>
|
<mirrorOf>*</mirrorOf>
|
||||||
<name>2ha mirror</name>
|
<name>2ha mirror</name>
|
||||||
<url>https://2ha.me:18082/repository/maven-public/</url>
|
<url>https://maven.2ha.me/repository/maven-public/</url>
|
||||||
</mirror>
|
</mirror>
|
||||||
</mirrors>
|
</mirrors>
|
||||||
|
|
||||||
@@ -272,7 +277,7 @@ under the License.
|
|||||||
<repository>
|
<repository>
|
||||||
<id>2ha</id>
|
<id>2ha</id>
|
||||||
<name>2ha.me nexus private</name>
|
<name>2ha.me nexus private</name>
|
||||||
<url>https://2ha.me:18082/repository/maven-public/</url>
|
<url>https://maven.2ha.me/repository/maven-public/</url>
|
||||||
<releases>
|
<releases>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</releases>
|
</releases>
|
||||||
@@ -284,12 +289,12 @@ under the License.
|
|||||||
<repository>
|
<repository>
|
||||||
<id>maven-releases</id>
|
<id>maven-releases</id>
|
||||||
<name>Nexus Release Repository</name>
|
<name>Nexus Release Repository</name>
|
||||||
<url>https://2ha.me:18082/repository/private/</url>
|
<url>https://maven.2ha.me/repository/private/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>maven-snapshots</id>
|
<id>maven-snapshots</id>
|
||||||
<name>Nexus Snapshot Repository</name>
|
<name>Nexus Snapshot Repository</name>
|
||||||
<url>https://2ha.me:18082/repository/private/</url>
|
<url>https://maven.2ha.me/repository/private/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
</profile>
|
</profile>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import org.slf4j.Logger
|
|||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.springframework.boot.SpringApplication
|
import org.springframework.boot.SpringApplication
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationPropertiesScan
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@@ -15,6 +16,7 @@ import java.util.*
|
|||||||
* 启动入口
|
* 启动入口
|
||||||
**/
|
**/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@ConfigurationPropertiesScan
|
||||||
open class DakaApplication
|
open class DakaApplication
|
||||||
|
|
||||||
val <T : Any> T.logger: Logger
|
val <T : Any> T.logger: Logger
|
||||||
|
|||||||
@@ -8,12 +8,15 @@ import com.pomelotea.hoperun.sign.config.HoperunUserConfig.deviceMap
|
|||||||
import com.pomelotea.hoperun.sign.config.HoperunUserConfig.getUserConfig
|
import com.pomelotea.hoperun.sign.config.HoperunUserConfig.getUserConfig
|
||||||
import com.pomelotea.hoperun.sign.config.HoperunUserConfig.userConfigMap
|
import com.pomelotea.hoperun.sign.config.HoperunUserConfig.userConfigMap
|
||||||
import com.pomelotea.hoperun.sign.config.UserConfig
|
import com.pomelotea.hoperun.sign.config.UserConfig
|
||||||
|
import com.pomelotea.hoperun.sign.notify.ServerChan3NotifyHelper
|
||||||
|
import com.pomelotea.hoperun.sign.service.NotificationService
|
||||||
import com.pomelotea.hoperun.sign.scheduler.AutoDakaScheduler
|
import com.pomelotea.hoperun.sign.scheduler.AutoDakaScheduler
|
||||||
import com.pomelotea.hoperun.sign.scheduler.AutoDakaScheduler.Companion.dakaQueue
|
import com.pomelotea.hoperun.sign.scheduler.AutoDakaScheduler.Companion.dakaQueue
|
||||||
import okhttp3.FormBody
|
import okhttp3.FormBody
|
||||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.RequestBody.Companion.toRequestBody
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.web.bind.annotation.*
|
import org.springframework.web.bind.annotation.*
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -29,12 +32,14 @@ import java.util.*
|
|||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/daka")
|
@RequestMapping("/api/daka")
|
||||||
class HoperunSignController {
|
class HoperunSignController(
|
||||||
|
@field:Autowired private val notificationService: NotificationService
|
||||||
|
) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
AutoDakaScheduler()
|
AutoDakaScheduler(notificationService)
|
||||||
// AutoRenewSessionScheduler()
|
// AutoRenewSessionScheduler()
|
||||||
val yxl = UserConfig(
|
val yxl = UserConfig(
|
||||||
project_id = "U2103S000112",
|
project_id = "U2103S000112",
|
||||||
@@ -163,6 +168,17 @@ class HoperunSignController {
|
|||||||
monthAttLog.autoDakaBeginTime = autoDaka.beginTime
|
monthAttLog.autoDakaBeginTime = autoDaka.beginTime
|
||||||
monthAttLog.autoDakaEndTime = autoDaka.endTime
|
monthAttLog.autoDakaEndTime = autoDaka.endTime
|
||||||
}
|
}
|
||||||
|
monthAttResult.forEach {
|
||||||
|
it.actual_area_begin =
|
||||||
|
if (!it.actual_area_begin.isNullOrBlank()) {
|
||||||
|
if (it.actual_area_begin == "buqianka") "补签卡" else
|
||||||
|
area_regex.find(it.actual_area_begin!!)?.groups?.get(0)?.value
|
||||||
|
} else null
|
||||||
|
it.actual_area_end = if (!it.actual_area_end.isNullOrBlank()) {
|
||||||
|
if (it.actual_area_end == "buqianka") "补签卡" else
|
||||||
|
area_regex.find(it.actual_area_end!!)?.groups?.get(0)?.value
|
||||||
|
} else null
|
||||||
|
}
|
||||||
return monthAttResult
|
return monthAttResult
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,6 +268,8 @@ class HoperunSignController {
|
|||||||
|
|
||||||
|
|
||||||
private fun setUserConfig(employeeNo: String) {
|
private fun setUserConfig(employeeNo: String) {
|
||||||
|
if (userConfigMap[employeeNo] != null
|
||||||
|
&& userConfigMap[employeeNo]!!.timeout > System.currentTimeMillis()) return
|
||||||
// 获取deviceua
|
// 获取deviceua
|
||||||
val loginRequest = Request.Builder()
|
val loginRequest = Request.Builder()
|
||||||
.url("http://pom.hoperun.com:8187/attp/login/login.do")
|
.url("http://pom.hoperun.com:8187/attp/login/login.do")
|
||||||
@@ -300,7 +318,8 @@ class HoperunSignController {
|
|||||||
val username: String = lastDakaInfo.getString("staff_name")
|
val username: String = lastDakaInfo.getString("staff_name")
|
||||||
userConfig.username = username
|
userConfig.username = username
|
||||||
if (userConfig.device == null) {
|
if (userConfig.device == null) {
|
||||||
if (lastDakaInfo.getString("actual_area_end") != null) {
|
if (lastDakaInfo.getString("actual_area_end") != null
|
||||||
|
&& lastDakaInfo.getString("actual_area_end") != "buqianka") {
|
||||||
val area: String = lastDakaInfo.getString("actual_area_end")
|
val area: String = lastDakaInfo.getString("actual_area_end")
|
||||||
userConfig.device = area.substring(area.lastIndexOf("Qing") + 13)
|
userConfig.device = area.substring(area.lastIndexOf("Qing") + 13)
|
||||||
} else if (lastDakaInfo.getString("actual_area_begin") != null) {
|
} else if (lastDakaInfo.getString("actual_area_begin") != null) {
|
||||||
@@ -371,6 +390,8 @@ class WebResult<T> protected constructor() : java.io.Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val area_regex = Regex(".*[\\u4e00-\\u9fa5]|[0-9][\\u4e00-\\u9fa5]")
|
||||||
|
|
||||||
data class MonthAttLog(
|
data class MonthAttLog(
|
||||||
var area_id: String? = null,
|
var area_id: String? = null,
|
||||||
var area_id_begin: String? = null,
|
var area_id_begin: String? = null,
|
||||||
@@ -387,6 +408,8 @@ data class MonthAttLog(
|
|||||||
var yearmonth: String? = null,
|
var yearmonth: String? = null,
|
||||||
var autoDakaBeginTime: String? = null,
|
var autoDakaBeginTime: String? = null,
|
||||||
var autoDakaEndTime: String? = null,
|
var autoDakaEndTime: String? = null,
|
||||||
|
var actual_area_begin: String? = null,
|
||||||
|
var actual_area_end: String? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
data class HoperunDakaRequest(
|
data class HoperunDakaRequest(
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.pomelotea.hoperun.sign.api.model
|
||||||
|
|
||||||
|
data class DingTalkNotifyRequest(
|
||||||
|
val msgtype: String = "text",
|
||||||
|
val text: TextContent
|
||||||
|
)
|
||||||
|
|
||||||
|
data class TextContent(
|
||||||
|
val content: String
|
||||||
|
)
|
||||||
|
|
||||||
|
data class DingTalkNotifyResponse(
|
||||||
|
val errcode: Int,
|
||||||
|
val errmsg: String
|
||||||
|
)
|
||||||
|
|
||||||
|
data class MarkdownContent(
|
||||||
|
val title: String,
|
||||||
|
val text: String
|
||||||
|
)
|
||||||
|
|
||||||
|
data class DingTalkMarkdownRequest(
|
||||||
|
val msgtype: String = "markdown",
|
||||||
|
val markdown: MarkdownContent
|
||||||
|
)
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.pomelotea.hoperun.sign.api.model
|
||||||
|
|
||||||
|
data class ScNotifyRequest(
|
||||||
|
val title: String,
|
||||||
|
val desp: String?,
|
||||||
|
val tags: String? = null,
|
||||||
|
val short: String? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
data class ScNotifyResponse(
|
||||||
|
val code: Int,
|
||||||
|
val message: String,
|
||||||
|
val data: String?
|
||||||
|
)
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.pomelotea.hoperun.sign.config
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||||
|
import org.springframework.stereotype.Component
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "dingtalk")
|
||||||
|
class DingTalkConfig {
|
||||||
|
lateinit var webhook: String
|
||||||
|
lateinit var secret: String
|
||||||
|
var enabled: Boolean = false
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ object HoperunUserConfig {
|
|||||||
)
|
)
|
||||||
|
|
||||||
val userConfigMap: MutableMap<String, UserConfig> = HashMap()
|
val userConfigMap: MutableMap<String, UserConfig> = HashMap()
|
||||||
var address: String = "浙江省杭州市西湖区转塘街道凌家桥路飞天园区"
|
var address: String = "浙江省杭州市西湖区飞天园区1号楼"
|
||||||
var longitueHead: String = "120.085"
|
var longitueHead: String = "120.085"
|
||||||
var latitudeHead: String = "30.138"
|
var latitudeHead: String = "30.138"
|
||||||
var longitueShort: String = "120.0845715522375"
|
var longitueShort: String = "120.0845715522375"
|
||||||
@@ -62,5 +62,6 @@ data class UserConfig(
|
|||||||
var project_id: String? = null,
|
var project_id: String? = null,
|
||||||
var projectname: String? = null,
|
var projectname: String? = null,
|
||||||
var projectcode: String? = null,
|
var projectcode: String? = null,
|
||||||
var autoDaka: Boolean = false
|
var autoDaka: Boolean = false,
|
||||||
|
val timeout: Long = System.currentTimeMillis() + 1000 * 60 * 30
|
||||||
)
|
)
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.pomelotea.hoperun.sign.config
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||||
|
import org.springframework.stereotype.Component
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "sc3")
|
||||||
|
class ServerChan3Config {
|
||||||
|
lateinit var uid: String
|
||||||
|
lateinit var sendKey: String
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package com.pomelotea.hoperun.sign.notify
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON
|
||||||
|
import com.alibaba.fastjson.JSONObject
|
||||||
|
import com.pomelotea.hoperun.sign.api.model.DingTalkMarkdownRequest
|
||||||
|
import com.pomelotea.hoperun.sign.api.model.DingTalkNotifyRequest
|
||||||
|
import com.pomelotea.hoperun.sign.api.model.DingTalkNotifyResponse
|
||||||
|
import com.pomelotea.hoperun.sign.api.model.MarkdownContent
|
||||||
|
import com.pomelotea.hoperun.sign.common.client
|
||||||
|
import com.pomelotea.hoperun.sign.config.DingTalkConfig
|
||||||
|
import com.pomelotea.hoperun.sign.scheduler.AutoDakaScheduler.Companion.logger
|
||||||
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
import java.net.URLEncoder
|
||||||
|
import java.nio.charset.StandardCharsets
|
||||||
|
import java.util.Base64
|
||||||
|
import javax.crypto.Mac
|
||||||
|
import javax.crypto.spec.SecretKeySpec
|
||||||
|
import kotlin.experimental.and
|
||||||
|
|
||||||
|
@Service
|
||||||
|
open class DingTalkNotifyHelper(
|
||||||
|
private val dingTalkConfig: DingTalkConfig
|
||||||
|
) {
|
||||||
|
|
||||||
|
fun sendText(content: String): DingTalkNotifyResponse {
|
||||||
|
if (!dingTalkConfig.enabled) {
|
||||||
|
logger.info("钉钉通知未启用,跳过发送消息")
|
||||||
|
return DingTalkNotifyResponse(0, "钉钉通知未启用")
|
||||||
|
}
|
||||||
|
|
||||||
|
val request = DingTalkNotifyRequest(
|
||||||
|
text = com.pomelotea.hoperun.sign.api.model.TextContent(content)
|
||||||
|
)
|
||||||
|
|
||||||
|
return sendRequest(request)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun sendMarkdown(title: String, content: String): DingTalkNotifyResponse {
|
||||||
|
if (!dingTalkConfig.enabled) {
|
||||||
|
logger.info("钉钉通知未启用,跳过发送消息")
|
||||||
|
return DingTalkNotifyResponse(0, "钉钉通知未启用")
|
||||||
|
}
|
||||||
|
|
||||||
|
val request = DingTalkMarkdownRequest(
|
||||||
|
markdown = MarkdownContent(title, content)
|
||||||
|
)
|
||||||
|
|
||||||
|
return sendRequest(request)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun sendRequest(request: Any): DingTalkNotifyResponse {
|
||||||
|
try {
|
||||||
|
val url = generateSignedUrl()
|
||||||
|
val jsonBody = JSON.toJSONString(request)
|
||||||
|
|
||||||
|
logger.info("发送钉钉消息: $jsonBody")
|
||||||
|
|
||||||
|
val httpRequest = Request.Builder()
|
||||||
|
.url(url)
|
||||||
|
.post(jsonBody.toRequestBody("application/json;charset=utf-8".toMediaTypeOrNull()))
|
||||||
|
.build()
|
||||||
|
|
||||||
|
val response = client.newCall(httpRequest).execute()
|
||||||
|
val responseBody = response.body?.string()
|
||||||
|
|
||||||
|
logger.info("钉钉响应: $responseBody")
|
||||||
|
|
||||||
|
return JSONObject.parseObject(responseBody, DingTalkNotifyResponse::class.java)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logger.error("发送钉钉消息失败", e)
|
||||||
|
return DingTalkNotifyResponse(-1, "发送钉钉消息失败: ${e.message}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun generateSignedUrl(): String {
|
||||||
|
val webhook = dingTalkConfig.webhook
|
||||||
|
val secret = dingTalkConfig.secret
|
||||||
|
|
||||||
|
if (secret.isEmpty()) {
|
||||||
|
return webhook
|
||||||
|
}
|
||||||
|
|
||||||
|
val timestamp = System.currentTimeMillis()
|
||||||
|
val sign = generateSign(timestamp.toString(), secret)
|
||||||
|
|
||||||
|
return "$webhook×tamp=$timestamp&sign=$sign"
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun generateSign(timestamp: String, secret: String): String {
|
||||||
|
val stringToSign = "$timestamp\n$secret"
|
||||||
|
val mac = Mac.getInstance("HmacSHA256")
|
||||||
|
mac.init(SecretKeySpec(secret.toByteArray(StandardCharsets.UTF_8), "HmacSHA256"))
|
||||||
|
val signData = mac.doFinal(stringToSign.toByteArray(StandardCharsets.UTF_8))
|
||||||
|
val sign = Base64.getEncoder().encodeToString(signData)
|
||||||
|
return URLEncoder.encode(sign, StandardCharsets.UTF_8.name())
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.pomelotea.hoperun.sign.notify
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON
|
||||||
|
import com.alibaba.fastjson.JSONObject
|
||||||
|
import com.pomelotea.hoperun.sign.api.model.ScNotifyRequest
|
||||||
|
import com.pomelotea.hoperun.sign.api.model.ScNotifyResponse
|
||||||
|
import com.pomelotea.hoperun.sign.common.client
|
||||||
|
import com.pomelotea.hoperun.sign.config.ServerChan3Config
|
||||||
|
import com.pomelotea.hoperun.sign.scheduler.AutoDakaScheduler.Companion.logger
|
||||||
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
|
open class ServerChan3NotifyHelper(
|
||||||
|
private val serverChan3Config: ServerChan3Config
|
||||||
|
) {
|
||||||
|
|
||||||
|
fun push(req: ScNotifyRequest): ScNotifyResponse {
|
||||||
|
val notifyRequest = Request.Builder()
|
||||||
|
.url("https://${serverChan3Config.uid}.push.ft07.com/send/${serverChan3Config.sendKey}.send")
|
||||||
|
.post(
|
||||||
|
JSON.toJSONString(req)
|
||||||
|
.toRequestBody("application/json;charset=utf-8".toMediaTypeOrNull())
|
||||||
|
)
|
||||||
|
.build()
|
||||||
|
val result: String? = client.newCall(notifyRequest).execute().body?.string()
|
||||||
|
return JSONObject.parseObject(result, ScNotifyResponse::class.java)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,21 @@
|
|||||||
package com.pomelotea.hoperun.sign.scheduler
|
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.DakaResponse
|
||||||
|
import com.pomelotea.hoperun.sign.api.model.ScNotifyRequest
|
||||||
|
import com.pomelotea.hoperun.sign.api.model.ScNotifyResponse
|
||||||
import com.pomelotea.hoperun.sign.common.*
|
import com.pomelotea.hoperun.sign.common.*
|
||||||
import com.pomelotea.hoperun.sign.config.HoperunUserConfig
|
import com.pomelotea.hoperun.sign.config.HoperunUserConfig
|
||||||
import com.pomelotea.hoperun.sign.config.UserConfig
|
import com.pomelotea.hoperun.sign.config.UserConfig
|
||||||
|
import com.pomelotea.hoperun.sign.notify.ServerChan3NotifyHelper
|
||||||
|
import com.pomelotea.hoperun.sign.service.NotificationService
|
||||||
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
import org.slf4j.Logger
|
import org.slf4j.Logger
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -21,7 +31,9 @@ import java.util.concurrent.TimeUnit
|
|||||||
* date 2023-03-22 14:50
|
* date 2023-03-22 14:50
|
||||||
* 自动打卡定时任务
|
* 自动打卡定时任务
|
||||||
**/
|
**/
|
||||||
class AutoDakaScheduler {
|
open class AutoDakaScheduler(
|
||||||
|
private val notificationService: NotificationService
|
||||||
|
) {
|
||||||
|
|
||||||
val timeThreadPool: ScheduledExecutorService = Executors.newScheduledThreadPool(1)
|
val timeThreadPool: ScheduledExecutorService = Executors.newScheduledThreadPool(1)
|
||||||
val schedulerThreadPool: ScheduledExecutorService = Executors.newScheduledThreadPool(10)
|
val schedulerThreadPool: ScheduledExecutorService = Executors.newScheduledThreadPool(10)
|
||||||
@@ -35,7 +47,7 @@ class AutoDakaScheduler {
|
|||||||
val logger: Logger = LoggerFactory.getLogger("DAKA-SHCEDULER")
|
val logger: Logger = LoggerFactory.getLogger("DAKA-SHCEDULER")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addAutoDakaScheduled(dakaDate: String = getNowDateyyyy_MM_dd()) {
|
private fun addAutoDakaScheduled(dakaDate: String = getNowDateyyyy_MM_dd()) {
|
||||||
// 调休的工作日
|
// 调休的工作日
|
||||||
if (isNeedDaka(dakaDate)) {
|
if (isNeedDaka(dakaDate)) {
|
||||||
HoperunUserConfig.userConfigMap.forEach { (_, v) ->
|
HoperunUserConfig.userConfigMap.forEach { (_, v) ->
|
||||||
@@ -45,8 +57,21 @@ class AutoDakaScheduler {
|
|||||||
if (daka == null) {
|
if (daka == null) {
|
||||||
daka = generateDakaInfo(v, dakaDate)
|
daka = generateDakaInfo(v, dakaDate)
|
||||||
dakaQueue.add(daka)
|
dakaQueue.add(daka)
|
||||||
|
notificationService.sendDingTalkNotification(
|
||||||
|
"#### 【 $dakaDate 】添加打卡任务!",
|
||||||
|
|
||||||
|
"""
|
||||||
|
#### 【 $dakaDate 】添加打卡任务!
|
||||||
|
**************************************************
|
||||||
|
##### 工号: ${daka.employeeNo}
|
||||||
|
##### 上班卡: ${daka.beginTime}
|
||||||
|
##### 下班卡: ${daka.endTime}
|
||||||
|
**************************************************
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
logger.info("添加打卡任务: ${v.username}, $daka")
|
||||||
}
|
}
|
||||||
logger.info("${v.username},${daka.toCsv()}")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,14 +114,35 @@ class AutoDakaScheduler {
|
|||||||
try {
|
try {
|
||||||
logger.info("[EXECUTE]BEGIN:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.beginTime}")
|
logger.info("[EXECUTE]BEGIN:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.beginTime}")
|
||||||
// 模拟重新登录打卡
|
// 模拟重新登录打卡
|
||||||
logger.info("${daka.employeeNo}OLD-JSESSIONID: ${sessionMap[daka.employeeNo]}")
|
logger.info("${daka.employeeNo}-OLD-JSESSIONID: ${sessionMap[daka.employeeNo]}")
|
||||||
resetJSessionId(employeeNo = daka.employeeNo)
|
resetJSessionId(employeeNo = daka.employeeNo)
|
||||||
logger.info("${daka.employeeNo}NEW-JSESSIONID: ${sessionMap[daka.employeeNo]}")
|
logger.info("${daka.employeeNo}-NEW-JSESSIONID: ${sessionMap[daka.employeeNo]}")
|
||||||
val resp: DakaResponse =
|
val resp: DakaResponse =
|
||||||
beginTime(employeeNo = daka.employeeNo, date = daka.dakaDate, time = daka.beginTime)
|
beginTime(employeeNo = daka.employeeNo, date = daka.dakaDate, time = daka.beginTime)
|
||||||
if (resp.result != "success") {
|
if (resp.result != "success") {
|
||||||
logger.error("打上班卡失败")
|
logger.error("打上班卡失败")
|
||||||
|
notificationService.sendDingTalkNotification(
|
||||||
|
title = "【 ${daka.dakaDate} 】打上班卡失败",
|
||||||
|
"""
|
||||||
|
#### 【 ${daka.dakaDate} 】打上班卡失败!
|
||||||
|
**************************************************
|
||||||
|
##### 工号: ${daka.employeeNo}
|
||||||
|
##### 上班卡: ${daka.beginTime}
|
||||||
|
##### 下班卡: ${daka.endTime}
|
||||||
|
**************************************************
|
||||||
|
"""
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
|
notificationService.sendDingTalkNotification(
|
||||||
|
title = "打上班卡成功:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.beginTime}",
|
||||||
|
"""
|
||||||
|
#### 【 ${daka.dakaDate} 】打上班卡成功!
|
||||||
|
**************************************************
|
||||||
|
##### 工号: ${daka.employeeNo}
|
||||||
|
##### 时间: ${daka.beginTime}
|
||||||
|
**************************************************
|
||||||
|
"""
|
||||||
|
)
|
||||||
logger.info("打上班卡成功")
|
logger.info("打上班卡成功")
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -110,13 +156,32 @@ class AutoDakaScheduler {
|
|||||||
try {
|
try {
|
||||||
logger.info("[EXECUTE]END:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.endTime}")
|
logger.info("[EXECUTE]END:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.endTime}")
|
||||||
// 模拟重新登录打卡
|
// 模拟重新登录打卡
|
||||||
logger.info("${daka.employeeNo}OLD-JSESSIONID: ${sessionMap[daka.employeeNo]}")
|
logger.info("${daka.employeeNo}-OLD-JSESSIONID: ${sessionMap[daka.employeeNo]}")
|
||||||
resetJSessionId(employeeNo = daka.employeeNo)
|
resetJSessionId(employeeNo = daka.employeeNo)
|
||||||
logger.info("${daka.employeeNo}NEW-JSESSIONID: ${sessionMap[daka.employeeNo]}")
|
logger.info("${daka.employeeNo}-NEW-JSESSIONID: ${sessionMap[daka.employeeNo]}")
|
||||||
val resp: DakaResponse = endTime(employeeNo = daka.employeeNo, date = daka.dakaDate, time = daka.endTime)
|
val resp: DakaResponse = endTime(employeeNo = daka.employeeNo, date = daka.dakaDate, time = daka.endTime)
|
||||||
if (resp.result != "success") {
|
if (resp.result != "success") {
|
||||||
logger.error("打下班卡失败")
|
logger.error("打下班卡失败")
|
||||||
|
notificationService.sendDingTalkNotification(
|
||||||
|
title = "打下班卡失败:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.endTime}",
|
||||||
|
"""
|
||||||
|
#### 【 ${daka.dakaDate} 】打下班卡失败!
|
||||||
|
**************************************************
|
||||||
|
##### 工号: ${daka.employeeNo}
|
||||||
|
##### 上班卡: ${daka.beginTime}
|
||||||
|
##### 下班卡: ${daka.endTime}
|
||||||
|
**************************************************
|
||||||
|
""" )
|
||||||
} else {
|
} else {
|
||||||
|
notificationService.sendDingTalkNotification(
|
||||||
|
title = "打下班卡成功:${daka.employeeNo}:DATE:${daka.dakaDate}:TIME:${daka.endTime}",
|
||||||
|
"""
|
||||||
|
#### 【 ${daka.dakaDate} 】打下班卡成功!
|
||||||
|
**************************************************
|
||||||
|
##### 工号: ${daka.employeeNo}
|
||||||
|
##### 时间: ${daka.endTime}
|
||||||
|
**************************************************
|
||||||
|
""" )
|
||||||
logger.info("打下班卡成功")
|
logger.info("打下班卡成功")
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -137,10 +202,13 @@ class AutoDakaScheduler {
|
|||||||
schedulerThreadPool as ScheduledThreadPoolExecutor
|
schedulerThreadPool as ScheduledThreadPoolExecutor
|
||||||
val queue = schedulerThreadPool.queue
|
val queue = schedulerThreadPool.queue
|
||||||
logger.info("任务队列数量: ${queue.size}")
|
logger.info("任务队列数量: ${queue.size}")
|
||||||
|
dakaQueue.forEach {
|
||||||
|
logger.info(it.toString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getRandomEndTime(): String {
|
private fun getRandomEndTime(): String {
|
||||||
val hourArray = intArrayOf(18, 19, 20, 21, 22, 23, 19, 20, 20, 19, 18, 20)
|
val hourArray = intArrayOf(18, 19, 20, 19, 19, 20, 19, 20, 20, 19, 18, 20)
|
||||||
val randomHour = hourArray[Math.round(Math.random() * 9).toInt()]
|
val randomHour = hourArray[Math.round(Math.random() * 9).toInt()]
|
||||||
val randomMinute = if (randomHour == 18) {
|
val randomMinute = if (randomHour == 18) {
|
||||||
30 + Random().nextInt(19)
|
30 + Random().nextInt(19)
|
||||||
@@ -167,4 +235,8 @@ data class Daka(
|
|||||||
fun toCsv(): String {
|
fun toCsv(): String {
|
||||||
return "$employeeNo,$dakaDate,$beginTime,$endTime,$added"
|
return "$employeeNo,$dakaDate,$beginTime,$endTime,$added"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "工号: $employeeNo, 日期: $dakaDate, 上班卡: $beginTime, 下班卡: $endTime, 定时开关: $added"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.pomelotea.hoperun.sign.service
|
||||||
|
|
||||||
|
import com.pomelotea.hoperun.sign.api.model.ScNotifyRequest
|
||||||
|
import com.pomelotea.hoperun.sign.api.model.ScNotifyResponse
|
||||||
|
import com.pomelotea.hoperun.sign.api.model.DingTalkNotifyResponse
|
||||||
|
import com.pomelotea.hoperun.sign.config.DingTalkConfig
|
||||||
|
import com.pomelotea.hoperun.sign.config.ServerChan3Config
|
||||||
|
import com.pomelotea.hoperun.sign.notify.DingTalkNotifyHelper
|
||||||
|
import com.pomelotea.hoperun.sign.notify.ServerChan3NotifyHelper
|
||||||
|
import com.pomelotea.hoperun.sign.scheduler.AutoDakaScheduler.Companion.logger
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
|
open class NotificationService(
|
||||||
|
private val serverChan3NotifyHelper: ServerChan3NotifyHelper,
|
||||||
|
private val dingTalkNotifyHelper: DingTalkNotifyHelper,
|
||||||
|
private val serverChan3Config: ServerChan3Config,
|
||||||
|
private val dingTalkConfig: DingTalkConfig
|
||||||
|
) {
|
||||||
|
|
||||||
|
fun sendAllNotifications(title: String, content: String) {
|
||||||
|
// 发送 ServerChan3 通知
|
||||||
|
try {
|
||||||
|
val scResponse = sendServerChanNotification(title, content)
|
||||||
|
logger.info("ServerChan3 通知发送结果: ${scResponse.message}")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logger.error("ServerChan3 通知发送失败", e)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送钉钉通知
|
||||||
|
try {
|
||||||
|
val dtResponse = sendDingTalkNotification(title, content)
|
||||||
|
logger.info("钉钉通知发送结果: ${dtResponse.errmsg}")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logger.error("钉钉通知发送失败", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun sendServerChanNotification(title: String, content: String): ScNotifyResponse {
|
||||||
|
val request = ScNotifyRequest(title = title, desp = content)
|
||||||
|
return serverChan3NotifyHelper.push(request)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun sendDingTalkNotification(title: String, content: String): DingTalkNotifyResponse {
|
||||||
|
// 如果内容包含markdown格式,使用markdown类型消息
|
||||||
|
return if (content.contains("**") || content.contains("#") || content.contains("*")) {
|
||||||
|
dingTalkNotifyHelper.sendMarkdown(title, content)
|
||||||
|
} else {
|
||||||
|
dingTalkNotifyHelper.sendText("$title\n\n$content")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun sendDingTalkText(text: String): DingTalkNotifyResponse {
|
||||||
|
return dingTalkNotifyHelper.sendText(text)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun sendDingTalkMarkdown(title: String, content: String): DingTalkNotifyResponse {
|
||||||
|
return dingTalkNotifyHelper.sendMarkdown(title, content)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isServerChanEnabled(): Boolean {
|
||||||
|
return serverChan3Config.uid.isNotEmpty() && serverChan3Config.sendKey.isNotEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isDingTalkEnabled(): Boolean {
|
||||||
|
return dingTalkConfig.enabled &&
|
||||||
|
dingTalkConfig.webhook.isNotEmpty() &&
|
||||||
|
!dingTalkConfig.webhook.contains("YOUR_ACCESS_TOKEN")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
server:
|
server:
|
||||||
port: 8082
|
port: 8982
|
||||||
|
|
||||||
hoperun:
|
hoperun:
|
||||||
address: "浙江省杭州市西湖区转塘街道凌家桥路飞天园区120"
|
address: "浙江省杭州市西湖区转塘街道凌家桥路飞天园区120"
|
||||||
@@ -9,3 +9,11 @@ hoperun:
|
|||||||
latitudeShort: "30.140219809955912"
|
latitudeShort: "30.140219809955912"
|
||||||
qingUa: "Qing/0.9.113"
|
qingUa: "Qing/0.9.113"
|
||||||
|
|
||||||
|
sc3:
|
||||||
|
uid: 7248
|
||||||
|
send-key: sctp7248ta-yehg0lpo6cr9xl6ikqwbpn4l
|
||||||
|
|
||||||
|
dingtalk:
|
||||||
|
enabled: true
|
||||||
|
webhook: https://oapi.dingtalk.com/robot/send?access_token=6925880a1b7379b2fb393b5336dd75155f37189a7912981b568b08316bfd7b9e
|
||||||
|
secret:
|
||||||
@@ -37,3 +37,12 @@ hoperun:
|
|||||||
"projectcode": "U2103S000112"
|
"projectcode": "U2103S000112"
|
||||||
"projectname": "JRKF-浙江网商-技术服务外包"
|
"projectname": "JRKF-浙江网商-技术服务外包"
|
||||||
"device": "Android 12;Redmi;M2007J3SC;deviceId:OAIDe7fa6084205e9a22d8f6f71bc91893ff;deviceName:Android"
|
"device": "Android 12;Redmi;M2007J3SC;deviceId:OAIDe7fa6084205e9a22d8f6f71bc91893ff;deviceName:Android"
|
||||||
|
|
||||||
|
sc3:
|
||||||
|
uid: 7248
|
||||||
|
send-key: sctp7248ta-yehg0lpo6cr9xl6ikqwbpn4l
|
||||||
|
|
||||||
|
dingtalk:
|
||||||
|
enabled: true
|
||||||
|
webhook: https://oapi.dingtalk.com/robot/send?access_token=6925880a1b7379b2fb393b5336dd75155f37189a7912981b568b08316bfd7b9e
|
||||||
|
secret:
|
||||||
@@ -89,12 +89,14 @@
|
|||||||
<!-- scheduler logger -->
|
<!-- scheduler logger -->
|
||||||
<logger name="DAKA-SHCEDULER" level="${logging.level}">
|
<logger name="DAKA-SHCEDULER" level="${logging.level}">
|
||||||
<appender-ref ref="SCHEDULER-APPENDER"/>
|
<appender-ref ref="SCHEDULER-APPENDER"/>
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<!-- application logger -->
|
<!-- application logger -->
|
||||||
<logger name="com.pomelotea.hoperun.sign" level="${logging.level}" additivity="false">
|
<logger name="com.pomelotea.hoperun.sign" level="${logging.level}" additivity="false">
|
||||||
<appender-ref ref="ROOT-APPENDER"/>
|
<appender-ref ref="ROOT-APPENDER"/>
|
||||||
<appender-ref ref="ERROR-APPENDER"/>
|
<appender-ref ref="ERROR-APPENDER"/>
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,131 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>打卡</title>
|
|
||||||
<link rel="stylesheet" href="./normalize.min.css">
|
|
||||||
<link rel="stylesheet" href="./style.css">
|
|
||||||
</head>
|
|
||||||
<body class="dark-mode"><!--partial:index.partial.html-->
|
|
||||||
<div class="job">
|
|
||||||
<div class="header">
|
|
||||||
<div class="logo">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
||||||
<path xmlns="http://www.w3.org/2000/svg"
|
|
||||||
d="M512 503.5H381.7a48 48 0 01-45.3-32.1L265 268.1l-9-25.5 2.7-124.6L338.2 8.5l23.5 67.1L512 503.5z"
|
|
||||||
fill="#0473ff" data-original="#28b446"/>
|
|
||||||
<path xmlns="http://www.w3.org/2000/svg" fill="#0473ff" data-original="#219b38"
|
|
||||||
d="M361.7 75.6L265 268.1l-9-25.5 2.7-124.6L338.2 8.5z"/>
|
|
||||||
<path xmlns="http://www.w3.org/2000/svg"
|
|
||||||
d="M338.2 8.5l-82.2 234-80.4 228.9a48 48 0 01-45.3 32.1H0l173.8-495h164.4z" fill="#0473ff"
|
|
||||||
data-original="#518ef8"/>
|
|
||||||
</svg>
|
|
||||||
打卡
|
|
||||||
</div>
|
|
||||||
<div class="user-settings">
|
|
||||||
<div class="dark-light">
|
|
||||||
<svg viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linecap="round"
|
|
||||||
stroke-linejoin="round">
|
|
||||||
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<img class="user-profile" id="user-head" src="img/tx.png" alt="">
|
|
||||||
<div id="user-div">
|
|
||||||
<div id="username">未登陆</div>
|
|
||||||
<span id="login-span">
|
|
||||||
<div class="alert-inline">
|
|
||||||
<div>
|
|
||||||
<input class="login-input" id="employee-number" type="text" placeholder="输入工号">
|
|
||||||
</div>
|
|
||||||
<!--<div>
|
|
||||||
<input class="login-input" style="width: 280px" id="jsessionId" type="text" placeholder="输入SESSIONID">
|
|
||||||
</div>-->
|
|
||||||
<div>
|
|
||||||
<div id="autodaka">自动打卡开关</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="toggle toggle--switch">
|
|
||||||
<input type="checkbox" id="toggle--switch" class="toggle--checkbox">
|
|
||||||
<label class="toggle--btn" for="toggle--switch"><span class="toggle--feature" data-label-on="on" data-label-off="off"></span></label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button class="random-buttons" id="login">登陆</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
<div id="logout-div" style="display: none">
|
|
||||||
<button class="random-buttons" id="logout">登出</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="dialog" style="display: none">
|
|
||||||
<div class="alert">
|
|
||||||
<div class="job-card-title" id="sign-date"><span style="font-size: 24px"></span></div>
|
|
||||||
<div class="alert-inline">
|
|
||||||
<div><input id="sign-begin-time" type="text" placeholder="输入上班时间"></div>
|
|
||||||
<div>
|
|
||||||
<button class="random-buttons" id="sign-begin-random">随机</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="alert-inline">
|
|
||||||
<div><input id="sign-end-time" type="text" placeholder="输入下班时间"></div>
|
|
||||||
<div>
|
|
||||||
<button class="random-buttons" id="sign-end-random">随机</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button class="search-buttons card-buttons begin-buttons" id="save-sign">保存</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="userinfo_dialog" style="display: none">
|
|
||||||
<div class="alert">
|
|
||||||
<div class="job-card-title"><span style="font-size: 24px">打卡信息</span></div>
|
|
||||||
<div class="alert-inline">
|
|
||||||
<div>
|
|
||||||
<label for="_user_input">用 户 名 : </label>
|
|
||||||
<input id="_user_input" readonly="readonly" type="text">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="alert-inline">
|
|
||||||
<div>
|
|
||||||
<label for="_project_id_input">项 目 I D: </label>
|
|
||||||
<input id="_project_id_input" readonly="readonly" type="text">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="alert-inline">
|
|
||||||
<div>
|
|
||||||
<label for="_project_name_input">项目名称: </label>
|
|
||||||
<input id="_project_name_input" readonly="readonly" type="text">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="alert-inline">
|
|
||||||
<div>
|
|
||||||
<label for="_area_input">打卡地区: </label>
|
|
||||||
<input id="_area_input" readonly="readonly" type="text">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="alert-inline">
|
|
||||||
<div>
|
|
||||||
<label for="_device_input">设备信息: </label>
|
|
||||||
<input id="_device_input" readonly="readonly" type="text">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="main-container">
|
|
||||||
<div class="searched-jobs">
|
|
||||||
<div class="searched-bar">
|
|
||||||
<div class="searched-show">打卡记录</div>
|
|
||||||
<!--<button class="search-button">餐补<span class="canbu-span"></span></button>--></div>
|
|
||||||
<div class="job-cards"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="./coco-message.js"></script>
|
|
||||||
<script src="./jquery.min.js"></script>
|
|
||||||
<script src="./script.js"></script>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +1 @@
|
|||||||
<!DOCTYPE html><html lang="zh"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1" /><title>打卡</title><link rel="stylesheet"href="./normalize.min.css"><link rel="stylesheet"href="./style.css"></head><body class="dark-mode"><!--partial:index.partial.html--><div class="job"><div class="header"><div class="logo"><svg xmlns="http://www.w3.org/2000/svg"viewBox="0 0 512 512"><path xmlns="http://www.w3.org/2000/svg"d="M512 503.5H381.7a48 48 0 01-45.3-32.1L265 268.1l-9-25.5 2.7-124.6L338.2 8.5l23.5 67.1L512 503.5z"fill="#0473ff"data-original="#28b446"/><path xmlns="http://www.w3.org/2000/svg"fill="#0473ff"data-original="#219b38"d="M361.7 75.6L265 268.1l-9-25.5 2.7-124.6L338.2 8.5z"/><path xmlns="http://www.w3.org/2000/svg"d="M338.2 8.5l-82.2 234-80.4 228.9a48 48 0 01-45.3 32.1H0l173.8-495h164.4z"fill="#0473ff"data-original="#518ef8"/></svg>打卡</div><div class="user-settings"><div class="dark-light"><svg viewBox="0 0 24 24"stroke="currentColor"stroke-width="1.5"fill="none"stroke-linecap="round"stroke-linejoin="round"><path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path></svg></div><img class="user-profile"id="user-head"src="img/tx.png"alt=""><div id="user-div"><div id="username">未登陆</div><span id="login-span"><div class="alert-inline"><div><input class="login-input"id="employee-number"type="text"placeholder="输入工号"></div><!--<div><input class="login-input"style="width: 280px"id="jsessionId"type="text"placeholder="输入SESSIONID"></div>--><div><div id="autodaka">自动打卡开关</div></div><div><div class="toggle toggle--switch"><input type="checkbox"id="toggle--switch"class="toggle--checkbox"><label class="toggle--btn"for="toggle--switch"><span class="toggle--feature"data-label-on="on"data-label-off="off"></span></label></div></div><div><button class="random-buttons"id="login">登陆</button></div></div></span><div id="logout-div"style="display: none"><button class="random-buttons"id="logout">登出</button></div></div></div></div><div class="dialog"style="display: none"><div class="alert"><div class="job-card-title"id="sign-date"><span style="font-size: 24px"></span></div><div class="alert-inline"><div><input id="sign-begin-time"type="text"placeholder="输入上班时间"></div><div><button class="random-buttons"id="sign-begin-random">随机</button></div></div><div class="alert-inline"><div><input id="sign-end-time"type="text"placeholder="输入下班时间"></div><div><button class="random-buttons"id="sign-end-random">随机</button></div></div><button class="search-buttons card-buttons begin-buttons"id="save-sign">保存</button></div></div><div class="userinfo_dialog"style="display: none"><div class="alert"><div class="job-card-title"><span style="font-size: 24px">打卡信息</span></div><div class="alert-inline"><div><label for="_user_input">用户名:</label><input id="_user_input"readonly="readonly"type="text"></div></div><div class="alert-inline"><div><label for="_project_id_input">项目I D:</label><input id="_project_id_input"readonly="readonly"type="text"></div></div><div class="alert-inline"><div><label for="_project_name_input">项目名称:</label><input id="_project_name_input"readonly="readonly"type="text"></div></div><div class="alert-inline"><div><label for="_area_input">打卡地区:</label><input id="_area_input"readonly="readonly"type="text"></div></div><div class="alert-inline"><div><label for="_device_input">设备信息:</label><input id="_device_input"readonly="readonly"type="text"></div></div></div></div><div class="wrapper"><div class="main-container"><div class="searched-jobs"><div class="searched-bar"><div class="searched-show">打卡记录</div><!--<button class="search-button">餐补<span class="canbu-span"></span></button>--></div><div class="job-cards"></div></div></div></div><script src="./coco-message.js"></script><script src="./jquery.min.js"></script><script src="./script.js"></script></div></body></html>
|
<!DOCTYPE html><html lang="zh"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1" /><title>打卡</title><link rel="stylesheet"href="./normalize.min.css"><link rel="stylesheet"href="./style.css"></head><body class="dark-mode"><!--partial:index.partial.html--><div class="job"><div class="header"><div class="logo"><svg xmlns="http://www.w3.org/2000/svg"viewBox="0 0 512 512"><path xmlns="http://www.w3.org/2000/svg"d="M512 503.5H381.7a48 48 0 01-45.3-32.1L265 268.1l-9-25.5 2.7-124.6L338.2 8.5l23.5 67.1L512 503.5z"fill="#0473ff"data-original="#28b446"/><path xmlns="http://www.w3.org/2000/svg"fill="#0473ff"data-original="#219b38"d="M361.7 75.6L265 268.1l-9-25.5 2.7-124.6L338.2 8.5z"/><path xmlns="http://www.w3.org/2000/svg"d="M338.2 8.5l-82.2 234-80.4 228.9a48 48 0 01-45.3 32.1H0l173.8-495h164.4z"fill="#0473ff"data-original="#518ef8"/></svg>打卡</div><div class="user-settings"><div class="dark-light"><svg viewBox="0 0 24 24"stroke="currentColor"stroke-width="1.5"fill="none"stroke-linecap="round"stroke-linejoin="round"><path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path></svg></div><img class="user-profile"id="user-head"src="img/tx.png"alt=""><div id="user-div"><div id="username">未登陆</div><span id="login-span"><div class="alert-inline"><div><input class="login-input"id="employee-number"type="text"placeholder="输入工号"></div><!--<div><input class="login-input"style="width: 280px"id="jsessionId"type="text"placeholder="输入SESSIONID"></div>--><div><div id="autodaka">自动打卡开关</div></div><div><div class="toggle toggle--switch"><input type="checkbox"id="toggle--switch"class="toggle--checkbox"><label class="toggle--btn"for="toggle--switch"><span class="toggle--feature"data-label-on="on"data-label-off="off"></span></label></div></div><div><button class="random-buttons"id="login">登陆</button></div></div></span><div id="logout-div"style="display: none"><button class="random-buttons"id="logout">登出</button></div></div></div></div><div class="dialog rainbow"style="display: none"><div class="alert"><div class="job-card-title"id="sign-date"><span style="font-size: 24px"></span></div><div class="alert-inline"><div><input id="sign-begin-time"type="text"placeholder="输入上班时间"></div><div><button class="random-buttons"id="sign-begin-random">随机</button></div></div><div class="alert-inline"><div><input id="sign-end-time"type="text"placeholder="输入下班时间"></div><div><button class="random-buttons"id="sign-end-random">随机</button></div></div><button class="search-buttons card-buttons begin-buttons"id="save-sign">保存</button></div></div><div class="userinfo_dialog rainbow"style="display: none"><div class="alert"><div class="job-card-title"><span style="font-size: 24px">打卡信息</span></div><div class="alert-inline"><div><label for="_user_input">用户名:</label><input id="_user_input"readonly="readonly"type="text"></div></div><div class="alert-inline"><div><label for="_project_id_input">项目I D:</label><input id="_project_id_input"readonly="readonly"type="text"></div></div><div class="alert-inline"><div><label for="_project_name_input">项目名称:</label><input id="_project_name_input"readonly="readonly"type="text"></div></div><div class="alert-inline"><div><label for="_area_input">打卡地区:</label><input id="_area_input"readonly="readonly"type="text"></div></div><div class="alert-inline"><div><label for="_device_input">设备信息:</label><input id="_device_input"readonly="readonly"type="text"></div></div></div></div><div class="wrapper"><div class="main-container"><div class="searched-jobs"><div class="searched-bar"><div class="searched-show">打卡记录</div><!--<button class="search-button">餐补<span class="canbu-span"></span></button>--></div><div class="job-cards"></div></div></div></div><script src="./coco-message.js"></script><script src="./jquery.min.js"></script><script src="./script.js"></script></div></body></html>
|
||||||
|
|||||||
@@ -105,7 +105,15 @@ function loadDakaList() {
|
|||||||
dateBeginTimeMap[signlog.yearmonth] = (signlog.begin_time == null ? "未打卡" : signlog.begin_time.substr(11, 5));
|
dateBeginTimeMap[signlog.yearmonth] = (signlog.begin_time == null ? "未打卡" : signlog.begin_time.substr(11, 5));
|
||||||
dateEndTimeMap[signlog.yearmonth] = (signlog.end_time == null ? "未打卡" : signlog.end_time.substr(11, 5));
|
dateEndTimeMap[signlog.yearmonth] = (signlog.end_time == null ? "未打卡" : signlog.end_time.substr(11, 5));
|
||||||
index++;
|
index++;
|
||||||
$('.job-cards').append('<div class="job-card">' +
|
let beginWarn = (signlog.begin_time != null && signlog.begin_time.substr(11, 5) > '09:30')
|
||||||
|
let endWarn = (signlog.end_time != null && signlog.end_time.substr(11, 5) < '18:30')
|
||||||
|
let buqianWarn = (signlog.actual_area_begin === '补签卡' || signlog.actual_area_end === '补签卡')
|
||||||
|
let weidakaWarn = (signlog.begin_time == null || signlog.end_time == null)
|
||||||
|
|
||||||
|
$('.job-cards').append('<div class="job-card ' +
|
||||||
|
(beginWarn || endWarn || weidakaWarn || buqianWarn ? 'rainbow' : '') + '" '+
|
||||||
|
// (beginWarn || endWarn || weidakaWarn || buqianWarn ? 'style="border: 8px; border-color: #ff8611; border-radius: 8px; border-style: solid;"' : "") +
|
||||||
|
'>' +
|
||||||
'<div class="job-card-title">' + (nowDate === signlog.yearmonth ? "今天" : signlog.yearmonth) + '</div>' +
|
'<div class="job-card-title">' + (nowDate === signlog.yearmonth ? "今天" : signlog.yearmonth) + '</div>' +
|
||||||
'<div class="job-card-subtitle">' +
|
'<div class="job-card-subtitle">' +
|
||||||
signlog.area_id +
|
signlog.area_id +
|
||||||
@@ -113,15 +121,23 @@ function loadDakaList() {
|
|||||||
'<div class="job-detail-buttons">' +
|
'<div class="job-detail-buttons">' +
|
||||||
'<button class="search-buttons detail-button">' + (signlog.begin_time == null ? "未打卡" : signlog.begin_time.substr(11, 5)) + '</button>' +
|
'<button class="search-buttons detail-button">' + (signlog.begin_time == null ? "未打卡" : signlog.begin_time.substr(11, 5)) + '</button>' +
|
||||||
'<button class="search-buttons detail-button">' + (signlog.end_time == null ? "未打卡" : signlog.end_time.substr(11, 5)) + '</button>' +
|
'<button class="search-buttons detail-button">' + (signlog.end_time == null ? "未打卡" : signlog.end_time.substr(11, 5)) + '</button>' +
|
||||||
(signlog.autoDakaBeginTime == null ? "" : '<br><button class="search-buttons detail-button">定时上班卡时间: ' + signlog.autoDakaBeginTime + '</button>') +
|
(signlog.autoDakaBeginTime == null ? "" : '<button class="search-buttons detail-button" style="font-size: 10px">定时上班卡时间: ' + signlog.autoDakaBeginTime + '</button>') +
|
||||||
(signlog.autoDakaEndTime == null ? "" : '<button class="search-buttons detail-button">定时下班卡时间: ' + signlog.autoDakaEndTime + '</button>') +
|
(signlog.autoDakaEndTime == null ? "" : '<button class="search-buttons detail-button" style="font-size: 10px">定时下班卡时间: ' + signlog.autoDakaEndTime + '</button>') +
|
||||||
(signlog.end_time != null && signlog.end_time.substr(11, 5) > "21:00" ? '<button class="search-buttons detail-button">餐补</button>' : '') +
|
// (signlog.end_time != null && signlog.end_time.substr(11, 5) > "21:00" ? '<button class="search-buttons detail-button">餐补</button>' : '') +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
(index <= 3 ? '<div class="job-card-buttons">' +
|
(index <= 3 ? '<div class="job-card-buttons">' +
|
||||||
'<button class="search-buttons card-buttons daka-buttons"' +
|
'<button class="search-buttons card-buttons daka-buttons"' +
|
||||||
'">打卡</button>' +
|
'">打卡</button>' +
|
||||||
'<button class="search-buttons card-buttons auto-daka-buttons">自动补卡</button>' +
|
'<button class="search-buttons card-buttons auto-daka-buttons">自动补卡</button>' +
|
||||||
'</div>' : '') +
|
'</div>' : '') +
|
||||||
|
(index > 3 ?
|
||||||
|
'<div class="job-card-subtitle">' +
|
||||||
|
signlog.actual_area_begin +
|
||||||
|
'</div>' +
|
||||||
|
(signlog.actual_area_begin !== signlog.actual_area_end ? '<div class="job-card-subtitle">' +
|
||||||
|
signlog.actual_area_end +
|
||||||
|
'</div>' : '')
|
||||||
|
: '') +
|
||||||
'</div>'
|
'</div>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
--border-color: #d8d8d8;
|
--border-color: #d8d8d8;
|
||||||
--alert-bg-color: #e8f2ff;
|
--alert-bg-color: #e8f2ff;
|
||||||
--subtitle-color: #83838e;
|
--subtitle-color: #83838e;
|
||||||
|
--subtext-color: #d5d5d5;
|
||||||
--inactive-color: #f0f0f0;
|
--inactive-color: #f0f0f0;
|
||||||
--placeholder-color: #9b9ba5;
|
--placeholder-color: #9b9ba5;
|
||||||
--time-button: #fc5757;
|
--time-button: #fc5757;
|
||||||
@@ -95,7 +96,7 @@ body {
|
|||||||
}
|
}
|
||||||
.dark-mode .detail-button {
|
.dark-mode .detail-button {
|
||||||
background-color: var(--inactive-color);
|
background-color: var(--inactive-color);
|
||||||
color: var(--subtitle-color);
|
color: var(--subtext-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.job {
|
.job {
|
||||||
@@ -188,6 +189,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.user-profile {
|
.user-profile {
|
||||||
|
display: none;
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
@@ -362,6 +364,10 @@ body {
|
|||||||
margin-left: -100px;
|
margin-left: -100px;
|
||||||
margin-top: -100px;
|
margin-top: -100px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
box-shadow: 0px 2px 4px hsl(0 0% 0% / 25%);
|
||||||
|
animation: border-angle-rotate 2s infinite linear;
|
||||||
|
border: 0.5rem solid transparent;
|
||||||
|
border-radius: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.userinfo_dialog {
|
.userinfo_dialog {
|
||||||
@@ -374,6 +380,10 @@ body {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
margin: auto 0;
|
margin: auto 0;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
|
box-shadow: 0px 2px 4px hsl(0 0% 0% / 25%);
|
||||||
|
animation: border-angle-rotate 2s infinite linear;
|
||||||
|
border: 0.5rem solid transparent;
|
||||||
|
border-radius: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.userinfo_dialog > div > .alert-inline {
|
.userinfo_dialog > div > .alert-inline {
|
||||||
@@ -389,12 +399,13 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body > div > div.userinfo_dialog > div > div > div {
|
body > div > div.userinfo_dialog > div > div > div {
|
||||||
display: inline-flex;
|
display: inline-grid;
|
||||||
|
grid-template-columns: 20% 80%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#username {
|
#username {
|
||||||
padding: 11px;
|
padding: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -437,8 +448,12 @@ body > div > div.userinfo_dialog > div > div > div {
|
|||||||
color: var(--body-color)
|
color: var(--body-color)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#username {
|
||||||
|
/*width: 64px;*/
|
||||||
|
}
|
||||||
|
|
||||||
body > div > div.userinfo_dialog > div > div > div input {
|
body > div > div.userinfo_dialog > div > div > div input {
|
||||||
width: 85%;
|
width: 100%;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
display: block;
|
display: block;
|
||||||
border-radius: 8px 8px 8px 8px;
|
border-radius: 8px 8px 8px 8px;
|
||||||
@@ -468,7 +483,7 @@ body > div > div.userinfo_dialog > div > div > div input {
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin-top: 14px;
|
margin-top: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.job-wrapper {
|
.job-wrapper {
|
||||||
@@ -598,7 +613,7 @@ body > div > div.userinfo_dialog > div > div > div input {
|
|||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
/*padding-right: 80px;*/
|
/*padding-right: 80px;*/
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(6, 1fr);
|
||||||
grid-column-gap: 25px;
|
grid-column-gap: 25px;
|
||||||
grid-row-gap: 25px;
|
grid-row-gap: 25px;
|
||||||
-webkit-animation: slideY .6s both;
|
-webkit-animation: slideY .6s both;
|
||||||
@@ -637,18 +652,51 @@ body > div > div.userinfo_dialog > div > div > div input {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@property --border-angle {
|
||||||
|
syntax: "<angle>";
|
||||||
|
initial-value: 0deg;
|
||||||
|
inherits: false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@keyframes border-angle-rotate {
|
||||||
|
from { --border-angle: 0deg; }
|
||||||
|
to { --border-angle: 360deg; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.rainbow {
|
||||||
|
background: linear-gradient(var(--header-bg-color), var(--header-bg-color)) padding-box,
|
||||||
|
conic-gradient(
|
||||||
|
from var(--border-angle),
|
||||||
|
oklch(100% 100% 0deg),
|
||||||
|
oklch(100% 100% 45deg),
|
||||||
|
oklch(100% 100% 90deg),
|
||||||
|
oklch(100% 100% 135deg),
|
||||||
|
oklch(100% 100% 180deg),
|
||||||
|
oklch(100% 100% 225deg),
|
||||||
|
oklch(100% 100% 270deg),
|
||||||
|
oklch(100% 100% 315deg),
|
||||||
|
oklch(100% 100% 360deg)
|
||||||
|
)
|
||||||
|
border-box;
|
||||||
|
}
|
||||||
|
|
||||||
.job-card {
|
.job-card {
|
||||||
padding: 20px 16px;
|
padding: 20px 16px;
|
||||||
background-color: var(--header-bg-color);
|
background-color: var(--header-bg-color);
|
||||||
border-radius: 8px;
|
border-radius: 16px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
-webkit-transition: .2s;
|
-webkit-transition: .2s;
|
||||||
transition: .2s;
|
transition: .2s;
|
||||||
|
box-shadow: 0px 2px 4px hsl(0 0% 0% / 25%);
|
||||||
|
animation: border-angle-rotate 2s infinite linear;
|
||||||
|
border: 0.5rem solid transparent;
|
||||||
}
|
}
|
||||||
.job-card:hover {
|
.job-card:hover {
|
||||||
-webkit-transform: scale(1.02);
|
-webkit-transform: scale(1.02);
|
||||||
transform: scale(1.02);
|
transform: scale(1.02);
|
||||||
}
|
}
|
||||||
|
|
||||||
.job-card svg {
|
.job-card svg {
|
||||||
width: 46px;
|
width: 46px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
@@ -713,13 +761,22 @@ body > div > div.userinfo_dialog > div > div > div input {
|
|||||||
padding: 6px 8px;
|
padding: 6px 8px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
.detail-button + .detail-button {
|
/*.detail-button + .detail-button {*/
|
||||||
margin-left: 4px;
|
/* margin-left: 4px;*/
|
||||||
|
/*}*/
|
||||||
|
|
||||||
|
.job-detail-buttons {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
grid-column-gap: 10px;
|
||||||
|
grid-row-gap: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.job-card-buttons {
|
.job-card-buttons {
|
||||||
display: -webkit-box;
|
display: grid;
|
||||||
display: flex;
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
grid-column-gap: 10px;
|
||||||
|
grid-row-gap: 25px;
|
||||||
-webkit-box-align: center;
|
-webkit-box-align: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
-webkit-box-pack: justify;
|
-webkit-box-pack: justify;
|
||||||
@@ -739,14 +796,15 @@ body > div > div.userinfo_dialog > div > div > div input {
|
|||||||
.card-buttons,
|
.card-buttons,
|
||||||
.card-buttons-msg {
|
.card-buttons-msg {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
width: 100%;
|
min-width: 46%;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-buttons {
|
/*.card-buttons {*/
|
||||||
margin-right: 12px;
|
/* margin-right: 4%;*/
|
||||||
}
|
/* margin-left: 4%;*/
|
||||||
|
/*}*/
|
||||||
.card-buttons-msg {
|
.card-buttons-msg {
|
||||||
background-color: var(--inactive-color);
|
background-color: var(--inactive-color);
|
||||||
color: var(--subtitle-color);
|
color: var(--subtitle-color);
|
||||||
|
|||||||
Reference in New Issue
Block a user