🆗 修改打卡时取项目信息的位置,从dakajson根元素获取,而不是从打卡记录中
🆗 修改多个项目打卡时,取最后一个项目打卡信息
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package com.pomelotea.hoperun.sign.api
|
package com.pomelotea.hoperun.sign.api
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON
|
import com.alibaba.fastjson.JSON
|
||||||
import com.alibaba.fastjson.JSONArray
|
|
||||||
import com.alibaba.fastjson.JSONObject
|
import com.alibaba.fastjson.JSONObject
|
||||||
import com.alibaba.fastjson.TypeReference
|
import com.alibaba.fastjson.TypeReference
|
||||||
import com.pomelotea.hoperun.sign.config.HoperunUserConfig
|
import com.pomelotea.hoperun.sign.config.HoperunUserConfig
|
||||||
@@ -160,15 +159,6 @@ class HoperunSignController(
|
|||||||
return sessionMap.get(employeeNo)
|
return sessionMap.get(employeeNo)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getUsernameAutoLogin(employeeNo: String): String? {
|
|
||||||
val userConfig = hoperunUserConfig.userConfigMap.get(employeeNo)
|
|
||||||
if (userConfig?.username == null) {
|
|
||||||
login(employeeNo)
|
|
||||||
}
|
|
||||||
return hoperunUserConfig.userConfigMap.get(employeeNo)?.username
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private fun getUserConfig(employeeNo: String): UserConfig? {
|
private fun getUserConfig(employeeNo: String): UserConfig? {
|
||||||
val userConfig = hoperunUserConfig.userConfigMap.get(employeeNo)
|
val userConfig = hoperunUserConfig.userConfigMap.get(employeeNo)
|
||||||
if (userConfig?.username == null) {
|
if (userConfig?.username == null) {
|
||||||
@@ -267,7 +257,7 @@ class HoperunSignController(
|
|||||||
val attendancesDetailResponse = client.newCall(attendancesDetailRequest).execute()
|
val attendancesDetailResponse = client.newCall(attendancesDetailRequest).execute()
|
||||||
val bodyString = attendancesDetailResponse.body?.string()
|
val bodyString = attendancesDetailResponse.body?.string()
|
||||||
val dakaJsonArray = JSONObject.parseArray(bodyString)
|
val dakaJsonArray = JSONObject.parseArray(bodyString)
|
||||||
val dakaInfo = dakaJsonArray.getJSONObject(0)
|
val dakaInfo = dakaJsonArray.getJSONObject(dakaJsonArray.size - 1)
|
||||||
val dakaList = dakaInfo.getJSONArray("list")
|
val dakaList = dakaInfo.getJSONArray("list")
|
||||||
var lastDakaInfo = dakaList.getJSONObject(dakaList.size - 1)
|
var lastDakaInfo = dakaList.getJSONObject(dakaList.size - 1)
|
||||||
val userConfig: UserConfig = hoperunUserConfig.userConfigMap.get(employeeNo) ?: UserConfig()
|
val userConfig: UserConfig = hoperunUserConfig.userConfigMap.get(employeeNo) ?: UserConfig()
|
||||||
@@ -291,13 +281,13 @@ class HoperunSignController(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (userConfig.projectcode == null) {
|
if (userConfig.projectcode == null) {
|
||||||
userConfig.projectcode = lastDakaInfo.getString("project_id")
|
userConfig.projectcode = dakaInfo.getString("pro_id")
|
||||||
}
|
}
|
||||||
if (userConfig.projectname == null) {
|
if (userConfig.projectname == null) {
|
||||||
userConfig.projectname = lastDakaInfo.getString("projectname")
|
userConfig.projectname = dakaInfo.getString("pro_name")
|
||||||
}
|
}
|
||||||
if (userConfig.project_id == null) {
|
if (userConfig.project_id == null) {
|
||||||
userConfig.project_id = lastDakaInfo.getString("project_id")
|
userConfig.project_id = dakaInfo.getString("pro_id")
|
||||||
}
|
}
|
||||||
hoperunUserConfig.addUserConfig(
|
hoperunUserConfig.addUserConfig(
|
||||||
employeeNo, userConfig
|
employeeNo, userConfig
|
||||||
|
|||||||
Reference in New Issue
Block a user