| | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.* |
| | | import cn.flightfeather.supervision.domain.ds1.repository.DeviceRep |
| | | import cn.flightfeather.supervision.lightshare.service.DeviceService |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import cn.flightfeather.supervision.lightshare.vo.DataHead |
| | | import cn.flightfeather.supervision.lightshare.vo.MonitorDeviceInfoVo |
| | | import com.google.gson.Gson |
| | | import org.springframework.beans.factory.annotation.Value |
| | | import org.springframework.stereotype.Service |
| | |
| | | return when (deviceType) { |
| | | Constant.DeviceType.MONITOR_DEVICE -> { |
| | | val info = Gson().fromJson(deviceInfo, MonitorDeviceInfo::class.java) |
| | | info.diCreateTime = Date() |
| | | deviceRep.insertDevice(info) |
| | | } |
| | | Constant.DeviceType.TREATMENT_DEVICE -> { |
| | | val info = Gson().fromJson(deviceInfo, TreatmentDeviceInfo::class.java) |
| | | info.piCreateTime = Date() |
| | | deviceRep.insertDevice(info) |
| | | } |
| | | Constant.DeviceType.PRODUCTION_DEVICE -> { |
| | | val info = Gson().fromJson(deviceInfo, ProductionDeviceInfo::class.java) |
| | | info.wiCreateTime = Date() |
| | | deviceRep.insertDevice(info) |
| | | } |
| | | } |
| | |
| | | deviceId: Int, |
| | | deviceType: Constant.DeviceType, |
| | | ): List<DeviceStatus> { |
| | | return emptyList() |
| | | return deviceRep.findStatuses(DeviceStatus().apply { |
| | | dlDeviceId = deviceId |
| | | dlDeviceType = deviceType.value |
| | | dlSceneGuid = sceneId |
| | | }) |
| | | } |
| | | |
| | | override fun insertDeviceLocation(deviceLocation: String, files: Array<MultipartFile>): Int { |
| | | val obj = JsonUtil.gson.fromJson(deviceLocation, DeviceStatus::class.java) |
| | | val time = DateUtil.DateToString(obj.dlCreateTime, DateUtil.DateStyle.YYYY_MM_DD) |
| | | val picPath = FileUtil.saveFiles(files, imgPath, "device/${obj.dlId}/${time}") |
| | | val picPath = FileUtil.saveFiles(files, imgPath, "device/${obj.dlSceneGuid}/${obj.dlDeviceId}/${time}") |
| | | obj.dlPicUrl = picPath.joinToString(";") |
| | | obj.dlCreateTime = Date() |
| | | return deviceRep.insertStatus(obj) |
| | |
| | | obj.dlPicUrl = oldImg.joinToString(";") |
| | | return deviceRep.updateStatus(obj) |
| | | } |
| | | |
| | | override fun searchExternalDevice( |
| | | areaVo: AreaVo, keyword: String, page: Int?, perPage: Int?, |
| | | ): Pair<DataHead, MonitorDeviceInfoVo> { |
| | | TODO("Not yet implemented") |
| | | } |
| | | } |