🆗 修改打卡时取项目信息的位置,从dakajson根元素获取,而不是从打卡记录中
🆗 修改多个项目打卡时,取最后一个项目打卡信息 🆗 如果最近一次打卡结束没有设备信息,则从最新一次开始打卡获取
This commit is contained in:
@@ -276,6 +276,9 @@ class HoperunSignController(
|
||||
if (lastDakaInfo.getString("actual_area_end") != null) {
|
||||
val area: String = lastDakaInfo.getString("actual_area_end")
|
||||
userConfig.device = area.substring(area.lastIndexOf("Qing") + 13)
|
||||
} else if (lastDakaInfo.getString("actual_area_begin") != null) {
|
||||
val area: String = lastDakaInfo.getString("actual_area_begin")
|
||||
userConfig.device = area.substring(area.lastIndexOf("Qing") + 13)
|
||||
} else {
|
||||
userConfig.device = null
|
||||
}
|
||||
|
||||
@@ -11,15 +11,9 @@ import org.springframework.core.annotation.Order
|
||||
import org.springframework.http.HttpStatus
|
||||
import org.springframework.validation.BindException
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.ResponseBody
|
||||
import org.springframework.web.bind.annotation.ResponseStatus
|
||||
import org.springframework.web.bind.annotation.*
|
||||
import org.springframework.web.client.HttpServerErrorException
|
||||
import org.springframework.web.servlet.NoHandlerFoundException
|
||||
import org.springframework.web.servlet.view.RedirectView
|
||||
import java.net.InetAddress
|
||||
import java.net.UnknownHostException
|
||||
import java.text.MessageFormat
|
||||
@@ -178,7 +172,6 @@ open class ExtendExceptionHandler(errorAttributes: ErrorAttributes) : AbstractEr
|
||||
|
||||
/**
|
||||
* 请求校验缺少必要参数
|
||||
* @param request HttpServletRequest 请求
|
||||
* @param response HttpServletResponse 响应
|
||||
* @param ex Exception 服务异常
|
||||
* @throws Exception 方法抛出异常
|
||||
@@ -186,7 +179,7 @@ open class ExtendExceptionHandler(errorAttributes: ErrorAttributes) : AbstractEr
|
||||
@ResponseStatus(code = HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(MethodArgumentNotValidException::class)
|
||||
@Throws(Exception::class)
|
||||
fun methodArgumentNotValidException(request: HttpServletRequest, response: HttpServletResponse, ex: MethodArgumentNotValidException) {
|
||||
fun methodArgumentNotValidException(response: HttpServletResponse, ex: MethodArgumentNotValidException) {
|
||||
val msg = StringBuilder()
|
||||
ex.bindingResult.fieldErrors.forEach {
|
||||
msg.append(
|
||||
@@ -204,7 +197,6 @@ open class ExtendExceptionHandler(errorAttributes: ErrorAttributes) : AbstractEr
|
||||
|
||||
/**
|
||||
* 参数绑定请求实体错误
|
||||
* @param request HttpServletRequest 请求
|
||||
* @param response HttpServletResponse 响应
|
||||
* @param ex Exception 服务异常
|
||||
* @throws Exception 方法抛出异常
|
||||
@@ -212,7 +204,7 @@ open class ExtendExceptionHandler(errorAttributes: ErrorAttributes) : AbstractEr
|
||||
@ResponseStatus(code = HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(BindException::class)
|
||||
@Throws(Exception::class)
|
||||
fun bindException(request: HttpServletRequest, response: HttpServletResponse, ex: BindException) {
|
||||
fun bindException(response: HttpServletResponse, ex: BindException) {
|
||||
val msg = StringBuilder()
|
||||
ex.bindingResult.fieldErrors.forEach {
|
||||
msg.append(
|
||||
@@ -250,8 +242,8 @@ open class ExtendExceptionHandler(errorAttributes: ErrorAttributes) : AbstractEr
|
||||
@ResponseStatus(code = HttpStatus.NOT_FOUND)
|
||||
@RequestMapping(produces = ["text/html"])
|
||||
@Throws(Exception::class)
|
||||
fun handleHtml(request: HttpServletRequest, response: HttpServletResponse): RedirectView {
|
||||
return RedirectView("/404")
|
||||
fun handleHtml(response: HttpServletResponse) {
|
||||
response.sendRedirect("/404.html")
|
||||
}
|
||||
|
||||
|
||||
@@ -292,13 +284,13 @@ open class ExtendExceptionHandler(errorAttributes: ErrorAttributes) : AbstractEr
|
||||
var ipAddress: String?
|
||||
return try {
|
||||
ipAddress = request.getHeader("x-forwarded-for")
|
||||
if (ipAddress == null || ipAddress.length == 0 || "unknown".equals(ipAddress, ignoreCase = true)) {
|
||||
if (ipAddress.isNullOrEmpty() || "unknown".equals(ipAddress, ignoreCase = true)) {
|
||||
ipAddress = request.getHeader("Proxy-Client-IP")
|
||||
}
|
||||
if (ipAddress == null || ipAddress.length == 0 || "unknown".equals(ipAddress, ignoreCase = true)) {
|
||||
if (ipAddress.isNullOrEmpty() || "unknown".equals(ipAddress, ignoreCase = true)) {
|
||||
ipAddress = request.getHeader("WL-Proxy-Client-IP")
|
||||
}
|
||||
if (ipAddress == null || ipAddress.length == 0 || "unknown".equals(ipAddress, ignoreCase = true)) {
|
||||
if (ipAddress.isNullOrEmpty() || "unknown".equals(ipAddress, ignoreCase = true)) {
|
||||
ipAddress = request.remoteAddr
|
||||
// 本机访问, 获取网卡地址
|
||||
if (ipAddress == "127.0.0.1" || ipAddress == "0:0:0:0:0:0:0:1") {
|
||||
|
||||
Reference in New Issue
Block a user