Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
bfc0baad
Commit
bfc0baad
authored
Nov 06, 2023
by
H2T
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
警情修改记录时更新源数据
parent
5fc2edf6
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
10 deletions
+81
-10
AlertFormRecordDto.java
...amos/boot/module/elevator/api/dto/AlertFormRecordDto.java
+3
-0
AlertFormRecord.java
...amos/boot/module/elevator/api/entity/AlertFormRecord.java
+6
-0
AlertFormRecordMapper.xml
...3-api/src/main/resources/mapper/AlertFormRecordMapper.xml
+2
-2
AlertFormRecordController.java
...le/elevator/biz/controller/AlertFormRecordController.java
+7
-4
AlertFormRecordServiceImpl.java
...ator/flc/biz/service/impl/AlertFormRecordServiceImpl.java
+63
-4
No files found.
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-api/src/main/java/com/yeejoin/amos/boot/module/elevator/api/dto/AlertFormRecordDto.java
View file @
bfc0baad
...
...
@@ -52,6 +52,9 @@ public class AlertFormRecordDto extends BaseDto {
@ApiModelProperty
(
value
=
"被困时间"
)
private
Date
trappedTime
;
@ApiModelProperty
(
value
=
"更新时间"
)
private
Date
updateTime
;
@ApiModelProperty
(
value
=
"事件描述"
)
private
String
description
;
...
...
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-api/src/main/java/com/yeejoin/amos/boot/module/elevator/api/entity/AlertFormRecord.java
View file @
bfc0baad
...
...
@@ -82,6 +82,12 @@ public class AlertFormRecord extends BaseEntity {
private
Date
trappedTime
;
/**
* 更新时间
*/
@TableField
(
"update_time"
)
private
Date
updateTime
;
/**
* 事件描述
*/
@TableField
(
"description"
)
...
...
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-api/src/main/resources/mapper/AlertFormRecordMapper.xml
View file @
bfc0baad
...
...
@@ -4,12 +4,12 @@
<select
id=
"getRecordByCalledId"
resultType=
"com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormRecord"
>
SELECT *
SELECT
afr.
*
FROM tz_alert_form_record afr
WHERE afr.is_delete = 0
<if
test=
"TzCarcylRegDto!=null and TzCarcylRegDto!='' "
>
AND afr.alert_called_id = #{alertCalledId}
</if>
ORDER BY afr.
rec_date
ORDER BY afr.
update_time desc
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/controller/AlertFormRecordController.java
View file @
bfc0baad
...
...
@@ -7,7 +7,10 @@ import com.yeejoin.amos.boot.module.elevator.api.service.IAlertFormRecordService
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
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.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
...
...
@@ -30,7 +33,7 @@ public class AlertFormRecordController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/saveRecord"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增警情接警填报记录"
,
notes
=
"新增警情接警填报记录"
)
public
ResponseModel
<
Object
>
save
Mobile
(
@RequestBody
Map
<
String
,
AlertFormRecordDto
>
map
)
{
public
ResponseModel
<
Object
>
save
Record
(
@RequestBody
Map
<
String
,
AlertFormRecordDto
>
map
)
{
if
(
ObjectUtil
.
isNotEmpty
(
map
.
get
(
"oldData"
))
&&
ObjectUtil
.
isNotEmpty
(
map
.
get
(
"newData"
)))
{
return
ResponseHelper
.
buildResponse
(
iAlertFormRecordService
.
saveAlertFormRecord
(
map
));
...
...
@@ -43,8 +46,8 @@ public class AlertFormRecordController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/recordByCalledId"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"根据警情id查询修改记录"
,
notes
=
"根据警情id查询修改记录"
)
public
ResponseModel
<
Object
>
saveMobile
(
@RequestParam
(
"alertCalledId"
)
String
alertCalledId
)
{
return
ResponseHelper
.
buildResponse
(
iAlertFormRecordService
.
allAlertFormRecordByCalledId
(
Long
.
valueOf
(
alertCalledId
)));
public
ResponseModel
<
Object
>
recordByCalledId
(
@RequestBody
Map
<
String
,
String
>
map
)
{
return
ResponseHelper
.
buildResponse
(
iAlertFormRecordService
.
allAlertFormRecordByCalledId
(
Long
.
valueOf
(
map
.
get
(
"alertCalledId"
)
)));
}
}
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/flc/biz/service/impl/AlertFormRecordServiceImpl.java
View file @
bfc0baad
package
com
.
yeejoin
.
amos
.
boot
.
module
.
elevator
.
flc
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil
;
import
com.yeejoin.amos.boot.module.elevator.api.dto.AlertFormRecordDto
;
import
com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormRecord
;
import
com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormValue
;
import
com.yeejoin.amos.boot.module.elevator.api.mapper.AlertFormRecordMapper
;
import
com.yeejoin.amos.boot.module.elevator.api.service.IAlertFormRecordService
;
import
com.yeejoin.amos.boot.module.elevator.biz.service.impl.AlertFormValueServiceImpl
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -13,6 +19,9 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.lang.reflect.Field
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -26,7 +35,30 @@ import java.util.Map;
public
class
AlertFormRecordServiceImpl
extends
BaseService
<
AlertFormRecordDto
,
AlertFormRecord
,
AlertFormRecordMapper
>
implements
IAlertFormRecordService
{
@Autowired
RedisUtils
redisUtils
;
@Autowired
private
AlertFormRecordMapper
alertFormRecordMapper
;
@Autowired
private
AlertFormValueServiceImpl
iAlertFormValueService
;
/**
* 驼峰转下划线
*
* @param str
* @return
*/
public
static
String
convertToUnderline
(
String
str
)
{
StringBuilder
sb
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
str
.
length
();
i
++)
{
char
c
=
str
.
charAt
(
i
);
if
(
Character
.
isUpperCase
(
c
))
{
sb
.
append
(
"_"
).
append
(
Character
.
toLowerCase
(
c
));
}
else
{
sb
.
append
(
c
);
}
}
return
sb
.
toString
();
}
/**
* 保存警情修改记录
...
...
@@ -41,15 +73,42 @@ public class AlertFormRecordServiceImpl extends BaseService<AlertFormRecordDto,
AlertFormRecordDto
oldData
=
map
.
get
(
"oldData"
);
AlertFormRecordDto
newData
=
map
.
get
(
"newData"
);
List
<
AlertFormRecord
>
recordByCalledId
=
alertFormRecordMapper
.
getRecordByCalledId
(
newData
.
getAlertCalledId
());
AlertFormRecord
r
ecord
=
new
AlertFormRecord
();
AlertFormRecord
oldR
ecord
=
new
AlertFormRecord
();
//第一次修改,保存旧记录
if
(
recordByCalledId
.
isEmpty
())
{
BeanUtils
.
copyProperties
(
oldData
,
r
ecord
);
record
.
setRecDat
e
(
oldData
.
getTrappedTime
());
alertFormRecordMapper
.
insert
(
r
ecord
);
BeanUtils
.
copyProperties
(
oldData
,
oldR
ecord
);
oldRecord
.
setUpdateTim
e
(
oldData
.
getTrappedTime
());
alertFormRecordMapper
.
insert
(
oldR
ecord
);
}
AlertFormRecord
record
=
new
AlertFormRecord
();
BeanUtils
.
copyProperties
(
newData
,
record
);
record
.
setUpdateTime
(
new
Date
());
alertFormRecordMapper
.
insert
(
record
);
// 更新警情基本信息
Long
alertCalled
=
record
.
getAlertCalledId
();
LambdaQueryWrapper
<
AlertFormValue
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
AlertFormValue:
:
getAlertCalledId
,
alertCalled
);
// 警情动态表单数据
List
<
AlertFormValue
>
list
=
iAlertFormValueService
.
list
(
queryWrapper
);
HashMap
<
String
,
Object
>
listMap
=
new
HashMap
<>();
list
.
forEach
(
x
->
listMap
.
put
(
x
.
getFieldCode
(),
x
.
getFieldValue
()));
for
(
Field
field
:
record
.
getClass
().
getDeclaredFields
())
{
field
.
setAccessible
(
true
);
// 设置为可访问,以访问私有属性
String
fieldName
=
convertToUnderline
(
field
.
getName
());
Object
value
=
field
.
get
(
record
);
try
{
if
(
listMap
.
containsKey
(
fieldName
))
{
LambdaUpdateWrapper
<
AlertFormValue
>
wrapper
=
new
LambdaUpdateWrapper
<>();
wrapper
.
eq
(
AlertFormValue:
:
getAlertCalledId
,
alertCalled
);
wrapper
.
eq
(
AlertFormValue:
:
getFieldCode
,
fieldName
);
wrapper
.
set
(
AlertFormValue:
:
getFieldValue
,
value
);
iAlertFormValueService
.
update
(
wrapper
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
redisUtils
.
del
(
RedisKey
.
TZS_ALERTCALLED_ID
+
alertCalled
);
return
ResponseHelper
.
buildResponse
(
"保存警情记录成功"
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
...
...
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