|
@@ -38,7 +38,6 @@ public class M00004Service extends M00004BaseModel implements ExecProcessFlow {
|
|
|
if(da==null){
|
|
|
throw new BusinessException("EB3000002");
|
|
|
}
|
|
|
-
|
|
|
DJobMapper jobDao =UtilTools.getBean(DJobMapper.class);
|
|
|
DJob job =jobDao.selectByPrimaryKey(da.getJid());
|
|
|
if(job ==null){
|
|
@@ -52,15 +51,15 @@ public class M00004Service extends M00004BaseModel implements ExecProcessFlow {
|
|
|
}
|
|
|
List <D_M00004_PTS_RECODE> pts =new ArrayList<>();//管道时间数据
|
|
|
String totaltime =job.getTotaltime();//模拟时间
|
|
|
- String dt=job.getDt();//时间步长
|
|
|
+ String re=job.getReportstep();//输出步长
|
|
|
String acctime =job.getAcctime();//开始时间
|
|
|
String genPtah = TemplateGenerator2.BPATH + "/" + aid + "/" + da.getJid() + "/";
|
|
|
- int steps = Integer.valueOf(totaltime)/Integer.valueOf(dt);
|
|
|
- if("Gass".equals(da.getType())||"Gass1".equals(da.getType())){//瓦斯爆炸
|
|
|
- genPtah=genPtah+"/gas/out";
|
|
|
- }else if("Water".equals(da.getType())){
|
|
|
+ int steps = Integer.valueOf(totaltime)/Integer.valueOf(re);
|
|
|
+ if("Gass".equals(da.getStype())||"Gass1".equals(da.getStype())){//瓦斯爆炸
|
|
|
+ genPtah=genPtah+"gas/out";
|
|
|
+ }else if("Water".equals(da.getStype())){
|
|
|
genPtah=genPtah+"water/out";
|
|
|
- }else if("Fire".equals(da.getType())){
|
|
|
+ }else if("Fire".equals(da.getStype())){
|
|
|
genPtah=genPtah+"fire/out";
|
|
|
}else{
|
|
|
throw new BusinessException("");
|
|
@@ -68,25 +67,27 @@ public class M00004Service extends M00004BaseModel implements ExecProcessFlow {
|
|
|
for (int i = 1; i <=steps; i++) {
|
|
|
D_M00004_PTS_RECODE pr =new D_M00004_PTS_RECODE();
|
|
|
Date startTime =XIDateTimeUtils.getDateFromZonedStr(acctime);
|
|
|
- Date thisTime = new Date(startTime.getTime()+Long.valueOf(String.valueOf(i * Integer.valueOf(dt))));
|
|
|
- pr.setTime(XIDateTimeUtils.getDateStrFromDate(thisTime));
|
|
|
+ Date thisTime = new Date(startTime.getTime()+Long.valueOf(String.valueOf(i*1000 * Integer.valueOf(re))));
|
|
|
+ pr.setTime(XIDateTimeUtils.getStrFromDate(thisTime));
|
|
|
String postFile =genPtah+"/POST"+i+".1d";
|
|
|
// 使用try-with-resources语句自动关闭资源
|
|
|
List<String> wsPcode = new ArrayList<>();//存储危险pcode
|
|
|
- readFilePipeDangers(postFile, wsPcode);
|
|
|
- DPtpipeassMapper ptDao = UtilTools.getBean(DPtpipeassMapper.class);
|
|
|
- DPtpipeassSQLBuilder ptsb = new DPtpipeassSQLBuilder();
|
|
|
- DPtpipeassSQLBuilder.Criteria ptsc = ptsb.createCriteria();
|
|
|
- ptsc.andPcodeIn(wsPcode);
|
|
|
- List<DPtpipeass> ptList = ptDao.selectByExample(ptsb);
|
|
|
- List<D_M00004_PTS_PIPES_RECODE> pipes= new ArrayList<>();
|
|
|
- for (DPtpipeass pt: ptList) {
|
|
|
- D_M00004_PTS_PIPES_RECODE recode = new D_M00004_PTS_PIPES_RECODE();
|
|
|
- recode.setPcode(pt.getPtcode());
|
|
|
- recode.setGrade("1");
|
|
|
- pipes.add(recode);
|
|
|
+ readFilePipeDangers(da.getStype(),postFile, wsPcode);
|
|
|
+ if(!wsPcode.isEmpty()){
|
|
|
+ DPtpipeassMapper ptDao = UtilTools.getBean(DPtpipeassMapper.class);
|
|
|
+ DPtpipeassSQLBuilder ptsb = new DPtpipeassSQLBuilder();
|
|
|
+ DPtpipeassSQLBuilder.Criteria ptsc = ptsb.createCriteria();
|
|
|
+ ptsc.andPcodeIn(wsPcode);
|
|
|
+ List<DPtpipeass> ptList = ptDao.selectByExample(ptsb);
|
|
|
+ List<D_M00004_PTS_PIPES_RECODE> pipes= new ArrayList<>();
|
|
|
+ for (DPtpipeass pt: ptList) {
|
|
|
+ D_M00004_PTS_PIPES_RECODE recode = new D_M00004_PTS_PIPES_RECODE();
|
|
|
+ recode.setPcode(pt.getPtcode());
|
|
|
+ recode.setGrade("1");
|
|
|
+ pipes.add(recode);
|
|
|
+ }
|
|
|
+ pr.setPipes(pipes);
|
|
|
}
|
|
|
- pr.setPipes(pipes);
|
|
|
pts.add(pr);
|
|
|
}
|
|
|
|
|
@@ -125,11 +126,16 @@ public class M00004Service extends M00004BaseModel implements ExecProcessFlow {
|
|
|
* @param postFile
|
|
|
* @param wsPcode
|
|
|
*/
|
|
|
- private void readFilePipeDangers(String postFile, List<String> wsPcode) {
|
|
|
+ private void readFilePipeDangers(String stype,String postFile, List<String> wsPcode) {
|
|
|
try (BufferedReader br = new BufferedReader(new FileReader(postFile))) {
|
|
|
String line;
|
|
|
List<String> salars = new ArrayList<>();
|
|
|
boolean fristFlag = true;//首行判断
|
|
|
+ if("Water".equals(stype)){//水灾没有salar 首行
|
|
|
+ salars.add("Height");
|
|
|
+ fristFlag = false;
|
|
|
+ }
|
|
|
+
|
|
|
boolean pcodFlag = true;//判断是否继续读取
|
|
|
// 逐行读取,直到文件末尾
|
|
|
while ((line = br.readLine()) != null) {
|
|
@@ -139,7 +145,7 @@ public class M00004Service extends M00004BaseModel implements ExecProcessFlow {
|
|
|
fristFlag=false;
|
|
|
continue;
|
|
|
}
|
|
|
- if(line.startsWith("pip")){//巷道行
|
|
|
+ if(line.matches("\\D.*")){//非数字开头,巷道行
|
|
|
if(pcodFlag){//如果上一个巷道安全
|
|
|
if(!wsPcode.isEmpty()){
|
|
|
wsPcode.remove(wsPcode.size()-1);
|
|
@@ -155,6 +161,8 @@ public class M00004Service extends M00004BaseModel implements ExecProcessFlow {
|
|
|
double val = Double.valueOf(salarVals[j]);
|
|
|
if("pos".equals(salars.get(j))){
|
|
|
|
|
|
+ }else if("Pressure".equals(salars.get(j))) {
|
|
|
+
|
|
|
}else if("Temperature".equals(salars.get(j))){
|
|
|
if(val>=40){//危险
|
|
|
pcodFlag=false;
|
|
@@ -216,6 +224,9 @@ public class M00004Service extends M00004BaseModel implements ExecProcessFlow {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if(pcodFlag){
|
|
|
+ wsPcode.remove(wsPcode.size()-1);
|
|
|
+ }
|
|
|
} catch (IOException e) {
|
|
|
// 异常处理
|
|
|
e.printStackTrace();
|