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
d2d857a9
Commit
d2d857a9
authored
Jun 06, 2025
by
maoying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加指标偏移量
parent
e6e32733
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
1 deletion
+66
-1
EquipmentSpecificIndex.java
...oin/equipmanage/common/entity/EquipmentSpecificIndex.java
+4
-0
MqttReceiveServiceImpl.java
...join/equipmanage/service/impl/MqttReceiveServiceImpl.java
+0
-0
FormulaCalculator.java
...java/com/yeejoin/equipmanage/utils/FormulaCalculator.java
+45
-0
wl-3.6.0.xml
...ot-system-equip/src/main/resources/changelog/wl-3.6.0.xml
+15
-0
EquipmentSpecificIndexMapper.xml
...rc/main/resources/mapper/EquipmentSpecificIndexMapper.xml
+2
-1
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/EquipmentSpecificIndex.java
View file @
d2d857a9
...
...
@@ -213,4 +213,8 @@ public class EquipmentSpecificIndex extends BaseEntity {
@ApiModelProperty
(
value
=
"是否遥测"
)
@TableField
(
value
=
"is_trend"
)
private
Boolean
isTrend
;
@ApiModelProperty
(
value
=
"计算公式"
)
@TableField
(
value
=
"formula"
)
private
String
formula
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/MqttReceiveServiceImpl.java
View file @
d2d857a9
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/utils/FormulaCalculator.java
0 → 100644
View file @
d2d857a9
package
com
.
yeejoin
.
equipmanage
.
utils
;
import
java.math.BigDecimal
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
javax.script.Compilable
;
import
javax.script.CompiledScript
;
import
javax.script.ScriptEngine
;
import
javax.script.ScriptEngineManager
;
import
javax.script.ScriptException
;
import
javax.script.SimpleBindings
;
public
class
FormulaCalculator
{
private
static
final
ScriptEngine
engine
=
new
ScriptEngineManager
().
getEngineByName
(
"js"
);
private
static
final
Map
<
String
,
CompiledScript
>
compiledCache
=
new
ConcurrentHashMap
<>();
public
static
synchronized
Object
calculate
(
String
formula
,
Map
<
String
,
Object
>
variables
)
throws
ScriptException
{
try
{
// 类型安全转换
variables
.
replaceAll
((
k
,
v
)
->
v
instanceof
String
?
new
BigDecimal
((
String
)
v
)
:
v
);
CompiledScript
script
=
compiledCache
.
computeIfAbsent
(
formula
,
f
->
{
try
{
return
((
Compilable
)
engine
).
compile
(
f
);
}
catch
(
ScriptException
e
)
{
e
.
printStackTrace
();
// TODO Auto-generated catch block
throw
new
IllegalArgumentException
(
"输入值格式错误"
);
}
}
);
return
script
.
eval
(
new
SimpleBindings
(
variables
));
}
catch
(
ClassCastException
e
)
{
throw
new
IllegalArgumentException
(
"输入值格式错误"
);
}
}
}
amos-boot-system-equip/src/main/resources/changelog/wl-3.6.0.xml
View file @
d2d857a9
...
...
@@ -1231,4 +1231,18 @@
alter table `f_equipment` add column `drain_duration` double DEFAULT NULL COMMENT '排空时长(分钟)';
</sql>
</changeSet>
<changeSet
author=
"my"
id=
"17491871450000"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"wl_equipment_specific_index"
columnName=
"formula"
/>
</not>
</preConditions>
<comment>
wl_equipment_specific_index add column formula
</comment>
<sql>
ALTER TABLE `wl_equipment_specific_index`
ADD COLUMN `formula` varchar(255) NULL DEFAULT '' COMMENT '计算公式';
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
amos-boot-system-equip/src/main/resources/mapper/EquipmentSpecificIndexMapper.xml
View file @
d2d857a9
...
...
@@ -68,7 +68,8 @@
sd.warehouse_structure_id AS buildId,
wes.biz_org_name AS bizOrgName,
wes.biz_org_code AS bizOrgCode,
wesi.alarm_rule AS alarmRule
wesi.alarm_rule AS alarmRule,
wesi.formula
FROM
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes
...
...
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