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
1c032397
Commit
1c032397
authored
Jan 20, 2021
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
e5356244
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
200 additions
and
26 deletions
+200
-26
SessionUtils.java
src/main/java/com/jz/common/utils/web/SessionUtils.java
+16
-0
DmpApiServiceMangeController.java
.../controller/dataService/DmpApiServiceMangeController.java
+42
-2
DmpOrgMangeController.java
...modules/controller/dataService/DmpOrgMangeController.java
+1
-1
ApiInterfaceReq.java
.../modules/controller/dataService/bean/ApiInterfaceReq.java
+2
-2
MakeBigDataApiReq.java
...odules/controller/dataService/bean/MakeBigDataApiReq.java
+3
-1
OrganizationManageAddReq.java
...controller/dataService/bean/OrganizationManageAddReq.java
+7
-4
OrganizationManageListQueryReq.java
...ller/dataService/bean/OrganizationManageListQueryReq.java
+3
-0
OrganizationManageUpdateReq.java
...troller/dataService/bean/OrganizationManageUpdateReq.java
+20
-13
DmpApiServiceMangeService.java
...com/jz/dmp/modules/service/DmpApiServiceMangeService.java
+16
-0
DmpApiServiceMangeServiceImpl.java
...p/modules/service/impl/DmpApiServiceMangeServiceImpl.java
+85
-3
DmpOrgMangeServiceImpl.java
...m/jz/dmp/modules/service/impl/DmpOrgMangeServiceImpl.java
+5
-0
No files found.
src/main/java/com/jz/common/utils/web/SessionUtils.java
View file @
1c032397
...
...
@@ -110,6 +110,7 @@ public class SessionUtils {
/**
* @Title: getSessionUserId
* @Description: 获取登录用户ID
* @Author: Bellamy
* @return String 返回类型
*/
public
static
String
getCurrentUserId
(){
...
...
@@ -121,6 +122,21 @@ public class SessionUtils {
return
userId
;
}
/**
* @Title: getCurrentUserName
* @Description: 获取登录用户名称
* @Author: Bellamy
* @return String 返回类型
*/
public
static
String
getCurrentUserName
(){
String
userName
=
""
;
DmpMember
user
=
getSecurityUser
();
if
(
user
!=
null
){
userName
=
user
.
getUserName
();
}
return
userName
;
}
/**
* @Title: getAuthentication
* @Description: TODO(获取authentication)
...
...
src/main/java/com/jz/dmp/modules/controller/dataService/DmpApiServiceMangeController.java
View file @
1c032397
...
...
@@ -45,7 +45,7 @@ public class DmpApiServiceMangeController {
*/
@ApiOperation
(
value
=
"保存API(第三方)"
,
notes
=
"保存API(第三方)"
)
@PostMapping
(
value
=
"/saveApi"
)
public
JsonResult
saveApiInfo
(
@RequestBody
ApiInterfaceReq
req
,
HttpServletRequest
httpRequest
)
{
public
JsonResult
saveApiInfo
(
@RequestBody
@Validated
ApiInterfaceReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiServiceMangeService
.
saveApiInfo
(
req
);
...
...
@@ -65,7 +65,7 @@ public class DmpApiServiceMangeController {
*/
@ApiOperation
(
value
=
"保存API(大数据查询/标签查询)"
,
notes
=
"保存API(大数据查询/标签查询)"
)
@PostMapping
(
value
=
"/saveApiBigData"
)
public
JsonResult
saveApiBigDataInfo
(
@RequestBody
MakeBigDataApiReq
req
,
HttpServletRequest
httpRequest
)
{
public
JsonResult
saveApiBigDataInfo
(
@RequestBody
@Validated
MakeBigDataApiReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiServiceMangeService
.
saveApiBigDataInfo
(
req
);
...
...
@@ -77,4 +77,44 @@ public class DmpApiServiceMangeController {
return
jsonResult
;
}
/**
* 编辑API(第三方)基本信息
*
* @author Bellamy
* @since 2021-01-20
*/
@ApiOperation
(
value
=
"编辑API(第三方)"
,
notes
=
"编辑API(第三方)"
)
@PostMapping
(
value
=
"/updataApi"
)
public
JsonResult
updateApiInfo
(
@RequestBody
@Validated
ApiInterfaceReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiServiceMangeService
.
updateApiInfo
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 编辑API(大数据查询/标签查询)
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation
(
value
=
"编辑API(大数据查询/标签查询)"
,
notes
=
"编辑API(大数据查询/标签查询)"
)
@PostMapping
(
value
=
"/updateApiBigData"
)
public
JsonResult
updateApiBigDataInfo
(
@RequestBody
@Validated
MakeBigDataApiReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpApiServiceMangeService
.
updateApiBigDataInfo
(
req
);
}
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/DmpOrgMangeController.java
View file @
1c032397
...
...
@@ -135,7 +135,7 @@ public class DmpOrgMangeController {
* @since 2021-01-18
*/
@ApiOperation
(
value
=
"根据组织id获取组织详情"
,
notes
=
"根据组织id获取组织详情"
)
@
Pos
tMapping
(
value
=
"/orgInfo"
)
@
Ge
tMapping
(
value
=
"/orgInfo"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"组织id"
,
required
=
true
)
public
JsonResult
getOrgInfoByOrgId
(
@RequestParam
String
id
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
...
...
src/main/java/com/jz/dmp/modules/controller/dataService/bean/ApiInterfaceReq.java
View file @
1c032397
...
...
@@ -62,13 +62,13 @@ public class ApiInterfaceReq implements Serializable {
@NotNull
(
message
=
"项目id不能为空"
)
public
Long
projectId
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
false
)
public
String
status
;
@ApiModelProperty
(
value
=
"更新时传入api自增id"
,
required
=
false
)
public
Long
id
;
@ApiModelProperty
(
value
=
"创建用户"
,
hidden
=
true
)
@ApiModelProperty
(
value
=
"创建用户"
)
public
String
createUser
;
@ApiModelProperty
(
value
=
"api类型:1.数据银行制作大数据表 "
+
...
...
src/main/java/com/jz/dmp/modules/controller/dataService/bean/MakeBigDataApiReq.java
View file @
1c032397
...
...
@@ -6,6 +6,8 @@ import lombok.Data;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.Map
;
/**
* @ClassName: MakeBigDataApiReq
...
...
@@ -104,7 +106,7 @@ public class MakeBigDataApiReq implements Serializable {
@ApiModelProperty
(
value
=
"段列表"
,
required
=
true
)
@NotNull
(
message
=
"字段列表不能为空"
)
private
String
tableFields
;
private
List
<
Map
>
tableFields
;
@ApiModelProperty
(
value
=
"创建用户"
,
required
=
false
)
public
String
createUser
;
...
...
src/main/java/com/jz/dmp/modules/controller/dataService/bean/OrganizationManageAddReq.java
View file @
1c032397
...
...
@@ -30,22 +30,25 @@ public class OrganizationManageAddReq implements Serializable {
@NotEmpty
(
message
=
"组织名称不能为空!"
)
private
String
orgName
;
@ApiModelProperty
(
value
=
"组织描述"
,
required
=
false
)
@ApiModelProperty
(
value
=
"组织描述"
)
private
String
orgDesc
;
@ApiModelProperty
(
value
=
"组织英文名称"
,
required
=
false
)
@ApiModelProperty
(
value
=
"组织英文名称"
)
private
String
orgCnName
;
@ApiModelProperty
(
value
=
"组织邮箱"
,
required
=
false
)
@ApiModelProperty
(
value
=
"组织邮箱"
)
private
String
orgMail
;
@ApiModelProperty
(
value
=
"联系方式"
,
required
=
true
)
@NotEmpty
(
message
=
"联系方式不能为空!"
)
private
String
orgPhone
;
@ApiModelProperty
(
value
=
"联系人"
)
private
String
linkman
;
@ApiModelProperty
(
value
=
"状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)"
,
required
=
true
)
private
String
status
;
@ApiModelProperty
(
value
=
"
联系人"
,
required
=
true
)
@ApiModelProperty
(
value
=
"
创建人"
)
private
String
createUser
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/OrganizationManageListQueryReq.java
View file @
1c032397
...
...
@@ -24,4 +24,7 @@ public class OrganizationManageListQueryReq extends BasePageBean implements Seri
@ApiModelProperty
(
value
=
"组织编码(组织唯一标识)"
)
private
String
orgCode
;
@ApiModelProperty
(
value
=
"联系人"
)
private
String
linkman
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/OrganizationManageUpdateReq.java
View file @
1c032397
...
...
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
...
...
@@ -22,30 +23,36 @@ public class OrganizationManageUpdateReq implements Serializable {
@NotNull
(
message
=
"组织id不能为空"
)
private
Long
id
;
/* @ApiModelProperty(value = "组织名称",required = true)
@ApiModelProperty
(
value
=
"组织类型:INT 内部组织 OUT 外部组织"
,
required
=
true
)
@NotNull
(
message
=
"组织类型不能为空!"
)
@NotEmpty
(
message
=
"组织类型不能为空!"
)
private
String
orgType
;
@ApiModelProperty
(
value
=
"组织名称"
,
required
=
true
)
@NotNull
(
message
=
"组织名称不能为空"
)
private String orgName;*/
@NotEmpty
(
message
=
"组织名称不能为空!"
)
private
String
orgName
;
@ApiModelProperty
(
value
=
"组织描述"
,
required
=
false
)
@ApiModelProperty
(
value
=
"组织描述"
)
private
String
orgDesc
;
@ApiModelProperty
(
value
=
"状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)"
,
required
=
false
)
private
String
status
;
@ApiModelProperty
(
value
=
"组织英文名称"
,
required
=
false
)
@ApiModelProperty
(
value
=
"组织英文名称"
)
private
String
orgCnName
;
@ApiModelProperty
(
value
=
"组织邮箱"
,
required
=
false
)
@ApiModelProperty
(
value
=
"组织邮箱"
)
private
String
orgMail
;
@ApiModelProperty
(
value
=
"组织电话"
,
required
=
false
)
@ApiModelProperty
(
value
=
"联系方式"
,
required
=
true
)
@NotEmpty
(
message
=
"联系方式不能为空!"
)
private
String
orgPhone
;
@ApiModelProperty
(
value
=
"
备注"
,
required
=
false
)
private
String
remark
;
@ApiModelProperty
(
value
=
"
联系人"
)
private
String
linkman
;
@ApiModelProperty
(
value
=
"
创建用户"
,
required
=
fals
e
)
private
String
updateUser
;
@ApiModelProperty
(
value
=
"
状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)"
,
required
=
tru
e
)
private
String
status
;
@ApiModelProperty
(
value
=
"创建人"
)
private
String
createUser
;
}
src/main/java/com/jz/dmp/modules/service/DmpApiServiceMangeService.java
View file @
1c032397
...
...
@@ -30,4 +30,20 @@ public interface DmpApiServiceMangeService {
* @since 2021-01-19
*/
JsonResult
saveApiBigDataInfo
(
MakeBigDataApiReq
req
)
throws
Exception
;
/**
* 编辑API(第三方)基本信息
*
* @author Bellamy
* @since 2021-01-20
*/
JsonResult
updateApiInfo
(
ApiInterfaceReq
req
)
throws
Exception
;
/**
* 编辑API(大数据查询/标签查询)
*
* @author Bellamy
* @since 2021-01-20
*/
JsonResult
updateApiBigDataInfo
(
MakeBigDataApiReq
req
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/impl/DmpApiServiceMangeServiceImpl.java
View file @
1c032397
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.utils.web.HttpClientUtils
;
import
com.jz.common.utils.web.SessionUtils
;
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
;
...
...
@@ -39,6 +40,9 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
//保存API(大数据查询/标签查询)url
private
static
final
String
addApiBigData
=
"/api/producer/makeBigDataApi"
;
//编辑API(第三方)基本信息url
private
static
final
String
updateApiInfo
=
"/api/producer/saveUpdate"
;
@Value
(
"${spring.gateway-url}"
)
private
String
gatewayUrl
;
...
...
@@ -52,6 +56,8 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
public
JsonResult
saveApiInfo
(
ApiInterfaceReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
addApiInfo
;
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"保存失败!"
);
...
...
@@ -82,18 +88,94 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
*/
@Override
public
JsonResult
saveApiBigDataInfo
(
MakeBigDataApiReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
ApiInterfaceReq
baseInfo
=
new
ApiInterfaceReq
();
BeanUtils
.
copyProperties
(
req
,
baseInfo
);
//保存API基本信息
JsonResult
apiKeyData
=
saveApiInfo
(
baseInfo
);
String
apiKey
=
apiKeyData
.
getData
().
toString
();
if
(
StringUtils
.
isNotEmpty
(
apiKey
))
{
logger
.
info
(
"######apiKey="
+
apiKey
);
req
.
setApiKey
(
apiKey
);
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
url
=
gatewayUrl
+
addApiBigData
;
//保存API(大数据查询/标签查询)
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"保存失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
return
result
;
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
}
}
return
result
;
}
/**
* 编辑API(第三方)基本信息
*
* @author Bellamy
* @since 2021-01-20
*/
@Override
public
JsonResult
updateApiInfo
(
ApiInterfaceReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
req
.
setApiKey
(
apiKey
);
String
url
=
gatewayUrl
+
addApiBigData
;
//保存API(大数据查询/标签查询)
String
url
=
gatewayUrl
+
updateApiInfo
;
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"保存失败!"
);
throw
new
RuntimeException
(
"编辑失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
Map
jsonObject
=
JSONObject
.
parseObject
(
resultData
);
if
(
jsonObject
.
containsKey
(
"code"
))
{
if
(
"200"
.
equals
(
jsonObject
.
get
(
"code"
).
toString
()))
{
return
result
;
}
}
if
(
jsonObject
.
containsKey
(
"message"
))
{
logger
.
info
(
jsonObject
.
get
(
"message"
).
toString
());
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
jsonObject
.
get
(
"message"
).
toString
());
}
return
result
;
}
/**
* 编辑API(大数据查询/标签查询)
*
* @author Bellamy
* @since 2021-01-20
*/
@Override
public
JsonResult
updateApiBigDataInfo
(
MakeBigDataApiReq
req
)
throws
Exception
{
ApiInterfaceReq
baseApi
=
new
ApiInterfaceReq
();
BeanUtils
.
copyProperties
(
req
,
baseApi
);
//编辑API基本信息
JsonResult
baseRes
=
updateApiInfo
(
baseApi
);
if
(!
"200"
.
equals
(
baseRes
.
getCode
()))
{
throw
new
RuntimeException
(
baseRes
.
getMessage
());
}
//编辑API(大数据查询/标签查询)
JsonResult
result
=
new
JsonResult
();
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
url
=
gatewayUrl
+
addApiBigData
;
String
resultData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
resultData
))
{
throw
new
RuntimeException
(
"编辑失败!"
);
}
logger
.
info
(
"#################响应结果数据{}"
+
resultData
);
...
...
src/main/java/com/jz/dmp/modules/service/impl/DmpOrgMangeServiceImpl.java
View file @
1c032397
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jcraft.jsch.Session
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.utils.web.HttpClientUtils
;
import
com.jz.common.utils.web.SessionUtils
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageAddReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageDetailQueryReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageListQueryReq
;
...
...
@@ -120,6 +122,7 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
public
JsonResult
addOrg
(
OrganizationManageAddReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
addOrg
;
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
returnData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"新增失败!"
);
...
...
@@ -151,6 +154,8 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
public
JsonResult
updateOrg
(
OrganizationManageUpdateReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
updateOrg
;
req
.
setCreateUser
(
SessionUtils
.
getCurrentUserName
());
String
returnData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"编辑失败!"
);
...
...
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