|  |  | 
 |  |  | package com.dy.pipIrrBase.dict; | 
 |  |  |  | 
 |  |  | import com.dy.pipIrrGlobal.daoBa.BaDictItemMapper; | 
 |  |  | import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper; | 
 |  |  | import com.dy.pipIrrGlobal.voBa.VoDictItem; | 
 |  |  | import com.dy.pipIrrGlobal.voBa.VoMapCenter; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | import java.math.BigDecimal; | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Optional; | 
 |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private BaDictItemMapper dictItemMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private BaSettingsMapper baSettingsMapper; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据字典Code获取字典项 | 
 |  |  |      * @param dictCode | 
 |  |  | 
 |  |  |         List<VoDictItem> rs = Optional.ofNullable(dictItemMapper.getDictItemsByDictCode(dictCode)).orElse(new ArrayList<>()); | 
 |  |  |         return rs ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据配置项名称获取配置项值 | 
 |  |  |      * @param itemName | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public String getItemValue(String itemName) { | 
 |  |  |         return baSettingsMapper.getItemValue(itemName); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获取地图中心坐标 | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public VoMapCenter getMapCenter() { | 
 |  |  |         BigDecimal lat = new BigDecimal(baSettingsMapper.getItemValue("lat")); | 
 |  |  |         BigDecimal lng = new BigDecimal(baSettingsMapper.getItemValue("lng")); | 
 |  |  |  | 
 |  |  |         Integer zoomMp = Integer.parseInt(Optional.ofNullable(baSettingsMapper.getItemValue("zoomMp")).orElse("0")); | 
 |  |  |         Integer zoomPc = Integer.parseInt(Optional.ofNullable(baSettingsMapper.getItemValue("zoomPc")).orElse("0")); | 
 |  |  |  | 
 |  |  |         VoMapCenter po = new VoMapCenter(); | 
 |  |  |         po.setLat(lat); | 
 |  |  |         po.setLng(lng); | 
 |  |  |         po.setZoomMp(zoomMp); | 
 |  |  |         po.setZoomPc(zoomPc); | 
 |  |  |         return po; | 
 |  |  |     } | 
 |  |  | } |