Commit 1be4d6f4 by jiang'yun

修改

parent ef615c77
package com.ruoyi.project.zjsgfa.controller; package com.ruoyi.project.zjsgfa.controller;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -101,4 +104,19 @@ public class SjJygjGdsjgdcsController extends BaseController ...@@ -101,4 +104,19 @@ public class SjJygjGdsjgdcsController extends BaseController
{ {
return toAjax(sjJygjGdsjgdcsService.deleteSjJygjGdsjgdcsByIds(ids)); return toAjax(sjJygjGdsjgdcsService.deleteSjJygjGdsjgdcsByIds(ids));
} }
/**
* 查询井眼轨迹二维:水平投影、垂直投影图
*/
@GetMapping("/jygjEw")
public String jygjEw(SjJygjGdsjgdcs sjJygjGdsjgdcs)
{
Map jsjgt = sjJygjGdsjgdcsService.jygjEw(sjJygjGdsjgdcs);
JSONObject jsonObject = new JSONObject(jsjgt);
String jsonString = jsonObject.toJSONString();
return jsonString;
}
} }
package com.ruoyi.project.zjsgfa.service; package com.ruoyi.project.zjsgfa.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.ruoyi.project.zjsgfa.domain.SjJygjGdsjgdcs; import com.ruoyi.project.zjsgfa.domain.SjJygjGdsjgdcs;
/** /**
...@@ -58,4 +60,7 @@ public interface ISjJygjGdsjgdcsService ...@@ -58,4 +60,7 @@ public interface ISjJygjGdsjgdcsService
* @return 结果 * @return 结果
*/ */
public int deleteSjJygjGdsjgdcsById(Long id); public int deleteSjJygjGdsjgdcsById(Long id);
Map jygjEw(SjJygjGdsjgdcs sjJygjGdsjgdcs);
} }
package com.ruoyi.project.zjsgfa.service.impl; package com.ruoyi.project.zjsgfa.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
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 +97,85 @@ public class SjJygjGdsjgdcsServiceImpl implements ISjJygjGdsjgdcsService ...@@ -92,4 +97,85 @@ public class SjJygjGdsjgdcsServiceImpl implements ISjJygjGdsjgdcsService
{ {
return sjJygjGdsjgdcsMapper.deleteSjJygjGdsjgdcsById(id); return sjJygjGdsjgdcsMapper.deleteSjJygjGdsjgdcsById(id);
} }
@Override
public Map jygjEw(SjJygjGdsjgdcs sjJygjGdsjgdcs) {
List<SjJygjGdsjgdcs> gjlist = sjJygjGdsjgdcsMapper.selectSjJygjGdsjgdcsList(sjJygjGdsjgdcs);
// 水平投影
Map sptymap =new HashMap();
List spList = new ArrayList<>();
sptymap.put("data",spList);
// 垂直投影
Map cztymap =new HashMap();
List czList = new ArrayList<>();
cztymap.put("data",czList);
// 垂直投影坐标范围
Double maxcs = 0.0;
Double maxsp = 0.0;
Double minsp = 0.0;
// 水平投影使用范围
Double maxnb = 0.0;
Double minnb = 0.0;
Double maxdx = 0.0;
Double mindx = 0.0;
maxcs= gjlist.stream().map(SjJygjGdsjgdcs::getCs).max(Double::compare).get();
maxsp= gjlist.stream().map(SjJygjGdsjgdcs::getSpy).max(Double::compare).get();
minsp= gjlist.stream().map(SjJygjGdsjgdcs::getSpy).min(Double::compare).get();
maxnb= gjlist.stream().map(SjJygjGdsjgdcs::getNbwy).max(Double::compare).get();
minnb= gjlist.stream().map(SjJygjGdsjgdcs::getNbwy).min(Double::compare).get();
maxdx= gjlist.stream().map(SjJygjGdsjgdcs::getDxwy).max(Double::compare).get();
mindx= gjlist.stream().map(SjJygjGdsjgdcs::getDxwy).min(Double::compare).get();
for(int i=0;i<gjlist.size();i++){
SjJygjGdsjgdcs dw = gjlist.get(i);
if (dw.getCs()==null||dw.getNbwy()==null||dw.getDxwy()==null||dw.getSpy()==null) {
return back("数据存在空值");
}
Double cs = dw.getCs(); // 垂深
Double sp = dw.getSpy(); // 水平
Double nb = dw.getNbwy(); // 南北
Double dx = dw.getDxwy(); // 东西
Map spd =new HashMap(); // 水平投影的点
spd.put("y",nb); // 给N北 南北位移
spd.put("x",dx); //给E东 东西位移
spList.add(spd);
Map czd =new HashMap(); // 垂直投影的点
czd.put("y",cs); // 垂深
czd.put("x",sp);// 水平位移
czList.add(czd);
}
sptymap.put("xmax",maxdx);
sptymap.put("xmin",mindx);
sptymap.put("ymax",maxnb);
sptymap.put("ymin",minnb);
cztymap.put("xmax",maxsp+500); // +1000
cztymap.put("xmin",minsp-300);
cztymap.put("ymax",maxcs+500);// +1000
cztymap.put("ymin",0);
Map map =new HashMap();
map.put("code",200);
map.put("msg","成功");
map.put("sptymap",sptymap);
map.put("cztymap",cztymap);
return map;
}
public static Map back(String msg) {
Map map =new HashMap();
map.put("code",500);
map.put("msg",msg);
return map;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment