| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | |
| | | */ |
| | | @Override |
| | | @Scheduled(cron = "0 0 0 * * ?") |
| | | // @Scheduled(cron = "*/10 * * * * ?") |
| | | public int syncXingtuDevice() throws Exception { |
| | | int total = 0; |
| | | total += syncPilotDevices(); |
| | | // 2.同步机巢设备 |
| | | total += syncAirportDevices(); |
| | | // 1.同步无人机设备 |
| | | total += syncPilotDevices(); |
| | | log.info("更新或新增设备"+total); |
| | | return total; |
| | | } |
| | |
| | | if (StringUtil.isBlank(entity.getAirportId())) { |
| | | return false; |
| | | } |
| | | // 获取设备信息 |
| | | GdManageDeviceEntity exist = lambdaQuery() |
| | | .eq(GdManageDeviceEntity::getAirportId, entity.getAirportId()) |
| | | .one(); |
| | | // 获取父级设备信息 |
| | | GdManageDeviceEntity parent = getOne(Wrappers.<GdManageDeviceEntity>lambdaQuery().eq(GdManageDeviceEntity::getChildSn, entity.getDeviceSn())); |
| | | if (exist != null) { |
| | | entity.setId(exist.getId()); |
| | | if (entity.getLongitude() == null) { |
| | |
| | | } |
| | | if (entity.getInsureExpiredTime() == null) { |
| | | entity.setInsureExpiredTime(exist.getInsureExpiredTime()); |
| | | } |
| | | // 获取父级设备位置信息 |
| | | if (parent != null) { |
| | | entity.setLongitude(parent.getLongitude()); |
| | | entity.setLatitude(parent.getLatitude()); |
| | | } |
| | | } |
| | | return saveOrUpdateDevice(entity); |
| | |
| | | entity.setModeCode(parseModeCode(item.getStatus())); |
| | | entity.setInsureExpiredTime(parseInsuranceDate(item.getInsuranceInfo())); |
| | | entity.setAreaCode(extractAreaCode(item.getRegionCode())); |
| | | entity.setIsWithDock(item.getIsWithDock()); |
| | | return entity; |
| | | } |
| | | |