🆗 修改打卡时取项目信息的位置,从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") {
|
||||
|
||||
56
src/main/resources/static/404.html
Normal file
56
src/main/resources/static/404.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<title>404 Not Found</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style>
|
||||
body {
|
||||
color: #A1A2AF;
|
||||
font-family: "Microsoft YaHei", "Segoe UI", "Lucida Grande", Helvetica,
|
||||
Arial, sans-serif;
|
||||
}
|
||||
.layout {
|
||||
width: 1190px;
|
||||
margin: 150px auto;
|
||||
}
|
||||
.err {
|
||||
position: relative;
|
||||
width: 568px;
|
||||
height: 306px;
|
||||
margin: 100px auto 40px;
|
||||
background: url("/img/airplane-404page.jpg") no-repeat 21px 18px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.err_text {
|
||||
position: absolute;
|
||||
top: 246px;
|
||||
left: 239px;
|
||||
}
|
||||
.err_back {
|
||||
position: absolute;
|
||||
top: 257px;
|
||||
left: 353px;
|
||||
width: 154px;
|
||||
height: 38px;
|
||||
text-indent: -999px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="layout">
|
||||
<div class="main">
|
||||
<div class="err">
|
||||
<p class="err_text">
|
||||
非常抱歉,您访
|
||||
<br>
|
||||
问的页面不存在
|
||||
</p>
|
||||
<a href="/index.html" class="err_back">返回首页</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
src/main/resources/static/img/airplane-404page.jpg
Normal file
BIN
src/main/resources/static/img/airplane-404page.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
Reference in New Issue
Block a user