Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
chejia-smart-api
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 0602ef4e
authored
Mar 23, 2021
by
wnb0128
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
车家智能移动端服务 产品图片获取接口--think.wang
1 parent
0cf161da
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
src/main/java/com/glsx/api/controller/RemoteProductController.java
src/main/java/com/glsx/api/pojo/response/ProductResp.java
src/main/java/com/glsx/api/controller/RemoteProductController.java
View file @
0602ef4
...
...
@@ -5,8 +5,11 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.glsx.api.exception.BusinessException
;
import
com.glsx.api.exception.ResultEnum
;
import
com.glsx.api.pojo.request.ProductReq
;
import
com.glsx.api.pojo.request.UserRelationReq
;
import
com.glsx.api.pojo.response.ProductResp
;
import
com.glsx.api.pojo.response.UserRelationResp
;
import
com.glsx.api.remote.ProductFeignClient
;
import
com.glsx.api.remote.UserFeignClient
;
import
com.glsx.plat.common.utils.HttpUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
...
...
@@ -19,6 +22,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
*
* 远程产品服务controller
...
...
@@ -36,7 +41,10 @@ public class RemoteProductController {
@Autowired
private
UserFeignClient
userFeignClient
;
/**
@Autowired
private
ProductFeignClient
productFeignClient
;
/**
* 用户获取远程产品列表数据
*
* @return 结果
...
...
@@ -70,9 +78,11 @@ public class RemoteProductController {
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
JSONObject
object
=
array
.
getJSONObject
(
i
);
JSONObject
val
=
new
JSONObject
();
val
.
put
(
"productId"
,
object
.
getString
(
"product_id"
));
String
productId
=
object
.
getString
(
"product_id"
);
val
.
put
(
"productId"
,
productId
);
val
.
put
(
"uuid"
,
object
.
getString
(
"uuid"
));
val
.
put
(
"productName"
,
object
.
getString
(
"product_name"
));
val
.
put
(
"iconUrl"
,
this
.
getProductIcon
(
productId
));
list
.
add
(
val
);
}
return
list
;
...
...
@@ -84,4 +94,19 @@ public class RemoteProductController {
return
null
;
}
/**
* 通过平台产品id获取产品图片
* @param productId
* @return
*/
private
String
getProductIcon
(
String
productId
){
ProductReq
req
=
new
ProductReq
();
req
.
setPlatformProductId
(
productId
);
List
<
ProductResp
>
list
=
productFeignClient
.
getListByCondition
(
req
);
if
(!
list
.
isEmpty
()){
return
list
.
get
(
0
).
getIconUrl
();
}
return
null
;
}
}
src/main/java/com/glsx/api/pojo/response/ProductResp.java
View file @
0602ef4
...
...
@@ -33,6 +33,11 @@ public class ProductResp {
private
Long
icon
;
/**
* 图片
*/
private
String
iconUrl
;
/**
* 产品类型ID 关联smart_product_type中id
*/
private
Long
typeId
;
...
...
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