Commit c1dbad730c4f508871de86d938f4d0979fb428cf
1 parent
3e76e1e5
行车路单排序
Showing
3 changed files
with
53 additions
and
1 deletions
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -1784,6 +1784,41 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1784,6 +1784,41 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1784 | List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | 1784 | List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); |
| 1785 | List<ScheduleRealInfo> list = null; | 1785 | List<ScheduleRealInfo> list = null; |
| 1786 | list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line); | 1786 | list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line); |
| 1787 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm"); | ||
| 1788 | + String sqlMinYysj="select start_opt from bsth_c_line_config where line = '"+BasicData.lineId2CodeMap.inverse().get(line) +"'"; | ||
| 1789 | + String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class); | ||
| 1790 | + String[] minSjs = minfcsj.split(":"); | ||
| 1791 | + Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]); | ||
| 1792 | + | ||
| 1793 | + for (int i = 0; i < list.size(); i++) { | ||
| 1794 | + ScheduleRealInfo s=list.get(i); | ||
| 1795 | + String[] fcsj= s.getFcsj().split(":"); | ||
| 1796 | + Long fcsjL=Long.parseLong(fcsj[0])*60+Long.parseLong(fcsj[1]); | ||
| 1797 | + | ||
| 1798 | + Long fscjT=0L; | ||
| 1799 | + if(fcsjL<minSj){ | ||
| 1800 | + Calendar calendar = new GregorianCalendar(); | ||
| 1801 | + calendar.setTime(s.getScheduleDate()); | ||
| 1802 | + calendar.add(calendar.DATE,1); | ||
| 1803 | + s.setScheduleDate(calendar.getTime()); | ||
| 1804 | + try { | ||
| 1805 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate())+" "+s.getFcsj()).getTime(); | ||
| 1806 | + } catch (ParseException e) { | ||
| 1807 | + // TODO Auto-generated catch block | ||
| 1808 | + e.printStackTrace(); | ||
| 1809 | + } | ||
| 1810 | + | ||
| 1811 | + }else{ | ||
| 1812 | + try { | ||
| 1813 | + fscjT =sdf.parse(s.getScheduleDateStr()+" "+s.getFcsj()).getTime(); | ||
| 1814 | + } catch (ParseException e) { | ||
| 1815 | + // TODO Auto-generated catch block | ||
| 1816 | + e.printStackTrace(); | ||
| 1817 | + }; | ||
| 1818 | + } | ||
| 1819 | + s.setFcsjT(fscjT); | ||
| 1820 | + } | ||
| 1821 | + Collections.sort(list, new ComparableReal()); | ||
| 1787 | for (int i = 0; i < list.size(); i++) { | 1822 | for (int i = 0; i < list.size(); i++) { |
| 1788 | ScheduleRealInfo s = list.get(i); | 1823 | ScheduleRealInfo s = list.get(i); |
| 1789 | s.setAdjustExps(i + 1 + ""); | 1824 | s.setAdjustExps(i + 1 + ""); |
src/main/java/com/bsth/util/ComparableReal.java
0 → 100644
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import java.util.Comparator; | ||
| 4 | +import java.util.List; | ||
| 5 | + | ||
| 6 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 7 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 8 | + | ||
| 9 | +public class ComparableReal implements Comparator<ScheduleRealInfo>{ | ||
| 10 | + | ||
| 11 | + @Override | ||
| 12 | + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | ||
| 13 | + // TODO Auto-generated method stub | ||
| 14 | + return o1.getFcsjT().compareTo(o2.getFcsjT()); | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | +} |
src/main/resources/application-dev.properties
| @@ -10,7 +10,7 @@ spring.jpa.show-sql= true | @@ -10,7 +10,7 @@ spring.jpa.show-sql= true | ||
| 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver | 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 11 | spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | 11 | spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false |
| 12 | spring.datasource.username= root | 12 | spring.datasource.username= root |
| 13 | -spring.datasource.password= root | 13 | +spring.datasource.password= |
| 14 | #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | 14 | #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false |
| 15 | #spring.datasource.username= root | 15 | #spring.datasource.username= root |
| 16 | #spring.datasource.password= root | 16 | #spring.datasource.password= root |