|
|
@@ -7,6 +7,7 @@ import com.github.microservice.net.ResultContent;
|
|
|
import com.github.microservice.net.ResultMessage;
|
|
|
import com.zhongshu.card.client.model.devices.*;
|
|
|
import com.zhongshu.card.client.model.org.OrganizationMiniModel;
|
|
|
+import com.zhongshu.card.client.model.org.OrganizationPayInfoModel;
|
|
|
import com.zhongshu.card.client.model.org.UserJoinBusOrgModel;
|
|
|
import com.zhongshu.card.client.model.school.AreaSimpleModel;
|
|
|
import com.zhongshu.card.client.service.school.DeviceInfoService;
|
|
|
@@ -16,6 +17,7 @@ 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.DeviceProduct;
|
|
|
import com.zhongshu.card.server.core.domain.devices.DeviceProductBindDevice;
|
|
|
import com.zhongshu.card.server.core.domain.devices.permiss.DevicePermiss;
|
|
|
import com.zhongshu.card.server.core.domain.org.Organization;
|
|
|
@@ -24,6 +26,7 @@ import com.zhongshu.card.server.core.service.base.CommonService;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.card.server.core.service.devices.deviceProduct.DeviceProductBindDeviceService;
|
|
|
import com.zhongshu.card.server.core.service.devices.permiss.DevicePermissEventService;
|
|
|
+import com.zhongshu.card.server.core.service.devices.permiss.DevicePermissVerifyService;
|
|
|
import com.zhongshu.card.server.core.service.org.OrganizationServiceImpl;
|
|
|
import com.zhongshu.card.server.core.service.orgManager.OrganizationManagerServiceImpl;
|
|
|
import com.zhongshu.card.server.core.service.paySetting.OrgPaySettingJudgmentService;
|
|
|
@@ -82,6 +85,9 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
@Autowired
|
|
|
private DeviceProductBindDeviceService deviceProductBindDeviceService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DevicePermissVerifyService devicePermissVerifyService;
|
|
|
+
|
|
|
/**
|
|
|
* 同步设备 (设备基础信息) 从物联网来
|
|
|
*
|
|
|
@@ -280,6 +286,31 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
return ResultContent.buildSuccess(models);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 判断当前用户关于设备的信息 和 是否有权限
|
|
|
+ *
|
|
|
+ * @param deviceId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResultContent<DeviceInfoMoreModel> getDeviceDetailAndPer(String deviceId) {
|
|
|
+ DeviceInfo deviceInfo = deviceInfoDao.findTopByDeviceId(deviceId);
|
|
|
+
|
|
|
+ // 判断当前用户是否有设备的权限
|
|
|
+ String userId = getCurrentUserId();
|
|
|
+ ResultContent content = devicePermissVerifyService.verifyDevice(userId, deviceId, null);
|
|
|
+ if (content.isFailed()) {
|
|
|
+ return ResultContent.buildFail(content.getMsg());
|
|
|
+ }
|
|
|
+
|
|
|
+ DeviceInfoMoreModel model = null;
|
|
|
+ if (ObjectUtils.isNotEmpty(deviceInfo)) {
|
|
|
+ model = toMoreModel(deviceInfo);
|
|
|
+ model.setPayOrgInfo(getDeviceReceiveOrgInfo(deviceId));
|
|
|
+ }
|
|
|
+ return ResultContent.buildSuccess(model);
|
|
|
+ }
|
|
|
+
|
|
|
public DeviceInfoMoreModel toMoreModel(DeviceInfo entity) {
|
|
|
DeviceInfoMoreModel model = null;
|
|
|
if (ObjectUtils.isNotEmpty(entity)) {
|
|
|
@@ -409,6 +440,31 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
return Lists.newArrayList();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 得到 设备的收款机构
|
|
|
+ *
|
|
|
+ * @param deviceId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public OrganizationPayInfoModel getDeviceReceiveOrgInfo(String deviceId) {
|
|
|
+ DeviceInfo deviceInfo = deviceInfoDao.findTopById(deviceId);
|
|
|
+ if (ObjectUtils.isEmpty(deviceInfo)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ String beLongOid = deviceInfo.getBeLongOid();
|
|
|
+ if (StringUtils.isEmpty(beLongOid)) {
|
|
|
+ // 查询设备绑定的产品 关联的 收款机构
|
|
|
+ DeviceProduct deviceProduct = deviceProductBindDeviceService.getDeviceBindProductInfo(deviceInfo);
|
|
|
+ if (deviceProduct != null) {
|
|
|
+ beLongOid = deviceProduct.getBeLongOid();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(beLongOid)) {
|
|
|
+ return organizationManagerService.toPayInfoModel(organizationServiceImpl.getOrgByOid(beLongOid));
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
public DeviceInfoModel getDeviceInfoModel(String deviceId) {
|
|
|
if (StringUtils.isEmpty(deviceId)) {
|
|
|
return null;
|