Commit 07728f5e10657cfa1f2e6cdd82edd3cebb92d85a

Authored by 廖磊
1 parent a16a2478

大间隔导出

src/main/java/com/bsth/controller/report/ReportController.java
... ... @@ -6,12 +6,15 @@ import java.util.Iterator;
6 6 import java.util.List;
7 7 import java.util.Map;
8 8  
  9 +import org.apache.commons.lang3.StringEscapeUtils;
9 10 import org.springframework.beans.factory.annotation.Autowired;
10 11 import org.springframework.web.bind.annotation.RequestMapping;
11 12 import org.springframework.web.bind.annotation.RequestMethod;
12 13 import org.springframework.web.bind.annotation.RequestParam;
13 14 import org.springframework.web.bind.annotation.RestController;
14 15  
  16 +import com.alibaba.fastjson.JSONArray;
  17 +import com.alibaba.fastjson.JSONObject;
15 18 import com.bsth.entity.StationRoute;
16 19 import com.bsth.entity.excep.ArrivalInfo;
17 20 import com.bsth.entity.realcontrol.ScheduleRealInfo;
... ... @@ -276,4 +279,40 @@ public class ReportController {
276 279 public List<Map<String, Object>> countDjg(@RequestParam Map<String, Object> map){
277 280 return service.countDjg(map);
278 281 }
  282 +
  283 +
  284 + @RequestMapping(value="/countDjgXx")
  285 + public List<Map<String, Object>> countDjgXx(@RequestParam Map<String, Object> map){
  286 + List<Map<String, Object>> lMap=new ArrayList<Map<String, Object>>();
  287 + String json =StringEscapeUtils.unescapeHtml4(map.get("listXx").toString());
  288 + JSONArray jsonArray=JSONArray.parseArray(json);
  289 + JSONObject jsonObject;
  290 + for (int x = 0; x < jsonArray.size(); x++) {
  291 + jsonObject=jsonArray.getJSONObject(x);
  292 + Map<String, Object> m_=new HashMap<String,Object>();
  293 + m_.put("fgsname", jsonObject.getString("fgsname"));
  294 + m_.put("xlName", jsonObject.getString("xlName"));
  295 + m_.put("djgde", jsonObject.getString("djgde"));
  296 + m_.put("qJh", jsonObject.getString("qJh"));
  297 + m_.put("qSj", jsonObject.getString("qSj"));
  298 + m_.put("hJh", jsonObject.getString("hJh"));
  299 + m_.put("hSj", jsonObject.getString("hSj"));
  300 + lMap.add(m_);
  301 + }
  302 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  303 + Map<String, Object> m = new HashMap<String, Object>();
  304 + m.put("date", map.get("date").toString());
  305 + ReportUtils ee = new ReportUtils();
  306 + try {
  307 + listI.add(lMap.iterator());
  308 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  309 + ee.excelReplace(listI, new Object[]{m}, path + "mould/countIntervalXx.xls",
  310 + path + "export/大间隔统计表详细.xls");
  311 + } catch (Exception e) {
  312 + // TODO: handle exception
  313 + e.printStackTrace();
  314 + }
  315 +
  316 + return lMap;
  317 + }
279 318 }
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -4,6 +4,7 @@ import com.bsth.entity.Line;
4 4 import com.bsth.entity.Personnel;
5 5 import com.bsth.entity.StationRoute;
6 6 import com.bsth.entity.excep.ArrivalInfo;
  7 +import com.bsth.entity.mcy_forms.Daily;
7 8 import com.bsth.entity.oil.Dlb;
8 9 import com.bsth.entity.oil.Ylb;
9 10 import com.bsth.entity.realcontrol.ChildTaskPlan;
... ... @@ -2234,6 +2235,7 @@ public class ReportServiceImpl implements ReportService{
2234 2235 String date=map.get("date").toString();
2235 2236 String gsbm=map.get("gsbm").toString();
2236 2237 String fgsbm=map.get("fgsbm").toString();
  2238 + String type=map.get("type").toString();
2237 2239 List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
2238 2240 if(line.equals("")){
2239 2241 list=scheduleRealInfoRepository.scheduleByDateAndLineByGs(gsbm, fgsbm, date);
... ... @@ -2273,7 +2275,6 @@ public class ReportServiceImpl implements ReportService{
2273 2275 }
2274 2276 });
2275 2277  
2276   -
2277 2278 for (int i = 0; i < xlList.size(); i++) {
2278 2279 String lineCode=xlList.get(i).get("line").toString();
2279 2280 String grade =xlList.get(i).get("grade").toString();
... ... @@ -2309,6 +2310,7 @@ public class ReportServiceImpl implements ReportService{
2309 2310 e.printStackTrace();
2310 2311 }
2311 2312 }
  2313 +
2312 2314 if(listInfo.size()>0){
2313 2315 int sjbcs=culateService.culateSjbc(list_, "")+culateService.culateLjbc(list_, "");
2314 2316 Map<String, Object> m=listDjg(gsbm,fgsbm,lineCode,sjbcs,peak,trough,listInfo,grade);
... ... @@ -2316,6 +2318,21 @@ public class ReportServiceImpl implements ReportService{
2316 2318 }
2317 2319  
2318 2320 }
  2321 + if(type.equals("export")){
  2322 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2323 + Map<String, Object> m = new HashMap<String, Object>();
  2324 + m.put("date", date);
  2325 + ReportUtils ee = new ReportUtils();
  2326 + try {
  2327 + listI.add(lMap.iterator());
  2328 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2329 + ee.excelReplace(listI, new Object[]{m}, path + "mould/countInterval.xls",
  2330 + path + "export/大间隔统计表.xls");
  2331 + } catch (Exception e) {
  2332 + // TODO: handle exception
  2333 + e.printStackTrace();
  2334 + }
  2335 + }
2319 2336 return lMap;
2320 2337 }
2321 2338  
... ...
src/main/resources/static/pages/forms/mould/countInterval.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/countIntervalXx.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/report/countInterval/countInterval.html
... ... @@ -53,6 +53,7 @@
53 53 <div class="row" class="col-md-12">
54 54 <div class="col-md-5">
55 55 <div id="left_table" style="margin-top: 10px;overflow:auto;height: 860px">
  56 + <input class="btn btn-default hidden" type="button" id="export" value="导出"/>
56 57 <table class="table table-bordered table-hover table-checkable pre-scrollable" id="info_inter">
57 58 <thead>
58 59 <tr class="hidden">
... ... @@ -71,7 +72,8 @@
71 72 </div>
72 73 </div>
73 74 <div class="col-md-7" id="printArea">
74   - <div class="table-container" id="table" style="margin-top: 10px;overflow:auto;">
  75 + <div class="table-container" id="table" style="margin-top: 10px;overflow:auto;">
  76 + <input class="btn btn-default hidden" type="button" id="exportXx" value="导出详细"/>
75 77 <table class="table table-bordered table-hover table-checkable" id="forms">
76 78 <thead class="hidden">
77 79 <tr >
... ... @@ -196,7 +198,7 @@
196 198 }
197 199 });
198 200  
199   - var date = '';
  201 + var date = "";
200 202 var gsbm="";
201 203 var fgsbm="";
202 204 var listRe=null;
... ... @@ -211,8 +213,9 @@
211 213 date = $("#date").val();
212 214 gsbm =$("#gsdm").val();
213 215 fgsbm=$("#fgsdm").val();
214   - $(".hidden").removeClass("hidden");
215   - $get('/report/countDjg',{line:line,date:date,gsbm:gsbm,fgsbm:fgsbm},function(result){
  216 + $(".hidden").removeClass("hidden");
  217 + var i = layer.load(2);
  218 + $get('/report/countDjg',{line:line,date:date,gsbm:gsbm,fgsbm:fgsbm,type:"query"},function(result){
216 219 listRe=result;
217 220 // 把数据填充到模版中
218 221 var tbodyHtml = template('list_inter_info',{list:result});
... ... @@ -220,17 +223,17 @@
220 223 $('#info_inter tbody').html(tbodyHtml);
221 224  
222 225 $('.btn-intervalList').on('click', showIntervalList);
223   -
224   -
  226 + layer.close(i);
  227 + $("#info_inter").height($(window).height()-180);
225 228 });
226 229 });
227   -
  230 + var listXx;
228 231 function showIntervalList(){
229 232  
230 233 $("#info_inter tbody tr td button").css('background-color', 'blue');
231 234 $(this).css('background-color', '#99CCFF');
232 235 var line_ = $(this).data('id');
233   - var listXx;
  236 +
234 237 $.each(listRe, function (i, obj) {
235 238 if(obj.line==line_){
236 239 listXx=obj.djgxx;
... ... @@ -240,19 +243,35 @@
240 243 $(".hidden").removeClass("hidden");
241 244 var interList = template('list_inter_info_xx',{list:listXx});
242 245 $('#forms tbody').html(interList);
243   - $("html,body").animate({scrollTop:$("#forms_1").offset().top},1000);
  246 +// $("html,body").animate({scrollTop:$("#forms_1").offset().top},1000);
244 247 // }
245 248  
246 249 }
247 250  
248   - /* $("#export").on("click",function(){
249   - $get('/realSchedule/historyMessage',{line:line,date:date,code:jName,type:"export_msg"},function(result){
250   - window.open("/downloadFile/download?fileName=调度消息分析"+moment(date).format("YYYYMMDD"));
  251 + $("#export").on("click",function(){
  252 + var i = layer.load(2);
  253 + $get('/report/countDjg',{line:line,date:date,gsbm:gsbm,fgsbm:fgsbm,type:"export"},function(result){
  254 + layer.close(i);
  255 + window.open("/downloadFile/download?fileName=大间隔统计表");
251 256 });
252   - }); */
253   -
  257 + });
254 258  
255 259  
  260 + $("#exportXx").on("click",function(){
  261 +
  262 + if(listXx.length>0){
  263 + var i = layer.load(2);
  264 + var params = {};
  265 + params['listXx']=JSON.stringify(listXx);
  266 + params['date']=date;
  267 + $get('/report/countDjgXx',params,function(result){
  268 + layer.close(i);
  269 + window.open("/downloadFile/download?fileName=大间隔统计表详细");
  270 + });
  271 + }else{
  272 + layer.msg("无数据");
  273 + }
  274 + });
256 275 });
257 276 </script>
258 277 <script type="text/html" id="list_inter_info">
... ...