🆗 由于默认密码变更,已无法后台登录,改为使用jsessionID登录
🆗 兼容新的打卡 🆗 增加自动打卡开关
This commit is contained in:
@@ -12,6 +12,7 @@ import com.pomelotea.hoperun.sign.config.HoperunUserConfig.getUserConfig
|
||||
import com.pomelotea.hoperun.sign.config.HoperunUserConfig.userConfigMap
|
||||
import com.pomelotea.hoperun.sign.config.UserConfig
|
||||
import com.pomelotea.hoperun.sign.scheduler.AutoDakaScheduler
|
||||
import com.pomelotea.hoperun.sign.scheduler.AutoDakaScheduler.Companion.dakaQueue
|
||||
import okhttp3.FormBody
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.Request
|
||||
@@ -143,6 +144,12 @@ class HoperunSignController {
|
||||
queryMonthAttData(employeeNo, jsessionId, getLastDateyyyy_MM() + "-01")
|
||||
val lastMonthAttLogs = lastMonthAttList.sortedByDescending { it.yearmonth }.filter { it.dateType == "1" }
|
||||
monthAttResult.addAll(lastMonthAttLogs)
|
||||
val monthAttLog = monthAttResult.find { it.yearmonth == getNowDateyyyy_MM_dd() }
|
||||
val autoDaka = dakaQueue.filter { it.dakaDate == getNowDateyyyy_MM_dd() }.findLast { it.employeeNo == employeeNo }
|
||||
if (autoDaka != null && monthAttLog != null) {
|
||||
monthAttLog.autoDakaBeginTime = autoDaka.beginTime
|
||||
monthAttLog.autoDakaEndTime = autoDaka.endTime
|
||||
}
|
||||
return monthAttResult
|
||||
}
|
||||
|
||||
@@ -278,7 +285,9 @@ data class MonthAttLog(
|
||||
var project_id: String? = null,
|
||||
var projectcode: String? = null,
|
||||
var staff_code: String? = null,
|
||||
var yearmonth: String? = null
|
||||
var yearmonth: String? = null,
|
||||
var autoDakaBeginTime: String? = null,
|
||||
var autoDakaEndTime: String? = null,
|
||||
)
|
||||
|
||||
data class HoperunDakaRequest(
|
||||
|
||||
@@ -25,6 +25,10 @@ class AutoDakaScheduler {
|
||||
val outFile = File("./daka.log")
|
||||
val bw: BufferedWriter = BufferedWriter(OutputStreamWriter(outFile.outputStream()))
|
||||
|
||||
val logFile = File("./scheduler.log")
|
||||
val logBw: BufferedWriter = BufferedWriter(OutputStreamWriter(logFile.outputStream()))
|
||||
|
||||
|
||||
val timeThreadPool: ScheduledExecutorService = Executors.newScheduledThreadPool(1)
|
||||
val schedulerThreadPool: ScheduledExecutorService = Executors.newScheduledThreadPool(10)
|
||||
|
||||
@@ -39,18 +43,16 @@ class AutoDakaScheduler {
|
||||
fun addAutoDakaScheduled(dakaDate: String = getNowDateyyyy_MM_dd()) {
|
||||
// 调休的工作日
|
||||
if (isNeedDaka(dakaDate)) {
|
||||
bw.use {
|
||||
HoperunUserConfig.userConfigMap.forEach { (k, v) ->
|
||||
if (v.autoDaka) {
|
||||
// 没有当日的打卡信息才插入
|
||||
var daka = dakaQueue.find { it.dakaDate == dakaDate && it.employeeNo == v.employeeNo }
|
||||
if (daka == null) {
|
||||
daka = generateDakaInfo(v, dakaDate)
|
||||
dakaQueue.add(daka)
|
||||
}
|
||||
bw.write("${v.username},${daka.toCsv()}")
|
||||
bw.newLine()
|
||||
HoperunUserConfig.userConfigMap.forEach { (_, v) ->
|
||||
if (v.autoDaka) {
|
||||
// 没有当日的打卡信息才插入
|
||||
var daka = dakaQueue.find { it.dakaDate == dakaDate && it.employeeNo == v.employeeNo }
|
||||
if (daka == null) {
|
||||
daka = generateDakaInfo(v, dakaDate)
|
||||
dakaQueue.add(daka)
|
||||
}
|
||||
bw.write("${v.username},${daka.toCsv()}")
|
||||
bw.newLine()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,11 +77,13 @@ class AutoDakaScheduler {
|
||||
|
||||
private fun beginDaka(daka: Daka) {
|
||||
// println("begin:${daka.toCsv()}")
|
||||
logBw.write("execute begin sign: ${daka.toCsv()}")
|
||||
beginTime(employeeNo = daka.employeeNo, date = daka.dakaDate, time = daka.beginTime)
|
||||
}
|
||||
|
||||
private fun endDaka(daka: Daka) {
|
||||
// println("end:${daka.toCsv()}")
|
||||
logBw.write("execute end sign: ${daka.toCsv()}")
|
||||
endTime(employeeNo = daka.employeeNo, date = daka.dakaDate, time = daka.beginTime)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user