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