Commit 0fc4bdad984a306970fd3d979c64c92dd666f44a

Authored by 潘钊
2 parents f95dc66b 43e2f0b1

Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang

# Conflicts:
#	src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
#	src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java

Too many changes to show.

To preserve performance only 4 of 10 files are displayed.

src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -139,19 +139,19 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI @@ -139,19 +139,19 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI
139 139
140 //去掉了 xlBm is not null 140 //去掉了 xlBm is not null
141 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 141 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
142 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)") 142 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.fcsj, lpName")
143 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date); 143 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date);
144 144
145 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 145 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
146 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by (s.lpName+1), s.realExecDate,s.dfsj") 146 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.lpName, s.realExecDate,s.fcsj")
147 List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date); 147 List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date);
148 148
149 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 149 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
150 - @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?3 and s.bcType not in ('in','out','ldks') order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)") 150 + @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?3 and s.bcType not in ('in','out','ldks') order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")
151 List<ScheduleRealInfo> scheduleByDateAndLineByGs(String gsdm,String fgsdm,String date); 151 List<ScheduleRealInfo> scheduleByDateAndLineByGs(String gsdm,String fgsdm,String date);
152 152
153 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 153 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
154 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)") 154 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")
155 List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date); 155 List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date);
156 156
157 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 157 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
1 package com.bsth.service.oil.impl; 1 package com.bsth.service.oil.impl;
2 2
  3 +import java.sql.ResultSet;
  4 +import java.sql.SQLException;
  5 +import java.text.ParseException;
  6 +import java.text.SimpleDateFormat;
  7 +import java.util.ArrayList;
  8 +import java.util.HashMap;
  9 +import java.util.List;
  10 +import java.util.Map;
  11 +
  12 +import javax.transaction.Transactional;
  13 +
  14 +import org.apache.commons.lang3.StringEscapeUtils;
  15 +import org.slf4j.Logger;
  16 +import org.slf4j.LoggerFactory;
  17 +import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.jdbc.core.JdbcTemplate;
  19 +import org.springframework.jdbc.core.RowMapper;
  20 +import org.springframework.stereotype.Service;
  21 +
3 import com.alibaba.fastjson.JSONArray; 22 import com.alibaba.fastjson.JSONArray;
4 import com.alibaba.fastjson.JSONObject; 23 import com.alibaba.fastjson.JSONObject;
5 import com.bsth.common.ResponseCode; 24 import com.bsth.common.ResponseCode;
  25 +import com.bsth.entity.excep.Offline;
6 import com.bsth.entity.oil.Ylb; 26 import com.bsth.entity.oil.Ylb;
7 import com.bsth.entity.oil.Ylxxb; 27 import com.bsth.entity.oil.Ylxxb;
  28 +import com.bsth.entity.search.CustomerSpecs;
8 import com.bsth.repository.oil.YlbRepository; 29 import com.bsth.repository.oil.YlbRepository;
9 import com.bsth.repository.oil.YlxxbRepository; 30 import com.bsth.repository.oil.YlxxbRepository;
10 import com.bsth.service.impl.BaseServiceImpl; 31 import com.bsth.service.impl.BaseServiceImpl;
11 import com.bsth.service.oil.YlxxbService; 32 import com.bsth.service.oil.YlxxbService;
12 import com.bsth.util.PageHelper; 33 import com.bsth.util.PageHelper;
13 import com.bsth.util.PageObject; 34 import com.bsth.util.PageObject;
14 -import org.apache.commons.lang3.StringEscapeUtils;  
15 -import org.slf4j.Logger;  
16 -import org.slf4j.LoggerFactory;  
17 -import org.springframework.beans.factory.annotation.Autowired;  
18 -import org.springframework.jdbc.core.JdbcTemplate;  
19 -import org.springframework.jdbc.core.RowMapper;  
20 -import org.springframework.stereotype.Service;  
21 -  
22 -import javax.transaction.Transactional;  
23 -import java.sql.ResultSet;  
24 -import java.sql.SQLException;  
25 -import java.util.HashMap;  
26 -import java.util.List;  
27 -import java.util.Map;  
28 35
29 @Service 36 @Service
30 public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements YlxxbService 37 public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements YlxxbService
@@ -185,4 +192,4 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements @@ -185,4 +192,4 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
185 return newMap; 192 return newMap;
186 } 193 }
187 194
188 -} 195 +}
189 \ No newline at end of file 196 \ No newline at end of file
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -4077,7 +4077,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -4077,7 +4077,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4077 Long zdsjActual_=Long.parseLong(zdsjActual_s[0])*60+Long.parseLong(zdsjActual_s[1]); 4077 Long zdsjActual_=Long.parseLong(zdsjActual_s[0])*60+Long.parseLong(zdsjActual_s[1]);
4078 if((zdsj_-zdsjActual_)>0){ 4078 if((zdsj_-zdsjActual_)>0){
4079 zdsjk =String.valueOf(zdsj_-zdsjActual_); 4079 zdsjk =String.valueOf(zdsj_-zdsjActual_);
4080 - }else{ 4080 + }
  4081 + if(((zdsj_-zdsjActual_)<0)){
4081 zdsjm =String.valueOf(zdsjActual_-zdsj_); 4082 zdsjm =String.valueOf(zdsjActual_-zdsj_);
4082 } 4083 }
4083 } 4084 }
@@ -4104,7 +4105,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -4104,7 +4105,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4104 Long fcsjActural_=Long.parseLong(fcsjActural_s[0])*60+Long.parseLong(fcsjActural_s[1]); 4105 Long fcsjActural_=Long.parseLong(fcsjActural_s[0])*60+Long.parseLong(fcsjActural_s[1]);
4105 if((zdsj_-fcsjActural_)>0){ 4106 if((zdsj_-fcsjActural_)>0){
4106 fcsjk =String.valueOf(zdsj_-fcsjActural_); 4107 fcsjk =String.valueOf(zdsj_-fcsjActural_);
4107 - }else{ 4108 + }
  4109 + if((zdsj_-fcsjActural_)<0){
4108 fcsjm =String.valueOf(fcsjActural_-zdsj_); 4110 fcsjm =String.valueOf(fcsjActural_-zdsj_);
4109 } 4111 }
4110 } 4112 }
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
@@ -4,6 +4,7 @@ import com.bsth.entity.Line; @@ -4,6 +4,7 @@ import com.bsth.entity.Line;
4 import com.bsth.entity.Personnel; 4 import com.bsth.entity.Personnel;
5 import com.bsth.entity.StationRoute; 5 import com.bsth.entity.StationRoute;
6 import com.bsth.entity.excep.ArrivalInfo; 6 import com.bsth.entity.excep.ArrivalInfo;
  7 +import com.bsth.entity.mcy_forms.Daily;
7 import com.bsth.entity.oil.Dlb; 8 import com.bsth.entity.oil.Dlb;
8 import com.bsth.entity.oil.Ylb; 9 import com.bsth.entity.oil.Ylb;
9 import com.bsth.entity.realcontrol.ChildTaskPlan; 10 import com.bsth.entity.realcontrol.ChildTaskPlan;
@@ -19,6 +20,8 @@ import com.bsth.util.ComparableChild; @@ -19,6 +20,8 @@ import com.bsth.util.ComparableChild;
19 import com.bsth.util.ComparableJob; 20 import com.bsth.util.ComparableJob;
20 import com.bsth.util.ReportUtils; 21 import com.bsth.util.ReportUtils;
21 import com.bsth.util.db.DBUtils_MS; 22 import com.bsth.util.db.DBUtils_MS;
  23 +import com.google.protobuf.StringValue;
  24 +
22 import org.apache.commons.lang.StringUtils; 25 import org.apache.commons.lang.StringUtils;
23 import org.slf4j.Logger; 26 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory; 27 import org.slf4j.LoggerFactory;
@@ -36,6 +39,8 @@ import java.text.ParseException; @@ -36,6 +39,8 @@ import java.text.ParseException;
36 import java.text.SimpleDateFormat; 39 import java.text.SimpleDateFormat;
37 import java.util.*; 40 import java.util.*;
38 41
  42 +import javax.persistence.criteria.CriteriaBuilder.In;
  43 +
39 @Service 44 @Service
40 public class ReportServiceImpl implements ReportService{ 45 public class ReportServiceImpl implements ReportService{
41 46
@@ -66,16 +71,16 @@ public class ReportServiceImpl implements ReportService{ @@ -66,16 +71,16 @@ public class ReportServiceImpl implements ReportService{
66 List<ScheduleRealInfo> list=scheduleRealInfoRepository.findByDate2(line,date,clzbh); 71 List<ScheduleRealInfo> list=scheduleRealInfoRepository.findByDate2(line,date,clzbh);
67 72
68 // jdbcTemplate.query("select * from bsth_c_s_sp_info_real where line=?1 " 73 // jdbcTemplate.query("select * from bsth_c_s_sp_info_real where line=?1 "
69 -// + "and DATE_FORMAT(schedule_date,'%Y-%m-%d')=?2 and cl_zbl=?3",  
70 -// new Object[]{line,date,clzbh},  
71 -// new RowMapper(){  
72 -// @Override  
73 -// public Object mapRow(ResultSet rs, int rowNum) throws SQLException {  
74 -// ScheduleRealInfo s = new ScheduleRealInfo(); 74 +// + "and DATE_FORMAT(schedule_date,'%Y-%m-%d')=?2 and cl_zbl=?3",
  75 +// new Object[]{line,date,clzbh},
  76 +// new RowMapper(){
  77 +// @Override
  78 +// public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
  79 +// ScheduleRealInfo s = new ScheduleRealInfo();
75 //// s. 80 //// s.
76 -// return s;  
77 -// }  
78 -// }); 81 +// return s;
  82 +// }
  83 +// });
79 84
80 return list; 85 return list;
81 } 86 }
@@ -283,11 +288,11 @@ public class ReportServiceImpl implements ReportService{ @@ -283,11 +288,11 @@ public class ReportServiceImpl implements ReportService{
283 + " group by equipment_code ) "; 288 + " group by equipment_code ) ";
284 289
285 Map<String, Object> map=new HashMap<String,Object>(); 290 Map<String, Object> map=new HashMap<String,Object>();
286 - 291 +
287 /*List<Map<String, Object>> listPc= jdbcTemplate.query(sqlPc, 292 /*List<Map<String, Object>> listPc= jdbcTemplate.query(sqlPc,
288 new RowMapper<Map<String, Object>>(){ 293 new RowMapper<Map<String, Object>>(){
289 @Override 294 @Override
290 - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { 295 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
291 Map<String, Object> m=new HashMap<String,Object>(); 296 Map<String, Object> m=new HashMap<String,Object>();
292 m.put("zbh", rs.getString("cl_zbh")); 297 m.put("zbh", rs.getString("cl_zbh"));
293 return m; 298 return m;
@@ -1453,7 +1458,7 @@ public class ReportServiceImpl implements ReportService{ @@ -1453,7 +1458,7 @@ public class ReportServiceImpl implements ReportService{
1453 keyMap.get("18:01——(末)").add(ttMap); 1458 keyMap.get("18:01——(末)").add(ttMap);
1454 } 1459 }
1455 } 1460 }
1456 - 1461 +
1457 for(String key : keyMap.keySet()){ 1462 for(String key : keyMap.keySet()){
1458 Map<String, Object> tempMap = new HashMap<String, Object>(); 1463 Map<String, Object> tempMap = new HashMap<String, Object>();
1459 List<Map<String, Object>> list2 = keyMap.get(key); 1464 List<Map<String, Object>> list2 = keyMap.get(key);
@@ -1472,7 +1477,7 @@ public class ReportServiceImpl implements ReportService{ @@ -1472,7 +1477,7 @@ public class ReportServiceImpl implements ReportService{
1472 }else{ 1477 }else{
1473 String[] split = m.get("fcsj").toString().split(":"); 1478 String[] split = m.get("fcsj").toString().split(":");
1474 int fcsj = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); 1479 int fcsj = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
1475 - 1480 +
1476 int xlDir = Integer.valueOf(m.get("dir").toString()); 1481 int xlDir = Integer.valueOf(m.get("dir").toString());
1477 int bcsj = Integer.valueOf(m.get("bcsj").toString()); 1482 int bcsj = Integer.valueOf(m.get("bcsj").toString());
1478 if(temp >= fcsj){ 1483 if(temp >= fcsj){
@@ -1493,17 +1498,17 @@ public class ReportServiceImpl implements ReportService{ @@ -1493,17 +1498,17 @@ public class ReportServiceImpl implements ReportService{
1493 } 1498 }
1494 } 1499 }
1495 lpname=m.get("lp").toString(); 1500 lpname=m.get("lp").toString();
1496 - 1501 +
1497 } 1502 }
1498 sxtsbc++; 1503 sxtsbc++;
1499 } 1504 }
1500 - 1505 +
1501 } else { 1506 } else {
1502 - 1507 +
1503 fcsj_x.add(fcsj); 1508 fcsj_x.add(fcsj);
1504 xxsj += bcsj; 1509 xxsj += bcsj;
1505 xxbc ++; 1510 xxbc ++;
1506 - 1511 +
1507 if(!ists){ 1512 if(!ists){
1508 if(lpname.equals("")){ 1513 if(lpname.equals("")){
1509 lpname=m.get("lp").toString(); 1514 lpname=m.get("lp").toString();
@@ -1517,7 +1522,7 @@ public class ReportServiceImpl implements ReportService{ @@ -1517,7 +1522,7 @@ public class ReportServiceImpl implements ReportService{
1517 } 1522 }
1518 xxtsbc++; 1523 xxtsbc++;
1519 } 1524 }
1520 - 1525 +
1521 } 1526 }
1522 if(temp < fcsj){ 1527 if(temp < fcsj){
1523 cjs.add(fcsj - temp); 1528 cjs.add(fcsj - temp);
@@ -1539,7 +1544,7 @@ public class ReportServiceImpl implements ReportService{ @@ -1539,7 +1544,7 @@ public class ReportServiceImpl implements ReportService{
1539 cjs.add(fcsj_s.get(i)-fcsjs); 1544 cjs.add(fcsj_s.get(i)-fcsjs);
1540 fcsjs=fcsj_s.get(i); 1545 fcsjs=fcsj_s.get(i);
1541 } 1546 }
1542 - 1547 +
1543 } 1548 }
1544 Collections.sort(fcsj_x); 1549 Collections.sort(fcsj_x);
1545 int fcsjx=0; 1550 int fcsjx=0;
@@ -1550,7 +1555,7 @@ public class ReportServiceImpl implements ReportService{ @@ -1550,7 +1555,7 @@ public class ReportServiceImpl implements ReportService{
1550 cjs.add(fcsj_x.get(i)-fcsjx); 1555 cjs.add(fcsj_x.get(i)-fcsjx);
1551 fcsjx =fcsj_x.get(i); 1556 fcsjx =fcsj_x.get(i);
1552 } 1557 }
1553 - 1558 +
1554 } 1559 }
1555 Collections.sort(cjs); 1560 Collections.sort(cjs);
1556 for(int i : cjs){ 1561 for(int i : cjs){
@@ -1849,7 +1854,7 @@ public class ReportServiceImpl implements ReportService{ @@ -1849,7 +1854,7 @@ public class ReportServiceImpl implements ReportService{
1849 // while (it.hasNext()) { 1854 // while (it.hasNext()) {
1850 // ChildTaskPlan childTaskPlan = it.next(); 1855 // ChildTaskPlan childTaskPlan = it.next();
1851 // if (childTaskPlan.isDestroy()) { 1856 // if (childTaskPlan.isDestroy()) {
1852 -// } 1857 +// }
1853 // } 1858 // }
1854 // } 1859 // }
1855 } 1860 }
@@ -2218,7 +2223,7 @@ public class ReportServiceImpl implements ReportService{ @@ -2218,7 +2223,7 @@ public class ReportServiceImpl implements ReportService{
2218 , (i+1)); 2223 , (i+1));
2219 } 2224 }
2220 inoutList.add(map1); 2225 inoutList.add(map1);
2221 - 2226 +
2222 /*for (int j = 0; j < listStation.size(); j++) { 2227 /*for (int j = 0; j < listStation.size(); j++) {
2223 map2=new HashMap<String,Object>(); 2228 map2=new HashMap<String,Object>();
2224 StationRoute s=listStation.get(j); 2229 StationRoute s=listStation.get(j);
@@ -2230,7 +2235,7 @@ public class ReportServiceImpl implements ReportService{ @@ -2230,7 +2235,7 @@ public class ReportServiceImpl implements ReportService{
2230 } 2235 }
2231 } 2236 }
2232 Map<String, String> m=this.strInOut(arrivalList,lzsj); 2237 Map<String, String> m=this.strInOut(arrivalList,lzsj);
2233 - 2238 +
2234 map2.put(s.getStationCode()+"in", m.get("in")); 2239 map2.put(s.getStationCode()+"in", m.get("in"));
2235 map2.put(s.getStationCode()+"out", m.get("out")); 2240 map2.put(s.getStationCode()+"out", m.get("out"));
2236 map2.put(s.getStationCode(), m.get("type")); 2241 map2.put(s.getStationCode(), m.get("type"));
@@ -3233,4 +3238,4 @@ class ComparableAcuals implements Comparator&lt;ScheduleRealInfo&gt;{ @@ -3233,4 +3238,4 @@ class ComparableAcuals implements Comparator&lt;ScheduleRealInfo&gt;{
3233 return o1.getFcsjActualTime().compareTo(o2.getFcsjActualTime()); 3238 return o1.getFcsjActualTime().compareTo(o2.getFcsjActualTime());
3234 } 3239 }
3235 3240
3236 -} 3241 +}
3237 \ No newline at end of file 3242 \ No newline at end of file