Commit ffe8c7f0c38c0742d8734a66deb426a9681bc84a

Authored by 廖磊
1 parent 536ffe46

报表

src/main/java/com/bsth/controller/report/ReportController.java
... ... @@ -40,5 +40,13 @@ public class ReportController {
40 40 public List<Map<String, String>> sreachPersonnel(@RequestParam String line,@RequestParam int zdlx,@RequestParam String zd) {
41 41 return service.sreachZd(line,zdlx, zd);
42 42 }
  43 +
  44 +
  45 +
  46 + @RequestMapping(value = "/historyMessageCount", method = RequestMethod.GET)
  47 + public List<Object[]> historyMessageCount(@RequestParam String line, @RequestParam String date,
  48 + @RequestParam String code) {
  49 + return service.historyMessageCount(line, date, code);
  50 + }
43 51  
44 52 }
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -40,6 +40,13 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
40 40 + "r.schedule_date like %?2% and r.cl_zbh like %?3% order by d.timestamp",nativeQuery=true)
41 41 List<Object[]> historyMessage(String line,String date,String code);
42 42  
  43 + @Query(value="SELECT r.xl_name,r.lp_name,r.cl_zbh,count(*) as cs "
  44 + + " FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d "
  45 + + " ON r.id = d.sch WHERE d.is_dispatch = 1 AND r.xl_bm like %?1% AND "
  46 + + " r.schedule_date like %?2% and r.cl_zbh like %?3% group by "
  47 + + " lp_name,xl_name,cl_zbh order by d.timestamp",nativeQuery=true)
  48 + List<Object[]> historyMessageCount(String line,String date,String code);
  49 +
43 50 @Query(value = "select max(id) from ScheduleRealInfo")
44 51 Long getMaxId();
45 52  
... ... @@ -74,6 +81,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
74 81 @Query(value="select 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 bcType='normal' order by bcs")
75 82 List<ScheduleRealInfo> queryListWaybill2(String jName,String clZbh,String lpName,String date);
76 83  
  84 + @Query(value="select 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 bcType='normal' order by bcs")
  85 + List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String lpName,String date);
  86 +
77 87 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
78 88 List<ScheduleRealInfo> scheduleDaily(String line,String date);
79 89  
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -113,7 +113,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
113 113 t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString()))));
114 114 t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString());
115 115 t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
116   - t.setSsgsdm(map.get("company").toString());
  116 + t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());
117 117 t.setRq(sdf.parse(rq));
118 118 repository.save(t);
119 119 newMap.put("status", ResponseCode.SUCCESS);
... ...
src/main/java/com/bsth/service/report/ReportService.java
... ... @@ -16,4 +16,6 @@ public interface ReportService {
16 16 List<ArrivalInfo> queryListClzd(String line,String zd,String zdlx,String fcsj,String ddsj);
17 17  
18 18 List<Map<String, String>> sreachZd(String line,int zdlx,String zd);
19   -}
  19 +
  20 + List<Object[]> historyMessageCount(String line, String date, String code);
  21 + }
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -246,5 +246,11 @@ public class ReportServiceImpl implements ReportService{
246 246 }
247 247 return list;
248 248 }
  249 + @Override
  250 + public List<Object[]> historyMessageCount(String line, String date, String code) {
  251 + // TODO Auto-generated method stub
  252 + List<Object[]> list = scheduleRealInfoRepository.historyMessageCount(line, date, code);
  253 + return list;
  254 + }
249 255  
250 256 }
... ...
src/main/resources/static/pages/report/message/message.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 +</style>
  18 +
  19 +<div class="page-head">
  20 + <div class="page-title">
  21 + <h1>行车路单</h1>
  22 + </div>
  23 +</div>
  24 +
  25 +<div class="row">
  26 + <div class="col-md-12">
  27 + <div class="portlet light porttlet-fit bordered">
  28 + <div class="portlet-title">
  29 + <form class="form-inline" action="">
  30 + <div style="display: inline-block;">
  31 + <span class="item-label" style="width: 80px;">线路: </span>
  32 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  33 + </div>
  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="date" style="width: 180px;"/>
  37 + </div>
  38 + <div style="display: inline-block;margin-left: 15px">
  39 + <span class="item-label" style="width: 140px;">内部编码: </span>
  40 + <select class="form-control" name="code" id="code" style="width: 180px;"></select>
  41 + </div>
  42 + <div class="form-group" style="display: inline-block;margin-left: 15px;">
  43 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  44 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  45 + <input class="btn btn-default" type="button" id="print" value="打印"/>
  46 + <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/>
  47 + </div>
  48 + </form>
  49 + </div>
  50 + <div class="portlet-body">
  51 + <div class="row">
  52 + <div class="col-md-3">
  53 + <div class="" style="margin-top: 10px;overflow:auto;height: 860px">
  54 + <table class="table table-bordered table-hover table-checkable pre-scrollable" id="info_msg">
  55 + <thead>
  56 + <tr class="hidden">
  57 + <th>线路</th>
  58 + <th>自编号</th>
  59 + <th>路牌</th>
  60 + <th>请求次数</th>
  61 + </tr>
  62 + </thead>
  63 + <tbody>
  64 +
  65 + </tbody>
  66 + </table>
  67 + </div>
  68 + </div>
  69 + <div class="col-md-9" id="printArea">
  70 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  71 + <table class="table table-bordered table-hover table-checkable" id="forms">
  72 + <thead>
  73 + <tr class="hidden">
  74 + <th>序号</th>
  75 + <th>线路</th>
  76 + <th>路牌</th>
  77 + <th>运营车辆</th>
  78 + <th>发送人</th>
  79 + <th>发送时间</th>
  80 + <th>调度消息内容</th>
  81 + </tr>
  82 + </thead>
  83 + <tbody>
  84 +
  85 + </tbody>
  86 + </table>
  87 + </div>
  88 + </div>
  89 + </div>
  90 + </div>
  91 + </div>
  92 + </div>
  93 +</div>
  94 +
  95 +<script>
  96 + $(function(){
  97 + // 关闭左侧栏
  98 + if (!$('body').hasClass('page-sidebar-closed'))
  99 + $('.menu-toggler.sidebar-toggler').click();
  100 +
  101 + $("#date").datetimepicker({
  102 + format : 'YYYY-MM-DD',
  103 + locale : 'zh-cn'
  104 + });
  105 +
  106 + $('#line').select2({
  107 + ajax: {
  108 + url: '/realSchedule/findLine',
  109 + type: 'post',
  110 + dataType: 'json',
  111 + delay: 150,
  112 + data: function(params){
  113 + return{line: params.term};
  114 + },
  115 + processResults: function (data) {
  116 + return {
  117 + results: data
  118 + };
  119 + },
  120 + cache: true
  121 + },
  122 + templateResult: function(repo){
  123 + if (repo.loading) return repo.text;
  124 + var h = '<span>'+repo.text+'</span>';
  125 + return h;
  126 + },
  127 + escapeMarkup: function (markup) { return markup; },
  128 + minimumInputLength: 1,
  129 + templateSelection: function(repo){
  130 + return repo.text;
  131 + },
  132 + language: {
  133 + noResults: function(){
  134 + return '<span style="color:red;font-size: 12px;">没有搜索到线路!</span>';
  135 + },
  136 + inputTooShort : function(e) {
  137 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入线路搜索线路</span>';
  138 + },
  139 + searching : function() {
  140 + return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>';
  141 + }
  142 + }
  143 + });
  144 + $('#code').select2({
  145 + ajax: {
  146 + url: '/realSchedule/sreachVehic',
  147 + dataType: 'json',
  148 + delay: 150,
  149 + data: function(params){
  150 + return{nbbm: params.term};
  151 + },
  152 + processResults: function (data) {
  153 + return {
  154 + results: data
  155 + };
  156 + },
  157 + cache: true
  158 + },
  159 + templateResult: function(repo){
  160 + if (repo.loading) return repo.text;
  161 + var h = '<span>'+repo.text+'</span>';
  162 + h += (repo.lineName?'&nbsp;<span class="select2-desc">'+repo.lineName+'</span>':'');
  163 + return h;
  164 + },
  165 + escapeMarkup: function (markup) { return markup; },
  166 + minimumInputLength: 1,
  167 + templateSelection: function(repo){
  168 + return repo.text;
  169 + },
  170 + language: {
  171 + noResults: function(){
  172 + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>';
  173 + },
  174 + inputTooShort : function(e) {
  175 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>';
  176 + },
  177 + searching : function() {
  178 + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
  179 + }
  180 + }
  181 + });
  182 +
  183 + var date = '';
  184 + $("#query").on("click",function(){
  185 + var line = $("#line").val();
  186 + date = $("#date").val();
  187 + var code=$("#code").val();
  188 + $(".hidden").removeClass("hidden");
  189 + $get('/report/historyMessageCount',{line:line,date:date,code:code},function(result){
  190 + // 把数据填充到模版中
  191 + var tbodyHtml = template('list_msg_info',{list:result});
  192 + // 把渲染好的模版html文本追加到表格中
  193 + $('#info_msg tbody').html(tbodyHtml);
  194 + });
  195 + });
  196 +
  197 + var params = new Array();
  198 + var jName = '';
  199 + $("#info_msg tbody").on("click","tr",function(){
  200 + if($(this).children().size() < 2){
  201 + return;
  202 + }
  203 + $(this).children().each(function(index){
  204 + params[index] = $(this).text();
  205 + });
  206 + jName = params[1];
  207 + var line = $("#line").val();
  208 + date = $("#date").val();
  209 + $get('/realSchedule/historyMessage',{line:line,date:date,code:jName},function(result){
  210 + var list_history_msg = template('list_history_msg',{list:result});
  211 + // 把渲染好的模版html文本追加到表格中
  212 + $('#forms tbody').html(list_history_msg);
  213 + });
  214 + });
  215 +
  216 + $("#export").on("click",function(){
  217 + if(params.length < 1){
  218 + return;
  219 + }
  220 + $post('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date},function(result){
  221 + window.open("/downloadFile/download?fileName="+jName);
  222 + });
  223 + });
  224 +
  225 + $("#print").click(function(){
  226 + $("#printArea").printArea();
  227 + });
  228 +
  229 + $("#exportMore").on("click",function(){
  230 + return;
  231 + $post('/realSchedule/exportWaybillMore',{date:date},function(result){
  232 + window.open("/downloadFile/download?fileName="+jName);
  233 + });
  234 + });
  235 +
  236 + });
  237 +</script>
  238 +<script type="text/html" id="list_msg_info">
  239 + {{each list as obj i}}
  240 + <tr>
  241 + <td width="25%">{{obj[0]}}\{{obj[1]}}</td>
  242 + <td width="25%">{{obj[2]}}</td>
  243 + <td width="25%">{{obj[1]}}</td>
  244 + <td width="25%">{{obj[3]}}</td>
  245 + </tr>
  246 + {{/each}}
  247 + {{if list.length == 0}}
  248 + <tr>
  249 + <td colspan="3"><h6 class="muted">没有找到相关数据</h6></td>
  250 + </tr>
  251 + {{/if}}
  252 +</script>
  253 +<script type="text/html" id="list_history_msg">
  254 + {{each list as obj i}}
  255 + <tr>
  256 + <td>{{i+1}}</td>
  257 + <td>{{obj[0]}}</td>
  258 + <td>{{obj[1]}}</td>
  259 + <td>{{obj[2]}}</td>
  260 + <td>{{obj[3]}}</td>
  261 + <td>{{obj[4]}}</td>
  262 + <td>{{obj[5]}}</td>
  263 + </tr>
  264 + {{/each}}
  265 + {{if list.length == 0}}
  266 + <tr>
  267 + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td>
  268 + </tr>
  269 + {{/if}}
  270 +</script>
... ...