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
668f0290
Commit
668f0290
authored
Jan 21, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 诱导屏文字编辑功能新增
parent
f2520cc0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
255 additions
and
15 deletions
+255
-15
InduceFontHistController.java
...wanji/opt/controller/induce/InduceFontHistController.java
+80
-0
InduceFontHistMapper.java
...net/wanji/opt/dao/mapper/induce/InduceFontHistMapper.java
+11
-0
InduceFontHist.java
...ce/src/main/java/net/wanji/opt/entity/InduceFontHist.java
+49
-0
InduceFontHistService.java
...a/net/wanji/opt/service/induce/InduceFontHistService.java
+31
-0
InduceFontHistServiceImpl.java
...ji/opt/service/induce/impl/InduceFontHistServiceImpl.java
+58
-0
StrategyControlServiceImpl.java
...pt/synthesis/service/impl/StrategyControlServiceImpl.java
+21
-15
InduceFontHistMapper.xml
...src/main/resources/mapper/induce/InduceFontHistMapper.xml
+5
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/controller/induce/InduceFontHistController.java
0 → 100644
View file @
668f0290
package
net
.
wanji
.
opt
.
controller
.
induce
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.framework.i18n.I18nResourceBundle
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.common.framework.rest.ValidationGroups
;
import
net.wanji.opt.entity.InduceFontHist
;
import
net.wanji.opt.service.induce.InduceFontHistService
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.ws.rs.core.MediaType
;
import
java.util.List
;
/**
* @author duanruiming
* @date 2025/01/21 14:37
*/
@Api
(
value
=
"InduceFontHistController"
,
description
=
"诱导屏-文字下发历史信息"
)
@RestController
@RequestMapping
(
"/induceFontHist"
)
@Slf4j
public
class
InduceFontHistController
{
@Resource
private
InduceFontHistService
induceFontHistService
;
@ApiOperation
(
value
=
"获取所有诱导文字下发记录"
,
notes
=
"获取所有诱导文字下发记录"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
)
@GetMapping
(
value
=
"/byAll"
,
produces
=
MediaType
.
APPLICATION_JSON
)
public
JsonViewObject
getAll
()
{
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
try
{
List
<
InduceFontHist
>
list
=
induceFontHistService
.
getAll
();
jsonViewObject
.
success
(
list
);
}
catch
(
Exception
e
)
{
jsonViewObject
.
fail
(
I18nResourceBundle
.
getConstants
(
"GET_FAILED_MSG"
));
log
.
error
(
"{} getAll error"
,
this
.
getClass
().
getSimpleName
(),
e
);
}
return
jsonViewObject
;
}
@ApiOperation
(
value
=
"诱导屏文字编辑新增修改"
,
notes
=
"诱导屏文字编辑新增修改"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/editor"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
public
JsonViewObject
editor
(
@ApiParam
(
value
=
"查询条件"
,
required
=
true
)
@RequestBody
@Validated
({
ValidationGroups
.
Query
.
class
})
InduceFontHist
induceFontHist
)
{
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
try
{
induceFontHistService
.
editor
(
induceFontHist
);
jsonViewObject
.
success
(
"编辑成功"
);
}
catch
(
Exception
e
)
{
jsonViewObject
.
fail
(
I18nResourceBundle
.
getConstants
(
"POST_FAILED_MSG"
));
log
.
error
(
"{} editor error"
,
this
.
getClass
().
getSimpleName
(),
e
);
}
return
jsonViewObject
;
}
@ApiOperation
(
value
=
"通过编号获取诱导屏最新文字"
,
notes
=
"通过编号获取诱导屏最新文字"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
)
@GetMapping
(
value
=
"/byLastOne"
,
produces
=
MediaType
.
APPLICATION_JSON
)
public
JsonViewObject
getLastOne
(
@RequestParam
(
"equipCode"
)
String
equipCode
)
{
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
try
{
InduceFontHist
induceFontHist
=
induceFontHistService
.
getLastOne
(
equipCode
);
jsonViewObject
.
success
(
induceFontHist
);
}
catch
(
Exception
e
)
{
jsonViewObject
.
fail
(
I18nResourceBundle
.
getConstants
(
"GET_FAILED_MSG"
));
log
.
error
(
"{} byLastOne error"
,
this
.
getClass
().
getSimpleName
(),
e
);
}
return
jsonViewObject
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/dao/mapper/induce/InduceFontHistMapper.java
0 → 100644
View file @
668f0290
package
net
.
wanji
.
opt
.
dao
.
mapper
.
induce
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
net.wanji.opt.entity.InduceFontHist
;
/**
* @author duanruiming
* @date 2025/01/21 14:40
*/
public
interface
InduceFontHistMapper
extends
BaseMapper
<
InduceFontHist
>
{
}
signal-optimize-service/src/main/java/net/wanji/opt/entity/InduceFontHist.java
0 → 100644
View file @
668f0290
package
net
.
wanji
.
opt
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author duanruiming
* @date 2025/01/21 14:29
*/
@Data
@TableName
(
"t_induce_font_hist_log"
)
public
class
InduceFontHist
{
@ApiModelProperty
(
value
=
"唯一ID"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
@ApiModelProperty
(
value
=
"诱导屏编码"
)
@TableField
(
"equip_code"
)
private
String
equipCode
;
@ApiModelProperty
(
value
=
"文字大小"
)
@TableField
(
"font_size"
)
private
String
fontSize
;
@ApiModelProperty
(
value
=
"文字颜色"
)
@TableField
(
"font_color"
)
private
String
fontColor
;
@ApiModelProperty
(
value
=
"字体行间距"
)
@TableField
(
"line_spacing"
)
private
String
lineSpacing
;
@ApiModelProperty
(
value
=
"文字内容"
)
@TableField
(
"content"
)
private
String
content
;
@ApiModelProperty
(
value
=
"绿波编号"
)
@TableField
(
"green_id"
)
private
Integer
greenId
;
@ApiModelProperty
(
value
=
"创建时间"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
"gmt_create"
)
private
Date
gmtCreate
;
@ApiModelProperty
(
value
=
"修改时间"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
"gmt_modified"
)
private
Date
gmtModified
;
}
signal-optimize-service/src/main/java/net/wanji/opt/service/induce/InduceFontHistService.java
0 → 100644
View file @
668f0290
package
net
.
wanji
.
opt
.
service
.
induce
;
import
net.wanji.opt.entity.InduceFontHist
;
import
java.util.List
;
/**
* @author duanruiming
* @date 2025/01/21 14:38
*/
public
interface
InduceFontHistService
{
/**
* 获取诱导屏所有文字下发记录
* @return
*/
List
<
InduceFontHist
>
getAll
();
/**
* 诱导屏文字编辑
* @param induceFontHist
*/
void
editor
(
InduceFontHist
induceFontHist
);
/**
* 通过诱导屏编码获取最新编辑文字
* @param equipCode
* @return
*/
InduceFontHist
getLastOne
(
String
equipCode
);
}
signal-optimize-service/src/main/java/net/wanji/opt/service/induce/impl/InduceFontHistServiceImpl.java
0 → 100644
View file @
668f0290
package
net
.
wanji
.
opt
.
service
.
induce
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.utils.tool.StringUtils
;
import
net.wanji.opt.dao.mapper.induce.InduceFontHistMapper
;
import
net.wanji.opt.entity.InduceFontHist
;
import
net.wanji.opt.service.induce.InduceFontHistService
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
/**
* @author duanruiming
* @date 2025/01/21 14:39
*/
@Service
@Slf4j
public
class
InduceFontHistServiceImpl
implements
InduceFontHistService
{
@Resource
private
InduceFontHistMapper
induceFontHistMapper
;
@Override
public
List
<
InduceFontHist
>
getAll
()
{
List
<
InduceFontHist
>
induceFontHists
=
induceFontHistMapper
.
selectList
(
new
LambdaQueryWrapper
<
InduceFontHist
>());
return
induceFontHists
;
}
@Override
public
void
editor
(
InduceFontHist
induceFontHist
)
{
if
(
Objects
.
nonNull
(
induceFontHist
))
{
Long
id
=
induceFontHist
.
getId
();
if
(
Objects
.
isNull
(
id
))
{
induceFontHistMapper
.
insert
(
induceFontHist
);
}
else
{
induceFontHist
.
setGmtModified
(
new
Date
());
induceFontHistMapper
.
updateById
(
induceFontHist
);
}
}
}
@Override
public
InduceFontHist
getLastOne
(
String
equipCode
)
{
if
(
StringUtils
.
isNotBlank
(
equipCode
))
{
LambdaQueryWrapper
<
InduceFontHist
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
InduceFontHist:
:
getEquipCode
,
equipCode
);
queryWrapper
.
orderByDesc
(
InduceFontHist:
:
getGmtModified
);
queryWrapper
.
last
(
"limit 1"
);
InduceFontHist
induceFontHist
=
induceFontHistMapper
.
selectOne
(
queryWrapper
);
return
induceFontHist
;
}
return
null
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/StrategyControlServiceImpl.java
View file @
668f0290
...
...
@@ -29,6 +29,7 @@ import net.wanji.opt.synthesis.pojo.vo.*;
import
net.wanji.opt.synthesis.service.PushStrategyControlService
;
import
net.wanji.opt.synthesis.service.StrategyControlService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.jetbrains.annotations.NotNull
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -184,21 +185,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
if
(
Objects
.
isNull
(
groupType
))
{
groupType
=
1
;
}
// LocalDateTime localDateTime = Objects.equals(0, groupType) ? DateUtil.getPlusHour(-1) : DateUtil.getMidNight();
LocalDateTime
localDateTime
=
null
;
switch
(
groupType
)
{
case
0
:
localDateTime
=
DateUtil
.
getPlusHour
(-
1
);
break
;
case
1
:
localDateTime
=
DateUtil
.
getMidNight
();
break
;
case
2
:
localDateTime
=
DateUtil
.
getPlusSecond
(-
5
);
break
;
default
:
localDateTime
=
DateUtil
.
getMidNight
();
}
LocalDateTime
localDateTime
=
getLocalDateTime
(
groupType
);
// 查询干线和路口
if
(
Objects
.
isNull
(
strategyType
))
{
...
...
@@ -220,6 +207,25 @@ public class StrategyControlServiceImpl implements StrategyControlService {
return
JsonViewObject
.
newInstance
().
success
(
sorted
);
}
@NotNull
private
static
LocalDateTime
getLocalDateTime
(
Integer
groupType
)
{
LocalDateTime
localDateTime
=
null
;
switch
(
groupType
)
{
case
0
:
localDateTime
=
DateUtil
.
getPlusHour
(-
1
);
break
;
case
1
:
localDateTime
=
DateUtil
.
getMidNight
();
break
;
case
2
:
localDateTime
=
DateUtil
.
getPlusSecond
(-
5
);
break
;
default
:
localDateTime
=
DateUtil
.
getMidNight
();
}
return
localDateTime
;
}
private
void
setCrossOptHist
(
List
<
StrategyControlHistVO
>
results
,
LocalDateTime
midnight
,
Integer
resultType
)
{
LambdaQueryWrapper
<
StrategyCrossResultEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
if
(
Objects
.
nonNull
(
midnight
))
{
...
...
signal-optimize-service/src/main/resources/mapper/induce/InduceFontHistMapper.xml
0 → 100644
View file @
668f0290
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"net.wanji.opt.dao.mapper.induce.InduceFontHistMapper"
>
</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