|
@@ -379,17 +379,17 @@ public class DeviceService {
|
|
|
/**
|
|
|
* 同步设备
|
|
|
*/
|
|
|
- public boolean synDev(String companyId) {
|
|
|
+ public void synDev(String companyId) throws Exception {
|
|
|
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(companyId)){
|
|
|
- return false;
|
|
|
+ throw new BDException("companyId 不能为空");
|
|
|
}
|
|
|
QueryWrapper<CareOrganization> queryWrapper1 = new QueryWrapper<>();
|
|
|
queryWrapper1.lambda().eq(CareOrganization::getCompanyId,companyId);
|
|
|
CareOrganization careOrganization = this.careOrganizationService.getOne(queryWrapper1);
|
|
|
if (careOrganization == null){
|
|
|
- return false;
|
|
|
+ throw new BDException("机构不存在");
|
|
|
}
|
|
|
|
|
|
// 通过synDevUrl获取data
|
|
@@ -415,17 +415,16 @@ public class DeviceService {
|
|
|
}
|
|
|
if (!list.isEmpty()) {
|
|
|
careDeviceService.synDev(list);
|
|
|
- return true;
|
|
|
} else {
|
|
|
- return false;
|
|
|
+ throw new BDException("同步数据为空");
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- return false;
|
|
|
+ throw new BDException("访问同步接口失败");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- return false;
|
|
|
+ throw new BDException("同步失败",e);
|
|
|
}
|
|
|
|
|
|
}
|