Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
PS
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBizPOC_20003
PS
提交
18ff8afd
提交
18ff8afd
编写于
4月 08, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibizdev提交
上级
1fdf033f
变更
2
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
243 行增加
和
0 行删除
+243
-0
HealthcheckDTO.java
...rc/main/java/com/ibiz/service/web/dto/HealthcheckDTO.java
+93
-0
HealthcheckResource.java
...va/com/ibiz/service/web/resource/HealthcheckResource.java
+150
-0
未找到文件。
ps-service/ps-service-web/src/main/java/com/ibiz/service/web/dto/HealthcheckDTO.java
0 → 100644
浏览文件 @
18ff8afd
package
com
.
ibiz
.
service
.
web
.
dto
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.math.BigInteger
;
import
java.util.Map
;
import
java.util.HashMap
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
com.ibiz.core.module2.valuerule.anno.healthcheck.*
;
import
com.ibiz.core.module2.domain.Healthcheck
;
import
org.springframework.cglib.beans.BeanCopier
;
import
com.fasterxml.jackson.annotation.JsonAutoDetect
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
/**
* 服务DTO对象[HealthcheckDTO]
*/
public
class
HealthcheckDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 属性 [HEALTHCHECKID]
*
*/
@HealthcheckHealthcheckidDefault
(
info
=
"默认规则"
)
private
String
healthcheckid
;
@JsonIgnore
private
boolean
healthcheckidDirtyFlag
;
/**
* 获取 [HEALTHCHECKID]
*/
@JsonProperty
(
"healthcheckid"
)
public
String
getHealthcheckid
(){
return
healthcheckid
;
}
/**
* 设置 [HEALTHCHECKID]
*/
@JsonProperty
(
"healthcheckid"
)
public
void
setHealthcheckid
(
String
healthcheckid
){
this
.
healthcheckid
=
healthcheckid
;
this
.
healthcheckidDirtyFlag
=
true
;
}
/**
* 获取 [HEALTHCHECKID]脏标记
*/
@JsonIgnore
public
boolean
getHealthcheckidDirtyFlag
(){
return
healthcheckidDirtyFlag
;
}
public
Healthcheck
toDO
()
{
Healthcheck
srfdomain
=
new
Healthcheck
();
if
(
getHealthcheckidDirtyFlag
())
srfdomain
.
setHealthcheckid
(
healthcheckid
);
return
srfdomain
;
}
public
void
fromDO
(
Healthcheck
srfdomain
)
{
if
(
srfdomain
==
null
)
return
;
if
(
srfdomain
.
getHealthcheckidDirtyFlag
())
this
.
setHealthcheckid
(
srfdomain
.
getHealthcheckid
());
}
public
List
<
HealthcheckDTO
>
fromDOPage
(
List
<
Healthcheck
>
poPage
)
{
if
(
poPage
==
null
)
return
null
;
List
<
HealthcheckDTO
>
dtos
=
new
ArrayList
<
HealthcheckDTO
>();
for
(
Healthcheck
domain
:
poPage
)
{
HealthcheckDTO
dto
=
new
HealthcheckDTO
();
dto
.
fromDO
(
domain
);
dtos
.
add
(
dto
);
}
return
dtos
;
}
}
ps-service/ps-service-web/src/main/java/com/ibiz/service/web/resource/HealthcheckResource.java
0 → 100644
浏览文件 @
18ff8afd
package
com
.
ibiz
.
service
.
web
.
resource
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.ServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.util.StringUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
com.ibiz.service.web.dto.HealthcheckDTO
;
import
com.ibiz.core.module2.domain.Healthcheck
;
import
com.ibiz.core.module2.service.IHealthcheckService
;
import
com.ibiz.util.SearchContext
;
import
com.ibiz.core.module2.filter.HealthcheckSearchContext
;
import
com.ibiz.util.log.IBIZLog
;
@Slf4j
@IBIZLog
@Api
(
tags
=
{
"Healthcheck"
})
@RestController
@RequestMapping
(
""
)
public
class
HealthcheckResource
{
@Autowired
private
IHealthcheckService
healthcheckService
;
public
IHealthcheckService
getHealthcheckService
()
{
return
this
.
healthcheckService
;
}
@ApiOperation
(
value
=
"GetDraft"
,
tags
=
{
"Healthcheck"
},
notes
=
"GetDraft"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/web/healthchecks/{healthcheck_id}/getdraft"
)
public
ResponseEntity
<
HealthcheckDTO
>
getDraft
(
@PathVariable
(
"healthcheck_id"
)
String
healthcheck_id
,
@RequestBody
HealthcheckDTO
healthcheckdto
)
{
Healthcheck
healthcheck
=
healthcheckdto
.
toDO
();
healthcheck
=
healthcheckService
.
getDraft
(
healthcheck
)
;
healthcheckdto
.
fromDO
(
healthcheck
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
healthcheckdto
);
}
@ApiOperation
(
value
=
"Remove"
,
tags
=
{
"Healthcheck"
},
notes
=
"Remove"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/web/healthchecks/{healthcheck_id}"
)
public
ResponseEntity
<
Boolean
>
remove
(
@PathVariable
(
"healthcheck_id"
)
String
healthcheck_id
)
{
HealthcheckDTO
healthcheckdto
=
new
HealthcheckDTO
();
Healthcheck
domain
=
new
Healthcheck
();
healthcheckdto
.
setHealthcheckid
(
healthcheck_id
);
domain
.
setHealthcheckid
(
healthcheck_id
);
Boolean
rst
=
healthcheckService
.
remove
(
domain
.
getHealthcheckid
());
if
(
rst
){
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
rst
);
}
else
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
rst
);
}
}
@ApiOperation
(
value
=
"CheckKey"
,
tags
=
{
"Healthcheck"
},
notes
=
"CheckKey"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/web/healthchecks/checkkey"
)
public
ResponseEntity
<
Boolean
>
checkKey
(
@RequestBody
HealthcheckDTO
healthcheckdto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@ApiOperation
(
value
=
"Update"
,
tags
=
{
"Healthcheck"
},
notes
=
"Update"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/web/healthchecks/{healthcheck_id}"
)
public
ResponseEntity
<
HealthcheckDTO
>
update
(
@PathVariable
(
"healthcheck_id"
)
String
healthcheck_id
,
@RequestBody
HealthcheckDTO
healthcheckdto
)
{
Healthcheck
domain
=
healthcheckdto
.
toDO
();
domain
.
setHealthcheckid
(
healthcheck_id
);
healthcheckService
.
update
(
domain
);
HealthcheckDTO
dto
=
new
HealthcheckDTO
();
dto
.
fromDO
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@ApiOperation
(
value
=
"Create"
,
tags
=
{
"Healthcheck"
},
notes
=
"Create"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/web/healthchecks"
)
public
ResponseEntity
<
HealthcheckDTO
>
create
(
@RequestBody
HealthcheckDTO
healthcheckdto
)
{
HealthcheckDTO
dto
=
new
HealthcheckDTO
();
Healthcheck
domain
=
healthcheckdto
.
toDO
();
healthcheckService
.
create
(
domain
);
dto
.
fromDO
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@ApiOperation
(
value
=
"test"
,
tags
=
{
"Healthcheck"
},
notes
=
"test"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/web/healthchecks/{healthcheck_id}/test"
)
public
ResponseEntity
<
HealthcheckDTO
>
test
(
@PathVariable
(
"healthcheck_id"
)
String
healthcheck_id
,
@RequestBody
HealthcheckDTO
healthcheckdto
)
{
Healthcheck
healthcheck
=
healthcheckdto
.
toDO
();
healthcheck
=
healthcheckService
.
test
(
healthcheck
)
;
healthcheckdto
.
fromDO
(
healthcheck
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
healthcheckdto
);
}
@ApiOperation
(
value
=
"Get"
,
tags
=
{
"Healthcheck"
},
notes
=
"Get"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/web/healthchecks/{healthcheck_id}"
)
public
ResponseEntity
<
HealthcheckDTO
>
get
(
@PathVariable
(
"healthcheck_id"
)
String
healthcheck_id
)
{
HealthcheckDTO
dto
=
new
HealthcheckDTO
();
Healthcheck
domain
=
healthcheckService
.
get
(
healthcheck_id
);
dto
.
fromDO
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@ApiOperation
(
value
=
"Save"
,
tags
=
{
"Healthcheck"
},
notes
=
"Save"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/web/healthchecks/{healthcheck_id}/save"
)
public
ResponseEntity
<
Boolean
>
save
(
@RequestBody
HealthcheckDTO
healthcheckdto
)
{
Healthcheck
healthcheck
=
healthcheckdto
.
toDO
();
Boolean
b
=
healthcheckService
.
save
(
healthcheck
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
b
);
}
@ApiOperation
(
value
=
"获取DEFAULT"
,
tags
=
{
"Healthcheck"
}
,
notes
=
"获取DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/web/healthchecks/fetchdefault"
)
public
ResponseEntity
<
Page
<
HealthcheckDTO
>>
fetchDefault
(
HealthcheckSearchContext
context
,
Pageable
pageable
,
ServletRequest
request
)
{
context
.
setPageable
(
pageable
);
List
<
HealthcheckDTO
>
list
=
new
ArrayList
<
HealthcheckDTO
>();
Page
<
Healthcheck
>
domains
=
healthcheckService
.
searchDefault
(
context
)
;
for
(
Healthcheck
healthcheck
:
domains
.
getContent
()){
HealthcheckDTO
dto
=
new
HealthcheckDTO
();
dto
.
fromDO
(
healthcheck
);
list
.
add
(
dto
);
}
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
new
PageImpl
(
list
,
context
.
getPageable
(),
domains
.
getTotalElements
()));
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录