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
cf43a81f
Commit
cf43a81f
authored
Nov 25, 2022
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
系统管理-设备管理-信号机管理-添加或删除
parent
6f54e94d
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
178 additions
and
14 deletions
+178
-14
IpPortException.java
.../java/net/wanji/utc/common/exception/IpPortException.java
+15
-0
PortFormatException.java
...a/net/wanji/utc/common/exception/PortFormatException.java
+15
-0
CrossInfoController.java
...in/java/net/wanji/utc/controller/CrossInfoController.java
+9
-9
CrossInfoMapper.java
...e/src/main/java/net/wanji/utc/mapper/CrossInfoMapper.java
+4
-0
CrossInfoService.java
...a/net/wanji/utc/service/systemadmin/CrossInfoService.java
+3
-0
CrossInfoServiceImpl.java
...ji/utc/service/systemadmin/impl/CrossInfoServiceImpl.java
+48
-1
ManufacturerApiInfoServiceImpl.java
...vice/systemadmin/impl/ManufacturerApiInfoServiceImpl.java
+2
-1
CrossInfoInsertOrUpdateInVO.java
...wanji/utc/vo/systemadmin/CrossInfoInsertOrUpdateInVO.java
+42
-0
ManufacturerApiInfoInsertOrUpdateInVO.java
...vo/systemadmin/ManufacturerApiInfoInsertOrUpdateInVO.java
+1
-3
CrossInfoMapper.xml
...utc-service/src/main/resources/mapper/CrossInfoMapper.xml
+39
-0
No files found.
signal-utc-service/src/main/java/net/wanji/utc/common/exception/IpPortException.java
0 → 100644
View file @
cf43a81f
package
net
.
wanji
.
utc
.
common
.
exception
;
/**
* @author Kent HAN
* @date 2022/11/15 13:57
*/
public
class
IpPortException
extends
RuntimeException
{
public
IpPortException
(
String
message
)
{
super
(
message
);
}
public
IpPortException
(
String
message
,
Exception
e
)
{
super
(
message
,
e
);
}
}
signal-utc-service/src/main/java/net/wanji/utc/common/exception/PortFormatException.java
0 → 100644
View file @
cf43a81f
package
net
.
wanji
.
utc
.
common
.
exception
;
/**
* @author Kent HAN
* @date 2022/11/15 13:57
*/
public
class
PortFormatException
extends
RuntimeException
{
public
PortFormatException
(
String
message
)
{
super
(
message
);
}
public
PortFormatException
(
String
message
,
Exception
e
)
{
super
(
message
,
e
);
}
}
signal-utc-service/src/main/java/net/wanji/utc/controller/CrossInfoController.java
View file @
cf43a81f
...
...
@@ -45,15 +45,15 @@ public class CrossInfoController {
return
jsonViewObject
.
success
(
crossInfoListOutVOPageInfo
);
}
// @ApiOperation(value = "接口添加或修改", notes = "接口
添加或修改", consumes = MediaType.APPLICATION_JSON)
//
@PostMapping(value = "/insertOrUpdate", consumes = MediaType.APPLICATION_JSON)
// public JsonViewObject insertOrUpdate(@RequestBody ManufacturerApi
InfoInsertOrUpdateInVO inVO) {
// manufacturerApi
InfoService.insertOrUpdate(inVO);
//
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
//
//
return jsonViewObject.success();
//
}
//
@ApiOperation
(
value
=
"信号机添加或修改"
,
notes
=
"信号机
添加或修改"
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/insertOrUpdate"
,
consumes
=
MediaType
.
APPLICATION_JSON
)
public
JsonViewObject
insertOrUpdate
(
@RequestBody
Cross
InfoInsertOrUpdateInVO
inVO
)
{
cross
InfoService
.
insertOrUpdate
(
inVO
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
();
}
// @ApiOperation(value = "接口删除", notes = "接口删除", consumes = MediaType.APPLICATION_JSON)
// @PostMapping(value = "/delete", consumes = MediaType.APPLICATION_JSON)
// public JsonViewObject delete(@RequestBody DeleteListInVO inVO) {
...
...
signal-utc-service/src/main/java/net/wanji/utc/mapper/CrossInfoMapper.java
View file @
cf43a81f
...
...
@@ -26,4 +26,8 @@ public interface CrossInfoMapper {
List
<
CrossInfoPO
>
selectByOptionals
(
@Param
(
"crossName"
)
String
crossName
,
@Param
(
"manufacturerId"
)
Integer
manufacturerId
);
void
insertOne
(
CrossInfoPO
crossInfoPO
);
void
updateOne
(
CrossInfoPO
crossInfoPO
);
}
signal-utc-service/src/main/java/net/wanji/utc/service/systemadmin/CrossInfoService.java
View file @
cf43a81f
package
net
.
wanji
.
utc
.
service
.
systemadmin
;
import
com.github.pagehelper.PageInfo
;
import
net.wanji.utc.vo.systemadmin.CrossInfoInsertOrUpdateInVO
;
import
net.wanji.utc.vo.systemadmin.CrossInfoListInVO
;
import
net.wanji.utc.vo.systemadmin.CrossInfoListOutVO
;
...
...
@@ -10,4 +11,6 @@ import net.wanji.utc.vo.systemadmin.CrossInfoListOutVO;
*/
public
interface
CrossInfoService
{
PageInfo
<
CrossInfoListOutVO
>
list
(
CrossInfoListInVO
crossInfoListInVO
);
void
insertOrUpdate
(
CrossInfoInsertOrUpdateInVO
inVO
);
}
signal-utc-service/src/main/java/net/wanji/utc/service/systemadmin/impl/CrossInfoServiceImpl.java
View file @
cf43a81f
package
net
.
wanji
.
utc
.
service
.
systemadmin
.
impl
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.IdUtil
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
net.wanji.utc.common.exception.IpPortException
;
import
net.wanji.utc.common.exception.PortFormatException
;
import
net.wanji.utc.mapper.CrossInfoMapper
;
import
net.wanji.utc.mapper.ManufacturerInfoMapper
;
import
net.wanji.utc.po.CrossInfoPO
;
import
net.wanji.utc.po.ManufacturerInfoPO
;
import
net.wanji.utc.service.systemadmin.CrossInfoService
;
import
net.wanji.utc.util.PageUtils
;
import
net.wanji.utc.vo.systemadmin.CrossInfoInsertOrUpdateInVO
;
import
net.wanji.utc.vo.systemadmin.CrossInfoListInVO
;
import
net.wanji.utc.vo.systemadmin.CrossInfoListOutVO
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.
ArrayList
;
import
java.util.
Date
;
import
java.util.List
;
/**
...
...
@@ -58,4 +63,46 @@ public class CrossInfoServiceImpl implements CrossInfoService {
return
crossInfoListOutVOPageInfo
;
}
@Override
public
void
insertOrUpdate
(
CrossInfoInsertOrUpdateInVO
inVO
)
{
CrossInfoPO
crossInfoPO
=
new
CrossInfoPO
();
BeanUtils
.
copyProperties
(
inVO
,
crossInfoPO
);
// IP和端口
String
ipPort
=
inVO
.
getIpPort
();
String
[]
split
=
ipPort
.
split
(
":"
);
if
(
split
.
length
!=
2
)
{
throw
new
IpPortException
(
"IP/端口格式错误,正确格式为 192.168.1.23:8080"
);
}
String
portStr
=
split
[
1
];
Integer
port
=
null
;
try
{
port
=
Integer
.
parseInt
(
portStr
);
}
catch
(
NumberFormatException
e
){
throw
new
PortFormatException
(
"端口必须为数字"
);
}
crossInfoPO
.
setIp
(
split
[
0
]);
crossInfoPO
.
setPort
(
port
);
// 厂商ID
String
manufacturerNick
=
inVO
.
getManufacturerNick
();
Integer
manufacturerId
=
manufacturerInfoMapper
.
selectIdByNick
(
manufacturerNick
);
crossInfoPO
.
setManufacturerId
(
manufacturerId
);
// 安装时间
String
installTimeStr
=
inVO
.
getInstallTime
();
Date
installTime
=
DateUtil
.
parse
(
installTimeStr
);
crossInfoPO
.
setInstallTime
(
installTime
);
String
id
=
inVO
.
getId
();
if
(
id
==
null
||
""
.
equals
(
id
))
{
// 添加
crossInfoPO
.
setId
(
IdUtil
.
simpleUUID
());
crossInfoMapper
.
insertOne
(
crossInfoPO
);
}
else
{
// 修改
crossInfoMapper
.
updateOne
(
crossInfoPO
);
}
}
}
signal-utc-service/src/main/java/net/wanji/utc/service/systemadmin/impl/ManufacturerApiInfoServiceImpl.java
View file @
cf43a81f
...
...
@@ -56,7 +56,6 @@ public class ManufacturerApiInfoServiceImpl implements ManufacturerApiInfoServic
@Override
public
void
insertOrUpdate
(
ManufacturerApiInfoInsertOrUpdateInVO
inVO
)
{
Integer
id
=
inVO
.
getId
();
ManufacturerApiInfoPO
manufacturerApiInfoPO
=
new
ManufacturerApiInfoPO
();
BeanUtils
.
copyProperties
(
inVO
,
manufacturerApiInfoPO
);
String
typeStr
=
inVO
.
getApiType
();
...
...
@@ -65,6 +64,8 @@ public class ManufacturerApiInfoServiceImpl implements ManufacturerApiInfoServic
Integer
manufacturerId
=
manufacturerInfoMapper
.
selectIdByNick
(
manufacturerName
);
manufacturerApiInfoPO
.
setType
(
typeCode
);
manufacturerApiInfoPO
.
setManufacturerId
(
manufacturerId
);
Integer
id
=
inVO
.
getId
();
if
(
id
==
null
||
id
==
0
)
{
// 添加
manufacturerApiInfoMapper
.
insertOne
(
manufacturerApiInfoPO
);
...
...
signal-utc-service/src/main/java/net/wanji/utc/vo/systemadmin/CrossInfoInsertOrUpdateInVO.java
0 → 100644
View file @
cf43a81f
package
net
.
wanji
.
utc
.
vo
.
systemadmin
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author Kent HAN
* @date 2022/11/25 10:21
*/
@Data
@ApiModel
(
value
=
"CrossInfoInsertOrUpdateInVO"
,
description
=
"信号机新增或修改输入参数"
)
public
class
CrossInfoInsertOrUpdateInVO
{
@ApiModelProperty
(
value
=
"路口ID。不传ID为新增,传ID为修改"
,
notes
=
""
)
private
String
id
;
/** 信号机编号 */
@ApiModelProperty
(
required
=
true
,
value
=
"信号机编号"
,
notes
=
""
)
private
String
code
;
/** 路口名称 */
@ApiModelProperty
(
required
=
true
,
value
=
"路口名称"
,
notes
=
""
)
private
String
name
;
/** 信号机IP/端口 */
@ApiModelProperty
(
required
=
true
,
value
=
"信号机IP/端口"
,
notes
=
""
)
private
String
ipPort
;
/** 厂商名称 */
@ApiModelProperty
(
required
=
true
,
value
=
"厂商名称"
,
notes
=
""
)
private
String
manufacturerNick
;
/** 信号机版本 */
@ApiModelProperty
(
required
=
true
,
value
=
"信号机版本"
,
notes
=
""
)
private
String
version
;
/** 信号机型号 */
@ApiModelProperty
(
required
=
true
,
value
=
"信号机型号"
,
notes
=
""
)
private
String
model
;
/** 安装时间 */
@ApiModelProperty
(
required
=
true
,
value
=
"安装时间,格式 2022-11-18 10:11:47"
,
notes
=
""
)
private
String
installTime
;
/** 安装位置 */
@ApiModelProperty
(
required
=
true
,
value
=
"安装位置"
,
notes
=
""
)
private
String
location
;
}
signal-utc-service/src/main/java/net/wanji/utc/vo/systemadmin/ManufacturerApiInfoInsertOrUpdateInVO.java
View file @
cf43a81f
...
...
@@ -4,14 +4,12 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author Kent HAN
* @date 2022/11/24 15:20
*/
@Data
@ApiModel
(
value
=
"ManufacturerApiInfoInsertOrUpdateInVO"
,
description
=
"接口新增或修改
删除
输入参数"
)
@ApiModel
(
value
=
"ManufacturerApiInfoInsertOrUpdateInVO"
,
description
=
"接口新增或修改输入参数"
)
public
class
ManufacturerApiInfoInsertOrUpdateInVO
{
/** 接口ID */
@ApiModelProperty
(
value
=
"接口ID。不传ID为新增,传ID为修改"
,
notes
=
""
)
...
...
signal-utc-service/src/main/resources/mapper/CrossInfoMapper.xml
View file @
cf43a81f
...
...
@@ -25,6 +25,45 @@
</foreach>
</insert>
<insert
id=
"insertOne"
>
insert into t_cross_info(id, name,code,manufacturer_id,ip,port,location,version,model,install_time)
values (#{id},#{name},#{code},#{manufacturerId},#{ip},#{port},#{location},#{version},#{model},#{installTime})
</insert>
<update
id=
"updateOne"
>
update t_cross_info
<set>
<if
test=
"name != null and name != ''"
>
name = #{name},
</if>
<if
test=
"code != null and code != ''"
>
code = #{code},
</if>
<if
test=
"manufacturerId != null and manufacturerId != ''"
>
manufacturer_id = #{manufacturerId},
</if>
<if
test=
"ip != null and ip != ''"
>
ip = #{ip},
</if>
<if
test=
"port != null and port != ''"
>
port = #{port},
</if>
<if
test=
"location != null and location != ''"
>
location = #{location},
</if>
<if
test=
"version != null and version != ''"
>
version = #{version},
</if>
<if
test=
"model != null and model != ''"
>
model = #{model},
</if>
<if
test=
"installTime != null"
>
install_time = #{installTime},
</if>
</set>
where id = #{id}
</update>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
>
select
id,name,code,manufacturer_id,ip,port,location,version,model,install_time,gmt_create,gmt_modified
...
...
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