| | |
| | | import com.zy.system.service.ConfigService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | |
| | | @Service("mainService") |
| | | public class MainServiceImpl { |
| | | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | |
| | | try { |
| | | for (int i = 1; i <= 4; i++) {//总共四层楼 |
| | | Object data = redisUtil.get(RedisKeyType.MAP.key + i); |
| | | if (data == null) {//redis地图数据为空,从数据库中获取 |
| | | if (data == null) {//redis地图数据为空 |
| | | BasMap basMap = basMapService.selectLatestMap(i); |
| | | if (basMap == null) { |
| | | //数据库中也不存在地图数据,从地图文件中获取 |
| | | //载入地图 |
| | | List<List<MapNode>> lists = navigateMapData.getJsonData(i, -1, null, null);//获取完整地图(包括入库出库) |
| | | |
| | | //存入数据库 |
| | | basMap = new BasMap(); |
| | | basMap.setData(JSON.toJSONString(lists)); |
| | | basMap.setCreateTime(new Date()); |
| | | basMap.setUpdateTime(new Date()); |
| | | basMap.setLev(i); |
| | | |
| | | if (!basMapService.insert(basMap)) { |
| | | log.info("地图数据存储失败"); |
| | | } |
| | | } |
| | | |
| | | //载入地图 |
| | | List<List<MapNode>> lists = navigateMapData.getJsonData(i, -1, null, null);//获取完整地图(包括入库出库) |
| | | |
| | | //存入数据库 |
| | | basMap.setData(JSON.toJSONString(lists)); |
| | | basMap.setCreateTime(new Date()); |
| | | basMap.setUpdateTime(new Date()); |
| | | basMap.setLev(i); |
| | | |
| | | if (!basMapService.updateById(basMap)) { |
| | | log.info("地图数据存储失败"); |
| | | } |
| | | |
| | | //将数据库地图数据存入redis |
| | | redisUtil.set(RedisKeyType.MAP.key + i, JSON.toJSONString(basMap)); |
| | | } |