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 4f2fcf3f
authored
Apr 13, 2021
by
111-PC\111
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]代码修改
1 parent
407949b1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
7 deletions
src/main/java/com/glsx/smart/dao/mapper/SmartDeviceStatusMapper.java
src/main/java/com/glsx/smart/service/impl/SmartSceneServiceImpl.java
src/main/resources/mapper/SmartDeviceStatusMapper.xml
src/main/java/com/glsx/smart/dao/mapper/SmartDeviceStatusMapper.java
View file @
4f2fcf3
package
com
.
glsx
.
smart
.
dao
.
mapper
;
package
com
.
glsx
.
smart
.
dao
.
mapper
;
import
java.util.List
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartDeviceStatus
;
import
com.glsx.smart.dao.entity.SmartDeviceStatus
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
/**
/**
* <p>Description:
* <p>Description:
* <p>Project: chejia-smart
* <p>Project: chejia-smart
...
@@ -25,4 +27,6 @@ public interface SmartDeviceStatusMapper
...
@@ -25,4 +27,6 @@ public interface SmartDeviceStatusMapper
int
updateBatchSelective
(
List
<
SmartDeviceStatus
>
list
);
int
updateBatchSelective
(
List
<
SmartDeviceStatus
>
list
);
int
batchInsert
(
@Param
(
"list"
)
List
<
SmartDeviceStatus
>
list
);
int
batchInsert
(
@Param
(
"list"
)
List
<
SmartDeviceStatus
>
list
);
SmartDeviceStatus
findDevStatusByIdAndCode
(
@Param
(
"deviceId"
)
String
devideId
,
@Param
(
"code"
)
String
order
);
}
}
src/main/java/com/glsx/smart/service/impl/SmartSceneServiceImpl.java
View file @
4f2fcf3
...
@@ -5,9 +5,10 @@ import cn.com.glsx.didicb.app.model.MessageBoxInfo;
...
@@ -5,9 +5,10 @@ import cn.com.glsx.didicb.app.model.MessageBoxInfo;
import
cn.com.glsx.didicb.app.remote.MessageBoxInfoRemote
;
import
cn.com.glsx.didicb.app.remote.MessageBoxInfoRemote
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.glsx.smart.dao.entity.SmartDeviceStatus
;
import
com.glsx.smart.dao.entity.SmartScene
;
import
com.glsx.smart.dao.entity.SmartScene
;
import
com.glsx.smart.dao.entity.SmartSceneData
;
import
com.glsx.smart.dao.entity.SmartSceneData
;
import
com.glsx.smart.dao.mapper.Smart
Product
Mapper
;
import
com.glsx.smart.dao.mapper.Smart
DeviceStatus
Mapper
;
import
com.glsx.smart.dao.mapper.SmartSceneDataMapper
;
import
com.glsx.smart.dao.mapper.SmartSceneDataMapper
;
import
com.glsx.smart.dao.mapper.SmartSceneMapper
;
import
com.glsx.smart.dao.mapper.SmartSceneMapper
;
import
com.glsx.smart.exception.BusinessException
;
import
com.glsx.smart.exception.BusinessException
;
...
@@ -52,11 +53,6 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
...
@@ -52,11 +53,6 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
@Resource
@Resource
private
SmartSceneDataMapper
sceneDataMapper
;
private
SmartSceneDataMapper
sceneDataMapper
;
@Resource
private
SmartProductMapper
productMapper
;
@DubboReference
private
MessageBoxInfoRemote
messageBoxInfoRemote
;
@Value
(
"${orderIssueurl}"
)
@Value
(
"${orderIssueurl}"
)
private
String
orderIssueurl
;
private
String
orderIssueurl
;
...
@@ -67,6 +63,12 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
...
@@ -67,6 +63,12 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
@Value
(
"${infoUrl}"
)
@Value
(
"${infoUrl}"
)
private
String
infoUrl
;
private
String
infoUrl
;
@DubboReference
private
MessageBoxInfoRemote
messageBoxInfoRemote
;
@Resource
private
SmartDeviceStatusMapper
smartDeviceStatusMapper
;
@Override
@Override
public
List
<
SmartScene
>
getList
(
SmartScene
record
)
{
public
List
<
SmartScene
>
getList
(
SmartScene
record
)
{
return
sceneMapper
.
getList
(
record
);
return
sceneMapper
.
getList
(
record
);
...
@@ -202,9 +204,16 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
...
@@ -202,9 +204,16 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
String
devideId
=
executeTaskVo
.
getSelect
();
String
devideId
=
executeTaskVo
.
getSelect
();
JSONObject
jsonObject
=
null
;
JSONObject
jsonObject
=
null
;
if
(
StringUtils
.
isBlank
(
remoteId
))
{
if
(
StringUtils
.
isBlank
(
remoteId
))
{
// 如果设备状态已经是设置的,不重复下发
String
order_value
=
executeTaskVo
.
getOrderVal
()
==
null
?
executeTaskVo
.
getValue
()
:
executeTaskVo
.
getOrderVal
();
SmartDeviceStatus
smartDevideStatus
=
smartDeviceStatusMapper
.
findDevStatusByIdAndCode
(
devideId
,
executeTaskVo
.
getOrder
());
if
(
smartDevideStatus
!=
null
&&
smartDevideStatus
.
getDeviceOrderValue
().
equals
(
order_value
)){
log
.
info
(
"该设备已经设置成当前需要的状态,设备id{}"
,
devideId
);
continue
;
}
String
valueType
=
executeTaskVo
.
getValType
();
String
valueType
=
executeTaskVo
.
getValType
();
ordermap
.
put
(
"code"
,
executeTaskVo
.
getOrder
());
ordermap
.
put
(
"code"
,
executeTaskVo
.
getOrder
());
ordermap
.
put
(
"value"
,
revertType
(
valueType
,
executeTaskVo
.
getOrderVal
()
==
null
?
executeTaskVo
.
getValue
()
:
executeTaskVo
.
getOrderVal
()
));
ordermap
.
put
(
"value"
,
revertType
(
valueType
,
order_value
));
maps
.
add
(
ordermap
);
maps
.
add
(
ordermap
);
ordermaps
.
put
(
"commands"
,
maps
);
ordermaps
.
put
(
"commands"
,
maps
);
log
.
info
(
"发送的指令{}"
,
JSON
.
toJSONString
(
maps
));
log
.
info
(
"发送的指令{}"
,
JSON
.
toJSONString
(
maps
));
...
...
src/main/resources/mapper/SmartDeviceStatusMapper.xml
View file @
4f2fcf3
...
@@ -117,6 +117,9 @@
...
@@ -117,6 +117,9 @@
#{item.id,jdbcType=INTEGER}
#{item.id,jdbcType=INTEGER}
</foreach>
</foreach>
</update>
</update>
<select
id=
"findDevStatusByIdAndCode"
resultMap=
"BaseResultMap"
>
select * from smart_device_status where device_id=#{deviceId} and device_order_code=#{code}
</select>
<insert
id=
"batchInsert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"map"
<insert
id=
"batchInsert"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"map"
useGeneratedKeys=
"true"
>
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
<!--@mbg.generated-->
...
...
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