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
deecf65c
Commit
deecf65c
authored
Oct 31, 2025
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reafact(jg): 压力管道管道长度
1.压力管道管道长度调整为字符串/分隔开,大编辑调整
parent
320099f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
8 deletions
+67
-8
MetaHandler.java
...in/java/com/yeejoin/amos/boot/biz/config/MetaHandler.java
+67
-6
JgChangeRegistrationReformServiceImpl.java
...z/service/impl/JgChangeRegistrationReformServiceImpl.java
+0
-2
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/config/MetaHandler.java
View file @
deecf65c
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.biz.config;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
;
import
com.baomidou.mybatisplus.core.toolkit.Constants
;
import
com.yeejoin.amos.boot.biz.common.annotation.FillCommonUserField
;
import
com.yeejoin.amos.boot.biz.common.annotation.PipeLengthField
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
...
...
@@ -20,6 +21,7 @@ import java.math.BigDecimal;
import
java.math.RoundingMode
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Objects
;
/**
...
...
@@ -47,7 +49,14 @@ public class MetaHandler implements MetaObjectHandler {
@Override
public
void
insertFill
(
MetaObject
metaObject
)
{
Date
currentDate
=
new
Date
();
Class
<?>
clazz
=
metaObject
.
getOriginalObject
().
getClass
();
Object
originalObj
=
metaObject
.
getOriginalObject
();
Class
<?>
clazz
=
originalObj
.
getClass
();
// 处理 Map 封装的情况(update(entity, wrapper) 方式)
if
(
originalObj
instanceof
Map
)
{
Map
<?,?>
map
=
(
Map
<?,?>)
originalObj
;
Object
et
=
map
.
get
(
Constants
.
ENTITY
);
// MyBatis-Plus 的实体key
clazz
=
(
et
!=
null
)
?
et
.
getClass
()
:
clazz
;
}
FillCommonUserField
annotation
=
clazz
.
getAnnotation
(
FillCommonUserField
.
class
);
if
(
annotation
==
null
||
annotation
.
isAutoFill
())
{
autoFillUser
(
metaObject
,
metaObject
.
getOriginalObject
());
...
...
@@ -59,15 +68,60 @@ public class MetaHandler implements MetaObjectHandler {
this
.
setFieldValByName
(
"createDate"
,
currentDate
,
metaObject
);
}
private
void
processAutoFill
(
MetaObject
metaObject
,
PipeLengthField
pipeLengthField
)
{
Object
sourceValue
=
metaObject
.
getValue
(
pipeLengthField
.
sourceField
());
if
(
sourceValue
!=
null
)
{
Object
convertedValue
=
convertValue
(
sourceValue
,
pipeLengthField
);
this
.
setFieldValByName
(
pipeLengthField
.
targetField
(),
convertedValue
,
metaObject
);
// 1. 防御性校验
if
(
metaObject
==
null
||
pipeLengthField
==
null
)
{
return
;
}
if
(
StringUtils
.
isBlank
(
pipeLengthField
.
sourceField
())
||
StringUtils
.
isBlank
(
pipeLengthField
.
targetField
()))
{
return
;
}
// 2. 获取实际要操作的对象(处理Map封装情况)
Object
operationObj
=
getOperationObject
(
metaObject
);
if
(
operationObj
==
null
)
{
return
;
}
// 3. 重新基于实际对象创建MetaObject
MetaObject
targetMetaObject
=
metaObject
.
hasGetter
(
Constants
.
ENTITY
)
?
MetaObject
.
forObject
(
operationObj
,
metaObject
.
getObjectFactory
(),
metaObject
.
getObjectWrapperFactory
(),
metaObject
.
getReflectorFactory
())
:
metaObject
;
// 4. 安全取值
if
(!
targetMetaObject
.
hasGetter
(
pipeLengthField
.
sourceField
()))
{
return
;
}
Object
sourceValue
=
targetMetaObject
.
getValue
(
pipeLengthField
.
sourceField
());
if
(
sourceValue
==
null
)
{
return
;
}
// 5. 转换并设值
Object
convertedValue
=
convertValue
(
sourceValue
,
pipeLengthField
);
this
.
setFieldValByName
(
pipeLengthField
.
targetField
(),
convertedValue
,
targetMetaObject
);
}
/**
* 处理Map类型的参数封装
*/
private
Object
getOperationObject
(
MetaObject
metaObject
)
{
Object
original
=
metaObject
.
getOriginalObject
();
// 处理update(entity, wrapper)产生的Map封装
if
(
original
instanceof
Map
)
{
Map
<?,
?>
map
=
(
Map
<?,
?>)
original
;
// MyBatis-Plus的标准实体key
return
map
.
get
(
Constants
.
ENTITY
)
==
null
?
original
:
map
.
get
(
Constants
.
ENTITY
);
}
return
original
;
}
private
Object
convertValue
(
Object
sourceValue
,
PipeLengthField
pipeLengthField
)
{
// 示例:针对pipeLength的特殊处理
if
(
"pipeLengthText"
.
equals
(
pipeLengthField
.
sourceField
()))
{
...
...
@@ -177,7 +231,14 @@ public class MetaHandler implements MetaObjectHandler {
*/
@Override
public
void
updateFill
(
MetaObject
metaObject
)
{
Class
<?>
clazz
=
metaObject
.
getOriginalObject
().
getClass
();
Object
originalObj
=
metaObject
.
getOriginalObject
();
Class
<?>
clazz
=
originalObj
.
getClass
();
// 处理 Map 封装的情况(update(entity, wrapper) 方式)
if
(
originalObj
instanceof
Map
)
{
Map
<?,?>
map
=
(
Map
<?,?>)
originalObj
;
Object
et
=
map
.
get
(
Constants
.
ENTITY
);
// MyBatis-Plus 的实体key
clazz
=
(
et
!=
null
)
?
et
.
getClass
()
:
clazz
;
}
FillCommonUserField
annotation
=
clazz
.
getAnnotation
(
FillCommonUserField
.
class
);
if
(
annotation
==
null
||
annotation
.
isAutoFill
())
{
String
userId
=
RequestContext
.
getExeUserId
();
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgChangeRegistrationReformServiceImpl.java
View file @
deecf65c
...
...
@@ -22,7 +22,6 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import
com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent
;
import
com.yeejoin.amos.boot.module.jg.api.common.PipLenCalUtils
;
import
com.yeejoin.amos.boot.module.jg.api.dto.*
;
import
com.yeejoin.amos.boot.module.jg.api.entity.*
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
...
...
@@ -853,7 +852,6 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
pipeline
.
setWorkPressure
(
item
.
getString
(
"workPressure"
));
pipeline
.
setWorkTemperature
(
item
.
getString
(
"workTemperature"
));
pipeline
.
setPipeLengthText
(
item
.
getString
(
"pipeLengthText"
));
pipeline
.
setPipeLength
(
PipLenCalUtils
.
cal
(
item
.
getString
(
"pipeLengthText"
)));
LambdaUpdateWrapper
<
IdxBizJgTechParamsPipeline
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
IdxBizJgTechParamsPipeline:
:
getRecord
,
item
.
getString
(
"record"
));
// 技术参数更新
...
...
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