Commit 800d6d1c by wangweidong

土工平台修改

parent 928a5fbc
......@@ -1434,7 +1434,62 @@ public class SoilEntrustServiceImpl extends BaseServiceImpl<SoilEntrustMapper, S
}else{
continue;
}
int dataSize = data.size();
Set<String> checkKey = new HashSet<>();
for (int i = 0; i < dataSize; i++) {
Map<String,Object> mapData = data.get(i);
for (Map.Entry<String,Object> s:mapData.entrySet()) {
checkKey.add(s.getKey());
}
}
if (!checkKey.contains("wuxing")){
Map<String,Object> wuxingFales = new HashMap<>();
wuxingFales.put("wuxing",false);
Map<String,Object> wuxingFalesEnd = new HashMap<>();
wuxingFalesEnd.put("wuxingEnd",false);
Map<String,Object> wuxingFalesZiJiao = new HashMap<>();
wuxingFalesZiJiao.put("wuxingZiJiaoCheck",false);
data.add(wuxingFales);
data.add(wuxingFalesEnd);
data.add(wuxingFalesZiJiao);
}
if (!checkKey.contains("lixue")){
Map<String,Object> lixueFales = new HashMap<>();
lixueFales.put("lixue",false);
Map<String,Object> lixueFalesEnd = new HashMap<>();
lixueFalesEnd.put("lixueEnd",false);
Map<String,Object> lixueFalesZiJiao = new HashMap<>();
lixueFalesZiJiao.put("lixueZiJiaoCheck",false);
data.add(lixueFales);
data.add(lixueFalesEnd);
data.add(lixueFalesZiJiao);
}
if (!checkKey.contains("gaoji")){
Map<String,Object> gaojiFales = new HashMap<>();
gaojiFales.put("gaoji",false);
Map<String,Object> gaojiFalesEnd = new HashMap<>();
gaojiFalesEnd.put("gaojiEnd",false);
Map<String,Object> gaojiFalesZiJiao = new HashMap<>();
gaojiFalesZiJiao.put("gaojiZiJiaoCheck",false);
data.add(gaojiFales);
data.add(gaojiFalesEnd);
data.add(gaojiFalesZiJiao);
}
}
page.setRecords(dtoList);
return page;
}
......
package com.patzn.cloud.service.lims.test;
import com.patzn.cloud.service.lims.common.HSSFWorkbookUtil;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.annotations.XYTextAnnotation;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.data.xy.DefaultXYDataset;
import org.jfree.ui.RefineryUtilities;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
public class ScatterPlot {
public static void data(String title,String[] a,String[] b)
{
DefaultXYDataset xydataset = new DefaultXYDataset ();
double[][] data=new double[2][a.length];
for(int i=0;i<a.length;i++)
{
data[0][i]=Double.parseDouble(a[i]);
data[1][i]=Double.parseDouble(b[i]);
}
xydataset.addSeries("牛的无线定位", data);
final JFreeChart chart =ChartFactory.createScatterPlot("","","",xydataset,PlotOrientation.VERTICAL,false,false,false);
ChartFrame frame = new ChartFrame(title,chart);
frame.pack();
RefineryUtilities.centerFrameOnScreen(frame);
frame.setVisible(true);
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
File file = new File("D://en//ccc.xlsx");
try {
InputStream io = new FileInputStream(file);
XSSFWorkbook xssfWorkbook = HSSFWorkbookUtil.getWorkbookByIO(io);
XSSFSheet sheet = xssfWorkbook.getSheetAt(2);
int xcol = 0;
int xrowBegin = 1;
int xrowEnd = sheet.getLastRowNum();
int ycol = 3;
int yrowBegin = 1;
int yrowEnd = sheet.getLastRowNum();
List<String> xList = new ArrayList<>();
List<String> yList = new ArrayList<>();
for (int i = xrowBegin; i < xrowEnd; i++) {
XSSFRow row = sheet.getRow(i);
if (row == null){
continue;
}
XSSFCell cell = row.getCell(xcol);
if (cell == null){
continue;
}
String xcalue = HSSFWorkbookUtil.getJavaValue(cell).toString();
xList.add(xcalue);
}
for (int i = yrowBegin; i < yrowEnd; i++) {
XSSFRow row = sheet.getRow(i);
if (row == null){
continue;
}
XSSFCell cell = row.getCell(ycol);
if (cell == null){
continue;
}
String ycalue = HSSFWorkbookUtil.getJavaValue(cell).toString();
yList.add(ycalue);
}
int size = xList.size()<yList.size()?xList.size():yList.size();
String[] a =new String[size];
String[] b =new String[size];
for (int i = 0; i < size; i++) {
a[i] = xList.get(i);
b[i] = yList.get(i);
}
ScatterPlot.data("title", a, b);
}catch (Exception e){
}
// String[] a ={"1.11","2.14","4.54"};
// String[] b ={"1.24","2.36","4.69"};
}
}
\ No newline at end of file
package com.patzn.cloud.service.lims.test;
import org.apache.commons.lang3.StringUtils;
public class Ytest {
public static void main(String[] args) {
boolean d = validateNumber("325.312122");
System.out.println(d);
}
private static boolean validateNumber(String str) {
if(StringUtils.isBlank(str)) {
return false;
}
// 说明一下的是该正则只能识别4位小数;如果不限制小数位数的话,写成[+-]?[0-9]+(\\.[0-9]+)?就可以了
return str.matches("[+-]?[0-9]+(\\.[0-9]+)?");
}
}
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