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
034d3bf4
Commit
034d3bf4
authored
Nov 06, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 临时方案接口优化
parent
0771d199
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
51 additions
and
26 deletions
+51
-26
FeignCommon.java
...main/java/net/wanji/feign/service/common/FeignCommon.java
+1
-1
ControlCommandController.java
...va/net/wanji/utc/controller/ControlCommandController.java
+2
-2
StaticInfoController.java
...n/java/net/wanji/utc/controller/StaticInfoController.java
+1
-1
ControlCommandService.java
.../net/wanji/utc/service/control/ControlCommandService.java
+1
-1
ControlCommandStrategyService.java
...ji/utc/service/control/ControlCommandStrategyService.java
+1
-3
ControlCommandStrategyServiceImpl.java
...rvice/control/impl/ControlCommandStrategyServiceImpl.java
+25
-10
HKControlCommandServiceImpl.java
...utc/service/control/impl/HKControlCommandServiceImpl.java
+1
-1
WanJiControlCommandServiceImpl.java
.../service/control/impl/WanJiControlCommandServiceImpl.java
+11
-3
application-police.yaml
...al-utc-service/src/main/resources/application-police.yaml
+8
-4
No files found.
signal-feign-service/src/main/java/net/wanji/feign/service/common/FeignCommon.java
View file @
034d3bf4
...
@@ -113,7 +113,7 @@ public interface FeignCommon {
...
@@ -113,7 +113,7 @@ public interface FeignCommon {
// 临时方案
// 临时方案
@PostMapping
(
"/tempScheme"
)
@PostMapping
(
"/tempScheme"
)
JsonViewObject
tempScheme
(
@RequestParam
String
crossCode
,
@RequestParam
Integer
schemeNo
);
JsonViewObject
tempScheme
(
Object
obj
);
@PostMapping
(
"/control/findPlanId"
)
@PostMapping
(
"/control/findPlanId"
)
Integer
findPlanId
(
@RequestParam
Date
datetime
,
@RequestParam
String
dateStr
,
@RequestParam
String
crossId
);
Integer
findPlanId
(
@RequestParam
Date
datetime
,
@RequestParam
String
dateStr
,
@RequestParam
String
crossId
);
...
...
signal-utc-service/src/main/java/net/wanji/utc/controller/ControlCommandController.java
View file @
034d3bf4
...
@@ -213,8 +213,8 @@ public class ControlCommandController {
...
@@ -213,8 +213,8 @@ public class ControlCommandController {
@AspectLog
(
description
=
"临时方案"
,
operationType
=
BaseEnum
.
OperationTypeEnum
.
UPDATE
)
@AspectLog
(
description
=
"临时方案"
,
operationType
=
BaseEnum
.
OperationTypeEnum
.
UPDATE
)
@ApiOperation
(
value
=
"临时方案"
,
notes
=
"临时方案"
)
@ApiOperation
(
value
=
"临时方案"
,
notes
=
"临时方案"
)
@PostMapping
(
"/tempScheme"
)
@PostMapping
(
"/tempScheme"
)
public
JsonViewObject
tempScheme
(
@Request
Param
String
crossCode
,
@RequestParam
Integer
schemeNo
)
throws
Exception
{
public
JsonViewObject
tempScheme
(
@Request
Body
@Validated
Object
obj
)
throws
Exception
{
return
controlCommandStrategyService
.
tempScheme
(
crossCode
,
schemeNo
);
return
controlCommandStrategyService
.
tempScheme
(
obj
);
}
}
/**
/**
...
...
signal-utc-service/src/main/java/net/wanji/utc/controller/StaticInfoController.java
View file @
034d3bf4
...
@@ -59,7 +59,7 @@ public class StaticInfoController {
...
@@ -59,7 +59,7 @@ public class StaticInfoController {
})
})
public
JsonViewObject
schemePhaseLights
(
@RequestBody
@Validated
SchemePhaseLightsDTO
schemePhaseLightsDTO
)
throws
Exception
{
public
JsonViewObject
schemePhaseLights
(
@RequestBody
@Validated
SchemePhaseLightsDTO
schemePhaseLightsDTO
)
throws
Exception
{
// 更新数据库
// 更新数据库
staticInfoService
.
schemePhaseLights
(
schemePhaseLightsDTO
);
//
staticInfoService.schemePhaseLights(schemePhaseLightsDTO);
// 构造返回值
// 构造返回值
SchemePhaseLightsVO
schemePhaseLightsVO
=
staticInfoService
.
buildSchemePhaseLightsResponse
(
schemePhaseLightsDTO
);
SchemePhaseLightsVO
schemePhaseLightsVO
=
staticInfoService
.
buildSchemePhaseLightsResponse
(
schemePhaseLightsDTO
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
...
...
signal-utc-service/src/main/java/net/wanji/utc/service/control/ControlCommandService.java
View file @
034d3bf4
...
@@ -100,7 +100,7 @@ public interface ControlCommandService {
...
@@ -100,7 +100,7 @@ public interface ControlCommandService {
JsonViewObject
delBaseConfig
(
DelBaseConfigPO
delBaseConfigPO
)
throws
Exception
;
JsonViewObject
delBaseConfig
(
DelBaseConfigPO
delBaseConfigPO
)
throws
Exception
;
JsonViewObject
timing
(
String
crossCode
,
Date
date
)
throws
Exception
;
JsonViewObject
timing
(
String
crossCode
,
Date
date
)
throws
Exception
;
JsonViewObject
tempScheme
(
String
crossCode
,
Integer
schemeNo
)
throws
Exception
;
JsonViewObject
tempScheme
(
Object
obj
)
throws
Exception
;
JsonViewObject
tempSchemeDetail
(
TempSchemeSendVO
tempSchemeSendVO
)
throws
Exception
;
JsonViewObject
tempSchemeDetail
(
TempSchemeSendVO
tempSchemeSendVO
)
throws
Exception
;
JsonViewObject
extendPhase
(
ExtendPhaseDTO
extendPhase
)
throws
Exception
;
JsonViewObject
extendPhase
(
ExtendPhaseDTO
extendPhase
)
throws
Exception
;
...
...
signal-utc-service/src/main/java/net/wanji/utc/service/control/ControlCommandStrategyService.java
View file @
034d3bf4
...
@@ -109,12 +109,10 @@ public interface ControlCommandStrategyService {
...
@@ -109,12 +109,10 @@ public interface ControlCommandStrategyService {
/**
/**
* 临时方案
* 临时方案
* @param crossCode
* @param schemeNo
* @return
* @return
* @throws Exception
* @throws Exception
*/
*/
JsonViewObject
tempScheme
(
String
crossCode
,
Integer
schemeNo
)
throws
Exception
;
JsonViewObject
tempScheme
(
Object
obj
)
throws
Exception
;
/**
/**
* 临时方案详情
* 临时方案详情
...
...
signal-utc-service/src/main/java/net/wanji/utc/service/control/impl/ControlCommandStrategyServiceImpl.java
View file @
034d3bf4
...
@@ -3,11 +3,10 @@ package net.wanji.utc.service.control.impl;
...
@@ -3,11 +3,10 @@ package net.wanji.utc.service.control.impl;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.databus.dto.ExtendPhaseDTO
;
import
net.wanji.databus.dto.StepingPhaseDTO
;
import
net.wanji.databus.vo.TempSchemeSendVO
;
import
net.wanji.databus.dao.entity.*
;
import
net.wanji.databus.dao.entity.*
;
import
net.wanji.databus.dao.mapper.*
;
import
net.wanji.databus.dao.mapper.*
;
import
net.wanji.databus.dto.ExtendPhaseDTO
;
import
net.wanji.databus.dto.StepingPhaseDTO
;
import
net.wanji.databus.po.BaseCrossLightsPO
;
import
net.wanji.databus.po.BaseCrossLightsPO
;
import
net.wanji.databus.po.CrossInfoPO
;
import
net.wanji.databus.po.CrossInfoPO
;
import
net.wanji.databus.po.SaveToUtcPO
;
import
net.wanji.databus.po.SaveToUtcPO
;
...
@@ -27,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -27,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.lang.reflect.Field
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -333,15 +333,30 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
...
@@ -333,15 +333,30 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
}
}
@Override
@Override
public
JsonViewObject
tempScheme
(
String
crossCode
,
Integer
schemeNo
)
throws
Exception
{
public
JsonViewObject
tempScheme
(
Object
obj
)
throws
Exception
{
String
crossCode
=
getCrossCode
(
obj
);
String
manufacturerCode
=
crossInfoCache
.
getManufacturerCodeByCrossId
(
crossCode
);
String
manufacturerCode
=
crossInfoCache
.
getManufacturerCodeByCrossId
(
crossCode
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
JsonViewObject
jsonViewObject
=
wanJiControlCommandService
.
tempScheme
(
obj
);
if
(
StringUtils
.
equals
(
BasicEnum
.
ManufacturerEnum
.
HK
.
getCode
(),
manufacturerCode
))
{
}
else
{
jsonViewObject
=
wanJiControlCommandService
.
tempScheme
(
crossCode
,
schemeNo
);
}
return
jsonViewObject
;
return
jsonViewObject
;
}
public
static
String
getCrossCode
(
Object
obj
)
throws
NoSuchFieldException
,
IllegalAccessException
{
// 获取对象的Class对象
Class
<?>
clazz
=
obj
.
getClass
();
// 查找名为"crossCode"的字段(假设字段名是crossCode,且是public或可访问的)
Field
crossCodeField
=
clazz
.
getDeclaredField
(
"crossCode"
);
// 如果字段是私有的,则需要设置可访问性
crossCodeField
.
setAccessible
(
true
);
// 获取字段的值
Object
crossCodeValue
=
crossCodeField
.
get
(
obj
);
// 将值转换为String类型(假设crossCode是String类型)
return
(
String
)
crossCodeValue
;
}
}
}
@Override
@Override
public
JsonViewObject
tempSchemeDetail
(
TempSchemeSendVO
tempSchemeSendVO
)
throws
Exception
{
public
JsonViewObject
tempSchemeDetail
(
TempSchemeSendVO
tempSchemeSendVO
)
throws
Exception
{
...
@@ -413,7 +428,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
...
@@ -413,7 +428,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
}
}
List
<
CrossSectionPO
>
sectionPOS
=
saveToUtcPO
.
getSectionPOS
();
List
<
CrossSectionPO
>
sectionPOS
=
saveToUtcPO
.
getSectionPOS
();
crossSectionMapper
.
deleteOne
(
crossId
,
null
,
null
);
crossSectionMapper
.
deleteOne
(
crossId
,
null
,
null
);
if
(!
CollectionUtils
.
isEmpty
(
sectionPOS
))
{
if
(!
CollectionUtils
.
isEmpty
(
sectionPOS
))
{
for
(
CrossSectionPO
sectionPO
:
sectionPOS
)
{
for
(
CrossSectionPO
sectionPO
:
sectionPOS
)
{
CrossSectionPO
crossSectionPO
=
new
CrossSectionPO
();
CrossSectionPO
crossSectionPO
=
new
CrossSectionPO
();
...
...
signal-utc-service/src/main/java/net/wanji/utc/service/control/impl/HKControlCommandServiceImpl.java
View file @
034d3bf4
...
@@ -554,7 +554,7 @@ public class HKControlCommandServiceImpl implements ControlCommandService {
...
@@ -554,7 +554,7 @@ public class HKControlCommandServiceImpl implements ControlCommandService {
}
}
@Override
@Override
public
JsonViewObject
tempScheme
(
String
crossCode
,
Integer
schemeNo
)
throws
Exception
{
public
JsonViewObject
tempScheme
(
Object
obj
)
throws
Exception
{
return
null
;
return
null
;
}
}
...
...
signal-utc-service/src/main/java/net/wanji/utc/service/control/impl/WanJiControlCommandServiceImpl.java
View file @
034d3bf4
...
@@ -174,9 +174,17 @@ public class WanJiControlCommandServiceImpl implements ControlCommandService {
...
@@ -174,9 +174,17 @@ public class WanJiControlCommandServiceImpl implements ControlCommandService {
}
}
@Override
@Override
public
JsonViewObject
tempScheme
(
String
crossCode
,
Integer
schemeNo
)
throws
Exception
{
public
JsonViewObject
tempScheme
(
Object
obj
)
throws
Exception
{
String
manufacturerIdCode
=
crossInfoCache
.
getManufacturerCodeByCrossId
(
crossCode
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
JsonViewObject
jsonViewObject
=
utcFeignClientCache
.
getUtcFeignClientService
(
manufacturerIdCode
).
tempScheme
(
crossCode
,
schemeNo
);
if
(
obj
instanceof
TempSchemeVO
)
{
TempSchemeVO
tempSchemeVO
=
(
TempSchemeVO
)
obj
;
String
manufacturerIdCode
=
crossInfoCache
.
getManufacturerCodeByCrossId
(
tempSchemeVO
.
getCrossCode
());
jsonViewObject
=
utcFeignClientCache
.
getUtcFeignClientService
(
manufacturerIdCode
).
tempScheme
(
tempSchemeVO
);
}
else
if
(
obj
instanceof
TempSchemeSendVO
)
{
TempSchemeSendVO
tempSchemeSendVO
=
(
TempSchemeSendVO
)
obj
;
String
manufacturerIdCode
=
crossInfoCache
.
getManufacturerCodeByCrossId
(
tempSchemeSendVO
.
getCrossCode
());
jsonViewObject
=
utcFeignClientCache
.
getUtcFeignClientService
(
manufacturerIdCode
).
tempScheme
(
tempSchemeSendVO
);
}
if
(
StringUtils
.
endsWithIgnoreCase
(
"success"
,
jsonViewObject
.
getStatus
()))
{
if
(
StringUtils
.
endsWithIgnoreCase
(
"success"
,
jsonViewObject
.
getStatus
()))
{
return
jsonViewObject
.
success
(
"万集标准协议下发临时方案成功!"
);
return
jsonViewObject
.
success
(
"万集标准协议下发临时方案成功!"
);
}
}
...
...
signal-utc-service/src/main/resources/application-police.yaml
View file @
034d3bf4
...
@@ -5,18 +5,18 @@ spring:
...
@@ -5,18 +5,18 @@ spring:
datasource
:
datasource
:
master
:
master
:
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:mysql://
37.12.182.29
:3306/t_signal_utc_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
url
:
jdbc:mysql://
10.102.1.182
:3306/t_signal_utc_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username
:
root
username
:
root
password
:
Wanji300552
password
:
Wanji300552
driverClassName
:
com.mysql.cj.jdbc.Driver
driverClassName
:
com.mysql.cj.jdbc.Driver
slave
:
slave
:
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:mysql://
37.12.182.29
:3306/t_signal_utc_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
url
:
jdbc:mysql://
10.102.1.182
:3306/t_signal_utc_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username
:
root
username
:
root
password
:
Wanji300552
password
:
Wanji300552
driverClassName
:
com.mysql.cj.jdbc.Driver
driverClassName
:
com.mysql.cj.jdbc.Driver
redis
:
redis
:
host
:
37.12.182.29
host
:
10.102.1.182
port
:
6379
port
:
6379
password
:
Wanji300552
password
:
Wanji300552
jedis
:
jedis
:
...
@@ -35,7 +35,7 @@ spring:
...
@@ -35,7 +35,7 @@ spring:
application
:
application
:
name
:
utc
name
:
utc
kafka
:
kafka
:
bootstrap-servers
:
37.12.182.29
:9092
bootstrap-servers
:
10.102.1.182
:9092
listener
:
listener
:
missing-topics-fatal
:
false
missing-topics-fatal
:
false
concurrency
:
3
concurrency
:
3
...
@@ -44,6 +44,10 @@ spring:
...
@@ -44,6 +44,10 @@ spring:
retries
:
0
retries
:
0
batch-size
:
10000
batch-size
:
10000
acks
:
1
acks
:
1
elasticsearch
:
username
:
elastic
password
:
Wanji300552
uris
:
http://10.102.1.182:9200
server
:
server
:
port
:
32000
port
:
32000
servlet
:
servlet
:
...
...
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