Commit 4eb56a8419be88d2207e1ec26deafff97d74db99

Authored by 廖磊
1 parent ce60fe55

修正报表重做,月报表加过滤条件

src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -7,6 +7,7 @@ import com.bsth.controller.realcontrol.dto.ChangePersonCar;
7 7 import com.bsth.controller.realcontrol.dto.DfsjChange;
8 8 import com.bsth.data.BasicData;
9 9 import com.bsth.data.schedule.DayOfSchedule;
  10 +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
10 11 import com.bsth.entity.realcontrol.ScheduleRealInfo;
11 12 import com.bsth.entity.schedule.SchedulePlanInfo;
12 13 import com.bsth.service.realcontrol.ScheduleRealInfoService;
... ... @@ -317,9 +318,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo,
317 318 }
318 319  
319 320 @RequestMapping(value = "/correctForm")
320   - public List<ScheduleRealInfo> correctForm(@RequestParam String line, @RequestParam String startDate,
321   - @RequestParam String endDate, @RequestParam String lpName, @RequestParam String code, @RequestParam String type) {
322   - return scheduleRealInfoService.correctForm(line, startDate, endDate, lpName, code, type);
  321 + public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date,
  322 + @RequestParam String lpName, @RequestParam String code, @RequestParam String type) {
  323 + return scheduleRealInfoService.correctForm(line, date, lpName, code, type);
323 324 }
324 325 /**
325 326 * @Title queryListWaybill
... ...
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
... ... @@ -205,12 +205,15 @@ public class FormsServiceImpl implements FormsService {
205 205 if(map.containsKey("fgsdmManth")){
206 206 fgsdmManth=map.get("fgsdmManth").toString();
207 207 }
208   - String sql = "select"
209   - + " r.j_name, r.cl_zbh,r.j_gh,r.s_gh,r.s_name "
210   -// + "r.gs_bm,r.gs_name,"
211   -// + " r.fgs_bm,r.fgs_name,r.bc_type,r.lp_name "
212   - + " from bsth_c_s_sp_info_real r "
213   - + " where 1=1 ";
  208 + String sql ="select ";
  209 + if(empnames.equals("驾驶员")){
  210 + sql += " r.j_name,r.j_gh ";
  211 + }else if(empnames.equals("售票员")){
  212 + sql += " r.s_gh,r.s_name";
  213 + }else{
  214 + sql += " r.cl_zbh";
  215 + }
  216 + sql += " from bsth_c_s_sp_info_real r where 1=1 ";
214 217 if(map.get("startDate")!=null&&!map.get("startDate").equals("")){
215 218 sql+=" and to_days(r.schedule_date_str) BETWEEN to_days('" + map.get("startDate").toString() + "') ";
216 219 }
... ... @@ -227,12 +230,16 @@ public class FormsServiceImpl implements FormsService {
227 230 // }
228 231 if(map.get("fgsdmManth")!=null&&!map.get("fgsdmManth").equals("")){
229 232 sql+=" and r.fgs_bm like'%"+fgsdmManth+"%' ";
230   - }
231   - if(empnames.equals("售票员")){
232   - sql+="and r.s_name is not null AND r.s_name !=''";
233 233 }
  234 + if(empnames.equals("驾驶员")){
234 235 sql += " GROUP BY "
235   - + "r.j_name, r.cl_zbh,r.j_gh,r.s_gh,r.s_name ";
  236 + + "r.j_name,r.j_gh";
  237 + }else if(empnames.equals("售票员")){
  238 + sql+="and r.s_name is not null AND r.s_name !='' GROUP BY r.s_gh,r.s_name";
  239 + }else{
  240 + sql += " GROUP BY r.cl_zbh";
  241 + }
  242 +
236 243 // + ",r.gs_bm,r.gs_name,"
237 244 // + "r.fgs_bm,r.fgs_name,r.bc_type ";
238 245  
... ... @@ -244,15 +251,16 @@ public class FormsServiceImpl implements FormsService {
244 251 public Shiftuehiclemanth mapRow(ResultSet arg0, int arg1) throws SQLException {
245 252 Shiftuehiclemanth shif = new Shiftuehiclemanth();
246 253 if(empnames.equals("驾驶员")){
247   - shif.setjName(arg0.getString("j_name"));
  254 + shif.setjName(arg0.getString("j_name")+"/"+arg0.getString("j_gh"));
  255 + shif.setJgh(arg0.getString("j_gh"));
248 256 }else if(empnames.equals("售票员")){
249   - shif.setjName(arg0.getString("s_name")==null ? "":arg0.getString("s_name"));
  257 + shif.setjName(arg0.getString("s_name")+"/"+arg0.getString("s_gh"));
250 258 shif.setSgh(arg0.getString("s_gh")==null ? "":arg0.getString("s_gh"));
251 259 }else if(empnames.equals("车辆自编号")){
252 260 shif.setjName(arg0.getString("cl_zbh"));
253 261 }
254   - shif.setJgh(arg0.getString("j_gh"));
255   - shif.setZbh(arg0.getString("cl_zbh"));
  262 +// shif.setJgh(arg0.getString("j_gh"));
  263 +// shif.setZbh(arg0.getString("cl_zbh"));
256 264 // shif.setjName(arg0.getString("s_gh")==null ? "":arg0.getString("s_gh"));
257 265 return shif;
258 266 }
... ... @@ -274,11 +282,11 @@ public class FormsServiceImpl implements FormsService {
274 282 }
275 283 }else if(empnames.equals("售票员")){
276 284 String sgh=s.getsGh()==null?"":s.getsGh();
277   - if(d.getSgh().equals(sgh) && d.getZbh().equals(s.getClZbh())){
  285 + if(d.getSgh().equals(sgh)){
278 286 sList.add(s);
279 287 }
280 288 }else if(empnames.equals("车辆自编号")){
281   - if(d.getZbh().equals(s.getClZbh())){
  289 + if(d.getjName().equals(s.getClZbh())){
282 290 sList.add(s);
283 291 }
284 292 }
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -2,6 +2,7 @@ package com.bsth.service.realcontrol;
2 2  
3 3 import com.bsth.controller.realcontrol.dto.ChangePersonCar;
4 4 import com.bsth.controller.realcontrol.dto.DfsjChange;
  5 +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
5 6 import com.bsth.entity.realcontrol.ScheduleRealInfo;
6 7 import com.bsth.entity.schedule.SchedulePlanInfo;
7 8 import com.bsth.service.BaseService;
... ... @@ -104,7 +105,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
104 105 List<Map<String,Object>> accountPx(String line,String date,String code,String xlName, String px);
105 106  
106 107  
107   - List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code, String type);
  108 + List<SchEditInfoDto> correctForm(String line,String date,String lpName,String code, String type);
108 109  
109 110 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line);
110 111  
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -16,6 +16,7 @@ import com.bsth.data.schedule.ScheduleComparator;
16 16 import com.bsth.data.schedule.edit_logs.FormLogger;
17 17 import com.bsth.data.schedule.edit_logs.ScheduleModifyLogger;
18 18 import com.bsth.data.schedule.edit_logs.loggers.FcxxwtLogger;
  19 +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
19 20 import com.bsth.data.schedule.late_adjust.LateAdjustHandle;
20 21 import com.bsth.entity.Cars;
21 22 import com.bsth.entity.Line;
... ... @@ -58,9 +59,11 @@ import org.apache.commons.lang3.StringEscapeUtils;
58 59 import org.apache.commons.lang3.StringUtils;
59 60 import org.joda.time.format.DateTimeFormat;
60 61 import org.joda.time.format.DateTimeFormatter;
  62 +import org.mvel2.optimizers.impl.refl.nodes.ArrayLength;
61 63 import org.slf4j.Logger;
62 64 import org.slf4j.LoggerFactory;
63 65 import org.springframework.beans.factory.annotation.Autowired;
  66 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
64 67 import org.springframework.jdbc.core.JdbcTemplate;
65 68 import org.springframework.jdbc.core.RowMapper;
66 69 import org.springframework.stereotype.Service;
... ... @@ -1904,7 +1907,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1904 1907 return listMap;
1905 1908 }
1906 1909  
1907   - @Override
  1910 + /* @Override
1908 1911 public List<ScheduleRealInfo> correctForm(String line, String startDate,
1909 1912 String endDate, String lpName, String code, String type) {
1910 1913 List<ScheduleRealInfo> list = scheduleRealInfoRepository.correctForm(line, startDate, endDate, lpName, code);
... ... @@ -1959,8 +1962,93 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1959 1962 }
1960 1963  
1961 1964 return list;
  1965 + }*/
  1966 +
  1967 + @Override
  1968 + public List<SchEditInfoDto> correctForm(String line,String date,
  1969 + String lpName,String code, String type) {
  1970 +
  1971 +// var types = {'DFTZ': '待发调整', 'FCXXWT':'发车信息微调', 'JHLB': '计划烂班', 'CXLB': '撤销烂班',
  1972 +// 'CXZX': '撤销执行', 'CXSF': '撤销实发', 'SFTZ': '实发调整', 'TZRC': '调整人车'};
  1973 + Map<String, Object> map=new HashMap<String,Object>();
  1974 + map.put("DFTZ", "待发调整");
  1975 + map.put("FCXXWT", "发车信息微调");
  1976 + map.put("JHLB", "计划烂班");
  1977 + map.put("CXLB", "撤销烂班");
  1978 + map.put("CXZX","撤销执行");
  1979 + map.put("CXSF", "撤销实发");
  1980 + map.put("SFTZ", "实发调整");
  1981 + map.put("TZRC", "调整人车");
  1982 +
  1983 + String cont = "";
  1984 + cont = " and xl_bm ='"+line +"'";
  1985 + if(!lpName.equals("")){
  1986 + cont +=" and lp_name = '"+lpName+"'";
  1987 + }
  1988 + if(!code.equals("")){
  1989 + cont +=" and cl_zbh ='"+code+"'";
  1990 + }
  1991 + String sql = "select t1.*, "
  1992 + + "t2.fcsj,t2.lp_name,t2.cl_zbh,t2.j_gh,t2.j_name,"
  1993 + + "t2.xl_dir,t2.real_exec_date from (select * from "
  1994 + + "logger_sch_modify where rq=? and line_code=? )"
  1995 + + " t1 INNER JOIN bsth_c_s_sp_info_real t2 on "
  1996 + + "t1.sch_id=t2.id where 1=1 " + cont;
  1997 +
  1998 + List<SchEditInfoDto> list = jdbcTemplate.query(sql,
  1999 + new BeanPropertyRowMapper(SchEditInfoDto.class),date, line);
  2000 + List<SchEditInfoDto> lists=new ArrayList<SchEditInfoDto>();
  2001 + for (int i = 0; i < list.size(); i++) {
  2002 + SchEditInfoDto t=list.get(i);
  2003 + if(map.get(t.getType())!=null){
  2004 + t.setType2(t.getTimeStr()+":"+map.get(t.getType()).toString());
  2005 + }else{
  2006 + t.setType2("");
  2007 + }
  2008 + boolean fage=true;
  2009 + for (int j = 0; j < lists.size(); j++) {
  2010 + SchEditInfoDto s=lists.get(j);
  2011 + if(s.getSchId()==t.getSchId()){
  2012 + s.setType2(s.getType2()+" "+t.getType2());
  2013 + fage=false;
  2014 + }
  2015 + }
  2016 + if(fage){
  2017 + lists.add(t);
  2018 + }
  2019 + }
  2020 +
  2021 + if (type != null && type.length() != 0 && type.equals("export")) {
  2022 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  2023 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  2024 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2025 + Map<String, Object> m = new HashMap<String, Object>();
  2026 + m.put("dates",date);
  2027 + ReportUtils ee = new ReportUtils();
  2028 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  2029 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  2030 + for (SchEditInfoDto d : lists) {
  2031 + Map<String, Object> tempMap = new HashMap<String, Object>();
  2032 + tempMap.put("lpName", d.getLpName());
  2033 + tempMap.put("clZbh", d.getClZbh());
  2034 + tempMap.put("jName", d.getjName()+"/"+d.getjGh());
  2035 + tempMap.put("fcsj", d.getFcsj());
  2036 + tempMap.put("type", d.getType2());
  2037 + tempList.add(tempMap);
  2038 + }
  2039 + try {
  2040 + listI.add(tempList.iterator());
  2041 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2042 + ee.excelReplace(listI, new Object[]{m}, path + "mould/correctForm.xls",
  2043 + path + "export/修正报表" + date+ ".xls");
  2044 + } catch (Exception e) {
  2045 + // TODO: handle exception
  2046 + e.printStackTrace();
  2047 + }
  2048 +// Map<String, Object> maps = tempList.get(tempList.size() - 1);
  2049 + }
  2050 + return lists;
1962 2051 }
1963   -
1964 2052 @Override
1965 2053 public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
1966 2054 String lpName, String date, String line) {
... ...
src/main/resources/static/pages/forms/mould/correctForm.xls
No preview for this file type
src/main/resources/static/pages/forms/statement/correctForm.html
... ... @@ -32,13 +32,13 @@
32 32 <select class="form-control" name="line" id="line" style="width: 136px;"></select>
33 33 </div>
34 34 <div style="display: inline-block;margin-left: 15px;">
35   - <span class="item-label" style="width: 80px;">开始时间: </span>
36   - <input class="form-control" type="text" id="startDate" style="width: 120px;"/>
37   - </div>
38   - <div style="display: inline-block;margin-left: 15px;">
39   - <span class="item-label" style="width: 80px;">结束时间: </span>
40   - <input class="form-control" type="text" id="endDate" style="width: 120px;"/>
  35 + <span class="item-label" style="width: 80px;">时间: </span>
  36 + <input class="form-control" type="text" id="date" style="width: 120px;"/>
41 37 </div>
  38 +<!-- <div style="display: inline-block;margin-left: 15px;"> -->
  39 +<!-- <span class="item-label" style="width: 80px;">结束时间: </span> -->
  40 +<!-- <input class="form-control" type="text" id="endDate" style="width: 120px;"/> -->
  41 +<!-- </div> -->
42 42 <div style="display: inline-block;margin-left: 15px">
43 43 <span class="item-label" style="width: 140px;">路牌: </span>
44 44 <select class="form-control" name="lpName" id="lpName" style="width: 136px;"></select>
... ... @@ -46,6 +46,7 @@
46 46 <div style="display: inline-block;margin-left: 15px">
47 47 <span class="item-label" style="width: 140px;">内部编码: </span>
48 48 <select class="form-control" name="code" id="code" style="width: 145px;"></select>
  49 + <input class="btn btn-default" type="button" id="czcl" value="X"/>
49 50 </div>
50 51 <div class="form-group">
51 52 <input class="btn btn-default" type="button" id="query" value="筛选"/>
... ... @@ -58,28 +59,15 @@
58 59 <table class="table table-bordered table-hover table-checkable" id="forms">
59 60 <thead>
60 61 <tr>
61   - <th colspan="12">营运车辆修正统计表</th>
62   - </tr>
63   - <tr>
64   - <td colspan="12">车队 站 <span id="sDate"></span>至<span id="eDate"></span></td>
  62 + <th colspan="6">营运车辆修正统计表</th>
65 63 </tr>
66 64 <tr>
67   - <td rowspan="2">线路名</td>
68   - <td rowspan="2">路牌</td>
69   - <td rowspan="2">车号</td>
70   - <td rowspan="2">司机</td>
71   - <td rowspan="2">售票员</td>
72   - <td colspan="2">发车时间</td>
73   - <td colspan="2">结束时间</td>
74   - <td rowspan="2">修改人</td>
75   - <td rowspan="2">修改时间</td>
76   - <td rowspan="2">备注</td>
77   - </tr>
78   - <tr>
79   - <td>计划</td>
80   - <td>实际</td>
81   - <td>计划</td>
82   - <td>实际</td>
  65 + <td>编号</td>
  66 + <td>路牌</td>
  67 + <td>车号</td>
  68 + <td>司机</td>
  69 + <td>计发</td>
  70 + <td>修改详细</td>
83 71 </tr>
84 72 </thead>
85 73 <tbody class="list_correctForm">
... ... @@ -104,11 +92,19 @@
104 92 if (!$('body').hasClass('page-sidebar-closed'))
105 93 $('.menu-toggler.sidebar-toggler').click();
106 94  
107   - $("#startDate,#endDate").datetimepicker({
  95 + $("#date").datetimepicker({
108 96 format : 'YYYY-MM-DD',
109 97 locale : 'zh-cn'
110 98 });
111   -
  99 + var d = new Date();
  100 + var year = d.getFullYear();
  101 + var month = d.getMonth() + 1;
  102 + var day = d.getDate();
  103 + if(month < 10)
  104 + month = "0" + month;
  105 + if(day < 10)
  106 + day = "0" + day;
  107 + $("#date").val(year + "-" + month + "-" + day);
112 108  
113 109 $.get('/basic/lineCode2Name',function(result){
114 110 var data=[];
... ... @@ -116,11 +112,12 @@
116 112 for(var code in result){
117 113 data.push({id: code, text: result[code]});
118 114 }
119   - console.log(data);
120 115 initPinYinSelect2('#line',data,'');
121 116  
122 117 })
123   -
  118 + $('#czcl').on('click', function () {
  119 + $('#code').val('').change();
  120 + });
124 121  
125 122 $('#lpName').select2({
126 123 ajax: {
... ... @@ -200,44 +197,16 @@
200 197 });
201 198  
202 199 var line = $("#line").val();
203   - var startDate = $("#startDate").val();
204   - var endDate = $("#endDate").val();
  200 + var date = $("#startDate").val();
205 201 var lpName = $("#lpName").val();
206 202 var code = $("#code").val();
207 203 $("#query").on("click",function(){
208   - if($("#startDate").val() == null || $("#startDate").val().trim().length == 0){
209   - layer.msg("请选择范围!");
210   - return;
211   - }
212   - if($("#endDate").val() == null || $("#endDate").val().trim().length == 0){
213   - layer.msg("请选择范围!");
214   - return;
215   - }
216 204 line = $("#line").val();
217   - startDate = $("#startDate").val();
218   - endDate = $("#endDate").val();
  205 + date = $("#date").val();
219 206 lpName = $("#lpName").val();
220 207 code = $("#code").val();
221 208 var type = "query";
222   - $post("/realSchedule/correctForm",{line:line,startDate:startDate,endDate:endDate,lpName:lpName,code:code,type:type},function(result){
223   - $("#sDate").text(startDate);
224   - $("#eDate").text(endDate);
225   - var temp = {};
226   - var today_account = 0;
227   - temp["line"] = $("#line").text() ;
228   - temp["totalAdjustment"] = result.length;
229   -
230   - $.each(result, function(i, obj) {
231   - if(moment(obj.scheduleDate).format("YYYY-MM-DD") == moment(obj.updateDate).format("YYYY-MM-DD")){
232   - today_account++;
233   - }
234   - obj.updateDate = moment(obj.updateDate).format("YYYY-MM-DD HH:mm:ss");
235   - });
236   -
237   - temp["todayAdjustment"] = today_account;
238   - temp["beforeAdjustment"] = result.length-today_account;
239   - temp["historyAdjustment"] = 0;
240   -
  209 + $get("/realSchedule/correctForm",{line:line,date:date,lpName:lpName,code:code,type:type},function(result){
241 210 var list_correctForm = template('list_correctForm',{list:result});
242 211 // 把渲染好的模版html文本追加到表格中
243 212 $('#forms .list_correctForm').html(list_correctForm);
... ... @@ -255,8 +224,8 @@
255 224  
256 225 $("#export").on("click",function(){
257 226 var type = "export";
258   - $get('/realSchedule/correctForm',{line:line,startDate:startDate,endDate:endDate,lpName:lpName,code:code,type:type},function(result){
259   - window.open("/downloadFile/download?fileName=修正报表"+moment(startDate).format("YYYYMMDD")+"-"+moment(endDate).format("YYYYMMDD"));
  227 + $get('/realSchedule/correctForm',{line:line,date:date,lpName:lpName,code:code,type:type},function(result){
  228 + window.open("/downloadFile/download?fileName=修正报表"+date);
260 229 });
261 230 });
262 231  
... ... @@ -264,38 +233,18 @@
264 233 </script>
265 234 <script type="text/html" id="list_correctForm">
266 235 {{each list as obj i}}
267   - <tr>
268   - <td>{{obj.xlName}}</td>
  236 + <tr>
  237 + <td>{{i+1}}</td>
269 238 <td>{{obj.lpName}}</td>
270 239 <td>{{obj.clZbh}}</td>
271   - <td>{{obj.jName}}</td>
272   - <td>{{obj.sName}}</td>
  240 + <td>{{obj.jName}}/{{obj.jGh}}</td>
273 241 <td>{{obj.fcsj}}</td>
274   - <td>{{obj.fcsjActual}}</td>
275   - <td>{{obj.zdsj}}</td>
276   - <td>{{obj.zdsjActual}}</td>
277   - <td>{{obj.updateBy}}</td>
278   - <td>{{obj.updateDate}}</td>
279   - <td>{{obj.remarks}}</td>
  242 + <td>{{obj.type2}}</td>
280 243 </tr>
281 244 {{/each}}
282 245 {{if list.length == 0}}
283 246 <tr>
284   - <td colspan="12"><h6 class="muted">没有找到相关数据</h6></td>
  247 + <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td>
285 248 </tr>
286 249 {{/if}}
287 250 </script>
288   -<script type="text/html" id="list_correctForm_statistics">
289   - <tr>
290   - <td colspan="2">线路:</td>
291   - <td>{{line}}</td>
292   - <td>调整总数</td>
293   - <td>{{totalAdjustment}}</td>
294   - <td>事先调整</td>
295   - <td>{{beforeAdjustment}}</td>
296   - <td>当日调整</td>
297   - <td>{{todayAdjustment}}</td>
298   - <td>历史调整</td>
299   - <td colspan="2">{{historyAdjustment}}</td>
300   - </tr>
301   -</script>
302 251 \ No newline at end of file
... ...