|
@@ -15,12 +15,14 @@ import com.care.common.vo.PageReqVO;
|
|
|
import com.care.common.vo.UserLogindConvertVO;
|
|
|
import com.care.common.vo.device.DeviceVO;
|
|
|
import com.care.common.vo.order.ChambEventOrderVO;
|
|
|
+import com.google.common.collect.Maps;
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 被监护人-设备(CareDevice)表服务实现类
|
|
@@ -30,8 +32,26 @@ import java.util.List;
|
|
|
*/
|
|
|
@Service
|
|
|
public class CareDeviceServiceImpl extends ServiceImpl<CareDeviceMapper, CareDevice> implements CareDeviceService {
|
|
|
- @Value("${device.3d.url:#{null}}")
|
|
|
- private String url3D;
|
|
|
+ @Value("${device.3d.url.host:#{null}}")
|
|
|
+ private String url3DUrlHost;
|
|
|
+ @Value("${device.3d.url.path:#{null}}")
|
|
|
+ private String url3DUrlPath;
|
|
|
+ @Override
|
|
|
+ public Map<String,String> get3dUrl(Long deviceId) {
|
|
|
+ Map<String,String> map = Maps.newHashMap();
|
|
|
+ CareDevice device = this.baseMapper.selectById(deviceId);
|
|
|
+ if (device!=null && StrUtil.isNotEmpty(device.getTopic())){
|
|
|
+ try {
|
|
|
+ String topic = java.net.URLEncoder.encode(device.getTopic(),"UTF-8");
|
|
|
+ String toWx = url3DUrlHost + url3DUrlPath + topic;
|
|
|
+ map.put("toWX",toWx);
|
|
|
+ map.put("toBms", url3DUrlPath + topic);
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
/**
|
|
|
* 查询房屋的设备列表
|
|
|
*
|
|
@@ -55,18 +75,7 @@ public class CareDeviceServiceImpl extends ServiceImpl<CareDeviceMapper, CareDev
|
|
|
return pageRes;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public String get3dUrl(Long deviceId) {
|
|
|
- CareDevice device = this.baseMapper.selectById(deviceId);
|
|
|
- if (device!=null && StrUtil.isNotEmpty(device.getTopic())){
|
|
|
- try {
|
|
|
- return url3D + java.net.URLEncoder.encode(device.getTopic(),"UTF-8");
|
|
|
- } catch (UnsupportedEncodingException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
public static void main(String[] args) throws UnsupportedEncodingException {
|
|
|
System.out.println(java.net.URLEncoder.encode("5JPD/monitor/f1/event","UTF-8"));
|