|
|
@@ -323,6 +323,7 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
|
|
|
/**
|
|
|
* 设备包含的 商品、、收款机构等信息 转换
|
|
|
+ *
|
|
|
* @param entity
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -345,6 +346,7 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
if (ObjectUtils.isEmpty(deviceInfo)) {
|
|
|
return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getId()));
|
|
|
}
|
|
|
+
|
|
|
Area area = null;
|
|
|
List<String> strings = new ArrayList<>();
|
|
|
// 修改设备 只能绑定 区域 所属机构等信息
|
|
|
@@ -365,7 +367,7 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
deviceInfo.setAreaPaths(String.join("/", strings));
|
|
|
deviceInfo.setDeviceName(param.getDeviceName());
|
|
|
|
|
|
- // 设备所属机构
|
|
|
+ // 设备收款机构
|
|
|
Organization organization = null;
|
|
|
if (StringUtils.isNotEmpty(param.getBeLongOid())) {
|
|
|
organization = organizationDao.findTopByOid(param.getBeLongOid());
|
|
|
@@ -377,6 +379,31 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
deviceInfo.setOrganization(organization);
|
|
|
deviceInfo.setBeLongOid(param.getBeLongOid());
|
|
|
|
|
|
+ // 设备所属机构
|
|
|
+ Organization beToOrganization = null;
|
|
|
+ if (StringUtils.isNotEmpty(param.getBeToOid())) {
|
|
|
+ beToOrganization = organizationDao.findTopByOid(param.getBeToOid());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotEmpty(beToOrganization)) {
|
|
|
+ deviceInfo.setAboutOid(beToOrganization.getOid());
|
|
|
+ deviceInfo.setBeToName(beToOrganization.getName());
|
|
|
+ } else {
|
|
|
+ deviceInfo.setBeToName("");
|
|
|
+ deviceInfo.setBeToOid("");
|
|
|
+ }
|
|
|
+
|
|
|
+ Organization billOrganization = null;
|
|
|
+ if (StringUtils.isNotEmpty(param.getBillOid())) {
|
|
|
+ billOrganization = organizationDao.findTopByOid(param.getBillOid());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotEmpty(billOrganization)) {
|
|
|
+ deviceInfo.setBillOid(billOrganization.getOid());
|
|
|
+ deviceInfo.setBillName(billOrganization.getName());
|
|
|
+ } else {
|
|
|
+ deviceInfo.setBillName("");
|
|
|
+ deviceInfo.setBillOid("");
|
|
|
+ }
|
|
|
+
|
|
|
if (StringUtils.isEmpty(deviceInfo.getProjectOid())) {
|
|
|
Organization project = organizationDao.findTopByCode(deviceInfo.getProjectInfoCode());
|
|
|
if (ObjectUtils.isNotEmpty(project)) {
|
|
|
@@ -399,23 +426,6 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 查询设备所属机构(设备绑定的那个机构)
|
|
|
- *
|
|
|
- * @param deviceId
|
|
|
- * @return
|
|
|
- */
|
|
|
- public Organization getDeviceBelongTo(String deviceId) {
|
|
|
- Organization organization = null;
|
|
|
- if (StringUtils.isNotEmpty(deviceId)) {
|
|
|
- DeviceInfo deviceInfo = deviceInfoDao.findTopById(deviceId);
|
|
|
- if (ObjectUtils.isNotEmpty(deviceInfo)) {
|
|
|
- organization = deviceInfo.getOrganization();
|
|
|
- }
|
|
|
- }
|
|
|
- return organization;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 启动平台时检查设备 (有些设备没有使用了,没有改变在线状态)
|
|
|
*/
|
|
|
@@ -436,18 +446,6 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 得到、封装设备的扩展信息
|
|
|
- *
|
|
|
- * @param deviceId
|
|
|
- */
|
|
|
- public void getDeviceAboutInfo(String deviceId) {
|
|
|
- DeviceInfo deviceInfo = deviceInfoDao.findTopById(deviceId);
|
|
|
- if (ObjectUtils.isNotEmpty(deviceInfo)) {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public List<DeviceInfo> getDevicesByDeviceIds(List<String> deviceIds) {
|
|
|
if (ObjectUtils.isNotEmpty(deviceIds)) {
|
|
|
return deviceInfoDao.findByDeviceIdIn(deviceIds);
|
|
|
@@ -501,10 +499,18 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
DeviceInfoModel model = null;
|
|
|
if (ObjectUtils.isNotEmpty(entity)) {
|
|
|
model = new DeviceInfoModel();
|
|
|
- // 所属机构信息
|
|
|
+ // 收款机构信息
|
|
|
OrganizationMiniModel miniModel = organizationManagerService.toMiniModel(entity.getOrganization());
|
|
|
model.setOrganization(miniModel);
|
|
|
|
|
|
+ // 所属机构
|
|
|
+ OrganizationMiniModel beToMiniModel = organizationManagerService.toMiniModel(organizationServiceImpl.getOrgByOid(entity.getBeToOid()));
|
|
|
+ model.setBeToOrganization(beToMiniModel);
|
|
|
+
|
|
|
+ OrganizationMiniModel billMiniModel = organizationManagerService.toMiniModel(organizationServiceImpl.getOrgByOid(entity.getBillOid()));
|
|
|
+ model.setBillOrganization(billMiniModel);
|
|
|
+
|
|
|
+
|
|
|
BeanUtils.copyProperties(entity, model);
|
|
|
model.setProjectInfoName(organizationServiceImpl.getOrgNameByCode(entity.getProjectInfoCode()));
|
|
|
|
|
|
@@ -564,6 +570,7 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
Organization organization = null;
|
|
|
if (ObjectUtils.isNotEmpty(deviceInfo)) {
|
|
|
String oid = deviceInfo.getBeLongOid();
|
|
|
+
|
|
|
if (StringUtils.isEmpty(oid)) {
|
|
|
// 查找产品绑定的产品
|
|
|
DeviceProductBindDevice bindInfo = deviceProductBindDeviceService.getDeviceBindInfo(deviceInfo);
|
|
|
@@ -579,6 +586,23 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
return organization;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 得到所属机构
|
|
|
+ *
|
|
|
+ * @param deviceInfo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Organization getDeviceBeToOrganization(DeviceInfo deviceInfo) {
|
|
|
+ Organization organization = null;
|
|
|
+ if (ObjectUtils.isNotEmpty(deviceInfo)) {
|
|
|
+ String oid = deviceInfo.getBeToOid();
|
|
|
+ if (StringUtils.isNotEmpty(oid)) {
|
|
|
+ organization = organizationDao.findTopByOid(oid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return organization;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 设备信息 简单模型
|
|
|
*
|