Commit 0de3f3fb8a969b89f69fc93ba271f22af1a76bdb
1 parent
44dc7f53
时间赛选条件
Showing
3 changed files
with
52 additions
and
106 deletions
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| ... | ... | @@ -25,16 +25,16 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 25 | 25 | @Query(value="select s from ScheduleRealInfo s where s.id = ?1 ") |
| 26 | 26 | ScheduleRealInfo scheduleById(Long id); |
| 27 | 27 | |
| 28 | - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and bc_type not in ('in','out') order by (lpName+1),clZbh,realExecDate,dfsj") | |
| 28 | + @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and bc_type not in ('in','out') order by (lpName+1),clZbh,realExecDate,dfsj") | |
| 29 | 29 | List<ScheduleRealInfo> scheduleDailyQp(String line,String date); |
| 30 | 30 | |
| 31 | - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.id,s.jGh,s.clZbh,s.lpName order by (lpName+1)") | |
| 31 | + @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 GROUP BY s.id,s.jGh,s.clZbh,s.lpName order by (lpName+1)") | |
| 32 | 32 | List<ScheduleRealInfo> queryUserInfo(String line,String date); |
| 33 | 33 | |
| 34 | - @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName order by (lpName+1)") | |
| 34 | + @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName order by (lpName+1)") | |
| 35 | 35 | List<ScheduleRealInfo> queryUserInfo2(String line,String date); |
| 36 | 36 | |
| 37 | - @Query(value="select min(s.id), s.clZbh from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.clZbh ") | |
| 37 | + @Query(value="select min(s.id), s.clZbh from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 GROUP BY s.clZbh ") | |
| 38 | 38 | List<ScheduleRealInfo> queryUserInfo3(String line,String date); |
| 39 | 39 | |
| 40 | 40 | @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by bcs") |
| ... | ... | @@ -43,7 +43,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 43 | 43 | //把sum(addMileage) 替换为0 数据表去掉了 add_mileage 字段 |
| 44 | 44 | @Query(value="select new map(clZbh as clZbh,jGh as jGh,jName as jName,sum(jhlc) as zgl," |
| 45 | 45 | + "0 as ksgl,count(jName) as bcs) from ScheduleRealInfo s where" |
| 46 | - + " s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 group by clZbh,jGh,jName") | |
| 46 | + + " s.xlBm = ?1 and s.scheduleDateStr = ?2 group by clZbh,jGh,jName") | |
| 47 | 47 | List<Map<String, Object>> dailyInfo(String line,String date); |
| 48 | 48 | |
| 49 | 49 | @Query(value="select t.inside_code,d.sender,d.txt_content,d.timestamp,0 as xlbm from (" |
| ... | ... | @@ -57,7 +57,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 57 | 57 | @Query(value="SELECT r.xl_name,r.lp_name,r.cl_zbh,count(*) as cs " |
| 58 | 58 | + " FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d " |
| 59 | 59 | + " ON r.id = d.sch WHERE d.is_dispatch = 1 AND r.xl_bm like %?1% AND " |
| 60 | - + " DATE_FORMAT(r.schedule_date,'%Y-%m-%d') = ?2 and r.cl_zbh like %?3% group by " | |
| 60 | + + " r.schedule_date_str = ?2 and r.cl_zbh like %?3% group by " | |
| 61 | 61 | + " lp_name,xl_name,cl_zbh",nativeQuery=true) |
| 62 | 62 | List<Object[]> historyMessageCount(String line,String date,String code); |
| 63 | 63 | |
| ... | ... | @@ -72,7 +72,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 72 | 72 | List<ScheduleRealInfo> findByDate(String dateStr); |
| 73 | 73 | |
| 74 | 74 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 75 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and cl_zbh=?3 order by bcs") | |
| 75 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and cl_zbh=?3 order by bcs") | |
| 76 | 76 | List<ScheduleRealInfo> findByDate2(String line,String date,String clzbh); |
| 77 | 77 | |
| 78 | 78 | @Query(value="select count(jName) from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.status = -1") |
| ... | ... | @@ -84,17 +84,17 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 84 | 84 | @Query(value="SELECT request_code,FROM_UNIXTIME(TIMESTAMP / 1000,'%Y-%m-%d %T') as TIMESTAMP ,device_id FROM bsth_v_report_80 WHERE FROM_UNIXTIME( TIMESTAMP / 1000,'%Y-%m-%d') = ?2 AND line_id = ?1 and device_id like %?3%",nativeQuery=true) |
| 85 | 85 | List<Object[]> account(String line,String date,String code); |
| 86 | 86 | |
| 87 | - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDate >= str_to_date(?2,'%Y-%m-%d') " | |
| 88 | - + " and s.scheduleDate <= str_to_date(?3,'%Y-%m-%d') and s.lpName like %?4% " | |
| 87 | + @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 " | |
| 88 | + + " and s.scheduleDateStr <= ?3 and s.lpName like %?4% " | |
| 89 | 89 | + " and clZbh like %?5% order by s.fcsj") |
| 90 | 90 | List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code); |
| 91 | 91 | |
| 92 | 92 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 93 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,fcsj") | |
| 93 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDateStr = ?4 and s.xlBm=?5 order by realExecDate,fcsj") | |
| 94 | 94 | List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line); |
| 95 | 95 | |
| 96 | 96 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 97 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,fcsj") | |
| 97 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDateStr = ?4 and s.xlBm=?5 order by realExecDate,fcsj") | |
| 98 | 98 | List<ScheduleRealInfo> queryListWaybillXcld(String jGh,String clZbh,String lpName,String date,String line); |
| 99 | 99 | |
| 100 | 100 | // @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| ... | ... | @@ -102,27 +102,27 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 102 | 102 | // List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm); |
| 103 | 103 | |
| 104 | 104 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 105 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlBm,s.clZbh,s.jGh,s.adjustExps,s.fcsj") | |
| 105 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 order by s.xlBm,s.clZbh,s.jGh,s.adjustExps,s.fcsj") | |
| 106 | 106 | List<ScheduleRealInfo> scheduleByDateAndLineTjrb(String line,String date); |
| 107 | 107 | |
| 108 | 108 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 109 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.xlDir=?3 and s.fcsjActual is not null and s.zdsjActual is not null order by s.realExecDate,s.fcsjActual") | |
| 109 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and s.xlDir=?3 and s.fcsjActual is not null and s.zdsjActual is not null order by s.realExecDate,s.fcsjActual") | |
| 110 | 110 | List<ScheduleRealInfo> scheduleByDateAndLineInOut(String line,String date,String zd); |
| 111 | 111 | |
| 112 | 112 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 113 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDate = str_to_date(?2,'%Y-%m-%d') and xlBm =?3 order by realExecDate,fcsj") | |
| 113 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDateStr = ?2 and xlBm =?3 order by realExecDate,fcsj") | |
| 114 | 114 | List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line); |
| 115 | 115 | |
| 116 | 116 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 117 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh like %?1% and s.clZbh like %?2% and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') and s.gsBm like %?4% and s.fgsBm like %?5% order by realExecDate,dfsj") | |
| 117 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh like %?1% and s.clZbh like %?2% and s.scheduleDateStr = ?3 and s.gsBm like %?4% and s.fgsBm like %?5% order by realExecDate,dfsj") | |
| 118 | 118 | List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm); |
| 119 | 119 | |
| 120 | 120 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 121 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between str_to_date(?3,'%Y-%m-%d') and str_to_date(?4,'%Y-%m-%d') order by bcs") | |
| 121 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.scheduleDateStr >=?3 and s.scheduleDateStr <=?4 order by bcs") | |
| 122 | 122 | List<ScheduleRealInfo> queryListWaybill4(String jName,String clZbh,String date,String enddate); |
| 123 | 123 | |
| 124 | 124 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 125 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") | |
| 125 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2") | |
| 126 | 126 | List<ScheduleRealInfo> scheduleDaily(String line,String date); |
| 127 | 127 | |
| 128 | 128 | @Query(value = "select count(*) from ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2") |
| ... | ... | @@ -139,66 +139,66 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 139 | 139 | |
| 140 | 140 | //去掉了 xlBm is not null |
| 141 | 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.fcsj, lpName") | |
| 142 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 order by s.xlDir,s.realExecDate,s.fcsj, lpName") | |
| 143 | 143 | List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date); |
| 144 | 144 | |
| 145 | 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, s.realExecDate,s.fcsj") | |
| 146 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and s.scheduleDateStr = ?2 order by s.lpName, s.realExecDate,s.fcsj") | |
| 147 | 147 | List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date); |
| 148 | 148 | |
| 149 | 149 | |
| 150 | 150 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 151 | - @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 order by s.xlDir,s.realExecDate,s.fcsj, s.lpName") | |
| 151 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and s.scheduleDateStr = ?3 order by s.xlDir,s.realExecDate,s.fcsj, s.lpName") | |
| 152 | 152 | List<ScheduleRealInfo> scheduleByDateAndLineByGs_(String gsdm,String fgsdm,String date); |
| 153 | 153 | |
| 154 | 154 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 155 | - @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") | |
| 155 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and s.scheduleDateStr = ?3 and s.bcType not in ('in','out','ldks') order by s.xlDir,s.realExecDate,s.fcsj, s.lpName") | |
| 156 | 156 | List<ScheduleRealInfo> scheduleByDateAndLineByGs(String gsdm,String fgsdm,String date); |
| 157 | 157 | |
| 158 | 158 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 159 | - @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") | |
| 159 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr= ?2 order by s.xlDir,s.realExecDate,s.fcsj, s.lpName") | |
| 160 | 160 | List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date); |
| 161 | 161 | |
| 162 | 162 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 163 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm,s.adjustExps,s.fcsj") | |
| 163 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm,s.adjustExps,s.fcsj") | |
| 164 | 164 | List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date); |
| 165 | 165 | |
| 166 | 166 | //按月统计 |
| 167 | 167 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 168 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m') = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm") | |
| 168 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm") | |
| 169 | 169 | List<ScheduleRealInfo> scheduleByDateAndLine3(String line,String date); |
| 170 | 170 | |
| 171 | 171 | //按照时间段统计 |
| 172 | 172 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 173 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 and gsBm like %?4% and fgsBm like %?5% order by s.xlBm") | |
| 173 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr >= ?2 and s.scheduleDateStr<= ?3 and gsBm like %?4% and fgsBm like %?5% order by s.xlBm") | |
| 174 | 174 | List<ScheduleRealInfo> scheduleByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm); |
| 175 | 175 | |
| 176 | 176 | //按照时间段统计 |
| 177 | 177 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 178 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 order by s.xlBm") | |
| 178 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 and s.scheduleDateStr<= ?3 order by s.xlBm") | |
| 179 | 179 | List<ScheduleRealInfo> scheduleByDateAndLineTj2(String line,String date,String date2); |
| 180 | 180 | //月报表 |
| 181 | 181 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 182 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 order by s.xlBm") | |
| 182 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 and s.scheduleDateStr<= ?3 order by s.xlBm") | |
| 183 | 183 | List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2); |
| 184 | 184 | |
| 185 | 185 | |
| 186 | - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,min(s.fcsj) as fcsj ) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate ORDER BY clZbh,fcsj") | |
| 186 | + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,min(s.fcsj) as fcsj ) from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate ORDER BY clZbh,fcsj") | |
| 187 | 187 | List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String nbbm); |
| 188 | 188 | |
| 189 | - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,min(s.fcsj) as fcsj ) from ScheduleRealInfo s where s.xlBm =?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate ORDER BY clZbh,fcsj") | |
| 189 | + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,min(s.fcsj) as fcsj ) from ScheduleRealInfo s where s.xlBm =?1 and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate ORDER BY clZbh,fcsj") | |
| 190 | 190 | List<Map<String,Object>> yesterdayDataList_eq(String line,String date,String gsbm,String fgsbm,String nbbm); |
| 191 | 191 | |
| 192 | - @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir") | |
| 192 | + @Query(value="select s from ScheduleRealInfo s where s.scheduleDateStr = ?1 ORDER BY xlBm,lpName,clZbh,xlDir") | |
| 193 | 193 | List<ScheduleRealInfo> setLD(String date); |
| 194 | 194 | |
| 195 | - @Query(value="select new map(xlBm as xlBm,lpName as lpName,clZbh as clZbh) from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm,lpName,clZbh ORDER BY xlBm,lpName,clZbh") | |
| 195 | + @Query(value="select new map(xlBm as xlBm,lpName as lpName,clZbh as clZbh) from ScheduleRealInfo s where s.scheduleDateStr = ?1 GROUP BY xlBm,lpName,clZbh ORDER BY xlBm,lpName,clZbh") | |
| 196 | 196 | List<Map<String,Object>> setLDGroup(String date); |
| 197 | 197 | |
| 198 | - @Query(value="select new map(xlBm as xlBm,clZbh as clZbh) from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm,clZbh ORDER BY xlBm,clZbh") | |
| 198 | + @Query(value="select new map(xlBm as xlBm,clZbh as clZbh) from ScheduleRealInfo s where s.scheduleDateStr = ?1 GROUP BY xlBm,clZbh ORDER BY xlBm,clZbh") | |
| 199 | 199 | List<Map<String,Object>> setLCYHGroup(String date); |
| 200 | 200 | |
| 201 | - @Query(value="select new map(xlBm as xlBm) from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm ORDER BY xlBm") | |
| 201 | + @Query(value="select new map(xlBm as xlBm) from ScheduleRealInfo s where s.scheduleDateStr = ?1 GROUP BY xlBm ORDER BY xlBm") | |
| 202 | 202 | List<Map<String,Object>> setDDRBGroup(String date); |
| 203 | 203 | |
| 204 | 204 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | ... | ... |
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
| ... | ... | @@ -201,7 +201,7 @@ public class FormsServiceImpl implements FormsService { |
| 201 | 201 | + " LEFT JOIN bsth_c_s_sp_info_real r on r.xl_bm=l.line_code" |
| 202 | 202 | + " where 1=1 "; |
| 203 | 203 | if(map.get("date").toString()!=""){ |
| 204 | - sql+="and to_days(r.schedule_date)=to_days('"+map.get("date").toString() + "') "; | |
| 204 | + sql+="and r.schedule_date_str='"+map.get("date").toString() + "'"; | |
| 205 | 205 | } |
| 206 | 206 | if( map.get("line").toString()!=""){ |
| 207 | 207 | sql+=" and l.line_code=" + map.get("line").toString(); |
| ... | ... | @@ -251,24 +251,14 @@ public class FormsServiceImpl implements FormsService { |
| 251 | 251 | }else{ |
| 252 | 252 | sql += " r.cl_zbh"; |
| 253 | 253 | } |
| 254 | - sql += " from bsth_c_s_sp_info_real r where 1=1 "; | |
| 255 | - if(map.get("startDate")!=null&&!map.get("startDate").equals("")){ | |
| 256 | - sql+=" and to_days(r.schedule_date_str) BETWEEN to_days('" + map.get("startDate").toString() + "') "; | |
| 257 | - } | |
| 258 | - | |
| 259 | - if(map.get("endDate")!=null&&!map.get("endDate").equals("")){ | |
| 260 | - sql+=" and to_days('" + map.get("endDate").toString() + "') "; | |
| 261 | - } | |
| 254 | + sql += " from bsth_c_s_sp_info_real r where " | |
| 255 | + + " r.schedule_date_str >= '" + map.get("startDate").toString() + "' " | |
| 256 | + + " and r.schedule_date_str <='" + map.get("endDate").toString() + "' "; | |
| 262 | 257 | if(map.get("line")!=null&&!map.get("line").equals("")){ |
| 263 | 258 | sql+=" and r.xl_bm='"+ map.get("line").toString() + "' "; |
| 264 | 259 | } |
| 265 | -// sql+= " AND r.gs_bm is not null and r.bc_type not in('in','out')"; | |
| 266 | -// if(map.get("gsdmManth")!=null&&!map.get("gsdmManth").equals("")){ | |
| 267 | - sql+=" and r.gs_bm like'%"+gsdmManth+"%' "; | |
| 268 | -// } | |
| 269 | - if(map.get("fgsdmManth")!=null&&!map.get("fgsdmManth").equals("")){ | |
| 270 | - sql+=" and r.fgs_bm like'%"+fgsdmManth+"%' "; | |
| 271 | - } | |
| 260 | + sql+=" and r.gs_bm like'%"+gsdmManth+"%' and r.fgs_bm like'%"+fgsdmManth+"%'"; | |
| 261 | + | |
| 272 | 262 | if(empnames.equals("驾驶员")){ |
| 273 | 263 | sql += " GROUP BY " |
| 274 | 264 | + "r.j_name,r.j_gh"; |
| ... | ... | @@ -278,11 +268,6 @@ public class FormsServiceImpl implements FormsService { |
| 278 | 268 | sql += " GROUP BY r.cl_zbh"; |
| 279 | 269 | } |
| 280 | 270 | |
| 281 | -// + ",r.gs_bm,r.gs_name," | |
| 282 | -// + "r.fgs_bm,r.fgs_name,r.bc_type "; | |
| 283 | - | |
| 284 | -// r.j_name,r.cl_zbh,r.j_gh,r.gs_bm,r.gs_name," | |
| 285 | -// + " r.fgs_bm,r.fgs_name,r.bc_type,r.s_name,r.lp_name | |
| 286 | 271 | List<Shiftuehiclemanth> list = jdbcTemplate.query(sql, new RowMapper<Shiftuehiclemanth>() { |
| 287 | 272 | |
| 288 | 273 | @Override |
| ... | ... | @@ -409,7 +394,7 @@ public class FormsServiceImpl implements FormsService { |
| 409 | 394 | + "IFNULL(r.s_name,'')as s_name," |
| 410 | 395 | + " r.cl_zbh,r.xl_bm, r.j_gh,r.gs_bm,r.fgs_bm,r.lp_name " |
| 411 | 396 | + "FROM bsth_c_s_sp_info_real r where 1=1 " |
| 412 | - + " and to_days(r.schedule_date)=to_days('"+date + "') " | |
| 397 | + + " and r.schedule_date_str='"+date + "' " | |
| 413 | 398 | + " and r.xl_bm like '%"+line+"%' " |
| 414 | 399 | + " and r.gs_bm like '%"+gsdmShif+"%' " |
| 415 | 400 | + " and r.fgs_bm like '%"+fgsdmShif+"%' ) t" |
| ... | ... | @@ -547,19 +532,6 @@ public class FormsServiceImpl implements FormsService { |
| 547 | 532 | if(map.get("fgsdm")!=null){ |
| 548 | 533 | fgs =map.get("fgsdm").toString(); |
| 549 | 534 | } |
| 550 | - /*String sql = " select c.*,l.line_code from bsth_c_chtoch c LEFT JOIN bsth_c_line l on c.xl=l.name WHERE 1=1 "; | |
| 551 | - if (!map.get("startDate").toString().equals(" ") && !map.get("endDate").toString().equals(" ")) { | |
| 552 | - sql += "and DATE_FORMAT( c.rq,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '" | |
| 553 | - + map.get("endDate").toString() + "'"; | |
| 554 | - } | |
| 555 | - if (!map.get("line").equals("")) { | |
| 556 | - sql += "and line_code='" + map.get("line") + "'"; | |
| 557 | - } | |
| 558 | - if (map.get("sel").equals("2")) { | |
| 559 | - sql += " and c.pcch!=c.pcry"; | |
| 560 | - } else if (map.get("sel").equals("1")) { | |
| 561 | - sql += " and c.jhgh!=c.sjgh"; | |
| 562 | - }*/ | |
| 563 | 535 | |
| 564 | 536 | String sql="select * from bsth_c_chtoch where rq BETWEEN '"+ map.get("startDate").toString()+"' " |
| 565 | 537 | + " and '"+map.get("endDate").toString() +"'"; |
| ... | ... | @@ -630,19 +602,6 @@ public class FormsServiceImpl implements FormsService { |
| 630 | 602 | |
| 631 | 603 | // rq = rq2 + "-" + rq3; |
| 632 | 604 | startDate = map.get("startDate").toString(); |
| 633 | -// endDate = map.get("endDate").toString(); | |
| 634 | -// String sql = "select t.*,y.yh,y.jzl from (" | |
| 635 | -// + " select r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm" | |
| 636 | -// + " from bsth_c_s_sp_info_real r where r.schedule_date_str " | |
| 637 | -// + " BETWEEN '"+startDate+"' and '"+endDate+"' and r.xl_bm='"+map.get("line").toString()+"' " | |
| 638 | -// + " AND r.gs_bm is not null and r.gs_bm='"+map.get("gsdmSing").toString()+"' " | |
| 639 | -// + " and r.fgs_bm='"+map.get("fgsdmSing").toString()+"' " | |
| 640 | -// + " group by r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm) t " | |
| 641 | -// + " LEFT JOIN (select a.nbbm,a.jsy,SUM(a.yh) as yh,SUM(a.jzl) as jzl " | |
| 642 | -// + " from bsth_c_ylb a where a.rq BETWEEN '"+startDate+"' and '"+endDate+"'and " | |
| 643 | -// + " a.ssgsdm='"+map.get("gsdmSing").toString()+"' and a.fgsdm='"+map.get("fgsdmSing").toString()+"' " | |
| 644 | -// + "group by a.nbbm,a.jsy) y" | |
| 645 | -// + " on y.nbbm=t.cl_zbh and y.jsy= t.j_gh"; | |
| 646 | 605 | |
| 647 | 606 | String sql="select r.s_gh,r.s_name, " |
| 648 | 607 | + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm" |
| ... | ... | @@ -1210,8 +1169,8 @@ public class FormsServiceImpl implements FormsService { |
| 1210 | 1169 | |
| 1211 | 1170 | String sql = "select gs_name, fgs_name, cl_zbh, fcsj, bc_type, xl_bm, xl_name, schedule_date" |
| 1212 | 1171 | + " from bsth_c_s_sp_info where gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"' " |
| 1213 | - + "and DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"' " | |
| 1214 | - + "and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"' "; | |
| 1172 | + + "and schedule_date_str >= '"+startDate+"' " | |
| 1173 | + + "and schedule_date_str <= '"+endDate+"' "; | |
| 1215 | 1174 | if(line.trim().length() != 0){ |
| 1216 | 1175 | sql += "and xl_bm = '"+line+"' "; |
| 1217 | 1176 | } |
| ... | ... | @@ -1367,8 +1326,8 @@ public class FormsServiceImpl implements FormsService { |
| 1367 | 1326 | |
| 1368 | 1327 | String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from " |
| 1369 | 1328 | + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type" |
| 1370 | - + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" | |
| 1371 | - + map.get("startDate").toString() + "' and '" + map.get("endDate").toString() + "' and xl_bm='" | |
| 1329 | + + " from bsth_c_s_sp_info" + " where schedule_date_str >= '" | |
| 1330 | + + map.get("startDate").toString() + "' and schedule_date_str <='" + map.get("endDate").toString() + "' and xl_bm='" | |
| 1372 | 1331 | + map.get("line").toString() + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out')" |
| 1373 | 1332 | + " and gs_bm='"+ map.get("gsdmEcecut").toString() + "'" |
| 1374 | 1333 | + " and fgs_bm='"+ map.get("fgsdmEcecut").toString() + "'" |
| ... | ... | @@ -1376,7 +1335,7 @@ public class FormsServiceImpl implements FormsService { |
| 1376 | 1335 | + " ) a left JOIN (" |
| 1377 | 1336 | + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl " |
| 1378 | 1337 | + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real " |
| 1379 | - + "where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '" | |
| 1338 | + + "where schedule_date_str >= '" + map.get("startDate").toString() + "' and schedule_date_str <= '" | |
| 1380 | 1339 | + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString() |
| 1381 | 1340 | + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out') " |
| 1382 | 1341 | // + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type" |
| ... | ... | @@ -1451,8 +1410,8 @@ public class FormsServiceImpl implements FormsService { |
| 1451 | 1410 | |
| 1452 | 1411 | String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from " |
| 1453 | 1412 | + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type" |
| 1454 | - + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" | |
| 1455 | - + map.get("startDate").toString() + "' and '" + map.get("endDate").toString() + "' and xl_bm='" | |
| 1413 | + + " from bsth_c_s_sp_info" + " where schedule_date_str >= '" | |
| 1414 | + + map.get("startDate").toString() + "' and schedule_date_str<= '" + map.get("endDate").toString() + "' and xl_bm='" | |
| 1456 | 1415 | + map.get("line").toString() + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out') " |
| 1457 | 1416 | + " and gs_bm='"+ map.get("gsdmAllline").toString() + "'" |
| 1458 | 1417 | + " and fgs_bm='"+ map.get("fgsdmAllline").toString() + "'" | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -24,6 +24,7 @@ import com.bsth.data.utils.CustomStringUtils; |
| 24 | 24 | import com.bsth.entity.Cars; |
| 25 | 25 | import com.bsth.entity.Line; |
| 26 | 26 | import com.bsth.entity.Personnel; |
| 27 | +import com.bsth.entity.mcy_forms.Waybillday; | |
| 27 | 28 | import com.bsth.entity.oil.Dlb; |
| 28 | 29 | import com.bsth.entity.oil.Ylb; |
| 29 | 30 | import com.bsth.entity.oil.Ylxxb; |
| ... | ... | @@ -788,13 +789,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 788 | 789 | + " select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh, " |
| 789 | 790 | + " s.lp_Name as lpName,s.j_Name as jName,max(s.schedule_date_str) as dateStr ," |
| 790 | 791 | + " min(s.fcsj) as fcsj,1 as px from bsth_c_s_sp_info_real s where " |
| 791 | - + " s.xl_Bm = '"+line+"' and DATE_FORMAT(s.schedule_Date,'%Y-%m-%d') ='"+date+"'" | |
| 792 | + + " s.xl_Bm = '"+line+"' and s.schedule_date_str ='"+date+"'" | |
| 792 | 793 | + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name ,s.j_Name ) x where x.fcsj >'"+minfcsj+"'" |
| 793 | 794 | + " UNION " |
| 794 | 795 | + " select * from ( select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh, " |
| 795 | 796 | + " s.lp_Name as lpName,s.j_Name as jName, max(s.schedule_date_str) as dateStr," |
| 796 | 797 | + " min(s.fcsj) as fcsj,2 as px from bsth_c_s_sp_info_real s " |
| 797 | - + " where s.xl_Bm = '"+line+"' and DATE_FORMAT(s.schedule_Date,'%Y-%m-%d') ='"+date+"'" | |
| 798 | + + " where s.xl_Bm = '"+line+"' and s.schedule_date_str ='"+date+"'" | |
| 798 | 799 | + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name ,s.j_Name " |
| 799 | 800 | + " ) y where y.fcsj <='"+minfcsj+"') z order by (" + state + "),dateStr,px " + type; |
| 800 | 801 | List<ScheduleRealInfo> list = jdbcTemplate.query(sqlPlan, |
| ... | ... | @@ -2943,17 +2944,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2943 | 2944 | }else{ |
| 2944 | 2945 | yesterdayDataList=scheduleRealInfoRepository.yesterdayDataList_eq(line, date,gsbm,fgsbm,nbbm); |
| 2945 | 2946 | } |
| 2946 | - | |
| 2947 | -// System.out.println("shijian2:"+new Date()); | |
| 2948 | - // List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date); | |
| 2947 | + System.out.println("time2:"+new Date()); | |
| 2948 | + | |
| 2949 | 2949 | List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date,gsbm,fgsbm); |
| 2950 | -// System.out.println("shijian3:"+new Date()); | |
| 2951 | 2950 | for (int x = 0; x < yesterdayDataList.size(); x++) { |
| 2952 | 2951 | String jName = yesterdayDataList.get(x).get("jGh").toString(); |
| 2953 | 2952 | String clZbh = yesterdayDataList.get(x).get("clZbh").toString(); |
| 2954 | 2953 | String xlbm = yesterdayDataList.get(x).get("xlBm").toString(); |
| 2955 | -// double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0; | |
| 2956 | - double addMileage = 0, remMileage = 0; | |
| 2957 | 2954 | Map<String, Object> map = new HashMap<String, Object>(); |
| 2958 | 2955 | boolean fage = true; |
| 2959 | 2956 | String company=""; |
| ... | ... | @@ -2981,7 +2978,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2981 | 2978 | |
| 2982 | 2979 | yesterdayDataList.get(x).put("company", company); |
| 2983 | 2980 | yesterdayDataList.get(x).put("bCompany", bCompany); |
| 2984 | -// Double zgl=Arith.add(yygl,ksgl); | |
| 2985 | 2981 | Double ljgl=culateMieageService.culateLjgl(listS); |
| 2986 | 2982 | Double sjgl=culateMieageService.culateSjgl(listS); |
| 2987 | 2983 | Double ksgl=culateMieageService.culateKsgl(listS); |
| ... | ... | @@ -2992,15 +2988,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2992 | 2988 | yesterdayDataList.get(x).put("totalKilometers", zlc); |
| 2993 | 2989 | |
| 2994 | 2990 | } |
| 2995 | - /* List<Map<String, Object>> yesterdayDataLists = new ArrayList<Map<String, Object>>(); | |
| 2996 | - | |
| 2997 | - for (int i = 0; i < yesterdayDataList.size(); i++) { | |
| 2998 | - Map<String, Object> map=yesterdayDataList.get(i); | |
| 2999 | - Double zlc=map.get("totalKilometers")==null?0.0:Double.parseDouble(map.get("totalKilometers").toString()); | |
| 3000 | -// if(zlc>0){ | |
| 3001 | - yesterdayDataLists.add(map); | |
| 3002 | -// } | |
| 3003 | - }*/ | |
| 3004 | 2991 | //增加顺序号 |
| 3005 | 2992 | for (int i = 0; i < yesterdayDataList.size(); i++) { |
| 3006 | 2993 | if (i == 0) { | ... | ... |