Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
H
hzsomms
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
ZTGK
hzsomms
Commits
9234c3b2
Commit
9234c3b2
authored
Aug 14, 2023
by
hkl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:1.调整程序
parent
3cc309c3
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
283 additions
and
881 deletions
+283
-881
AsyncTask.java
...t-base-core/src/main/java/org/jeecg/config/AsyncTask.java
+4
-2
FastenerManagementController.java
.../deviceAsset/controller/FastenerManagementController.java
+2
-0
SignBoardManagementController.java
...deviceAsset/controller/SignBoardManagementController.java
+2
-0
SleeperManagementController.java
...s/deviceAsset/controller/SleeperManagementController.java
+2
-0
TrackBedManagementController.java
.../deviceAsset/controller/TrackBedManagementController.java
+2
-0
CurveManagementMapper.xml
.../modules/deviceAsset/mapper/xml/CurveManagementMapper.xml
+20
-21
RailManagementMapper.xml
...g/modules/deviceAsset/mapper/xml/RailManagementMapper.xml
+63
-51
CurveManagementServiceImpl.java
.../deviceAsset/service/impl/CurveManagementServiceImpl.java
+2
-0
RailManagementServiceImpl.java
...s/deviceAsset/service/impl/RailManagementServiceImpl.java
+12
-4
SwitchManagementServiceImpl.java
...deviceAsset/service/impl/SwitchManagementServiceImpl.java
+2
-0
VerticalCurveManagementServiceImpl.java
...sset/service/impl/VerticalCurveManagementServiceImpl.java
+2
-0
AnalysisAlgorithm.java
...es/dynamicStaticAnalysis/algorithm/AnalysisAlgorithm.java
+0
-732
AnalysisBatchUnitDevice.java
...dynamicStaticAnalysis/entity/AnalysisBatchUnitDevice.java
+0
-1
AnalysisAlgorithmMapper.xml
...amicStaticAnalysis/mapper/xml/AnalysisAlgorithmMapper.xml
+9
-6
WorkBatchController.java
...dules/maintenanceWork/controller/WorkBatchController.java
+7
-20
AnalysisBatchSaveDTO.java
...ecg/modules/maintenanceWork/dto/AnalysisBatchSaveDTO.java
+64
-0
UnitDeviceDTO.java
.../org/jeecg/modules/maintenanceWork/dto/UnitDeviceDTO.java
+10
-4
WorkBatchSaveOrUpdateDTO.java
...modules/maintenanceWork/dto/WorkBatchSaveOrUpdateDTO.java
+4
-0
IWorkBatchService.java
...cg/modules/maintenanceWork/service/IWorkBatchService.java
+2
-2
WorkBatchServiceImpl.java
...es/maintenanceWork/service/impl/WorkBatchServiceImpl.java
+74
-38
No files found.
jeecg-boot-base-core/src/main/java/org/jeecg/config/AsyncTask.java
View file @
9234c3b2
...
...
@@ -30,9 +30,11 @@ public class AsyncTask implements AsyncConfigurer {
public
Executor
getAsyncExecutor
()
{
ThreadPoolTaskExecutor
executor
=
new
ThreadPoolTaskExecutor
();
// 设置核心线程数
executor
.
setCorePoolSize
(
10
);
// CPU密集型(CPU密集型也叫计算密集型,指的是运算较多,cpu占用高,读/写I/O(硬盘/内存)较少):corePoolSize = CPU核数 + 1
// IO密集型(与cpu密集型相反,系统运作,大部分的状况是CPU在等I/O (硬盘/内存) 的读/写操作,此时CPU Loading并不高。):corePoolSize = CPU核数 * 2
executor
.
setCorePoolSize
(
8
);
// 设置最大线程数
executor
.
setMaxPoolSize
(
100
);
executor
.
setMaxPoolSize
(
8
);
// 线程池所使用的缓冲队列
executor
.
setQueueCapacity
(
10
);
// 等待任务在关机时完成-- 表明等待所有线程执行完
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/controller/FastenerManagementController.java
View file @
9234c3b2
...
...
@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiOperation;
import
org.jeecg.common.api.vo.Result
;
import
org.jeecg.common.aspect.annotation.AutoLog
;
import
org.jeecg.common.system.base.controller.JeecgController
;
import
org.jeecg.common.util.UUIDGenerator
;
import
org.jeecg.modules.deviceAsset.dto.FastenerManagementDTO
;
import
org.jeecg.modules.deviceAsset.entity.FastenerManagement
;
import
org.jeecg.modules.deviceAsset.service.IFastenerManagementService
;
...
...
@@ -46,6 +47,7 @@ public class FastenerManagementController extends JeecgController<FastenerManage
@PostMapping
(
value
=
"/edit"
)
public
Result
<
String
>
edit
(
@RequestBody
FastenerManagement
fastenerManagement
)
{
if
(
ObjectUtil
.
isEmpty
(
fastenerManagement
.
getId
()))
{
fastenerManagement
.
setId
(
UUIDGenerator
.
generate
());
this
.
service
.
save
(
fastenerManagement
);
}
else
{
this
.
service
.
updateById
(
fastenerManagement
);
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/controller/SignBoardManagementController.java
View file @
9234c3b2
...
...
@@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
org.jeecg.common.api.vo.Result
;
import
org.jeecg.common.aspect.annotation.AutoLog
;
import
org.jeecg.common.util.UUIDGenerator
;
import
org.jeecg.modules.deviceAsset.dto.FastenerManagementDTO
;
import
org.jeecg.modules.deviceAsset.dto.SignBoardManagementDTO
;
import
org.jeecg.modules.deviceAsset.entity.FastenerManagement
;
...
...
@@ -50,6 +51,7 @@ public class SignBoardManagementController extends JeecgController<SignBoardMana
@PostMapping
(
value
=
"/edit"
)
public
Result
<
String
>
edit
(
@RequestBody
SignBoardManagement
signBoardManagement
)
{
if
(
ObjectUtil
.
isEmpty
(
signBoardManagement
.
getId
()))
{
signBoardManagement
.
setId
(
UUIDGenerator
.
generate
());
this
.
service
.
save
(
signBoardManagement
);
}
else
{
this
.
service
.
updateById
(
signBoardManagement
);
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/controller/SleeperManagementController.java
View file @
9234c3b2
...
...
@@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
org.jeecg.common.api.vo.Result
;
import
org.jeecg.common.aspect.annotation.AutoLog
;
import
org.jeecg.common.util.UUIDGenerator
;
import
org.jeecg.modules.deviceAsset.dto.SignBoardManagementDTO
;
import
org.jeecg.modules.deviceAsset.dto.SleeperManagementDTO
;
import
org.jeecg.modules.deviceAsset.entity.SignBoardManagement
;
...
...
@@ -51,6 +52,7 @@ public class SleeperManagementController extends JeecgController<SleeperManageme
@PostMapping
(
value
=
"/edit"
)
public
Result
<
String
>
edit
(
@RequestBody
SleeperManagement
sleeperManagement
)
{
if
(
ObjectUtil
.
isEmpty
(
sleeperManagement
.
getId
()))
{
sleeperManagement
.
setId
(
UUIDGenerator
.
generate
());
this
.
service
.
save
(
sleeperManagement
);
}
else
{
this
.
service
.
updateById
(
sleeperManagement
);
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/controller/TrackBedManagementController.java
View file @
9234c3b2
...
...
@@ -12,6 +12,7 @@ import io.swagger.annotations.ApiParam;
import
org.jeecg.common.api.vo.Result
;
import
org.jeecg.common.aspect.annotation.AutoLog
;
import
org.jeecg.common.system.base.controller.JeecgController
;
import
org.jeecg.common.util.UUIDGenerator
;
import
org.jeecg.modules.deviceAsset.dto.TrackBedManagementDTO
;
import
org.jeecg.modules.deviceAsset.entity.TrackBedManagement
;
import
org.jeecg.modules.deviceAsset.service.ITrackBedManagementService
;
...
...
@@ -50,6 +51,7 @@ public class TrackBedManagementController extends JeecgController<TrackBedManage
@PostMapping
(
value
=
"/edit"
)
public
Result
<
String
>
edit
(
@RequestBody
TrackBedManagement
trackBedManagement
)
{
if
(
ObjectUtil
.
isEmpty
(
trackBedManagement
.
getId
()))
{
trackBedManagement
.
setId
(
UUIDGenerator
.
generate
());
this
.
service
.
save
(
trackBedManagement
);
}
else
{
this
.
service
.
updateById
(
trackBedManagement
);
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/mapper/xml/CurveManagementMapper.xml
View file @
9234c3b2
...
...
@@ -5,29 +5,28 @@
<select
id=
"queryPageList"
resultType=
"org.jeecg.modules.deviceAsset.vo.CurveManagementQueryVO"
>
SELECT
t1.*,
t2.light_rail_name,
t2.light_rail_id,
t2.section_name,
(SELECT line_alias_name FROM t_sn_line_alias WHERE id = t1.line_alias_id limit 1) line_alias_name
t1.*,
t2.light_rail_name,
t2.light_rail_id,
t2.section_name,
(SELECT line_alias_name FROM t_sn_line_alias WHERE id = t1.line_alias_id limit 1) line_alias_name
FROM
t_da_curve_management t1
t_da_curve_management t1
LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
LEFT JOIN t_sn_light_rail t3 ON t2.light_rail_id = t3.id
<where>
<if
test=
"dto.curveCode != null and dto.curveCode != ''"
>
AND t1.curve_code like concat('%',#{dto.curveCode},'%')
</if>
<if
test=
"dto.sectionId != null and dto.sectionId != ''"
>
AND t1.section_id = #{dto.sectionId}
</if>
<if
test=
"dto.lightRailId != null and dto.lightRailId != ''"
>
AND t2.light_rail_id = #{dto.lightRailId}
</if>
<if
test=
"dto.lineAliasId != null and dto.lineAliasId != ''"
>
AND t1.line_alias_id = #{dto.lineAliasId}
</if>
AND t3.status = 1
</where>
WHERE t3.status = 1
<if
test=
"dto.curveCode != null and dto.curveCode != ''"
>
AND t1.curve_code like concat('%',#{dto.curveCode},'%')
</if>
<if
test=
"dto.sectionId != null and dto.sectionId != ''"
>
AND t1.section_id = #{dto.sectionId}
</if>
<if
test=
"dto.lightRailId != null and dto.lightRailId != ''"
>
AND t2.light_rail_id = #{dto.lightRailId}
</if>
<if
test=
"dto.lineAliasId != null and dto.lineAliasId != ''"
>
AND t1.line_alias_id = #{dto.lineAliasId}
</if>
order by t1.line_alias_id,t1.curve_mileage_zh
</select>
</mapper>
\ No newline at end of file
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/mapper/xml/RailManagementMapper.xml
View file @
9234c3b2
...
...
@@ -27,58 +27,70 @@
</if>
</select>
<select
id=
"getLineSpecialRail"
resultType=
"java.util.Map"
>
SELECT
id,
unitCode,
startMileage,
endMileage,
type
FROM
(
SELECT
t1.id,
t1.unit_code unitCode,
t1.curve_mileage_zh startMileage,
t1.curve_mileage_hz endMileage,
'曲线' type
FROM
t_da_curve_management t1
LEFT JOIN t_sn_train_station t2 ON t1.section_id = t1.id
WHERE
t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
SELECT id,
unitCode,
deviceCode,
startMileage,
endMileage,
ROUND((startMileage + endMileage) / 2, 3) centerMileage,
type,
typeName
FROM (
<!--
SELECT t1.id,
t1.unit_code unitCode,
t1.rail_code deviceCode,
t1.starting_mileage startMileage,
t1.end_mileage endMileage,
1 type,
'钢轨' typeName
FROM t_da_rail_management t1
WHERE t1.line_alias_id = #{lineAliasId}
AND t1.light_rail_id = #{lightRailId}
UNION ALL
-->
SELECT t1.id,
t1.unit_code unitCode,
t1.curve_code deviceCode,
t1.curve_mileage_zh startMileage,
t1.curve_mileage_hz endMileage,
2 type,
'曲线' typeName
FROM t_da_curve_management t1
LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
WHERE t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
UNION ALL
SELECT t1.id,
t1.unit_code unitCode,
t1.vertical_curve_code deviceCode,
t1.starting_mileage startMileage,
t1.end_mileage endMileage,
3 type,
'竖曲线' typeName
FROM t_da_vertical_curve_management t1
LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
WHERE t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
UNION ALL
SELECT
t1.id,
t1.unit_code unitCode,
t1.starting_mileage startMileage,
t1.end_mileage endMileage,
'竖曲线' type
FROM
t_da_vertical_curve_management t1
LEFT JOIN t_sn_train_station t2 ON t1.section_id = t1.id
WHERE
t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
UNION ALL
UNION ALL
SELECT
t1.id,
t1.unit_code unitCode,
t1.byroad_pre_mileage startMileage,
t1.byroad_end_mileage endMileage,
'道岔' type
FROM
t_da_switch_management t1
LEFT JOIN t_sn_section_station_map t2 ON t1.section_station_map_id = t2.id
LEFT JOIN t_sn_subway_section t3 ON t2.section_id = t3.id
AND t3.line_alias_id = t1.line_alias_id
WHERE
t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
) t
ORDER BY
t.startMileage
SELECT t1.id,
t1.unit_code unitCode,
t1.switch_code deviceCode,
t1.byroad_pre_mileage startMileage,
t1.byroad_end_mileage endMileage,
4 type,
'道岔' typeName
FROM t_da_switch_management t1
LEFT JOIN t_sn_section_station_map t2 ON t1.section_station_map_id = t2.id
LEFT JOIN t_sn_subway_section t3 ON t2.section_id = t3.id AND t3.line_alias_id = t1.line_alias_id
WHERE t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
) t
ORDER BY t.startMileage
</select>
</mapper>
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/service/impl/CurveManagementServiceImpl.java
View file @
9234c3b2
...
...
@@ -3,6 +3,7 @@ package org.jeecg.modules.deviceAsset.service.impl;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.jeecg.common.util.UUIDGenerator
;
import
org.jeecg.modules.deviceAsset.dto.CurveManagementDTO
;
import
org.jeecg.modules.deviceAsset.entity.CurveManagement
;
import
org.jeecg.modules.deviceAsset.mapper.CurveManagementMapper
;
...
...
@@ -36,6 +37,7 @@ public class CurveManagementServiceImpl extends ServiceImpl<CurveManagementMappe
@Override
public
void
edit
(
CurveManagement
curveManagement
)
{
if
(
ObjectUtil
.
isEmpty
(
curveManagement
.
getId
()))
{
curveManagement
.
setId
(
UUIDGenerator
.
generate
());
String
utilCode
=
UnitCodeUtil
.
curveUnitCodeUtil
(
curveManagement
.
getLineAliasId
());
curveManagement
.
setUnitCode
(
utilCode
);
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/service/impl/RailManagementServiceImpl.java
View file @
9234c3b2
...
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.jeecg.common.util.UUIDGenerator
;
import
org.jeecg.config.AsyncTask
;
import
org.jeecg.modules.deviceAsset.dto.RailManagementDTO
;
import
org.jeecg.modules.deviceAsset.entity.RailManagement
;
import
org.jeecg.modules.deviceAsset.mapper.RailManagementMapper
;
...
...
@@ -46,6 +47,9 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
@Resource
private
SubwaySectionMapper
subwaySectionMapper
;
@Resource
private
AsyncTask
asyncTask
;
@Override
public
Page
<
RailManagementVO
>
queryPageList
(
Page
<
RailManagementVO
>
pageData
,
RailManagementDTO
dto
)
{
return
this
.
baseMapper
.
queryPageList
(
pageData
,
dto
);
...
...
@@ -70,7 +74,7 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
@Override
public
void
intelligentGeneration
(
String
lightRailId
)
{
// 1.删除整条线的
this
.
lambdaUpdate
().
eq
(
RailManagement:
:
getLightRailId
,
lightRailId
).
remove
();
this
.
lambdaUpdate
().
eq
(
RailManagement:
:
getLightRailId
,
lightRailId
).
remove
();
// 2.查询当前车站的上下行里程
...
...
@@ -119,7 +123,11 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
allRailList
.
addAll
(
downRailList
);
this
.
saveBatch
(
allRailList
);
// 异步执行保存
asyncTask
.
getAsyncExecutor
().
execute
(()
->
{
this
.
saveBatch
(
allRailList
);
});
}
/**
...
...
@@ -185,7 +193,7 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
* @param lineAliasId
*/
private
void
generationCore
(
LightRail
lightRail
,
List
<
RailManagement
>
allRailList
,
String
lineAliasId
)
{
List
<
Map
<
String
,
Object
>>
lineSpecialRailList
=
this
.
getLineSpecialRail
(
lightRail
.
getId
(),
lineAliasId
);
List
<
Map
<
String
,
Object
>>
lineSpecialRailList
=
this
.
getLineSpecialRail
(
lightRail
.
getId
(),
lineAliasId
);
BigDecimal
lineStartMileage
=
BigDecimal
.
ZERO
;
BigDecimal
endMileage
=
lightRail
.
getUpLineMileage
();
...
...
@@ -269,6 +277,6 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
@Override
public
List
<
Map
<
String
,
Object
>>
getLineSpecialRail
(
String
lightRailId
,
String
lineAliasId
)
{
return
this
.
baseMapper
.
getLineSpecialRail
(
lightRailId
,
lineAliasId
);
return
this
.
baseMapper
.
getLineSpecialRail
(
lightRailId
,
lineAliasId
);
}
}
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/service/impl/SwitchManagementServiceImpl.java
View file @
9234c3b2
...
...
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.jeecg.common.api.dto.PageSearch
;
import
org.jeecg.common.util.UUIDGenerator
;
import
org.jeecg.modules.deviceAsset.dto.SwitchManagementQueryDTO
;
import
org.jeecg.modules.deviceAsset.entity.SwitchManagement
;
import
org.jeecg.modules.deviceAsset.mapper.SwitchManagementMapper
;
...
...
@@ -35,6 +36,7 @@ public class SwitchManagementServiceImpl extends ServiceImpl<SwitchManagementMap
@Override
public
void
edit
(
SwitchManagement
switchManagement
)
{
if
(
ObjectUtil
.
isEmpty
(
switchManagement
.
getId
()))
{
switchManagement
.
setId
(
UUIDGenerator
.
generate
());
String
utilCode
=
UnitCodeUtil
.
switchUnitCodeUtil
(
switchManagement
.
getLineAliasId
());
switchManagement
.
setUnitCode
(
utilCode
);
this
.
save
(
switchManagement
);
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/service/impl/VerticalCurveManagementServiceImpl.java
View file @
9234c3b2
...
...
@@ -2,6 +2,7 @@ package org.jeecg.modules.deviceAsset.service.impl;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.jeecg.common.util.UUIDGenerator
;
import
org.jeecg.modules.deviceAsset.dto.VerticalCurveManagementDTO
;
import
org.jeecg.modules.deviceAsset.entity.VerticalCurveManagement
;
import
org.jeecg.modules.deviceAsset.mapper.VerticalCurveManagementMapper
;
...
...
@@ -30,6 +31,7 @@ public class VerticalCurveManagementServiceImpl extends ServiceImpl<VerticalCurv
@Override
public
void
edit
(
VerticalCurveManagement
verticalCurveManagement
)
{
if
(
ObjectUtil
.
isEmpty
(
verticalCurveManagement
.
getId
()))
{
verticalCurveManagement
.
setId
(
UUIDGenerator
.
generate
());
String
utilCode
=
UnitCodeUtil
.
verticalCurveUnitCodeUtil
(
verticalCurveManagement
.
getLineAliasId
());
verticalCurveManagement
.
setUnitCode
(
utilCode
);
this
.
save
(
verticalCurveManagement
);
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/dynamicStaticAnalysis/algorithm/AnalysisAlgorithm.java
View file @
9234c3b2
...
...
@@ -65,738 +65,6 @@ public class AnalysisAlgorithm {
@Resource
private
IMovementOverReportService
movementOverReportService
;
/**
* 分析
*/
public
void
analysis2
(
String
analysisBatchId
)
{
// 1.映射单元格
// 1.1 获取分析批次数据
AnalysisBatch
analysisBatch
=
analysisBatchService
.
getById
(
analysisBatchId
);
List
<
AnalysisBatchCheckDataMap
>
analysisBatchCheckDataMapList
=
analysisBatchCheckDataMapService
.
lambdaQuery
()
.
eq
(
AnalysisBatchCheckDataMap:
:
getAnalysisBatchId
,
analysisBatchId
)
.
list
();
// 1.2 按公里数正序排序所有1-钢轨,2-曲线,3-竖曲线,4-道岔
List
<
Map
<
String
,
Object
>>
unitDeviceList
=
analysisAlgorithmMapper
.
getUnitDevice
(
analysisBatch
.
getLightRailId
(),
analysisBatch
.
getLineAliasId
());
Map
<
String
,
Map
<
String
,
Object
>>
unitDeviceTable
=
new
TreeMap
<>();
// 1.3 获取检查数据
for
(
AnalysisBatchCheckDataMap
checkDataMap
:
analysisBatchCheckDataMapList
)
{
// 检查数据类型 1-人工静态检查 2-轨检仪静态检查 3-轨检车检查 4-添乘仪检查
if
(
1
==
checkDataMap
.
getEkType
())
{
List
<
MovementCheckDataUnitDeviceMap
>
movementCheckDataUnitDeviceMaps
=
new
ArrayList
<>();
// 1 获取人工检查数据
List
<
MovementCourse
>
checkItemList
=
movementCourseService
.
lambdaQuery
()
.
eq
(
MovementCourse:
:
getMovementMasterId
,
checkDataMap
.
getEkId
())
.
list
();
List
<
MovementCourseInfo
>
checkItemItemDetailList
=
movementCourseInfoService
.
lambdaQuery
()
.
eq
(
MovementCourseInfo:
:
getMovementMasterId
,
checkDataMap
.
getEkId
())
.
list
();
Map
<
String
,
List
<
MovementCourseInfo
>>
checkItemItemDetailMap
=
checkItemItemDetailList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
MovementCourseInfo:
:
getMovementCourseId
));
// 2 循环遍历检查项目比较【开始-结束】来映射关联关系
for
(
MovementCourse
checkItem
:
checkItemList
)
{
// 2.1 这里可能出现开始时间比结束时间大的情况
BigDecimal
checkItemStartingMileage
=
checkItem
.
getCourseStartingMileage
();
BigDecimal
checkItemEndMileage
=
checkItem
.
getCourseEndMileage
();
if
(
checkItemStartingMileage
.
compareTo
(
checkItemEndMileage
)
>
0
)
{
checkItemStartingMileage
=
checkItem
.
getCourseEndMileage
();
checkItemEndMileage
=
checkItem
.
getCourseStartingMileage
();
}
// 2.2 单元设备中心里程落在检查项目【开始-结束】这个区间视为这个区间的单元设备
for
(
Map
<
String
,
Object
>
unitDevice
:
unitDeviceList
)
{
BigDecimal
startMileage
=
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"startMileage"
));
BigDecimal
endMileage
=
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"endMileage"
));
BigDecimal
centerMileage
=
startMileage
.
add
(
endMileage
).
divide
(
new
BigDecimal
(
"2"
),
3
,
RoundingMode
.
HALF_UP
);
unitDevice
.
put
(
"centerMileage"
,
centerMileage
);
// 2.2.1 命中检查项目
if
(
checkItemStartingMileage
.
compareTo
(
centerMileage
)
<=
0
&&
checkItemEndMileage
.
compareTo
(
centerMileage
)
>
0
)
{
List
<
MovementCourseInfo
>
movementCourseInfos
=
checkItemItemDetailMap
.
get
(
checkItem
.
getId
());
if
(
ObjectUtil
.
isNotEmpty
(
movementCourseInfos
))
{
// 1 处理3个格子映射问题
Map
<
String
,
List
<
MovementCourseInfo
>>
trackCodeMap
=
movementCourseInfos
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
MovementCourseInfo:
:
getTrackCode
));
int
size
=
trackCodeMap
.
size
();
BigDecimal
averageDec
=
checkItemEndMileage
.
subtract
(
checkItemStartingMileage
).
divide
(
new
BigDecimal
(
size
),
3
,
RoundingMode
.
HALF_UP
);
List
<
String
>
trackCodes
=
trackCodeMap
.
keySet
().
stream
()
.
mapToInt
(
Integer:
:
valueOf
)
.
sorted
()
.
mapToObj
(
String:
:
valueOf
)
.
collect
(
Collectors
.
toList
());
BigDecimal
currentStartMileage
=
checkItemStartingMileage
;
BigDecimal
currentEndEndMileage
=
checkItemStartingMileage
.
add
(
averageDec
);
for
(
String
trackCode
:
trackCodes
)
{
// 2.命中格子
if
(
currentStartMileage
.
compareTo
(
centerMileage
)
<=
0
&&
currentEndEndMileage
.
compareTo
(
centerMileage
)
>
0
)
{
String
unitCode
=
Convert
.
toStr
(
unitDevice
.
get
(
"unitCode"
));
// 人工检查数据
List
<
MovementCourseInfo
>
labourCheck
=
trackCodeMap
.
get
(
trackCode
);
unitDevice
.
put
(
"labourCheck"
,
labourCheck
);
unitDeviceTable
.
putIfAbsent
(
unitCode
,
unitDevice
);
// 保存单元-测点数据
for
(
MovementCourseInfo
movementCourseInfo
:
labourCheck
)
{
MovementCheckDataUnitDeviceMap
movementCheckDataUnitDeviceMap
=
new
MovementCheckDataUnitDeviceMap
();
movementCheckDataUnitDeviceMap
.
setId
(
UUIDGenerator
.
generate
());
movementCheckDataUnitDeviceMap
.
setCheckType
(
1
);
// 人工检查
movementCheckDataUnitDeviceMap
.
setUnitId
(
Convert
.
toStr
(
unitDevice
.
get
(
"id"
)));
movementCheckDataUnitDeviceMap
.
setUnitCode
(
Convert
.
toStr
(
unitDevice
.
get
(
"unitCode"
)));
movementCheckDataUnitDeviceMap
.
setUnitType
(
Convert
.
toInt
(
unitDevice
.
get
(
"type"
)));
movementCheckDataUnitDeviceMap
.
setUnitTypeName
(
Convert
.
toStr
(
unitDevice
.
get
(
"typeName"
)));
movementCheckDataUnitDeviceMap
.
setUnitStartingMileage
(
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"startMileage"
)));
movementCheckDataUnitDeviceMap
.
setUnitCenterMileage
(
centerMileage
);
movementCheckDataUnitDeviceMap
.
setUnitEndMileage
(
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"endMileage"
)));
movementCheckDataUnitDeviceMap
.
setCheckId
(
checkItem
.
getMovementMasterId
());
movementCheckDataUnitDeviceMap
.
setCheckItemId
(
checkItem
.
getId
());
movementCheckDataUnitDeviceMap
.
setCheckItemStartingMileage
(
checkItem
.
getCourseStartingMileage
());
movementCheckDataUnitDeviceMap
.
setCheckItemEndMileage
(
checkItem
.
getCourseEndMileage
());
movementCheckDataUnitDeviceMap
.
setCheckItemText
(
movementCourseInfo
.
getTrackCode
());
movementCheckDataUnitDeviceMap
.
setCheckDetailId
(
movementCourseInfo
.
getId
());
movementCheckDataUnitDeviceMap
.
setCheckDetailStartingMileage
(
currentStartMileage
);
movementCheckDataUnitDeviceMap
.
setCheckDetailEndMileage
(
currentEndEndMileage
);
movementCheckDataUnitDeviceMap
.
setTrackGauge
(
movementCourseInfo
.
getTrackGauge
());
movementCheckDataUnitDeviceMap
.
setLevel
(
movementCourseInfo
.
getLevel
());
movementCheckDataUnitDeviceMap
.
setTriangularPit
(
movementCourseInfo
.
getTriangularPit
());
movementCheckDataUnitDeviceMap
.
setMeasurePoint
(
movementCourseInfo
.
getMeasurePoint
());
movementCheckDataUnitDeviceMap
.
setDirection
(
movementCourseInfo
.
getDirection
());
movementCheckDataUnitDeviceMap
.
setHeight
(
movementCourseInfo
.
getHeight
());
movementCheckDataUnitDeviceMap
.
setStructure
(
movementCourseInfo
.
getStructure
());
movementCheckDataUnitDeviceMap
.
setRectification
(
movementCourseInfo
.
getRectification
());
movementCheckDataUnitDeviceMaps
.
add
(
movementCheckDataUnitDeviceMap
);
}
}
currentStartMileage
=
currentEndEndMileage
;
currentEndEndMileage
=
currentEndEndMileage
.
add
(
averageDec
);
}
}
}
}
}
// 保存之前先删除
movementCheckDataUnitDeviceMapService
.
lambdaUpdate
().
eq
(
MovementCheckDataUnitDeviceMap:
:
getCheckId
,
checkDataMap
.
getEkId
()).
remove
();
movementCheckDataUnitDeviceMapService
.
saveBatch
(
movementCheckDataUnitDeviceMaps
);
}
else
if
(
2
==
checkDataMap
.
getEkType
())
{
List
<
MovementCheckDataUnitDeviceMap
>
movementCheckDataUnitDeviceMaps
=
new
ArrayList
<>();
// 1 获取轨检仪静态检查
List
<
RailInspectionEquipmentItem
>
checkItemList
=
railInspectionEquipmentItemService
.
lambdaQuery
()
.
eq
(
RailInspectionEquipmentItem:
:
getRailInspectionEquipmentId
,
checkDataMap
.
getEkId
())
.
list
();
List
<
RailInspectionEquipmentItemDetail
>
checkItemItemDetailList
=
railInspectionEquipmentItemDetailService
.
lambdaQuery
()
.
eq
(
RailInspectionEquipmentItemDetail:
:
getRailInspectionEquipmentId
,
checkDataMap
.
getEkId
())
.
list
();
Map
<
String
,
List
<
RailInspectionEquipmentItemDetail
>>
checkItemItemDetailMap
=
checkItemItemDetailList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
RailInspectionEquipmentItemDetail:
:
getRailInspectionEquipmentItemId
));
// 2 循环遍历检查项目比较【开始-结束】来映射关联关系
for
(
RailInspectionEquipmentItem
checkItem
:
checkItemList
)
{
// 2.1 这里可能出现开始时间比结束时间大的情况
BigDecimal
checkItemStartingMileage
=
checkItem
.
getCourseStartingMileage
();
BigDecimal
checkItemEndMileage
=
checkItem
.
getCourseEndMileage
();
if
(
checkItemStartingMileage
.
compareTo
(
checkItemEndMileage
)
>
0
)
{
checkItemStartingMileage
=
checkItem
.
getCourseEndMileage
();
checkItemEndMileage
=
checkItem
.
getCourseStartingMileage
();
}
// 2.2 单元设备中心里程落在检查项目【开始-结束】这个区间视为这个区间的单元设备
for
(
Map
<
String
,
Object
>
unitDevice
:
unitDeviceList
)
{
BigDecimal
startMileage
=
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"startMileage"
));
BigDecimal
endMileage
=
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"endMileage"
));
BigDecimal
centerMileage
=
startMileage
.
add
(
endMileage
).
divide
(
new
BigDecimal
(
"2"
),
3
,
RoundingMode
.
HALF_UP
);
unitDevice
.
put
(
"centerMileage"
,
centerMileage
);
// 2.2.1 命中检查项目
if
(
checkItemStartingMileage
.
compareTo
(
centerMileage
)
<=
0
&&
checkItemEndMileage
.
compareTo
(
centerMileage
)
>
0
)
{
List
<
RailInspectionEquipmentItemDetail
>
movementCourseInfos
=
checkItemItemDetailMap
.
get
(
checkItem
.
getId
());
for
(
RailInspectionEquipmentItemDetail
info
:
movementCourseInfos
)
{
String
checkItemKey
=
info
.
getCheckItem
();
BigDecimal
bigDecimal
=
new
BigDecimal
(
checkItemKey
);
BigDecimal
multiply
=
bigDecimal
.
multiply
(
new
BigDecimal
(
"1000"
));
info
.
setCheckItem
(
String
.
valueOf
(
multiply
.
intValue
()));
}
if
(
ObjectUtil
.
isNotEmpty
(
movementCourseInfos
))
{
// 1.处理3个格子映射问题
Map
<
String
,
List
<
RailInspectionEquipmentItemDetail
>>
trackCodeMap
=
movementCourseInfos
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
RailInspectionEquipmentItemDetail:
:
getCheckItem
));
int
size
=
trackCodeMap
.
size
();
BigDecimal
averageDec
=
checkItemEndMileage
.
subtract
(
checkItemStartingMileage
).
divide
(
new
BigDecimal
(
size
),
3
,
RoundingMode
.
HALF_UP
);
List
<
String
>
trackCodes
=
trackCodeMap
.
keySet
().
stream
()
.
mapToInt
(
Integer:
:
valueOf
)
.
sorted
()
.
mapToObj
(
String:
:
valueOf
)
.
collect
(
Collectors
.
toList
());
BigDecimal
currentStartMileage
=
checkItemStartingMileage
;
BigDecimal
currentEndEndMileage
=
checkItemStartingMileage
.
add
(
averageDec
);
for
(
String
trackCode
:
trackCodes
)
{
// 2.命中格子
if
(
currentStartMileage
.
compareTo
(
centerMileage
)
<=
0
&&
currentEndEndMileage
.
compareTo
(
centerMileage
)
>
0
)
{
String
unitCode
=
Convert
.
toStr
(
unitDevice
.
get
(
"unitCode"
));
// 轨检仪检查数据
List
<
RailInspectionEquipmentItemDetail
>
railDevice
=
trackCodeMap
.
get
(
trackCode
);
unitDevice
.
put
(
"railDevice"
,
railDevice
);
unitDeviceTable
.
putIfAbsent
(
unitCode
,
unitDevice
);
// 保存单元-测点数据
for
(
RailInspectionEquipmentItemDetail
movementCourseInfo
:
railDevice
)
{
MovementCheckDataUnitDeviceMap
movementCheckDataUnitDeviceMap
=
new
MovementCheckDataUnitDeviceMap
();
movementCheckDataUnitDeviceMap
.
setId
(
UUIDGenerator
.
generate
());
movementCheckDataUnitDeviceMap
.
setCheckType
(
2
);
// 2-轨检仪静态检查
movementCheckDataUnitDeviceMap
.
setUnitId
(
Convert
.
toStr
(
unitDevice
.
get
(
"id"
)));
movementCheckDataUnitDeviceMap
.
setUnitCode
(
Convert
.
toStr
(
unitDevice
.
get
(
"unitCode"
)));
movementCheckDataUnitDeviceMap
.
setUnitType
(
Convert
.
toInt
(
unitDevice
.
get
(
"type"
)));
movementCheckDataUnitDeviceMap
.
setUnitTypeName
(
Convert
.
toStr
(
unitDevice
.
get
(
"typeName"
)));
movementCheckDataUnitDeviceMap
.
setUnitStartingMileage
(
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"startMileage"
)));
movementCheckDataUnitDeviceMap
.
setUnitCenterMileage
(
centerMileage
);
movementCheckDataUnitDeviceMap
.
setUnitEndMileage
(
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"endMileage"
)));
movementCheckDataUnitDeviceMap
.
setCheckId
(
checkItem
.
getRailInspectionEquipmentId
());
movementCheckDataUnitDeviceMap
.
setCheckItemId
(
checkItem
.
getRailInspectionEquipmentId
());
movementCheckDataUnitDeviceMap
.
setCheckItemStartingMileage
(
checkItem
.
getCourseStartingMileage
());
movementCheckDataUnitDeviceMap
.
setCheckItemEndMileage
(
checkItem
.
getCourseEndMileage
());
movementCheckDataUnitDeviceMap
.
setCheckItemText
(
movementCourseInfo
.
getCheckItem
());
movementCheckDataUnitDeviceMap
.
setCheckDetailId
(
movementCourseInfo
.
getId
());
movementCheckDataUnitDeviceMap
.
setCheckDetailStartingMileage
(
currentStartMileage
);
movementCheckDataUnitDeviceMap
.
setCheckDetailEndMileage
(
currentEndEndMileage
);
movementCheckDataUnitDeviceMap
.
setTrackGauge
(
movementCourseInfo
.
getTrackGauge
());
movementCheckDataUnitDeviceMap
.
setLevel
(
movementCourseInfo
.
getLevel
());
movementCheckDataUnitDeviceMap
.
setTriangularPit
(
movementCourseInfo
.
getTriangularPit
());
movementCheckDataUnitDeviceMap
.
setMeasurePoint
(
movementCourseInfo
.
getMeasurePoint
());
movementCheckDataUnitDeviceMaps
.
add
(
movementCheckDataUnitDeviceMap
);
}
}
currentStartMileage
=
currentEndEndMileage
;
currentEndEndMileage
=
currentEndEndMileage
.
add
(
averageDec
);
}
}
}
}
}
// 保存之前先删除
movementCheckDataUnitDeviceMapService
.
lambdaUpdate
().
eq
(
MovementCheckDataUnitDeviceMap:
:
getCheckId
,
checkDataMap
.
getEkId
()).
remove
();
movementCheckDataUnitDeviceMapService
.
saveBatch
(
movementCheckDataUnitDeviceMaps
);
}
else
if
(
3
==
checkDataMap
.
getEkType
())
{
}
else
{
}
}
// 2.计算超限&计算评分
if
(
ObjectUtil
.
isNotEmpty
(
unitDeviceTable
))
{
for
(
Map
.
Entry
<
String
,
Map
<
String
,
Object
>>
entry
:
unitDeviceTable
.
entrySet
())
{
Map
<
String
,
Object
>
unitDevice
=
entry
.
getValue
();
// 1.计算超限
List
<
MovementCourseInfo
>
labourCheckList
=
(
List
<
MovementCourseInfo
>)
unitDevice
.
get
(
"labourCheck"
);
if
(
ObjectUtil
.
isNotEmpty
(
labourCheckList
))
{
// 1.计算超限
JSONObject
allowValue
=
JSONObject
.
parseObject
(
analysisBatch
.
getAllowValue
());
Integer
bigTrackGauge
=
Convert
.
toInt
(
allowValue
.
get
(
"bigTrackGauge"
));
// 大轨距
Integer
smallTrackGauge
=
Convert
.
toInt
(
allowValue
.
get
(
"smallTrackGauge"
));
// 小轨距
Integer
allowLevel
=
Convert
.
toInt
(
allowValue
.
get
(
"level"
));
// 水平
Integer
allowTriangularPit
=
Convert
.
toInt
(
allowValue
.
get
(
"triangularPit"
));
// 三角坑
Integer
allowHeight
=
Convert
.
toInt
(
allowValue
.
get
(
"height"
));
// 高低
Integer
allowDirection
=
Convert
.
toInt
(
allowValue
.
get
(
"direction"
));
// 轨向
boolean
isTransfinite
=
false
;
String
allowValueSave
=
""
;
String
measurePointValue
=
""
;
String
transfiniteType
=
""
;
for
(
MovementCourseInfo
movementCourseInfo
:
labourCheckList
)
{
// 轨距
Integer
trackGauge
=
Convert
.
toInt
(
movementCourseInfo
.
getTrackGauge
());
if
(
ObjectUtil
.
isNotEmpty
(
trackGauge
))
{
if
(
trackGauge
>
bigTrackGauge
)
{
isTransfinite
=
true
;
allowValueSave
=
bigTrackGauge
.
toString
();
measurePointValue
=
trackGauge
.
toString
();
transfiniteType
=
"大轨距"
;
break
;
}
else
if
(
trackGauge
<
smallTrackGauge
)
{
isTransfinite
=
true
;
allowValueSave
=
smallTrackGauge
.
toString
();
measurePointValue
=
trackGauge
.
toString
();
transfiniteType
=
"小轨距"
;
break
;
}
}
// 水平
Integer
level
=
Convert
.
toInt
(
movementCourseInfo
.
getLevel
());
if
(
ObjectUtil
.
isNotEmpty
(
level
))
{
if
(
level
>
allowLevel
)
{
isTransfinite
=
true
;
allowValueSave
=
allowLevel
.
toString
();
measurePointValue
=
level
.
toString
();
transfiniteType
=
"水平"
;
break
;
}
}
//三角坑
Integer
triangularPit
=
Convert
.
toInt
(
movementCourseInfo
.
getTriangularPit
());
if
(
ObjectUtil
.
isNotEmpty
(
triangularPit
))
{
if
(
triangularPit
>
allowTriangularPit
)
{
isTransfinite
=
true
;
allowValueSave
=
allowTriangularPit
.
toString
();
measurePointValue
=
triangularPit
.
toString
();
transfiniteType
=
"三角坑"
;
break
;
}
}
// 高低
Integer
height
=
Convert
.
toInt
(
movementCourseInfo
.
getHeight
());
if
(
ObjectUtil
.
isNotEmpty
(
height
))
{
if
(
height
>
allowHeight
)
{
isTransfinite
=
true
;
allowValueSave
=
allowHeight
.
toString
();
measurePointValue
=
height
.
toString
();
transfiniteType
=
"高低"
;
break
;
}
}
// 轨向
Integer
direction
=
Convert
.
toInt
(
movementCourseInfo
.
getDirection
());
if
(
ObjectUtil
.
isNotEmpty
(
direction
))
{
if
(
direction
>
allowDirection
)
{
isTransfinite
=
true
;
allowValueSave
=
allowDirection
.
toString
();
measurePointValue
=
direction
.
toString
();
transfiniteType
=
"轨向"
;
break
;
}
}
}
Integer
isWork
=
1
;
String
reasonLabel
=
""
;
JSONArray
dispatchingList
=
JSONArray
.
parseArray
(
analysisBatch
.
getDispatching
());
for
(
Object
obj
:
dispatchingList
)
{
JSONObject
dispatching
=
(
JSONObject
)
obj
;
String
reasonValue
=
String
.
valueOf
(
dispatching
.
get
(
"reasonValue"
));
reasonLabel
=
String
.
valueOf
(
dispatching
.
get
(
"reasonLabel"
));
if
(
"static_limit"
.
equals
(
reasonValue
))
{
Boolean
isWorkTemp
=
Boolean
.
valueOf
(
dispatching
.
get
(
"isWork"
).
toString
());
if
(
isWorkTemp
)
{
isWork
=
1
;
}
else
{
isWork
=
0
;
}
}
}
// 超限
if
(
isTransfinite
)
{
AnalysisBatchUnitDeviceTransfinite
analysisBatchUnitDeviceTransfinite
=
new
AnalysisBatchUnitDeviceTransfinite
();
analysisBatchUnitDeviceTransfinite
.
setId
(
UUIDGenerator
.
generate
());
analysisBatchUnitDeviceTransfinite
.
setTransfiniteGrade
(
1
);
analysisBatchUnitDeviceTransfinite
.
setTransfiniteGradeName
(
reasonLabel
);
analysisBatchUnitDeviceTransfinite
.
setTransfiniteType
(
transfiniteType
);
analysisBatchUnitDeviceTransfinite
.
setAllowValue
(
allowValueSave
);
analysisBatchUnitDeviceTransfinite
.
setMeasurePointValue
(
measurePointValue
);
analysisBatchUnitDeviceTransfinite
.
setIsWork
(
isWork
);
unitDevice
.
put
(
"transfinite"
,
analysisBatchUnitDeviceTransfinite
);
}
}
// 2.计算评分
if
(
ObjectUtil
.
isNotEmpty
(
labourCheckList
))
{
Integer
analysisType
=
analysisBatch
.
getAnalysisType
();
Integer
finalTrackGauge
=
null
;
Integer
finalLevel
=
null
;
Integer
finalTriangularPit
=
null
;
Integer
finalHeight
=
null
;
Integer
finalDirection
=
null
;
int
sumTrackGauge
=
0
;
int
sumLevel
=
0
;
int
sumTriangularPit
=
0
;
int
sumHeight
=
0
;
int
sumDirection
=
0
;
int
maxTrackGauge
=
0
;
int
maxLevel
=
0
;
int
maxTriangularPit
=
0
;
int
maxHeight
=
0
;
int
maxDirection
=
0
;
int
avgTrackGauge
=
0
;
int
avgLevel
=
0
;
int
avgTriangularPit
=
0
;
int
avgHeight
=
0
;
int
avgDirection
=
0
;
int
trackGaugeSize
=
0
;
int
levelSize
=
0
;
int
triangularPitSize
=
0
;
int
heightSize
=
0
;
int
directionSize
=
0
;
// 循环计算均值/峰值
for
(
MovementCourseInfo
movementCourseInfo
:
labourCheckList
)
{
// 轨距
Integer
trackGauge
=
Convert
.
toInt
(
movementCourseInfo
.
getTrackGauge
());
if
(
ObjectUtil
.
isNotEmpty
(
trackGauge
))
{
trackGauge
=
Math
.
abs
(
trackGauge
);
// 均值
sumTrackGauge
=
sumTrackGauge
+
trackGauge
;
trackGaugeSize
++;
avgTrackGauge
=
sumTrackGauge
/
trackGaugeSize
;
// 峰值
if
(
trackGauge
>
maxTrackGauge
)
{
maxTrackGauge
=
trackGauge
;
}
if
(
1
==
analysisType
)
{
finalTrackGauge
=
avgTrackGauge
;
}
else
{
finalTrackGauge
=
maxLevel
;
}
}
// 水平
Integer
level
=
Convert
.
toInt
(
movementCourseInfo
.
getLevel
());
if
(
ObjectUtil
.
isNotEmpty
(
level
))
{
level
=
Math
.
abs
(
level
);
// 均值
sumLevel
=
sumLevel
+
level
;
levelSize
++;
avgLevel
=
sumLevel
/
levelSize
;
// 峰值
if
(
level
>
maxLevel
)
{
maxLevel
=
level
;
}
if
(
1
==
analysisType
)
{
finalLevel
=
avgLevel
;
}
else
{
finalLevel
=
maxLevel
;
}
}
//三角坑
Integer
triangularPit
=
Convert
.
toInt
(
movementCourseInfo
.
getTriangularPit
());
if
(
ObjectUtil
.
isNotEmpty
(
triangularPit
))
{
triangularPit
=
Math
.
abs
(
triangularPit
);
// 均值
sumTriangularPit
=
sumTriangularPit
+
triangularPit
;
triangularPitSize
++;
avgTriangularPit
=
sumTriangularPit
/
triangularPitSize
;
// 峰值
if
(
triangularPit
>
maxTriangularPit
)
{
maxTriangularPit
=
triangularPit
;
}
if
(
1
==
analysisType
)
{
finalTriangularPit
=
avgTriangularPit
;
}
else
{
finalTriangularPit
=
maxTriangularPit
;
}
}
// 高低
Integer
height
=
Convert
.
toInt
(
movementCourseInfo
.
getHeight
());
if
(
ObjectUtil
.
isNotEmpty
(
height
))
{
height
=
Math
.
abs
(
height
);
// 均值
sumHeight
=
sumHeight
+
height
;
heightSize
++;
avgHeight
=
sumHeight
/
heightSize
;
// 峰值
if
(
height
>
maxHeight
)
{
maxHeight
=
height
;
}
if
(
1
==
analysisType
)
{
finalHeight
=
avgHeight
;
}
else
{
finalHeight
=
maxHeight
;
}
}
// 轨向
Integer
direction
=
Convert
.
toInt
(
movementCourseInfo
.
getDirection
());
if
(
ObjectUtil
.
isNotEmpty
(
direction
))
{
direction
=
Math
.
abs
(
direction
);
// 均值
sumDirection
=
sumDirection
+
direction
;
directionSize
++;
avgDirection
=
sumDirection
/
directionSize
;
// 峰值
if
(
direction
>
maxDirection
)
{
maxDirection
=
direction
;
}
if
(
1
==
analysisType
)
{
finalDirection
=
avgDirection
;
}
else
{
finalDirection
=
maxDirection
;
}
}
}
ConfigLabourCheck
configLabour
=
configLabourCheckService
.
lambdaQuery
()
.
eq
(
ConfigLabourCheck:
:
getSpeedMax
,
analysisBatch
.
getSpeedMax
())
.
eq
(
ConfigLabourCheck:
:
getSpeedMin
,
analysisBatch
.
getSpeedMin
())
.
eq
(
ConfigLabourCheck:
:
getDelFlag
,
"0"
)
.
last
(
"limit 1"
)
.
one
();
// 1-钢轨,2-曲线,3-竖曲线,4-道岔
Integer
type
=
Convert
.
toInt
(
unitDevice
.
get
(
"type"
));
JSONObject
jsonObject
=
null
;
if
(
type
==
1
)
{
jsonObject
=
JSONObject
.
parseObject
(
configLabour
.
getRail
());
}
else
if
(
type
==
2
)
{
jsonObject
=
JSONObject
.
parseObject
(
configLabour
.
getCurve
());
}
else
if
(
type
==
3
)
{
jsonObject
=
JSONObject
.
parseObject
(
configLabour
.
getVerticalCurve
());
}
else
if
(
type
==
4
)
{
jsonObject
=
JSONObject
.
parseObject
(
configLabour
.
getRailSwitch
());
}
BigDecimal
trackGaugeWeightValues
=
jsonObject
.
getBigDecimal
(
"trackGauge"
);
BigDecimal
directionWeightValues
=
jsonObject
.
getBigDecimal
(
"direction"
);
BigDecimal
triangularPitWeightValues
=
jsonObject
.
getBigDecimal
(
"triangularPit"
);
BigDecimal
heightWeightValues
=
jsonObject
.
getBigDecimal
(
"height"
);
BigDecimal
levelWeightValues
=
jsonObject
.
getBigDecimal
(
"level"
);
// 总单元得分
BigDecimal
sumUnitScore
=
null
;
// 轨距单元得分
BigDecimal
trackGaugeUnitScore
;
List
<
AnalysisBatchUnitDevicePointScore
>
scoreList
=
new
ArrayList
<>();
if
(
ObjectUtil
.
isNotEmpty
(
finalTrackGauge
))
{
trackGaugeUnitScore
=
trackGaugeWeightValues
.
multiply
(
new
BigDecimal
(
finalTrackGauge
.
toString
()));
if
(
sumUnitScore
==
null
)
{
sumUnitScore
=
BigDecimal
.
ZERO
;
}
sumUnitScore
=
sumUnitScore
.
add
(
trackGaugeUnitScore
);
AnalysisBatchUnitDevicePointScore
score
=
new
AnalysisBatchUnitDevicePointScore
();
score
.
setId
(
UUIDGenerator
.
generate
());
score
.
setAnalysisType
(
analysisType
);
score
.
setSpeedMax
(
analysisBatch
.
getSpeedMax
());
score
.
setSpeedMin
(
analysisBatch
.
getSpeedMin
());
score
.
setAnalysisBatchId
(
analysisBatch
.
getId
());
score
.
setAnalysisBatchCode
(
analysisBatch
.
getAnalysisBatchCode
());
score
.
setAnalysisBatchUnitDeviceId
(
"轨距"
);
score
.
setPointValue
(
finalTrackGauge
);
score
.
setWeightValues
(
trackGaugeWeightValues
);
score
.
setPointScore
(
trackGaugeUnitScore
);
scoreList
.
add
(
score
);
}
// 轨向单元得分
BigDecimal
directionGaugeUnitScore
=
null
;
if
(
ObjectUtil
.
isNotEmpty
(
finalDirection
))
{
directionGaugeUnitScore
=
directionWeightValues
.
multiply
(
new
BigDecimal
(
finalDirection
.
toString
()));
if
(
sumUnitScore
==
null
)
{
sumUnitScore
=
BigDecimal
.
ZERO
;
}
sumUnitScore
=
sumUnitScore
.
add
(
directionGaugeUnitScore
);
AnalysisBatchUnitDevicePointScore
score
=
new
AnalysisBatchUnitDevicePointScore
();
score
.
setId
(
UUIDGenerator
.
generate
());
score
.
setAnalysisType
(
analysisType
);
score
.
setSpeedMax
(
analysisBatch
.
getSpeedMax
());
score
.
setSpeedMin
(
analysisBatch
.
getSpeedMin
());
score
.
setAnalysisBatchId
(
analysisBatch
.
getId
());
score
.
setAnalysisBatchCode
(
analysisBatch
.
getAnalysisBatchCode
());
score
.
setAnalysisBatchUnitDeviceId
(
"轨向"
);
score
.
setPointValue
(
finalDirection
);
score
.
setWeightValues
(
directionGaugeUnitScore
);
score
.
setPointScore
(
directionGaugeUnitScore
);
scoreList
.
add
(
score
);
}
// 三角坑单元得分
BigDecimal
triangularPitGaugeUnitScore
;
if
(
ObjectUtil
.
isNotEmpty
(
finalTriangularPit
))
{
triangularPitGaugeUnitScore
=
triangularPitWeightValues
.
multiply
(
new
BigDecimal
(
finalTriangularPit
.
toString
()));
if
(
sumUnitScore
==
null
)
{
sumUnitScore
=
BigDecimal
.
ZERO
;
}
sumUnitScore
=
sumUnitScore
.
add
(
triangularPitGaugeUnitScore
);
AnalysisBatchUnitDevicePointScore
score
=
new
AnalysisBatchUnitDevicePointScore
();
score
.
setId
(
UUIDGenerator
.
generate
());
score
.
setAnalysisType
(
analysisType
);
score
.
setSpeedMax
(
analysisBatch
.
getSpeedMax
());
score
.
setSpeedMin
(
analysisBatch
.
getSpeedMin
());
score
.
setAnalysisBatchId
(
analysisBatch
.
getId
());
score
.
setAnalysisBatchCode
(
analysisBatch
.
getAnalysisBatchCode
());
score
.
setAnalysisBatchUnitDeviceId
(
"三角坑"
);
score
.
setPointValue
(
finalTriangularPit
);
score
.
setWeightValues
(
triangularPitWeightValues
);
score
.
setPointScore
(
triangularPitGaugeUnitScore
);
scoreList
.
add
(
score
);
}
// 高低单元得分
BigDecimal
heightGaugeUnitScore
;
if
(
ObjectUtil
.
isNotEmpty
(
finalHeight
))
{
heightGaugeUnitScore
=
heightWeightValues
.
multiply
(
new
BigDecimal
(
finalHeight
.
toString
()));
if
(
sumUnitScore
==
null
)
{
sumUnitScore
=
BigDecimal
.
ZERO
;
}
sumUnitScore
=
sumUnitScore
.
add
(
heightGaugeUnitScore
);
AnalysisBatchUnitDevicePointScore
score
=
new
AnalysisBatchUnitDevicePointScore
();
score
.
setId
(
UUIDGenerator
.
generate
());
score
.
setAnalysisType
(
analysisType
);
score
.
setSpeedMax
(
analysisBatch
.
getSpeedMax
());
score
.
setSpeedMin
(
analysisBatch
.
getSpeedMin
());
score
.
setAnalysisBatchId
(
analysisBatch
.
getId
());
score
.
setAnalysisBatchCode
(
analysisBatch
.
getAnalysisBatchCode
());
score
.
setAnalysisBatchUnitDeviceId
(
"高低"
);
score
.
setPointValue
(
finalHeight
);
score
.
setWeightValues
(
heightWeightValues
);
score
.
setPointScore
(
heightGaugeUnitScore
);
scoreList
.
add
(
score
);
}
// 水平单元得分
BigDecimal
levelUnitScore
;
if
(
ObjectUtil
.
isNotEmpty
(
finalLevel
))
{
levelUnitScore
=
levelWeightValues
.
multiply
(
new
BigDecimal
(
finalLevel
.
toString
()));
if
(
sumUnitScore
==
null
)
{
sumUnitScore
=
BigDecimal
.
ZERO
;
}
sumUnitScore
=
sumUnitScore
.
add
(
levelUnitScore
);
AnalysisBatchUnitDevicePointScore
score
=
new
AnalysisBatchUnitDevicePointScore
();
score
.
setId
(
UUIDGenerator
.
generate
());
score
.
setAnalysisType
(
analysisType
);
score
.
setSpeedMax
(
analysisBatch
.
getSpeedMax
());
score
.
setSpeedMin
(
analysisBatch
.
getSpeedMin
());
score
.
setAnalysisBatchId
(
analysisBatch
.
getId
());
score
.
setAnalysisBatchCode
(
analysisBatch
.
getAnalysisBatchCode
());
score
.
setAnalysisBatchUnitDeviceId
(
"高低"
);
score
.
setPointValue
(
finalLevel
);
score
.
setWeightValues
(
levelWeightValues
);
score
.
setPointScore
(
levelUnitScore
);
scoreList
.
add
(
score
);
}
unitDevice
.
put
(
"labourCheckScore"
,
sumUnitScore
);
unitDevice
.
put
(
"labourCheckScoreList"
,
scoreList
);
}
}
}
// 3.保存算法结果
if
(
ObjectUtil
.
isNotEmpty
(
unitDeviceTable
))
{
List
<
AnalysisBatchUnitDevice
>
analysisBatchUnitDevices
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
Map
<
String
,
Object
>>
entry
:
unitDeviceTable
.
entrySet
())
{
Map
<
String
,
Object
>
unitDevice
=
entry
.
getValue
();
AnalysisBatchUnitDevice
analysisBatchUnitDevice
=
new
AnalysisBatchUnitDevice
();
analysisBatchUnitDevice
.
setId
(
UUIDGenerator
.
generate
());
analysisBatchUnitDevice
.
setAnalysisBatchId
(
analysisBatch
.
getId
());
analysisBatchUnitDevice
.
setAnalysisBatchCode
(
analysisBatch
.
getAnalysisBatchCode
());
analysisBatchUnitDevice
.
setUnitId
(
Convert
.
toStr
(
unitDevice
.
get
(
"id"
)));
analysisBatchUnitDevice
.
setUnitCode
(
Convert
.
toStr
(
unitDevice
.
get
(
"unitCode"
)));
analysisBatchUnitDevice
.
setUnitDeviceCode
(
Convert
.
toStr
(
unitDevice
.
get
(
"deviceCode"
)));
analysisBatchUnitDevice
.
setUnitType
(
Convert
.
toInt
(
unitDevice
.
get
(
"type"
)));
analysisBatchUnitDevice
.
setUnitTypeName
(
Convert
.
toStr
(
unitDevice
.
get
(
"typeName"
)));
analysisBatchUnitDevice
.
setUnitStartingMileage
(
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"startMileage"
)));
analysisBatchUnitDevice
.
setUnitCenterMileage
(
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"centerMileage"
)));
analysisBatchUnitDevice
.
setUnitEndMileage
(
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"endMileage"
)));
Object
labourCheckData
=
unitDevice
.
get
(
"labourCheck"
);
if
(
ObjectUtil
.
isNotEmpty
(
labourCheckData
))
{
analysisBatchUnitDevice
.
setLabourCheck
(
1
);
}
else
{
analysisBatchUnitDevice
.
setLabourCheck
(
0
);
}
BigDecimal
labourCheckScore
=
(
BigDecimal
)
unitDevice
.
get
(
"labourCheckScore"
);
// -1代表未评分
if
(
labourCheckScore
==
null
)
{
analysisBatchUnitDevice
.
setLabourCheckScore
(
new
BigDecimal
(
"-1"
));
}
else
{
analysisBatchUnitDevice
.
setLabourCheckScore
(
labourCheckScore
);
// 先写死
analysisBatchUnitDevice
.
setUnitScore
(
labourCheckScore
);
analysisBatchUnitDevice
.
setUnitScoreLevel
(
3
);
}
Object
railDeviceData
=
unitDevice
.
get
(
"railDevice"
);
if
(
ObjectUtil
.
isNotEmpty
(
railDeviceData
))
{
analysisBatchUnitDevice
.
setRailDeviceCheck
(
1
);
}
else
{
analysisBatchUnitDevice
.
setRailDeviceCheck
(
0
);
}
analysisBatchUnitDevices
.
add
(
analysisBatchUnitDevice
);
// 保存超限
Object
transfiniteData
=
unitDevice
.
get
(
"transfinite"
);
if
(
ObjectUtil
.
isNotEmpty
(
transfiniteData
))
{
AnalysisBatchUnitDeviceTransfinite
transfinite
=
(
AnalysisBatchUnitDeviceTransfinite
)
transfiniteData
;
transfinite
.
setAnalysisBatchUnitDeviceId
(
analysisBatchUnitDevice
.
getId
());
transfinite
.
setAnalysisBatchId
(
analysisBatchUnitDevice
.
getAnalysisBatchId
());
transfinite
.
setAnalysisBatchCode
(
analysisBatchUnitDevice
.
getAnalysisBatchCode
());
transfinite
.
setUnitId
(
analysisBatchUnitDevice
.
getUnitId
());
transfinite
.
setUnitCode
(
analysisBatchUnitDevice
.
getUnitCode
());
transfinite
.
setUnitType
(
analysisBatchUnitDevice
.
getUnitType
());
transfinite
.
setUnitTypeName
(
analysisBatchUnitDevice
.
getUnitTypeName
());
analysisBatchUnitDeviceTransfiniteService
.
lambdaUpdate
().
eq
(
AnalysisBatchUnitDeviceTransfinite:
:
getAnalysisBatchUnitDeviceId
,
analysisBatchUnitDevice
.
getId
()).
remove
();
analysisBatchUnitDeviceTransfiniteService
.
save
(
transfinite
);
}
// 保存得分
List
<
AnalysisBatchUnitDevicePointScore
>
scoreList
=
(
List
<
AnalysisBatchUnitDevicePointScore
>)
unitDevice
.
get
(
"labourCheckScoreList"
);
if
(
ObjectUtil
.
isNotEmpty
(
scoreList
))
{
for
(
AnalysisBatchUnitDevicePointScore
score
:
scoreList
)
{
score
.
setAnalysisBatchUnitDeviceId
(
analysisBatchUnitDevice
.
getId
());
score
.
setAnalysisBatchId
(
analysisBatchUnitDevice
.
getAnalysisBatchId
());
score
.
setAnalysisBatchCode
(
analysisBatchUnitDevice
.
getAnalysisBatchCode
());
score
.
setUnitId
(
analysisBatchUnitDevice
.
getUnitId
());
score
.
setUnitCode
(
analysisBatchUnitDevice
.
getUnitCode
());
score
.
setUnitType
(
analysisBatchUnitDevice
.
getUnitType
());
score
.
setUnitTypeName
(
analysisBatchUnitDevice
.
getUnitTypeName
());
}
analysisBatchUnitDevicePointScoreService
.
lambdaUpdate
().
eq
(
AnalysisBatchUnitDevicePointScore:
:
getAnalysisBatchUnitDeviceId
,
analysisBatchUnitDevice
.
getId
()).
remove
();
analysisBatchUnitDevicePointScoreService
.
saveBatch
(
scoreList
);
}
}
analysisBatchUnitDeviceService
.
lambdaUpdate
().
eq
(
AnalysisBatchUnitDevice:
:
getAnalysisBatchId
,
analysisBatchId
).
remove
();
analysisBatchUnitDeviceService
.
saveBatch
(
analysisBatchUnitDevices
);
}
}
public
void
analysis
(
String
analysisBatchId
)
{
Map
<
String
,
Map
<
String
,
Object
>>
unitDeviceTable
=
new
TreeMap
<>();
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/dynamicStaticAnalysis/entity/AnalysisBatchUnitDevice.java
View file @
9234c3b2
...
...
@@ -133,7 +133,6 @@ public class AnalysisBatchUnitDevice implements Serializable {
@TableField
(
"add_device_check_score"
)
private
BigDecimal
addDeviceCheckScore
;
@ApiModelProperty
(
"备注"
)
@TableField
(
"remark"
)
private
String
remark
;
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/dynamicStaticAnalysis/mapper/xml/AnalysisAlgorithmMapper.xml
View file @
9234c3b2
...
...
@@ -8,6 +8,7 @@
deviceCode,
startMileage,
endMileage,
ROUND((startMileage + endMileage) / 2, 3) centerMileage,
type,
typeName
FROM (SELECT t1.id,
...
...
@@ -31,7 +32,7 @@
2 type,
'曲线' typeName
FROM t_da_curve_management t1
LEFT JOIN t_sn_train_station t2 ON t1.section_id = t1
.id
LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2
.id
WHERE t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
...
...
@@ -45,10 +46,12 @@
3 type,
'竖曲线' typeName
FROM t_da_vertical_curve_management t1
LEFT JOIN t_sn_train_station t2 ON t1.section_id = t1
.id
LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2
.id
WHERE t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
UNION ALL
SELECT t1.id,
t1.unit_code unitCode,
t1.switch_code deviceCode,
...
...
@@ -57,11 +60,11 @@
4 type,
'道岔' typeName
FROM t_da_switch_management t1
LEFT JOIN t_sn_section_station_map t2 ON t1.section_station_map_id = t2.id
LEFT JOIN t_sn_subway_section t3 ON t2.section_id = t3.id
AND t3.line_alias_id = t1.line_alias_id
LEFT JOIN t_sn_section_station_map t2 ON t1.section_station_map_id = t2.id
LEFT JOIN t_sn_subway_section t3 ON t2.section_id = t3.id AND t3.line_alias_id = t1.line_alias_id
WHERE t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}) t
AND t2.light_rail_id = #{lightRailId}
) t
ORDER BY t.startMileage
</select>
</mapper>
jeecg-module-system/src/main/java/org/jeecg/modules/maintenanceWork/controller/WorkBatchController.java
View file @
9234c3b2
...
...
@@ -62,17 +62,18 @@ public class WorkBatchController extends JeecgController<WorkBatch, IWorkBatchSe
return
Result
.
OK
(
"操作成功"
);
}
@AutoLog
(
value
=
"维修作业管理-作业计划批次管理-超限页面新增"
)
@ApiOperation
(
value
=
"维修作业管理-作业计划批次管理-超限页面新增"
,
notes
=
"维修作业管理-作业计划批次管理-超限页面新增"
)
@PostMapping
(
value
=
"/batchSaveRecord"
)
public
Result
<
String
>
batchSaveRecord
(
@RequestBody
AnalysisBatchSaveDTO
dto
)
{
@AutoLog
(
value
=
"维修作业管理-作业计划批次管理-维修作业管理页面更新"
)
@ApiOperation
(
value
=
"维修作业管理-作业计划批次管理-维修作业管理页面更新"
,
notes
=
"维修作业管理-作业计划批次管理-维修作业管理页面更新"
)
@PostMapping
(
value
=
"/updateRecord"
)
public
Result
<
String
>
updateRecord
(
@RequestBody
WorkBatchSaveOrUpdateDTO
dto
)
{
this
.
service
.
batchSaveRecord
(
dto
);
this
.
service
.
updateRecord
(
dto
);
return
Result
.
OK
(
"操作成功"
);
}
@AutoLog
(
value
=
"维修作业管理-作业计划批次管理-通过id删除"
)
@ApiOperation
(
value
=
"维修作业管理-作业计划批次管理-通过id删除"
,
notes
=
"维修作业管理-作业计划批次管理-通过id删除"
)
@GetMapping
(
value
=
"/deleteRecord"
)
...
...
@@ -83,25 +84,11 @@ public class WorkBatchController extends JeecgController<WorkBatch, IWorkBatchSe
@AutoLog
(
value
=
"维修作业管理-作业计划批次管理-获取里程单元设备"
)
@ApiOperation
(
value
=
"维修作业管理-作业计划批次管理-获取里程单元设备"
,
notes
=
"维修作业管理-作业计划批次管理-获取里程单元设备"
)
@
Ge
tMapping
(
value
=
"/getUnitDeviceList"
)
@
Pos
tMapping
(
value
=
"/getUnitDeviceList"
)
public
Result
<
List
<
Map
<
String
,
Object
>>>
getUnitDeviceList
(
@RequestBody
UnitDeviceDTO
dto
)
{
List
<
Map
<
String
,
Object
>>
records
=
this
.
service
.
getUnitDeviceList
(
dto
);
return
Result
.
OK
(
records
);
}
@AutoLog
(
value
=
"维修作业管理-作业计划批次管理-维修作业管理页面详情新增"
)
@ApiOperation
(
value
=
"维修作业管理-作业计划批次管理-维修作业管理页面新增"
,
notes
=
"维修作业管理-作业计划批次管理-维修作业管理页面新增"
)
@PostMapping
(
value
=
"/saveDetailRecord"
)
public
Result
<
String
>
saveDetailRecord
(
@RequestBody
WorkBatchDetailDTO
dto
)
{
this
.
service
.
saveDetailRecord
(
dto
);
return
Result
.
OK
(
"操作成功"
);
}
}
jeecg-module-system/src/main/java/org/jeecg/modules/maintenanceWork/dto/AnalysisBatchSaveDTO.java
0 → 100644
View file @
9234c3b2
package
org
.
jeecg
.
modules
.
maintenanceWork
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* <p>
* 维修作业管理-作业计划批次管理表
* </p>
*
* @author hkl
* @since 2023-08-09
*/
@Data
@ApiModel
(
value
=
"PageSaveOrUpdateDTO对象"
,
description
=
"维修作业管理-页面来源保存或更新dto"
)
public
class
AnalysisBatchSaveDTO
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
id
;
@ApiModelProperty
(
"作业计划批次号"
)
private
String
workBatchCode
;
@ApiModelProperty
(
"所属线路id"
)
private
String
lightRailId
;
@ApiModelProperty
(
"所属线路名称"
)
private
String
lightRailName
;
@ApiModelProperty
(
"所属线别id"
)
private
String
lineAliasId
;
@ApiModelProperty
(
"所属线别名称"
)
private
String
lineAliasName
;
@ApiModelProperty
(
"作业起始里程"
)
private
BigDecimal
workStartingMileage
;
@ApiModelProperty
(
"作业终点里程"
)
private
BigDecimal
workEndMileage
;
@ApiModelProperty
(
"作业终止时间"
)
private
Date
workStartTime
;
@ApiModelProperty
(
"作业终止时间"
)
private
Date
workEndTime
;
@ApiModelProperty
(
"作业班组"
)
private
String
team
;
@ApiModelProperty
(
"作业状态 0-未作业 1-已作业"
)
private
Integer
workStatus
;
@ApiModelProperty
(
"来源 1-一键全部派工 2-一键失格派工"
)
private
Integer
saveType
;
@ApiModelProperty
(
"分析批次id"
)
private
String
analysisBatchId
;
}
jeecg-module-system/src/main/java/org/jeecg/modules/maintenanceWork/dto/UnitDeviceDTO.java
View file @
9234c3b2
...
...
@@ -9,12 +9,18 @@ import java.math.BigDecimal;
@Data
@ApiModel
(
value
=
"UnitDeviceDTO对象"
,
description
=
"fsf1"
)
public
class
UnitDeviceDTO
{
@ApiModelProperty
(
"
作业计划批次号
"
)
@ApiModelProperty
(
"
车站id
"
)
private
String
lightRailId
;
@ApiModelProperty
(
"作业计划批次号"
)
@ApiModelProperty
(
"线别id"
)
private
String
lineAliasId
;
@ApiModelProperty
(
"作业计划批次号"
)
@ApiModelProperty
(
"开始里程"
)
private
BigDecimal
startMileage
;
@ApiModelProperty
(
"作业计划批次号"
)
@ApiModelProperty
(
"结束里程"
)
private
BigDecimal
endMileage
;
@ApiModelProperty
(
"设备类型 1-钢轨 2-曲线 3-竖曲线 4-道岔"
)
private
String
type
;
}
jeecg-module-system/src/main/java/org/jeecg/modules/maintenanceWork/dto/WorkBatchSaveOrUpdateDTO.java
View file @
9234c3b2
...
...
@@ -6,6 +6,7 @@ import lombok.Data;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
/**
* <p>
...
...
@@ -58,4 +59,7 @@ public class WorkBatchSaveOrUpdateDTO {
@ApiModelProperty
(
"作业状态 0-未作业 1-已作业"
)
private
Integer
workStatus
;
@ApiModelProperty
(
"单元设备列表"
)
private
List
<
DispatchDTO
>
unitDeviceList
;
}
jeecg-module-system/src/main/java/org/jeecg/modules/maintenanceWork/service/IWorkBatchService.java
View file @
9234c3b2
...
...
@@ -23,13 +23,13 @@ public interface IWorkBatchService extends IService<WorkBatch> {
void
saveRecord
(
WorkBatchSaveOrUpdateDTO
dto
);
void
updateRecord
(
WorkBatchSaveOrUpdateDTO
dto
);
void
deleteRecord
(
String
id
);
void
transfiniteSaveRecord
(
WorkBatchTransfiniteSaveDTO
dto
);
void
saveDetailRecord
(
WorkBatchDetailDTO
dto
);
List
<
Map
<
String
,
Object
>>
getUnitDeviceList
(
UnitDeviceDTO
dto
);
void
batchSaveRecord
(
AnalysisBatchSaveDTO
dto
);
}
jeecg-module-system/src/main/java/org/jeecg/modules/maintenanceWork/service/impl/WorkBatchServiceImpl.java
View file @
9234c3b2
...
...
@@ -2,11 +2,14 @@ package org.jeecg.modules.maintenanceWork.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.jeecg.common.util.UUIDGenerator
;
import
org.jeecg.modules.dynamicStaticAnalysis.entity.AnalysisBatchUnitDevice
;
import
org.jeecg.modules.dynamicStaticAnalysis.mapper.AnalysisAlgorithmMapper
;
import
org.jeecg.modules.dynamicStaticAnalysis.mapper.AnalysisBatchUnitDeviceMapper
;
import
org.jeecg.modules.maintenanceWork.dto.*
;
import
org.jeecg.modules.maintenanceWork.entity.WorkBatch
;
import
org.jeecg.modules.maintenanceWork.entity.WorkBatchDetail
;
...
...
@@ -40,6 +43,9 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
@Resource
private
AnalysisAlgorithmMapper
analysisAlgorithmMapper
;
@Resource
private
AnalysisBatchUnitDeviceMapper
analysisBatchUnitDeviceMapper
;
@Override
public
Page
<
WorkBatchVO
>
listRecord
(
Page
<
WorkBatchVO
>
pageData
,
WorkBatchDTO
dto
)
{
return
this
.
baseMapper
.
listRecord
(
pageData
,
dto
);
...
...
@@ -47,15 +53,40 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
@Override
public
void
saveRecord
(
WorkBatchSaveOrUpdateDTO
dto
)
{
// 保存主信息
WorkBatch
workBatch
=
BeanUtil
.
copyProperties
(
dto
,
WorkBatch
.
class
);
workBatch
.
setId
(
UUIDGenerator
.
generate
());
this
.
save
(
workBatch
);
}
if
(
ObjectUtil
.
isEmpty
(
dto
.
getId
()))
{
workBatch
.
setId
(
UUIDGenerator
.
generate
());
workBatch
.
setWorkStatus
(
9
);
}
@Override
public
void
updateRecord
(
WorkBatchSaveOrUpdateDTO
dto
)
{
WorkBatch
workBatch
=
BeanUtil
.
copyProperties
(
dto
,
WorkBatch
.
class
);
this
.
updateById
(
workBatch
);
this
.
saveOrUpdate
(
workBatch
);
// 保证明细信息
// 先删除
LambdaQueryWrapper
<
WorkBatchDetail
>
delWrapper
=
Wrappers
.
lambdaQuery
();
delWrapper
.
eq
(
WorkBatchDetail:
:
getWorkBatchId
,
dto
.
getId
());
workBatchDetailMapper
.
delete
(
delWrapper
);
List
<
DispatchDTO
>
transfiniteList
=
dto
.
getUnitDeviceList
();
for
(
DispatchDTO
dispatchDTO
:
transfiniteList
)
{
WorkBatchDetail
workBatchDetail
=
new
WorkBatchDetail
();
workBatchDetail
.
setId
(
UUIDGenerator
.
generate
());
workBatchDetail
.
setWorkBatchId
(
dto
.
getId
());
workBatchDetail
.
setWorkBatchCode
(
dto
.
getWorkBatchCode
());
workBatchDetail
.
setUnitId
(
dispatchDTO
.
getUnitId
());
workBatchDetail
.
setUnitCode
(
dispatchDTO
.
getUnitCode
());
workBatchDetail
.
setUnitType
(
dispatchDTO
.
getUnitType
());
workBatchDetail
.
setUnitTypeName
(
dispatchDTO
.
getUnitTypeName
());
workBatchDetail
.
setUnitDeviceCode
(
dispatchDTO
.
getUnitDeviceCode
());
workBatchDetail
.
setUnitEndMileage
(
dispatchDTO
.
getUnitStartingMileage
());
workBatchDetail
.
setUnitEndMileage
(
dispatchDTO
.
getUnitEndMileage
());
workBatchDetail
.
setUnitCenterMileage
(
dispatchDTO
.
getUnitCenterMileage
());
workBatchDetail
.
setUnitScore
(
dispatchDTO
.
getUnitScore
());
workBatchDetail
.
setUnitScoreLevel
(
dispatchDTO
.
getUnitScoreLevel
());
workBatchDetail
.
setUnitScoreLevelStr
(
dispatchDTO
.
getUnitScoreLevelStr
());
workBatchDetailMapper
.
insert
(
workBatchDetail
);
}
}
@Override
...
...
@@ -99,43 +130,13 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
}
@Override
public
void
saveDetailRecord
(
WorkBatchDetailDTO
dto
)
{
// 先删除
LambdaQueryWrapper
<
WorkBatchDetail
>
delWrapper
=
Wrappers
.
lambdaQuery
();
delWrapper
.
eq
(
WorkBatchDetail:
:
getWorkBatchId
,
dto
.
getWorkBatchId
());
workBatchDetailMapper
.
delete
(
delWrapper
);
List
<
DispatchDTO
>
transfiniteList
=
dto
.
getUnitDeviceList
();
for
(
DispatchDTO
dispatchDTO
:
transfiniteList
)
{
WorkBatchDetail
workBatchDetail
=
new
WorkBatchDetail
();
workBatchDetail
.
setId
(
UUIDGenerator
.
generate
());
workBatchDetail
.
setWorkBatchId
(
dto
.
getWorkBatchId
());
workBatchDetail
.
setWorkBatchCode
(
dto
.
getWorkBatchCode
());
workBatchDetail
.
setUnitId
(
dispatchDTO
.
getUnitId
());
workBatchDetail
.
setUnitCode
(
dispatchDTO
.
getUnitCode
());
workBatchDetail
.
setUnitType
(
dispatchDTO
.
getUnitType
());
workBatchDetail
.
setUnitTypeName
(
dispatchDTO
.
getUnitTypeName
());
workBatchDetail
.
setUnitDeviceCode
(
dispatchDTO
.
getUnitDeviceCode
());
workBatchDetail
.
setUnitEndMileage
(
dispatchDTO
.
getUnitStartingMileage
());
workBatchDetail
.
setUnitEndMileage
(
dispatchDTO
.
getUnitEndMileage
());
workBatchDetail
.
setUnitCenterMileage
(
dispatchDTO
.
getUnitCenterMileage
());
workBatchDetail
.
setUnitScore
(
dispatchDTO
.
getUnitScore
());
workBatchDetail
.
setUnitScoreLevel
(
dispatchDTO
.
getUnitScoreLevel
());
workBatchDetail
.
setUnitScoreLevelStr
(
dispatchDTO
.
getUnitScoreLevelStr
());
workBatchDetailMapper
.
insert
(
workBatchDetail
);
}
}
@Override
public
List
<
Map
<
String
,
Object
>>
getUnitDeviceList
(
UnitDeviceDTO
dto
)
{
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
unitDeviceList
=
analysisAlgorithmMapper
.
getUnitDevice
(
dto
.
getLightRailId
(),
dto
.
getLineAliasId
());
for
(
Map
<
String
,
Object
>
unitDevice
:
unitDeviceList
)
{
BigDecimal
startMileage
=
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"startMileage"
));
BigDecimal
endMileage
=
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"endMileage"
));
BigDecimal
centerMileage
=
startMileage
.
add
(
endMileage
).
divide
(
new
BigDecimal
(
"2"
),
3
,
RoundingMode
.
HALF_UP
);
BigDecimal
centerMileage
=
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"centerMileage"
));
if
(
dto
.
getStartMileage
().
compareTo
(
centerMileage
)
<=
0
&&
dto
.
getEndMileage
().
compareTo
(
centerMileage
)
>
0
)
{
resultList
.
add
(
unitDevice
);
}
...
...
@@ -143,4 +144,39 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
return
resultList
;
}
@Override
public
void
batchSaveRecord
(
AnalysisBatchSaveDTO
dto
)
{
WorkBatch
workBatch
=
BeanUtil
.
copyProperties
(
dto
,
WorkBatch
.
class
);
workBatch
.
setId
(
UUIDGenerator
.
generate
());
workBatch
.
setWorkStatus
(
9
);
// 9-已作业
workBatch
.
setSource
(
2
);
// 超限页面
this
.
save
(
workBatch
);
// 2.查询
LambdaQueryWrapper
<
AnalysisBatchUnitDevice
>
unitDeviceWrapper
=
Wrappers
.
lambdaQuery
();
if
(
dto
.
getSaveType
()
==
2
)
{
unitDeviceWrapper
.
eq
(
AnalysisBatchUnitDevice:
:
getUnitScoreLevel
,
3
);
}
List
<
AnalysisBatchUnitDevice
>
unitDevices
=
analysisBatchUnitDeviceMapper
.
selectList
(
unitDeviceWrapper
);
for
(
AnalysisBatchUnitDevice
unitDevice
:
unitDevices
)
{
WorkBatchDetail
workBatchDetail
=
new
WorkBatchDetail
();
workBatchDetail
.
setId
(
UUIDGenerator
.
generate
());
workBatchDetail
.
setWorkBatchId
(
workBatch
.
getId
());
workBatchDetail
.
setWorkBatchCode
(
workBatch
.
getWorkBatchCode
());
workBatchDetail
.
setUnitId
(
unitDevice
.
getUnitId
());
workBatchDetail
.
setUnitCode
(
unitDevice
.
getUnitCode
());
workBatchDetail
.
setUnitType
(
unitDevice
.
getUnitType
());
workBatchDetail
.
setUnitTypeName
(
unitDevice
.
getUnitTypeName
());
workBatchDetail
.
setUnitDeviceCode
(
unitDevice
.
getUnitDeviceCode
());
workBatchDetail
.
setUnitEndMileage
(
unitDevice
.
getUnitStartingMileage
());
workBatchDetail
.
setUnitEndMileage
(
unitDevice
.
getUnitEndMileage
());
workBatchDetail
.
setUnitCenterMileage
(
unitDevice
.
getUnitCenterMileage
());
workBatchDetail
.
setUnitScore
(
unitDevice
.
getUnitScore
());
workBatchDetail
.
setUnitScoreLevel
(
unitDevice
.
getUnitScoreLevel
());
workBatchDetail
.
setUnitScoreLevelStr
(
unitDevice
.
getUnitScoreLevelStr
());
workBatchDetailMapper
.
insert
(
workBatchDetail
);
}
}
}
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