Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jz-dmp-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
姚本章
jz-dmp-service
Commits
40eb0b54
Commit
40eb0b54
authored
Jan 20, 2021
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
1c032397
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
222 additions
and
15 deletions
+222
-15
SourceDbNameListDto.java
.../controller/DataIntegration/bean/SourceDbNameListDto.java
+2
-2
DmpApiMangeController.java
...modules/controller/dataService/DmpApiMangeController.java
+23
-0
DmpApiServiceMangeController.java
.../controller/dataService/DmpApiServiceMangeController.java
+67
-0
OrganizationManageAddReq.java
...controller/dataService/bean/OrganizationManageAddReq.java
+1
-1
OrganizationManageUpdateReq.java
...troller/dataService/bean/OrganizationManageUpdateReq.java
+1
-1
DmpApiMangeService.java
...n/java/com/jz/dmp/modules/service/DmpApiMangeService.java
+7
-0
DmpApiServiceMangeService.java
...com/jz/dmp/modules/service/DmpApiServiceMangeService.java
+16
-0
DmpApiMangeServiceImpl.java
...m/jz/dmp/modules/service/impl/DmpApiMangeServiceImpl.java
+35
-0
DmpApiServiceMangeServiceImpl.java
...p/modules/service/impl/DmpApiServiceMangeServiceImpl.java
+60
-0
DmpOrgMangeServiceImpl.java
...m/jz/dmp/modules/service/impl/DmpOrgMangeServiceImpl.java
+1
-1
OfflineSynchMapper.xml
src/main/resources/mapper/dmp/OfflineSynchMapper.xml
+9
-10
No files found.
src/main/java/com/jz/dmp/modules/controller/DataIntegration/bean/SourceDbNameListDto.java
View file @
40eb0b54
...
...
@@ -22,7 +22,7 @@ public class SourceDbNameListDto {
/*
* 源数据库名称
* */
@ApiModelProperty
(
value
=
"
源数据库
名称"
)
@ApiModelProperty
(
value
=
"
数据源
名称"
)
String
datasourceNameOrg
;
/*
...
...
@@ -40,7 +40,7 @@ public class SourceDbNameListDto {
/*
* 源数据库和数据库类型名称
* */
@ApiModelProperty
(
value
=
"
源数据库
和数据库类型名称"
)
@ApiModelProperty
(
value
=
"
数据源
和数据库类型名称"
)
String
datasourceName
;
/*
...
...
src/main/java/com/jz/dmp/modules/controller/dataService/DmpApiMangeController.java
View file @
40eb0b54
...
...
@@ -217,4 +217,27 @@ public class DmpApiMangeController {
return
jsonResult
;
}
/**
* 授权模糊查询组织信息
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation
(
value
=
"授权模糊查询组织信息"
,
notes
=
"授权模糊查询组织信息"
)
@GetMapping
(
value
=
"/authOrgList"
)
@ApiImplicitParam
(
name
=
"key"
,
value
=
"key"
,
required
=
true
)
public
JsonResult
getAuthOrgList
(
@RequestParam
String
key
,
HttpServletRequest
httpRequest
)
{
if
(
StringUtils
.
isEmpty
(
key
))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"key不能为空!"
);
}
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
getAuthOrgList
(
key
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/controller/dataService/DmpApiServiceMangeController.java
View file @
40eb0b54
...
...
@@ -2,6 +2,7 @@ package com.jz.dmp.modules.controller.dataService;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto
;
import
com.jz.dmp.modules.controller.dataService.bean.*
;
import
com.jz.dmp.modules.service.DmpApiMangeService
;
import
com.jz.dmp.modules.service.DmpApiServiceMangeService
;
...
...
@@ -17,6 +18,7 @@ import org.springframework.validation.annotation.Validated;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
/**
* 数据服务-服务管理--调用gateway 接口
...
...
@@ -37,6 +39,9 @@ public class DmpApiServiceMangeController {
@Autowired
private
DmpApiServiceMangeService
dmpApiServiceMangeService
;
@Autowired
private
DmpApiMangeService
dmpApiMangeService
;
/**
* 保存API(第三方)基本信息
*
...
...
@@ -117,4 +122,66 @@ public class DmpApiServiceMangeController {
return
jsonResult
;
}
/**
* API计量调用次数和执行时长
*
* @author Bellamy
* @since 2021-01-20
*/
@ApiOperation
(
value
=
"API计量--调用次数和执行时长"
,
notes
=
"API计量调用次数和执行时长"
)
@GetMapping
(
value
=
"/countAPiCallStat"
)
//@ApiImplicitParam(name = "date", value = "date", required = true)
public
JsonResult
countAPiCallStat
(
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiServiceMangeService
.
getCountAPiCallStat
();
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* API计量--API列表
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation
(
value
=
"API计量--API列表"
,
notes
=
"API计量--API列表"
)
@PostMapping
(
value
=
"/apiCountListPage"
)
public
JsonResult
apiCountListPage
(
@RequestBody
@Validated
ApiInterfaceInfoListReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiMangeService
.
queryApiListPage
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 获取数据源配置——下拉框
*
* @return
* @author Bellamy
*/
@ApiOperation
(
value
=
"获取数据源配置-下拉框"
,
notes
=
"获取数据源配置"
)
@GetMapping
(
value
=
"/sourceDbList"
)
@ApiImplicitParam
(
name
=
"projectId"
,
value
=
"项目id"
,
required
=
true
)
public
JsonResult
<
List
<
SourceDbNameListDto
>>
getSourceDbList
(
@RequestParam
Integer
projectId
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiServiceMangeService
.
querygSourceDbList
(
projectId
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
"查询失败"
);
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/controller/dataService/bean/OrganizationManageAddReq.java
View file @
40eb0b54
...
...
@@ -47,7 +47,7 @@ public class OrganizationManageAddReq implements Serializable {
private
String
linkman
;
@ApiModelProperty
(
value
=
"状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)"
,
required
=
true
)
private
String
status
;
private
Boolean
status
;
@ApiModelProperty
(
value
=
"创建人"
)
private
String
createUser
;
...
...
src/main/java/com/jz/dmp/modules/controller/dataService/bean/OrganizationManageUpdateReq.java
View file @
40eb0b54
...
...
@@ -50,7 +50,7 @@ public class OrganizationManageUpdateReq implements Serializable {
private
String
linkman
;
@ApiModelProperty
(
value
=
"状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)"
,
required
=
true
)
private
String
status
;
private
Boolean
status
;
@ApiModelProperty
(
value
=
"创建人"
)
private
String
createUser
;
...
...
src/main/java/com/jz/dmp/modules/service/DmpApiMangeService.java
View file @
40eb0b54
...
...
@@ -76,4 +76,11 @@ public interface DmpApiMangeService {
*/
JsonResult
checkApiLogInfo
(
LogInfoListReq
req
)
throws
Exception
;
/**
* 授权模糊查询组织信息
*
* @author Bellamy
* @since 2021-01-19
*/
JsonResult
getAuthOrgList
(
String
key
)
throws
Exception
;
}
src/main/java/com/jz/dmp/modules/service/DmpApiServiceMangeService.java
View file @
40eb0b54
...
...
@@ -46,4 +46,20 @@ public interface DmpApiServiceMangeService {
* @since 2021-01-20
*/
JsonResult
updateApiBigDataInfo
(
MakeBigDataApiReq
req
)
throws
Exception
;
/**
* API计量调用次数和执行时长
*
* @author Bellamy
* @since 2021-01-20
*/
JsonResult
getCountAPiCallStat
()
throws
Exception
;
/**
* 获取数据源配置——下拉框
*
* @return
* @author Bellamy
*/
JsonResult
querygSourceDbList
(
Integer
projectId
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/impl/DmpApiMangeServiceImpl.java
View file @
40eb0b54
...
...
@@ -54,6 +54,9 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
//查看日志url
private
static
final
String
checkApiLog
=
"/api/logging/listApiLog"
;
//授权模糊查询组织信息url
private
static
final
String
authOrgList
=
"/api/auth/getAuthNameList"
;
@Value
(
"${spring.gateway-url}"
)
private
String
gatewayUrl
;
...
...
@@ -308,4 +311,36 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
return
result
;
}
/**
* 授权模糊查询组织信息
*
* @author Bellamy
* @since 2021-01-19
*/
@Override
public
JsonResult
getAuthOrgList
(
String
key
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
authOrgList
;
Map
params
=
new
HashMap
();
params
.
put
(
"key"
,
key
);
String
returnData
=
HttpClientUtils
.
getJsonForParam
(
url
,
params
);
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
map
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
map
.
get
(
"data"
));
}
}
if
(
map
.
containsKey
(
"message"
))
{
logger
.
info
(
map
.
get
(
"message"
).
toString
());
result
.
setMessage
(
map
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
}
src/main/java/com/jz/dmp/modules/service/impl/DmpApiServiceMangeServiceImpl.java
View file @
40eb0b54
...
...
@@ -3,11 +3,14 @@ package com.jz.dmp.modules.service.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.utils.DateUtils
;
import
com.jz.common.utils.web.HttpClientUtils
;
import
com.jz.common.utils.web.SessionUtils
;
import
com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto
;
import
com.jz.dmp.modules.controller.dataService.bean.ApiInterfaceReq
;
import
com.jz.dmp.modules.controller.dataService.bean.MakeBigDataApiReq
;
import
com.jz.dmp.modules.dao.DvRuleTDao
;
import
com.jz.dmp.modules.dao.OfflineSynchDao
;
import
com.jz.dmp.modules.model.DvRuleT
;
import
com.jz.dmp.modules.service.DmpApiServiceMangeService
;
import
com.jz.dmp.modules.service.DvRuleTService
;
...
...
@@ -19,6 +22,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -43,9 +48,17 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
//编辑API(第三方)基本信息url
private
static
final
String
updateApiInfo
=
"/api/producer/saveUpdate"
;
//API计量调用次数和执行时长url
private
static
final
String
countAPiCallStat
=
"/api/logging/countAPiCallStat"
;
@Value
(
"${spring.gateway-url}"
)
private
String
gatewayUrl
;
@Value
(
"${spring.api-bigData-setting}"
)
private
String
apiBigSetting
;
@Autowired
private
OfflineSynchDao
offlineSynchDao
;
/**
* 保存API(第三方)基本信息
*
...
...
@@ -192,4 +205,51 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
}
return
result
;
}
/**
* API计量调用次数和执行时长
*
* @author Bellamy
* @since 2021-01-20
*/
@Override
public
JsonResult
getCountAPiCallStat
()
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
countAPiCallStat
;
Map
params
=
new
HashMap
();
params
.
put
(
"date"
,
DateUtils
.
currentDate
());
String
returnData
=
HttpClientUtils
.
getJsonForParam
(
url
,
params
);
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"查询失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
map
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
(
map
.
get
(
"data"
));
}
}
if
(
map
.
containsKey
(
"message"
))
{
logger
.
info
(
map
.
get
(
"message"
).
toString
());
result
.
setMessage
(
map
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
}
return
result
;
}
/**
* 获取数据源配置——下拉框
*
* @return
* @author Bellamy
*/
@Override
public
JsonResult
querygSourceDbList
(
Integer
projectId
)
throws
Exception
{
Map
map
=
new
HashMap
();
map
.
put
(
"projectId"
,
projectId
);
//项目id
map
.
put
(
"datasource"
,
apiBigSetting
.
split
(
","
));
List
<
SourceDbNameListDto
>
list
=
offlineSynchDao
.
querygSourceDbList
(
map
);
return
JsonResult
.
ok
(
list
);
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/impl/DmpOrgMangeServiceImpl.java
View file @
40eb0b54
...
...
@@ -153,7 +153,7 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
@Override
public
JsonResult
updateOrg
(
OrganizationManageUpdateReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
update
Org
;
String
url
=
gatewayUrl
+
add
Org
;
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
returnData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
...
...
src/main/resources/mapper/dmp/OfflineSynchMapper.xml
View file @
40eb0b54
...
...
@@ -49,17 +49,16 @@
dsdt.datasource_catecode as datasourceCatecode
from dmp_syncing_datasource ds
inner join dmp_syncing_datasource_type dsdt on ds.datasource_type = dsdt.id
<if
test =
'isEnableSource != null and isEnableSource == "1"'
>
and dsdt.is_enable_source = '1'
</if>
<if
test =
"isEnableTarget != null and isEnableTarget=='1'.toString()"
>
and dsdt.is_enable_target = '1'
</if>
where ds.data_status = '1'
and ds.project_id = #{projectId}
<if
test =
'datasourceType != null and datasourceType > 0 '
>
and ds.DATASOURCE_TYPE = #{datasourceType}
<if
test =
'isEnableSource != null and isEnableSource == "1"'
>
and dsdt.is_enable_source = '1'
</if>
<if
test =
"isEnableTarget != null and isEnableTarget=='1'.toString()"
>
and dsdt.is_enable_target = '1'
</if>
where ds.data_status = '1' and ds.project_id = #{projectId}
<if
test=
"datasource != null and datasource !='' "
>
and dsdt.datasource in
<foreach
collection=
"datasource"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test =
'datasourceType != null and datasourceType > 0 '
>
and ds.DATASOURCE_TYPE = #{datasourceType}
</if>
</select>
<!--主键查询数据源-->
...
...
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