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
23e98c88
Commit
23e98c88
authored
Jan 16, 2021
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
7f78a584
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
999 additions
and
599 deletions
+999
-599
JsonResult.java
src/main/java/com/jz/common/constant/JsonResult.java
+7
-0
ServiceException.java
src/main/java/com/jz/common/exception/ServiceException.java
+2
-0
HttpClientUtils.java
src/main/java/com/jz/common/utils/web/HttpClientUtils.java
+585
-595
DmpOrgMangeController.java
...modules/controller/dataService/DmpOrgMangeController.java
+107
-4
OrganizationManageAddReq.java
...controller/dataService/bean/OrganizationManageAddReq.java
+51
-0
OrganizationManageListQueryReq.java
...ller/dataService/bean/OrganizationManageListQueryReq.java
+27
-0
OrganizationManageUpdateReq.java
...troller/dataService/bean/OrganizationManageUpdateReq.java
+51
-0
DmpOrgMangeService.java
...n/java/com/jz/dmp/modules/service/DmpOrgMangeService.java
+41
-0
DmpOrgMangeServiceImpl.java
...m/jz/dmp/modules/service/impl/DmpOrgMangeServiceImpl.java
+128
-0
No files found.
src/main/java/com/jz/common/constant/JsonResult.java
View file @
23e98c88
...
...
@@ -96,6 +96,13 @@ public class JsonResult<T> implements Serializable {
return
result
;
}
public
static
JsonResult
<
Object
>
error
(
String
message
)
{
JsonResult
<
Object
>
result
=
new
JsonResult
<>();
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
message
);
return
result
;
}
public
static
JsonResult
<
Object
>
error
(
ResultCode
code
,
String
message
)
{
JsonResult
<
Object
>
result
=
new
JsonResult
<>();
result
.
setCode
(
code
);
...
...
src/main/java/com/jz/common/exception/ServiceException.java
View file @
23e98c88
package
com
.
jz
.
common
.
exception
;
import
com.jz.common.constant.ResultCode
;
public
class
ServiceException
extends
Exception
{
private
static
final
long
serialVersionUID
=
1859731705152111160L
;
...
...
src/main/java/com/jz/common/utils/web/HttpClientUtils.java
View file @
23e98c88
This diff is collapsed.
Click to expand it.
src/main/java/com/jz/dmp/modules/controller/dataService/DmpOrgMangeController.java
View file @
23e98c88
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.dataOperation.bean.DataDevTaskListDto
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageAddReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageListQueryReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageUpdateReq
;
import
com.jz.dmp.modules.service.DmpOrgMangeService
;
import
com.jz.dmp.modules.service.DvRuleTService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
/**
* 数据服务组织管理
* 数据服务组织管理
--调用gateway 接口
*
* @author Bellamy
* @since 2020-12-24 10:56:18
...
...
@@ -17,11 +29,102 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping
(
"/orgMange"
)
@Api
(
tags
=
"数据服务-组织管理"
)
public
class
DmpOrgMangeController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DmpOrgMangeController
.
class
);
/**
* 服务对象
*/
@Autowired
private
DmpOrgMangeService
dmpOrgMangeService
;
/**
* 列表分页查询
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@ApiOperation
(
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
@PostMapping
(
value
=
"/listPage"
)
public
JsonResult
getOrgListPage
(
@RequestBody
@Validated
OrganizationManageListQueryReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpOrgMangeService
.
queryOrgListPage
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 删除组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@ApiOperation
(
value
=
"删除组织"
,
notes
=
"删除组织"
)
@GetMapping
(
value
=
"/delOrg"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"组织id"
,
required
=
true
)
public
JsonResult
delOrgById
(
@RequestParam
long
id
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpOrgMangeService
.
delOrgById
(
id
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 新增组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@ApiOperation
(
value
=
"新增组织"
,
notes
=
"新增组织"
)
@PostMapping
(
value
=
"/addOrg"
)
public
JsonResult
addOrg
(
@RequestBody
@Validated
OrganizationManageAddReq
req
,
HttpServletRequest
httpRequest
)
{
if
(
StringUtils
.
isEmpty
(
req
.
getOrgName
()))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"组织名称不能为空!"
);
}
if
(
StringUtils
.
isEmpty
(
req
.
getOrgType
()))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"组织类型不能为空!"
);
}
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpOrgMangeService
.
addOrg
(
req
);
}
catch
(
Exception
e
)
{
jsonResult
.
setMessage
(
e
.
getMessage
());
jsonResult
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
e
.
printStackTrace
();
}
return
jsonResult
;
}
/**
* 编辑组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@ApiOperation
(
value
=
"编辑组织"
,
notes
=
"编辑组织"
)
@PostMapping
(
value
=
"/updateOrg"
)
public
JsonResult
updateOrg
(
@RequestBody
@Validated
OrganizationManageUpdateReq
req
,
HttpServletRequest
httpRequest
)
{
JsonResult
jsonResult
=
new
JsonResult
();
try
{
jsonResult
=
dmpOrgMangeService
.
updateOrg
(
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/bean/OrganizationManageAddReq.java
0 → 100644
View file @
23e98c88
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
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
;
/**
* @ClassName: OrganizationManageAddReq
* @Description: 新增组织管理请求体
* @Author: Bellamy
* @Date 2021/1/16
* @Version 1.0
*/
@Data
@ApiModel
(
"新增组织管理详情请求体"
)
public
class
OrganizationManageAddReq
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3131683881168540907L
;
@ApiModelProperty
(
value
=
"组织类型:INT 内部组织 OUT 外部组织"
,
required
=
true
)
@NotNull
(
message
=
"组织类型不能为空!"
)
@NotEmpty
(
message
=
"组织类型不能为空!"
)
private
String
orgType
;
@ApiModelProperty
(
value
=
"组织名称"
,
required
=
true
)
@NotNull
(
message
=
"组织名称不能为空"
)
@NotEmpty
(
message
=
"组织名称不能为空!"
)
private
String
orgName
;
@ApiModelProperty
(
value
=
"组织描述"
,
required
=
false
)
private
String
orgDesc
;
@ApiModelProperty
(
value
=
"组织英文名称"
,
required
=
false
)
private
String
orgCnName
;
@ApiModelProperty
(
value
=
"组织邮箱"
,
required
=
false
)
private
String
orgMail
;
@ApiModelProperty
(
value
=
"联系方式"
,
required
=
true
)
@NotEmpty
(
message
=
"联系方式不能为空!"
)
private
String
orgPhone
;
@ApiModelProperty
(
value
=
"状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)"
,
required
=
true
)
private
String
status
;
@ApiModelProperty
(
value
=
"联系人"
,
required
=
true
)
private
String
createUser
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/OrganizationManageListQueryReq.java
0 → 100644
View file @
23e98c88
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
com.jz.common.bean.BasePageBean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @ClassName: DmpOrgMangeService
* @Description: 组织管理列表查询请求体
* @Author: Bellamy
* @Date 2021/1/16
* @Version 1.0
*/
@Data
@ApiModel
(
"组织管理列表查询请求体"
)
public
class
OrganizationManageListQueryReq
extends
BasePageBean
implements
Serializable
{
@ApiModelProperty
(
value
=
"组织名称"
)
private
String
orgName
;
@ApiModelProperty
(
value
=
"组织编码(组织唯一标识)"
)
private
String
orgCode
;
}
src/main/java/com/jz/dmp/modules/controller/dataService/bean/OrganizationManageUpdateReq.java
0 → 100644
View file @
23e98c88
package
com
.
jz
.
dmp
.
modules
.
controller
.
dataService
.
bean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @ClassName: OrganizationManageUpdateReq
* @Description: 更新组织管理请求体
* @Author: Bellamy
* @Date 2021/1/16
* @Version 1.0
*/
@Data
@ApiModel
(
"更新组织管理请求体"
)
public
class
OrganizationManageUpdateReq
implements
Serializable
{
@ApiModelProperty
(
value
=
"组织id"
,
required
=
true
)
@NotNull
(
message
=
"组织id不能为空"
)
private
Long
id
;
/* @ApiModelProperty(value = "组织名称",required = true)
@NotNull(message = "组织名称不能为空")
private String orgName;*/
@ApiModelProperty
(
value
=
"组织描述"
,
required
=
false
)
private
String
orgDesc
;
@ApiModelProperty
(
value
=
"状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)"
,
required
=
false
)
private
String
status
;
@ApiModelProperty
(
value
=
"组织英文名称"
,
required
=
false
)
private
String
orgCnName
;
@ApiModelProperty
(
value
=
"组织邮箱"
,
required
=
false
)
private
String
orgMail
;
@ApiModelProperty
(
value
=
"组织电话"
,
required
=
false
)
private
String
orgPhone
;
@ApiModelProperty
(
value
=
"备注"
,
required
=
false
)
private
String
remark
;
@ApiModelProperty
(
value
=
"创建用户"
,
required
=
false
)
private
String
updateUser
;
}
src/main/java/com/jz/dmp/modules/service/DmpOrgMangeService.java
View file @
23e98c88
package
com
.
jz
.
dmp
.
modules
.
service
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageAddReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageListQueryReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageUpdateReq
;
/**
* @ClassName: DmpOrgMangeService
* @Description: 数据服务组织管理
...
...
@@ -8,4 +13,40 @@ package com.jz.dmp.modules.service;
* @Version 1.0
*/
public
interface
DmpOrgMangeService
{
/**
* 列表分页查询
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
JsonResult
queryOrgListPage
(
OrganizationManageListQueryReq
req
)
throws
Exception
;
/**
* 删除组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
JsonResult
delOrgById
(
long
id
)
throws
Exception
;
/**
* 新增组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
JsonResult
addOrg
(
OrganizationManageAddReq
req
)
throws
Exception
;
/**
* 编辑组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
JsonResult
updateOrg
(
OrganizationManageUpdateReq
req
)
throws
Exception
;
}
src/main/java/com/jz/dmp/modules/service/impl/DmpOrgMangeServiceImpl.java
View file @
23e98c88
package
com
.
jz
.
dmp
.
modules
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.common.utils.web.HttpClientUtils
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageAddReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageListQueryReq
;
import
com.jz.dmp.modules.controller.dataService.bean.OrganizationManageUpdateReq
;
import
com.jz.dmp.modules.service.DmpOrgMangeService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @ClassName: DmpOrgMangeServiceImpl
* @Description: 数据服务组织管理
...
...
@@ -13,5 +27,119 @@ import org.springframework.stereotype.Service;
@Service
(
"dmpOrgMangeService"
)
public
class
DmpOrgMangeServiceImpl
implements
DmpOrgMangeService
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DmpOrgMangeServiceImpl
.
class
);
//列表分页查询url
private
static
final
String
orgListPage
=
"/api/organization/listOrg"
;
//删除组织url
private
static
final
String
delOrg
=
"/api/organization/logoutOrg"
;
//新增组织url
private
static
final
String
addOrg
=
"/api/organization/add"
;
//编辑组织url
private
static
final
String
updateOrg
=
"/api/organization/update"
;
@Value
(
"${spring.gateway-url}"
)
private
String
gatewayUrl
;
/**
* 列表分页查询
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@Override
public
JsonResult
queryOrgListPage
(
OrganizationManageListQueryReq
req
)
throws
Exception
{
JsonResult
result
=
new
JsonResult
();
String
url
=
gatewayUrl
+
orgListPage
;
if
(
StringUtils
.
isNotEmpty
(
req
.
getOrgName
()))
{
req
.
setOrgName
(
req
.
getOrgName
().
trim
());
}
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
!=
null
)
{
result
.
setData
(
jsonObject
.
get
(
"data"
));
/*Map records = JSONObject.parseObject(jsonObject.get("data").toString());
List<Map> list = (List<Map>) records.get("records");*/
}
return
result
;
}
/**
* 删除组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@Override
public
JsonResult
delOrgById
(
long
id
)
throws
Exception
{
Map
params
=
new
HashMap
();
params
.
put
(
"id"
,
id
);
String
url
=
gatewayUrl
+
delOrg
;
String
returnData
=
HttpClientUtils
.
getJsonForParam
(
url
,
params
);
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"删除失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
();
}
return
JsonResult
.
error
(
"删除失败!"
);
}
/**
* 新增组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@Override
public
JsonResult
addOrg
(
OrganizationManageAddReq
req
)
throws
Exception
{
String
url
=
gatewayUrl
+
addOrg
;
String
returnData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"新增失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
();
}
logger
.
info
(
map
.
get
(
"message"
).
toString
());
return
JsonResult
.
error
(
map
.
get
(
"message"
).
toString
());
}
/**
* 编辑组织
*
* @return
* @author Bellamy
* @since 2021-01-16
*/
@Override
public
JsonResult
updateOrg
(
OrganizationManageUpdateReq
req
)
throws
Exception
{
String
url
=
gatewayUrl
+
updateOrg
;
String
returnData
=
HttpClientUtils
.
post
(
url
,
JSONObject
.
toJSONString
(
req
));
if
(
StringUtils
.
isEmpty
(
returnData
))
{
throw
new
RuntimeException
(
"编辑失败!"
);
}
logger
.
info
(
"#################响应结果{}"
+
returnData
);
Map
map
=
JSONObject
.
parseObject
(
returnData
);
if
(
"200"
.
equals
(
map
.
get
(
"code"
).
toString
()))
{
return
JsonResult
.
ok
();
}
logger
.
info
(
map
.
get
(
"message"
).
toString
());
return
JsonResult
.
error
(
map
.
get
(
"message"
).
toString
());
}
}
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