Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Z
zlmy-cloud
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zlmy
zlmy-cloud
Commits
3f4bcb82
Commit
3f4bcb82
authored
Aug 19, 2025
by
鲁鸿波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
安全风险分析阶段多条数据报错bug
parent
44e364a2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
11 deletions
+29
-11
THazardAssessmentController.java
...module/hazard/controller/THazardAssessmentController.java
+3
-8
THazardAssessmentService.java
...estor/module/hazard/service/THazardAssessmentService.java
+1
-1
THazardAssessmentServiceImpl.java
...ule/hazard/service/impl/THazardAssessmentServiceImpl.java
+25
-2
No files found.
zlmy-modules/zlmy-boot/src/main/java/com/testor/module/hazard/controller/THazardAssessmentController.java
View file @
3f4bcb82
...
...
@@ -11,12 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
lombok.extern.slf4j.Slf4j
;
import
com.tongtech.tfw.backend.core.helper.StringHelper
;
import
com.tongtech.tfw.backend.core.helper.ObjectHelper
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.tongtech.tfw.backend.common.biz.constants.BizConstants
;
...
...
@@ -61,9 +56,9 @@ public class THazardAssessmentController extends SuperController
@ApiOperation
(
value
=
"获取 安全风险分析 "
,
notes
=
"Get THazardAssessment By Id"
)
@GetMapping
(
value
=
"/get"
)
public
BaseResponse
<
THazardAssessmentDTO
>
getById
(
String
workTypeId
,
String
planId
){
public
BaseResponse
<
THazardAssessmentDTO
>
getById
(
@RequestParam
(
value
=
"workTypeId"
,
required
=
false
)
String
workTypeId
,
@RequestParam
(
value
=
"planId"
,
required
=
false
)
String
planId
,
@RequestParam
(
value
=
"completeTime"
,
required
=
false
)
String
completeTime
){
BaseResponse
<
THazardAssessmentDTO
>
baseResponse
=
new
BaseResponse
<>();
THazardAssessmentDTO
data
=
tHazardAssessmentService
.
getDetailsById
(
workTypeId
,
planId
);
THazardAssessmentDTO
data
=
tHazardAssessmentService
.
getDetailsById
(
workTypeId
,
planId
,
completeTime
);
baseResponse
.
setData
(
data
);
return
baseResponse
;
}
...
...
zlmy-modules/zlmy-boot/src/main/java/com/testor/module/hazard/service/THazardAssessmentService.java
View file @
3f4bcb82
...
...
@@ -16,7 +16,7 @@ public interface THazardAssessmentService extends SuperService<THazardAssessment
THazardAssessment
addEntity
(
THazardAssessmentDTO
tHazardAssessmentDTO
);
THazardAssessmentDTO
getDetailsById
(
String
typeId
,
String
planId
);
THazardAssessmentDTO
getDetailsById
(
String
typeId
,
String
planId
,
String
completeTime
);
void
initData
(
String
workTypes
,
THazardWorkPlan
tHazardWorkPlan
);
}
zlmy-modules/zlmy-boot/src/main/java/com/testor/module/hazard/service/impl/THazardAssessmentServiceImpl.java
View file @
3f4bcb82
...
...
@@ -18,6 +18,8 @@ import com.tongtech.tfw.backend.common.models.supers.SuperServiceImpl;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.List
;
/**
...
...
@@ -53,9 +55,30 @@ public class THazardAssessmentServiceImpl extends SuperServiceImpl<THazardAssess
}
@Override
public
THazardAssessmentDTO
getDetailsById
(
String
typeId
,
String
planId
)
{
THazardAssessment
tHazardAssessment
=
this
.
getOne
(
new
LambdaQueryWrapper
<
THazardAssessment
>().
eq
(
THazardAssessment:
:
getWorkTypeId
,
typeId
).
eq
(
THazardAssessment:
:
getPlanId
,
planId
));
public
THazardAssessmentDTO
getDetailsById
(
String
typeId
,
String
planId
,
String
completeTime
)
{
THazardAssessment
tHazardAssessment
=
null
;
if
(
StringUtils
.
isEmpty
(
completeTime
)){
tHazardAssessment
=
this
.
getOne
(
new
LambdaQueryWrapper
<
THazardAssessment
>().
eq
(
THazardAssessment:
:
getWorkTypeId
,
typeId
).
eq
(
THazardAssessment:
:
getPlanId
,
planId
));
}
else
{
tHazardAssessment
=
this
.
getOne
(
new
LambdaQueryWrapper
<
THazardAssessment
>().
eq
(
THazardAssessment:
:
getWorkTypeId
,
typeId
).
eq
(
THazardAssessment:
:
getPlanId
,
planId
).
eq
(
THazardAssessment:
:
getCreateDate
,
completeTime
));
}
if
(
StringUtils
.
isNull
(
tHazardAssessment
))
{
if
(!
StringUtils
.
isEmpty
(
completeTime
)){
//可能计算的时候会有时间上的差异,减1后继续查询一次
//completeTime: 2025-08-19 08:57:04
//实际值2025-08-19 08:57:03
// 定义时间格式
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
// 将字符串解析为LocalDateTime对象
LocalDateTime
dateTime
=
LocalDateTime
.
parse
(
completeTime
,
formatter
);
// 减去1秒
LocalDateTime
newDateTime
=
dateTime
.
minusSeconds
(
1
);
// 格式化为字符串
completeTime
=
newDateTime
.
format
(
formatter
);
tHazardAssessment
=
this
.
getOne
(
new
LambdaQueryWrapper
<
THazardAssessment
>().
eq
(
THazardAssessment:
:
getWorkTypeId
,
typeId
).
eq
(
THazardAssessment:
:
getPlanId
,
planId
).
eq
(
THazardAssessment:
:
getCreateDate
,
completeTime
));
}
else
{
return
null
;
}
return
null
;
}
THazardAssessmentDTO
tHazardAssessmentDTO
=
BeanHelper
.
beanToBean
(
tHazardAssessment
,
THazardAssessmentDTO
.
class
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment