|
|
@ -9,7 +9,9 @@ import com.ruoyi.common.core.domain.AjaxResult; |
|
|
|
import com.ruoyi.common.exception.ServiceException; |
|
|
|
import com.ruoyi.common.utils.PageUtils; |
|
|
|
import com.ruoyi.common.utils.StakeMarkUtils; |
|
|
|
import com.zc.business.domain.DcRoadSection; |
|
|
|
import com.zc.business.domain.DcStakeMark; |
|
|
|
import com.zc.business.mapper.DcRoadSectionMapper; |
|
|
|
import com.zc.business.mapper.DcStakeMarkMapper; |
|
|
|
import com.zc.business.service.IDcStakeMarkService; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -30,6 +32,8 @@ public class DcStakeMarkServiceImpl extends ServiceImpl<DcStakeMarkMapper, DcSta |
|
|
|
|
|
|
|
@Resource |
|
|
|
private DcStakeMarkMapper dcStakeMarkMapper; |
|
|
|
@Resource |
|
|
|
private DcRoadSectionMapper dcRoadSectionMapper; |
|
|
|
|
|
|
|
public LambdaQueryWrapper<DcStakeMark> stakeMarkQueryWrapper(DcStakeMark dcStakeMark) { |
|
|
|
|
|
|
@ -142,7 +146,7 @@ public class DcStakeMarkServiceImpl extends ServiceImpl<DcStakeMarkMapper, DcSta |
|
|
|
* @return com.ruoyi.common.core.domain.AjaxResult |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public AjaxResult importJsonStakeMark(String filePath) throws IOException { |
|
|
|
public AjaxResult importJsonStakeMark(String filePath,String direction) throws IOException { |
|
|
|
|
|
|
|
Date methodStart = new Date(); |
|
|
|
File file = new File(filePath); |
|
|
@ -159,6 +163,8 @@ public class DcStakeMarkServiceImpl extends ServiceImpl<DcStakeMarkMapper, DcSta |
|
|
|
Map<String, Map<String,Object>> map = JSON.parseObject(jsonStr, new TypeReference<HashMap<String, Map<String,Object>>>() {}); |
|
|
|
List<DcStakeMark> stakeMarkList = new ArrayList<>(); |
|
|
|
|
|
|
|
List<DcRoadSection> dcRoadSectionList = dcRoadSectionMapper.selectDcRoadSectionList(null); |
|
|
|
|
|
|
|
//桩号格式校验
|
|
|
|
List<String> errorKey = new ArrayList<>(); |
|
|
|
map.keySet().forEach(key ->{ |
|
|
@ -170,9 +176,11 @@ public class DcStakeMarkServiceImpl extends ServiceImpl<DcStakeMarkMapper, DcSta |
|
|
|
|
|
|
|
dcStakeMark.setLongitude(map.get(key).containsKey("lng") ? map.get(key).get("lng").toString() : ""); |
|
|
|
dcStakeMark.setLatitude(map.get(key).containsKey("lat") ? map.get(key).get("lat").toString() : ""); |
|
|
|
dcStakeMark.setDirection("1"); |
|
|
|
dcStakeMark.setSectionId(1L); |
|
|
|
dcStakeMark.setMileage(Long.valueOf(StakeMarkUtils.formatMetre(key))); |
|
|
|
dcStakeMark.setDirection(direction); |
|
|
|
|
|
|
|
Long sectionId = getRoadSection(dcRoadSectionList,key); |
|
|
|
dcStakeMark.setSectionId(sectionId); |
|
|
|
dcStakeMark.setMileage(StakeMarkUtils.formatMetreLong(key)); |
|
|
|
stakeMarkList.add(dcStakeMark); |
|
|
|
}); |
|
|
|
|
|
|
@ -189,5 +197,23 @@ public class DcStakeMarkServiceImpl extends ServiceImpl<DcStakeMarkMapper, DcSta |
|
|
|
return AjaxResult.success(); |
|
|
|
} |
|
|
|
|
|
|
|
private Long getRoadSection(List<DcRoadSection> roadSectionList,String stakeMark){ |
|
|
|
|
|
|
|
if (roadSectionList == null || roadSectionList.size() < 1){ |
|
|
|
return null; |
|
|
|
} |
|
|
|
Long metre = StakeMarkUtils.formatMetreLong(stakeMark); |
|
|
|
for (DcRoadSection dcRoadSection : roadSectionList) { |
|
|
|
Long startStakeMark = StakeMarkUtils.formatMetreLong(dcRoadSection.getStartStakeMark()); |
|
|
|
Long endStakeMark = StakeMarkUtils.formatMetreLong(dcRoadSection.getEndStakeMark()); |
|
|
|
if (metre >= startStakeMark && metre < endStakeMark){ |
|
|
|
return dcRoadSection.getId(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|