Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
chejia-smart-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 70a1b2a6
authored
Mar 18, 2021
by
tyfanchz
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
2 parents
84f6e541
33a0049d
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
518 additions
and
37 deletions
src/main/java/com/glsx/admin/controller/BaseController.java
src/main/java/com/glsx/admin/controller/IndexController.java
src/main/java/com/glsx/admin/controller/SceneTemplateController.java
src/main/java/com/glsx/admin/exception/BusinessException.java
src/main/java/com/glsx/admin/pojo/BaseDTO.java
src/main/java/com/glsx/admin/pojo/GroupA.java
src/main/java/com/glsx/admin/pojo/request/ProductReq.java
src/main/java/com/glsx/admin/pojo/request/SmartSceneTemplateReq.java → src/main/java/com/glsx/admin/pojo/request/SceneTemplateReq.java
src/main/java/com/glsx/admin/pojo/request/SmartTemplateParamReq.java → src/main/java/com/glsx/admin/pojo/request/TemplateParamReq.java
src/main/java/com/glsx/admin/pojo/response/SceneTemplateResp.java
src/main/java/com/glsx/admin/pojo/response/TemplateParamResp.java
src/main/java/com/glsx/admin/remote/IndexFeignClient.java
src/main/java/com/glsx/admin/remote/SceneTemplateFeignClient.java
src/main/java/com/glsx/admin/remote/impl/IndexHystrix.java
src/main/resources/application.properties
src/main/java/com/glsx/admin/controller/BaseController.java
0 → 100644
View file @
70a1b2a
package
com
.
glsx
.
admin
.
controller
;
import
com.glsx.admin.exception.BusinessException
;
import
com.glsx.admin.exception.ResultEnum
;
import
com.glsx.plat.common.utils.StringUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.FieldError
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author think.wang
* @version 1.0.0
* @Title BaseController
* @Package com.glsx.admin.controller
* @Description controller基类
* @date 2021/3/17
*/
@Slf4j
public
class
BaseController
{
/**
* hibernate-validator参数校验返回错误方法
*
* @param result
* @return
*/
public
Map
<
String
,
String
>
getErrors
(
BindingResult
result
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
List
<
FieldError
>
list
=
result
.
getFieldErrors
();
for
(
FieldError
error
:
list
)
{
map
.
put
(
error
.
getField
(),
error
.
getDefaultMessage
());
}
return
map
;
}
/**
* 将请求参数进行校验,校验不成功则抛出 {@link BusinessException} 异常
*
* @param bindingResult Spring校验结果
*/
protected
void
checkRequestParam
(
BindingResult
bindingResult
)
{
if
(
bindingResult
.
hasErrors
())
{
Map
<
String
,
String
>
errorMap
=
this
.
getErrors
(
bindingResult
);
Collection
<
String
>
values
=
errorMap
.
values
();
String
errorMsg
=
StringUtils
.
join
(
values
,
";"
);
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_ERROR
.
getCode
(),
errorMsg
);
}
}
}
src/main/java/com/glsx/admin/controller/IndexController.java
View file @
70a1b2a
package
com
.
glsx
.
admin
.
controller
;
package
com
.
glsx
.
admin
.
controller
;
import
com.glsx.admin.pojo.request.ProductReq
;
import
com.glsx.admin.remote.IndexFeignClient
;
import
com.glsx.admin.remote.IndexFeignClient
;
import
com.glsx.biz.user.common.entity.User
;
import
com.glsx.biz.user.common.entity.User
;
import
com.glsx.biz.user.service.UserService
;
import
com.glsx.biz.user.service.UserService
;
...
@@ -7,9 +8,7 @@ import com.glsx.cloudframework.exception.ServiceException;
...
@@ -7,9 +8,7 @@ import com.glsx.cloudframework.exception.ServiceException;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
/**
/**
* @Title: IndexController.java
* @Title: IndexController.java
...
@@ -29,7 +28,7 @@ public class IndexController {
...
@@ -29,7 +28,7 @@ public class IndexController {
private
UserService
userService
;
private
UserService
userService
;
@ResponseBody
@ResponseBody
@RequestMapping
(
"home"
)
@RequestMapping
(
"
/
home"
)
public
R
home
(){
public
R
home
(){
try
{
try
{
User
user
=
userService
.
getByUserId
(
92001768
);
//dubbo服务调用
User
user
=
userService
.
getByUserId
(
92001768
);
//dubbo服务调用
...
@@ -40,4 +39,13 @@ public class IndexController {
...
@@ -40,4 +39,13 @@ public class IndexController {
return
R
.
ok
().
data
(
indexFeignClient
.
getHome
());
//feign调用远程服务
return
R
.
ok
().
data
(
indexFeignClient
.
getHome
());
//feign调用远程服务
}
}
@ResponseBody
@RequestMapping
(
value
=
"/getProduct"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
R
getProduct
(
@RequestParam
(
"url"
)
String
url
,
@RequestParam
(
"name"
)
String
name
){
ProductReq
product
=
new
ProductReq
();
product
.
setIconUrl
(
url
);
product
.
setProductName
(
name
);
return
R
.
ok
().
data
(
indexFeignClient
.
getProduct
(
product
));
//feign调用远程服务
}
}
}
src/main/java/com/glsx/admin/controller/SceneTemplateController.java
0 → 100644
View file @
70a1b2a
package
com
.
glsx
.
admin
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.glsx.admin.pojo.GroupA
;
import
com.glsx.admin.pojo.request.SceneTemplateReq
;
import
com.glsx.admin.remote.SceneTemplateFeignClient
;
import
com.glsx.plat.core.web.R
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.groups.Default
;
import
java.util.Date
;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
@Slf4j
@RestController
@RequestMapping
(
"/sceneTemplate"
)
public
class
SceneTemplateController
extends
BaseController
{
@Autowired
private
SceneTemplateFeignClient
templateFeignClient
;
@RequestMapping
(
value
=
"/getList"
,
method
=
{
RequestMethod
.
POST
})
public
R
getList
(
@RequestBody
SceneTemplateReq
sceneTemplate
)
{
log
.
info
(
"/sceneTemplate/getList param: {}"
,
JSON
.
toJSONString
(
sceneTemplate
));
return
R
.
ok
().
data
(
templateFeignClient
.
getPageList
(
sceneTemplate
));
}
@RequestMapping
(
value
=
"/getById"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
R
getById
(
@RequestBody
@Validated
(
value
=
Default
.
class
)
SceneTemplateReq
sceneTemplate
,
BindingResult
result
)
{
this
.
checkRequestParam
(
result
);
Long
id
=
sceneTemplate
.
getId
();
log
.
info
(
"/sceneTemplate/getById param: {}"
,
id
);
return
R
.
ok
().
data
(
templateFeignClient
.
getById
(
id
));
}
@RequestMapping
(
value
=
"/save"
,
method
=
{
RequestMethod
.
POST
})
public
R
save
(
@RequestBody
@Validated
(
value
=
GroupA
.
class
)
SceneTemplateReq
sceneTemplate
,
BindingResult
result
)
{
log
.
info
(
"新增调用/sceneTemplate/save param: {}"
,
JSON
.
toJSONString
(
sceneTemplate
));
this
.
checkRequestParam
(
result
);
Long
id
=
sceneTemplate
.
getId
();
Date
now
=
new
Date
();
if
(
id
==
null
||
id
<=
0
){
//新增
sceneTemplate
.
setCreateTime
(
now
);
sceneTemplate
.
setUpdateBy
(-
1L
);
templateFeignClient
.
add
(
sceneTemplate
);
}
else
{
sceneTemplate
.
setUpdateTime
(
now
);
sceneTemplate
.
setUpdateBy
(-
1L
);
templateFeignClient
.
update
(
sceneTemplate
);
}
return
R
.
ok
();
}
@RequestMapping
(
value
=
"/updateStatus"
,
method
=
{
RequestMethod
.
POST
})
public
R
update
(
@RequestBody
@Validated
(
value
=
Default
.
class
)
SceneTemplateReq
sceneTemplate
,
BindingResult
result
)
{
this
.
checkRequestParam
(
result
);
log
.
info
(
"更新调用/sceneTemplate/updateStatus param: {}"
,
JSON
.
toJSONString
(
sceneTemplate
));
Date
now
=
new
Date
();
sceneTemplate
.
setUpdateTime
(
now
);
sceneTemplate
.
setUpdateBy
(-
1L
);
templateFeignClient
.
updateParam
(
sceneTemplate
);
return
R
.
ok
();
}
}
src/main/java/com/glsx/admin/exception/BusinessException.java
View file @
70a1b2a
...
@@ -34,4 +34,15 @@ public class BusinessException extends RuntimeException {
...
@@ -34,4 +34,15 @@ public class BusinessException extends RuntimeException {
public
void
setMessage
(
String
message
)
{
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
this
.
message
=
message
;
}
}
public
static
BusinessException
create
(
int
code
,
String
message
){
BusinessException
businessException
=
new
BusinessException
();
businessException
.
code
=
code
;
businessException
.
message
=
message
;
return
businessException
;
}
public
static
BusinessException
create
(
ResultEnum
resultEnum
)
{
return
create
(
resultEnum
.
getCode
(),
resultEnum
.
getMessage
());
}
}
}
src/main/java/com/glsx/admin/pojo/BaseDTO.java
View file @
70a1b2a
...
@@ -40,11 +40,6 @@ public class BaseDTO {
...
@@ -40,11 +40,6 @@ public class BaseDTO {
*/
*/
private
String
endTime
;
private
String
endTime
;
/**
* 用户id
*/
private
Long
uid
;
public
int
getPageIndex
()
{
public
int
getPageIndex
()
{
return
pageIndex
;
return
pageIndex
;
}
}
...
@@ -69,14 +64,6 @@ public class BaseDTO {
...
@@ -69,14 +64,6 @@ public class BaseDTO {
this
.
searchKey
=
searchKey
;
this
.
searchKey
=
searchKey
;
}
}
public
Long
getUid
()
{
return
uid
;
}
public
void
setUid
(
Long
uid
)
{
this
.
uid
=
uid
;
}
public
String
getOrderBy
()
{
public
String
getOrderBy
()
{
return
orderBy
;
return
orderBy
;
}
}
...
...
src/main/java/com/glsx/admin/pojo/GroupA.java
0 → 100644
View file @
70a1b2a
package
com
.
glsx
.
admin
.
pojo
;
/**
* @author think.wang
* @version 1.0.0
* @Title GroupA
* @Package com.glsx.admin.pojo
* @Description Hibernate-validator的分组
* @date 2021/3/8
*/
public
interface
GroupA
{
}
src/main/java/com/glsx/admin/pojo/request/ProductReq.java
0 → 100644
View file @
70a1b2a
package
com
.
glsx
.
admin
.
pojo
.
request
;
import
lombok.Data
;
import
java.util.Date
;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
/**
* 车家智能产品数据表
*/
@Data
public
class
ProductReq
{
/**
* 图标 url
*/
private
String
iconUrl
;
/**
* 产品类型名称
*/
private
String
typeName
;
/**
* 接入平台名称
*/
private
String
platformName
;
/**
* 配网模式名称
*/
private
String
networkName
;
/**
* 标识ID
*/
private
Long
id
;
/**
* 产品名称
*/
private
String
productName
;
/**
* 图片ID 关联smart_sys_file中id
*/
private
Long
icon
;
/**
* 产品类型ID 关联smart_product_type中id
*/
private
Long
typeId
;
/**
* 商城产品id
*/
private
String
shopProductId
;
/**
* 接入平台key 关联smart_sys_code中dict_key
*/
private
String
platformKey
;
/**
* 接入平台产品id
*/
private
String
platformProductId
;
/**
* 配网方式key 关联smart_sys_code中dict_key
*/
private
String
networkKey
;
/**
* 状态:0下线 1上线
*/
private
Byte
status
;
/**
* 备注
*/
private
String
remark
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 创建人
*/
private
Long
createBy
;
/**
* 更新时间
*/
private
Date
updateTime
;
/**
* 更新人
*/
private
Long
updateBy
;
}
src/main/java/com/glsx/admin/pojo/request/S
martS
ceneTemplateReq.java
→
src/main/java/com/glsx/admin/pojo/request/SceneTemplateReq.java
View file @
70a1b2a
package
com
.
glsx
.
admin
.
pojo
.
request
;
package
com
.
glsx
.
admin
.
pojo
.
request
;
import
javax.persistence.GeneratedValue
;
import
com.glsx.admin.pojo.BaseDTO
;
import
javax.persistence.GenerationType
;
import
com.glsx.admin.pojo.GroupA
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.util.Date
;
import
lombok.Data
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.groups.Default
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* <p>Description:
* <p>Description:
* <p>Project: chejia-smart
* <p>Project: chejia-smart
...
@@ -20,33 +23,36 @@ import lombok.Data;
...
@@ -20,33 +23,36 @@ import lombok.Data;
* 车家智能场景模板表
* 车家智能场景模板表
*/
*/
@Data
@Data
@Table
(
name
=
"smart_scene_template"
)
public
class
SceneTemplateReq
extends
BaseDTO
{
public
class
SmartSceneTemplateReq
{
/**
/**
* 标识ID
* 标识ID
*/
*/
@Id
@NotNull
(
message
=
"id不能为空"
,
groups
=
{
Default
.
class
})
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
private
Long
id
;
/**
/**
* 场景名称
* 场景名称
*/
*/
@NotEmpty
(
message
=
"sceneName不能为空"
,
groups
=
{
GroupA
.
class
})
private
String
sceneName
;
private
String
sceneName
;
/**
/**
* 场景类型key 关联smart_sys_code中dict_key
* 场景类型key 关联smart_sys_code中dict_key
*/
*/
@NotEmpty
(
message
=
"typeKey不能为空"
,
groups
=
{
GroupA
.
class
})
private
String
typeKey
;
private
String
typeKey
;
/**
/**
* 场景图标ID 关联smart_sys_file中id
* 场景图标ID 关联smart_sys_file中id
*/
*/
@NotNull
(
message
=
"icon不能为空"
,
groups
=
{
GroupA
.
class
})
private
Long
icon
;
private
Long
icon
;
/**
/**
* 场景背景图ID 关联smart_sys_file中id
* 场景背景图ID 关联smart_sys_file中id
*/
*/
@NotNull
(
message
=
"backPic不能为空"
,
groups
=
{
GroupA
.
class
})
private
Long
backPic
;
private
Long
backPic
;
/**
/**
...
@@ -98,4 +104,9 @@ public class SmartSceneTemplateReq {
...
@@ -98,4 +104,9 @@ public class SmartSceneTemplateReq {
* 更新人
* 更新人
*/
*/
private
Long
updateBy
;
private
Long
updateBy
;
/**
* 模板list
*/
private
List
<
TemplateParamReq
>
templateList
;
}
}
src/main/java/com/glsx/admin/pojo/request/
Smart
TemplateParamReq.java
→
src/main/java/com/glsx/admin/pojo/request/TemplateParamReq.java
View file @
70a1b2a
...
@@ -9,23 +9,16 @@ package com.glsx.admin.pojo.request;
...
@@ -9,23 +9,16 @@ package com.glsx.admin.pojo.request;
*/
*/
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
lombok.Data
;
import
lombok.Data
;
/**
/**
* 车家智能场景模板参数表
* 车家智能场景模板参数表
*/
*/
@Data
@Data
@Table
(
name
=
"smart_template_param"
)
public
class
TemplateParamReq
{
public
class
SmartTemplateParamReq
{
/**
/**
* 标识ID
* 标识ID
*/
*/
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
private
Long
id
;
/**
/**
...
...
src/main/java/com/glsx/admin/pojo/response/SceneTemplateResp.java
0 → 100644
View file @
70a1b2a
package
com
.
glsx
.
admin
.
pojo
.
response
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
/**
* 车家智能场景模板表
*/
@Data
public
class
SceneTemplateResp
{
/**
* 标识ID
*/
private
Long
id
;
/**
* 场景名称
*/
private
String
sceneName
;
/**
* 场景类型key 关联smart_sys_code中dict_key
*/
private
String
typeKey
;
/**
* 场景图标ID 关联smart_sys_file中id
*/
private
Long
icon
;
/**
* 场景图标
*/
private
String
iconUrl
;
/**
* 场景背景图ID 关联smart_sys_file中id
*/
private
Long
backPic
;
/**
* 场景背景图
*/
private
String
backPicUrl
;
/**
* 查看次数
*/
private
Long
viewTimes
;
/**
* 场景描述
*/
private
String
description
;
/**
* 条件规则 1任一条件 2全部条件
*/
private
Byte
conditionRule
;
/**
* 执行周期 1每天 2工作日 3法定节假日
*/
private
Byte
executeCycle
;
/**
* 状态:0下线 1上线
*/
private
Byte
status
;
/**
* 备注
*/
private
String
remark
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 创建人
*/
private
Long
createBy
;
/**
* 更新时间
*/
private
Date
updateTime
;
/**
* 更新人
*/
private
Long
updateBy
;
/**
* 模板list
*/
private
List
<
TemplateParamResp
>
templateList
;
}
src/main/java/com/glsx/admin/pojo/response/TemplateParamResp.java
0 → 100644
View file @
70a1b2a
package
com
.
glsx
.
admin
.
pojo
.
response
;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
import
lombok.Data
;
/**
* 车家智能场景模板参数表
*/
@Data
public
class
TemplateParamResp
{
/**
* 标识ID
*/
private
Long
id
;
/**
* 模板ID 关联smart_scene_template中id
*/
private
Long
templateId
;
/**
* 类型 1触发条件 2执行内容
*/
private
Byte
type
;
/**
* 排序
*/
private
Byte
sort
;
/**
* 参数key
*/
private
String
paramKey
;
/**
* 模板值 数组对象
*/
private
String
paramValue
;
}
src/main/java/com/glsx/admin/remote/IndexFeignClient.java
View file @
70a1b2a
package
com
.
glsx
.
admin
.
remote
;
package
com
.
glsx
.
admin
.
remote
;
import
com.glsx.admin.pojo.request.ProductReq
;
import
com.glsx.admin.remote.impl.IndexHystrix
;
import
com.glsx.admin.remote.impl.IndexHystrix
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
...
@@ -13,4 +15,8 @@ public interface IndexFeignClient {
...
@@ -13,4 +15,8 @@ public interface IndexFeignClient {
@RequestMapping
(
value
=
"/home"
,
method
=
{
RequestMethod
.
GET
})
@RequestMapping
(
value
=
"/home"
,
method
=
{
RequestMethod
.
GET
})
String
getHome
();
String
getHome
();
@ResponseBody
@RequestMapping
(
value
=
"/getProduct"
,
method
=
{
RequestMethod
.
GET
})
String
getProduct
(
@RequestBody
ProductReq
product
);
}
}
src/main/java/com/glsx/admin/remote/SceneTemplateFeignClient.java
0 → 100644
View file @
70a1b2a
package
com
.
glsx
.
admin
.
remote
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.admin.pojo.request.SceneTemplateReq
;
import
com.glsx.admin.pojo.response.SceneTemplateResp
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.SpringQueryMap
;
import
org.springframework.web.bind.annotation.*
;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author think.wang
* @date 2021-03-16
*/
@FeignClient
(
name
=
"${feign.server.name}"
,
url
=
"${feign.server.url}"
)
public
interface
SceneTemplateFeignClient
{
@ResponseBody
@RequestMapping
(
value
=
"/sceneTemplate/getPageList"
,
method
=
{
RequestMethod
.
GET
})
PageInfo
<
SceneTemplateResp
>
getPageList
(
@SpringQueryMap
SceneTemplateReq
req
);
@ResponseBody
@RequestMapping
(
value
=
"/sceneTemplate/getById"
,
method
=
{
RequestMethod
.
GET
})
SceneTemplateResp
getById
(
@RequestParam
Long
id
);
@ResponseBody
@RequestMapping
(
value
=
"/sceneTemplate/add"
,
method
=
{
RequestMethod
.
POST
})
boolean
add
(
@RequestBody
SceneTemplateReq
req
);
@ResponseBody
@RequestMapping
(
value
=
"/sceneTemplate/update"
,
method
=
{
RequestMethod
.
POST
})
boolean
update
(
@RequestBody
SceneTemplateReq
req
);
@ResponseBody
@RequestMapping
(
value
=
"/sceneTemplate/updateParam"
,
method
=
{
RequestMethod
.
POST
})
boolean
updateParam
(
@RequestBody
SceneTemplateReq
req
);
}
src/main/java/com/glsx/admin/remote/impl/IndexHystrix.java
View file @
70a1b2a
package
com
.
glsx
.
admin
.
remote
.
impl
;
package
com
.
glsx
.
admin
.
remote
.
impl
;
import
com.glsx.admin.pojo.request.ProductReq
;
import
com.glsx.admin.remote.IndexFeignClient
;
import
com.glsx.admin.remote.IndexFeignClient
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -21,4 +22,9 @@ public class IndexHystrix implements IndexFeignClient {
...
@@ -21,4 +22,9 @@ public class IndexHystrix implements IndexFeignClient {
log
.
error
(
"请求getHome()异常"
);
log
.
error
(
"请求getHome()异常"
);
return
"服务请求异常"
;
return
"服务请求异常"
;
}
}
@Override
public
String
getProduct
(
ProductReq
product
)
{
return
"服务请求异常"
;
}
}
}
src/main/resources/application.properties
View file @
70a1b2a
...
@@ -2,9 +2,6 @@
...
@@ -2,9 +2,6 @@
spring.profiles.active
=
dev
spring.profiles.active
=
dev
server.servlet.context-
path
=
/smartAdmin
server.servlet.context-
path
=
/smartAdmin
# \u5F00\u542F\u7194\u65AD
feign.hystrix.enabled
=
true
#\u6307\u5B9Adate\u8F93\u51FA\u683C\u5F0F\u4E3Ayyyy-MM-dd HH:mm:ss
#\u6307\u5B9Adate\u8F93\u51FA\u683C\u5F0F\u4E3Ayyyy-MM-dd HH:mm:ss
spring.jackson.date-
format
=
yyyy-MM-dd HH:mm:ss
spring.jackson.date-
format
=
yyyy-MM-dd HH:mm:ss
spring.jackson.time-
zone
=
GMT+8
spring.jackson.time-
zone
=
GMT+8
...
@@ -18,6 +15,10 @@ logging.path=/data/java_log/jetty/smartService/chejia-smart-admin
...
@@ -18,6 +15,10 @@ logging.path=/data/java_log/jetty/smartService/chejia-smart-admin
feign.server.name
=
chejia-smart-service
feign.server.name
=
chejia-smart-service
feign.server.url
=
http://localhost:8209/smartService
feign.server.url
=
http://localhost:8209/smartService
feign.client.config.default.connect-
timeout
=
20000
feign.client.config.default.read-
timeout
=
20000
# \u5F00\u542F\u7194\u65AD
feign.hystrix.enabled
=
true
dubbo.registry.address
=
zookeeper://192.168.1.36:2181?init.timeout=60000
dubbo.registry.address
=
zookeeper://192.168.1.36:2181?init.timeout=60000
dubbo.registry.timeout
=
10000
dubbo.registry.timeout
=
10000
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment