Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
signal
traffic-signal-platform
Commits
535d9b8a
Commit
535d9b8a
authored
Nov 25, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 路口指标方向指标
parent
27636fc2
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
126 additions
and
8 deletions
+126
-8
CrossIndexController.java
.../wanji/opt/controller/signalopt/CrossIndexController.java
+50
-0
GreenBeltKafkaDTO.java
...ce/src/main/java/net/wanji/opt/dto/GreenBeltKafkaDTO.java
+1
-1
CrossIndexService.java
...rc/main/java/net/wanji/opt/service/CrossIndexService.java
+14
-0
CrossIndexServiceImpl.java
...ava/net/wanji/opt/service/impl/CrossIndexServiceImpl.java
+39
-0
GreenBeltInfoServiceImpl.java
.../net/wanji/opt/service/impl/GreenBeltInfoServiceImpl.java
+1
-1
StrategyControlDataEntity.java
...t/wanji/opt/synthesis/pojo/StrategyControlDataEntity.java
+2
-0
StrategyControlServiceImpl.java
...pt/synthesis/service/impl/StrategyControlServiceImpl.java
+8
-4
StrategyGreenBeltServiceImpl.java
.../synthesis/service/impl/StrategyGreenBeltServiceImpl.java
+1
-1
GreenBeltInfoVO.java
...rvice/src/main/java/net/wanji/opt/vo/GreenBeltInfoVO.java
+1
-1
CrossDirDataRealtimeMapper.java
.../wanji/databus/dao/mapper/CrossDirDataRealtimeMapper.java
+2
-0
CrossDirDataRealtimeMapper.xml
.../src/main/resources/mapper/CrossDirDataRealtimeMapper.xml
+7
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/controller/signalopt/CrossIndexController.java
0 → 100644
View file @
535d9b8a
package
net
.
wanji
.
opt
.
controller
.
signalopt
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.databus.bo.CrossIdBO
;
import
net.wanji.databus.po.CrossDirDataRealtimePO
;
import
net.wanji.opt.dto.strategy.AddOrUpdateSceneDTO
;
import
net.wanji.opt.service.CrossIndexService
;
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
javax.annotation.Resource
;
import
javax.ws.rs.core.MediaType
;
import
java.util.Date
;
import
java.util.Map
;
/**
* @author duanruiming
* @date 2024/11/25 19:10
*/
@Api
(
value
=
"CrossIndexController"
,
description
=
"路口指标控制器"
)
@RequestMapping
(
"/crossIndex"
)
@RestController
public
class
CrossIndexController
{
@Resource
private
CrossIndexService
crossIndexService
;
@ApiOperation
(
value
=
"路口方向指标"
,
notes
=
"路口方向指标"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/crossDirIndex"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
AddOrUpdateSceneDTO
.
class
),
})
public
JsonViewObject
crossDirIndex
(
@RequestBody
CrossIdBO
crossIdBO
)
{
Map
<
Integer
,
CrossDirDataRealtimePO
>
result
=
crossIndexService
.
crossDirIndex
(
crossIdBO
);
return
JsonViewObject
.
newInstance
().
success
(
result
);
}
public
static
void
main
(
String
[]
args
)
{
Date
date
=
new
Date
();
System
.
err
.
println
(
date
);
}
}
signal-optimize-service/src/main/java/net/wanji/opt/dto/GreenBeltKafkaDTO.java
View file @
535d9b8a
...
@@ -19,7 +19,7 @@ import java.util.Map;
...
@@ -19,7 +19,7 @@ import java.util.Map;
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
GreenBeltKafkaDTO
{
public
class
GreenBeltKafkaDTO
{
@JsonProperty
(
"greenbelt_id"
)
@JsonProperty
(
"greenbelt_id"
)
private
String
greenbeltId
;
// 绿波带id
private
Integer
greenbeltId
;
// 绿波带id
@JsonProperty
(
"greenbelt_length"
)
@JsonProperty
(
"greenbelt_length"
)
private
double
greenbeltLength
;
// 绿波干线长度(m)
private
double
greenbeltLength
;
// 绿波干线长度(m)
@JsonProperty
(
"max_speed_forward"
)
@JsonProperty
(
"max_speed_forward"
)
...
...
signal-optimize-service/src/main/java/net/wanji/opt/service/CrossIndexService.java
0 → 100644
View file @
535d9b8a
package
net
.
wanji
.
opt
.
service
;
import
net.wanji.databus.bo.CrossIdBO
;
import
net.wanji.databus.po.CrossDirDataRealtimePO
;
import
java.util.Map
;
/**
* @author duanruiming
* @date 2024/11/25 19:12
*/
public
interface
CrossIndexService
{
Map
<
Integer
,
CrossDirDataRealtimePO
>
crossDirIndex
(
CrossIdBO
crossIdBO
);
}
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/CrossIndexServiceImpl.java
0 → 100644
View file @
535d9b8a
package
net
.
wanji
.
opt
.
service
.
impl
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.databus.bo.CrossIdBO
;
import
net.wanji.databus.dao.mapper.CrossDirDataRealtimeMapper
;
import
net.wanji.databus.po.CrossDirDataRealtimePO
;
import
net.wanji.opt.service.CrossIndexService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author duanruiming
* @date 2024/11/25 19:12
*/
@Service
@Slf4j
public
class
CrossIndexServiceImpl
implements
CrossIndexService
{
@Resource
private
CrossDirDataRealtimeMapper
crossDirDataRealtimeMapper
;
@Override
public
Map
<
Integer
,
CrossDirDataRealtimePO
>
crossDirIndex
(
CrossIdBO
crossIdBO
)
{
List
<
CrossDirDataRealtimePO
>
crossDirDataRealtimePOS
=
crossDirDataRealtimeMapper
.
selectMaxBatchTime
(
crossIdBO
.
getCrossId
());
if
(!
CollectionUtils
.
isEmpty
(
crossDirDataRealtimePOS
))
{
Map
<
Integer
,
CrossDirDataRealtimePO
>
dirDataMap
=
new
HashMap
<>(
crossDirDataRealtimePOS
.
size
());
for
(
CrossDirDataRealtimePO
crossDirDataRealtimePO
:
crossDirDataRealtimePOS
)
{
dirDataMap
.
put
(
crossDirDataRealtimePO
.
getDirType
(),
crossDirDataRealtimePO
);
}
return
dirDataMap
;
}
return
null
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/GreenBeltInfoServiceImpl.java
View file @
535d9b8a
...
@@ -99,7 +99,7 @@ public class GreenBeltInfoServiceImpl implements GreenBeltInfoService {
...
@@ -99,7 +99,7 @@ public class GreenBeltInfoServiceImpl implements GreenBeltInfoService {
entity
.
setGreenWidthTime
(
dirGreenDetail
.
getGreenWidthTime
());
entity
.
setGreenWidthTime
(
dirGreenDetail
.
getGreenWidthTime
());
entity
.
setCrossGreenDetail
(
JacksonUtils
.
getInstance
().
writeValueAsString
(
dirGreenDetail
.
getCrossGreenDetailList
()));
entity
.
setCrossGreenDetail
(
JacksonUtils
.
getInstance
().
writeValueAsString
(
dirGreenDetail
.
getCrossGreenDetailList
()));
strategyGreenOptHistMapper
.
insert
(
entity
);
strategyGreenOptHistMapper
.
insert
(
entity
);
String
key
=
Constants
.
GREEN_ID_OPT_KEY
.
concat
(
infoVO
.
getGreenId
(
));
String
key
=
Constants
.
GREEN_ID_OPT_KEY
.
concat
(
String
.
valueOf
(
infoVO
.
getGreenId
()
));
}
}
}
}
}
}
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/pojo/StrategyControlDataEntity.java
View file @
535d9b8a
...
@@ -43,4 +43,6 @@ public class StrategyControlDataEntity extends PageVO {
...
@@ -43,4 +43,6 @@ public class StrategyControlDataEntity extends PageVO {
private
Integer
status
;
private
Integer
status
;
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
crossName
;
private
String
crossName
;
@TableField
(
exist
=
false
)
private
String
wkt
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/StrategyControlServiceImpl.java
View file @
535d9b8a
...
@@ -23,8 +23,8 @@ import net.wanji.opt.dao.mapper.StrategyPlanInfoMapper;
...
@@ -23,8 +23,8 @@ import net.wanji.opt.dao.mapper.StrategyPlanInfoMapper;
import
net.wanji.opt.synthesis.pojo.*
;
import
net.wanji.opt.synthesis.pojo.*
;
import
net.wanji.opt.synthesis.service.PushStrategyControlService
;
import
net.wanji.opt.synthesis.service.PushStrategyControlService
;
import
net.wanji.opt.synthesis.service.StrategyControlService
;
import
net.wanji.opt.synthesis.service.StrategyControlService
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
...
@@ -87,7 +87,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -87,7 +87,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
List
<
StrategyControlDataVO
>
dataList
=
strategyControlVO
.
getDataList
();
List
<
StrategyControlDataVO
>
dataList
=
strategyControlVO
.
getDataList
();
for
(
StrategyControlDataVO
dataVO
:
dataList
)
{
for
(
StrategyControlDataVO
dataVO
:
dataList
)
{
StrategyControlDataEntity
entity
=
new
StrategyControlDataEntity
();
StrategyControlDataEntity
entity
=
new
StrategyControlDataEntity
();
BeanUtils
.
copyProperties
(
entity
,
dataVO
);
BeanUtils
.
copyProperties
(
dataVO
,
entity
);
entity
.
setTime
(
JacksonUtils
.
getInstance
().
writeValueAsString
(
dataVO
.
getTime
()));
entity
.
setTime
(
JacksonUtils
.
getInstance
().
writeValueAsString
(
dataVO
.
getTime
()));
if
(
StringUtils
.
equals
(
"insert"
,
dataVO
.
getAction
()))
{
if
(
StringUtils
.
equals
(
"insert"
,
dataVO
.
getAction
()))
{
entity
.
setId
(
null
);
entity
.
setId
(
null
);
...
@@ -178,7 +178,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -178,7 +178,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
Date
current
=
new
Date
();
Date
current
=
new
Date
();
for
(
StrategyControlDataEntity
entity
:
entities
)
{
for
(
StrategyControlDataEntity
entity
:
entities
)
{
StrategyControlDataEntity
result
=
new
StrategyControlDataEntity
();
StrategyControlDataEntity
result
=
new
StrategyControlDataEntity
();
BeanUtils
.
copyProperties
(
result
,
entity
);
BeanUtils
.
copyProperties
(
entity
,
result
);
Date
start
=
entity
.
getScheduleStart
();
Date
start
=
entity
.
getScheduleStart
();
Date
end
=
entity
.
getScheduleEnd
();
Date
end
=
entity
.
getScheduleEnd
();
if
(
current
.
before
(
start
)
||
current
.
after
(
end
))
{
if
(
current
.
before
(
start
)
||
current
.
after
(
end
))
{
...
@@ -214,10 +214,14 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -214,10 +214,14 @@ public class StrategyControlServiceImpl implements StrategyControlService {
if
(
type
==
0
)
{
if
(
type
==
0
)
{
BaseCrossInfoPO
baseCrossInfoPO
=
baseCrossInfoMapper
.
selectById
(
entity
.
getBizId
());
BaseCrossInfoPO
baseCrossInfoPO
=
baseCrossInfoMapper
.
selectById
(
entity
.
getBizId
());
result
.
setCrossName
(
baseCrossInfoPO
.
getName
());
result
.
setCrossName
(
baseCrossInfoPO
.
getName
());
String
location
=
baseCrossInfoPO
.
getLocation
();
location
=
location
.
replace
(
"POINT("
,
""
).
replace
(
" "
,
","
).
replace
(
")"
,
""
);
result
.
setWkt
(
location
);
}
}
if
(
type
==
1
)
{
if
(
type
==
1
)
{
GreenwaveInfoPO
greenwaveInfoPO
=
greenwaveInfoMapper
.
selectById
(
Integer
.
valueOf
(
entity
.
getBizId
()));
GreenwaveInfoPO
greenwaveInfoPO
=
greenwaveInfoMapper
.
selectById
(
Integer
.
valueOf
(
entity
.
getBizId
()));
result
.
setCrossName
(
greenwaveInfoPO
.
getName
());
result
.
setCrossName
(
greenwaveInfoPO
.
getName
());
result
.
setWkt
(
greenwaveInfoPO
.
getWkt
());
}
}
results
.
add
(
result
);
results
.
add
(
result
);
}
}
...
@@ -234,7 +238,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -234,7 +238,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
for
(
StrategyControlDataEntity
strategyControlDataEntity
:
currentStrateInfoList
)
{
for
(
StrategyControlDataEntity
strategyControlDataEntity
:
currentStrateInfoList
)
{
Integer
strategy
=
strategyControlDataEntity
.
getStrategy
();
Integer
strategy
=
strategyControlDataEntity
.
getStrategy
();
StrategyControlDataExt
strategyControlDataExt
=
new
StrategyControlDataExt
();
StrategyControlDataExt
strategyControlDataExt
=
new
StrategyControlDataExt
();
BeanUtils
.
copyProperties
(
strategyControlDataE
xt
,
strategyControlDataEntity
);
BeanUtils
.
copyProperties
(
strategyControlDataE
ntity
,
strategyControlDataExt
);
String
strategyName
=
""
;
String
strategyName
=
""
;
for
(
StrategyFactoryEntity
strategyFactoryEntity
:
strategyFactoryEntities
)
{
for
(
StrategyFactoryEntity
strategyFactoryEntity
:
strategyFactoryEntities
)
{
if
(
strategy
==
strategyFactoryEntity
.
getScene
())
{
if
(
strategy
==
strategyFactoryEntity
.
getScene
())
{
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/StrategyGreenBeltServiceImpl.java
View file @
535d9b8a
...
@@ -64,7 +64,7 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
...
@@ -64,7 +64,7 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
private
static
void
setBeltInfo
(
ObjectMapper
mapper
,
List
<
StrategyGreenOptHistEntity
>
entities
,
GreenBeltInfoVO
greenBeltInfoVO
,
List
<
GreenBeltInfoVO
.
DirGreenDetail
>
dirGreenDetails
)
throws
JsonProcessingException
{
private
static
void
setBeltInfo
(
ObjectMapper
mapper
,
List
<
StrategyGreenOptHistEntity
>
entities
,
GreenBeltInfoVO
greenBeltInfoVO
,
List
<
GreenBeltInfoVO
.
DirGreenDetail
>
dirGreenDetails
)
throws
JsonProcessingException
{
for
(
StrategyGreenOptHistEntity
entity
:
entities
)
{
for
(
StrategyGreenOptHistEntity
entity
:
entities
)
{
greenBeltInfoVO
.
setGreenId
(
String
.
valueOf
(
entity
.
getGreenId
()
));
greenBeltInfoVO
.
setGreenId
(
entity
.
getGreenId
(
));
greenBeltInfoVO
.
setLength
(
entity
.
getLength
());
greenBeltInfoVO
.
setLength
(
entity
.
getLength
());
greenBeltInfoVO
.
setCycle
(
entity
.
getCycle
());
greenBeltInfoVO
.
setCycle
(
entity
.
getCycle
());
greenBeltInfoVO
.
setControlTime
(
entity
.
getControlTime
());
greenBeltInfoVO
.
setControlTime
(
entity
.
getControlTime
());
...
...
signal-optimize-service/src/main/java/net/wanji/opt/vo/GreenBeltInfoVO.java
View file @
535d9b8a
...
@@ -19,7 +19,7 @@ import java.util.List;
...
@@ -19,7 +19,7 @@ import java.util.List;
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
GreenBeltInfoVO
{
public
class
GreenBeltInfoVO
{
@ApiModelProperty
(
"绿波id"
)
@ApiModelProperty
(
"绿波id"
)
private
String
greenId
;
private
Integer
greenId
;
@ApiModelProperty
(
"绿波带长度"
)
@ApiModelProperty
(
"绿波带长度"
)
private
Double
length
;
private
Double
length
;
@ApiModelProperty
(
"绿波带周期"
)
@ApiModelProperty
(
"绿波带周期"
)
...
...
wj-databus/src/main/java/net/wanji/databus/dao/mapper/CrossDirDataRealtimeMapper.java
View file @
535d9b8a
...
@@ -28,4 +28,6 @@ public interface CrossDirDataRealtimeMapper extends BaseMapper<CrossDirDataRealt
...
@@ -28,4 +28,6 @@ public interface CrossDirDataRealtimeMapper extends BaseMapper<CrossDirDataRealt
CrossDirDataRealtimePO
selectByInDir
(
String
currentCrossId
,
Integer
key
);
CrossDirDataRealtimePO
selectByInDir
(
String
currentCrossId
,
Integer
key
);
CrossDirDataRealtimePO
selectByCrossIdAndDirs
(
String
crossId
,
List
<
Integer
>
dirCodeList
);
CrossDirDataRealtimePO
selectByCrossIdAndDirs
(
String
crossId
,
List
<
Integer
>
dirCodeList
);
List
<
CrossDirDataRealtimePO
>
selectMaxBatchTime
(
String
crossId
);
}
}
wj-databus/src/main/resources/mapper/CrossDirDataRealtimeMapper.xml
View file @
535d9b8a
...
@@ -97,4 +97,11 @@
...
@@ -97,4 +97,11 @@
and in_out_type = 1
and in_out_type = 1
</select>
</select>
<select
id=
"selectMaxBatchTime"
resultType=
"net.wanji.databus.po.CrossDirDataRealtimePO"
>
select
<include
refid=
"Base_Column_List"
/>
from t_cross_dir_data_realtime
where cross_id = #{crossId} and in_out_type = 1
and batch_time in (select max(batch_time) from t_cross_dir_data_realtime where cross_id = #{crossId})
</select>
</mapper>
</mapper>
\ No newline at end of file
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