Commit 7ad0d18f by jiang'yun

修改

parent 40031266
...@@ -248,6 +248,9 @@ public class DjdcController { ...@@ -248,6 +248,9 @@ public class DjdcController {
//// map.put("sldf","数量得分"); //// map.put("sldf","数量得分");
// map.put("zhdf","综合得分"); // map.put("zhdf","综合得分");
return AjaxResult.success( djdcService.getDzfcList(param),map); return AjaxResult.success( djdcService.getDzfcList(param),map);
case "getFdcsList":
//获取分段方案参数
return AjaxResult.success( djdcService.getFdcsList(param));
default: default:
return AjaxResult.success(); return AjaxResult.success();
} }
...@@ -308,6 +311,11 @@ public class DjdcController { ...@@ -308,6 +311,11 @@ public class DjdcController {
ExcelUtil<LjSzfxjg> utilSzfxjg = new ExcelUtil<LjSzfxjg>(LjSzfxjg.class); ExcelUtil<LjSzfxjg> utilSzfxjg = new ExcelUtil<LjSzfxjg>(LjSzfxjg.class);
utilSzfxjg.exportExcel(response, ljSzfxjgList, "Sheet1"); utilSzfxjg.exportExcel(response, ljSzfxjgList, "Sheet1");
break; break;
case "exportFdcsList":
//导出实钻分析结果
List<Jsha> fdcsList = djdcService.getFdcsList(param);
exportFdcs(response,fdcsList);
break;
default: default:
break; break;
} }
...@@ -395,7 +403,84 @@ public class DjdcController { ...@@ -395,7 +403,84 @@ public class DjdcController {
public void exportFdcs(HttpServletResponse response,List<Jsha> list)throws IOException {
Workbook exl = null;
OutputStream out = null;
InputStream in = null;
try {
in =this.getClass().getResourceAsStream("/static/excel/ljfdcs.xlsx");
exl = WorkbookFactory.create(in);
out = response.getOutputStream();
response.reset();
String filename = URLEncoder.encode("导入模板.xlsx", "UTF-8");
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-Disposition", "attachment;filename=" + filename);
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
Sheet sheet = exl.getSheet("Sheet1");
CellStyle cellStyle = exl.createCellStyle();
cellStyle.setAlignment(HorizontalAlignment.CENTER);
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN);//左边框
cellStyle.setBorderTop(BorderStyle.THIN);//上边框
cellStyle.setBorderRight(BorderStyle.THIN);//右边框
cellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
cellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
cellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());
cellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());
Font cellFont = exl.createFont();
cellFont.setFontHeightInPoints((short)9); // 字体大小
cellFont.setFontName("宋体"); // 字体应用到当前单元格上
cellStyle.setFont(cellFont);
cellStyle.setWrapText(true);//设置自动换行
int lastRow = sheet.getLastRowNum()+1;
for(Jsha item:list){
Row row = sheet.createRow(lastRow);
row.setHeightInPoints(18);
int m = 0;
Cell cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getJh());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getKc());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getZy());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getZs());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getGj());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getBs());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getPl());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getLgby());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getZtyj());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getHkyh());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getCjl());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getPssd());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getZtsgl());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getBsgl());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getSfsdzg());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getSfsdzt());
cell = row.createCell(m++);cell.setCellStyle(cellStyle); cell.setCellValue(item.getGllyl());
lastRow++;
}
exl.write(out);
exl.close();
}catch (Exception e){
e.getMessage();
throw new IOException();
}finally{
if (exl != null) {
try {
exl.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
if (out != null) {
try {
out.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
......
...@@ -7,6 +7,7 @@ import java.util.Date; ...@@ -7,6 +7,7 @@ import java.util.Date;
@Data @Data
public class Jsha { public class Jsha {
private String jh; private String jh;
private String kc;
private Integer xh; private Integer xh;
private String ztxlh; private String ztxlh;
private String ztxh; private String ztxh;
......
...@@ -37,4 +37,6 @@ public interface DjdcInfoMapper { ...@@ -37,4 +37,6 @@ public interface DjdcInfoMapper {
List<DjZtfx> getDjZtfxList(CommonParam param); List<DjZtfx> getDjZtfxList(CommonParam param);
List<Jsha> getFdcsList(CommonParam param);
} }
...@@ -47,4 +47,6 @@ public interface DjdcService { ...@@ -47,4 +47,6 @@ public interface DjdcService {
List<LjSzfxjg> getSztfxjgList(List<DjZtfx> djZtfxList, List<Djjc> djjcList, CommonParam param); List<LjSzfxjg> getSztfxjgList(List<DjZtfx> djZtfxList, List<Djjc> djjcList, CommonParam param);
List<Jsha> getFdcsList(CommonParam param);
} }
...@@ -657,17 +657,20 @@ public class DjdcServiceImpl implements DjdcService { ...@@ -657,17 +657,20 @@ public class DjdcServiceImpl implements DjdcService {
// } // }
//查询进尺和时效 //查询进尺和时效
DjZjzhfx djZjzhfx=djdcInfoMapper.getJshaJc(item.getJh(),item.getKsjs(),item.getJs()); if(item.getKsjs()!=null && item.getJs()!=null){
if(djZjzhfx!=null){ DjZjzhfx djZjzhfx=djdcInfoMapper.getJshaJc(item.getJh(),item.getKsjs(),item.getJs());
Double jc = djZjzhfx.getJc(); if(djZjzhfx!=null){
Double jcsjhj = djZjzhfx.getJcsjhj(); Double jc = djZjzhfx.getJc();
item.setJc(jc); Double jcsjhj = djZjzhfx.getJcsjhj();
item.setJcsjhj(jcsjhj); item.setJc(jc);
if(jcsjhj>0){ item.setJcsjhj(jcsjhj);
double zb =jc/jcsjhj; if(jcsjhj>0){
item.setZb(Double.parseDouble(df.format(zb))); double zb =jc/jcsjhj;
item.setZb(Double.parseDouble(df.format(zb)));
}
} }
} }
} }
...@@ -917,7 +920,7 @@ public class DjdcServiceImpl implements DjdcService { ...@@ -917,7 +920,7 @@ public class DjdcServiceImpl implements DjdcService {
//钻头关键数据(匹配数据) //钻头关键数据(匹配数据)
List<SjInfo> collect3=new ArrayList<>(); List<SjInfo> collect3=new ArrayList<>();
List<Djjc> ztppList = djjcList.stream().filter(dj -> equals(dj.getZtcc(),info.getZtcc() ) && dj.getKc().equals(info.getKc())).collect(Collectors.toList()); List<Djjc> ztppList = djjcList.stream().filter(dj -> equals(dj.getZtcc(),info.getZtcc() ) && info.getKc().equals(dj.getKc())).collect(Collectors.toList());
ztppList.forEach(ztpp->{ ztppList.forEach(ztpp->{
SjInfo sjInfo=new SjInfo(); SjInfo sjInfo=new SjInfo();
sjInfo.setKc(ztpp.getKc()); sjInfo.setKc(ztpp.getKc());
...@@ -1409,6 +1412,16 @@ public class DjdcServiceImpl implements DjdcService { ...@@ -1409,6 +1412,16 @@ public class DjdcServiceImpl implements DjdcService {
return ljSzfxjgList; return ljSzfxjgList;
} }
@Override
public List<Jsha> getFdcsList(CommonParam param) {
if(StringUtils.isNotEmpty(param.getJh())){
String[] jhs = param.getJh().split(",");
param.setJhs(jhs);
}
List<Jsha> jshaList=djdcInfoMapper.getFdcsList(param);
return jshaList;
}
public static void calculateScores(List<SjInfo> items) { public static void calculateScores(List<SjInfo> items) {
// 按进尺降序排序 // 按进尺降序排序
...@@ -1485,8 +1498,15 @@ public class DjdcServiceImpl implements DjdcService { ...@@ -1485,8 +1498,15 @@ public class DjdcServiceImpl implements DjdcService {
} }
public static boolean equals(double a, double b) { public static boolean equals(Double a, Double b) {
// 注意:要使用String类型的构造函数,防止精度丢失 // 注意:要使用String类型的构造函数,防止精度丢失
if(a==null){
return false;
}
// 注意:要使用String类型的构造函数,防止精度丢失
if(b==null){
return false;
}
BigDecimal bd1 = new BigDecimal(Double.toString(a)); BigDecimal bd1 = new BigDecimal(Double.toString(a));
BigDecimal bd2 = new BigDecimal(Double.toString(b)); BigDecimal bd2 = new BigDecimal(Double.toString(b));
return bd1.compareTo(bd2) == 0; return bd1.compareTo(bd2) == 0;
......
...@@ -51,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -51,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if> <if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if> <if test="createdTime != null "> and created_time = #{createdTime}</if>
</where> </where>
order by js
</select> </select>
<select id="selectSjJygjGdsjgdcsById" parameterType="Long" resultMap="SjJygjGdsjgdcsResult"> <select id="selectSjJygjGdsjgdcsById" parameterType="Long" resultMap="SjJygjGdsjgdcsResult">
......
...@@ -553,4 +553,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -553,4 +553,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)ss )ss
group by ss.kc,ss.ztxh,ss.cc,ss.cj group by ss.kc,ss.ztxh,ss.cc,ss.cj
</select> </select>
<select id="getFdcsList" resultType="com.ruoyi.project.zt.domain.Jsha">
select a.jh,c.kc,zy, zs, gj, bs, pl, lgby, ztyj, hkyh, cjl, pssd, ztsgl, bsgl, sfsdzg, sfsdzt, gllyl
from JSBA a
left join jsaa b on a.jh = b.jh
left join (
SELECT
jh,kc,(CASE WHEN kc = 1 THEN 0 ELSE LAG_JS END) ksjs,js, CONCAT( CASE WHEN kc = 1 THEN '0-' ELSE LAG_JS || '-'END,JS) AS jd
FROM (
SELECT
jh, ROW_NUMBER() OVER (PARTITION BY jh ORDER BY js) AS kc,
JS,
LAG(JS, 1, 0) OVER (PARTITION BY jh ORDER BY js) AS LAG_JS
FROM JSDB
) t) c on a.jh=c.jh
left join (
select jh,xh,
JC,ZZJS,zy, zs, gj, bs, pl, lgby, ztyj, hkyh, cjl, pssd, ztsgl, bsgl, sfsdzg, sfsdzt, gllyl
from JSHA
order by xh
) d on a.JH=d.jh and d.zzjs>ksjs and d.zzjs &lt;=js
where 1=1
<if test="jhs!=null">
and a.jh in
<foreach item="jh" collection="jhs"
open="(" separator="," close=")">
#{jh}
</foreach>
</if>
order by kc asc
</select>
</mapper> </mapper>
\ No newline at end of file
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