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
88ec542a
Commit
88ec542a
authored
Nov 24, 2022
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
系统管理-设备管理-接口管理
parent
8cf2af41
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
1648 additions
and
65 deletions
+1648
-65
pom.xml
signal-utc-service/pom.xml
+0
-7
HttpRequest.java
...n/java/net/wanji/utc/common/commonentity/HttpRequest.java
+5
-5
Constants.java
...rc/main/java/net/wanji/utc/common/constant/Constants.java
+1084
-4
ApiInfoTask.java
.../src/main/java/net/wanji/utc/common/task/ApiInfoTask.java
+8
-8
HttpCode.java
...src/main/java/net/wanji/utc/common/typeenum/HttpCode.java
+71
-0
ManufacturerApiInfoTypeEnum.java
...anji/utc/common/typeenum/ManufacturerApiInfoTypeEnum.java
+28
-0
ManufacturerApiController.java
...a/net/wanji/utc/controller/ManufacturerApiController.java
+69
-0
ManufacturerController.java
...java/net/wanji/utc/controller/ManufacturerController.java
+16
-9
JsonViewObject.java
...ce/src/main/java/net/wanji/utc/entity/JsonViewObject.java
+79
-0
ApiInfoMapper.java
...ice/src/main/java/net/wanji/utc/mapper/ApiInfoMapper.java
+0
-13
ManufacturerApiInfoMapper.java
.../java/net/wanji/utc/mapper/ManufacturerApiInfoMapper.java
+24
-0
ManufacturerInfoMapper.java
...ain/java/net/wanji/utc/mapper/ManufacturerInfoMapper.java
+2
-0
ManufacturerApiInfoPO.java
...src/main/java/net/wanji/utc/po/ManufacturerApiInfoPO.java
+10
-10
ManufacturerApiInfoService.java
...i/utc/service/systemadmin/ManufacturerApiInfoService.java
+19
-0
ManufacturerService.java
...et/wanji/utc/service/systemadmin/ManufacturerService.java
+2
-2
ManufacturerApiInfoServiceImpl.java
...vice/systemadmin/impl/ManufacturerApiInfoServiceImpl.java
+83
-0
ManufacturerServiceImpl.java
...utc/service/systemadmin/impl/ManufacturerServiceImpl.java
+2
-3
DeleteListInVO.java
...ain/java/net/wanji/utc/vo/systemadmin/DeleteListInVO.java
+4
-4
ManufacturerApiInfoInsertOrUpdateInVO.java
...vo/systemadmin/ManufacturerApiInfoInsertOrUpdateInVO.java
+37
-0
ManufacturerApiInfoListInVO.java
...wanji/utc/vo/systemadmin/ManufacturerApiInfoListInVO.java
+24
-0
ManufacturerApiInfoMapper.xml
...e/src/main/resources/mapper/ManufacturerApiInfoMapper.xml
+75
-0
ManufacturerInfoMapper.xml
...vice/src/main/resources/mapper/ManufacturerInfoMapper.xml
+6
-0
No files found.
signal-utc-service/pom.xml
View file @
88ec542a
...
...
@@ -144,13 +144,6 @@
<groupId>
org.glassfish.jersey.media
</groupId>
<artifactId>
jersey-media-multipart
</artifactId>
</dependency>
<dependency>
<groupId>
com.hikvision.artemis
</groupId>
<artifactId>
sdk
</artifactId>
<version>
1.1.7
</version>
<scope>
system
</scope>
<systemPath>
${project.basedir}/lib/artemis-http-client-1.1.7.jar
</systemPath>
</dependency>
</dependencies>
<build>
...
...
signal-utc-service/src/main/java/net/wanji/utc/common/commonentity/HttpRequest.java
View file @
88ec542a
...
...
@@ -3,7 +3,7 @@ package net.wanji.utc.common.commonentity;
import
lombok.Data
;
import
net.wanji.utc.common.constant.Constants
;
import
net.wanji.utc.common.exception.NoSuchApiException
;
import
net.wanji.utc.po.ApiInfoPO
;
import
net.wanji.utc.po.
Manufacturer
ApiInfoPO
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.MediaType
;
...
...
@@ -23,13 +23,13 @@ public class HttpRequest {
public
HttpRequest
(
String
manufacturerAbbr
,
String
apiCode
)
{
// 获取请求地址
ApiInfoPO
a
piInfoPO
=
Constants
.
getManufacturerUrlMap
(
manufacturerAbbr
+
ManufacturerApiInfoPO
manufacturerA
piInfoPO
=
Constants
.
getManufacturerUrlMap
(
manufacturerAbbr
+
Constants
.
SEPARATOR_UNDER_LINE
+
apiCode
);
if
(
a
piInfoPO
==
null
)
{
if
(
manufacturerA
piInfoPO
==
null
)
{
throw
new
NoSuchApiException
(
"没有此接口信息,请在t_manufacturer_api_info表中添加"
);
}
url
=
a
piInfoPO
.
getAddress
();
httpMethod
=
HttpMethod
.
valueOf
(
a
piInfoPO
.
getMethod
());
url
=
manufacturerA
piInfoPO
.
getAddress
();
httpMethod
=
HttpMethod
.
valueOf
(
manufacturerA
piInfoPO
.
getMethod
());
headers
=
buildHeader
();
}
...
...
signal-utc-service/src/main/java/net/wanji/utc/common/constant/Constants.java
View file @
88ec542a
This diff is collapsed.
Click to expand it.
signal-utc-service/src/main/java/net/wanji/utc/common/task/ApiInfoTask.java
View file @
88ec542a
...
...
@@ -2,9 +2,9 @@ package net.wanji.utc.common.task;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.utc.common.constant.Constants
;
import
net.wanji.utc.mapper.ApiInfoMapper
;
import
net.wanji.utc.mapper.
Manufacturer
ApiInfoMapper
;
import
net.wanji.utc.mapper.ManufacturerInfoMapper
;
import
net.wanji.utc.po.ApiInfoPO
;
import
net.wanji.utc.po.
Manufacturer
ApiInfoPO
;
import
net.wanji.utc.po.ManufacturerInfoPO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.EnableAsync
;
...
...
@@ -18,27 +18,27 @@ import java.util.List;
@EnableAsync
public
class
ApiInfoTask
{
@Autowired
ApiInfoMapper
a
piInfoMapper
;
ManufacturerApiInfoMapper
manufacturerA
piInfoMapper
;
@Autowired
ManufacturerInfoMapper
manufacturerInfoMapper
;
@Scheduled
(
fixedRate
=
2
*
60
*
1000
)
public
void
apiInfoRefresh
()
{
try
{
ApiInfoPO
apiInfoPO
=
new
ApiInfoPO
();
List
<
ApiInfoPO
>
apiInfoPOList
=
a
piInfoMapper
.
selectAll
();
if
(
apiInfoPOList
==
null
||
a
piInfoPOList
.
isEmpty
())
{
ManufacturerApiInfoPO
manufacturerApiInfoPO
=
new
Manufacturer
ApiInfoPO
();
List
<
ManufacturerApiInfoPO
>
manufacturerApiInfoPOList
=
manufacturerA
piInfoMapper
.
selectAll
();
if
(
manufacturerApiInfoPOList
==
null
||
manufacturerA
piInfoPOList
.
isEmpty
())
{
return
;
}
// 刷新JVM
for
(
ApiInfoPO
infoPO
:
a
piInfoPOList
)
{
for
(
ManufacturerApiInfoPO
infoPO
:
manufacturerA
piInfoPOList
)
{
Integer
manufacturerId
=
infoPO
.
getManufacturerId
();
ManufacturerInfoPO
manufacturerInfoPO
=
manufacturerInfoMapper
.
selectById
(
manufacturerId
);
String
abbr
=
manufacturerInfoPO
.
getNickName
();
String
s
=
abbr
+
Constants
.
SEPARATOR_UNDER_LINE
+
infoPO
.
getCode
();
Constants
.
putManufacturerUrlMap
(
s
,
infoPO
);
}
log
.
info
(
"刷新"
+
a
piInfoPOList
.
size
()
+
"条厂商URL至JVM"
);
log
.
info
(
"刷新"
+
manufacturerA
piInfoPOList
.
size
()
+
"条厂商URL至JVM"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"刷新厂商URL到JVM异常"
,
e
);
}
...
...
signal-utc-service/src/main/java/net/wanji/utc/common/typeenum/HttpCode.java
0 → 100644
View file @
88ec542a
package
net
.
wanji
.
utc
.
common
.
typeenum
;
public
enum
HttpCode
{
/** 200请求成功 */
SUCCESS
(
200
),
/** 207频繁操作 */
MULTI_STATUS
(
207
),
/** 400请求参数出错 */
BAD_REQUEST
(
400
),
/** 401没有登录 */
UNAUTHORIZED
(
401
),
/** 402登录失败 */
LOGIN_FAIL
(
402
),
/** 403没有权限 */
FORBIDDEN
(
403
),
/** 404找不到页面 */
NOT_FOUND
(
404
),
/** 405请求方法不能被用于请求相应的资源 */
METHOD_NOT_ALLOWED
(
405
),
/** 406内容特性不满足 */
NOT_ACCEPTABLE
(
406
),
/** token过期 */
TOKEN_EXPIRED
(
407
),
/** 408请求超时 */
REQUEST_TIMEOUT
(
408
),
/** 409发生冲突 */
CONFLICT
(
409
),
/** 410已被删除 */
GONE
(
410
),
/** 411没有定义长度 */
LENGTH_REQUIRED
(
411
),
/** 412条件不满足 */
PRECONDITION_FAILED
(
412
),
/** 413数据太大 */
ENTITY_TOO_LARGE
(
413
),
/** 415不是服务器中所支持的格式 */
UNSUPPORTED_MEDIA_TYPE
(
415
),
/** 421连接数过多 */
TOO_MANY_CONNECTIONS
(
421
),
/** 423已被锁定 */
LOCKED
(
423
),
/** 451法律不允许 */
UNAVAILABLE_LEGAL
(
451
),
/** 500服务器出错 */
INTERNAL_SERVER_ERROR
(
500
),
/** 501不支持当前请求所需要的某个功能 */
NOT_IMPLEMENTED
(
501
),
/** 503服务器升级中,暂时不可用 */
SERVICE_UNAVAILABLE
(
503
),
/** 501获取资源所需要的策略并没有被满足 */
NOT_EXTENDED
(
510
);
private
final
Integer
value
;
private
HttpCode
(
Integer
value
)
{
this
.
value
=
value
;
}
/**
* Return the integer value of this status code.
*/
public
Integer
value
()
{
return
this
.
value
;
}
@Override
public
String
toString
()
{
return
this
.
value
.
toString
();
}
}
\ No newline at end of file
signal-utc-service/src/main/java/net/wanji/utc/common/typeenum/ManufacturerApiInfoTypeEnum.java
0 → 100644
View file @
88ec542a
package
net
.
wanji
.
utc
.
common
.
typeenum
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* @author Kent HAN
* @date 2022/11/24 14:16
*/
@Getter
@AllArgsConstructor
public
enum
ManufacturerApiInfoTypeEnum
{
ONE
(
1
,
"静态信息接口"
),
TWO
(
2
,
"运行信息接口"
),
THREE
(
3
,
"控制指令接口"
);
private
Integer
code
;
private
String
msg
;
public
static
Integer
getCodeByMsg
(
String
typeStr
)
{
for
(
ManufacturerApiInfoTypeEnum
value
:
values
())
{
if
(
value
.
getMsg
().
equals
(
typeStr
))
{
return
value
.
getCode
();
}
}
return
null
;
}
}
signal-utc-service/src/main/java/net/wanji/utc/controller/ManufacturerApiController.java
0 → 100644
View file @
88ec542a
package
net
.
wanji
.
utc
.
controller
;
import
com.github.pagehelper.PageInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
net.wanji.utc.entity.JsonViewObject
;
import
net.wanji.utc.po.ManufacturerApiInfoPO
;
import
net.wanji.utc.service.systemadmin.ManufacturerApiInfoService
;
import
net.wanji.utc.vo.systemadmin.DeleteListInVO
;
import
net.wanji.utc.vo.systemadmin.ManufacturerApiInfoInsertOrUpdateInVO
;
import
net.wanji.utc.vo.systemadmin.ManufacturerApiInfoListInVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
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.ws.rs.core.MediaType
;
/**
* 系统管理-接口管理
*
* @author Kent HAN
* @date 2022/11/24 8:32
*/
@Api
(
value
=
"系统管理-接口管理"
,
description
=
"系统管理-接口管理"
)
@RequestMapping
(
"/manufacturerApiInfo"
)
@RestController
public
class
ManufacturerApiController
{
@Autowired
ManufacturerApiInfoService
manufacturerApiInfoService
;
@ApiOperation
(
value
=
"接口列表"
,
notes
=
"接口列表"
,
response
=
ManufacturerApiInfoPO
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/list"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ManufacturerApiInfoPO
.
class
),
})
public
JsonViewObject
list
(
@RequestBody
ManufacturerApiInfoListInVO
manufacturerApiInfoListInVO
)
{
PageInfo
<
ManufacturerApiInfoPO
>
manufacturerApiInfoPOPageInfo
=
manufacturerApiInfoService
.
list
(
manufacturerApiInfoListInVO
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
(
manufacturerApiInfoPOPageInfo
);
}
@ApiOperation
(
value
=
"接口添加或修改"
,
notes
=
"接口添加或修改"
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/insertOrUpdate"
,
consumes
=
MediaType
.
APPLICATION_JSON
)
public
JsonViewObject
insertOrUpdate
(
@RequestBody
ManufacturerApiInfoInsertOrUpdateInVO
inVO
)
{
manufacturerApiInfoService
.
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
)
{
manufacturerApiInfoService
.
delete
(
inVO
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
();
}
}
signal-utc-service/src/main/java/net/wanji/utc/controller/Manufacturer
Admin
Controller.java
→
signal-utc-service/src/main/java/net/wanji/utc/controller/ManufacturerController.java
View file @
88ec542a
...
...
@@ -5,14 +5,15 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
net.wanji.utc.entity.JsonViewObject
;
import
net.wanji.utc.po.ManufacturerInfoPO
;
import
net.wanji.utc.service.systemadmin.ManufacturerService
;
import
net.wanji.utc.vo.systemadmin.
ManufacturerDelete
InVO
;
import
net.wanji.utc.vo.systemadmin.
DeleteList
InVO
;
import
net.wanji.utc.vo.systemadmin.ManufacturerInsertOrUpdateInVO
;
import
net.wanji.utc.vo.systemadmin.ManufacturerListInVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.ws.rs.core.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -28,7 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
@Api
(
value
=
"系统管理-厂商管理"
,
description
=
"系统管理-厂商管理"
)
@RequestMapping
(
"/manufacturer"
)
@RestController
public
class
Manufacturer
Admin
Controller
{
public
class
ManufacturerController
{
@Autowired
ManufacturerService
manufacturerService
;
...
...
@@ -39,22 +40,28 @@ public class ManufacturerAdminController {
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ManufacturerInfoPO
.
class
),
})
public
ResponseEntity
list
(
@RequestBody
ManufacturerListInVO
manufacturerListInVO
)
{
public
JsonViewObject
list
(
@RequestBody
ManufacturerListInVO
manufacturerListInVO
)
{
PageInfo
<
ManufacturerInfoPO
>
manufacturerInfoPOPageInfo
=
manufacturerService
.
list
(
manufacturerListInVO
);
return
ResponseEntity
.
ok
(
manufacturerInfoPOPageInfo
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
(
manufacturerInfoPOPageInfo
);
}
@ApiOperation
(
value
=
"厂商添加或修改"
,
notes
=
"厂商添加或修改"
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/insertOrUpdate"
,
consumes
=
MediaType
.
APPLICATION_JSON
)
public
ResponseEntity
insertOrUpdate
(
@RequestBody
ManufacturerInsertOrUpdateInVO
inVO
)
{
public
JsonViewObject
insertOrUpdate
(
@RequestBody
ManufacturerInsertOrUpdateInVO
inVO
)
{
manufacturerService
.
insertOrUpdate
(
inVO
);
return
ResponseEntity
.
ok
(
"success"
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
();
}
@ApiOperation
(
value
=
"厂商删除"
,
notes
=
"厂商删除"
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/delete"
,
consumes
=
MediaType
.
APPLICATION_JSON
)
public
ResponseEntity
delete
(
@RequestBody
ManufacturerDelete
InVO
inVO
)
{
public
JsonViewObject
delete
(
@RequestBody
DeleteList
InVO
inVO
)
{
manufacturerService
.
delete
(
inVO
);
return
ResponseEntity
.
ok
(
"success"
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
();
}
}
signal-utc-service/src/main/java/net/wanji/utc/entity/JsonViewObject.java
0 → 100644
View file @
88ec542a
package
net
.
wanji
.
utc
.
entity
;
import
lombok.Data
;
import
net.wanji.utc.common.constant.Constants
;
import
net.wanji.utc.common.typeenum.HttpCode
;
import
java.io.Serializable
;
@Data
public
class
JsonViewObject
implements
Serializable
{
private
Object
content
;
private
String
message
;
private
String
status
;
private
Integer
code
;
private
Long
timestamp
;
public
Object
getContent
()
{
return
content
;
}
public
String
getMessage
()
{
return
message
;
}
public
String
getStatus
()
{
return
status
;
}
private
JsonViewObject
()
{
}
public
static
JsonViewObject
newInstance
()
{
return
new
JsonViewObject
();
}
public
JsonViewObject
success
()
{
return
success
((
Object
)
""
);
}
public
JsonViewObject
success
(
Object
content
)
{
return
success
(
content
,
""
);
}
public
JsonViewObject
success
(
String
message
)
{
return
success
(
""
,
message
);
}
public
JsonViewObject
success
(
Object
content
,
String
message
)
{
return
pack
(
content
,
message
,
Constants
.
JsonView
.
STATUS_SUCCESS
);
}
public
JsonViewObject
fail
()
{
return
fail
(
""
,
""
);
}
public
JsonViewObject
fail
(
Exception
e
)
{
String
message
=
e
.
getMessage
();
int
index
=
message
.
indexOf
(
":"
);
return
fail
(
index
==
-
1
?
message
:
message
.
substring
(
index
+
1
));
}
public
JsonViewObject
fail
(
String
errMsg
)
{
return
fail
(
""
,
errMsg
);
}
public
JsonViewObject
fail
(
Object
content
,
String
message
)
{
return
pack
(
content
,
message
,
Constants
.
JsonView
.
STATUS_FAIL
);
}
private
JsonViewObject
pack
(
Object
content
,
String
message
,
String
status
)
{
this
.
content
=
content
;
this
.
message
=
message
;
this
.
status
=
status
;
//增加服务返回状态码,后期待完善
this
.
code
=(
status
.
equals
(
Constants
.
JsonView
.
STATUS_SUCCESS
)
?
HttpCode
.
SUCCESS
.
value
():
HttpCode
.
INTERNAL_SERVER_ERROR
.
value
());
return
this
;
}
}
\ No newline at end of file
signal-utc-service/src/main/java/net/wanji/utc/mapper/ApiInfoMapper.java
deleted
100644 → 0
View file @
8cf2af41
package
net
.
wanji
.
utc
.
mapper
;
import
net.wanji.utc.po.ApiInfoPO
;
import
java.util.List
;
/**
* @author Kent HAN
* @date 2022/11/15 15:31
*/
public
interface
ApiInfoMapper
{
List
<
ApiInfoPO
>
selectAll
();
}
signal-utc-service/src/main/java/net/wanji/utc/mapper/ManufacturerApiInfoMapper.java
0 → 100644
View file @
88ec542a
package
net
.
wanji
.
utc
.
mapper
;
import
net.wanji.utc.po.ManufacturerApiInfoPO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @author Kent HAN
* @date 2022/11/15 15:31
*/
public
interface
ManufacturerApiInfoMapper
{
List
<
ManufacturerApiInfoPO
>
selectAll
();
List
<
ManufacturerApiInfoPO
>
selectByOptionals
(
@Param
(
"name"
)
String
name
,
@Param
(
"typeCode"
)
Integer
typeCode
,
@Param
(
"manufacturerId"
)
Integer
manufacturerId
);
void
insertOne
(
ManufacturerApiInfoPO
manufacturerApiInfoPO
);
void
updateOne
(
ManufacturerApiInfoPO
manufacturerApiInfoPO
);
void
deleteBatch
(
@Param
(
"ids"
)
List
<
Integer
>
ids
);
}
signal-utc-service/src/main/java/net/wanji/utc/mapper/ManufacturerInfoMapper.java
View file @
88ec542a
...
...
@@ -25,4 +25,6 @@ public interface ManufacturerInfoMapper {
void
updateOne
(
ManufacturerInfoPO
manufacturerInfoPO
);
void
deleteBatch
(
@Param
(
"ids"
)
List
<
Integer
>
ids
);
Integer
selectIdByName
(
@Param
(
"manufacturerName"
)
String
manufacturerName
);
}
signal-utc-service/src/main/java/net/wanji/utc/po/ApiInfoPO.java
→
signal-utc-service/src/main/java/net/wanji/utc/po/
Manufacturer
ApiInfoPO.java
View file @
88ec542a
...
...
@@ -10,32 +10,32 @@ import java.util.Date;
* @date 2022/11/15 13:41
*/
@Data
public
class
ApiInfoPO
{
public
class
Manufacturer
ApiInfoPO
{
/** 接口ID */
@ApiModelProperty
(
nam
e
=
"接口ID"
,
notes
=
""
)
@ApiModelProperty
(
valu
e
=
"接口ID"
,
notes
=
""
)
private
Integer
id
;
/** 接口代码 */
@ApiModelProperty
(
nam
e
=
"接口代码"
,
notes
=
""
)
@ApiModelProperty
(
valu
e
=
"接口代码"
,
notes
=
""
)
private
String
code
;
/** 接口名称 */
@ApiModelProperty
(
nam
e
=
"接口名称"
,
notes
=
""
)
@ApiModelProperty
(
valu
e
=
"接口名称"
,
notes
=
""
)
private
String
name
;
/** 接口类型:1、静态;2、动态;3、控制 */
@ApiModelProperty
(
nam
e
=
"接口类型:1、静态;2、动态;3、控制"
,
notes
=
""
)
@ApiModelProperty
(
valu
e
=
"接口类型:1、静态;2、动态;3、控制"
,
notes
=
""
)
private
Integer
type
;
/** 请求方式:get、post */
@ApiModelProperty
(
nam
e
=
"请求方式:get、post"
,
notes
=
""
)
@ApiModelProperty
(
valu
e
=
"请求方式:get、post"
,
notes
=
""
)
private
String
method
;
/** 接口地址 */
@ApiModelProperty
(
nam
e
=
"接口地址"
,
notes
=
""
)
@ApiModelProperty
(
valu
e
=
"接口地址"
,
notes
=
""
)
private
String
address
;
/** 厂商ID */
@ApiModelProperty
(
nam
e
=
"厂商ID"
,
notes
=
""
)
@ApiModelProperty
(
valu
e
=
"厂商ID"
,
notes
=
""
)
private
Integer
manufacturerId
;
/** 创建时间 */
@ApiModelProperty
(
nam
e
=
"创建时间"
,
notes
=
""
)
@ApiModelProperty
(
valu
e
=
"创建时间"
,
notes
=
""
)
private
Date
gmtCreate
;
/** 修改时间 */
@ApiModelProperty
(
nam
e
=
"修改时间"
,
notes
=
""
)
@ApiModelProperty
(
valu
e
=
"修改时间"
,
notes
=
""
)
private
Date
gmtModified
;
}
signal-utc-service/src/main/java/net/wanji/utc/service/systemadmin/ManufacturerApiInfoService.java
0 → 100644
View file @
88ec542a
package
net
.
wanji
.
utc
.
service
.
systemadmin
;
import
com.github.pagehelper.PageInfo
;
import
net.wanji.utc.po.ManufacturerApiInfoPO
;
import
net.wanji.utc.vo.systemadmin.DeleteListInVO
;
import
net.wanji.utc.vo.systemadmin.ManufacturerApiInfoInsertOrUpdateInVO
;
import
net.wanji.utc.vo.systemadmin.ManufacturerApiInfoListInVO
;
/**
* @author Kent HAN
* @date 2022/11/24 13:59
*/
public
interface
ManufacturerApiInfoService
{
PageInfo
<
ManufacturerApiInfoPO
>
list
(
ManufacturerApiInfoListInVO
manufacturerApiInfoListInVO
);
void
insertOrUpdate
(
ManufacturerApiInfoInsertOrUpdateInVO
inVO
);
void
delete
(
DeleteListInVO
inVO
);
}
signal-utc-service/src/main/java/net/wanji/utc/service/systemadmin/ManufacturerService.java
View file @
88ec542a
...
...
@@ -2,7 +2,7 @@ package net.wanji.utc.service.systemadmin;
import
com.github.pagehelper.PageInfo
;
import
net.wanji.utc.po.ManufacturerInfoPO
;
import
net.wanji.utc.vo.systemadmin.
ManufacturerDelete
InVO
;
import
net.wanji.utc.vo.systemadmin.
DeleteList
InVO
;
import
net.wanji.utc.vo.systemadmin.ManufacturerInsertOrUpdateInVO
;
import
net.wanji.utc.vo.systemadmin.ManufacturerListInVO
;
...
...
@@ -15,5 +15,5 @@ public interface ManufacturerService {
void
insertOrUpdate
(
ManufacturerInsertOrUpdateInVO
inVO
);
void
delete
(
ManufacturerDelete
InVO
inVO
);
void
delete
(
DeleteList
InVO
inVO
);
}
signal-utc-service/src/main/java/net/wanji/utc/service/systemadmin/impl/ManufacturerApiInfoServiceImpl.java
0 → 100644
View file @
88ec542a
package
net
.
wanji
.
utc
.
service
.
systemadmin
.
impl
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
net.wanji.utc.common.typeenum.ManufacturerApiInfoTypeEnum
;
import
net.wanji.utc.mapper.ManufacturerApiInfoMapper
;
import
net.wanji.utc.mapper.ManufacturerInfoMapper
;
import
net.wanji.utc.po.ManufacturerApiInfoPO
;
import
net.wanji.utc.po.ManufacturerInfoPO
;
import
net.wanji.utc.service.systemadmin.ManufacturerApiInfoService
;
import
net.wanji.utc.vo.systemadmin.DeleteListInVO
;
import
net.wanji.utc.vo.systemadmin.ManufacturerApiInfoInsertOrUpdateInVO
;
import
net.wanji.utc.vo.systemadmin.ManufacturerApiInfoListInVO
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* @author Kent HAN
* @date 2022/11/24 14:10
*/
@Service
public
class
ManufacturerApiInfoServiceImpl
implements
ManufacturerApiInfoService
{
@Autowired
ManufacturerApiInfoMapper
manufacturerApiInfoMapper
;
@Autowired
ManufacturerInfoMapper
manufacturerInfoMapper
;
@Override
public
PageInfo
<
ManufacturerApiInfoPO
>
list
(
ManufacturerApiInfoListInVO
manufacturerApiInfoListInVO
)
{
Integer
pageNum
=
manufacturerApiInfoListInVO
.
getPageNum
();
Integer
pageSize
=
manufacturerApiInfoListInVO
.
getPageSize
();
String
name
=
manufacturerApiInfoListInVO
.
getName
();
String
typeStr
=
manufacturerApiInfoListInVO
.
getTypeStr
();
Integer
typeCode
=
null
;
if
(
typeStr
!=
null
)
{
typeCode
=
ManufacturerApiInfoTypeEnum
.
getCodeByMsg
(
typeStr
);
}
String
manufacturerName
=
manufacturerApiInfoListInVO
.
getManufacturerName
();
Integer
manufacturerId
=
null
;
if
(
manufacturerName
!=
null
)
{
manufacturerId
=
manufacturerInfoMapper
.
selectIdByName
(
manufacturerName
);
}
PageHelper
.
startPage
(
pageNum
,
pageSize
);
List
<
ManufacturerApiInfoPO
>
manufacturerApiInfoPOList
=
manufacturerApiInfoMapper
.
selectByOptionals
(
name
,
typeCode
,
manufacturerId
);
PageInfo
<
ManufacturerApiInfoPO
>
manufacturerApiInfoPOPageInfo
=
new
PageInfo
<>(
manufacturerApiInfoPOList
);
return
manufacturerApiInfoPOPageInfo
;
}
@Override
public
void
insertOrUpdate
(
ManufacturerApiInfoInsertOrUpdateInVO
inVO
)
{
Integer
id
=
inVO
.
getId
();
ManufacturerApiInfoPO
manufacturerApiInfoPO
=
new
ManufacturerApiInfoPO
();
BeanUtils
.
copyProperties
(
inVO
,
manufacturerApiInfoPO
);
String
typeStr
=
inVO
.
getApiType
();
Integer
typeCode
=
ManufacturerApiInfoTypeEnum
.
getCodeByMsg
(
typeStr
);
String
manufacturerName
=
inVO
.
getManufacturerName
();
Integer
manufacturerId
=
manufacturerInfoMapper
.
selectIdByName
(
manufacturerName
);
manufacturerApiInfoPO
.
setType
(
typeCode
);
manufacturerApiInfoPO
.
setManufacturerId
(
manufacturerId
);
if
(
id
==
null
||
id
==
0
)
{
// 添加
manufacturerApiInfoMapper
.
insertOne
(
manufacturerApiInfoPO
);
}
else
{
// 修改
manufacturerApiInfoMapper
.
updateOne
(
manufacturerApiInfoPO
);
}
}
@Override
public
void
delete
(
DeleteListInVO
inVO
)
{
List
<
Integer
>
ids
=
inVO
.
getIds
();
manufacturerApiInfoMapper
.
deleteBatch
(
ids
);
}
}
signal-utc-service/src/main/java/net/wanji/utc/service/systemadmin/impl/ManufacturerServiceImpl.java
View file @
88ec542a
...
...
@@ -5,12 +5,11 @@ import com.github.pagehelper.PageInfo;
import
net.wanji.utc.mapper.ManufacturerInfoMapper
;
import
net.wanji.utc.po.ManufacturerInfoPO
;
import
net.wanji.utc.service.systemadmin.ManufacturerService
;
import
net.wanji.utc.vo.systemadmin.
ManufacturerDelete
InVO
;
import
net.wanji.utc.vo.systemadmin.
DeleteList
InVO
;
import
net.wanji.utc.vo.systemadmin.ManufacturerInsertOrUpdateInVO
;
import
net.wanji.utc.vo.systemadmin.ManufacturerListInVO
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
...
...
@@ -52,7 +51,7 @@ public class ManufacturerServiceImpl implements ManufacturerService {
}
@Override
public
void
delete
(
ManufacturerDelete
InVO
inVO
)
{
public
void
delete
(
DeleteList
InVO
inVO
)
{
List
<
Integer
>
ids
=
inVO
.
getIds
();
manufacturerInfoMapper
.
deleteBatch
(
ids
);
}
...
...
signal-utc-service/src/main/java/net/wanji/utc/vo/systemadmin/
ManufacturerDelete
InVO.java
→
signal-utc-service/src/main/java/net/wanji/utc/vo/systemadmin/
DeleteList
InVO.java
View file @
88ec542a
...
...
@@ -11,9 +11,9 @@ import java.util.List;
* @date 2022/11/24 10:10
*/
@Data
@ApiModel
(
value
=
"
ManufacturerDeleteInVO"
,
description
=
"厂商
删除输入参数"
)
public
class
ManufacturerDelete
InVO
{
/** 厂商ID列表 */
@ApiModelProperty
(
value
=
"厂商ID列表"
,
notes
=
""
)
@ApiModel
(
value
=
"
DeleteListInVO"
,
description
=
"厂商或接口
删除输入参数"
)
public
class
DeleteList
InVO
{
/** 厂商
或接口
ID列表 */
@ApiModelProperty
(
value
=
"厂商
或接口
ID列表"
,
notes
=
""
)
private
List
<
Integer
>
ids
;
}
signal-utc-service/src/main/java/net/wanji/utc/vo/systemadmin/ManufacturerApiInfoInsertOrUpdateInVO.java
0 → 100644
View file @
88ec542a
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/24 15:20
*/
@Data
@ApiModel
(
value
=
"ManufacturerApiInfoInsertOrUpdateInVO"
,
description
=
"接口新增或修改删除输入参数"
)
public
class
ManufacturerApiInfoInsertOrUpdateInVO
{
/** 接口ID */
@ApiModelProperty
(
value
=
"接口ID。不传ID为新增,传ID为修改"
,
notes
=
""
)
private
Integer
id
;
/** 接口代码 */
@ApiModelProperty
(
required
=
true
,
value
=
"接口代码"
,
notes
=
""
)
private
String
code
;
/** 接口名称 */
@ApiModelProperty
(
required
=
true
,
value
=
"接口名称"
,
notes
=
""
)
private
String
name
;
/** 接口类型 */
@ApiModelProperty
(
required
=
true
,
value
=
"接口类型"
,
notes
=
""
)
private
String
apiType
;
/** 请求方式:get、post */
@ApiModelProperty
(
required
=
true
,
value
=
"请求方式:get、post"
,
notes
=
""
)
private
String
method
;
/** 接口地址 */
@ApiModelProperty
(
required
=
true
,
value
=
"接口地址"
,
notes
=
""
)
private
String
address
;
/** 厂商ID */
@ApiModelProperty
(
required
=
true
,
value
=
"接口厂商"
,
notes
=
""
)
private
String
manufacturerName
;
}
signal-utc-service/src/main/java/net/wanji/utc/vo/systemadmin/ManufacturerApiInfoListInVO.java
0 → 100644
View file @
88ec542a
package
net
.
wanji
.
utc
.
vo
.
systemadmin
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author Kent HAN
* @date 2022/11/24 14:05
*/
@Data
@ApiModel
(
value
=
"ManufacturerApiInfoListInVO"
,
description
=
"查询接口列表输入参数"
)
public
class
ManufacturerApiInfoListInVO
{
@ApiModelProperty
(
required
=
true
,
value
=
"页号"
)
Integer
pageNum
;
@ApiModelProperty
(
required
=
true
,
value
=
"每页记录数"
)
Integer
pageSize
;
@ApiModelProperty
(
value
=
"接口名称"
)
String
name
;
@ApiModelProperty
(
value
=
"接口类型"
)
String
typeStr
;
@ApiModelProperty
(
value
=
"接口厂商"
)
String
manufacturerName
;
}
signal-utc-service/src/main/resources/mapper/ApiInfoMapper.xml
→
signal-utc-service/src/main/resources/mapper/
Manufacturer
ApiInfoMapper.xml
View file @
88ec542a
<?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.utc.mapper.ApiInfoMapper"
>
<resultMap
type=
"net.wanji.utc.po.ApiInfoPO"
id=
"BaseResultMap"
>
<mapper
namespace=
"net.wanji.utc.mapper.
Manufacturer
ApiInfoMapper"
>
<resultMap
type=
"net.wanji.utc.po.
Manufacturer
ApiInfoPO"
id=
"BaseResultMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"code"
column=
"code"
/>
<result
property=
"name"
column=
"name"
/>
...
...
@@ -13,9 +13,63 @@
<result
property=
"gmtModified"
column=
"gmt_modified"
/>
</resultMap>
<insert
id=
"insertOne"
>
insert into t_manufacturer_api_info(code,name,type,method,address,manufacturer_id)
values (#{code},#{name},#{type},#{method},#{address},#{manufacturerId})
</insert>
<update
id=
"updateOne"
>
update t_manufacturer_api_info
<set>
<if
test=
"code != null and code != ''"
>
code = #{code},
</if>
<if
test=
"name != null and name != ''"
>
name = #{name},
</if>
<if
test=
"type != null and type != 0"
>
type = #{type},
</if>
<if
test=
"method != null and method != ''"
>
method = #{method},
</if>
<if
test=
"address != null and address != ''"
>
address = #{address},
</if>
<if
test=
"manufacturerId != null and manufacturerId != 0"
>
manufacturer_id = #{manufacturerId},
</if>
</set>
where id = #{id}
</update>
<delete
id=
"deleteBatch"
>
delete from t_manufacturer_api_info
where id in
<foreach
collection=
"ids"
item=
"id"
separator=
","
open=
"("
close=
")"
>
#{id}
</foreach>
</delete>
<select
id=
"selectAll"
resultMap=
"BaseResultMap"
>
select
id,code,name,type,method,address,manufacturer_id,gmt_create,gmt_modified
from t_manufacturer_api_info
</select>
<select
id=
"selectByOptionals"
resultMap=
"BaseResultMap"
>
select id,code,name,type,method,address,manufacturer_id,gmt_create,gmt_modified
from t_manufacturer_api_info
<where>
<if
test=
"name != null and name != ''"
>
AND name LIKE CONCAT('%',#{name},'%')
</if>
<if
test=
"typeCode != null and typeCode != 0"
>
AND type = #{typeCode}
</if>
<if
test=
"manufacturerId != null and manufacturerId != 0"
>
AND manufacturer_id = #{manufacturerId}
</if>
</where>
</select>
</mapper>
signal-utc-service/src/main/resources/mapper/ManufacturerInfoMapper.xml
View file @
88ec542a
...
...
@@ -11,6 +11,7 @@
<result
property=
"gmtCreate"
column=
"gmt_create"
/>
<result
property=
"gmtModified"
column=
"gmt_modified"
/>
</resultMap>
<insert
id=
"insertOne"
>
insert into t_manufacturer_info(code,name,nick_name,address,maintenance_unit)
values (#{code},#{name},#{nickName},#{address},#{maintenanceUnit})
...
...
@@ -75,4 +76,9 @@
</where>
order by id
</select>
<select
id=
"selectIdByName"
resultType=
"java.lang.Integer"
>
select id from t_manufacturer_info
where name = #{manufacturerName}
</select>
</mapper>
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