|
|
@@ -1,5 +1,6 @@
|
|
|
package com.yunfeiyun.agmp.iots.service.impl;
|
|
|
|
|
|
+import com.yunfeiyun.agmp.common.utils.DateUtils;
|
|
|
import com.yunfeiyun.agmp.common.utils.StringUtils;
|
|
|
import com.yunfeiyun.agmp.common.web.system.service.ISysConfigService;
|
|
|
import com.yunfeiyun.agmp.iot.common.constant.IotErrorCode;
|
|
|
@@ -124,7 +125,7 @@ public class IotDeviceServiceImpl implements IIotDeviceService {
|
|
|
*/
|
|
|
@Override
|
|
|
public int updateIotDevice(IotDevice iotDevice) {
|
|
|
- if(needFakeStatus(iotDevice.getDevBid())){
|
|
|
+ if (needFakeStatus(iotDevice.getDevBid())) {
|
|
|
iotDevice.setDevStatus("1");
|
|
|
}
|
|
|
return iotDeviceMapper.updateIotDevice(iotDevice);
|
|
|
@@ -200,7 +201,7 @@ public class IotDeviceServiceImpl implements IIotDeviceService {
|
|
|
|
|
|
@Override
|
|
|
public IotDevice selectDeviceByDeviceServiceNameAndDevCode(String deviceServiceName, String devCode) {
|
|
|
- return iotDeviceMapper.selectDeviceByDeviceServiceNameAndDevCode(deviceServiceName,devCode);
|
|
|
+ return iotDeviceMapper.selectDeviceByDeviceServiceNameAndDevCode(deviceServiceName, devCode);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -220,7 +221,7 @@ public class IotDeviceServiceImpl implements IIotDeviceService {
|
|
|
public int updateIotDeviceStatusByDevBidList(List<String> devBidList) {
|
|
|
List<String> devBidList2 = new ArrayList<>();
|
|
|
for (String devBid : devBidList) {
|
|
|
- if(!needFakeStatus(devBid)){
|
|
|
+ if (!needFakeStatus(devBid)) {
|
|
|
devBidList2.add(devBid);
|
|
|
}
|
|
|
}
|
|
|
@@ -229,31 +230,32 @@ public class IotDeviceServiceImpl implements IIotDeviceService {
|
|
|
|
|
|
@Override
|
|
|
public void updateIotDeviceExtInfo(String devBid, String extInfo) {
|
|
|
- iotDeviceMapper.updateIotDeviceExtInfo(devBid, extInfo);
|
|
|
+ String updateDate = DateUtils.dateTimeNow();
|
|
|
+ iotDeviceMapper.updateIotDeviceExtInfo(devBid, extInfo,updateDate);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void updateIotDeviceByDevCodeAndFirmDev(IotDevice iotDevice) {
|
|
|
- if(needFakeStatus(iotDevice.getDevBid())){
|
|
|
+ if (needFakeStatus(iotDevice.getDevBid())) {
|
|
|
iotDevice.setDevStatus("1");
|
|
|
}
|
|
|
iotDeviceMapper.updateIotDeviceByDevCodeAndFirmDev(iotDevice);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateIotDeviceStatusByDevCodeList(String devStatus,List<String> devCodeList,String devtypeBid,String firmBid) {
|
|
|
+ public void updateIotDeviceStatusByDevCodeList(String devStatus, List<String> devCodeList, String devtypeBid, String firmBid) {
|
|
|
List<String> devCodeList2 = new ArrayList<>();
|
|
|
for (String devBid : devCodeList) {
|
|
|
- if(!needFakeStatus(devBid)){
|
|
|
+ if (!needFakeStatus(devBid)) {
|
|
|
devCodeList2.add(devBid);
|
|
|
}
|
|
|
}
|
|
|
- iotDeviceMapper.updateIotDeviceStatusByDevCodeList(devStatus,devCodeList2,devtypeBid,firmBid);
|
|
|
+ iotDeviceMapper.updateIotDeviceStatusByDevCodeList(devStatus, devCodeList2, devtypeBid, firmBid);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int updateIotDeviceStatusByType(String devStatus, String firmBid,String devtypeBid ) {
|
|
|
- return iotDeviceMapper.updateIotDeviceStatusByType(devStatus,firmBid,devtypeBid);
|
|
|
+ public int updateIotDeviceStatusByType(String devStatus, String firmBid, String devtypeBid) {
|
|
|
+ return iotDeviceMapper.updateIotDeviceStatusByType(devStatus, firmBid, devtypeBid);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -292,9 +294,9 @@ public class IotDeviceServiceImpl implements IIotDeviceService {
|
|
|
public Map<String, List<IotDevice>> getXphHttpDeviceMapByDevtypeBids(String firmBizId, List<String> devtypeBids) {
|
|
|
List<IotDevice> iotDeviceList = getDeviceListByDevtypeBids(firmBizId, devtypeBids);
|
|
|
Map<String, List<IotDevice>> iotDeviceMap = new HashMap<>();
|
|
|
- for(IotDevice iotDevice: iotDeviceList){
|
|
|
+ for (IotDevice iotDevice : iotDeviceList) {
|
|
|
String devCode = iotDevice.getDevCode();
|
|
|
- if(!iotDeviceMap.containsKey(devCode)){
|
|
|
+ if (!iotDeviceMap.containsKey(devCode)) {
|
|
|
iotDeviceMap.put(devCode, new ArrayList<>());
|
|
|
}
|
|
|
iotDeviceMap.get(devCode).add(iotDevice);
|
|
|
@@ -309,7 +311,7 @@ public class IotDeviceServiceImpl implements IIotDeviceService {
|
|
|
@Override
|
|
|
public void updateIotDeviceBatch(List<IotDevice> iotDeviceList) {
|
|
|
for (IotDevice iotDevice : iotDeviceList) {
|
|
|
- if(needFakeStatus(iotDevice.getDevBid())){
|
|
|
+ if (needFakeStatus(iotDevice.getDevBid())) {
|
|
|
iotDevice.setDevStatus("1");
|
|
|
}
|
|
|
}
|
|
|
@@ -335,15 +337,16 @@ public class IotDeviceServiceImpl implements IIotDeviceService {
|
|
|
|
|
|
/**
|
|
|
* 是否是属于需要忽略状态的设备
|
|
|
+ *
|
|
|
* @param devBid
|
|
|
* @return
|
|
|
*/
|
|
|
- private boolean needFakeStatus(String devBid){
|
|
|
+ private boolean needFakeStatus(String devBid) {
|
|
|
String ignorStatusDeviceList = sysConfigService.selectConfigValueByCommonKey("iot_ignor_status_devicelist");
|
|
|
String[] ignorStatusDevBids = ignorStatusDeviceList.split(",");
|
|
|
//判断devbid是否在忽略状态设备列表中
|
|
|
- for(String ignorDevBid : ignorStatusDevBids){
|
|
|
- if(ignorDevBid.equals(devBid)){
|
|
|
+ for (String ignorDevBid : ignorStatusDevBids) {
|
|
|
+ if (ignorDevBid.equals(devBid)) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|