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 d785f1c0
authored
Mar 17, 2021
by
tyfanchz
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1、删除无用代码
2、增加feign调用异常捕捉 3、车家智能后台接口开发
1 parent
411cd5e8
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
434 additions
and
52 deletions
src/main/java/com/glsx/admin/controller/ProductController.java
src/main/java/com/glsx/admin/controller/ProductTypeController.java
src/main/java/com/glsx/admin/exception/GlobalExceptionHandler.java
src/main/java/com/glsx/admin/exception/ResultEnum.java
src/main/java/com/glsx/admin/pojo/request/SmartDeviceOrderReq.java
src/main/java/com/glsx/admin/pojo/request/SmartProductReq.java
src/main/java/com/glsx/admin/pojo/request/SmartProductTypeParamReq.java
src/main/java/com/glsx/admin/pojo/request/SmartProductTypeReq.java
src/main/java/com/glsx/admin/pojo/response/SmartDeviceOrderResp.java
src/main/java/com/glsx/admin/pojo/response/SmartProductResp.java
src/main/java/com/glsx/admin/pojo/response/SmartProductTypeResp.java
src/main/java/com/glsx/admin/remote/ProductFeignClient.java
src/main/java/com/glsx/admin/remote/ProductTypeFeignClient.java
src/main/java/com/glsx/admin/controller/ProductController.java
View file @
d785f1c
package
com
.
glsx
.
admin
.
controller
;
package
com
.
glsx
.
admin
.
controller
;
import
java.util.List
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.admin.exception.BusinessException
;
import
com.glsx.admin.exception.BusinessException
;
import
com.glsx.admin.exception.ResultEnum
;
import
com.glsx.admin.exception.ResultEnum
;
import
com.glsx.admin.pojo.request.SmartProductReq
;
import
com.glsx.admin.pojo.request.SmartProductReq
;
import
com.glsx.admin.pojo.response.SmartDeviceOrderResp
;
import
com.glsx.admin.pojo.response.SmartProductResp
;
import
com.glsx.admin.remote.ProductFeignClient
;
import
com.glsx.admin.remote.ProductFeignClient
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
...
@@ -39,7 +42,7 @@ public class ProductController {
...
@@ -39,7 +42,7 @@ public class ProductController {
@RequestMapping
(
value
=
"/getList"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
@RequestMapping
(
value
=
"/getList"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
R
getList
(
SmartProductReq
req
)
{
public
R
getList
(
SmartProductReq
req
)
{
log
.
info
(
"$$$$ /product/getList param: {}"
,
JSON
.
toJSONString
(
req
));
log
.
info
(
"$$$$ /product/getList param: {}"
,
JSON
.
toJSONString
(
req
));
PageInfo
<
SmartProductRe
q
>
pageInfo
=
productFeignClient
.
getList
(
req
);
PageInfo
<
SmartProductRe
sp
>
pageInfo
=
productFeignClient
.
getList
(
req
);
return
R
.
ok
().
putPageData
(
pageInfo
);
return
R
.
ok
().
putPageData
(
pageInfo
);
}
}
...
@@ -50,18 +53,25 @@ public class ProductController {
...
@@ -50,18 +53,25 @@ public class ProductController {
* @return 结果
* @return 结果
*/
*/
@RequestMapping
(
value
=
"/getById"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
@RequestMapping
(
value
=
"/getById"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
SmartProductReq
getById
(
Long
id
)
{
public
R
getById
(
Long
id
)
{
return
null
;
log
.
info
(
"$$$$ /product/getById param: {}"
,
id
);
if
(
id
==
null
)
{
throw
new
BusinessException
(
ResultEnum
.
PARAM_ERROR
);
}
SmartProductResp
resp
=
productFeignClient
.
getById
(
id
);
return
R
.
ok
().
data
(
resp
);
}
}
/**
/**
* 保存产品。无则插入,有则更新。
* 保存产品。无则插入,有则更新。
*
*
* @param
product
产品
* @param
req
产品
*/
*/
@RequestMapping
(
value
=
"/save"
,
method
=
{
RequestMethod
.
POST
})
@RequestMapping
(
value
=
"/save"
,
method
=
{
RequestMethod
.
POST
})
public
void
save
(
@RequestBody
@Validated
SmartProductReq
product
)
{
public
R
save
(
@RequestBody
@Validated
SmartProductReq
req
)
{
log
.
info
(
"$$$$ /product/save param: {}"
,
JSON
.
toJSONString
(
product
));
log
.
info
(
"$$$$ /product/save param: {}"
,
JSON
.
toJSONString
(
req
));
productFeignClient
.
save
(
req
);
return
R
.
ok
();
}
}
/**
/**
...
@@ -70,8 +80,13 @@ public class ProductController {
...
@@ -70,8 +80,13 @@ public class ProductController {
* @param id 产品 id
* @param id 产品 id
*/
*/
@RequestMapping
(
value
=
"/getCommandSetById"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
@RequestMapping
(
value
=
"/getCommandSetById"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
void
getCommandSetById
(
Lo
ng
id
)
{
public
R
getCommandSetById
(
Stri
ng
id
)
{
log
.
info
(
"$$$$ /product/getCommandSetById param: {}"
,
id
);
log
.
info
(
"$$$$ /product/getCommandSetById param: {}"
,
id
);
if
(
StringUtils
.
isBlank
(
id
))
{
throw
new
BusinessException
(
ResultEnum
.
PARAM_ERROR
);
}
List
<
SmartDeviceOrderResp
>
respList
=
productFeignClient
.
getCommandSetById
(
id
);
return
R
.
ok
().
data
(
respList
);
}
}
/**
/**
...
@@ -80,12 +95,13 @@ public class ProductController {
...
@@ -80,12 +95,13 @@ public class ProductController {
* @param shopProductId 商品 id
* @param shopProductId 商品 id
*/
*/
@RequestMapping
(
value
=
"/checkShopProductId"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
@RequestMapping
(
value
=
"/checkShopProductId"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
Boolean
checkShopProductId
(
String
shopProductId
)
{
public
R
checkShopProductId
(
String
shopProductId
)
{
log
.
info
(
"$$$$ /product/checkShopProductId param: {}"
,
shopProductId
);
log
.
info
(
"$$$$ /product/checkShopProductId param: {}"
,
shopProductId
);
if
(
StringUtils
.
isBlank
(
shopProductId
))
{
if
(
StringUtils
.
isBlank
(
shopProductId
))
{
throw
new
BusinessException
(
ResultEnum
.
PARAM_ERROR
);
throw
new
BusinessException
(
ResultEnum
.
PARAM_ERROR
);
}
}
return
null
;
Boolean
productIdValid
=
productFeignClient
.
checkShopProductId
(
shopProductId
);
return
R
.
ok
().
data
(
productIdValid
);
}
}
/**
/**
...
@@ -94,10 +110,12 @@ public class ProductController {
...
@@ -94,10 +110,12 @@ public class ProductController {
* @param id 产品 id
* @param id 产品 id
*/
*/
@RequestMapping
(
value
=
"/putOnOff"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
@RequestMapping
(
value
=
"/putOnOff"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
void
putOnOff
(
Long
id
)
{
public
R
putOnOff
(
Long
id
)
{
log
.
info
(
"$$$$ /product/putOnOff param: {}"
,
id
);
log
.
info
(
"$$$$ /product/putOnOff param: {}"
,
id
);
if
(
id
==
null
)
{
if
(
id
==
null
)
{
throw
new
BusinessException
(
ResultEnum
.
PARAM_ERROR
);
throw
new
BusinessException
(
ResultEnum
.
PARAM_ERROR
);
}
}
productFeignClient
.
putOnOff
(
id
);
return
R
.
ok
();
}
}
}
}
src/main/java/com/glsx/admin/controller/ProductTypeController.java
0 → 100644
View file @
d785f1c
package
com
.
glsx
.
admin
.
controller
;
import
java.util.List
;
import
com.alibaba.fastjson.JSON
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.admin.exception.BusinessException
;
import
com.glsx.admin.exception.ResultEnum
;
import
com.glsx.admin.pojo.request.SmartProductTypeReq
;
import
com.glsx.admin.pojo.response.SmartProductTypeResp
;
import
com.glsx.admin.remote.ProductTypeFeignClient
;
import
com.glsx.plat.core.web.R
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
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
;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-17
*/
@Slf4j
@RestController
@RequestMapping
(
"/productType"
)
public
class
ProductTypeController
{
@Autowired
private
ProductTypeFeignClient
productTypeFeignClient
;
/**
* 获取产品类型列表。
*
* @param req 请求
* @return 结果
*/
@RequestMapping
(
value
=
"/getList"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
R
getList
(
SmartProductTypeReq
req
)
{
log
.
info
(
"$$$$ /productType/getList param: {}"
,
JSON
.
toJSONString
(
req
));
PageInfo
<
SmartProductTypeResp
>
pageInfo
=
productTypeFeignClient
.
getList
(
req
);
return
R
.
ok
().
putPageData
(
pageInfo
);
}
/**
* 根据 id 获取产品类型。
*
* @param id 产品类型 id
* @return 结果
*/
@RequestMapping
(
value
=
"/getById"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
R
getById
(
Long
id
)
{
log
.
info
(
"$$$$ /productType/getById param: {}"
,
id
);
if
(
id
==
null
)
{
throw
new
BusinessException
(
ResultEnum
.
PARAM_ERROR
);
}
SmartProductTypeResp
resp
=
productTypeFeignClient
.
getById
(
id
);
return
R
.
ok
().
data
(
resp
);
}
/**
* 保存产品类型。
*
* @param req 产品类型
*/
@RequestMapping
(
value
=
"/save"
,
method
=
{
RequestMethod
.
POST
})
public
R
save
(
@RequestBody
@Validated
SmartProductTypeReq
req
)
{
log
.
info
(
"$$$$ /productType/save param: {}"
,
JSON
.
toJSONString
(
req
));
productTypeFeignClient
.
save
(
req
);
return
R
.
ok
();
}
/**
* 获取商城标签
*
* @return 结果
*/
@RequestMapping
(
value
=
"/getShopTagList"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
R
getShopTagList
()
{
log
.
info
(
"$$$$ /productType/getShopTagList ..."
);
List
<
String
>
shopTagList
=
productTypeFeignClient
.
getShopTagList
();
return
R
.
ok
().
data
(
shopTagList
);
}
}
src/main/java/com/glsx/admin/exception/GlobalExceptionHandler.java
View file @
d785f1c
package
com
.
glsx
.
admin
.
exception
;
package
com
.
glsx
.
admin
.
exception
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.core.web.R
;
import
com.netflix.hystrix.exception.HystrixRuntimeException
;
import
feign.FeignException
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.BindException
;
import
org.springframework.validation.BindException
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
...
@@ -18,21 +24,44 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
...
@@ -18,21 +24,44 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice
@RestControllerAdvice
public
class
GlobalExceptionHandler
{
public
class
GlobalExceptionHandler
{
@ExceptionHandler
({
BusinessException
.
class
})
@ExceptionHandler
({
BusinessException
.
class
})
public
String
handleBusinessException
(
BusinessException
e
)
{
public
R
handleBusinessException
(
BusinessException
e
)
{
log
.
error
(
"!!!! 业务异常"
,
e
);
log
.
error
(
"!!!! 业务异常"
,
e
);
return
e
.
getMessage
(
);
return
R
.
error
(
e
.
getCode
(),
e
.
getMessage
()
);
}
}
@ExceptionHandler
({
ServletRequestBindingException
.
class
,
MethodArgumentNotValidException
.
class
,
@ExceptionHandler
({
ServletRequestBindingException
.
class
,
MethodArgumentNotValidException
.
class
,
BindException
.
class
})
BindException
.
class
})
public
String
handleBindException
(
Exception
e
)
{
public
R
handleBindException
(
Exception
e
)
{
log
.
error
(
"!!!! 参数错误"
,
e
);
log
.
error
(
"!!!! 参数错误"
,
e
);
return
ResultEnum
.
PARAM_ERROR
.
getMessage
();
return
R
.
error
(
ResultEnum
.
PARAM_ERROR
.
getCode
(),
ResultEnum
.
PARAM_ERROR
.
getMessage
());
}
@ExceptionHandler
({
HystrixRuntimeException
.
class
})
public
R
handleHystrixException
(
HystrixRuntimeException
e
)
{
Throwable
cause
=
e
.
getCause
();
if
(
cause
instanceof
FeignException
)
{
FeignException
feignException
=
(
FeignException
)
cause
;
return
this
.
handleFeignException
(
feignException
);
}
else
{
log
.
error
(
"!!!! Hystrix熔断错误"
,
e
);
return
R
.
error
(
ResultEnum
.
ERROR
.
getCode
(),
ResultEnum
.
ERROR
.
getMessage
());
}
}
@ExceptionHandler
({
FeignException
.
class
})
public
R
handleFeignException
(
FeignException
e
)
{
log
.
error
(
"!!!! 远程服务错误"
,
e
);
JSONObject
respObj
=
JSON
.
parseObject
(
e
.
contentUTF8
());
String
respMessage
=
respObj
.
getString
(
"message"
);
int
code
=
ResultEnum
.
REMOTE_SERVICE_ERROR
.
getCode
();
String
message
=
StringUtils
.
isBlank
(
respMessage
)
?
ResultEnum
.
REMOTE_SERVICE_ERROR
.
getMessage
()
:
respMessage
;
return
R
.
error
(
code
,
message
);
}
}
@ExceptionHandler
(
Exception
.
class
)
@ExceptionHandler
(
Exception
.
class
)
public
String
handleException
(
Exception
e
)
{
public
R
handleException
(
Exception
e
)
{
log
.
error
(
"!!!! 未知异常"
,
e
);
log
.
error
(
"!!!! 未知异常"
,
e
);
return
R
esultEnum
.
ERROR
.
getMessage
(
);
return
R
.
error
(
ResultEnum
.
ERROR
.
getCode
(),
ResultEnum
.
ERROR
.
getMessage
()
);
}
}
}
}
src/main/java/com/glsx/admin/exception/ResultEnum.java
View file @
d785f1c
...
@@ -17,6 +17,8 @@ public enum ResultEnum {
...
@@ -17,6 +17,8 @@ public enum ResultEnum {
PRODUCT_NAME_DUPLICATE
(
2002
,
"产品名称重复"
),
PRODUCT_NAME_DUPLICATE
(
2002
,
"产品名称重复"
),
PRODUCT_TYPE_NOT_FOUND
(
3001
,
"产品类型ID未找到"
),
PRODUCT_TYPE_NOT_FOUND
(
3001
,
"产品类型ID未找到"
),
REMOTE_SERVICE_ERROR
(
9001
,
"服务调用错误"
),
;
;
private
final
Integer
code
;
private
final
Integer
code
;
...
...
src/main/java/com/glsx/admin/pojo/request/SmartDeviceOrderReq.java
0 → 100644
View file @
d785f1c
package
com
.
glsx
.
admin
.
pojo
.
request
;
import
lombok.Data
;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-17
*/
@Data
public
class
SmartDeviceOrderReq
{
private
Integer
id
;
/**
* 产品id
*/
private
String
productId
;
private
String
orderCode
;
private
String
orderValue
;
/**
* 设备类型 1.非固定值不需要查询 2.固定值需要查询
*/
private
String
orderType
;
}
src/main/java/com/glsx/admin/pojo/request/SmartProductReq.java
View file @
d785f1c
package
com
.
glsx
.
admin
.
pojo
.
request
;
package
com
.
glsx
.
admin
.
pojo
.
request
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
java.util.Date
;
import
java.util.Date
;
import
com.glsx.admin.pojo.BaseDTO
;
import
com.glsx.admin.pojo.BaseDTO
;
...
@@ -22,13 +18,10 @@ import lombok.Data;
...
@@ -22,13 +18,10 @@ import lombok.Data;
* 车家智能产品数据表
* 车家智能产品数据表
*/
*/
@Data
@Data
@Table
(
name
=
"smart_product"
)
public
class
SmartProductReq
extends
BaseDTO
{
public
class
SmartProductReq
extends
BaseDTO
{
/**
/**
* 标识ID
* 标识ID
*/
*/
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
private
Long
id
;
/**
/**
...
...
src/main/java/com/glsx/admin/pojo/request/SmartProductTypeParamReq.java
View file @
d785f1c
...
@@ -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_product_type_param"
)
public
class
SmartProductTypeParamReq
{
public
class
SmartProductTypeParamReq
{
/**
/**
* 标识ID
* 标识ID
*/
*/
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
private
Long
id
;
/**
/**
...
...
src/main/java/com/glsx/admin/pojo/request/SmartProductTypeReq.java
View file @
d785f1c
package
com
.
glsx
.
admin
.
pojo
.
request
;
package
com
.
glsx
.
admin
.
pojo
.
request
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.persistence.Transient
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
java.util.Date
;
import
java.util.Date
;
import
com.glsx.admin.pojo.BaseDTO
;
import
com.glsx.admin.pojo.BaseDTO
;
...
@@ -23,26 +18,10 @@ import lombok.Data;
...
@@ -23,26 +18,10 @@ import lombok.Data;
* 车家智能产品类型表
* 车家智能产品类型表
*/
*/
@Data
@Data
@Table
(
name
=
"smart_product_type"
)
public
class
SmartProductTypeReq
extends
BaseDTO
{
public
class
SmartProductTypeReq
extends
BaseDTO
{
/**
/**
* 一级分类名
*/
@Transient
private
String
categoryName1
;
/**
* 二级分类名
*/
@Transient
private
String
categoryName2
;
/**
* 标识ID
* 标识ID
*/
*/
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
private
Long
id
;
/**
/**
...
...
src/main/java/com/glsx/admin/pojo/response/SmartDeviceOrderResp.java
0 → 100644
View file @
d785f1c
package
com
.
glsx
.
admin
.
pojo
.
response
;
import
lombok.Data
;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-17
*/
@Data
public
class
SmartDeviceOrderResp
{
private
Integer
id
;
/**
* 产品id
*/
private
String
productId
;
private
String
orderCode
;
private
String
orderValue
;
/**
* 设备类型 1.非固定值不需要查询 2.固定值需要查询
*/
private
String
orderType
;
}
src/main/java/com/glsx/admin/pojo/response/SmartProductResp.java
0 → 100644
View file @
d785f1c
package
com
.
glsx
.
admin
.
pojo
.
response
;
import
java.util.Date
;
import
com.glsx.admin.pojo.BaseDTO
;
import
lombok.Data
;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
/**
* 车家智能产品数据表
*/
@Data
public
class
SmartProductResp
extends
BaseDTO
{
/**
* 标识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/response/SmartProductTypeResp.java
0 → 100644
View file @
d785f1c
package
com
.
glsx
.
admin
.
pojo
.
response
;
import
javax.validation.constraints.NotBlank
;
import
java.util.Date
;
import
com.glsx.admin.pojo.BaseDTO
;
import
lombok.Data
;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
/**
* 车家智能产品类型表
*/
@Data
public
class
SmartProductTypeResp
extends
BaseDTO
{
/**
* 标识ID
*/
private
Long
id
;
/**
* 类型名称
*/
@NotBlank
private
String
typeName
;
/**
* 类别key 关联smart_sys_code中dict_key
*/
private
String
categoryKey
;
/**
* 商城标签
*/
private
String
shopTag
;
/**
* 备注
*/
private
String
remark
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 创建人
*/
private
Long
createBy
;
/**
* 更新时间
*/
private
Date
updateTime
;
/**
* 更新人
*/
private
Long
updateBy
;
}
src/main/java/com/glsx/admin/remote/ProductFeignClient.java
View file @
d785f1c
package
com
.
glsx
.
admin
.
remote
;
package
com
.
glsx
.
admin
.
remote
;
import
java.util.List
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.admin.pojo.request.SmartProductReq
;
import
com.glsx.admin.pojo.request.SmartProductReq
;
import
com.glsx.admin.pojo.response.SmartDeviceOrderResp
;
import
com.glsx.admin.pojo.response.SmartProductResp
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.SpringQueryMap
;
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.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
/**
/**
...
@@ -18,5 +24,25 @@ import org.springframework.web.bind.annotation.ResponseBody;
...
@@ -18,5 +24,25 @@ import org.springframework.web.bind.annotation.ResponseBody;
public
interface
ProductFeignClient
{
public
interface
ProductFeignClient
{
@RequestMapping
(
value
=
"/product/getList"
,
method
=
{
RequestMethod
.
GET
})
@RequestMapping
(
value
=
"/product/getList"
,
method
=
{
RequestMethod
.
GET
})
@ResponseBody
@ResponseBody
PageInfo
<
SmartProductReq
>
getList
(
SmartProductReq
req
);
PageInfo
<
SmartProductResp
>
getList
(
@SpringQueryMap
SmartProductReq
req
);
@RequestMapping
(
value
=
"/product/getById"
,
method
=
{
RequestMethod
.
GET
})
@ResponseBody
SmartProductResp
getById
(
@RequestParam
Long
id
);
@RequestMapping
(
value
=
"/product/save"
,
method
=
{
RequestMethod
.
POST
})
@ResponseBody
void
save
(
@RequestBody
SmartProductReq
req
);
@RequestMapping
(
"/product/getCommandSetById"
)
@ResponseBody
List
<
SmartDeviceOrderResp
>
getCommandSetById
(
@RequestParam
String
id
);
@RequestMapping
(
value
=
"/product/checkShopProductId"
,
method
=
{
RequestMethod
.
GET
})
@ResponseBody
Boolean
checkShopProductId
(
@RequestParam
String
shopProductId
);
@RequestMapping
(
value
=
"/product/putOnOff"
,
method
=
{
RequestMethod
.
POST
})
@ResponseBody
void
putOnOff
(
@RequestParam
Long
id
);
}
}
src/main/java/com/glsx/admin/remote/ProductTypeFeignClient.java
0 → 100644
View file @
d785f1c
package
com
.
glsx
.
admin
.
remote
;
import
java.util.List
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.admin.pojo.request.SmartProductTypeReq
;
import
com.glsx.admin.pojo.response.SmartProductTypeResp
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.SpringQueryMap
;
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.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-17
*/
@FeignClient
(
name
=
"${feign.server.name}"
,
url
=
"${feign.server.url}"
)
public
interface
ProductTypeFeignClient
{
@RequestMapping
(
value
=
"/productType/getList"
,
method
=
{
RequestMethod
.
GET
})
@ResponseBody
PageInfo
<
SmartProductTypeResp
>
getList
(
@SpringQueryMap
SmartProductTypeReq
req
);
@RequestMapping
(
value
=
"/productType/getById"
,
method
=
{
RequestMethod
.
GET
})
@ResponseBody
SmartProductTypeResp
getById
(
@RequestParam
Long
id
);
@RequestMapping
(
value
=
"/productType/save"
,
method
=
{
RequestMethod
.
POST
})
@ResponseBody
void
save
(
@RequestBody
SmartProductTypeReq
req
);
@RequestMapping
(
value
=
"/productType/getShopTagList"
,
method
=
{
RequestMethod
.
GET
})
@ResponseBody
List
<
String
>
getShopTagList
();
}
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