Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
chejia-smart-service
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 1a03e9d3
authored
Apr 28, 2021
by
111-PC\111
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]红外修改
1 parent
689f918a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
15 deletions
src/main/java/com/glsx/smart/service/impl/SmartProductTypeServiceImpl.java
src/main/java/com/glsx/smart/service/impl/SmartProductTypeServiceImpl.java
View file @
1a03e9d
...
@@ -140,7 +140,8 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
...
@@ -140,7 +140,8 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
@Override
@Override
public
String
findRemotesById
(
String
infrared_id
)
{
public
String
findRemotesById
(
String
infrared_id
)
{
List
<
SmartUserDevice
>
smartUserDeviceList
=
smartUserDeviceMapper
.
findByParentId
(
infrared_id
);
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
List
<
SmartUserDevice
>
smartUserDeviceList
=
smartUserDeviceMapper
.
findByParentId
(
infrared_id
);
List
<
Map
<
String
,
String
>>
collect
=
smartUserDeviceList
.
stream
().
map
(
index
->
{
List
<
Map
<
String
,
String
>>
collect
=
smartUserDeviceList
.
stream
().
map
(
index
->
{
Map
<
String
,
String
>
hash
=
new
HashMap
<>();
Map
<
String
,
String
>
hash
=
new
HashMap
<>();
hash
.
put
(
"remote_name"
,
index
.
getDeviceName
());
hash
.
put
(
"remote_name"
,
index
.
getDeviceName
());
...
@@ -148,7 +149,9 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
...
@@ -148,7 +149,9 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
hash
.
put
(
"typeId"
,
index
.
getTypeId
());
hash
.
put
(
"typeId"
,
index
.
getTypeId
());
return
hash
;
return
hash
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
return
JSONObject
.
toJSONString
(
collect
);
objectMap
.
put
(
"code"
,
200
);
objectMap
.
put
(
"message"
,
collect
);
return
JSONObject
.
toJSONString
(
objectMap
);
}
}
/**
/**
...
@@ -168,7 +171,7 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
...
@@ -168,7 +171,7 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
prodIdList
.
add
(
array
.
getJSONObject
(
i
).
getString
(
"product_id"
));
prodIdList
.
add
(
array
.
getJSONObject
(
i
).
getString
(
"product_id"
));
}
}
List
<
SmartProduct
>
productList
=
productMapper
.
getByPlatProductIdList
(
prodIdList
);
List
<
SmartProduct
>
productList
=
productMapper
.
getByPlatProductIdList
(
prodIdList
);
if
(
CollectionUtils
.
isEmpty
(
productList
))
{
if
(
CollectionUtils
.
isEmpty
(
productList
))
{
return
deviceRespList
;
return
deviceRespList
;
}
}
Map
<
Long
,
SmartProductType
>
typeMap
=
this
.
getProductTypeMap
(
status
,
productList
);
Map
<
Long
,
SmartProductType
>
typeMap
=
this
.
getProductTypeMap
(
status
,
productList
);
...
@@ -177,11 +180,11 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
...
@@ -177,11 +180,11 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
JSONObject
object
=
array
.
getJSONObject
(
i
);
JSONObject
object
=
array
.
getJSONObject
(
i
);
String
productId
=
object
.
getString
(
"product_id"
);
String
productId
=
object
.
getString
(
"product_id"
);
SmartProduct
product
=
this
.
compareProductId
(
productList
,
productId
);
SmartProduct
product
=
this
.
compareProductId
(
productList
,
productId
);
if
(
product
==
null
)
{
if
(
product
==
null
)
{
continue
;
continue
;
}
}
SmartProductType
productType
=
typeMap
.
get
(
product
.
getTypeId
());
SmartProductType
productType
=
typeMap
.
get
(
product
.
getTypeId
());
if
(
productType
!=
null
)
{
if
(
productType
!=
null
)
{
RemoteDeviceResp
resp
=
new
RemoteDeviceResp
();
RemoteDeviceResp
resp
=
new
RemoteDeviceResp
();
resp
.
setProductId
(
productId
);
resp
.
setProductId
(
productId
);
resp
.
setUuid
(
object
.
getString
(
"id"
));
resp
.
setUuid
(
object
.
getString
(
"id"
));
...
@@ -209,16 +212,16 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
...
@@ -209,16 +212,16 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
List
<
String
>
prodIdList
=
new
ArrayList
<>(
deviceList
.
size
());
List
<
String
>
prodIdList
=
new
ArrayList
<>(
deviceList
.
size
());
deviceList
.
forEach
(
index
->
prodIdList
.
add
(
index
.
getPlatformProductId
()));
deviceList
.
forEach
(
index
->
prodIdList
.
add
(
index
.
getPlatformProductId
()));
List
<
SmartProduct
>
productList
=
productMapper
.
getByPlatProductIdList
(
prodIdList
);
List
<
SmartProduct
>
productList
=
productMapper
.
getByPlatProductIdList
(
prodIdList
);
if
(
CollectionUtils
.
isEmpty
(
productList
))
{
if
(
CollectionUtils
.
isEmpty
(
productList
))
{
return
deviceRespList
;
return
deviceRespList
;
}
}
Map
<
Long
,
SmartProductType
>
typeMap
=
this
.
getProductTypeMap
(
status
,
productList
);
Map
<
Long
,
SmartProductType
>
typeMap
=
this
.
getProductTypeMap
(
status
,
productList
);
//用户设备数据封装
//用户设备数据封装
deviceList
.
forEach
(
index
->{
deviceList
.
forEach
(
index
->
{
SmartProduct
product
=
this
.
compareProductId
(
productList
,
index
.
getPlatformProductId
());
SmartProduct
product
=
this
.
compareProductId
(
productList
,
index
.
getPlatformProductId
());
if
(
product
!=
null
)
{
if
(
product
!=
null
)
{
SmartProductType
productType
=
typeMap
.
get
(
product
.
getTypeId
());
SmartProductType
productType
=
typeMap
.
get
(
product
.
getTypeId
());
if
(
productType
!=
null
)
{
if
(
productType
!=
null
)
{
RemoteDeviceResp
resp
=
new
RemoteDeviceResp
();
RemoteDeviceResp
resp
=
new
RemoteDeviceResp
();
resp
.
setProductId
(
index
.
getPlatformProductId
());
resp
.
setProductId
(
index
.
getPlatformProductId
());
resp
.
setUuid
(
index
.
getDeviceId
());
resp
.
setUuid
(
index
.
getDeviceId
());
...
@@ -242,12 +245,12 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
...
@@ -242,12 +245,12 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
* @param productList
* @param productList
* @return
* @return
*/
*/
private
Map
<
Long
,
SmartProductType
>
getProductTypeMap
(
Byte
status
,
List
<
SmartProduct
>
productList
){
private
Map
<
Long
,
SmartProductType
>
getProductTypeMap
(
Byte
status
,
List
<
SmartProduct
>
productList
)
{
//获取设备类型列表
//获取设备类型列表
List
<
SmartProductType
>
list
;
List
<
SmartProductType
>
list
;
if
(
status
==
1
)
{
if
(
status
==
1
)
{
list
=
productTypeMapper
.
getAllConditionList
();
list
=
productTypeMapper
.
getAllConditionList
();
}
else
if
(
status
==
2
)
{
}
else
if
(
status
==
2
)
{
list
=
productTypeMapper
.
getAllContentList
();
list
=
productTypeMapper
.
getAllContentList
();
}
else
{
}
else
{
//获取平台产品类型id列表
//获取平台产品类型id列表
...
@@ -258,21 +261,22 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
...
@@ -258,21 +261,22 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
list
=
productTypeMapper
.
getByIdList
(
typeIdList
);
list
=
productTypeMapper
.
getByIdList
(
typeIdList
);
}
}
Map
<
Long
,
SmartProductType
>
typeMap
=
new
HashMap
<>(
list
.
size
());
Map
<
Long
,
SmartProductType
>
typeMap
=
new
HashMap
<>(
list
.
size
());
list
.
stream
().
forEach
(
index
->
typeMap
.
put
(
index
.
getId
(),
index
));
list
.
stream
().
forEach
(
index
->
typeMap
.
put
(
index
.
getId
(),
index
));
return
typeMap
;
return
typeMap
;
}
}
/**
/**
* 比较获取产品
* 比较获取产品
*
* @param list
* @param list
* @param productId
* @param productId
* @return
* @return
*/
*/
private
SmartProduct
compareProductId
(
List
<
SmartProduct
>
list
,
String
productId
){
private
SmartProduct
compareProductId
(
List
<
SmartProduct
>
list
,
String
productId
)
{
int
len
=
list
.
size
();
int
len
=
list
.
size
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
SmartProduct
product
=
list
.
get
(
i
);
SmartProduct
product
=
list
.
get
(
i
);
if
(
productId
.
equals
(
product
.
getPlatformProductId
()))
{
if
(
productId
.
equals
(
product
.
getPlatformProductId
()))
{
return
product
;
return
product
;
}
}
}
}
...
...
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