|
|
@@ -21,15 +21,18 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author lidexi
|
|
|
* @date 2021/5/24 17:23
|
|
|
*/
|
|
|
@Service
|
|
|
-public class QinLinMqProvider implements IQinLinButtService<String>, IOpenDoorService<UserInfoDto>, IDoorDeviceService<QLinCommunityDevices>, IDeviceUserService<UserInfoDto> {
|
|
|
+public class QinLinMqProvider implements IQinLinButtService<String>, IOpenDoorService<UserInfoDto>, IDoorDeviceService, IDeviceUserService<UserInfoDto> {
|
|
|
|
|
|
@Autowired
|
|
|
private IQinlinApiLogService qinlinApiLogService;
|
|
|
@@ -109,8 +112,11 @@ public class QinLinMqProvider implements IQinLinButtService<String>, IOpenDoorSe
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public R addDevice(DoorDevice doorDevice, QLinCommunityDevices qLinCommunityDevices) {
|
|
|
+ public R addDevice(DoorDevice doorDevice) {
|
|
|
+ QLinCommunityDevices qLinCommunityDevices = new QLinCommunityDevices();
|
|
|
try{
|
|
|
+ qLinCommunityDevices.setCommunityId(doorDevice.getResidentialId());
|
|
|
+ qLinCommunityDevices.setMac(Arrays.asList(doorDevice.getMacAddress()));
|
|
|
ApiResultBean apiResultBean = qinLinHttpUtil.addDevices(qLinCommunityDevices);
|
|
|
QinlinApiLog log = BeanUtil.toBean(apiResultBean, QinlinApiLog.class);
|
|
|
log.setReqData(JsonUtil.toJson(qLinCommunityDevices));
|
|
|
@@ -118,23 +124,23 @@ public class QinLinMqProvider implements IQinLinButtService<String>, IOpenDoorSe
|
|
|
log.setMethod("新增设备");
|
|
|
qinlinApiLogService.recordApiLog(log);
|
|
|
if(apiResultBean.getSuccess()){
|
|
|
- return R.success("新增小区成功");
|
|
|
+ return R.success("注册设备成功");
|
|
|
}else{
|
|
|
return R.fail(apiResultBean.getMessage());
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
QinlinApiLog log = new QinlinApiLog();
|
|
|
- log.setMethod("新增设备");
|
|
|
+ log.setMethod("注册设备成功");
|
|
|
log.setReqData(JsonUtil.toJson(qLinCommunityDevices));
|
|
|
log.setCode(-1);
|
|
|
log.setMessage(e.getMessage());
|
|
|
qinlinApiLogService.recordApiLog(log);
|
|
|
- return R.fail("新增小区异常");
|
|
|
+ return R.fail("注册设备异常");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public R deleteDevice(DoorDevice doorDevice, QLinCommunityDevices qLinCommunityDevices) {
|
|
|
+ public R deleteDevice(DoorDevice doorDevice) {
|
|
|
return null;
|
|
|
}
|
|
|
|