|
|
@@ -13,6 +13,7 @@ import com.zhongshu.card.client.type.OnLineState;
|
|
|
import com.zhongshu.card.server.core.dao.devices.DeviceInfoDao;
|
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationDao;
|
|
|
import com.zhongshu.card.server.core.dao.school.AreaDao;
|
|
|
+import com.zhongshu.card.server.core.dataConfig.DeviceConfig;
|
|
|
import com.zhongshu.card.server.core.domain.devices.DeviceInfo;
|
|
|
import com.zhongshu.card.server.core.domain.devices.DevicePermiss;
|
|
|
import com.zhongshu.card.server.core.domain.org.Organization;
|
|
|
@@ -275,26 +276,35 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
}
|
|
|
deviceInfo.setArea(area);
|
|
|
deviceInfo.setAreaPaths(String.join("/", strings));
|
|
|
+ deviceInfo.setDeviceName(param.getDeviceName());
|
|
|
|
|
|
// 设备所属机构
|
|
|
Organization organization = null;
|
|
|
if (StringUtils.isNotEmpty(param.getBeLongOid())) {
|
|
|
organization = organizationDao.findTopByOid(param.getBeLongOid());
|
|
|
+ if (ObjectUtils.isEmpty(organization)) {
|
|
|
+ return ResultContent.buildFail("所属机构不存在");
|
|
|
+ }
|
|
|
+ deviceInfo.setBeLongName(organization.getName());
|
|
|
}
|
|
|
deviceInfo.setOrganization(organization);
|
|
|
deviceInfo.setBeLongOid(param.getBeLongOid());
|
|
|
- deviceInfo.setBeLongName(organization.getName());
|
|
|
+
|
|
|
if (StringUtils.isEmpty(deviceInfo.getProjectOid())) {
|
|
|
Organization project = organizationDao.findTopByCode(deviceInfo.getProjectInfoCode());
|
|
|
if (ObjectUtils.isNotEmpty(project)) {
|
|
|
deviceInfo.setProjectOid(project.getOid());
|
|
|
}
|
|
|
}
|
|
|
- // 检查设备关联的结构,是否可以收款
|
|
|
- ResultContent resultContent = orgPaySettingJudgmentService.checkOrgPaySetting(deviceInfo.getProjectOid(), deviceInfo.getBeLongOid());
|
|
|
- if (resultContent.isFailed()) {
|
|
|
- return ResultContent.buildFail(resultContent.getMsg());
|
|
|
+
|
|
|
+ if(ObjectUtils.isNotEmpty(organization)) {
|
|
|
+ // 检查设备关联的机构,是否可以收款
|
|
|
+ ResultContent resultContent = orgPaySettingJudgmentService.checkOrgPaySetting(deviceInfo.getProjectOid(), deviceInfo.getBeLongOid());
|
|
|
+ if (resultContent.isFailed()) {
|
|
|
+ return ResultContent.buildFail(resultContent.getMsg());
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
deviceInfoDao.save(deviceInfo);
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
@@ -322,7 +332,7 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
public void initCheckDeviceOnLine() {
|
|
|
List<DeviceInfo> list = deviceInfoDao.findAll();
|
|
|
if (ObjectUtils.isNotEmpty(list)) {
|
|
|
- long maxTime = 24 * 60 * 60 * 1000;
|
|
|
+ long maxTime = DeviceConfig.maxInitCheckDeviceLineStateTime;
|
|
|
List<DeviceInfo> deviceInfos = new ArrayList<>();
|
|
|
for (DeviceInfo deviceInfo : list) {
|
|
|
if (deviceInfo.getLastOnlineTime() == null || (System.currentTimeMillis() - deviceInfo.getLastOnlineTime()) > maxTime) {
|
|
|
@@ -336,6 +346,18 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 得到、封装设备的扩展信息
|
|
|
+ *
|
|
|
+ * @param deviceId
|
|
|
+ */
|
|
|
+ public void getDeviceAboutInfo(String deviceId) {
|
|
|
+ DeviceInfo deviceInfo = deviceInfoDao.findTopById(deviceId);
|
|
|
+ if (ObjectUtils.isNotEmpty(deviceInfo)) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 设备基础信息
|
|
|
*
|