|
@@ -1,10 +1,14 @@
|
|
package com.sooka.sponest.data.digitalforest.service.impl;
|
|
package com.sooka.sponest.data.digitalforest.service.impl;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
|
+import com.ruoyi.common.core.utils.StringUtils;
|
|
import com.ruoyi.common.datascope.annotation.DataScopeMutiDept;
|
|
import com.ruoyi.common.datascope.annotation.DataScopeMutiDept;
|
|
|
|
+import com.ruoyi.common.security.utils.DictUtils;
|
|
import com.sooka.sponest.data.base.service.impl.BaseServiceImpl;
|
|
import com.sooka.sponest.data.base.service.impl.BaseServiceImpl;
|
|
import com.sooka.sponest.data.digitalforest.domain.*;
|
|
import com.sooka.sponest.data.digitalforest.domain.*;
|
|
import com.sooka.sponest.data.digitalforest.mapper.ForestViewNewMapper;
|
|
import com.sooka.sponest.data.digitalforest.mapper.ForestViewNewMapper;
|
|
import com.sooka.sponest.data.digitalforest.service.IForestViewNewService;
|
|
import com.sooka.sponest.data.digitalforest.service.IForestViewNewService;
|
|
|
|
+import com.sooka.sponest.data.digitalwater.domain.CenterdataTHydraulicPatrolTask;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -92,4 +96,46 @@ public class ForestViewNewServiceImpl extends BaseServiceImpl implements IForest
|
|
return forestViewNewMapper.selectCyryList(centerdataTForestCyry);
|
|
return forestViewNewMapper.selectCyryList(centerdataTForestCyry);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @DataScopeMutiDept(deptAlias = "d")
|
|
|
|
+ @Override
|
|
|
|
+ public List<Map<String, Object>> selectTaskList(CenterdataTHydraulicPatrolTask task) {
|
|
|
|
+ setSookaDataBase(task);
|
|
|
|
+ List<Map<String,Object>> list = forestViewNewMapper.selectTaskList(task);
|
|
|
|
+ list.forEach(item -> {
|
|
|
|
+ item.put("rangLabel",DictUtils.getDictDataByValue("forest_lin_level",item.get("rank").toString()));
|
|
|
|
+ item.put("periodLabel",DictUtils.getDictDataByValue("centerdataplanning_cycle",item.get("period").toString()));
|
|
|
|
+ if (StringUtils.isNotBlank(item.get("patrolTrajectory").toString())) {
|
|
|
|
+ item.put("planLength",getPlanLength(item.get("patrolTrajectory").toString()));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private String getPlanLength(String patrolTrajectory) {
|
|
|
|
+ double juli = 0.0;
|
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(patrolTrajectory);
|
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ // 纬度
|
|
|
|
+ double lat1 = Math.toRadians(jsonArray.getJSONObject(i - 1).getDouble("lat"));
|
|
|
|
+ double lat2 = Math.toRadians(jsonArray.getJSONObject(i).getDouble("lat"));
|
|
|
|
+ // 经度
|
|
|
|
+ double lng1 = Math.toRadians(jsonArray.getJSONObject(i - 1).getDouble("lng"));
|
|
|
|
+ double lng2 = Math.toRadians(jsonArray.getJSONObject(i).getDouble("lng"));
|
|
|
|
+ // 纬度之差
|
|
|
|
+ double a = lat1 - lat2;
|
|
|
|
+ // 经度之差
|
|
|
|
+ double b = lng1 - lng2;
|
|
|
|
+ // 计算两点距离的公式
|
|
|
|
+ double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
|
|
|
|
+ Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(b / 2), 2)));
|
|
|
|
+ // 弧长乘地球半径, 返回单位: 千米
|
|
|
|
+ juli += s * 6378.137;
|
|
|
|
+ }
|
|
|
|
+ return String.format("%.2f", juli);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|