Commit 143d992a0dd60587e2b11563b98584e0df143e84

Authored by 潘钊
2 parents 16b49f3b c7913ee5

Merge branch 'minhang' into qingpu

# Conflicts:
#	src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
#	src/main/resources/ms-jdbc.properties
#	src/main/resources/static/real_control_v2/js/north/toolbar.js
Showing 110 changed files with 6523 additions and 1466 deletions
src/main/java/com/bsth/common/Constants.java
@@ -21,6 +21,9 @@ public class Constants { @@ -21,6 +21,9 @@ public class Constants {
21 public static final String LOGIN_FAILURE = "/user/loginFailure"; 21 public static final String LOGIN_FAILURE = "/user/loginFailure";
22 public static final String CAPTCHA = "/captcha.jpg"; 22 public static final String CAPTCHA = "/captcha.jpg";
23 23
  24 + //对外的营运数据接口
  25 + public static final String SERVICE_INTERFACE = "/companyService/**";
  26 +
24 /** 27 /**
25 * 线调部分子页面不做拦截,便于浏览器缓存 28 * 线调部分子页面不做拦截,便于浏览器缓存
26 */ 29 */
src/main/java/com/bsth/controller/oil/CdlController.java 0 → 100644
  1 +package com.bsth.controller.oil;
  2 +
  3 +import java.util.Date;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +
  11 +import com.bsth.controller.BaseController;
  12 +import com.bsth.entity.oil.Cdl;
  13 +import com.bsth.service.oil.CdlService;
  14 +
  15 +@RestController
  16 +@RequestMapping("cdl")
  17 +public class CdlController extends BaseController<Cdl, Integer>{
  18 + @Autowired
  19 + CdlService service;
  20 + @RequestMapping(value = "/save",method = RequestMethod.POST)
  21 + public Map<String, Object> saveCdl(Cdl t){
  22 +// SysUser user = SecurityUtils.getCurrentUser();
  23 + t.setUpdatetime(new Date());
  24 + /*SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  25 + try {
  26 + t.setUpdatetime(sdf.parse("2016-10-13"));
  27 + } catch (ParseException e) {
  28 + // TODO Auto-generated catch block
  29 + e.printStackTrace();
  30 + }*/
  31 + return service.save(t);
  32 + }
  33 +}
src/main/java/com/bsth/controller/oil/DlbController.java
1 package com.bsth.controller.oil; 1 package com.bsth.controller.oil;
2 2
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.data.domain.Page;
  8 +import org.springframework.data.domain.PageRequest;
  9 +import org.springframework.data.domain.Sort;
  10 +import org.springframework.data.domain.Sort.Direction;
3 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RequestMethod;
  13 +import org.springframework.web.bind.annotation.RequestParam;
4 import org.springframework.web.bind.annotation.RestController; 14 import org.springframework.web.bind.annotation.RestController;
5 import com.bsth.controller.BaseController; 15 import com.bsth.controller.BaseController;
6 import com.bsth.entity.oil.Dlb; 16 import com.bsth.entity.oil.Dlb;
  17 +import com.bsth.entity.oil.Ylb;
  18 +import com.bsth.service.oil.DlbService;
  19 +import com.google.common.base.Splitter;
7 20
8 @RestController 21 @RestController
9 @RequestMapping("dlb") 22 @RequestMapping("dlb")
10 public class DlbController extends BaseController<Dlb, Integer>{ 23 public class DlbController extends BaseController<Dlb, Integer>{
  24 + @Autowired
  25 + DlbService service;
  26 + /**
  27 + *
  28 + * @Title: list
  29 + * @Description: TODO(多条件分页查询)
  30 + * @param @param map 查询条件
  31 + * @param @param page 页码
  32 + * @param @param size 每页显示数量
  33 + * @throws
  34 + */
  35 + @RequestMapping(method = RequestMethod.GET)
  36 + public Page<Dlb> list(@RequestParam Map<String, Object> map,
  37 + @RequestParam(defaultValue = "0") int page,
  38 + @RequestParam(defaultValue = "10") int size,
  39 + @RequestParam(defaultValue = "id") String order,
  40 + @RequestParam(defaultValue = "DESC") String direction){
  41 +
  42 + Direction d;
  43 +// map.put("xlbm_like", map.get("xlbm_like").toString().trim());
  44 +// try {
  45 + String rq=map.get("rq").toString();
  46 + if(!(rq=="")){
  47 +//
  48 +// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  49 +// Calendar calendar = new GregorianCalendar();
  50 +// calendar.setTime(sdf.parse(rq));
  51 +// calendar.add(calendar.DATE,1);
  52 +// Date date=calendar.getTime();
  53 + map.put("rq_eq", rq);
  54 +// map.put("rq_lt", sdf.format(date));
  55 +// System.out.println(rq);
  56 +// System.out.println(sdf.format(date));
  57 + }
  58 +// } catch (ParseException e) {
  59 +// // TODO Auto-generated catch block
  60 +// e.printStackTrace();
  61 +// }
  62 + if(null != direction && direction.equals("ASC"))
  63 + d = Direction.ASC;
  64 + else
  65 + d = Direction.DESC;
  66 +
  67 + // 允许多个字段排序,order可以写单个字段,也可以写多个字段
  68 + // 多个字段格式:{col1},{col2},{col3},....,{coln}
  69 + // 每个字段的排序方向都是一致,这个以后再看要不要改
  70 + List<String> list = Splitter.on(",").trimResults().splitToList(order);
  71 + return baseService.list(map, new PageRequest(page, size, new Sort(d, list)));
  72 + }
  73 +
  74 + @RequestMapping(value = "/obtain",method = RequestMethod.GET)
  75 + public Map<String, Object> obtain(@RequestParam Map<String, Object> map){
  76 + Map<String, Object> list=service.obtain(map);
  77 + System.out.println();
  78 + return list;
  79 + }
  80 +
  81 + /**
  82 + * 保存电量
  83 + * @param map
  84 + * @return
  85 + */
  86 + @RequestMapping(value = "/sort",method = RequestMethod.GET)
  87 + public Map<String, Object> sort(@RequestParam Map<String, Object> map){
  88 + Map<String, Object> list=service.sort(map);
  89 + return list;
  90 + }
11 91
  92 + /**
  93 + * 核对电量(有加电没里程)
  94 + * @param map
  95 + * @return
  96 + */
  97 + @RequestMapping(value = "/checkDl",method = RequestMethod.GET)
  98 + public Map<String, Object> checkDl(@RequestParam Map<String, Object> map){
  99 + Map<String, Object> list=service.checkDl(map);
  100 + return list;
  101 + }
12 } 102 }
src/main/java/com/bsth/controller/oil/YlbController.java
@@ -50,8 +50,14 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -50,8 +50,14 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
50 * @return 50 * @return
51 */ 51 */
52 @RequestMapping(value = "/obtain",method = RequestMethod.GET) 52 @RequestMapping(value = "/obtain",method = RequestMethod.GET)
53 - public Map<String, Object> obtain(@RequestParam Map<String, Object> map){  
54 - Map<String, Object> list=yblService.obtain(map); 53 + public Map<String, Object> obtain(@RequestParam Map<String, Object> map) throws Exception{
  54 + Map<String, Object> list =new HashMap<String, Object>();
  55 + try {
  56 + list = yblService.obtain(map);
  57 + } catch (Exception e) {
  58 + // TODO Auto-generated catch block
  59 + throw e;
  60 + }
55 System.out.println(); 61 System.out.println();
56 return list; 62 return list;
57 } 63 }
@@ -73,8 +79,14 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -73,8 +79,14 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
73 * @return 79 * @return
74 */ 80 */
75 @RequestMapping(value = "/outAndIn",method = RequestMethod.GET) 81 @RequestMapping(value = "/outAndIn",method = RequestMethod.GET)
76 - public Map<String, Object> outAndIn(@RequestParam Map<String, Object> map){  
77 - Map<String, Object> list=yblService.outAndIn(map); 82 + public Map<String, Object> outAndIn(@RequestParam Map<String, Object> map) throws Exception{
  83 + Map<String, Object> list=new HashMap<String, Object>();
  84 + try {
  85 + list=yblService.outAndIn(map);
  86 + } catch (Exception e) {
  87 + // TODO: handle exception
  88 + }
  89 +
78 return list; 90 return list;
79 } 91 }
80 92
@@ -107,8 +119,15 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -107,8 +119,15 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
107 119
108 Direction d; 120 Direction d;
109 map.put("xlbm_like", map.get("xlbm_like").toString().trim()); 121 map.put("xlbm_like", map.get("xlbm_like").toString().trim());
110 -// try {  
111 String rq=map.get("rq").toString(); 122 String rq=map.get("rq").toString();
  123 + int lx=Integer.parseInt(map.get("sxtj").toString().trim());
  124 + if(lx>0){
  125 + map.put("nbbm_in", yblService.checkNbmmNum(rq, map.get("ssgsdm_like").toString(),
  126 + map.get("fgsdm_like").toString(), map.get("xlbm_like").toString(),
  127 + map.get("nbbm_eq").toString(),lx));
  128 + }
  129 +// try {
  130 +
112 if(!(rq=="")){ 131 if(!(rq=="")){
113 // 132 //
114 // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); 133 // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
@@ -143,6 +162,11 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -143,6 +162,11 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
143 return yblService.oilListMonth(line, date); 162 return yblService.oilListMonth(line, date);
144 } 163 }
145 164
  165 + @RequestMapping(value = "/sumYlb",method = RequestMethod.GET)
  166 + public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){
  167 + Map<String, Object> list=yblService.sumYlb(map);
  168 + return list;
  169 + }
146 170
147 @RequestMapping(value = "/listExport",method = RequestMethod.POST) 171 @RequestMapping(value = "/listExport",method = RequestMethod.POST)
148 public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){ 172 public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){
src/main/java/com/bsth/controller/realcontrol/OilStationSocietyController.java 0 → 100644
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.entity.realcontrol.OilStationSociety;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +/**
  9 + * Created by panzhao on 2017/3/16.
  10 + */
  11 +@RestController
  12 +@RequestMapping("/oilStation")
  13 +public class OilStationSocietyController extends BaseController<OilStationSociety, String>{
  14 +}
src/main/java/com/bsth/controller/realcontrol/PageForwardingController.java
1 package com.bsth.controller.realcontrol; 1 package com.bsth.controller.realcontrol;
2 2
  3 +import com.bsth.entity.sys.Role;
3 import com.bsth.entity.sys.SysUser; 4 import com.bsth.entity.sys.SysUser;
4 import com.bsth.security.util.SecurityUtils; 5 import com.bsth.security.util.SecurityUtils;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
5 import org.springframework.stereotype.Controller; 8 import org.springframework.stereotype.Controller;
6 import org.springframework.web.bind.annotation.RequestMapping; 9 import org.springframework.web.bind.annotation.RequestMapping;
7 import org.springframework.web.servlet.ModelAndView; 10 import org.springframework.web.servlet.ModelAndView;
8 11
  12 +import javax.servlet.http.HttpServletResponse;
  13 +
9 /** 14 /**
10 * 线调登入页面转发 15 * 线调登入页面转发
11 * Created by panzhao on 2017/1/21. 16 * Created by panzhao on 2017/1/21.
@@ -14,18 +19,36 @@ import org.springframework.web.servlet.ModelAndView; @@ -14,18 +19,36 @@ import org.springframework.web.servlet.ModelAndView;
14 @RequestMapping("real_control") 19 @RequestMapping("real_control")
15 public class PageForwardingController { 20 public class PageForwardingController {
16 21
  22 + Logger logger = LoggerFactory.getLogger(this.getClass());
  23 +
17 @RequestMapping("/v2") 24 @RequestMapping("/v2")
18 - public ModelAndView v2(){ 25 + public ModelAndView v2(HttpServletResponse response){
19 ModelAndView mv = new ModelAndView(); 26 ModelAndView mv = new ModelAndView();
20 SysUser user = SecurityUtils.getCurrentUser(); 27 SysUser user = SecurityUtils.getCurrentUser();
21 28
22 //班次管理员 29 //班次管理员
23 if(user.getUserName().equals("bcgly")){ 30 if(user.getUserName().equals("bcgly")){
24 mv.setViewName("/real_control_v2/sch_manage/sch_imitate.html"); 31 mv.setViewName("/real_control_v2/sch_manage/sch_imitate.html");
  32 + return mv;
25 } 33 }
  34 +
  35 + try{
  36 + //闵行运管所,直接打开地图页面
  37 + if(user.getRoles().size() == 1){
  38 + for(Role role : user.getRoles()){
  39 + if(role.getCodeName().equals("MH_YGS")){
  40 + // 直接重定向
  41 + response.sendRedirect("/pages/mapmonitor/alone/wrap.html");
  42 + return null;
  43 + }
  44 + }
  45 + }
  46 + }catch (Exception e){
  47 + logger.error("", e);
  48 + }
  49 +
26 //正常线调主页 50 //正常线调主页
27 - else  
28 - mv.setViewName("/real_control_v2/main.html"); 51 + mv.setViewName("/real_control_v2/main.html");
29 return mv; 52 return mv;
30 } 53 }
31 } 54 }
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
@@ -35,6 +35,11 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -35,6 +35,11 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
35 return scheduleRealInfoService.findByLines(lines); 35 return scheduleRealInfoService.findByLines(lines);
36 } 36 }
37 37
  38 + @RequestMapping(value = "/car")
  39 + public List<ScheduleRealInfo> findByCar(String nbbm){
  40 + return dayOfSchedule.findByNbbm(nbbm);
  41 + }
  42 +
38 /** 43 /**
39 * 44 *
40 * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id 45 * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id
@@ -279,13 +284,13 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -279,13 +284,13 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
279 return scheduleRealInfoService.queryUserInfoPx(line, date,state,type); 284 return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);
280 } 285 }
281 286
282 - @RequestMapping(value = "/exportWaybill") 287 + @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET)
283 public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh, 288 public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh,
284 @RequestParam String lpName,@RequestParam String date,@RequestParam String line) { 289 @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {
285 return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date,line); 290 return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date,line);
286 } 291 }
287 292
288 - @RequestMapping(value = "/exportWaybillQp") 293 + @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET)
289 public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh 294 public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh
290 ,@RequestParam String date,@RequestParam String line) { 295 ,@RequestParam String date,@RequestParam String line) {
291 return scheduleRealInfoService.exportWaybillQp( clZbh, date,line); 296 return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);
@@ -308,13 +313,13 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -308,13 +313,13 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
308 return scheduleRealInfoService.findLine(line); 313 return scheduleRealInfoService.findLine(line);
309 } 314 }
310 315
311 - @RequestMapping(value="/findKMBC") 316 + @RequestMapping(value="/findKMBC",method = RequestMethod.GET)
312 public Map<String,Object> findKMBC(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName 317 public Map<String,Object> findKMBC(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
313 ,@RequestParam String date,@RequestParam String line){ 318 ,@RequestParam String date,@RequestParam String line){
314 return scheduleRealInfoService.findKMBC(jName, clZbh,lpName,date,line); 319 return scheduleRealInfoService.findKMBC(jName, clZbh,lpName,date,line);
315 } 320 }
316 321
317 - @RequestMapping(value="/findKMBCQp") 322 + @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET)
318 public Map<String,Object> findKMBCQp(@RequestParam String clZbh 323 public Map<String,Object> findKMBCQp(@RequestParam String clZbh
319 ,@RequestParam String date,@RequestParam String line){ 324 ,@RequestParam String date,@RequestParam String line){
320 return scheduleRealInfoService.findKMBCQp(clZbh,date,line); 325 return scheduleRealInfoService.findKMBCQp(clZbh,date,line);
@@ -344,13 +349,13 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -344,13 +349,13 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
344 * @param lpName 路牌 349 * @param lpName 路牌
345 * @return 350 * @return
346 */ 351 */
347 - @RequestMapping(value="/queryListWaybill") 352 + @RequestMapping(value="/queryListWaybill",method = RequestMethod.GET)
348 public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName 353 public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
349 ,@RequestParam String date,@RequestParam String line){ 354 ,@RequestParam String date,@RequestParam String line){
350 return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,line); 355 return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,line);
351 } 356 }
352 357
353 - @RequestMapping(value="/queryListWaybillQp") 358 + @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET)
354 public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh, 359 public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,
355 @RequestParam String date,@RequestParam String line){ 360 @RequestParam String date,@RequestParam String line){
356 return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line); 361 return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);
@@ -362,6 +367,12 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -362,6 +367,12 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
362 return scheduleRealInfoService.statisticsDaily(line, date, xlName, type); 367 return scheduleRealInfoService.statisticsDaily(line, date, xlName, type);
363 } 368 }
364 369
  370 + @RequestMapping(value="/statisticsDailyTj")
  371 + public List<Map<String,Object>> statisticsDailyTj(@RequestParam String line, @RequestParam String date,
  372 + @RequestParam String date2,@RequestParam String xlName, @RequestParam String type){
  373 + return scheduleRealInfoService.statisticsDailyTj(line, date,date2, xlName, type);
  374 + }
  375 +
365 @RequestMapping(value="/MapById",method = RequestMethod.GET) 376 @RequestMapping(value="/MapById",method = RequestMethod.GET)
366 public Map<String, Object> MapById(@RequestParam("id") Long id){ 377 public Map<String, Object> MapById(@RequestParam("id") Long id){
367 return scheduleRealInfoService.MapById(id); 378 return scheduleRealInfoService.MapById(id);
@@ -457,7 +468,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -457,7 +468,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
457 return scheduleRealInfoService.scheduleDailyExport(map); 468 return scheduleRealInfoService.scheduleDailyExport(map);
458 } 469 }
459 470
460 - @RequestMapping(value = "exportWaybillMore", method = RequestMethod.POST) 471 + @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET)
461 public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){ 472 public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){
462 return scheduleRealInfoService.exportWaybillMore(map); 473 return scheduleRealInfoService.exportWaybillMore(map);
463 } 474 }
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java 0 → 100644
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.data.schedule.DayOfSchedule;
  4 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  5 +import org.apache.commons.lang3.StringUtils;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestParam;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +
  11 +import java.util.ArrayList;
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * 对外的营运数据接口,主要输出当日的数据
  16 + * Created by panzhao on 2017/3/15.
  17 + */
  18 +@RestController
  19 +@RequestMapping("/companyService")
  20 +public class ServiceDataInterface {
  21 +
  22 + private final static String SECRE_KEY = "dVPHJkWUt5FhMT7jrM2dLV7QvlHAmZFd42rs1P0usBx8A7HZki";
  23 +
  24 + @Autowired
  25 + DayOfSchedule dayOfSchedule;
  26 +
  27 + @RequestMapping("/getCurrentDayPlan")
  28 + public List<ScheduleRealInfo> getCurrentDayPlan(
  29 + @RequestParam String companyId,
  30 + @RequestParam String workId,
  31 + @RequestParam String secretKey) {
  32 +
  33 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  34 + return null;
  35 +
  36 + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>();
  37 + for (ScheduleRealInfo sch : all) {
  38 + if (sch.getGsBm() != null
  39 + && sch.getGsBm().equals(companyId)
  40 + && sch.getjGh().equals(workId)) {
  41 + rs.add(sch);
  42 + }
  43 + }
  44 + return rs;
  45 + }
  46 +
  47 + @RequestMapping("/returnCCInfo")
  48 + public List<ScheduleRealInfo> returnCCInfo(@RequestParam String companyId, @RequestParam String secretKey){
  49 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  50 + return null;
  51 +
  52 +
  53 + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>();
  54 + for (ScheduleRealInfo sch : all) {
  55 +
  56 + if (sch.getBcType().equals("out")
  57 + && sch.getGsBm() != null
  58 + && sch.getGsBm().equals(companyId)) {
  59 + rs.add(sch);
  60 + }
  61 + }
  62 + return rs;
  63 + }
  64 +
  65 + @RequestMapping("/returnJCInfo")
  66 + public List<ScheduleRealInfo> returnJCInfo(@RequestParam String companyId, @RequestParam String secretKey){
  67 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  68 + return null;
  69 +
  70 +
  71 + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>();
  72 + for (ScheduleRealInfo sch : all) {
  73 + if (sch.getBcType().equals("in")
  74 + && sch.getGsBm() != null
  75 + && sch.getGsBm().equals(companyId)) {
  76 + rs.add(sch);
  77 + }
  78 + }
  79 + return rs;
  80 + }
  81 +}
src/main/java/com/bsth/controller/realcontrol/dto/LpData.java
@@ -22,7 +22,7 @@ public class LpData { @@ -22,7 +22,7 @@ public class LpData {
22 this.zdzName = sch.getZdzName(); 22 this.zdzName = sch.getZdzName();
23 } 23 }
24 24
25 - public void appendTo(ScheduleRealInfo sch, int type, boolean changeRealTime) { 25 + public void appendTo(ScheduleRealInfo sch, int type) {
26 26
27 if (type == 0) { 27 if (type == 0) {
28 //只换人 28 //只换人
@@ -33,11 +33,11 @@ public class LpData { @@ -33,11 +33,11 @@ public class LpData {
33 } else if (type == 1) { 33 } else if (type == 1) {
34 //只换车 34 //只换车
35 sch.setClZbh(this.nbbm); 35 sch.setClZbh(this.nbbm);
36 -  
37 - //换实际时间 36 + changeRealTime(sch);
  37 + /*//换实际时间
38 if(changeRealTime){ 38 if(changeRealTime){
39 changeRealTime(sch); 39 changeRealTime(sch);
40 - } 40 + }*/
41 41
42 } else if (type == 2) { 42 } else if (type == 2) {
43 //换人并换车 43 //换人并换车
@@ -48,9 +48,9 @@ public class LpData { @@ -48,9 +48,9 @@ public class LpData {
48 sch.setClZbh(this.nbbm); 48 sch.setClZbh(this.nbbm);
49 49
50 //换实际时间 50 //换实际时间
51 - if(changeRealTime){ 51 + //if(changeRealTime){
52 changeRealTime(sch); 52 changeRealTime(sch);
53 - } 53 + //}
54 } 54 }
55 } 55 }
56 56
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -46,7 +46,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -46,7 +46,7 @@ public class DayOfSchedule implements CommandLineRunner {
46 46
47 Logger logger = LoggerFactory.getLogger(this.getClass()); 47 Logger logger = LoggerFactory.getLogger(this.getClass());
48 48
49 - //按线路分组的 “计划” 排班数据 49 + //按线路分组的 “原始计划” 排班数据
50 public static Map<String, List<SchedulePlanInfo>> schedulePlanMap; 50 public static Map<String, List<SchedulePlanInfo>> schedulePlanMap;
51 51
52 // 按车辆分组的班次数据 52 // 按车辆分组的班次数据
@@ -378,9 +378,11 @@ public class DayOfSchedule implements CommandLineRunner { @@ -378,9 +378,11 @@ public class DayOfSchedule implements CommandLineRunner {
378 sch.setZdsj(fmtHHmm.print(fmtHHmm.parseMillis(sch.getFcsj()) + (sch.getBcsj() * 60 * 1000))); 378 sch.setZdsj(fmtHHmm.print(fmtHHmm.parseMillis(sch.getFcsj()) + (sch.getBcsj() * 60 * 1000)));
379 sch.setLate(false); 379 sch.setLate(false);
380 } 380 }
  381 +
  382 + sch.setJhlcOrig(sch.getJhlc());
381 //计划里程为0,设置NULL 383 //计划里程为0,设置NULL
382 - if (sch.getJhlc() != null && sch.getJhlc() == 0)  
383 - sch.setJhlc(null); 384 + //if (sch.getJhlc() != null && sch.getJhlc() == 0)
  385 + // sch.setJhlc(null);
384 } 386 }
385 } catch (Exception e) { 387 } catch (Exception e) {
386 logger.error("", e); 388 logger.error("", e);
@@ -492,6 +494,9 @@ public class DayOfSchedule implements CommandLineRunner { @@ -492,6 +494,9 @@ public class DayOfSchedule implements CommandLineRunner {
492 if (config != null) 494 if (config != null)
493 outConfig = config.getOutConfig(); 495 outConfig = config.getOutConfig();
494 496
  497 + //限定出站既出场的停车场
  498 + String park = config.getTwinsPark();
  499 + boolean limitPark = StringUtils.isNotEmpty(park);
495 boolean flag = false; 500 boolean flag = false;
496 ScheduleRealInfo next = null; 501 ScheduleRealInfo next = null;
497 for (ScheduleRealInfo temp : list) { 502 for (ScheduleRealInfo temp : list) {
@@ -504,7 +509,8 @@ public class DayOfSchedule implements CommandLineRunner { @@ -504,7 +509,8 @@ public class DayOfSchedule implements CommandLineRunner {
504 continue; 509 continue;
505 510
506 //出站既出场,忽略出场班次 511 //出站既出场,忽略出场班次
507 - if (outConfig == 2 && temp.getBcType().equals("out")) 512 + if (outConfig == 2 && temp.getBcType().equals("out")
  513 + && (!limitPark || park.equals(temp.getQdzCode())))
508 continue; 514 continue;
509 515
510 if (flag) { 516 if (flag) {
@@ -527,6 +533,9 @@ public class DayOfSchedule implements CommandLineRunner { @@ -527,6 +533,9 @@ public class DayOfSchedule implements CommandLineRunner {
527 if (config != null) 533 if (config != null)
528 outConfig = config.getOutConfig(); 534 outConfig = config.getOutConfig();
529 535
  536 + //限定出站既出场的停车场
  537 + String park = config.getTwinsPark();
  538 + boolean limitPark = StringUtils.isNotEmpty(park);
530 boolean flag = false; 539 boolean flag = false;
531 ScheduleRealInfo next = null; 540 ScheduleRealInfo next = null;
532 for (ScheduleRealInfo temp : list) { 541 for (ScheduleRealInfo temp : list) {
@@ -539,7 +548,8 @@ public class DayOfSchedule implements CommandLineRunner { @@ -539,7 +548,8 @@ public class DayOfSchedule implements CommandLineRunner {
539 continue; 548 continue;
540 549
541 //出站既出场,忽略出场班次 550 //出站既出场,忽略出场班次
542 - if (outConfig == 2 && temp.getBcType().equals("out")) 551 + if (outConfig == 2 && temp.getBcType().equals("out")
  552 + && (!limitPark || park.equals(temp.getQdzCode())))
543 continue; 553 continue;
544 554
545 if (flag && temp.getXlDir().equals(sch.getXlDir())) { 555 if (flag && temp.getXlDir().equals(sch.getXlDir())) {
src/main/java/com/bsth/entity/oil/Cdl.java 0 → 100644
  1 +package com.bsth.entity.oil;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +import javax.persistence.Transient;
  10 +
  11 +import com.bsth.data.BasicData;
  12 +
  13 +@Entity
  14 +@Table(name = "bsth_c_cdl")
  15 +public class Cdl {
  16 + @Id
  17 + @GeneratedValue
  18 + private Integer id;
  19 +
  20 + private String nbbm;
  21 +
  22 + //存电量
  23 + private Double cdl;
  24 +
  25 + private Date updatetime;
  26 +
  27 + //恒定存电
  28 + private Double clcd;
  29 + //公司代码
  30 + private String gsdm;
  31 +
  32 + @Transient
  33 + private String gsname;
  34 +
  35 + @Transient
  36 + private String fgsname;
  37 +
  38 + //分公司代码
  39 + private String fgsdm;
  40 +
  41 + public Integer getId() {
  42 + return id;
  43 + }
  44 +
  45 + public void setId(Integer id) {
  46 + this.id = id;
  47 + }
  48 +
  49 + public String getNbbm() {
  50 + return nbbm;
  51 + }
  52 +
  53 + public void setNbbm(String nbbm) {
  54 + this.nbbm = nbbm;
  55 + }
  56 +
  57 +
  58 + public Double getCdl() {
  59 + return cdl;
  60 + }
  61 +
  62 + public void setCdl(Double cdl) {
  63 + this.cdl = cdl;
  64 + }
  65 +
  66 + public Double getClcd() {
  67 + return clcd;
  68 + }
  69 +
  70 + public void setClcd(Double clcd) {
  71 + this.clcd = clcd;
  72 + }
  73 +
  74 + public Date getUpdatetime() {
  75 + return updatetime;
  76 + }
  77 +
  78 + public void setUpdatetime(Date updatetime) {
  79 + this.updatetime = updatetime;
  80 + }
  81 +
  82 +
  83 + public String getGsdm(){
  84 + return gsdm;
  85 + }
  86 +
  87 + public void setGsdm(String gsdm){
  88 + this.gsdm=gsdm;
  89 + }
  90 +
  91 + public String getFgsdm() {
  92 + return fgsdm;
  93 + }
  94 +
  95 + public void setFgsdm(String fgsdm) {
  96 + this.fgsdm = fgsdm;
  97 + }
  98 +
  99 + public String getGsname() {
  100 + return BasicData.businessCodeNameMap.get(this.gsdm);
  101 + }
  102 +
  103 + public void setGsname(String gsname) {
  104 + this.gsname = gsname;
  105 + }
  106 +
  107 + public String getFgsname() {
  108 + return BasicData.businessFgsCodeNameMap.get(this.fgsdm+"_"+this.gsdm);
  109 + }
  110 +
  111 + public void setFgsname(String fgsname) {
  112 + this.fgsname = fgsname;
  113 + }
  114 +
  115 +
  116 +}
src/main/java/com/bsth/entity/oil/Ylb.java
@@ -30,7 +30,7 @@ public class Ylb { @@ -30,7 +30,7 @@ public class Ylb {
30 private Double jzlc=0.0; 30 private Double jzlc=0.0;
31 private Double czyl=0.0; 31 private Double czyl=0.0;
32 private Double jzyl=0.0; 32 private Double jzyl=0.0;
33 - private Double jzl; 33 + private Double jzl=0.0;
34 private int sfkt; 34 private int sfkt;
35 private String jhsj; 35 private String jhsj;
36 private Double yh=0.0; 36 private Double yh=0.0;
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
@@ -47,6 +47,9 @@ public class LineConfig { @@ -47,6 +47,9 @@ public class LineConfig {
47 /** 出场时间设置 0:真实出场(设备离开缓冲区时间) 1:请求出场时间 2:出站即出场 */ 47 /** 出场时间设置 0:真实出场(设备离开缓冲区时间) 1:请求出场时间 2:出站即出场 */
48 private int outConfig; 48 private int outConfig;
49 49
  50 + /** 出站既出场 对应的停车场 */
  51 + private String twinsPark;
  52 +
50 /** 短语模板 , 号分隔多个 */ 53 /** 短语模板 , 号分隔多个 */
51 private String phraseTemps; 54 private String phraseTemps;
52 55
@@ -208,4 +211,12 @@ public class LineConfig { @@ -208,4 +211,12 @@ public class LineConfig {
208 public void setDownOutDiff(int downOutDiff) { 211 public void setDownOutDiff(int downOutDiff) {
209 this.downOutDiff = downOutDiff; 212 this.downOutDiff = downOutDiff;
210 } 213 }
  214 +
  215 + public String getTwinsPark() {
  216 + return twinsPark;
  217 + }
  218 +
  219 + public void setTwinsPark(String twinsPark) {
  220 + this.twinsPark = twinsPark;
  221 + }
211 } 222 }
src/main/java/com/bsth/entity/realcontrol/OilStationSociety.java 0 → 100644
  1 +package com.bsth.entity.realcontrol;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.Id;
  5 +import javax.persistence.Table;
  6 +
  7 +/**
  8 + * 社会加油站
  9 + * Created by panzhao on 2017/3/16.
  10 + */
  11 +@Entity
  12 +@Table(name = "bsth_c_oil_station")
  13 +public class OilStationSociety {
  14 +
  15 + @Id
  16 + private String lineCode;
  17 +
  18 + /**
  19 + * 加油站名称
  20 + */
  21 + private String stationName;
  22 +
  23 + /**
  24 + * 上行进场距离
  25 + */
  26 + private Double upInMile;
  27 + /**
  28 + * 上行出场距离
  29 + */
  30 + private Double upOutMile;
  31 +
  32 + /**
  33 + * 下行进场距离
  34 + */
  35 + private Double downInMile;
  36 + /**
  37 + * 下行出场距离
  38 + */
  39 + private Double downOutMile;
  40 +
  41 +
  42 + /**
  43 + * 上行进场时间 分钟
  44 + */
  45 + private int upInTime;
  46 + /**
  47 + * 上行出场时间 分钟
  48 + */
  49 + private int upOutTime;
  50 +
  51 + /**
  52 + * 下行进场时间 分钟
  53 + */
  54 + private int downInTime;
  55 + /**
  56 + * 下行出场时间 分钟
  57 + */
  58 + private int downOutTime;
  59 +
  60 +
  61 + public String getLineCode() {
  62 + return lineCode;
  63 + }
  64 +
  65 + public void setLineCode(String lineCode) {
  66 + this.lineCode = lineCode;
  67 + }
  68 +
  69 + public String getStationName() {
  70 + return stationName;
  71 + }
  72 +
  73 + public void setStationName(String stationName) {
  74 + this.stationName = stationName;
  75 + }
  76 +
  77 + public Double getUpInMile() {
  78 + return upInMile;
  79 + }
  80 +
  81 + public void setUpInMile(Double upInMile) {
  82 + this.upInMile = upInMile;
  83 + }
  84 +
  85 + public Double getUpOutMile() {
  86 + return upOutMile;
  87 + }
  88 +
  89 + public void setUpOutMile(Double upOutMile) {
  90 + this.upOutMile = upOutMile;
  91 + }
  92 +
  93 + public Double getDownInMile() {
  94 + return downInMile;
  95 + }
  96 +
  97 + public void setDownInMile(Double downInMile) {
  98 + this.downInMile = downInMile;
  99 + }
  100 +
  101 + public Double getDownOutMile() {
  102 + return downOutMile;
  103 + }
  104 +
  105 + public void setDownOutMile(Double downOutMile) {
  106 + this.downOutMile = downOutMile;
  107 + }
  108 +
  109 + public int getUpInTime() {
  110 + return upInTime;
  111 + }
  112 +
  113 + public void setUpInTime(int upInTime) {
  114 + this.upInTime = upInTime;
  115 + }
  116 +
  117 + public int getUpOutTime() {
  118 + return upOutTime;
  119 + }
  120 +
  121 + public void setUpOutTime(int upOutTime) {
  122 + this.upOutTime = upOutTime;
  123 + }
  124 +
  125 + public int getDownInTime() {
  126 + return downInTime;
  127 + }
  128 +
  129 + public void setDownInTime(int downInTime) {
  130 + this.downInTime = downInTime;
  131 + }
  132 +
  133 + public int getDownOutTime() {
  134 + return downOutTime;
  135 + }
  136 +
  137 + public void setDownOutTime(int downOutTime) {
  138 + this.downOutTime = downOutTime;
  139 + }
  140 +}
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
@@ -88,7 +88,10 @@ public class ScheduleRealInfo { @@ -88,7 +88,10 @@ public class ScheduleRealInfo {
88 /** 计划里程 */ 88 /** 计划里程 */
89 private Double jhlc; 89 private Double jhlc;
90 90
91 - /** 实际里程 */ 91 + /** 原始计划里程 (原计调的数据) */
  92 + private Double jhlcOrig;
  93 +
  94 + /** 实际里程 这个字段被废弃*/
92 private Double realMileage; 95 private Double realMileage;
93 96
94 /** 实际里程 */ 97 /** 实际里程 */
@@ -460,6 +463,9 @@ public class ScheduleRealInfo { @@ -460,6 +463,9 @@ public class ScheduleRealInfo {
460 463
461 public void setJhlc(Double jhlc) { 464 public void setJhlc(Double jhlc) {
462 this.jhlc = jhlc; 465 this.jhlc = jhlc;
  466 + //临加班次 计划公里 和 实际计划公里一样
  467 + if(this.isSflj())
  468 + this.setJhlcOrig(this.getJhlc());
463 } 469 }
464 470
465 public String getSjlc() { 471 public String getSjlc() {
@@ -623,6 +629,11 @@ public class ScheduleRealInfo { @@ -623,6 +629,11 @@ public class ScheduleRealInfo {
623 } 629 }
624 } 630 }
625 631
  632 + @Override
  633 + public int hashCode() {
  634 + return ("schedule_" + this.id).hashCode();
  635 + }
  636 +
626 public String getQdzArrDateJH() { 637 public String getQdzArrDateJH() {
627 return qdzArrDatejh; 638 return qdzArrDatejh;
628 } 639 }
@@ -757,6 +768,7 @@ public class ScheduleRealInfo { @@ -757,6 +768,7 @@ public class ScheduleRealInfo {
757 } 768 }
758 769
759 public void destroy(){ 770 public void destroy(){
  771 + this.jhlc = 0.0;
760 this.status = -1; 772 this.status = -1;
761 } 773 }
762 774
@@ -845,4 +857,22 @@ public class ScheduleRealInfo { @@ -845,4 +857,22 @@ public class ScheduleRealInfo {
845 public void setRealMileage(Double realMileage) { 857 public void setRealMileage(Double realMileage) {
846 this.realMileage = realMileage; 858 this.realMileage = realMileage;
847 } 859 }
  860 +
  861 + public Double getJhlcOrig() {
  862 + return jhlcOrig;
  863 + }
  864 +
  865 + public void setJhlcOrig(Double jhlcOrig) {
  866 + this.jhlcOrig = jhlcOrig;
  867 + }
  868 +
  869 + public void reCalcLate() {
  870 + if(this.getStatus() == 0
  871 + && this.getFcsjActual() == null
  872 + && this.dfsjT < System.currentTimeMillis()){
  873 + this.setLate(true);
  874 + }
  875 + else
  876 + this.setLate(false);
  877 + }
848 } 878 }
src/main/java/com/bsth/entity/schedule/CarConfigInfo.java
1 package com.bsth.entity.schedule; 1 package com.bsth.entity.schedule;
2 2
  3 +import com.bsth.entity.CarPark;
3 import com.bsth.entity.Cars; 4 import com.bsth.entity.Cars;
4 import com.bsth.entity.Line; 5 import com.bsth.entity.Line;
5 import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 6 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@@ -47,9 +48,16 @@ public class CarConfigInfo extends BEntity implements Serializable { @@ -47,9 +48,16 @@ public class CarConfigInfo extends BEntity implements Serializable {
47 private Date qyrq; 48 private Date qyrq;
48 /** 终止日期 */ 49 /** 终止日期 */
49 private Date zzrq; 50 private Date zzrq;
  51 +
  52 +
50 @Column(nullable = false) 53 @Column(nullable = false)
51 /** 停车点(TODO:这个不知道是否要关联)*/ 54 /** 停车点(TODO:这个不知道是否要关联)*/
52 private String tcd; 55 private String tcd;
  56 +
  57 + /** 停车场关联(出场,进场班次会关联停车场) */
  58 + @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
  59 + private CarPark tcc;
  60 +
53 /** 受否切换 0或者1(TODO:不懂,貌似喝历史配车有关) */ 61 /** 受否切换 0或者1(TODO:不懂,貌似喝历史配车有关) */
54 @Column(nullable = false) 62 @Column(nullable = false)
55 private int isSwitch; 63 private int isSwitch;
@@ -248,4 +256,12 @@ public class CarConfigInfo extends BEntity implements Serializable { @@ -248,4 +256,12 @@ public class CarConfigInfo extends BEntity implements Serializable {
248 public void setDownInSj(Double downInSj) { 256 public void setDownInSj(Double downInSj) {
249 this.downInSj = downInSj; 257 this.downInSj = downInSj;
250 } 258 }
  259 +
  260 + public CarPark getTcc() {
  261 + return tcc;
  262 + }
  263 +
  264 + public void setTcc(CarPark tcc) {
  265 + this.tcc = tcc;
  266 + }
251 } 267 }
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
@@ -160,7 +160,10 @@ public class SchedulePlanInfo { @@ -160,7 +160,10 @@ public class SchedulePlanInfo {
160 Boolean isFb, 160 Boolean isFb,
161 CarConfigInfo carConfigInfo, 161 CarConfigInfo carConfigInfo,
162 List<EmployeeConfigInfo> employeeConfigInfoList, 162 List<EmployeeConfigInfo> employeeConfigInfoList,
163 - SchedulePlan schedulePlan) { 163 + SchedulePlan schedulePlan,
  164 + boolean isFirstBc, // 是否第一个班次
  165 + boolean isLastBc // 是否最后一个班次
  166 + ) {
164 167
165 // TODO:关联的公司名称 168 // TODO:关联的公司名称
166 // TODO:关联的公司编码 169 // TODO:关联的公司编码
@@ -266,6 +269,47 @@ public class SchedulePlanInfo { @@ -266,6 +269,47 @@ public class SchedulePlanInfo {
266 // 使用的时刻表名字 269 // 使用的时刻表名字
267 this.ttInfoName = ttInfoDetail.getTtinfo().getName(); 270 this.ttInfoName = ttInfoDetail.getTtinfo().getName();
268 271
  272 + // 使用车辆配置的停车场信息
  273 + String pzType = carConfigInfo.getPzType(); // 配置类型
  274 + if (pzType != null && !pzType.equals("BSY")) {
  275 + if ("ZW".equals(pzType)) { // 只看早晚进出场
  276 + if (isFirstBc) { // 第一个班次是出场
  277 + this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id
  278 + this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code
  279 + this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name
  280 +
  281 + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc();
  282 + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue();
  283 +
  284 + } else if (isLastBc) { // 最后一个班次是进场
  285 + this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id
  286 + this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code
  287 + this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name
  288 +
  289 + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc();
  290 + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue();
  291 + }
  292 +
  293 + } else if ("FS".equals(pzType)) { // 所有进出场
  294 + if ("out".equals(this.bcType)) { // 出场班次
  295 + this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id
  296 + this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code
  297 + this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name
  298 +
  299 + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc();
  300 + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue();
  301 +
  302 + } else if ("in".equals(this.bcType)) {
  303 + this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id
  304 + this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code
  305 + this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name
  306 +
  307 + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc();
  308 + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue();
  309 + }
  310 + }
  311 + }
  312 +
269 } 313 }
270 314
271 315
src/main/java/com/bsth/entity/schedule/rule/ScheduleRule1Flat.java
@@ -71,7 +71,7 @@ public class ScheduleRule1Flat extends BEntity { @@ -71,7 +71,7 @@ public class ScheduleRule1Flat extends BEntity {
71 @NotNull 71 @NotNull
72 private Integer ryStart; 72 private Integer ryStart;
73 73
74 - /** 翻班格式(TODO:这个用在车子上的,暂时不管)*/ 74 + /** 翻班格式(类似格式:1110011)*/
75 private String fbgs; 75 private String fbgs;
76 76
77 public Long getId() { 77 public Long getId() {
src/main/java/com/bsth/entity/search/PredicatesBuilder.java
@@ -69,6 +69,11 @@ public class PredicatesBuilder { @@ -69,6 +69,11 @@ public class PredicatesBuilder {
69 return cb.in(expression).value(list); 69 return cb.in(expression).value(list);
70 } 70 }
71 71
  72 +
  73 + public static Predicate ins(CriteriaBuilder cb,Path<?> expression, List<String> list){
  74 + return cb.in(expression).value(list);
  75 + }
  76 +
72 public static Predicate gt(CriteriaBuilder cb,Path<Number> expression, Object object){ 77 public static Predicate gt(CriteriaBuilder cb,Path<Number> expression, Object object){
73 try { 78 try {
74 return cb.gt(expression, nf.parse(object.toString())); 79 return cb.gt(expression, nf.parse(object.toString()));
src/main/java/com/bsth/entity/search/SearchOperator.java
@@ -27,5 +27,6 @@ public enum SearchOperator { @@ -27,5 +27,6 @@ public enum SearchOperator {
27 isf, //假 isFalse,boolean 27 isf, //假 isFalse,boolean
28 ist, //真 isTrue,boolean 28 ist, //真 isTrue,boolean
29 date, //时间 29 date, //时间
30 - in //数组 30 + in, //数组
  31 + ins //传参 List<String>
31 } 32 }
src/main/java/com/bsth/entity/sys/RealControAuthority.java
@@ -16,6 +16,7 @@ public class RealControAuthority { @@ -16,6 +16,7 @@ public class RealControAuthority {
16 /** 16 /**
17 * 可调度的线路 , 分隔多个 17 * 可调度的线路 , 分隔多个
18 */ 18 */
  19 + @Column(length = 4000)
19 private String lineCodeStr; 20 private String lineCodeStr;
20 21
21 /** 22 /**
src/main/java/com/bsth/filter/BaseFilter.java
@@ -16,7 +16,7 @@ public abstract class BaseFilter implements Filter { @@ -16,7 +16,7 @@ public abstract class BaseFilter implements Filter {
16 /** 16 /**
17 * 白名单 17 * 白名单
18 */ 18 */
19 - private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, 19 + private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE,
20 Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS }; 20 Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS };
21 21
22 @Override 22 @Override
src/main/java/com/bsth/filter/ResourceFilter.java
@@ -42,7 +42,6 @@ public class ResourceFilter extends BaseFilter { @@ -42,7 +42,6 @@ public class ResourceFilter extends BaseFilter {
42 42
43 if (f.exists() && f.isFile()) { 43 if (f.exists() && f.isFile()) {
44 request.getRequestDispatcher("/?initFragment=" + joinParam(request)).forward(request, response); 44 request.getRequestDispatcher("/?initFragment=" + joinParam(request)).forward(request, response);
45 - ;  
46 } else 45 } else
47 response.sendRedirect("/"); 46 response.sendRedirect("/");
48 } 47 }
src/main/java/com/bsth/repository/CarsRepository.java
@@ -12,4 +12,7 @@ public interface CarsRepository extends BaseRepository&lt;Cars, Integer&gt;{ @@ -12,4 +12,7 @@ public interface CarsRepository extends BaseRepository&lt;Cars, Integer&gt;{
12 12
13 @Query(value="select s from Cars s where s.id in(select e.cl.id from CarConfigInfo e where e.xl.id = ?1) ") 13 @Query(value="select s from Cars s where s.id in(select e.cl.id from CarConfigInfo e where e.xl.id = ?1) ")
14 List<Cars> findCarsByLineId(Integer lineId); 14 List<Cars> findCarsByLineId(Integer lineId);
  15 +
  16 + @Query(value="select s from Cars s")
  17 + List<Cars> findCars();
15 } 18 }
src/main/java/com/bsth/repository/oil/CdlRepository.java 0 → 100644
  1 +package com.bsth.repository.oil;
  2 +
  3 +
  4 +
  5 +import java.util.List;
  6 +
  7 +import org.springframework.data.jpa.repository.Modifying;
  8 +import org.springframework.data.jpa.repository.Query;
  9 +import org.springframework.stereotype.Repository;
  10 +import org.springframework.transaction.annotation.Transactional;
  11 +
  12 +import com.bsth.entity.oil.Cdl;
  13 +import com.bsth.entity.oil.Cyl;
  14 +import com.bsth.repository.BaseRepository;
  15 +
  16 +@Repository
  17 +public interface CdlRepository extends BaseRepository<Cdl, Integer>{
  18 + @Transactional
  19 + @Modifying
  20 + @Query(value="SELECT * FROM bsth_c_cdl ",nativeQuery=true)
  21 + List<Cdl> obtainCdl();
  22 +}
src/main/java/com/bsth/repository/oil/CylRepository.java
@@ -15,6 +15,6 @@ import com.bsth.repository.BaseRepository; @@ -15,6 +15,6 @@ import com.bsth.repository.BaseRepository;
15 public interface CylRepository extends BaseRepository<Cyl, Integer>{ 15 public interface CylRepository extends BaseRepository<Cyl, Integer>{
16 @Transactional 16 @Transactional
17 @Modifying 17 @Modifying
18 - @Query(value="SELECT * FROM bsth_c_cyl ",nativeQuery=true)  
19 - List<Cyl> obtainCyl(); 18 + @Query(value="SELECT * FROM bsth_c_cyl where nbbm like %?1% and gsdm like %?2%",nativeQuery=true)
  19 + List<Cyl> obtainCyl(String nbbm,String gsdm);
20 } 20 }
src/main/java/com/bsth/repository/oil/DlbRepository.java
1 package com.bsth.repository.oil; 1 package com.bsth.repository.oil;
2 2
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.Modifying;
  6 +import org.springframework.data.jpa.repository.Query;
3 import org.springframework.stereotype.Repository; 7 import org.springframework.stereotype.Repository;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +
4 import com.bsth.entity.oil.Dlb; 10 import com.bsth.entity.oil.Dlb;
  11 +import com.bsth.entity.oil.Ylb;
5 import com.bsth.repository.BaseRepository; 12 import com.bsth.repository.BaseRepository;
6 13
7 @Repository 14 @Repository
8 public interface DlbRepository extends BaseRepository<Dlb, Integer>{ 15 public interface DlbRepository extends BaseRepository<Dlb, Integer>{
  16 + /**
  17 + * 前一天DLB信息
  18 + * @param rq
  19 + * @return
  20 + */
  21 + @Transactional
  22 + @Modifying
  23 + @Query(value="SELECT a.* FROM bsth_c_dlb a where to_days(?1)-to_days(a.rq)=1"
  24 + + " and jcsx=(select max(b.jcsx) from bsth_c_dlb b where a.nbbm=b.nbbm and "
  25 + + " to_days(?1)-to_days(b.rq)=1 )",nativeQuery=true)
  26 + List<Dlb> obtainYlbefore(String rq);
  27 + /**
  28 + * 当天DLB信息
  29 + * @param rq
  30 + * @return
  31 + */
  32 + @Transactional
  33 + @Modifying
  34 + @Query(value="SELECT * FROM bsth_c_dlb where to_days(?)=to_days(rq)",nativeQuery=true)
  35 + List<Dlb> obtainDl(String rq);
9 36
10 } 37 }
src/main/java/com/bsth/repository/oil/JdlRepository.java
@@ -27,6 +27,12 @@ public interface JdlRepository extends BaseRepository&lt;Jdl, Integer&gt;{ @@ -27,6 +27,12 @@ public interface JdlRepository extends BaseRepository&lt;Jdl, Integer&gt;{
27 @Query(value="SELECT * FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm like %?4%",nativeQuery=true) 27 @Query(value="SELECT * FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm like %?4%",nativeQuery=true)
28 List<Jdl> query(String gsbm, String fgsbm, String rq, String nbbm); 28 List<Jdl> query(String gsbm, String fgsbm, String rq, String nbbm);
29 29
  30 +
  31 + @Transactional
  32 + @Modifying
  33 + @Query(value="SELECT * FROM bsth_c_jdl where rq = ?",nativeQuery=true)
  34 + List<Jdl> JdlList( String rq);
  35 +
30 @Transactional 36 @Transactional
31 @Modifying 37 @Modifying
32 @Query(value="SELECT jdl FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm = ?4 and jdz = ?5",nativeQuery=true) 38 @Query(value="SELECT jdl FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm = ?4 and jdz = ?5",nativeQuery=true)
src/main/java/com/bsth/repository/oil/YlbRepository.java
@@ -23,8 +23,9 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{ @@ -23,8 +23,9 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
23 @Modifying 23 @Modifying
24 @Query(value="SELECT a.* FROM bsth_c_ylb a where to_days(?1)-to_days(a.rq)=1" 24 @Query(value="SELECT a.* FROM bsth_c_ylb a where to_days(?1)-to_days(a.rq)=1"
25 + " and jcsx=(select max(b.jcsx) from bsth_c_ylb b where a.nbbm=b.nbbm and " 25 + " and jcsx=(select max(b.jcsx) from bsth_c_ylb b where a.nbbm=b.nbbm and "
26 - + " to_days(?1)-to_days(b.rq)=1 )",nativeQuery=true)  
27 - List<Ylb> obtainYlbefore(String rq); 26 + + " to_days(?1)-to_days(b.rq)=1 ) and ssgsdm like %?2% and fgsdm like %?3% and "
  27 + + " xlbm like %?4% and nbbm like %?5% ",nativeQuery=true)
  28 + List<Ylb> obtainYlbefore(String rq,String gsbm,String fgsbm,String xlbm,String nbbm);
28 29
29 /** 30 /**
30 * 当天YLB信息 31 * 当天YLB信息
@@ -33,8 +34,10 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{ @@ -33,8 +34,10 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
33 */ 34 */
34 @Transactional 35 @Transactional
35 @Modifying 36 @Modifying
36 - @Query(value="SELECT * FROM bsth_c_ylb where to_days(?)=to_days(rq)",nativeQuery=true)  
37 - List<Ylb> obtainYl(String rq); 37 + @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and ssgsdm like %?2% "
  38 + + " and fgsdm like %?3%"
  39 + + " and xlbm like %?4% and nbbm like %?5% order by ?6 asc ",nativeQuery=true)
  40 + List<Ylb> obtainYl(String rq,String gsdm,String fgsdm,String xlbm,String nbbm,String px);
38 41
39 42
40 @Transactional 43 @Transactional
@@ -48,6 +51,41 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{ @@ -48,6 +51,41 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
48 */ 51 */
49 @Transactional 52 @Transactional
50 @Modifying 53 @Modifying
51 - @Query(value="select sum(jzl) as jzl,sum(zlc) as zlc from bsth_c_ylb where nbbm=?1 and rq=?2",nativeQuery=true)  
52 - List<Object[]> sumLcYl(String nbbm,Date rq); 54 + @Query(value="select ifnull(jzl,0),ifnull(zlc,0),ifnull(sh,0) from bsth_c_ylb where nbbm=?1 and rq=?2 and xlbm like %?3%",nativeQuery=true)
  55 + List<Object[]> sumLcYl(String nbbm,Date rq,String xlbm);
  56 +
  57 + /**
  58 + *
  59 + * @param nbbm
  60 + * @param rq
  61 + * @param xlbm
  62 + * @return
  63 + */
  64 + @Transactional
  65 + @Modifying
  66 + @Query(value="select nbbm,count(nbbm) from bsth_c_ylb where to_days(?1)=to_days(rq) and "
  67 + + " ssgsdm like %?2% "
  68 + + " and fgsdm like %?3%"
  69 + + " and xlbm like %?4% and nbbm like %?5% "
  70 + + " group by nbbm,rq,ssgsdm,fgsdm,xlbm",nativeQuery=true)
  71 + List<Object[]> checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
  72 +
  73 +
  74 + @Query(value="select jzl,yh,sh from Ylb s "
  75 + + " where to_days(?1)=to_days(s.rq) "
  76 + + " and s.ssgsdm like %?2% "
  77 + + " and s.fgsdm like %?3%"
  78 + + " and s.xlbm like %?4% "
  79 + + " and s.nbbm in ?5 ")
  80 + List<Object[]> sumYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  81 +
  82 + @Transactional
  83 + @Modifying
  84 + @Query(value="select ifnull(jzl,0),ifnull(yh,0),ifnull(sh,0) from bsth_c_ylb "
  85 + + " where to_days(?1)=to_days(rq) "
  86 + + " and ssgsdm like %?2% "
  87 + + " and fgsdm like %?3%"
  88 + + " and xlbm like %?4% "
  89 + + " and nbbm like %?5%",nativeQuery=true)
  90 + List<Object[]> sumYlb2(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
53 } 91 }
src/main/java/com/bsth/repository/oil/YlxxbRepository.java
@@ -19,8 +19,8 @@ public interface YlxxbRepository extends BaseRepository&lt;Ylxxb, Integer&gt;{ @@ -19,8 +19,8 @@ public interface YlxxbRepository extends BaseRepository&lt;Ylxxb, Integer&gt;{
19 */ 19 */
20 @Transactional 20 @Transactional
21 @Modifying 21 @Modifying
22 - @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?)=to_days(yyrq)",nativeQuery=true)  
23 - List<Ylxxb> obtainYlxx(String rq); 22 + @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?1)=to_days(yyrq) and nylx=?2 and gsdm like %?3%",nativeQuery=true)
  23 + List<Ylxxb> obtainYlxx(String rq,int nylx,String gsdm);
24 24
25 @Transactional 25 @Transactional
26 @Modifying 26 @Modifying
src/main/java/com/bsth/repository/realcontrol/ChildTaskPlanRepository.java
1 package com.bsth.repository.realcontrol; 1 package com.bsth.repository.realcontrol;
2 2
3 -import java.util.List;  
4 - 3 +import com.bsth.entity.realcontrol.ChildTaskPlan;
  4 +import com.bsth.repository.BaseRepository;
5 import org.springframework.data.jpa.domain.Specification; 5 import org.springframework.data.jpa.domain.Specification;
6 import org.springframework.data.jpa.repository.EntityGraph; 6 import org.springframework.data.jpa.repository.EntityGraph;
7 import org.springframework.stereotype.Repository; 7 import org.springframework.stereotype.Repository;
8 8
9 -import com.bsth.entity.realcontrol.ChildTaskPlan;  
10 -import com.bsth.repository.BaseRepository; 9 +import java.util.List;
11 10
12 @Repository 11 @Repository
13 public interface ChildTaskPlanRepository extends BaseRepository<ChildTaskPlan, Long>{ 12 public interface ChildTaskPlanRepository extends BaseRepository<ChildTaskPlan, Long>{
@@ -15,4 +14,8 @@ public interface ChildTaskPlanRepository extends BaseRepository&lt;ChildTaskPlan, L @@ -15,4 +14,8 @@ public interface ChildTaskPlanRepository extends BaseRepository&lt;ChildTaskPlan, L
15 @EntityGraph(value = "childTaskPlan_schedule", type = EntityGraph.EntityGraphType.FETCH) 14 @EntityGraph(value = "childTaskPlan_schedule", type = EntityGraph.EntityGraphType.FETCH)
16 @Override 15 @Override
17 List<ChildTaskPlan> findAll(Specification<ChildTaskPlan> spec); 16 List<ChildTaskPlan> findAll(Specification<ChildTaskPlan> spec);
  17 +
  18 + @EntityGraph(value = "childTaskPlan_schedule", type = EntityGraph.EntityGraphType.FETCH)
  19 + @Override
  20 + ChildTaskPlan findOne(Long id);
18 } 21 }
src/main/java/com/bsth/repository/realcontrol/OilStationSocietyRepository.java 0 → 100644
  1 +package com.bsth.repository.realcontrol;
  2 +
  3 +import com.bsth.entity.realcontrol.OilStationSociety;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +/**
  8 + * Created by panzhao on 2017/3/16.
  9 + */
  10 +@Repository
  11 +public interface OilStationSocietyRepository extends BaseRepository<OilStationSociety, String>{
  12 +}
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -65,11 +65,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -65,11 +65,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
65 int countByDate(String date); 65 int countByDate(String date);
66 66
67 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 67 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
68 - @Query(value = "select s from ScheduleRealInfo s where s.scheduleDateStr = ?1") 68 + @Query(value = "select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr = ?1")
69 List<ScheduleRealInfo> findByDate(String dateStr); 69 List<ScheduleRealInfo> findByDate(String dateStr);
70 70
71 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 71 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
72 - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and cl_zbh=?3 order by bcs") 72 + @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")
73 List<ScheduleRealInfo> findByDate2(String line,String date,String clzbh); 73 List<ScheduleRealInfo> findByDate2(String line,String date,String clzbh);
74 74
75 @Query(value="select count(jName) from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.status = -1") 75 @Query(value="select count(jName) from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.status = -1")
@@ -86,26 +86,31 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -86,26 +86,31 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
86 + " and clZbh like %?5% order by s.fcsj") 86 + " and clZbh like %?5% order by s.fcsj")
87 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code); 87 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code);
88 88
89 - @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 s.xlBm=?5 order by realExecDate,fcsj") 89 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  90 + @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")
90 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line); 91 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line);
91 92
92 - @Query(value="select 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") 93 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  94 + @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")
93 List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line); 95 List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line);
94 96
95 - @Query(value="select s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') order by realExecDate,fcsj")  
96 - List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date); 97 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  98 + @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,fcsj")
  99 + List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm);
97 100
98 - @Query(value="select 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") 101 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  102 + @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")
99 List<ScheduleRealInfo> queryListWaybill4(String jName,String clZbh,String date,String enddate); 103 List<ScheduleRealInfo> queryListWaybill4(String jName,String clZbh,String date,String enddate);
100 104
101 - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") 105 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  106 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
102 List<ScheduleRealInfo> scheduleDaily(String line,String date); 107 List<ScheduleRealInfo> scheduleDaily(String line,String date);
103 108
104 @Query(value = "select count(*) from ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2") 109 @Query(value = "select count(*) from ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2")
105 int countByLineCodeAndDate(String xlBm, String schDate); 110 int countByLineCodeAndDate(String xlBm, String schDate);
106 111
107 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 112 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
108 - @Query(value = "select s from ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2") 113 + @Query(value = "select DISTINCT s from ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2")
109 List<ScheduleRealInfo> findByLineCodeAndDate(String xlBm, String schDate); 114 List<ScheduleRealInfo> findByLineCodeAndDate(String xlBm, String schDate);
110 115
111 @Modifying 116 @Modifying
@@ -127,8 +132,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -127,8 +132,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
127 @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m') = ?2 and s.bcType not in ('in','out') order by s.xlBm") 132 @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m') = ?2 and s.bcType not in ('in','out') order by s.xlBm")
128 List<ScheduleRealInfo> scheduleByDateAndLine3(String line,String date); 133 List<ScheduleRealInfo> scheduleByDateAndLine3(String line,String date);
129 134
130 - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY xlBm,clZbh")  
131 - List<Map<String,Object>> yesterdayDataList(String line,String date); 135 + //按照时间段统计
  136 + @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 and s.bcType not in ('in','out') order by s.xlBm")
  137 + List<ScheduleRealInfo> scheduleByDateAndLineTj(String line,String date,String date2);
  138 +
  139 + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) 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% GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY xlBm,clZbh")
  140 + List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm);
132 141
133 @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir") 142 @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir")
134 List<ScheduleRealInfo> setLD(String date); 143 List<ScheduleRealInfo> setLD(String date);
src/main/java/com/bsth/repository/schedule/SchedulePlanInfoRepository.java
@@ -49,7 +49,7 @@ public interface SchedulePlanInfoRepository extends BaseRepository&lt;SchedulePlanI @@ -49,7 +49,7 @@ public interface SchedulePlanInfoRepository extends BaseRepository&lt;SchedulePlanI
49 "where info.xl = ?1 and " + 49 "where info.xl = ?1 and " +
50 "info.schedule_date = ?2 " + 50 "info.schedule_date = ?2 " +
51 "group by info.xl_name, info.schedule_date, info.lp, info.lp_name, info.cl, info.cl_zbh " + 51 "group by info.xl_name, info.schedule_date, info.lp, info.lp_name, info.cl, info.cl_zbh " +
52 - "order by info.xl_name, info.schedule_date, info.lp ", nativeQuery = true) 52 + "order by info.xl_name, info.schedule_date, info.lp, info.fcno ", nativeQuery = true)
53 List<Object[]> findGroupInfo(Integer xlid, Date scheduleDate); 53 List<Object[]> findGroupInfo(Integer xlid, Date scheduleDate);
54 54
55 @Modifying 55 @Modifying
src/main/java/com/bsth/repository/sys/DutyEmployeeRepository.java
@@ -13,6 +13,7 @@ import java.util.List; @@ -13,6 +13,7 @@ import java.util.List;
13 @Repository 13 @Repository
14 public interface DutyEmployeeRepository extends BaseRepository<DutyEmployee, Long>{ 14 public interface DutyEmployeeRepository extends BaseRepository<DutyEmployee, Long>{
15 15
16 - @Query("select t from DutyEmployee t where t.codeIdx like %?1% and t.ts > ?2 and t.ts < ?3") 16 + //@Query("select t from DutyEmployee t where t.codeIdx like %?1% and t.ts > ?2 and t.ts < ?3")
  17 + @Query("select t from DutyEmployee t where t.codeIdx like %?1% and t.ts < ?3")
17 List<DutyEmployee> findByLineAndTime(String lineCode, long st, long et); 18 List<DutyEmployee> findByLineAndTime(String lineCode, long st, long et);
18 } 19 }
src/main/java/com/bsth/security/WebSecurityConfig.java
@@ -36,7 +36,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @@ -36,7 +36,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
36 public void configure(WebSecurity web) throws Exception { 36 public void configure(WebSecurity web) throws Exception {
37 // 白名单 37 // 白名单
38 web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA, 38 web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA,
39 - Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS); 39 + Constants.SERVICE_INTERFACE, Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS);
40 } 40 }
41 41
42 @Override 42 @Override
src/main/java/com/bsth/service/forms/impl/CommonServiceImpl.java
@@ -101,7 +101,7 @@ public class CommonServiceImpl implements CommonService{ @@ -101,7 +101,7 @@ public class CommonServiceImpl implements CommonService{
101 + " order by bcs"; 101 + " order by bcs";
102 102
103 103
104 - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh , date); 104 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh , date,"","");
105 105
106 DecimalFormat format = new DecimalFormat("0.00"); 106 DecimalFormat format = new DecimalFormat("0.00");
107 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); 107 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
@@ -2,6 +2,7 @@ package com.bsth.service.forms.impl; @@ -2,6 +2,7 @@ package com.bsth.service.forms.impl;
2 2
3 import java.sql.ResultSet; 3 import java.sql.ResultSet;
4 import java.sql.SQLException; 4 import java.sql.SQLException;
  5 +import java.text.DecimalFormat;
5 import java.text.NumberFormat; 6 import java.text.NumberFormat;
6 import java.text.ParseException; 7 import java.text.ParseException;
7 import java.text.SimpleDateFormat; 8 import java.text.SimpleDateFormat;
@@ -23,6 +24,7 @@ import com.bsth.entity.mcy_forms.Singledata; @@ -23,6 +24,7 @@ import com.bsth.entity.mcy_forms.Singledata;
23 import com.bsth.entity.mcy_forms.Turnoutrate; 24 import com.bsth.entity.mcy_forms.Turnoutrate;
24 import com.bsth.entity.mcy_forms.Vehicleloading; 25 import com.bsth.entity.mcy_forms.Vehicleloading;
25 import com.bsth.entity.mcy_forms.Waybillday; 26 import com.bsth.entity.mcy_forms.Waybillday;
  27 +import com.bsth.data.BasicData;
26 import com.bsth.entity.mcy_forms.Allline; 28 import com.bsth.entity.mcy_forms.Allline;
27 import com.bsth.entity.mcy_forms.Changetochange; 29 import com.bsth.entity.mcy_forms.Changetochange;
28 import com.bsth.entity.mcy_forms.Daily; 30 import com.bsth.entity.mcy_forms.Daily;
@@ -47,33 +49,33 @@ public class FormsServiceImpl implements FormsService { @@ -47,33 +49,33 @@ public class FormsServiceImpl implements FormsService {
47 @Override 49 @Override
48 public List<Waybillday> waybillday(Map<String, Object> map) { 50 public List<Waybillday> waybillday(Map<String, Object> map) {
49 51
50 - String sql ="select x.j_gh,x.cl_zbh,z.JZL,z.YH,z.personnel_name,x.schedule_date,x.gs_bm,x.gs_name,x.fgs_bm,x.fgs_name "  
51 - + " from bsth_c_s_sp_info_real x INNER join "  
52 - + " ( select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH,c.personnel_name from"  
53 - + " bsth_c_ylb y LEFT JOIN bsth_c_personnel c ON c.job_code=y.JSY "  
54 - + " where 1=1 ";  
55 - if(map.get("date").toString()!=""){  
56 - sql+=" and to_days(y.RQ)=to_days('"+map.get("date").toString() + "') ";  
57 - }  
58 - if( map.get("line").toString()!=""){  
59 - sql+=" and y.XLBM= '"+ map.get("line").toString()+"' GROUP BY y.NBBM) ";  
60 - }  
61 - sql+= " z on x.cl_zbh=z.nbbm where to_days( x.schedule_date)=to_days('"+map.get("date").toString()+"') ";  
62 - if(map.get("gsdmWaybillday").toString()!=""){  
63 - sql+=" and x.gs_bm='"+map.get("gsdmWaybillday").toString()+"'";  
64 - }  
65 - if(map.get("fgsdmWaybillday").toString()!=""){  
66 - sql+=" and x.fgs_bm='"+map.get("fgsdmWaybillday").toString()+"'";  
67 - }  
68 - sql += " GROUP BY x.j_gh,x.cl_zbh,z.JZL,z.YH,z.personnel_name,x.schedule_date,x.gs_bm,x.gs_name,x.fgs_bm,x.fgs_name "; 52 +
  53 +
  54 + String sql=" select t.*,z.jzl,z.yh from ("
  55 + + " select x.j_gh,x.cl_zbh,x.j_name,x.schedule_date,"
  56 + + " x.gs_bm,x.gs_name,x.fgs_bm,x.fgs_name from bsth_c_s_sp_info_real x "
  57 + + " where to_days( x.schedule_date)=to_days('"+map.get("date").toString() + "') "
  58 + + " and x.gs_bm='"+map.get("gsdmWaybillday").toString()+"' "
  59 + + " and x.fgs_bm='"+map.get("fgsdmWaybillday").toString()+"' "
  60 + + " and xl_bm like '%"+ map.get("line").toString().trim()+"%'"
  61 + + " GROUP BY x.j_gh,x.cl_zbh,x.j_name,"
  62 + + " x.schedule_date,x.gs_bm,x.gs_name,x.fgs_bm,x.fgs_name ) t"
  63 + + " LEFT join (select y.rq,y.xlbm,y.nbbm,y.jsy,y.jzl,y.yh from"
  64 + + " bsth_c_ylb y where 1=1 "
  65 + + " and to_days(y.RQ)=to_days('"+map.get("date").toString() + "') "
  66 + + " and y.XLBM like '%"+ map.get("line").toString().trim()+"%'"
  67 + + " and y.ssgsdm='"+map.get("gsdmWaybillday").toString()+"'"
  68 + + " and y.fgsdm='"+map.get("gsdmWaybillday").toString()+"') z "
  69 + + " on t.cl_zbh=z.nbbm ";
  70 +
69 List<Waybillday> list = jdbcTemplate.query(sql, new RowMapper<Waybillday>() { 71 List<Waybillday> list = jdbcTemplate.query(sql, new RowMapper<Waybillday>() {
70 @Override 72 @Override
71 public Waybillday mapRow(ResultSet arg0, int arg1) throws SQLException { 73 public Waybillday mapRow(ResultSet arg0, int arg1) throws SQLException {
72 Waybillday wbd = new Waybillday(); 74 Waybillday wbd = new Waybillday();
73 wbd.setCarPlate(arg0.getString("cl_zbh")); 75 wbd.setCarPlate(arg0.getString("cl_zbh"));
74 - wbd.setJzl(arg0.getString("JZL"));  
75 - wbd.setYh(arg0.getString("YH"));  
76 - wbd.setjName(arg0.getString("personnel_name")); 76 + wbd.setJzl(arg0.getString("jzl"));
  77 + wbd.setYh(arg0.getString("yh"));
  78 + wbd.setjName(arg0.getString("j_name"));
77 wbd.setRq(arg0.getString("schedule_date")); 79 wbd.setRq(arg0.getString("schedule_date"));
78 wbd.setJgh(arg0.getString("j_gh")); 80 wbd.setJgh(arg0.getString("j_gh"));
79 return wbd; 81 return wbd;
@@ -193,7 +195,15 @@ public class FormsServiceImpl implements FormsService { @@ -193,7 +195,15 @@ public class FormsServiceImpl implements FormsService {
193 // 班次车辆人员日统计 195 // 班次车辆人员日统计
194 @Override 196 @Override
195 public List<Shifday> shifday(Map<String, Object> map) { 197 public List<Shifday> shifday(Map<String, Object> map) {
196 - String sql = " select r.schedule_date,r.lp_name,r.xl_name,r.j_name,r.s_name, r.cl_zbh,r.xl_bm," 198 +
  199 + String sql ="select t.* from (select r.schedule_date,r.j_name,IFNULL(r.s_name,'')as s_name,"
  200 + + " r.cl_zbh,r.xl_bm, r.j_gh,r.gs_bm,r.fgs_bm FROM bsth_c_s_sp_info_real r where 1=1 "
  201 + + " and to_days(r.schedule_date)=to_days('"+ map.get("date").toString() + "') "
  202 + + " and r.xl_bm like '%"+map.get("line").toString()+"%' "
  203 + + " and r.gs_bm='"+map.get("gsdmShif").toString()+"' "
  204 + + " and r.fgs_bm='"+map.get("fgsdmShif").toString()+"' ) t"
  205 + + " GROUP BY t.schedule_date,t.j_name,t.s_name, t.cl_zbh,t.xl_bm,t.j_gh,t.gs_bm,t.fgs_bm ";
  206 + /*String sql = " select r.schedule_date,r.lp_name,r.xl_name,r.j_name,r.s_name, r.cl_zbh,r.xl_bm,"
197 + " r.cl_zbh,r.j_gh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name,r.bc_type " 207 + " r.cl_zbh,r.j_gh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name,r.bc_type "
198 + " FROM bsth_c_s_sp_info_real r " 208 + " FROM bsth_c_s_sp_info_real r "
199 + " where 1=1 "; 209 + " where 1=1 ";
@@ -211,20 +221,18 @@ public class FormsServiceImpl implements FormsService { @@ -211,20 +221,18 @@ public class FormsServiceImpl implements FormsService {
211 sql+=" and r.fgs_bm='"+map.get("fgsdmShif").toString()+"'"; 221 sql+=" and r.fgs_bm='"+map.get("fgsdmShif").toString()+"'";
212 } 222 }
213 sql += " GROUP BY r.schedule_date,r.lp_name,r.xl_name,r.j_name,r.s_name, r.cl_zbh,r.xl_bm,r.cl_zbh,r.j_gh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name " 223 sql += " GROUP BY r.schedule_date,r.lp_name,r.xl_name,r.j_name,r.s_name, r.cl_zbh,r.xl_bm,r.cl_zbh,r.j_gh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "
214 - + " ORDER BY r.lp_name asc"; 224 + + " ORDER BY r.lp_name asc";*/
215 225
216 List<Shifday> list = jdbcTemplate.query(sql, new RowMapper<Shifday>() { 226 List<Shifday> list = jdbcTemplate.query(sql, new RowMapper<Shifday>() {
217 227
218 @Override 228 @Override
219 public Shifday mapRow(ResultSet arg0, int arg1) throws SQLException { 229 public Shifday mapRow(ResultSet arg0, int arg1) throws SQLException {
220 Shifday shifday = new Shifday(); 230 Shifday shifday = new Shifday();
  231 + shifday.setRq(arg0.getString("schedule_date"));
221 shifday.setjName(arg0.getString("j_name").toString()); 232 shifday.setjName(arg0.getString("j_name").toString());
222 shifday.setsName(arg0.getString("s_name") == null ? "" : arg0.getString("s_name").toString()); 233 shifday.setsName(arg0.getString("s_name") == null ? "" : arg0.getString("s_name").toString());
223 - shifday.setLpName(arg0.getString("r.lp_name").toString());  
224 shifday.setCarPlate(arg0.getString("cl_zbh").toString()); 234 shifday.setCarPlate(arg0.getString("cl_zbh").toString());
225 shifday.setJgh(arg0.getString("j_gh")); 235 shifday.setJgh(arg0.getString("j_gh"));
226 - shifday.setZbh(arg0.getString("cl_zbh"));  
227 - shifday.setRq(arg0.getString("schedule_date"));  
228 return shifday; 236 return shifday;
229 } 237 }
230 238
@@ -335,33 +343,28 @@ public class FormsServiceImpl implements FormsService { @@ -335,33 +343,28 @@ public class FormsServiceImpl implements FormsService {
335 String rq3 = sdf1.format(d1); 343 String rq3 = sdf1.format(d1);
336 344
337 rq = rq2 + "-" + rq3; 345 rq = rq2 + "-" + rq3;
338 -  
339 - String sql = " SELECT r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "  
340 - + " FROM bsth_c_s_sp_info_real r "  
341 - + " left join bsth_c_ylb y"  
342 - + " ON r.cl_zbh = y.nbbm "  
343 - + " where r.schedule_date_str BETWEEN '" + map.get("startDate").toString() + "'"  
344 - + " and '"+ map.get("endDate").toString() + "'"  
345 - + " and r.xl_bm='" + map.get("line").toString() + "'"  
346 - + " AND r.gs_bm is not null";  
347 -  
348 - if(map.get("gsdmSing").toString()!=""){  
349 - sql+=" and r.gs_bm='"+map.get("gsdmSing").toString()+"'";  
350 - }  
351 - if(map.get("fgsdmSing").toString()!=""){  
352 - sql+=" and r.fgs_bm='"+map.get("fgsdmSing").toString()+"'";  
353 - }  
354 - sql += " GROUP BY r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name ";  
355 -  
356 startDate = map.get("startDate").toString(); 346 startDate = map.get("startDate").toString();
357 endDate = map.get("endDate").toString(); 347 endDate = map.get("endDate").toString();
  348 + String sql = "select t.*,y.yh,y.jzl from ("
  349 + + " select r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm"
  350 + + " from bsth_c_s_sp_info_real r where r.schedule_date_str "
  351 + + " BETWEEN '"+startDate+"' and '"+endDate+"' and r.xl_bm='"+map.get("line").toString()+"' "
  352 + + " AND r.gs_bm is not null and r.gs_bm='"+map.get("gsdmSing").toString()+"' "
  353 + + " and r.fgs_bm='"+map.get("fgsdmSing").toString()+"' "
  354 + + " group by r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm) t "
  355 + + " LEFT JOIN (select a.nbbm,a.jsy,SUM(a.yh) as yh,SUM(a.jzl) as jzl "
  356 + + " from bsth_c_ylb a where a.rq BETWEEN '"+startDate+"' and '"+endDate+"'and "
  357 + + " a.ssgsdm='"+map.get("gsdmSing").toString()+"' and a.fgsdm='"+map.get("fgsdmSing").toString()+"' "
  358 + + "group by a.nbbm,a.jsy) y"
  359 + + " on y.nbbm=t.cl_zbh and y.jsy= t.j_gh";
  360 +
358 List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 361 List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
359 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 362 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
360 @Override 363 @Override
361 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 364 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
362 Singledata sin = new Singledata(); 365 Singledata sin = new Singledata();
363 sin.setrQ(rq); 366 sin.setrQ(rq);
364 - sin.setgS(arg0.getString("gs_name")); 367 + sin.setgS(arg0.getString("gs_bm"));
365 sin.setxL(arg0.getString("xl_name")); 368 sin.setxL(arg0.getString("xl_name"));
366 sin.setClzbh(arg0.getString("cl_zbh")); 369 sin.setClzbh(arg0.getString("cl_zbh"));
367 sin.setJsy(arg0.getString("j_gh")); 370 sin.setJsy(arg0.getString("j_gh"));
@@ -374,8 +377,13 @@ public class FormsServiceImpl implements FormsService { @@ -374,8 +377,13 @@ public class FormsServiceImpl implements FormsService {
374 return sin; 377 return sin;
375 } 378 }
376 }); 379 });
  380 + DecimalFormat df = new DecimalFormat("0.00");
377 for(int i=0;i<list.size();i++){ 381 for(int i=0;i<list.size();i++){
  382 +
378 Singledata si=list.get(i); 383 Singledata si=list.get(i);
  384 + si.setgS(BasicData.businessCodeNameMap.get(si.getgS()));
  385 + si.setJzl(df.format(Double.parseDouble(si.getJzl())));
  386 + si.setHyl(df.format(Double.parseDouble(si.getHyl())));
379 Map<String, Object> maps = new HashMap<>(); 387 Map<String, Object> maps = new HashMap<>();
380 maps = commonService.findKMBC1(si.getjName(),si.getClzbh(), startDate, 388 maps = commonService.findKMBC1(si.getjName(),si.getClzbh(), startDate,
381 endDate); 389 endDate);
@@ -712,22 +720,20 @@ public class FormsServiceImpl implements FormsService { @@ -712,22 +720,20 @@ public class FormsServiceImpl implements FormsService {
712 720
713 @Override 721 @Override
714 public List<Daily> daily(Map<String, Object> map) { 722 public List<Daily> daily(Map<String, Object> map) {
715 -  
716 - String sql ="select r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "  
717 - + " from bsth_c_s_sp_info_real r LEFT JOIN bsth_c_ylb y ON r.cl_zbh = y.nbbm "  
718 - + " WHERE 1 = 1"  
719 - + " and r.xl_bm='" + map.get("line").toString() + "'"  
720 - + " and to_days(r.schedule_date)=to_days('"+map.get("date").toString()+"')"  
721 - + " AND r.gs_bm is not null";  
722 -  
723 - if(map.get("gsdmDaily").toString()!=""){  
724 - sql+=" and r.gs_bm='"+map.get("gsdmDaily").toString()+"'";  
725 - }  
726 - if(map.get("fgsdmDaily").toString()!=""){  
727 - sql+=" and r.fgs_bm='"+map.get("fgsdmDaily").toString()+"'";  
728 - }  
729 - sql += " GROUP BY r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name ";  
730 - 723 + String sql="select t.schedule_date_str,"
  724 + + " t.cl_zbh,t.j_gh,t.j_name,x.yh from (select r.schedule_date_str,r.xl_bm,r.xl_name,"
  725 + + " r.cl_zbh,r.j_gh,r.j_name from bsth_c_s_sp_info_real r WHERE "
  726 + + " r.xl_bm='" + map.get("line").toString() + "' and to_days(r.schedule_date)=to_days('"+map.get("date").toString()+"') "
  727 + + " and r.gs_bm like '%"+map.get("gsdmDaily").toString()+"%' "
  728 + + " and r.fgs_bm like '%"+map.get("fgsdmDaily").toString()+"%' "
  729 + + " GROUP BY r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name) t"
  730 + + " left join (select * from bsth_c_ylb y where "
  731 + + " to_days(y.rq)=to_days('"+map.get("date").toString()+"') "
  732 + + " and y.xlbm= '" + map.get("line").toString() + "'"
  733 + + " and y.ssgsdm like '%"+map.get("gsdmDaily").toString()+"%' "
  734 + + " and y.fgsdm like '%"+map.get("fgsdmDaily").toString()+"%'"
  735 + + " ) x"
  736 + + " on t.cl_zbh = x.nbbm ";
731 List<Daily> list = jdbcTemplate.query(sql, new RowMapper<Daily>() { 737 List<Daily> list = jdbcTemplate.query(sql, new RowMapper<Daily>() {
732 @Override 738 @Override
733 public Daily mapRow(ResultSet arg0, int arg1) throws SQLException { 739 public Daily mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -736,7 +742,7 @@ public class FormsServiceImpl implements FormsService { @@ -736,7 +742,7 @@ public class FormsServiceImpl implements FormsService {
736 daily.setZbh(arg0.getString("cl_zbh")); 742 daily.setZbh(arg0.getString("cl_zbh"));
737 daily.setJgh(arg0.getString("j_gh")); 743 daily.setJgh(arg0.getString("j_gh"));
738 daily.setjName(arg0.getString("j_name")); 744 daily.setjName(arg0.getString("j_name"));
739 - daily.setYh(arg0.getString("YH")); 745 + daily.setYh(arg0.getString("yh"));
740 return daily; 746 return daily;
741 } 747 }
742 }); 748 });
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
@@ -1345,8 +1345,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1345,8 +1345,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1345 Collections.sort(keyMap1.get(key), new Comparator<Map<String, Object>>() { 1345 Collections.sort(keyMap1.get(key), new Comparator<Map<String, Object>>() {
1346 1346
1347 public int compare(Map<String, Object> o1, Map<String, Object> o2) { 1347 public int compare(Map<String, Object> o1, Map<String, Object> o2) {
1348 - Integer a;  
1349 - Integer b; 1348 + Long a;
  1349 + Long b;
1350 String lp1 = o1.get("lp").toString(); 1350 String lp1 = o1.get("lp").toString();
1351 String lp2 = o2.get("lp").toString(); 1351 String lp2 = o2.get("lp").toString();
1352 String str1 = ""; 1352 String str1 = "";
@@ -1358,8 +1358,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1358,8 +1358,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1358 str2 += (int)lp2.charAt(i); 1358 str2 += (int)lp2.charAt(i);
1359 } 1359 }
1360 1360
1361 - a = Integer.valueOf(str1);  
1362 - b = Integer.valueOf(str2); 1361 + a = Long.valueOf(str1);
  1362 + b = Long.valueOf(str2);
1363 1363
1364 // 升序 1364 // 升序
1365 return a.compareTo(b); 1365 return a.compareTo(b);
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -15,6 +15,7 @@ import com.bsth.service.TrafficManageService; @@ -15,6 +15,7 @@ import com.bsth.service.TrafficManageService;
15 import com.bsth.util.TimeUtils; 15 import com.bsth.util.TimeUtils;
16 import com.bsth.util.db.DBUtils_MS; 16 import com.bsth.util.db.DBUtils_MS;
17 import com.bsth.webService.trafficManage.geotool.services.InternalPortType; 17 import com.bsth.webService.trafficManage.geotool.services.InternalPortType;
  18 +import com.bsth.webService.trafficManage.geotool.services.Internal;
18 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator; 19 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator;
19 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap; 20 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap;
20 import org.apache.commons.lang.time.DateUtils; 21 import org.apache.commons.lang.time.DateUtils;
@@ -25,10 +26,7 @@ import org.springframework.data.domain.Sort; @@ -25,10 +26,7 @@ import org.springframework.data.domain.Sort;
25 import org.springframework.data.domain.Sort.Direction; 26 import org.springframework.data.domain.Sort.Direction;
26 import org.springframework.stereotype.Service; 27 import org.springframework.stereotype.Service;
27 28
28 -import java.io.BufferedOutputStream;  
29 -import java.io.File;  
30 -import java.io.FileOutputStream;  
31 -import java.io.IOException; 29 +import java.io.*;
32 import java.sql.Connection; 30 import java.sql.Connection;
33 import java.sql.PreparedStatement; 31 import java.sql.PreparedStatement;
34 import java.sql.ResultSet; 32 import java.sql.ResultSet;
@@ -188,6 +186,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -188,6 +186,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
188 sBuffer.append("</XLs>"); 186 sBuffer.append("</XLs>");
189 System.out.println(sBuffer.toString()); 187 System.out.println(sBuffer.toString());
190 if(sBuffer.indexOf("<XL>") != -1){ 188 if(sBuffer.indexOf("<XL>") != -1){
  189 + portType = new Internal().getInternalHttpSoap11Endpoint();
191 String portResult = portType.setXL(userNameXl, passwordXl, sBuffer.toString()); 190 String portResult = portType.setXL(userNameXl, passwordXl, sBuffer.toString());
192 String portArray[] = portResult.split("\n"); 191 String portArray[] = portResult.split("\n");
193 if(portArray.length >= 4){ 192 if(portArray.length >= 4){
@@ -386,6 +385,24 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -386,6 +385,24 @@ public class TrafficManageServiceImpl implements TrafficManageService{
386 } 385 }
387 386
388 /** 387 /**
  388 + * 从文件中读取xml
  389 + * @param fileName 例:D:/test.txt
  390 + * @return
  391 + * @throws Exception
  392 + */
  393 + private String readXmlFromFile(String fileName) throws Exception {
  394 + StringBuffer sf = new StringBuffer("");
  395 + File file = new File(fileName);
  396 + InputStreamReader reader = new InputStreamReader(new FileInputStream(file),"utf-8");
  397 + BufferedReader bufferedReader = new BufferedReader(reader);
  398 + String lineTxt = "";
  399 + while((lineTxt = bufferedReader.readLine()) != null){
  400 + sf.append(lineTxt);
  401 + }
  402 + reader.close();
  403 + return sf.toString().replaceAll("\t","");
  404 + }
  405 + /**
389 * 上传里程油耗 406 * 上传里程油耗
390 * @return 上传成功标识 407 * @return 上传成功标识
391 */ 408 */
@@ -890,7 +907,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -890,7 +907,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
890 int nTotalMemory = ( int ) (currRuntime.totalMemory() / 1024 / 1024); 907 int nTotalMemory = ( int ) (currRuntime.totalMemory() / 1024 / 1024);
891 908
892 System.out.println("zzz:"+nFreeMemory + "M/" + nTotalMemory +"M(free/total)"); 909 System.out.println("zzz:"+nFreeMemory + "M/" + nTotalMemory +"M(free/total)");
893 - 910 + portType = new Internal().getInternalHttpSoap11Endpoint();
894 byte[] res = portType.downloadAllDataFile("down_pdgj", "down_pdgj123"); 911 byte[] res = portType.downloadAllDataFile("down_pdgj", "down_pdgj123");
895 String filePath = "E:\\ygc"; 912 String filePath = "E:\\ygc";
896 BufferedOutputStream bos = null; 913 BufferedOutputStream bos = null;
src/main/java/com/bsth/service/oil/CdlService.java 0 → 100644
  1 +package com.bsth.service.oil;
  2 +
  3 +
  4 +import com.bsth.entity.oil.Cdl;
  5 +import com.bsth.service.BaseService;
  6 +
  7 +public interface CdlService extends BaseService<Cdl, Integer>{
  8 +}
src/main/java/com/bsth/service/oil/DlbService.java
1 package com.bsth.service.oil; 1 package com.bsth.service.oil;
2 2
  3 +import java.util.Map;
  4 +
3 import com.bsth.entity.oil.Dlb; 5 import com.bsth.entity.oil.Dlb;
4 import com.bsth.service.BaseService; 6 import com.bsth.service.BaseService;
5 7
6 public interface DlbService extends BaseService<Dlb, Integer>{ 8 public interface DlbService extends BaseService<Dlb, Integer>{
  9 + Map<String, Object> obtain(Map<String, Object> map);
  10 +
  11 + Map<String, Object> sort(Map<String, Object> map);
  12 +
  13 + Map<String, Object> checkDl(Map<String, Object> map);
7 } 14 }
src/main/java/com/bsth/service/oil/YlbService.java
@@ -7,13 +7,17 @@ import com.bsth.entity.oil.Ylb; @@ -7,13 +7,17 @@ import com.bsth.entity.oil.Ylb;
7 import com.bsth.service.BaseService; 7 import com.bsth.service.BaseService;
8 8
9 public interface YlbService extends BaseService<Ylb, Integer>{ 9 public interface YlbService extends BaseService<Ylb, Integer>{
10 - Map<String, Object> obtain(Map<String, Object> map);  
11 - String obtainDsq(); 10 + Map<String, Object> obtain(Map<String, Object> map) throws Exception;
  11 + String obtainDsq() throws Exception;
12 Map<String, Object> sort(Map<String, Object> map); 12 Map<String, Object> sort(Map<String, Object> map);
13 13
14 - Map<String, Object> outAndIn(Map<String, Object> map); 14 + Map<String, Object> outAndIn(Map<String, Object> map) throws Exception;
15 15
16 Map<String, Object> checkYl(Map<String, Object> map); 16 Map<String, Object> checkYl(Map<String, Object> map);
17 17
  18 + Map<String, Object> sumYlb(Map<String, Object> map);
  19 +
18 List<Ylb> oilListMonth(String line,String date); 20 List<Ylb> oilListMonth(String line,String date);
  21 +
  22 + StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx);
19 } 23 }
src/main/java/com/bsth/service/oil/impl/CdlServiceImpl.java 0 → 100644
  1 +package com.bsth.service.oil.impl;
  2 +
  3 +import org.springframework.stereotype.Service;
  4 +
  5 +import com.bsth.entity.oil.Cdl;
  6 +import com.bsth.service.impl.BaseServiceImpl;
  7 +import com.bsth.service.oil.CdlService;
  8 +
  9 +@Service
  10 +public class CdlServiceImpl extends BaseServiceImpl<Cdl,Integer> implements CdlService
  11 +{
  12 +
  13 +}
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
@@ -2,14 +2,316 @@ package com.bsth.service.oil.impl; @@ -2,14 +2,316 @@ package com.bsth.service.oil.impl;
2 2
3 3
4 4
  5 +import java.text.DecimalFormat;
  6 +import java.text.ParseException;
  7 +import java.text.SimpleDateFormat;
  8 +import java.util.ArrayList;
  9 +import java.util.Date;
  10 +import java.util.HashMap;
  11 +import java.util.Iterator;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +import javax.transaction.Transactional;
  16 +
  17 +import org.slf4j.Logger;
  18 +import org.slf4j.LoggerFactory;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.data.domain.Sort;
  21 +import org.springframework.data.domain.Sort.Direction;
  22 +import org.springframework.jdbc.core.JdbcTemplate;
5 import org.springframework.stereotype.Service; 23 import org.springframework.stereotype.Service;
6 24
  25 +import com.bsth.common.ResponseCode;
  26 +import com.bsth.entity.Cars;
  27 +import com.bsth.entity.oil.Cdl;
  28 +import com.bsth.entity.oil.Cyl;
7 import com.bsth.entity.oil.Dlb; 29 import com.bsth.entity.oil.Dlb;
  30 +import com.bsth.entity.oil.Jdl;
  31 +import com.bsth.entity.oil.Ylb;
  32 +import com.bsth.entity.oil.Ylxxb;
  33 +import com.bsth.entity.search.CustomerSpecs;
  34 +import com.bsth.repository.CarsRepository;
  35 +import com.bsth.repository.oil.CdlRepository;
  36 +import com.bsth.repository.oil.CylRepository;
  37 +import com.bsth.repository.oil.DlbRepository;
  38 +import com.bsth.repository.oil.JdlRepository;
  39 +import com.bsth.repository.oil.YlbRepository;
  40 +import com.bsth.repository.oil.YlxxbRepository;
8 import com.bsth.service.impl.BaseServiceImpl; 41 import com.bsth.service.impl.BaseServiceImpl;
9 import com.bsth.service.oil.DlbService; 42 import com.bsth.service.oil.DlbService;
  43 +import com.bsth.service.realcontrol.ScheduleRealInfoService;
10 44
11 @Service 45 @Service
12 public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbService{ 46 public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbService{
  47 + @Autowired
  48 + DlbRepository repository;
  49 +
  50 + @Autowired
  51 + YlxxbRepository ylxxbRepository;
  52 +
  53 + @Autowired
  54 + CdlRepository cdlRepository;
  55 + @Autowired
  56 + JdlRepository jdlRepository;
  57 + @Autowired
  58 + CarsRepository carsRepository;
13 59
  60 + @Autowired
  61 + ScheduleRealInfoService scheduleRealInfoService;
  62 +
  63 + @Autowired
  64 + JdbcTemplate jdbcTemplate;
  65 +
  66 + Logger logger = LoggerFactory.getLogger(this.getClass());
  67 + /**
  68 + * 获取进存油信息
  69 + * @Transactional 回滚事物
  70 + */
  71 + @Transactional
  72 + @Override
  73 + public Map<String, Object> obtain(Map<String, Object> map2) {
  74 + List<Cars> carsList=carsRepository.findCars();
  75 + Map<String, Boolean> carsMap=new HashMap<String, Boolean>();
  76 + for (int i = 0; i < carsList.size(); i++) {
  77 + Cars c=carsList.get(i);
  78 + carsMap.put(c.getInsideCode(), c.getSfdc());
  79 + }
  80 + String gsbm="";
  81 + if(map2.get("ssgsdm_like")!=null){
  82 + gsbm=map2.get("ssgsdm_like").toString();
  83 + }
  84 + String rq=map2.get("rq").toString();
  85 + String line="";
  86 + if(map2.get("xlbm_eq")!=null){
  87 + line=map2.get("xlbm_eq").toString();
  88 + }
  89 +
  90 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  91 + //保留两位小数
  92 + DecimalFormat df = new DecimalFormat("#.00");
  93 + // TODO Auto-generated method stub
  94 + Map<String, Object> newMap=new HashMap<String,Object>();
  95 + //当天DLB信息
  96 + List<Dlb> dlList=repository.obtainDl(rq);
  97 + //当天YLXXB信息
  98 + List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,gsbm);
  99 + //当天加电信息表
  100 + List<Jdl> jdlList=jdlRepository.JdlList(rq);
  101 + //前一天所有车辆最后进场班次信息
  102 + List<Dlb> dlListBe=repository.obtainYlbefore(rq);
  103 + List<Cdl> cdyList=cdlRepository.obtainCdl();
  104 + //从排班表中计算出行驶的总里程
  105 + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","","");
  106 + List<Ylb> addList=new ArrayList<Ylb>();
  107 + List<Ylb> updateList=new ArrayList<Ylb>();
  108 + for(int x=0;x<listpb.size();x++){
  109 + String type="add";
  110 + boolean sfdc=false;
  111 + Map<String, Object> map=listpb.get(x);
  112 + if (carsMap.get(map.get("clZbh").toString())!=null) {
  113 + sfdc= carsMap.get(map.get("clZbh").toString());
  114 + }else{
  115 + sfdc=false;
  116 + }
  117 + if(sfdc){
  118 + //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
  119 + Dlb t=new Dlb();
  120 + for(int k=0;k<dlList.size();k++){
  121 + Dlb t1=dlList.get(k);
  122 + if(t1.getNbbm().equals(map.get("clZbh").toString())
  123 + &&t1.getJsy().equals(map.get("jGh").toString())
  124 + &&t1.getXlbm().equals(map.get("xlBm").toString()))
  125 + {
  126 + t=t1;
  127 + type="update";
  128 + }
  129 + }
  130 + try {
  131 + //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
  132 + if(map.get("seqNumber").toString().equals("1")){
  133 + boolean fage=true;
  134 + for (int i = 0; i < dlListBe.size(); i++) {
  135 + Dlb dlb=dlListBe.get(i);
  136 + if(map.get("clZbh").toString().equals(dlb.getNbbm())){
  137 + t.setCzcd(dlb.getJzcd());
  138 + fage=false;
  139 + break;
  140 + }
  141 + }
  142 + if(fage){
  143 + for (int y = 0; y < cdyList.size(); y++) {
  144 + Cdl cdl=cdyList.get(y);
  145 + if(map.get("clZbh").toString().equals(cdl.getNbbm())){
  146 + t.setCzcd(cdl.getClcd());
  147 + fage=false;
  148 + break;
  149 + }
  150 + }
  151 + }
  152 + if(fage){
  153 + t.setCzcd(0.0);
  154 + }
  155 + }
  156 +
  157 + Double jzl=0.0;
  158 + //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断)
  159 + for(int j=0;j<ylxxList.size();j++){
  160 + Ylxxb ylxxb= ylxxList.get(j);
  161 + if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){
  162 + jzl+=ylxxb.getJzl();
  163 + }
  164 + }
  165 +
  166 + //手动导入没有驾驶员工号
  167 + for (int i = 0; i < jdlList.size(); i++) {
  168 + Jdl jdl=jdlList.get(i);
  169 + if(map.get("clZbh").toString().equals(jdl.getNbbm()) ){
  170 + jzl+=jdl.getJdl();
  171 + }
  172 + }
  173 + t.setCdl(jzl);
  174 + t.setJzcd(t.getCzcd());
  175 + t.setNbbm(map.get("clZbh").toString());
  176 + t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString());
  177 + t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString()))));
  178 + t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString());
  179 + t.setHd(jzl);
  180 + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
  181 + t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());
  182 + t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());
  183 + t.setRq(sdf.parse(rq));
  184 + /*if(type.equals("add")){
  185 + addList.add(t);
  186 + }else{
  187 + updateList.add(t);
  188 + }*/
  189 + repository.save(t);
  190 + newMap.put("status", ResponseCode.SUCCESS);
  191 + } catch (ParseException e) {
  192 + // TODO Auto-generated catch block
  193 + newMap.put("status", ResponseCode.ERROR);
  194 + e.printStackTrace();
  195 + }
  196 + }
  197 + }
  198 + /* try {
  199 + if(addList.size()>0){
  200 + new BatchSaveUtils<Ylb>().saveList(addList, Ylb.class);
  201 + }
  202 +
  203 + if(updateList.size()>0){
  204 +
  205 + }
  206 + newMap.put("status", ResponseCode.SUCCESS);
  207 + }
  208 + catch (Exception e) {
  209 + // TODO: handle exception
  210 + newMap.put("status", ResponseCode.ERROR);
  211 + }*/
  212 + return newMap;
  213 + }
  214 +
  215 + /**
  216 + * 拆分
  217 + */
  218 + @Transactional
  219 + @Override
  220 + public Map<String, Object> sort(Map<String, Object> map) {
  221 + // TODO Auto-generated method stub
  222 + Map<String, Object> newMap = new HashMap<String, Object>();
  223 + try{
  224 + int id=Integer.parseInt(map.get("id").toString());
  225 + //最后存油量
  226 + Double jzdl=Double.parseDouble(map.get("jzdl").toString());
  227 + Double hdl=Double.parseDouble(map.get("hdl").toString());
  228 + Dlb dlb=repository.findOne(id);
  229 + dlb.setJzcd(jzdl);
  230 + dlb.setHd(hdl);
  231 + repository.save(dlb);
  232 + newMap.put("status", ResponseCode.SUCCESS);
  233 + }catch(Exception e){
  234 + newMap.put("status", ResponseCode.ERROR);
  235 + logger.error("save erro.", e);
  236 + }
  237 + return newMap;
  238 + }
14 239
  240 +
  241 + /**
  242 + * 核对,有加注没里程
  243 + * @param map
  244 + * @return
  245 + */
  246 + @Transactional
  247 + @Override
  248 + public Map<String, Object> checkDl(Map<String, Object> map) {
  249 + Map<String, Object> newMap=new HashMap<String,Object>();
  250 + String xlbm=map.get("xlbm_eq").toString();
  251 + String gsbm="";
  252 + if(map.get("ssgsdm_like")!=null){
  253 + gsbm=map.get("ssgsdm_like").toString();
  254 + }
  255 + // TODO Auto-generated method stub
  256 + try{
  257 + //获取车辆存油信息
  258 +// List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));
  259 + String rq=map.get("rq").toString();
  260 + List<Dlb> dlbList=repository.obtainDl(rq);
  261 + List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,1,gsbm);
  262 + //当天加电信息表
  263 + List<Jdl> jdlList=jdlRepository.JdlList(rq);
  264 + for (int i = 0; i < ylxxbList.size(); i++) {
  265 + Boolean fage=true;
  266 + Ylxxb y1=ylxxbList.get(i);
  267 + for(int y=0;y<dlbList.size();y++){
  268 + Dlb y2=dlbList.get(y);
  269 + if(y1.getNbbm().equals(y2.getNbbm())){
  270 + fage=false;
  271 + break;
  272 + }
  273 + }
  274 +
  275 + if(fage){
  276 + Dlb t=new Dlb();
  277 + t.setNbbm(y1.getNbbm());
  278 + t.setRq(y1.getYyrq());
  279 + t.setJsy(y1.getJsy());
  280 + t.setCdl(y1.getJzl());
  281 + t.setSsgsdm(y1.getGsdm());
  282 + t.setXlbm(xlbm);
  283 + repository.save(t);
  284 + }
  285 + }
  286 +
  287 + for (int i = 0; i < jdlList.size(); i++) {
  288 + Boolean fage=true;
  289 + Jdl y1=jdlList.get(i);
  290 + for(int y=0;y<dlbList.size();y++){
  291 + Dlb y2=dlbList.get(y);
  292 + if(y1.getNbbm().equals(y2.getNbbm())){
  293 + fage=false;
  294 + break;
  295 + }
  296 + }
  297 +
  298 + if(fage){
  299 + Dlb t=new Dlb();
  300 + t.setNbbm(y1.getNbbm());
  301 + t.setRq(y1.getRq());
  302 +// t.setJsy(y1.getJsy());
  303 + t.setCdl(y1.getJdl());
  304 + t.setSsgsdm(y1.getGsBm());
  305 + t.setXlbm(xlbm);
  306 + repository.save(t);
  307 + }
  308 + }
  309 + newMap.put("status", ResponseCode.SUCCESS);
  310 + }catch(Exception e){
  311 + newMap.put("status", ResponseCode.ERROR);
  312 + logger.error("save erro.", e);
  313 + }
  314 +
  315 + return newMap;
  316 + }
15 } 317 }
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
1 package com.bsth.service.oil.impl; 1 package com.bsth.service.oil.impl;
2 2
  3 +import java.sql.ResultSet;
  4 +import java.sql.SQLException;
  5 +import java.text.DecimalFormat;
  6 +import java.text.ParseException;
  7 +import java.text.SimpleDateFormat;
  8 +import java.util.ArrayList;
  9 +import java.util.Calendar;
  10 +import java.util.Date;
  11 +import java.util.HashMap;
  12 +import java.util.Iterator;
  13 +import java.util.List;
  14 +import java.util.Map;
  15 +
  16 +import javax.transaction.Transactional;
  17 +
  18 +import org.slf4j.Logger;
  19 +import org.slf4j.LoggerFactory;
  20 +import org.springframework.beans.factory.annotation.Autowired;
  21 +import org.springframework.data.domain.Sort;
  22 +import org.springframework.data.domain.Sort.Direction;
  23 +import org.springframework.jdbc.core.JdbcTemplate;
  24 +import org.springframework.jdbc.core.RowMapper;
  25 +import org.springframework.stereotype.Service;
  26 +
3 import com.bsth.common.ResponseCode; 27 import com.bsth.common.ResponseCode;
  28 +import com.bsth.data.BasicData;
  29 +import com.bsth.entity.Cars;
4 import com.bsth.entity.oil.Cyl; 30 import com.bsth.entity.oil.Cyl;
5 import com.bsth.entity.oil.Ylb; 31 import com.bsth.entity.oil.Ylb;
6 import com.bsth.entity.oil.Ylxxb; 32 import com.bsth.entity.oil.Ylxxb;
7 import com.bsth.entity.search.CustomerSpecs; 33 import com.bsth.entity.search.CustomerSpecs;
  34 +import com.bsth.repository.CarsRepository;
8 import com.bsth.repository.oil.CylRepository; 35 import com.bsth.repository.oil.CylRepository;
9 import com.bsth.repository.oil.YlbRepository; 36 import com.bsth.repository.oil.YlbRepository;
10 import com.bsth.repository.oil.YlxxbRepository; 37 import com.bsth.repository.oil.YlxxbRepository;
11 import com.bsth.service.impl.BaseServiceImpl; 38 import com.bsth.service.impl.BaseServiceImpl;
12 import com.bsth.service.oil.YlbService; 39 import com.bsth.service.oil.YlbService;
13 import com.bsth.service.realcontrol.ScheduleRealInfoService; 40 import com.bsth.service.realcontrol.ScheduleRealInfoService;
14 -import org.slf4j.Logger;  
15 -import org.slf4j.LoggerFactory;  
16 -import org.springframework.beans.factory.annotation.Autowired;  
17 -import org.springframework.data.domain.Sort;  
18 -import org.springframework.data.domain.Sort.Direction;  
19 -import org.springframework.jdbc.core.JdbcTemplate;  
20 -import org.springframework.jdbc.core.RowMapper;  
21 -import org.springframework.stereotype.Service;  
22 -  
23 -import javax.transaction.Transactional;  
24 -import java.sql.ResultSet;  
25 -import java.sql.SQLException;  
26 -import java.text.DecimalFormat;  
27 -import java.text.ParseException;  
28 -import java.text.SimpleDateFormat;  
29 -import java.util.*; 41 +import com.bsth.util.Arith;
  42 +import com.bsth.util.BatchSaveUtils;
  43 +import com.github.abel533.echarts.code.Y;
30 44
31 @Service 45 @Service
32 public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbService{ 46 public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbService{
33 @Autowired 47 @Autowired
34 YlbRepository repository; 48 YlbRepository repository;
35 - 49 +
36 @Autowired 50 @Autowired
37 YlxxbRepository ylxxbRepository; 51 YlxxbRepository ylxxbRepository;
38 - 52 +
39 @Autowired 53 @Autowired
40 CylRepository cylRepository; 54 CylRepository cylRepository;
41 - 55 +
  56 + @Autowired
  57 + CarsRepository carsRepository;
  58 +
42 @Autowired 59 @Autowired
43 ScheduleRealInfoService scheduleRealInfoService; 60 ScheduleRealInfoService scheduleRealInfoService;
44 - 61 +
45 @Autowired 62 @Autowired
46 JdbcTemplate jdbcTemplate; 63 JdbcTemplate jdbcTemplate;
47 - 64 +
48 Logger logger = LoggerFactory.getLogger(this.getClass()); 65 Logger logger = LoggerFactory.getLogger(this.getClass());
49 -  
50 -  
51 - 66 +
  67 +
  68 +
52 /** 69 /**
53 * 获取进存油信息 70 * 获取进存油信息
54 * @Transactional 回滚事物 71 * @Transactional 回滚事物
55 */ 72 */
56 - @Transactional 73 + @Transactional
57 @Override 74 @Override
58 - public String obtainDsq() { 75 + public String obtainDsq() throws Exception{
59 String result = "failure"; 76 String result = "failure";
60 - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");  
61 - Date dNow = new Date(); //当前时间  
62 - Date dBefore = new Date();  
63 - Calendar calendar = Calendar.getInstance(); //得到日历  
64 - calendar.setTime(dNow);//把当前时间赋给日历  
65 - calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天  
66 - dBefore = calendar.getTime(); //得到前一天的时间  
67 - String rq=sdf.format(dBefore);  
68 - //保留两位小数  
69 - DecimalFormat df = new DecimalFormat("#.00");  
70 - // TODO Auto-generated method stub  
71 - Map<String, Object> newMap=new HashMap<String,Object>();  
72 - //当天YLB信息  
73 - List<Ylb> ylList=repository.obtainYl(rq);  
74 - //当天YLXXB信息  
75 -// List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq);  
76 - //前一天所有车辆最后进场班次信息  
77 - List<Ylb> ylListBe=repository.obtainYlbefore(rq);  
78 - List<Cyl> clyList=cylRepository.obtainCyl();  
79 - //从排班表中计算出行驶的总里程  
80 - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("",rq);  
81 -  
82 - for(int x=0;x<listpb.size();x++){  
83 -  
84 - Map<String, Object> map=listpb.get(x);  
85 -  
86 - //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)  
87 - Ylb t=new Ylb();  
88 - for(int k=0;k<ylList.size();k++){  
89 - Ylb t1=ylList.get(k);  
90 - if(t1.getNbbm().equals(map.get("clZbh").toString())  
91 - &&t1.getJsy().equals(map.get("jGh").toString())  
92 - &&t1.getXlbm().equals(map.get("xlBm").toString()))  
93 - {  
94 - t=t1;  
95 - } 77 + try {
  78 + List<Cars> carsList=carsRepository.findCars();
  79 + Map<String, Boolean> carsMap=new HashMap<String, Boolean>();
  80 + for (int i = 0; i < carsList.size(); i++) {
  81 + Cars c=carsList.get(i);
  82 + carsMap.put(c.getInsideCode(), c.getSfdc());
96 } 83 }
97 - try {  
98 - //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量  
99 - if(map.get("seqNumber").toString().equals("1")){  
100 - for (int y = 0; y < clyList.size(); y++) {  
101 - Cyl cyl=clyList.get(y);  
102 - if(map.get("clZbh").toString().equals(cyl.getNbbm())){  
103 - t.setCzyl(cyl.getCyl());  
104 - break;  
105 - }else{  
106 - for (int i = 0; i < ylListBe.size(); i++) {  
107 - Ylb ylb=ylListBe.get(i);  
108 - if(map.get("clZbh").toString().equals(ylb.getNbbm())){  
109 - t.setCzyl(ylb.getJzyl());  
110 - break;  
111 - }else{  
112 - t.setCzyl(0.0); 84 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  85 + Date dNow = new Date(); //当前时间
  86 + Date dBefore = new Date();
  87 + Calendar calendar = Calendar.getInstance(); //得到日历
  88 + calendar.setTime(dNow);//把当前时间赋给日历
  89 + calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天
  90 + dBefore = calendar.getTime(); //得到前一天的时间
  91 + String rq=sdf.format(dBefore);
  92 + //保留两位小数
  93 + DecimalFormat df = new DecimalFormat("#.00");
  94 + // TODO Auto-generated method stub
  95 + Map<String, Object> newMap=new HashMap<String,Object>();
  96 + //当天YLB信息
  97 + List<Ylb> ylList=repository.obtainYl(rq,"","","","","nbbm");
  98 + //当天YLXXB信息
  99 + // List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq);
  100 + //前一天所有车辆最后进场班次信息
  101 + List<Ylb> ylListBe=repository.obtainYlbefore(rq,"","","","");
  102 + List<Cyl> clyList=cylRepository.obtainCyl("","");
  103 + //从排班表中计算出行驶的总里程
  104 + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", rq, "", "", "", "");
  105 +
  106 + for(int x=0;x<listpb.size();x++){
  107 + boolean sfdc=true;
  108 + Map<String, Object> map=listpb.get(x);
  109 + if (carsMap.get(map.get("clZbh").toString())!=null) {
  110 + sfdc= carsMap.get(map.get("clZbh").toString());
  111 + }else{
  112 + sfdc=true;
  113 + }
  114 + if(!sfdc){
  115 + //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
  116 + Ylb t=new Ylb();
  117 + for(int k=0;k<ylList.size();k++){
  118 + Ylb t1=ylList.get(k);
  119 + if(t1.getNbbm().equals(map.get("clZbh").toString())
  120 + &&t1.getJsy().equals(map.get("jGh").toString())
  121 + &&t1.getXlbm().equals(map.get("xlBm").toString()))
  122 + {
  123 + t=t1;
  124 + }
  125 + }
  126 +
  127 + //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
  128 + if(map.get("seqNumber").toString().equals("1")){
  129 + boolean fage=true;
  130 + for (int i = 0; i < ylListBe.size(); i++) {
  131 + Ylb ylb=ylListBe.get(i);
  132 + if(map.get("clZbh").toString().equals(ylb.getNbbm())){
  133 + if(ylb.getJzyl()!=null){
  134 + if(ylb.getJzyl()>0){
  135 + t.setCzyl(ylb.getJzyl());
  136 + fage=false;
  137 + break;
  138 + }
113 } 139 }
  140 +
114 } 141 }
115 } 142 }
  143 + if(fage){
  144 + for (int y = 0; y < clyList.size(); y++) {
  145 + Cyl cyl=clyList.get(y);
  146 + if(map.get("clZbh").toString().equals(cyl.getNbbm())){
  147 + if(cyl.getCyl()!=null){
  148 + t.setCzyl(cyl.getCyl());
  149 + fage=false;
  150 + break;
  151 + }
  152 + }
  153 + }
  154 + }
  155 + if(fage){
  156 + t.setCzyl(0.0);
  157 + }
116 } 158 }
  159 +
  160 + /*Double jzl=0.0;
  161 + //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断)
  162 + for(int j=0;j<ylxxList.size();j++){
  163 + Ylxxb ylxxb= ylxxList.get(j);
  164 + if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){
  165 + jzl+=ylxxb.getJzl();
  166 + }
  167 + }
  168 + t.setJzl(jzl);*/
  169 + t.setNbbm(map.get("clZbh").toString());
  170 + t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString());
  171 + t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString()))));
  172 + t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString());
  173 + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
  174 + t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());
  175 + t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());
  176 + t.setRq(sdf.parse(rq));
  177 + repository.save(t);
  178 +
117 } 179 }
118 -  
119 - /*Double jzl=0.0;  
120 - //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断)  
121 - for(int j=0;j<ylxxList.size();j++){  
122 - Ylxxb ylxxb= ylxxList.get(j);  
123 - if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){  
124 - jzl+=ylxxb.getJzl();  
125 - }  
126 - }  
127 - t.setJzl(jzl);*/  
128 - t.setNbbm(map.get("clZbh").toString());  
129 - t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString());  
130 - t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString()))));  
131 - t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString());  
132 - t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));  
133 - t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());  
134 - t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());  
135 - t.setRq(sdf.parse(rq));  
136 - repository.save(t);  
137 result = "success"; 180 result = "success";
138 - } catch (Exception e) {  
139 - // TODO Auto-generated catch block  
140 - e.printStackTrace();  
141 - }finally{  
142 - logger.info("setDDRB:"+result);  
143 } 181 }
  182 + }catch (Exception e) {
  183 + // TODO Auto-generated catch block
  184 + throw e;
  185 + }finally{
  186 + logger.info("setDDRB:"+result);
144 } 187 }
145 - 188 +
146 return result; 189 return result;
147 } 190 }
148 - 191 +
149 /** 192 /**
150 * 获取进存油信息 193 * 获取进存油信息
151 * @Transactional 回滚事物 194 * @Transactional 回滚事物
152 */ 195 */
153 - @Transactional 196 + @Transactional
154 @Override 197 @Override
155 - public Map<String, Object> obtain(Map<String, Object> map2) {  
156 - String rq=map2.get("rq").toString();  
157 - String line="";  
158 - if(map2.get("xlbm_eq")!=null){  
159 - line=map2.get("xlbm_eq").toString();  
160 - }  
161 -  
162 - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");  
163 - //保留两位小数  
164 - DecimalFormat df = new DecimalFormat("#.00");  
165 - // TODO Auto-generated method stub  
166 - Map<String, Object> newMap=new HashMap<String,Object>();  
167 - //当天YLB信息  
168 - List<Ylb> ylList=repository.obtainYl(rq);  
169 - //当天YLXXB信息  
170 - List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq);  
171 - //前一天所有车辆最后进场班次信息  
172 - List<Ylb> ylListBe=repository.obtainYlbefore(rq);  
173 - List<Cyl> clyList=cylRepository.obtainCyl();  
174 - //从排班表中计算出行驶的总里程  
175 - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq);  
176 - List<Ylb> addList=new ArrayList<Ylb>();  
177 - List<Ylb> updateList=new ArrayList<Ylb>();  
178 - for(int x=0;x<listpb.size();x++){  
179 - String type="add";  
180 - Map<String, Object> map=listpb.get(x);  
181 -  
182 - //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)  
183 - Ylb t=new Ylb();  
184 - for(int k=0;k<ylList.size();k++){  
185 - Ylb t1=ylList.get(k);  
186 - if(t1.getNbbm().equals(map.get("clZbh").toString())  
187 - &&t1.getJsy().equals(map.get("jGh").toString())  
188 - &&t1.getXlbm().equals(map.get("xlBm").toString()))  
189 - {  
190 - t=t1;  
191 - type="update";  
192 - } 198 + public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{
  199 + Map<String, Object> newMap = new HashMap<String, Object>();
  200 + try {
  201 + List<Cars> carsList = carsRepository.findCars();
  202 + Map<String, Boolean> carsMap = new HashMap<String, Boolean>();
  203 + for (int i = 0; i < carsList.size(); i++) {
  204 + Cars c = carsList.get(i);
  205 + carsMap.put(c.getInsideCode(), c.getSfdc());
193 } 206 }
194 - try {  
195 - //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量  
196 - if(map.get("seqNumber").toString().equals("1")){  
197 - for (int y = 0; y < clyList.size(); y++) {  
198 - Cyl cyl=clyList.get(y);  
199 - if(map.get("clZbh").toString().equals(cyl.getNbbm())){  
200 - t.setCzyl(cyl.getCyl());  
201 - break;  
202 - }else{  
203 - for (int i = 0; i < ylListBe.size(); i++) {  
204 - Ylb ylb=ylListBe.get(i);  
205 - if(map.get("clZbh").toString().equals(ylb.getNbbm())){ 207 + String rq = map2.get("rq").toString();
  208 + String line = "";
  209 + if (map2.get("xlbm_like") != null) {
  210 + line = map2.get("xlbm_like").toString().trim();
  211 + }
  212 + String gsbm="";
  213 + if(map2.get("ssgsdm_like")!=null){
  214 + gsbm=map2.get("ssgsdm_like").toString();
  215 + }
  216 + String fgsbm="";
  217 + if(map2.get("fgsdm_like")!=null){
  218 + fgsbm=map2.get("fgsdm_like").toString();
  219 + }
  220 + String nbbm="";
  221 + if(map2.get("nbbm_eq")!=null){
  222 + nbbm=map2.get("nbbm_eq").toString();
  223 + }
  224 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  225 + // 保留两位小数
  226 + DecimalFormat df = new DecimalFormat("#.00");
  227 + // TODO Auto-generated method stub
  228 + // 当天YLB信息
  229 + List<Ylb> ylList = repository.obtainYl(rq,gsbm,fgsbm,line,nbbm,"nbbm");
  230 + // 当天YLXXB信息
  231 + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm);
  232 + // 前一天所有车辆最后进场班次信息
  233 + List<Ylb> ylListBe = repository.obtainYlbefore(rq, gsbm, fgsbm, line, nbbm);
  234 + List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm);
  235 + // 从排班表中计算出行驶的总里程
  236 + List<Map<String, Object>> listpb = scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm);
  237 + List<Ylb> addList = new ArrayList<Ylb>();
  238 + List<Ylb> updateList = new ArrayList<Ylb>();
  239 + String ins="";
  240 + for (int x = 0; x < listpb.size(); x++) {
  241 + String type = "add";
  242 + boolean sfdc = true;
  243 + Map<String, Object> map = listpb.get(x);
  244 + if (carsMap.get(map.get("clZbh").toString()) != null) {
  245 + sfdc = carsMap.get(map.get("clZbh").toString());
  246 + } else {
  247 + sfdc = true;
  248 + }
  249 + if (!sfdc) {
  250 + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
  251 + Ylb t = new Ylb();
  252 + for (int k = 0; k < ylList.size(); k++) {
  253 + Ylb t1 = ylList.get(k);
  254 + if (t1.getNbbm().equals(map.get("clZbh").toString())
  255 + && t1.getJsy().equals(map.get("jGh").toString())
  256 + && t1.getXlbm().equals(map.get("xlBm").toString())) {
  257 + t = t1;
  258 + type = "update";
  259 + }
  260 + }
  261 +
  262 + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
  263 + if (map.get("seqNumber").toString().equals("1")) {
  264 + boolean fage = true;
  265 + for (int i = 0; i < ylListBe.size(); i++) {
  266 + Ylb ylb = ylListBe.get(i);
  267 + if (map.get("clZbh").toString().equals(ylb.getNbbm())) {
  268 + if(ylb.getJzyl()>0){
206 t.setCzyl(ylb.getJzyl()); 269 t.setCzyl(ylb.getJzyl());
  270 + fage = false;
207 break; 271 break;
208 - }else{  
209 - t.setCzyl(0.0); 272 + }
  273 +
  274 + }
  275 + }
  276 + if (fage) {
  277 + for (int y = 0; y < clyList.size(); y++) {
  278 + Cyl cyl = clyList.get(y);
  279 + if (map.get("clZbh").toString().equals(cyl.getNbbm())) {
  280 + if(cyl.getCyl()>0){
  281 + t.setCzyl(cyl.getCyl());
  282 + fage = false;
  283 + break;
  284 + }else {
  285 + if(cyl.getCxrl()!=null){
  286 + if(cyl.getCxrl()>0){
  287 + t.setCzyl(cyl.getCxrl());
  288 + fage = false;
  289 + break;
  290 + }
  291 + }
  292 + }
210 } 293 }
211 } 294 }
212 } 295 }
  296 + if (fage) {
  297 + t.setCzyl(0.0);
  298 + }
213 } 299 }
214 - }  
215 -  
216 - Double jzl=0.0;  
217 - //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断)  
218 - for(int j=0;j<ylxxList.size();j++){  
219 - Ylxxb ylxxb= ylxxList.get(j);  
220 - if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){  
221 - jzl+=ylxxb.getJzl(); 300 +
  301 + Double jzl = 0.0;
  302 + // 把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断)
  303 + for (int j = 0; j < ylxxList.size(); j++) {
  304 + Ylxxb ylxxb = ylxxList.get(j);
  305 + if (map.get("clZbh").toString().equals(ylxxb.getNbbm())
  306 + && map.get("jGh").toString().equals(ylxxb.getJsy())) {
  307 +// jzl += ylxxb.getJzl();
  308 + jzl =Arith.add(jzl, ylxxb.getJzl());
  309 + }
  310 + }
  311 + if(map.get("clZbh").toString().equals("W0A-212")){
  312 + System.out.println();
  313 + }
  314 + if(map.get("clZbh").toString().equals("W0A-211")){
  315 + System.out.println();
222 } 316 }
  317 + t.setJzl(jzl);
  318 + t.setNbbm(map.get("clZbh").toString());
  319 + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString());
  320 + t.setZlc(map.get("totalKilometers") == null ? 0.0
  321 + : Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString()))));
  322 + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString());
  323 + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
  324 + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
  325 + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
  326 + t.setRq(sdf.parse(rq));
  327 +
  328 + if(type.equals("add")){
  329 + addList.add(t);
  330 + }else{
  331 + updateList.add(t);
  332 + ins += t.getId().toString()+",";
  333 + }
  334 +// repository.save(t);
  335 + newMap.put("status", ResponseCode.SUCCESS);
  336 +
223 } 337 }
224 - t.setJzl(jzl);  
225 - t.setNbbm(map.get("clZbh").toString());  
226 - t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString());  
227 - t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString()))));  
228 - t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString());  
229 - t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));  
230 - t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());  
231 - t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());  
232 - t.setRq(sdf.parse(rq));  
233 - /*if(type.equals("add")){  
234 - addList.add(t);  
235 - }else{  
236 - updateList.add(t);  
237 - }*/  
238 - repository.save(t);  
239 - newMap.put("status", ResponseCode.SUCCESS);  
240 - } catch (ParseException e) {  
241 - // TODO Auto-generated catch block  
242 - newMap.put("status", ResponseCode.ERROR);  
243 - e.printStackTrace();  
244 } 338 }
245 - }  
246 - /* try {  
247 if(addList.size()>0){ 339 if(addList.size()>0){
248 new BatchSaveUtils<Ylb>().saveList(addList, Ylb.class); 340 new BatchSaveUtils<Ylb>().saveList(addList, Ylb.class);
249 } 341 }
250 - 342 +
251 if(updateList.size()>0){ 343 if(updateList.size()>0){
252 - 344 + for (int i = 0; i < updateList.size(); i++) {
  345 + repository.save(updateList.get(i));
  346 + }
253 } 347 }
254 newMap.put("status", ResponseCode.SUCCESS); 348 newMap.put("status", ResponseCode.SUCCESS);
255 - }  
256 - catch (Exception e) {  
257 - // TODO: handle exception 349 + } catch (ParseException e) {
  350 + // TODO Auto-generated catch block
258 newMap.put("status", ResponseCode.ERROR); 351 newMap.put("status", ResponseCode.ERROR);
259 - }*/ 352 + throw e;
  353 + }
  354 +
260 return newMap; 355 return newMap;
261 } 356 }
262 -  
263 - 357 +
  358 +
264 /** 359 /**
265 * 进场等于出场 360 * 进场等于出场
266 */ 361 */
267 - @Transactional 362 + @Transactional
268 @Override 363 @Override
269 - public Map<String, Object> outAndIn(Map<String, Object> map){ 364 + public Map<String, Object> outAndIn(Map<String, Object> map) throws Exception{
270 // TODO Auto-generated method stub 365 // TODO Auto-generated method stub
  366 + String xlbm="";
  367 + if(map.get("xlbm_like")!=null){
  368 + xlbm= map.get("xlbm_like").toString().trim();
  369 + }
  370 + String gsbm="";
  371 + if(map.get("ssgsdm_like")!=null){
  372 + gsbm=map.get("ssgsdm_like").toString();
  373 + }
  374 + String fgsbm="";
  375 + if(map.get("fgsdm_like")!=null){
  376 + fgsbm=map.get("fgsdm_like").toString();
  377 + }
  378 + String rq = map.get("rq").toString();
  379 + String nbbm="";
  380 + if(map.get("nbbm_eq")!=null){
  381 + nbbm=map.get("nbbm_eq").toString();
  382 + }
  383 +
271 Map<String, Object> newMap=new HashMap<String,Object>(); 384 Map<String, Object> newMap=new HashMap<String,Object>();
272 Map<String, Object> map2=new HashMap<String,Object>(); 385 Map<String, Object> map2=new HashMap<String,Object>();
273 - String rq=map.get("rq").toString();  
274 - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");  
275 -  
276 try { 386 try {
  387 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  388 +
277 map.put("rq_eq", sdf.parse(rq)); 389 map.put("rq_eq", sdf.parse(rq));
278 - } catch (ParseException e1) {  
279 - // TODO Auto-generated catch block  
280 - e1.printStackTrace();  
281 - }  
282 - //获取车辆存油信息  
283 - List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));  
284 - //指定日期YLB信息  
285 - Iterator<Ylb> iterator= repository.findAll(new CustomerSpecs<Ylb>(map)).iterator();  
286 - while(iterator.hasNext()){  
287 - Ylb ylb=iterator.next();  
288 - //判断是否已经计算过  
289 - if(newMap.get("nbbm"+ylb.getNbbm())==null){  
290 - String nbbm_eq=ylb.getNbbm();  
291 - Date rq_eq=ylb.getRq();  
292 - //得到一天总的加油和里程(根据车,时间)  
293 - List<Object[]> sumList=repository.sumLcYl(nbbm_eq, rq_eq);  
294 - //保存总的加油量  
295 - Double jzl=Double.valueOf(sumList.get(0)[0].toString());  
296 - //保存总的里程  
297 - Double zlc=Double.valueOf(sumList.get(0)[1].toString());  
298 - //保留两位小数 390 +// List<Cyl> clyList = cylRepository.obtainCyl();
  391 + // 获取车辆存油信息
  392 + List<Cyl> cylList = cylRepository.obtainCyl(nbbm,gsbm);
  393 + // 指定日期YLB信息
  394 + List<Ylb> ylbList =repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm");
  395 + List<Ylb> iterator2=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"jcsx");
  396 + for (int i=0;i<ylbList.size();i++) {
  397 + Ylb ylb = ylbList.get(i);
  398 + // 判断是否已经计算过
  399 + if (newMap.get("nbbm" + ylb.getNbbm()) == null) {
  400 + String nbbm_eq = ylb.getNbbm();
  401 + Date rq_eq = ylb.getRq();
  402 + // 得到一天总的加油和里程(根据车,时间)
  403 + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm());
  404 + // 保存总的加油量
  405 + Double jzl = 0.0;
  406 + // 保存总的里程
  407 + Double zlc = 0.0;
  408 + //保存总的损耗
  409 + Double zsh = 0.0;
  410 + for (int j = 0; j < sumList.size(); j++) {
  411 + jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString()));
  412 + zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString()));
  413 + zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString()));
  414 + }
  415 + jzl = Arith.sub(jzl, zsh);
  416 + // 保留两位小数
299 DecimalFormat df = new DecimalFormat("#.00"); 417 DecimalFormat df = new DecimalFormat("#.00");
300 - Double zyl=0.0;  
301 - Double nextJzyl=0.0;  
302 -  
303 - //保存已经计算过的车辆,相同车辆编号的车不在计算  
304 - newMap.put("nbbm"+ylb.getNbbm(), ylb.getNbbm());  
305 -  
306 - //查询指定车辆,设置进、存、耗油量 418 + Double zyl = 0.0;
  419 + Double nextJzyl = 0.0;
  420 + // 保存已经计算过的车辆,相同车辆编号的车不在计算
  421 + newMap.put("nbbm" + ylb.getNbbm(), ylb.getNbbm());
  422 +
  423 + // 查询指定车辆,设置进、存、耗油量
307 map.remove("nbbm_eq"); 424 map.remove("nbbm_eq");
308 map.put("nbbm_eq", ylb.getNbbm()); 425 map.put("nbbm_eq", ylb.getNbbm());
309 - Iterator<Ylb> iterator2= repository.findAll(new CustomerSpecs<Ylb>(map),new Sort(Direction.ASC, "jcsx")).iterator();  
310 - while(iterator2.hasNext()){  
311 - try{  
312 - Ylb t = iterator2.next();  
313 - if(t.getJcsx()==1){  
314 - //进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量  
315 - Double yl=t.getCzyl();  
316 - Double jcyl=t.getCzyl();  
317 - zyl=jcyl+jzl-yl;  
318 - Double yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc))); 426 + map.put("xlbm_like", ylb.getXlbm());
  427 +// Iterator<Ylb> iterator2 = repository
  428 +// .findAll(new CustomerSpecs<Ylb>(map), new Sort(Direction.ASC, "jcsx")).iterator();
  429 + for (int j = 0; j < iterator2.size(); j++) {
  430 +
  431 + Ylb t = iterator2.get(j);
  432 + if(t.getNbbm().equals(ylb.getNbbm())){
  433 + if (t.getJcsx() == 1) {
  434 + // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量
  435 + Double yl = t.getCzyl();
  436 + Double jcyl = t.getCzyl();
  437 +// zyl = jcyl + jzl - yl;
  438 + zyl =Arith.sub( Arith.add(jcyl, jzl),yl);
  439 + Double yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
319 t.setYh(yh); 440 t.setYh(yh);
320 - nextJzyl=t.getJzl()+t.getCzyl()-yh;  
321 - t.setJzyl(Double.parseDouble(df.format(nextJzyl)));  
322 - }else{  
323 - t.setCzyl(Double.parseDouble(df.format(nextJzyl)));  
324 - Double yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc))); 441 +// nextJzyl = t.getJzl() + t.getCzyl() - yh;
  442 + nextJzyl =Arith.sub( Arith.add(t.getJzl(), t.getCzyl()),yh);
  443 +// t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  444 + t.setJzyl(nextJzyl);
  445 + } else {
  446 +// t.setCzyl(Double.parseDouble(df.format(nextJzyl)));
  447 + t.setCzyl(nextJzyl);
  448 + Double yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
325 t.setYh(yh); 449 t.setYh(yh);
326 - nextJzyl=t.getJzl()+nextJzyl-yh;  
327 - t.setJzyl(Double.parseDouble(df.format(nextJzyl))); 450 +// nextJzyl = t.getJzl() + nextJzyl - yh;
  451 + nextJzyl =Arith.sub( Arith.add(t.getJzl(),nextJzyl),yh);
  452 +// t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  453 + t.setJzyl(nextJzyl);
328 } 454 }
329 -  
330 repository.save(t); 455 repository.save(t);
331 - //设置存油量  
332 - Cyl cyl=null;  
333 - boolean fage=false;  
334 - for(int z=0;z<cylList.size();z++){  
335 - cyl=cylList.get(z);  
336 - if(t.getNbbm().equals(cyl.getNbbm())){  
337 - cyl.setCyl(t.getJzyl());  
338 - cyl.setUpdatetime(t.getRq());  
339 - fage=true;  
340 - break;  
341 - }  
342 - }  
343 -  
344 - if(fage){  
345 - cylRepository.save(cyl);  
346 - }else{  
347 - cyl=new Cyl();  
348 - cyl.setNbbm(t.getNbbm()); 456 + }
  457 +
  458 + // 设置存油量
  459 + Cyl cyl = null;
  460 + boolean fage = false;
  461 + for (int z = 0; z < cylList.size(); z++) {
  462 + cyl = cylList.get(z);
  463 + if (t.getNbbm().equals(cyl.getNbbm())) {
349 cyl.setCyl(t.getJzyl()); 464 cyl.setCyl(t.getJzyl());
350 - cyl.setGsdm(t.getSsgsdm());  
351 cyl.setUpdatetime(t.getRq()); 465 cyl.setUpdatetime(t.getRq());
352 - cylRepository.save(cyl); 466 + fage = true;
  467 + break;
353 } 468 }
354 -  
355 -  
356 - map2.put("status", ResponseCode.SUCCESS);  
357 - }catch(Exception e){  
358 - map2.put("status", ResponseCode.ERROR);  
359 - logger.error("save erro.", e);  
360 } 469 }
  470 + if (fage) {
  471 + cylRepository.save(cyl);
  472 + } else {
  473 + cyl = new Cyl();
  474 + cyl.setNbbm(t.getNbbm());
  475 + cyl.setCyl(t.getJzyl());
  476 + cyl.setGsdm(t.getSsgsdm());
  477 + cyl.setUpdatetime(t.getRq());
  478 + cylRepository.save(cyl);
  479 + }
  480 + map2.put("status", ResponseCode.SUCCESS);
361 } 481 }
362 -  
363 -  
364 } 482 }
  483 + }
  484 + } catch (Exception e) {
  485 + map2.put("status", ResponseCode.ERROR);
  486 + logger.error("save erro.", e);
  487 + throw e;
365 } 488 }
366 -  
367 return map2; 489 return map2;
368 } 490 }
369 - 491 +
370 /** 492 /**
371 * 拆分 493 * 拆分
372 */ 494 */
373 - @Transactional 495 + @Transactional
374 @Override 496 @Override
375 public Map<String, Object> sort(Map<String, Object> map) { 497 public Map<String, Object> sort(Map<String, Object> map) {
376 // TODO Auto-generated method stub 498 // TODO Auto-generated method stub
377 Map<String, Object> newMap = new HashMap<String, Object>(); 499 Map<String, Object> newMap = new HashMap<String, Object>();
378 - //获取车辆存油信息  
379 - List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));  
380 - int id=Integer.parseInt(map.get("id").toString());  
381 - //最后存油量  
382 - Double yl=Double.parseDouble(map.get("jzyl").toString());  
383 - Ylb ylb=repository.findOne(id);  
384 - String nbbm_eq=ylb.getNbbm();  
385 - Date rq_eq=ylb.getRq();  
386 - //得到一天总的加油和里程(根据车,时间)  
387 - List<Object[]> sumList=repository.sumLcYl(nbbm_eq, rq_eq);  
388 - //保存总的加油量  
389 - Double jzl=Double.valueOf(sumList.get(0)[0].toString());  
390 - //保存总的里程  
391 - Double zlc=Double.valueOf(sumList.get(0)[1].toString());  
392 - map.put("nbbm_eq", nbbm_eq);  
393 - map.put("rq_eq",rq_eq);  
394 - Iterator<Ylb> iterator= repository.findAll(new CustomerSpecs<Ylb>(map),new Sort(Direction.ASC, "jcsx")).iterator();  
395 - //根据jcyl排序1为该车当日第一个出场,出场油量为前一天的存油  
396 - //保留两位小数  
397 - DecimalFormat df = new DecimalFormat("#.00");  
398 - Double zyl=0.0;  
399 - Double nextJzyl=0.0;  
400 - //车的,进,出油量及耗油  
401 - while(iterator.hasNext()){  
402 - try{  
403 - Ylb t = iterator.next();  
404 - if(t.getJcsx()==1){  
405 - Double jcyl=t.getCzyl();  
406 - zyl=jcyl+jzl-yl;  
407 - Double yh=0.0;  
408 - if(zlc>0&&t.getZlc()>0){  
409 - yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc))); 500 + SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
  501 + try {
  502 + // 获取车辆存油信息
  503 + List<Cyl> cylList = cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));
  504 + int id = Integer.parseInt(map.get("id").toString());
  505 + // 最后存油量
  506 + Double yl = Double.parseDouble(map.get("jzyl").toString());
  507 + Double sh= Double.parseDouble(map.get("sh").toString());
  508 + String shyy=map.get("shyy").toString();
  509 + Ylb ylb = repository.findOne(id);
  510 +
  511 + String nbbm_eq = ylb.getNbbm();
  512 + Date rq_eq = ylb.getRq();
  513 + // 得到一天总的加油和里程(根据车,时间)
  514 + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm());
  515 + // 保存总的加油量
  516 + Double jzl = 0.0;
  517 + // 保存总的里程
  518 + Double zlc = 0.0;
  519 + //保存总的损耗
  520 + Double zsh = 0.0;
  521 + for (int j = 0; j < sumList.size(); j++) {
  522 + jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString()));
  523 + zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString()));
  524 + zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString()));
  525 + }
  526 + jzl = Arith.sub(jzl, zsh);
  527 +
  528 + //新的 损耗不等于 旧的损耗 总损耗从新算
  529 + if(Arith.sub(ylb.getSh(),sh )!=0){
  530 +// zsh =zsh-ylb.getSh()+sh;
  531 + zsh =Arith.add(Arith.sub(zsh, ylb.getSh()), sh);
  532 +// jzl =jzl-zsh;
  533 + jzl =Arith.sub(jzl, zsh);
  534 + }else{
  535 +// jzl=jzl-zsh;
  536 + jzl =Arith.sub(jzl, zsh);
  537 + }
  538 + map.put("nbbm_eq", nbbm_eq);
  539 + map.put("rq_eq", rq_eq);
  540 + List<Ylb> iterator2=repository.obtainYl(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),ylb.getXlbm(),
  541 + ylb.getNbbm(),"jcsx");
  542 +// Iterator<Ylb> iterator = repository.findAll(new CustomerSpecs<Ylb>(map), new Sort(Direction.ASC, "jcsx"))
  543 +// .iterator();
  544 + // 根据jcyl排序1为该车当日第一个出场,出场油量为前一天的存油
  545 + // 保留两位小数
  546 + DecimalFormat df = new DecimalFormat("#.00");
  547 + Double zyl = 0.0;
  548 + Double nextJzyl = 0.0;
  549 + // 车的,进,出油量及耗油
  550 + for (int i = 0; i < iterator2.size(); i++) {
  551 + Ylb t = iterator2.get(i);
  552 + if (t.getJcsx() == 1) {
  553 + if(t.getId()==id){
  554 + t.setSh(sh);
  555 + t.setShyy(shyy);
  556 + }
  557 + Double jcyl = t.getCzyl();
  558 +// zyl = jcyl + jzl - yl;
  559 + zyl = Arith.sub(Arith.add(jcyl, jzl), yl);
  560 + Double yh = 0.0;
  561 + if (zlc > 0 && t.getZlc() > 0) {
  562 + yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
410 } 563 }
411 t.setYh(yh); 564 t.setYh(yh);
412 - nextJzyl=t.getJzl()+t.getCzyl()-yh;  
413 - t.setJzyl(Double.parseDouble(df.format(nextJzyl)));  
414 - }else{  
415 - if(t.getZlc()!=0){  
416 - t.setCzyl(Double.parseDouble(df.format(nextJzyl)));  
417 - Double yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc))); 565 +// nextJzyl = t.getJzl() + t.getCzyl() - yh-t.getSh();
  566 + nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), Arith.add(yh, t.getSh()));
  567 +// t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  568 + t.setJzyl(nextJzyl);
  569 + } else {
  570 + if(t.getId()==id){
  571 + t.setSh(sh);
  572 + t.setShyy(shyy);
  573 + }
  574 + if (t.getZlc() != 0) {
  575 +// t.setCzyl(Double.parseDouble(df.format(nextJzyl)));
  576 + t.setCzyl(nextJzyl);
  577 + Double yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
418 t.setYh(yh); 578 t.setYh(yh);
419 - nextJzyl=t.getJzl()+nextJzyl-yh;  
420 - t.setJzyl(Double.parseDouble(df.format(nextJzyl))); 579 +// nextJzyl = t.getJzl() + nextJzyl - yh-t.getSh();
  580 + nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh()));
  581 +// t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  582 + t.setJzyl(nextJzyl);
421 } 583 }
422 - 584 +
423 } 585 }
424 repository.save(t); 586 repository.save(t);
425 -  
426 - //设置存油量  
427 - Cyl cyl=null;  
428 - boolean fage=false;  
429 - for(int z=0;z<cylList.size();z++){  
430 - cyl=cylList.get(z);  
431 - if(t.getNbbm().equals(cyl.getNbbm())){ 587 +
  588 + // 设置存油量
  589 + Cyl cyl = null;
  590 + boolean fage = false;
  591 + for (int z = 0; z < cylList.size(); z++) {
  592 + cyl = cylList.get(z);
  593 + if (t.getNbbm().equals(cyl.getNbbm())) {
432 cyl.setCyl(t.getJzyl()); 594 cyl.setCyl(t.getJzyl());
433 cyl.setUpdatetime(t.getRq()); 595 cyl.setUpdatetime(t.getRq());
434 - fage=true; 596 + fage = true;
435 break; 597 break;
436 } 598 }
437 } 599 }
438 - if(fage){ 600 + if (fage) {
439 cylRepository.save(cyl); 601 cylRepository.save(cyl);
440 - }else{  
441 - cyl=new Cyl(); 602 + } else {
  603 + cyl = new Cyl();
442 cyl.setNbbm(t.getNbbm()); 604 cyl.setNbbm(t.getNbbm());
443 cyl.setCyl(t.getJzyl()); 605 cyl.setCyl(t.getJzyl());
444 cyl.setGsdm(t.getSsgsdm()); 606 cyl.setGsdm(t.getSsgsdm());
445 cyl.setUpdatetime(t.getRq()); 607 cyl.setUpdatetime(t.getRq());
446 cylRepository.save(cyl); 608 cylRepository.save(cyl);
447 } 609 }
448 - 610 +
449 newMap.put("status", ResponseCode.SUCCESS); 611 newMap.put("status", ResponseCode.SUCCESS);
450 - }catch(Exception e){  
451 - newMap.put("status", ResponseCode.ERROR);  
452 - logger.error("save erro.", e);  
453 } 612 }
  613 + } catch (Exception e) {
  614 + newMap.put("status", ResponseCode.ERROR);
  615 + logger.error("save erro.", e);
454 } 616 }
455 return newMap; 617 return newMap;
456 } 618 }
@@ -464,14 +626,33 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -464,14 +626,33 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
464 @Override 626 @Override
465 public Map<String, Object> checkYl(Map<String, Object> map) { 627 public Map<String, Object> checkYl(Map<String, Object> map) {
466 Map<String, Object> newMap=new HashMap<String,Object>(); 628 Map<String, Object> newMap=new HashMap<String,Object>();
467 - String xlbm=map.get("xlbm_eq").toString(); 629 +// String xlbm="";
  630 +// if(map.get("xlbm_like")!=null){
  631 +// xlbm=map.get("xlbm_like").toString();
  632 +// }
468 // TODO Auto-generated method stub 633 // TODO Auto-generated method stub
469 try{ 634 try{
470 //获取车辆存油信息 635 //获取车辆存油信息
471 List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); 636 List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));
472 String rq=map.get("rq").toString(); 637 String rq=map.get("rq").toString();
473 - List<Ylb> ylbList=repository.obtainYl(rq);  
474 - List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq); 638 + String xlbm="";
  639 + if(map.get("xlbm_like")!=null){
  640 + xlbm= map.get("xlbm_like").toString().trim();
  641 + }
  642 + String gsbm="";
  643 + if(map.get("ssgsdm_like")!=null){
  644 + gsbm=map.get("ssgsdm_like").toString();
  645 + }
  646 + String fgsbm="";
  647 + if(map.get("fgsdm_like")!=null){
  648 + fgsbm=map.get("fgsdm_like").toString();
  649 + }
  650 + String nbbm="";
  651 + if(map.get("nbbm_eq")!=null){
  652 + nbbm=map.get("nbbm_eq").toString();
  653 + }
  654 + List<Ylb> ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm");
  655 + List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm);
475 for (int i = 0; i < ylxxbList.size(); i++) { 656 for (int i = 0; i < ylxxbList.size(); i++) {
476 Boolean fage=true; 657 Boolean fage=true;
477 Ylxxb y1=ylxxbList.get(i); 658 Ylxxb y1=ylxxbList.get(i);
@@ -482,7 +663,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -482,7 +663,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
482 break; 663 break;
483 } 664 }
484 } 665 }
485 - 666 +
486 if(fage){ 667 if(fage){
487 Ylb t=new Ylb(); 668 Ylb t=new Ylb();
488 t.setNbbm(y1.getNbbm()); 669 t.setNbbm(y1.getNbbm());
@@ -492,14 +673,15 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -492,14 +673,15 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
492 t.setSsgsdm(y1.getGsdm()); 673 t.setSsgsdm(y1.getGsdm());
493 t.setXlbm(xlbm); 674 t.setXlbm(xlbm);
494 repository.save(t); 675 repository.save(t);
495 - 676 +
496 //设置存油量 677 //设置存油量
497 Cyl cyl=null; 678 Cyl cyl=null;
498 boolean status=false; 679 boolean status=false;
499 for(int z=0;z<cylList.size();z++){ 680 for(int z=0;z<cylList.size();z++){
500 cyl=cylList.get(z); 681 cyl=cylList.get(z);
501 if(t.getNbbm().equals(cyl.getNbbm())){ 682 if(t.getNbbm().equals(cyl.getNbbm())){
502 - cyl.setCyl(cyl.getCyl()+t.getJzl()); 683 +// cyl.setCyl(cyl.getCyl()+t.getJzl());
  684 + cyl.setCyl(Arith.add(cyl.getCyl(),t.getJzl()));
503 cyl.setUpdatetime(t.getRq()); 685 cyl.setUpdatetime(t.getRq());
504 status=true; 686 status=true;
505 break; 687 break;
@@ -515,16 +697,17 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -515,16 +697,17 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
515 cyl.setUpdatetime(t.getRq()); 697 cyl.setUpdatetime(t.getRq());
516 cylRepository.save(cyl); 698 cylRepository.save(cyl);
517 } 699 }
518 -  
519 - 700 +
  701 +
520 } 702 }
521 } 703 }
522 newMap.put("status", ResponseCode.SUCCESS); 704 newMap.put("status", ResponseCode.SUCCESS);
523 }catch(Exception e){ 705 }catch(Exception e){
524 newMap.put("status", ResponseCode.ERROR); 706 newMap.put("status", ResponseCode.ERROR);
525 logger.error("save erro.", e); 707 logger.error("save erro.", e);
  708 + throw e;
526 } 709 }
527 - 710 +
528 return newMap; 711 return newMap;
529 } 712 }
530 713
@@ -540,28 +723,128 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -540,28 +723,128 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
540 " select x.nbbm,max(x.rq) as rq,max(x.jcsx) as jcsx from " 723 " select x.nbbm,max(x.rq) as rq,max(x.jcsx) as jcsx from "
541 + "(select nbbm,rq,max(jcsx) as jcsx from bsth_c_ylb where rq between '" 724 + "(select nbbm,rq,max(jcsx) as jcsx from bsth_c_ylb where rq between '"
542 + date2 +"' and '" + date+"' "+lineStr 725 + date2 +"' and '" + date+"' "+lineStr
543 - + "group by nbbm,rq) x group by x.nbbm ) b" 726 + + "group by nbbm,rq) x group by x.nbbm ) b"
544 + " left join (select nbbm,rq,jzyl,jcsx FROM bsth_c_ylb " 727 + " left join (select nbbm,rq,jzyl,jcsx FROM bsth_c_ylb "
545 + " where rq between '" 728 + " where rq between '"
546 + date2 +"' and '" + date+"' "+lineStr 729 + date2 +"' and '" + date+"' "+lineStr
547 + ") a " 730 + ") a "
548 + " on a.nbbm =b.nbbm and a.jcsx=b.jcsx and a.rq=b.rq " 731 + " on a.nbbm =b.nbbm and a.jcsx=b.jcsx and a.rq=b.rq "
549 + " where a.nbbm is not null order by a.nbbm"; 732 + " where a.nbbm is not null order by a.nbbm";
550 - 733 +
551 // TODO Auto-generated method stub 734 // TODO Auto-generated method stub
552 - List<Ylb> list =jdbcTemplate.query(sql,  
553 - new RowMapper<Ylb>(){  
554 - @Override  
555 - public Ylb mapRow(ResultSet rs, int rowNum) throws SQLException {  
556 - Ylb s = new Ylb();  
557 - s.setNbbm(rs.getString("nbbm"));  
558 - s.setRq(rs.getDate("rq"));  
559 - s.setJzyl(rs.getDouble("jzyl"));  
560 - return s;  
561 - }  
562 - }); 735 + List<Ylb> list =jdbcTemplate.query(sql,
  736 + new RowMapper<Ylb>(){
  737 + @Override
  738 + public Ylb mapRow(ResultSet rs, int rowNum) throws SQLException {
  739 + Ylb s = new Ylb();
  740 + s.setNbbm(rs.getString("nbbm"));
  741 + s.setRq(rs.getDate("rq"));
  742 + s.setJzyl(rs.getDouble("jzyl"));
  743 + return s;
  744 + }
  745 + });
563 return list; 746 return list;
564 } 747 }
565 -  
566 748
567 -} 749 + @Override
  750 + public StringBuffer checkNbmmNum(String rq, String gsbm, String fgsbm, String xlbm,String nbbm,int lx) {
  751 + StringBuffer stringList =new StringBuffer();
  752 + List<Object[]> objectList=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
  753 + for (int i = 0; i < objectList.size(); i++) {
  754 + String clbm=objectList.get(i)[0].toString()+",";
  755 + int cs=Integer.parseInt(objectList.get(i)[1].toString());
  756 + //一车一单
  757 + if(lx==1){
  758 + if(cs==1){
  759 + stringList.append(clbm);
  760 + }
  761 + }
  762 + //一车多单
  763 + if(lx==2){
  764 + if(cs>1){
  765 + stringList.append(clbm);
  766 + }
  767 +
  768 + }
  769 + }
  770 + return stringList;
  771 + }
  772 +
  773 +
  774 +
  775 + @Override
  776 + public Map<String, Object> sumYlb(Map<String, Object> map) {
  777 + // TODO Auto-generated method stub
  778 + List<String> stringList=new ArrayList<String>();
  779 + String rq=map.get("rq").toString();
  780 + String gsbm=map.get("ssgsdm_like").toString();
  781 + String fgsbm=map.get("fgsdm_like").toString();
  782 + String xlbm=map.get("xlbm_like").toString().trim();
  783 + String nbbm=map.get("nbbm_eq").toString();
  784 + String sxtj=map.get("sxtj").toString();
  785 + if(nbbm.trim()!=""){
  786 + stringList.add(nbbm);
  787 + }else{
  788 + if(!sxtj.equals("0")){
  789 + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
  790 + for (int i = 0; i < objectLists.size(); i++) {
  791 + String clbm=objectLists.get(i)[0].toString();
  792 + int cs=Integer.parseInt(objectLists.get(i)[1].toString());
  793 + //一车一单
  794 +
  795 + if(sxtj.equals("1")){
  796 + if(cs==1){
  797 + stringList.add(clbm);
  798 + }
  799 + }
  800 + //一车多单
  801 + if(sxtj.equals("2")){
  802 + if(cs>1){
  803 + stringList.add(clbm);
  804 + }
  805 + }
  806 + }
  807 + }
  808 + }
  809 + List<Object[]> sumYlbList=new ArrayList<Object[]>();
  810 + if(sxtj.equals("0")){
  811 + sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm,nbbm);
  812 + }else{
  813 + if(stringList.size()>0){
  814 +
  815 +// String strings[]=new String[stringList.size()];
  816 +// for(int i=0;i<stringList.size();i++){
  817 +// strings[i]=stringList.get(i);
  818 +// }
  819 + sumYlbList=repository.sumYlb(rq, gsbm, fgsbm, xlbm, stringList);
  820 + }else{
  821 + sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm, nbbm);
  822 + }
  823 +
  824 + }
  825 +
  826 + Double jzl=0.0,yh=0.0,sh=0.0;
  827 + for (int i = 0; i < sumYlbList.size(); i++) {
  828 + jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString()));
  829 + yh = Arith.add(yh, Double.valueOf(sumYlbList.get(i)[1].toString()));
  830 + sh = Arith.add(sh, Double.valueOf(sumYlbList.get(i)[2].toString()));
  831 + }
  832 +
  833 + Map<String, Object> sumMap=new HashMap<String,Object>();
  834 + sumMap.put("jzl", jzl);
  835 + sumMap.put("yh", yh);
  836 + sumMap.put("sh", sh);
  837 +// String sql="select sum(jzl),sum(yh),sum(sh) from bsth_c_ylb "
  838 +// + " where to_days('"+map.get("rq").toString()+"')=to_days(rq) "
  839 +// + " and ssgsdm like '%"+map.get("ssgsdm_like").toString()+"%' "
  840 +// + " and fgsdm like '%"+map.get("fgsdm_like").toString()+"%' "
  841 +// + " and xlbm like '%"+map.get("xlbm_like").toString()+ "%'"
  842 +// + " and nbbm like '%"+map.get("nbbm_eq").toString()+"% '";
  843 +// if(map.get("nbbm_in")!=null){
  844 +//// sql +=" and nbbm in ("
  845 +// }
  846 + return sumMap;
  847 + }
  848 +
  849 +
  850 +}
568 \ No newline at end of file 851 \ No newline at end of file
src/main/java/com/bsth/service/realcontrol/OilStationSocietyService.java 0 → 100644
  1 +package com.bsth.service.realcontrol;
  2 +
  3 +import com.bsth.entity.realcontrol.OilStationSociety;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +/**
  7 + * Created by panzhao on 2017/3/16.
  8 + */
  9 +public interface OilStationSocietyService extends BaseService<OilStationSociety, String> {
  10 +}
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
@@ -112,6 +112,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -112,6 +112,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
112 112
113 List<Map<String,Object>> statisticsDaily(String line, String date, String xlName, String type); 113 List<Map<String,Object>> statisticsDaily(String line, String date, String xlName, String type);
114 114
  115 + List<Map<String,Object>> statisticsDailyTj(String line, String date,String date2, String xlName, String type);
  116 +
115 //List<Object> scheduleDaily(String line,String date); 117 //List<Object> scheduleDaily(String line,String date);
116 118
117 int countByLineCodeAndDate(String xlBm, String schDate); 119 int countByLineCodeAndDate(String xlBm, String schDate);
@@ -126,7 +128,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -126,7 +128,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
126 List<ScheduleRealInfo> realScheduleList(String line,String date); 128 List<ScheduleRealInfo> realScheduleList(String line,String date);
127 List<ScheduleRealInfo> realScheduleListQp(String line,String date); 129 List<ScheduleRealInfo> realScheduleListQp(String line,String date);
128 130
129 - List<Map<String,Object>> yesterdayDataList(String line,String date); 131 + List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String jGh,String nbbm);
130 132
131 List<Map<String,Object>> yesterdayDataList(String line); 133 List<Map<String,Object>> yesterdayDataList(String line);
132 134
@@ -156,7 +158,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -156,7 +158,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
156 158
157 Map<String,Object> lpChangeMulti(String leftIdx, String rightIdx, int type); 159 Map<String,Object> lpChangeMulti(String leftIdx, String rightIdx, int type);
158 160
159 - void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type, boolean changeRealTime); 161 + void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type);
160 162
161 Map<String,Object> revokeRealArrive(Long id); 163 Map<String,Object> revokeRealArrive(Long id);
162 } 164 }
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
@@ -9,6 +9,7 @@ import com.bsth.repository.realcontrol.ChildTaskPlanRepository; @@ -9,6 +9,7 @@ import com.bsth.repository.realcontrol.ChildTaskPlanRepository;
9 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 9 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
10 import com.bsth.service.impl.BaseServiceImpl; 10 import com.bsth.service.impl.BaseServiceImpl;
11 import com.bsth.service.realcontrol.ChildTaskPlanService; 11 import com.bsth.service.realcontrol.ChildTaskPlanService;
  12 +import org.apache.commons.lang3.StringUtils;
12 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.jdbc.core.JdbcTemplate; 14 import org.springframework.jdbc.core.JdbcTemplate;
14 import org.springframework.stereotype.Service; 15 import org.springframework.stereotype.Service;
@@ -45,8 +46,11 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon @@ -45,8 +46,11 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
45 //保存起终点名称 46 //保存起终点名称
46 String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_"; 47 String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_";
47 48
48 - t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix));  
49 - t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix)); 49 + if(StringUtils.isEmpty(t.getStartStationName()))
  50 + t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix));
  51 +
  52 + if(StringUtils.isEmpty(t.getEndStationName()))
  53 + t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix));
50 //先持久化子任务 54 //先持久化子任务
51 rs = super.save(t); 55 rs = super.save(t);
52 //再关联主任务 56 //再关联主任务
src/main/java/com/bsth/service/realcontrol/impl/OilStationSocietyServiceImpl.java 0 → 100644
  1 +package com.bsth.service.realcontrol.impl;
  2 +
  3 +import com.bsth.entity.realcontrol.OilStationSociety;
  4 +import com.bsth.service.impl.BaseServiceImpl;
  5 +import com.bsth.service.realcontrol.OilStationSocietyService;
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +/**
  9 + * Created by panzhao on 2017/3/16.
  10 + */
  11 +@Service
  12 +public class OilStationSocietyServiceImpl extends BaseServiceImpl<OilStationSociety, String> implements OilStationSocietyService {
  13 +}
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -179,6 +179,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -179,6 +179,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
179 schedule.setBcType(bcType); 179 schedule.setBcType(bcType);
180 } 180 }
181 181
  182 + //重新计算是否误点
  183 + schedule.reCalcLate();
  184 +
182 // 持久化到数据库 185 // 持久化到数据库
183 dayOfSchedule.save(schedule); 186 dayOfSchedule.save(schedule);
184 187
@@ -338,7 +341,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -338,7 +341,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
338 t.setLate(false); 341 t.setLate(false);
339 t.setDfsj(t.getFcsj()); 342 t.setDfsj(t.getFcsj());
340 t.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + t.getZdsj()).getTime()); 343 t.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + t.getZdsj()).getTime());
341 - 344 + t.setJhlcOrig(t.getJhlc());
342 345
343 //班次历时 346 //班次历时
344 t.setBcsj(DateUtils.calcHHmmDiff(t.getFcsj(), t.getZdsj()) / 1000 / 60); 347 t.setBcsj(DateUtils.calcHHmmDiff(t.getFcsj(), t.getZdsj()) / 1000 / 60);
@@ -391,14 +394,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -391,14 +394,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
391 return rs; 394 return rs;
392 } 395 }
393 396
394 - dayOfSchedule.delete(sch);  
395 - //ScheduleRealInfo sch = dayOfSchedule.delete(id);  
396 //数据库删除 397 //数据库删除
397 rs = super.delete(id); 398 rs = super.delete(id);
398 - //更新起点应到时间  
399 - List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch.getClZbh());  
400 - rs.put("ts", ts);  
401 - rs.put("delete", sch); 399 + if(rs.get("status").equals(ResponseCode.SUCCESS)){
  400 + dayOfSchedule.delete(sch);
  401 + //更新起点应到时间
  402 + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch.getClZbh());
  403 + rs.put("ts", ts);
  404 + rs.put("delete", sch);
  405 + }
402 406
403 return rs; 407 return rs;
404 } 408 }
@@ -853,6 +857,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -853,6 +857,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
853 rs.put("msg", "未烂班,无法撤销!"); 857 rs.put("msg", "未烂班,无法撤销!");
854 } else { 858 } else {
855 sch.setStatus(0); 859 sch.setStatus(0);
  860 + sch.setRemarks("");//清空备注
  861 + sch.setJhlc(sch.getJhlcOrig());
856 rs.put("status", ResponseCode.SUCCESS); 862 rs.put("status", ResponseCode.SUCCESS);
857 rs.put("t", sch); 863 rs.put("t", sch);
858 864
@@ -1057,9 +1063,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1057,9 +1063,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1057 1063
1058 //修改班次里程 1064 //修改班次里程
1059 String jhlc = map.get("jhlc"); 1065 String jhlc = map.get("jhlc");
1060 - if (StringUtils.isNotEmpty(jhlc)  
1061 - && Double.parseDouble(jhlc) != sch.getJhlc()) {  
1062 - sch.setJhlc(Double.parseDouble(jhlc)); 1066 + if (StringUtils.isNotEmpty(jhlc)) {
  1067 + if(Double.parseDouble(jhlc) == 0 && sch.getJhlcOrig() != 0)
  1068 + destroy(sch.getId() + "", "", map.get("adjustExps").toString());
  1069 + else{
  1070 + sch.setJhlc(Double.parseDouble(jhlc));
  1071 + }
1063 } 1072 }
1064 } 1073 }
1065 1074
@@ -1097,6 +1106,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1097,6 +1106,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1097 schedule = dayOfSchedule.get(jsonObj.getLong("id")); 1106 schedule = dayOfSchedule.get(jsonObj.getLong("id"));
1098 //设置待发时间 1107 //设置待发时间
1099 schedule.setDfsjAll(dfsj); 1108 schedule.setDfsjAll(dfsj);
  1109 + //重新计算是否误点
  1110 + schedule.reCalcLate();
1100 1111
1101 dayOfSchedule.save(schedule); 1112 dayOfSchedule.save(schedule);
1102 } 1113 }
@@ -1215,7 +1226,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1215,7 +1226,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1215 1226
1216 @Override 1227 @Override
1217 public Map<String, Object> findKMBC2(String jName, String clZbh, String date) { 1228 public Map<String, Object> findKMBC2(String jName, String clZbh, String date) {
1218 - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date); 1229 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date,"","");
1219 1230
1220 DecimalFormat format = new DecimalFormat("0.00"); 1231 DecimalFormat format = new DecimalFormat("0.00");
1221 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); 1232 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
@@ -1290,7 +1301,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1290,7 +1301,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1290 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); 1301 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
1291 int jhbc = 0, cjbc = 0, ljbc = 0; 1302 int jhbc = 0, cjbc = 0, ljbc = 0;
1292 double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0; 1303 double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
1293 - float addMileage = 0l, remMileage = 0l; 1304 + float addMileage = 0l, remMileage = 0l,addMileageYy = 0l,addMileageJc =0l;
1294 Map<String, Object> map = new HashMap<String, Object>(); 1305 Map<String, Object> map = new HashMap<String, Object>();
1295 for (ScheduleRealInfo scheduleRealInfo : list) { 1306 for (ScheduleRealInfo scheduleRealInfo : list) {
1296 if (scheduleRealInfo != null) { 1307 if (scheduleRealInfo != null) {
@@ -1301,18 +1312,25 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1301,18 +1312,25 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1301 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); 1312 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
1302 if (scheduleRealInfo.isSflj()) { 1313 if (scheduleRealInfo.isSflj()) {
1303 addMileage += tempJhlc; 1314 addMileage += tempJhlc;
1304 - ljbc++; 1315 + if (scheduleRealInfo.getBcType().equals("in")
  1316 + || scheduleRealInfo.getBcType().equals("out")) {
  1317 + addMileageJc +=tempJhlc;
  1318 + }else{
  1319 + ljbc++;
  1320 + addMileageYy +=tempJhlc;
  1321 + }
  1322 +
1305 } else { 1323 } else {
1306 if (!(scheduleRealInfo.getBcType().equals("in") 1324 if (!(scheduleRealInfo.getBcType().equals("in")
1307 || scheduleRealInfo.getBcType().equals("out"))) { 1325 || scheduleRealInfo.getBcType().equals("out"))) {
1308 - jhbc++;  
1309 - jhlc += tempJhlc; 1326 + jhbc++;
  1327 + jhlc += tempJhlc;
  1328 + if (scheduleRealInfo.getStatus() == -1) {
  1329 + remMileage += tempJhlc;
  1330 + cjbc++;
  1331 + }
1310 } 1332 }
1311 1333
1312 - if (scheduleRealInfo.getStatus() == -1) {  
1313 - remMileage += tempJhlc;  
1314 - cjbc++;  
1315 - }  
1316 } 1334 }
1317 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); 1335 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1318 //计算营运里程,空驶里程 1336 //计算营运里程,空驶里程
@@ -1358,15 +1376,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1358,15 +1376,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1358 map.put("jhlc", format.format(jhlc)); 1376 map.put("jhlc", format.format(jhlc));
1359 map.put("remMileage", format.format(remMileage)); 1377 map.put("remMileage", format.format(remMileage));
1360 map.put("addMileage", format.format(addMileage)); 1378 map.put("addMileage", format.format(addMileage));
1361 - map.put("yygl", format.format(yygl)); 1379 + map.put("yygl", format.format(yygl+addMileageYy));
1362 map.put("ksgl", format.format(ksgl)); 1380 map.put("ksgl", format.format(ksgl));
1363 - map.put("realMileage", format.format(yygl + ksgl + jcclc)); 1381 + map.put("realMileage", format.format(yygl + ksgl + jcclc+addMileageYy));
  1382 +// map.put("realMileage", format.format(yygl + ksgl + jcclc+addMileage));
1364 map.put("jhbc", jhbc); 1383 map.put("jhbc", jhbc);
1365 map.put("cjbc", cjbc); 1384 map.put("cjbc", cjbc);
1366 map.put("ljbc", ljbc); 1385 map.put("ljbc", ljbc);
1367 map.put("sjbc", jhbc - cjbc + ljbc); 1386 map.put("sjbc", jhbc - cjbc + ljbc);
1368 map.put("jcclc", jcclc); 1387 map.put("jcclc", jcclc);
1369 map.put("zkslc", format.format(ksgl + jcclc)); 1388 map.put("zkslc", format.format(ksgl + jcclc));
  1389 +// map.put("zkslc", format.format(ksgl + jcclc+addMileageJc));
1370 return map; 1390 return map;
1371 } 1391 }
1372 1392
@@ -1436,140 +1456,681 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1436,140 +1456,681 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1436 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 1456 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
1437 Map<String, Object> m = new HashMap<String, Object>(); 1457 Map<String, Object> m = new HashMap<String, Object>();
1438 ReportUtils ee = new ReportUtils(); 1458 ReportUtils ee = new ReportUtils();
1439 - m.put("dates", startDate + " 至 " + endDate);  
1440 - List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();  
1441 - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
1442 - for (ScheduleRealInfo schedule : list) {  
1443 - Map<String, Object> tempMap = new HashMap<String, Object>();  
1444 - tempMap.put("xlName", schedule.getXlName() != null ? schedule.getXlName() : "");  
1445 - tempMap.put("lpName", schedule.getLpName() != null ? schedule.getLpName() : "");  
1446 - tempMap.put("clZbh", schedule.getClZbh() != null ? schedule.getClZbh() : "");  
1447 - tempMap.put("jName", schedule.getjName() != null ? schedule.getjName() : "");  
1448 - tempMap.put("sName", schedule.getsName() != null ? schedule.getsName() : "");  
1449 - tempMap.put("fcsj", schedule.getFcsj() != null ? schedule.getFcsj() : "");  
1450 - tempMap.put("fcsjActual", schedule.getFcsjActual() != null ? schedule.getFcsjActual() : "");  
1451 - tempMap.put("zdsj", schedule.getZdsj() != null ? schedule.getZdsj() : "");  
1452 - tempMap.put("zdsjActual", schedule.getZdsjActual() != null ? schedule.getZdsjActual() : "");  
1453 - if (schedule.getUpdateBy() != null) {  
1454 - if (schedule.getUpdateBy().getName() != null)  
1455 - tempMap.put("userName", schedule.getUpdateBy().getName());  
1456 - else  
1457 - tempMap.put("userName", "");  
1458 - } else {  
1459 - tempMap.put("userName", "");  
1460 - }  
1461 - if (schedule.getUpdateDate() != null) {  
1462 - tempMap.put("updateDate", sdf.format(schedule.getUpdateDate()));  
1463 - } else {  
1464 - tempMap.put("updateDate", "");  
1465 - }  
1466 - tempMap.put("remarks", schedule.getRemarks() != null ? schedule.getRemarks() : "");  
1467 - tempList.add(tempMap);  
1468 - } 1459 + m.put("dates", startDate + " 至 " + endDate);
  1460 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  1461 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1462 + for (ScheduleRealInfo schedule : list) {
  1463 + Map<String, Object> tempMap = new HashMap<String, Object>();
  1464 + tempMap.put("xlName", schedule.getXlName() != null ? schedule.getXlName() : "");
  1465 + tempMap.put("lpName", schedule.getLpName() != null ? schedule.getLpName() : "");
  1466 + tempMap.put("clZbh", schedule.getClZbh() != null ? schedule.getClZbh() : "");
  1467 + tempMap.put("jName", schedule.getjName() != null ? schedule.getjName() : "");
  1468 + tempMap.put("sName", schedule.getsName() != null ? schedule.getsName() : "");
  1469 + tempMap.put("fcsj", schedule.getFcsj() != null ? schedule.getFcsj() : "");
  1470 + tempMap.put("fcsjActual", schedule.getFcsjActual() != null ? schedule.getFcsjActual() : "");
  1471 + tempMap.put("zdsj", schedule.getZdsj() != null ? schedule.getZdsj() : "");
  1472 + tempMap.put("zdsjActual", schedule.getZdsjActual() != null ? schedule.getZdsjActual() : "");
  1473 + if (schedule.getUpdateBy() != null) {
  1474 + if (schedule.getUpdateBy().getName() != null)
  1475 + tempMap.put("userName", schedule.getUpdateBy().getName());
  1476 + else
  1477 + tempMap.put("userName", "");
  1478 + } else {
  1479 + tempMap.put("userName", "");
  1480 + }
  1481 + if (schedule.getUpdateDate() != null) {
  1482 + tempMap.put("updateDate", sdf.format(schedule.getUpdateDate()));
  1483 + } else {
  1484 + tempMap.put("updateDate", "");
  1485 + }
  1486 + tempMap.put("remarks", schedule.getRemarks() != null ? schedule.getRemarks() : "");
  1487 + tempList.add(tempMap);
  1488 + }
  1489 + try {
  1490 + listI.add(tempList.iterator());
  1491 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  1492 + ee.excelReplace(listI, new Object[]{m}, path + "mould/correctForm.xls",
  1493 + path + "export/修正报表" + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls");
  1494 + } catch (Exception e) {
  1495 + // TODO: handle exception
  1496 + e.printStackTrace();
  1497 + }
  1498 + Map<String, Object> map = tempList.get(tempList.size() - 1);
  1499 + System.out.println("tempMap:" + map);
  1500 + }
  1501 +
  1502 + return list;
  1503 + }
  1504 +
  1505 + @Override
  1506 + public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
  1507 + String lpName, String date, String line) {
  1508 + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>();
  1509 + List<ScheduleRealInfo> list = null;
  1510 + list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line);
  1511 + for (int i = 0; i < list.size(); i++) {
  1512 + ScheduleRealInfo s = list.get(i);
  1513 + s.setAdjustExps(i + 1 + "");
  1514 + String remarks = "";
  1515 + if (s.getRemarks() != null) {
  1516 + remarks += s.getRemarks();
  1517 + }
  1518 +
  1519 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  1520 + if (!childTaskPlans.isEmpty()) {
  1521 + s.setFcsjActual("");
  1522 + s.setZdsjActual("");
  1523 + s.setJhlc(0.0);
  1524 + }
  1525 +
  1526 + if (s.isDestroy()) {
  1527 + s.setFcsjActual("");
  1528 + s.setZdsjActual("");
  1529 + s.setJhlc(0.0);
  1530 + remarks += "(烂班)";
  1531 + s.setRemarks(remarks);
  1532 + }
  1533 + listSchedule.add(s);
  1534 + //计算营运里程,空驶里程
  1535 + if (!childTaskPlans.isEmpty()) {
  1536 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1537 + while (it.hasNext()) {
  1538 + ScheduleRealInfo t = new ScheduleRealInfo();
  1539 + ChildTaskPlan childTaskPlan = it.next();
  1540 + if (childTaskPlan.isDestroy()) {
  1541 + t.setFcsjActual("");
  1542 + t.setZdsjActual("");
  1543 + t.setJhlc(0.0);
  1544 + } else {
  1545 + t.setFcsjActual(childTaskPlan.getStartDate());
  1546 + t.setZdsjActual(childTaskPlan.getEndDate());
  1547 + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage())));
  1548 + }
  1549 + t.setQdzName(childTaskPlan.getStartStationName());
  1550 + t.setZdzName(childTaskPlan.getEndStationName());
  1551 + t.setRemarks(childTaskPlan.getRemarks());
  1552 + t.setAdjustExps("子");
  1553 + listSchedule.add(t);
  1554 + }
  1555 + /* String sqlPc = "select * from bsth_c_s_child_task where schedule=" + s.getId() + " order by start_date ";
  1556 + List<ScheduleRealInfo> lists = jdbcTemplate.query(sqlPc,
  1557 + new RowMapper<ScheduleRealInfo>() {
  1558 + @Override
  1559 + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  1560 + ScheduleRealInfo t = new ScheduleRealInfo();
  1561 + if (rs.getInt("destroy") == 0) {
  1562 + t.setFcsjActual(rs.getString("start_date"));
  1563 + t.setZdsjActual(rs.getString("end_date"));
  1564 + t.setJhlc(rs.getDouble("mileage"));
  1565 + } else {
  1566 + t.setFcsjActual("");
  1567 + t.setZdsjActual("");
  1568 + t.setJhlc(0.0);
  1569 + }
  1570 + t.setQdzName(rs.getString("start_station_name"));
  1571 + t.setZdzName(rs.getString("end_station_name"));
  1572 + t.setRemarks(rs.getString("remarks"));
  1573 + t.setAdjustExps("子");
  1574 + return t;
  1575 + }
  1576 + });
  1577 + for (int j = 0; j < lists.size(); j++) {
  1578 + ScheduleRealInfo t = lists.get(j);
  1579 + listSchedule.add(t);
  1580 + }*/
  1581 + }
  1582 + }
  1583 +
  1584 + return listSchedule;
  1585 + }
  1586 +
  1587 + @Override
  1588 + public Map<String, Object> removeChildTask(Long taskId) {
  1589 + Map<String, Object> rs = new HashMap<>();
  1590 + ChildTaskPlan chTask = cTaskPlanRepository.findOne(taskId);
  1591 +
  1592 + ScheduleRealInfo sch = dayOfSchedule.get(chTask.getSchedule().getId());
  1593 + try {
  1594 +
  1595 + sch.getcTasks().remove(chTask);
  1596 + scheduleRealInfoRepository.save(sch);
  1597 + rs.put("status", ResponseCode.SUCCESS);
  1598 + } catch (Exception e) {
  1599 + logger.error("", e);
  1600 + rs.put("status", ResponseCode.ERROR);
  1601 + }
  1602 + return rs;
  1603 + }
  1604 +
  1605 + @Override
  1606 + public List<Map<String, Object>> statisticsDaily(String line, String date,
  1607 + String xlName, String type) {
  1608 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  1609 + if (date.length() == 10)
  1610 + list = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);
  1611 + else if (date.length() == 7)
  1612 + list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date);
  1613 +
  1614 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  1615 + DecimalFormat format = new DecimalFormat("0.00");
  1616 + double jhlc = 0, tempJhlc = 0, childMileage = 0;
  1617 + float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f;
  1618 + //班次
  1619 + int ssbc = 0, ssbc_lz = 0, ssbc_dm = 0, ssbc_gz = 0, ssbc_jf = 0, ssbc_zs = 0, ssbc_qr = 0, ssbc_qc = 0, ssbc_kx = 0, ssbc_qh = 0, ssbc_yw = 0, ssbc_other = 0;
  1620 + int sj_0 = 6 * 60 + 31, sj_1 = 8 * 60 + 30, sj_2 = 16 * 60 + 1, sj_3 = 18 * 60;
  1621 + int jhbc = 0, jhbc_m = 0, jhbc_a = 0;
  1622 + int sjbc = 0, sjbc_m = 0, sjbc_a = 0;
  1623 + int ljbc = 0, ljbc_m = 0, ljbc_a = 0;
  1624 + int fzbc = 0, fzbc_m = 0, fzbc_a = 0;
  1625 + int dtbc = 0, dtbc_m = 0, dtbc_a = 0;
  1626 + int djg = 0, djg_m = 0, djg_a = 0, djg_time = 0;
  1627 +
  1628 + double jhlcZ = 0, tempJhlcZ = 0, childMileageZ = 0;
  1629 + float sjglZ = 0f, ssglZ = 0f, ssgl_lzZ = 0f, ssgl_dmZ = 0f,
  1630 + ssgl_gzZ = 0f, ssgl_jfZ = 0f, ssgl_zsZ = 0f, ssgl_qrZ = 0f, ssgl_qcZ = 0f,
  1631 + ssgl_kxZ = 0f, ssgl_qhZ = 0f, ssgl_ywZ = 0f, ssgl_otherZ = 0f, ljglZ = 0f;
  1632 + //班次
  1633 + int ssbcZ = 0, ssbc_lzZ = 0, ssbc_dmZ = 0, ssbc_gzZ = 0, ssbc_jfZ = 0, ssbc_zsZ = 0, ssbc_qrZ = 0, ssbc_qcZ = 0, ssbc_kxZ = 0, ssbc_qhZ = 0, ssbc_ywZ = 0, ssbc_otherZ = 0;
  1634 + int jhbcZ = 0, jhbc_mZ = 0, jhbc_aZ = 0;
  1635 + int sjbcZ = 0, sjbc_mZ = 0, sjbc_aZ = 0;
  1636 + int ljbcZ = 0, ljbc_mZ = 0, ljbc_aZ = 0;
  1637 + int fzbcZ = 0, fzbc_mZ = 0, fzbc_aZ = 0;
  1638 + int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0;
  1639 + int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0;
  1640 + Map<String, Object> map = null;
  1641 + for (int i = 0; i < list.size(); i++) {
  1642 + ScheduleRealInfo scheduleRealInfo = list.get(i);
  1643 + if (scheduleRealInfo != null) {
  1644 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1645 + //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
  1646 + if (childTaskPlans.isEmpty()) {
  1647 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1648 + //临加公里
  1649 + if (scheduleRealInfo.isSflj()) {
  1650 + ljgl += tempJhlc;
  1651 + ljglZ += tempJhlc;
  1652 + } else {
  1653 + jhlc += tempJhlc;
  1654 + jhlcZ += tempJhlc;
  1655 + }
  1656 + if (scheduleRealInfo.getStatus() == -1) {
  1657 + ssgl += tempJhlc;
  1658 + ssglZ += tempJhlc;
  1659 + ssbc++;
  1660 + ssbcZ++;
  1661 + if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("路阻") != -1) {
  1662 + ssgl_lz += tempJhlc;
  1663 + ssgl_lzZ += tempJhlc;
  1664 + ssbc_lz++;
  1665 + ssbc_lzZ++;
  1666 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("吊慢") != -1) {
  1667 + ssgl_dm += tempJhlc;
  1668 + ssgl_dmZ += tempJhlc;
  1669 + ssbc_dm++;
  1670 + ssbc_dmZ++;
  1671 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("故障") != -1) {
  1672 + ssgl_gz += tempJhlc;
  1673 + ssgl_gzZ += tempJhlc;
  1674 + ssbc_gz++;
  1675 + ssbc_gzZ++;
  1676 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("纠纷") != -1) {
  1677 + ssgl_jf += tempJhlc;
  1678 + ssgl_jfZ += tempJhlc;
  1679 + ssbc_jf++;
  1680 + ssbc_jfZ++;
  1681 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("肇事") != -1) {
  1682 + ssgl_zs += tempJhlc;
  1683 + ssgl_zsZ += tempJhlc;
  1684 + ssbc_zs++;
  1685 + ssbc_zsZ++;
  1686 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("缺人") != -1) {
  1687 + ssgl_qr += tempJhlc;
  1688 + ssgl_qrZ += tempJhlc;
  1689 + ssbc_qr++;
  1690 + ssbc_qrZ++;
  1691 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("缺车") != -1) {
  1692 + ssgl_qc += tempJhlc;
  1693 + ssgl_qcZ += tempJhlc;
  1694 + ssbc_qc++;
  1695 + ssbc_qcZ++;
  1696 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("客稀") != -1) {
  1697 + ssgl_kx += tempJhlc;
  1698 + ssgl_kxZ += tempJhlc;
  1699 + ssbc_kx++;
  1700 + ssbc_kxZ++;
  1701 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("气候") != -1) {
  1702 + ssgl_qh += tempJhlc;
  1703 + ssgl_qhZ += tempJhlc;
  1704 + ssbc_qh++;
  1705 + ssbc_qhZ++;
  1706 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("援外") != -1) {
  1707 + ssgl_yw += tempJhlc;
  1708 + ssgl_ywZ += tempJhlc;
  1709 + ssbc_yw++;
  1710 + ssbc_ywZ++;
  1711 + } else {
  1712 + ssgl_other += tempJhlc;
  1713 + ssgl_otherZ += tempJhlc;
  1714 + ssbc_other++;
  1715 + ssbc_otherZ++;
  1716 + }
  1717 + } else {
  1718 + sjgl += tempJhlc;
  1719 + sjglZ += tempJhlc;
  1720 + }
  1721 + } else {
  1722 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1723 + while (it.hasNext()) {
  1724 + ChildTaskPlan childTaskPlan = it.next();
  1725 + childMileage = childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1726 + jhlc += childMileage;
  1727 + jhlcZ += childMileage;
  1728 + if (childTaskPlan.isDestroy()) {
  1729 + ssgl += childMileage;
  1730 + ssglZ += childMileage;
  1731 + ssbc++;
  1732 + ssbcZ++;
  1733 + if (childTaskPlan.getDestroyReason().equals("路阻")) {
  1734 + ssgl_lz += childTaskPlan.getMileage();
  1735 + ssgl_lzZ += childTaskPlan.getMileage();
  1736 + ssbc_lzZ++;
  1737 + ssbc_lzZ++;
  1738 + } else if (childTaskPlan.getDestroyReason().equals("吊慢")) {
  1739 + ssgl_dm += childTaskPlan.getMileage();
  1740 + ssgl_dmZ += childTaskPlan.getMileage();
  1741 + ssbc_dm++;
  1742 + ssbc_dmZ++;
  1743 + } else if (childTaskPlan.getDestroyReason().equals("故障")) {
  1744 + ssgl_gz += childTaskPlan.getMileage();
  1745 + ssgl_gzZ += childTaskPlan.getMileage();
  1746 + ssbc_gz++;
  1747 + ssbc_gzZ++;
  1748 + } else if (childTaskPlan.getDestroyReason().equals("纠纷")) {
  1749 + ssgl_jf += childTaskPlan.getMileage();
  1750 + ssgl_jfZ += childTaskPlan.getMileage();
  1751 + ssbc_jf++;
  1752 + ssbc_jfZ++;
  1753 + } else if (childTaskPlan.getDestroyReason().equals("肇事")) {
  1754 + ssgl_zs += childTaskPlan.getMileage();
  1755 + ssgl_zsZ += childTaskPlan.getMileage();
  1756 + ssbc_zs++;
  1757 + ssbc_zsZ++;
  1758 + } else if (childTaskPlan.getDestroyReason().equals("缺人")) {
  1759 + ssgl_qr += childTaskPlan.getMileage();
  1760 + ssgl_qrZ += childTaskPlan.getMileage();
  1761 + ssbc_qr++;
  1762 + ssbc_qrZ++;
  1763 + } else if (childTaskPlan.getDestroyReason().equals("缺车")) {
  1764 + ssgl_qc += childTaskPlan.getMileage();
  1765 + ssgl_qcZ += childTaskPlan.getMileage();
  1766 + ssbc_qc++;
  1767 + ssbc_qcZ++;
  1768 + } else if (childTaskPlan.getDestroyReason().equals("客稀")) {
  1769 + ssgl_kx += childTaskPlan.getMileage();
  1770 + ssgl_kxZ += childTaskPlan.getMileage();
  1771 + ssbc_kx++;
  1772 + ssbc_kxZ++;
  1773 + } else if (childTaskPlan.getDestroyReason().equals("气候")) {
  1774 + ssgl_qh += childTaskPlan.getMileage();
  1775 + ssgl_qhZ += childTaskPlan.getMileage();
  1776 + ssbc_qh++;
  1777 + ssbc_qhZ++;
  1778 + } else if (childTaskPlan.getDestroyReason().equals("援外")) {
  1779 + ssgl_yw += childTaskPlan.getMileage();
  1780 + ssgl_ywZ += childTaskPlan.getMileage();
  1781 + ssbc_yw++;
  1782 + ssbc_ywZ++;
  1783 + } else {
  1784 + ssgl_other += childTaskPlan.getMileage();
  1785 + ssgl_otherZ += childTaskPlan.getMileage();
  1786 + ssbc_other++;
  1787 + ssbc_otherZ++;
  1788 + }
  1789 + } else {
  1790 + sjgl += childMileage;
  1791 + sjglZ += childMileage;
  1792 + }
  1793 + }
  1794 + }
  1795 +
  1796 + //班次
  1797 + jhbc++;
  1798 + jhbcZ++;
  1799 + String[] fcsj = scheduleRealInfo.getFcsj().split(":");
  1800 + String[] fcsjActual = (scheduleRealInfo.getFcsjActual() == null ? "0:00" : scheduleRealInfo.getFcsjActual()).split(":");
  1801 + if ((Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) > sj_0 && (Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) < sj_1) {
  1802 + jhbc_m++;
  1803 + jhbc_mZ++;
  1804 + } else if ((Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) > sj_2 && (Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) < sj_3) {
  1805 + jhbc_a++;
  1806 + jhbc_aZ++;
  1807 + }
  1808 + if (scheduleRealInfo.getStatus() != -1) {
  1809 + sjbc++;
  1810 + sjbcZ++;
  1811 + if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_1) {
  1812 + sjbc_m++;
  1813 + sjbc_mZ++;
  1814 + } else if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_3) {
  1815 + sjbc_a++;
  1816 + sjbc_aZ++;
  1817 + }
  1818 + }
  1819 + if (scheduleRealInfo.isSflj()) {
  1820 + ljbc++;
  1821 + ljbcZ++;
  1822 + if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_1) {
  1823 + ljbc_m++;
  1824 + ljbc_mZ++;
  1825 + } else if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_3) {
  1826 + ljbc_a++;
  1827 + ljbc_aZ++;
  1828 + }
  1829 + }
  1830 + if (scheduleRealInfo.getBcType().equals("venting")) {
  1831 + fzbc++;
  1832 + fzbcZ++;
  1833 + if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_1) {
  1834 + fzbc_m++;
  1835 + fzbc_mZ++;
  1836 + } else if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_3) {
  1837 + fzbc_a++;
  1838 + fzbc_aZ++;
  1839 + }
  1840 + }
  1841 +
  1842 + if (i < list.size() - 1) {
  1843 + if (!scheduleRealInfo.getXlBm().equals(list.get(i + 1).getXlBm())) {
  1844 + map = new HashMap<String, Object>();
  1845 + map.put("xlName", scheduleRealInfo.getXlName());
  1846 + map.put("jhlc", format.format(jhlc));
  1847 + map.put("sjgl", format.format(sjgl));
  1848 + map.put("ssgl", format.format(ssgl));
  1849 + map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
  1850 + map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
  1851 + map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz));
  1852 + map.put("ssgl_jf", ssgl_jf == 0 ? 0 : format.format(ssgl_jf));
  1853 + map.put("ssgl_zs", ssgl_zs == 0 ? 0 : format.format(ssgl_zs));
  1854 + map.put("ssgl_qr", ssgl_qr == 0 ? 0 : format.format(ssgl_qr));
  1855 + map.put("ssgl_qc", ssgl_qc == 0 ? 0 : format.format(ssgl_qc));
  1856 + map.put("ssgl_kx", ssgl_kx == 0 ? 0 : format.format(ssgl_kx));
  1857 + map.put("ssgl_qh", ssgl_qh == 0 ? 0 : format.format(ssgl_qh));
  1858 + map.put("ssgl_yw", ssgl_yw == 0 ? 0 : format.format(ssgl_yw));
  1859 + map.put("ssgl_other", ssgl_other == 0 ? 0 : format.format(ssgl_other));
  1860 + map.put("ssbc", ssbc);
  1861 + map.put("ssbc_lz", ssbc_lz);
  1862 + map.put("ssbc_dm", ssbc_dm);
  1863 + map.put("ssbc_gz", ssbc_gz);
  1864 + map.put("ssbc_jf", ssbc_jf);
  1865 + map.put("ssbc_zs", ssbc_zs);
  1866 + map.put("ssbc_qr", ssbc_qr);
  1867 + map.put("ssbc_qc", ssbc_qc);
  1868 + map.put("ssbc_kx", ssbc_kx);
  1869 + map.put("ssbc_qh", ssbc_qh);
  1870 + map.put("ssbc_yw", ssbc_yw);
  1871 + map.put("ssbc_other", ssbc_other);
  1872 + map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl));
  1873 + map.put("jhbc", jhbc);
  1874 + map.put("jhbc_m", jhbc_m);
  1875 + map.put("jhbc_a", jhbc_a);
  1876 + map.put("sjbc", sjbc);
  1877 + map.put("sjbc_m", sjbc_m);
  1878 + map.put("sjbc_a", sjbc_a);
  1879 + map.put("ljbc", ljbc);
  1880 + map.put("ljbc_m", ljbc_m);
  1881 + map.put("ljbc_a", ljbc_a);
  1882 + map.put("fzbc", fzbc);
  1883 + map.put("fzbc_m", fzbc_m);
  1884 + map.put("fzbc_a", fzbc_a);
  1885 + map.put("dtbc", dtbc);
  1886 + map.put("dtbc_m", dtbc_m);
  1887 + map.put("dtbc_a", dtbc_a);
  1888 + map.put("djg", djg);
  1889 + map.put("djg_m", djg_m);
  1890 + map.put("djg_a", djg_a);
  1891 + map.put("djg_time", djg_time);
  1892 + lMap.add(map);
  1893 + jhlc = 0;
  1894 + tempJhlc = 0;
  1895 + childMileage = 0;
  1896 + sjgl = 0f;
  1897 + ssgl = 0f;
  1898 + ssgl_lz = 0f;
  1899 + ssgl_dm = 0f;
  1900 + ssgl_gz = 0f;
  1901 + ssgl_jf = 0f;
  1902 + ssgl_zs = 0f;
  1903 + ssgl_qr = 0f;
  1904 + ssgl_qc = 0f;
  1905 + ssgl_kx = 0f;
  1906 + ssgl_qh = 0f;
  1907 + ssgl_yw = 0f;
  1908 + ssgl_other = 0f;
  1909 + ljgl = 0f;
  1910 + //班次
  1911 + jhbc = 0;
  1912 + jhbc_m = 0;
  1913 + jhbc_a = 0;
  1914 + sjbc = 0;
  1915 + sjbc_m = 0;
  1916 + sjbc_a = 0;
  1917 + ljbc = 0;
  1918 + ljbc_m = 0;
  1919 + ljbc_a = 0;
  1920 + fzbc = 0;
  1921 + fzbc_m = 0;
  1922 + fzbc_a = 0;
  1923 + dtbc = 0;
  1924 + dtbc_m = 0;
  1925 + dtbc_a = 0;
  1926 + djg = 0;
  1927 + djg_m = 0;
  1928 + djg_a = 0;
  1929 + djg_time = 0;
  1930 + }
  1931 + } else {
  1932 + map = new HashMap<String, Object>();
  1933 + map.put("xlName", scheduleRealInfo.getXlName());
  1934 + map.put("jhlc", format.format(jhlc));
  1935 + map.put("sjgl", format.format(sjgl));
  1936 + map.put("ssgl", format.format(ssgl));
  1937 + map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
  1938 + map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
  1939 + map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz));
  1940 + map.put("ssgl_jf", ssgl_jf == 0 ? 0 : format.format(ssgl_jf));
  1941 + map.put("ssgl_zs", ssgl_zs == 0 ? 0 : format.format(ssgl_zs));
  1942 + map.put("ssgl_qr", ssgl_qr == 0 ? 0 : format.format(ssgl_qr));
  1943 + map.put("ssgl_qc", ssgl_qc == 0 ? 0 : format.format(ssgl_qc));
  1944 + map.put("ssgl_kx", ssgl_kx == 0 ? 0 : format.format(ssgl_kx));
  1945 + map.put("ssgl_qh", ssgl_qh == 0 ? 0 : format.format(ssgl_qh));
  1946 + map.put("ssgl_yw", ssgl_yw == 0 ? 0 : format.format(ssgl_yw));
  1947 + map.put("ssgl_other", ssgl_other == 0 ? 0 : format.format(ssgl_other));
  1948 + map.put("ssbc", ssbc);
  1949 + map.put("ssbc_lz", ssbc_lz);
  1950 + map.put("ssbc_dm", ssbc_dm);
  1951 + map.put("ssbc_gz", ssbc_gz);
  1952 + map.put("ssbc_jf", ssbc_jf);
  1953 + map.put("ssbc_zs", ssbc_zs);
  1954 + map.put("ssbc_qr", ssbc_qr);
  1955 + map.put("ssbc_qc", ssbc_qc);
  1956 + map.put("ssbc_kx", ssbc_kx);
  1957 + map.put("ssbc_qh", ssbc_qh);
  1958 + map.put("ssbc_yw", ssbc_yw);
  1959 + map.put("ssbc_other", ssbc_other);
  1960 + map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl));
  1961 + map.put("jhbc", jhbc);
  1962 + map.put("jhbc_m", jhbc_m);
  1963 + map.put("jhbc_a", jhbc_a);
  1964 + map.put("sjbc", sjbc);
  1965 + map.put("sjbc_m", sjbc_m);
  1966 + map.put("sjbc_a", sjbc_a);
  1967 + map.put("ljbc", ljbc);
  1968 + map.put("ljbc_m", ljbc_m);
  1969 + map.put("ljbc_a", ljbc_a);
  1970 + map.put("fzbc", fzbc);
  1971 + map.put("fzbc_m", fzbc_m);
  1972 + map.put("fzbc_a", fzbc_a);
  1973 + map.put("dtbc", dtbc);
  1974 + map.put("dtbc_m", dtbc_m);
  1975 + map.put("dtbc_a", dtbc_a);
  1976 + map.put("djg", djg);
  1977 + map.put("djg_m", djg_m);
  1978 + map.put("djg_a", djg_a);
  1979 + map.put("djg_time", djg_time);
  1980 + lMap.add(map);
  1981 + jhlc = 0;
  1982 + tempJhlc = 0;
  1983 + childMileage = 0;
  1984 + sjgl = 0f;
  1985 + ssgl = 0f;
  1986 + ssgl_lz = 0f;
  1987 + ssgl_dm = 0f;
  1988 + ssgl_gz = 0f;
  1989 + ssgl_jf = 0f;
  1990 + ssgl_zs = 0f;
  1991 + ssgl_qr = 0f;
  1992 + ssgl_qc = 0f;
  1993 + ssgl_kx = 0f;
  1994 + ssgl_qh = 0f;
  1995 + ssgl_yw = 0f;
  1996 + ssgl_other = 0f;
  1997 + ljgl = 0f;
  1998 + //班次
  1999 + jhbc = 0;
  2000 + jhbc_m = 0;
  2001 + jhbc_a = 0;
  2002 + sjbc = 0;
  2003 + sjbc_m = 0;
  2004 + sjbc_a = 0;
  2005 + ljbc = 0;
  2006 + ljbc_m = 0;
  2007 + ljbc_a = 0;
  2008 + fzbc = 0;
  2009 + fzbc_m = 0;
  2010 + fzbc_a = 0;
  2011 + dtbc = 0;
  2012 + dtbc_m = 0;
  2013 + dtbc_a = 0;
  2014 + djg = 0;
  2015 + djg_m = 0;
  2016 + djg_a = 0;
  2017 + djg_time = 0;
  2018 + }
  2019 + }
  2020 + }
  2021 + map = new HashMap<String, Object>();
  2022 + map.put("xlName", "合计");
  2023 + map.put("jhlc", format.format(jhlcZ));
  2024 + map.put("sjgl", format.format(sjglZ));
  2025 + map.put("ssgl", format.format(ssglZ));
  2026 + map.put("ssgl_lz", ssgl_lzZ == 0 ? 0 : format.format(ssgl_lzZ));
  2027 + map.put("ssgl_dm", ssgl_dmZ == 0 ? 0 : format.format(ssgl_dmZ));
  2028 + map.put("ssgl_gz", ssgl_gzZ == 0 ? 0 : format.format(ssgl_gzZ));
  2029 + map.put("ssgl_jf", ssgl_jfZ == 0 ? 0 : format.format(ssgl_jfZ));
  2030 + map.put("ssgl_zs", ssgl_zsZ == 0 ? 0 : format.format(ssgl_zsZ));
  2031 + map.put("ssgl_qr", ssgl_qrZ == 0 ? 0 : format.format(ssgl_qrZ));
  2032 + map.put("ssgl_qc", ssgl_qcZ == 0 ? 0 : format.format(ssgl_qcZ));
  2033 + map.put("ssgl_kx", ssgl_kxZ == 0 ? 0 : format.format(ssgl_kxZ));
  2034 + map.put("ssgl_qh", ssgl_qhZ == 0 ? 0 : format.format(ssgl_qhZ));
  2035 + map.put("ssgl_yw", ssgl_ywZ == 0 ? 0 : format.format(ssgl_ywZ));
  2036 + map.put("ssgl_other", ssgl_otherZ == 0 ? 0 : format.format(ssgl_otherZ));
  2037 + map.put("ssbc", ssbcZ);
  2038 + map.put("ssbc_lz", ssbc_lzZ);
  2039 + map.put("ssbc_dm", ssbc_lzZ);
  2040 + map.put("ssbc_gz", ssbc_gzZ);
  2041 + map.put("ssbc_jf", ssbc_jfZ);
  2042 + map.put("ssbc_zs", ssbc_zsZ);
  2043 + map.put("ssbc_qr", ssbc_qrZ);
  2044 + map.put("ssbc_qc", ssbc_qcZ);
  2045 + map.put("ssbc_kx", ssbc_qcZ);
  2046 + map.put("ssbc_qh", ssbc_qhZ);
  2047 + map.put("ssbc_yw", ssbc_ywZ);
  2048 + map.put("ssbc_other", ssbc_otherZ);
  2049 + map.put("ljgl", ljglZ == 0 ? 0 : format.format(ljglZ));
  2050 + map.put("jhbc", jhbcZ);
  2051 + map.put("jhbc_m", jhbc_mZ);
  2052 + map.put("jhbc_a", jhbc_aZ);
  2053 + map.put("sjbc", sjbcZ);
  2054 + map.put("sjbc_m", sjbc_mZ);
  2055 + map.put("sjbc_a", sjbc_aZ);
  2056 + map.put("ljbc", ljbcZ);
  2057 + map.put("ljbc_m", ljbc_mZ);
  2058 + map.put("ljbc_a", ljbc_aZ);
  2059 + map.put("fzbc", fzbcZ);
  2060 + map.put("fzbc_m", fzbc_mZ);
  2061 + map.put("fzbc_a", fzbc_aZ);
  2062 + map.put("dtbc", dtbcZ);
  2063 + map.put("dtbc_m", dtbc_mZ);
  2064 + map.put("dtbc_a", dtbc_aZ);
  2065 + map.put("djg", djgZ);
  2066 + map.put("djg_m", djg_mZ);
  2067 + map.put("djg_a", djg_aZ);
  2068 + map.put("djg_time", djg_timeZ);
  2069 + lMap.add(map);
  2070 + /* for (int i = 0; i < lMap.size(); i++) {
  2071 + Map<String, Object> m=lMap.get(i);
  2072 +// m.get(""))
  2073 + jhlc += Double.parseDouble(m.get("jhlc").toString());
  2074 + sjgl += Double.parseDouble(m.get("sjgl").toString());
  2075 + ssgl += Double.parseDouble( m.get("ssgl").toString());
  2076 + ssgl_lz += Double.parseDouble( m.get("ssgl_lz").toString());
  2077 + ssgl_dm += Double.parseDouble(m.get("ssgl_dm").toString());
  2078 + ssgl_gz += Double.parseDouble( m.get("ssgl_gz").toString());
  2079 + ssgl_jf += m.get("ssgl_jf", ssgl_jf == 0 ? 0 : format.format(ssgl_jf));
  2080 + m.get("ssgl_zs", ssgl_zs == 0 ? 0 : format.format(ssgl_zs));
  2081 + m.get("ssgl_qr", ssgl_qr == 0 ? 0 : format.format(ssgl_qr));
  2082 + m.get("ssgl_qc", ssgl_qc == 0 ? 0 : format.format(ssgl_qc));
  2083 + m.get("ssgl_kx", ssgl_kx == 0 ? 0 : format.format(ssgl_kx));
  2084 + m.get("ssgl_qh", ssgl_qh == 0 ? 0 : format.format(ssgl_qh));
  2085 + m.get("ssgl_yw", ssgl_yw == 0 ? 0 : format.format(ssgl_yw));
  2086 + m.get("ssgl_other", ssgl_other == 0 ? 0 : format.format(ssgl_other));
  2087 + m.get("ljgl", ljgl == 0 ? 0 : format.format(ljgl));
  2088 + m.get("jhbc", jhbc);
  2089 + m.get("jhbc_m", jhbc_m);
  2090 + m.get("jhbc_a", jhbc_a);
  2091 + m.get("sjbc", sjbc);
  2092 + m.get("sjbc_m", sjbc_m);
  2093 + m.get("sjbc_a", sjbc_a);
  2094 + m.get("ljbc", ljbc);
  2095 + m.get("ljbc_m", ljbc_m);
  2096 + m.get("ljbc_a", ljbc_a);
  2097 + m.get("fzbc", fzbc);
  2098 + m.get("fzbc_m", fzbc_m);
  2099 + m.get("fzbc_a", fzbc_a);
  2100 + m.get("dtbc", dtbc);
  2101 + m.get("dtbc_m", dtbc_m);
  2102 + m.get("dtbc_a", dtbc_a);
  2103 + m.get("djg", djg);
  2104 + m.get("djg_m", djg_m);
  2105 + m.get("djg_a", djg_a);
  2106 + m.get("djg_time", djg_time);
  2107 + }*/
  2108 +
  2109 + if (type != null && type.length() != 0 && type.equals("export")) {
  2110 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  2111 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  2112 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2113 + Map<String, Object> m = new HashMap<String, Object>();
  2114 + ReportUtils ee = new ReportUtils();
1469 try { 2115 try {
1470 - listI.add(tempList.iterator()); 2116 + listI.add(lMap.iterator());
1471 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 2117 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
1472 - ee.excelReplace(listI, new Object[]{m}, path + "mould/correctForm.xls",  
1473 - path + "export/修正报表" + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls"); 2118 + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_.xls",
  2119 + path + "export/统计日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
1474 } catch (Exception e) { 2120 } catch (Exception e) {
1475 // TODO: handle exception 2121 // TODO: handle exception
1476 e.printStackTrace(); 2122 e.printStackTrace();
1477 } 2123 }
1478 - Map<String, Object> map = tempList.get(tempList.size() - 1);  
1479 - System.out.println("tempMap:" + map);  
1480 - }  
1481 -  
1482 - return list;  
1483 - }  
1484 -  
1485 - @Override  
1486 - public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,  
1487 - String lpName, String date, String line) {  
1488 - List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>();  
1489 - List<ScheduleRealInfo> list = null;  
1490 - list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line);  
1491 - for (int i = 0; i < list.size(); i++) {  
1492 - ScheduleRealInfo s = list.get(i);  
1493 - s.setAdjustExps(i + 1 + "");  
1494 - String remarks = "";  
1495 - if (s.getRemarks() != null) {  
1496 - remarks += s.getRemarks();  
1497 - }  
1498 -  
1499 - Set<ChildTaskPlan> childTaskPlans = s.getcTasks();  
1500 - if (!childTaskPlans.isEmpty()) {  
1501 - s.setFcsjActual("");  
1502 - s.setZdsjActual("");  
1503 - }  
1504 -  
1505 - if (s.isDestroy()) {  
1506 - s.setFcsjActual("");  
1507 - s.setZdsjActual("");  
1508 - s.setJhlc(0.0);  
1509 - remarks += "(烂班)";  
1510 - s.setRemarks(remarks);  
1511 - }  
1512 - listSchedule.add(s);  
1513 - //计算营运里程,空驶里程  
1514 - if (!childTaskPlans.isEmpty()) {  
1515 - String sqlPc = "select * from bsth_c_s_child_task where schedule=" + s.getId() + " order by start_date ";  
1516 - List<ScheduleRealInfo> lists = jdbcTemplate.query(sqlPc,  
1517 - new RowMapper<ScheduleRealInfo>() {  
1518 - @Override  
1519 - public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {  
1520 - ScheduleRealInfo t = new ScheduleRealInfo();  
1521 - if (rs.getInt("destroy") == 0) {  
1522 - t.setFcsjActual(rs.getString("start_date"));  
1523 - t.setZdsjActual(rs.getString("end_date"));  
1524 - t.setJhlc(rs.getDouble("mileage"));  
1525 - } else {  
1526 - t.setFcsjActual("");  
1527 - t.setZdsjActual("");  
1528 - t.setJhlc(0.0);  
1529 - }  
1530 - t.setQdzName(rs.getString("start_station_name"));  
1531 - t.setZdzName(rs.getString("end_station_name"));  
1532 - t.setRemarks(rs.getString("remarks"));  
1533 - t.setAdjustExps("子");  
1534 - return t;  
1535 - }  
1536 - });  
1537 - for (int j = 0; j < lists.size(); j++) {  
1538 - ScheduleRealInfo t = lists.get(j);  
1539 - listSchedule.add(t);  
1540 - }  
1541 - }  
1542 } 2124 }
1543 2125
1544 - return listSchedule;  
1545 - }  
1546 -  
1547 - @Override  
1548 - public Map<String, Object> removeChildTask(Long taskId) {  
1549 - Map<String, Object> rs = new HashMap<>();  
1550 - ChildTaskPlan chTask = cTaskPlanRepository.findOne(taskId);  
1551 -  
1552 - ScheduleRealInfo sch = dayOfSchedule.get(chTask.getSchedule().getId());  
1553 - try {  
1554 -  
1555 - sch.getcTasks().remove(chTask);  
1556 - scheduleRealInfoRepository.save(sch);  
1557 - rs.put("status", ResponseCode.SUCCESS);  
1558 - } catch (Exception e) {  
1559 - logger.error("", e);  
1560 - rs.put("status", ResponseCode.ERROR);  
1561 - }  
1562 - return rs; 2126 + return lMap;
1563 } 2127 }
1564 - 2128 +
1565 @Override 2129 @Override
1566 - public List<Map<String, Object>> statisticsDaily(String line, String date, 2130 + public List<Map<String, Object>> statisticsDailyTj(String line, String date,String date2,
1567 String xlName, String type) { 2131 String xlName, String type) {
1568 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); 2132 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
1569 - if (date.length() == 10)  
1570 - list = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);  
1571 - else if (date.length() == 7)  
1572 - list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date); 2133 + list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date,date2);
1573 2134
1574 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); 2135 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
1575 DecimalFormat format = new DecimalFormat("0.00"); 2136 DecimalFormat format = new DecimalFormat("0.00");
@@ -2331,117 +2892,113 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2331,117 +2892,113 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2331 return list; 2892 return list;
2332 } 2893 }
2333 2894
2334 - public List<Map<String, Object>> yesterdayDataList(String line, String date) { 2895 + public List<Map<String, Object>> yesterdayDataList(String line, String date,String gsbm,String fgsbm,String jGh,String nbbm) {
  2896 +// Arith arith=new Arith();
2335 //前一天日期 2897 //前一天日期
2336 // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1)); 2898 // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
2337 // String date = "2016-09-20"; 2899 // String date = "2016-09-20";
2338 - List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date);  
2339 -// List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date); 2900 + System.out.println("shijian1:"+new Date());
  2901 + List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date,gsbm,fgsbm);
  2902 + System.out.println("shijian2:"+new Date());
  2903 + // List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  2904 + List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date,gsbm,fgsbm);
  2905 + System.out.println("shijian3:"+new Date());
2340 for (int x = 0; x < yesterdayDataList.size(); x++) { 2906 for (int x = 0; x < yesterdayDataList.size(); x++) {
2341 String jName = yesterdayDataList.get(x).get("jGh").toString(); 2907 String jName = yesterdayDataList.get(x).get("jGh").toString();
2342 String clZbh = yesterdayDataList.get(x).get("clZbh").toString(); 2908 String clZbh = yesterdayDataList.get(x).get("clZbh").toString();
2343 - List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date); 2909 +
2344 double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0; 2910 double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
2345 - float addMileage = 0l, remMileage = 0l; 2911 + double addMileage = 0, remMileage = 0;
2346 Map<String, Object> map = new HashMap<String, Object>(); 2912 Map<String, Object> map = new HashMap<String, Object>();
2347 boolean fage = true; 2913 boolean fage = true;
  2914 + String company="";
  2915 + String bCompany="";
2348 for (ScheduleRealInfo scheduleRealInfo : lists) { 2916 for (ScheduleRealInfo scheduleRealInfo : lists) {
2349 - if (fage) {  
2350 - //根据线路代码获取公司  
2351 - Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());  
2352 - yesterdayDataList.get(x).put("company", li.getCompany());  
2353 - yesterdayDataList.get(x).put("bCompany", li.getBrancheCompany());  
2354 - fage = false;  
2355 - }  
2356 - if (scheduleRealInfo != null) {  
2357 - //计划里程(主任务过滤掉临加班次),  
2358 - //烂班里程(主任务烂班),  
2359 - //临加里程(主任务临加),  
2360 - //计划班次,烂班班次,增加班次  
2361 - tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();  
2362 - if (scheduleRealInfo.isSflj()) {  
2363 - addMileage += tempJhlc;  
2364 - } else {  
2365 - if (!(scheduleRealInfo.getBcType().equals("in")  
2366 - || scheduleRealInfo.getBcType().equals("out"))) {  
2367 - jhlc += tempJhlc;  
2368 - }  
2369 -  
2370 - if (scheduleRealInfo.getStatus() == -1) {  
2371 - remMileage += tempJhlc;  
2372 - }  
2373 - }  
2374 - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();  
2375 - //计算营运里程,空驶里程  
2376 - if (childTaskPlans.isEmpty()) {  
2377 - if (scheduleRealInfo.getBcType().equals("in") ||  
2378 - scheduleRealInfo.getBcType().equals("out")) {  
2379 - jcclc += tempJhlc;  
2380 - }  
2381 - //主任务 放空班次属于营运  
2382 -// else if(scheduleRealInfo.getBcType().equals("venting")){  
2383 -// ksgl += tempJhlc;  
2384 -// }  
2385 - else {  
2386 - if (scheduleRealInfo.getStatus() != -1) {  
2387 - yygl += tempJhlc;  
2388 - }  
2389 - }  
2390 - } else {  
2391 - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();  
2392 - while (it.hasNext()) {  
2393 - ChildTaskPlan childTaskPlan = it.next();  
2394 - if (childTaskPlan.getMileageType().equals("empty")) {  
2395 - if (childTaskPlan.isDestroy()) {  
2396 - remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();  
2397 - } else {  
2398 - ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();  
2399 - }  
2400 - } else {  
2401 - if (childTaskPlan.isDestroy()) {  
2402 - remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();  
2403 - } else {  
2404 - yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();  
2405 - }  
2406 - }  
2407 - }  
2408 - }  
2409 - } 2917 + if(scheduleRealInfo.getjGh().equals(jName) && scheduleRealInfo.getClZbh().equals(clZbh)){
  2918 + if (fage) {
  2919 + //根据线路代码获取公司
  2920 + company=scheduleRealInfo.getGsBm();
  2921 + bCompany=scheduleRealInfo.getFgsBm();
  2922 + fage = false;
  2923 + }
  2924 + if (scheduleRealInfo != null) {
  2925 + //计划里程(主任务过滤掉临加班次),
  2926 + //烂班里程(主任务烂班),
  2927 + //临加里程(主任务临加),
  2928 + //计划班次,烂班班次,增加班次
  2929 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  2930 + if (scheduleRealInfo.isSflj()) {
  2931 + if(scheduleRealInfo.getStatus() == -1){
  2932 +// addMileage += tempJhlc;
  2933 + addMileage =Arith.add(addMileage, tempJhlc);
  2934 + }
  2935 + } else {
  2936 + if (!(scheduleRealInfo.getBcType().equals("in")
  2937 + || scheduleRealInfo.getBcType().equals("out"))) {
  2938 +// jhlc += tempJhlc;
  2939 + jhlc =Arith.add(jhlc,tempJhlc);
  2940 + }
  2941 +
  2942 + if (scheduleRealInfo.getStatus() == -1) {
  2943 +// remMileage += tempJhlc;
  2944 + remMileage =Arith.add(remMileage,tempJhlc);
  2945 + }
  2946 + }
  2947 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  2948 + //计算营运里程,空驶里程
  2949 + if (childTaskPlans.isEmpty()) {
  2950 + if (scheduleRealInfo.getBcType().equals("in") ||
  2951 + scheduleRealInfo.getBcType().equals("out")) {
  2952 + if (scheduleRealInfo.getStatus() != -1) {
  2953 +// jcclc += tempJhlc;
  2954 + jcclc=Arith.add(jcclc,tempJhlc);
  2955 + }
  2956 + }
  2957 + //主任务 放空班次属于营运
  2958 + // else if(scheduleRealInfo.getBcType().equals("venting")){
  2959 + // ksgl += tempJhlc;
  2960 + // }
  2961 + else {
  2962 + if (scheduleRealInfo.getStatus() != -1) {
  2963 +// yygl += tempJhlc;
  2964 + yygl=Arith.add(yygl,tempJhlc);
  2965 + }
  2966 + }
  2967 + } else {
  2968 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  2969 + while (it.hasNext()) {
  2970 + ChildTaskPlan childTaskPlan = it.next();
  2971 + if (childTaskPlan.getMileageType().equals("empty")) {
  2972 + if (childTaskPlan.isDestroy()) {
  2973 +// remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2974 + remMileage=Arith.add(remMileage,childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage());
  2975 + } else {
  2976 +// ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2977 + ksgl += Arith.add(ksgl,childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage());
  2978 + }
  2979 + } else {
  2980 + if (childTaskPlan.isDestroy()) {
  2981 +// remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2982 + remMileage=Arith.add(remMileage,childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage());
  2983 +
  2984 + } else {
  2985 +// yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2986 + yygl=Arith.add(yygl,childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage());
  2987 +
  2988 + }
  2989 + }
  2990 + }
  2991 + }
  2992 + }
  2993 + }
2410 } 2994 }
  2995 + yesterdayDataList.get(x).put("company", company);
  2996 + yesterdayDataList.get(x).put("bCompany", bCompany);
  2997 + Double zgl=Arith.add(yygl,ksgl);
  2998 + yesterdayDataList.get(x).put("totalKilometers", Arith.add(zgl, jcclc));
2411 2999
2412 - yesterdayDataList.get(x).put("totalKilometers", yygl + ksgl + jcclc);  
2413 -  
2414 - }  
2415 -  
2416 - /* for(ScheduleRealInfo scheduleRealInfo:list){  
2417 - if(scheduleRealInfo != null){  
2418 - for(int i=0;i<yesterdayDataList.size();i++){  
2419 - if(scheduleRealInfo.getXlBm().equals(yesterdayDataList.get(i).get("xlBm")) && scheduleRealInfo.getClZbh().equals(yesterdayDataList.get(i).get("clZbh"))  
2420 - && scheduleRealInfo.getjGh().equals(yesterdayDataList.get(i).get("jGh"))){  
2421 - //根据线路代码获取公司  
2422 - Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());  
2423 - yesterdayDataList.get(i).put("company", li.getCompany());  
2424 - yesterdayDataList.get(i).put("bCompany", li.getBrancheCompany());  
2425 - //计算总公里  
2426 - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();  
2427 - //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班  
2428 - if(childTaskPlans.isEmpty()){  
2429 - if(scheduleRealInfo.getStatus() == 2){  
2430 - yesterdayDataList.get(i).put("totalKilometers", scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc()+(double)(yesterdayDataList.get(i).get("totalKilometers")==null?0.0:yesterdayDataList.get(i).get("totalKilometers")));  
2431 - }  
2432 - }else{  
2433 - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();  
2434 - while(it.hasNext()){  
2435 - ChildTaskPlan childTaskPlan = it.next();  
2436 - if(!childTaskPlan.isDestroy()){  
2437 - yesterdayDataList.get(i).put("totalKilometers", childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage()+(double)(yesterdayDataList.get(i).get("totalKilometers")==null?0.0:yesterdayDataList.get(i).get("totalKilometers")));  
2438 - }  
2439 - }  
2440 - }  
2441 - }  
2442 - }  
2443 - }  
2444 - }*/ 3000 + }
  3001 + System.out.println();
2445 //增加顺序号 3002 //增加顺序号
2446 for (int i = 0; i < yesterdayDataList.size(); i++) { 3003 for (int i = 0; i < yesterdayDataList.size(); i++) {
2447 if (i == 0) { 3004 if (i == 0) {
@@ -3116,7 +3673,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3116,7 +3673,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3116 } 3673 }
3117 3674
3118 if (!c.isDestroy()) { 3675 if (!c.isDestroy()) {
3119 - sjlc += c.getMileage() == null ? 0 : c.getMileage(); 3676 + if(c.getMileageType().equals("service")){
  3677 + sjlc += c.getMileage() == null ? 0 : c.getMileage();
  3678 + }
3120 } 3679 }
3121 3680
3122 } 3681 }
@@ -3143,7 +3702,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3143,7 +3702,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3143 ScheduleRealInfo s = scheduleRealInfoRepository.findOne(id); 3702 ScheduleRealInfo s = scheduleRealInfoRepository.findOne(id);
3144 String xlbm = s.getXlBm(); 3703 String xlbm = s.getXlBm();
3145 String fcrq = s.getScheduleDateStr(); 3704 String fcrq = s.getScheduleDateStr();
3146 - 3705 + //保留两位小数
  3706 + DecimalFormat df = new DecimalFormat("#.00");
3147 List<Ylxxb> listYlxxb = ylxxbRepository.queryListYlxxb(s.getClZbh(), fcrq); 3707 List<Ylxxb> listYlxxb = ylxxbRepository.queryListYlxxb(s.getClZbh(), fcrq);
3148 Double jzl = 0.0; 3708 Double jzl = 0.0;
3149 for (int t = 0; t < listYlxxb.size(); t++) { 3709 for (int t = 0; t < listYlxxb.size(); t++) {
@@ -3162,7 +3722,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3162,7 +3722,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3162 yh += y.getYh(); 3722 yh += y.getYh();
3163 3723
3164 } 3724 }
3165 - map.put("jzl", jzl); 3725 + map.put("jzl", df.format(jzl));
3166 map.put("yh", yh); 3726 map.put("yh", yh);
3167 map.put("ccyl", ccyl); 3727 map.put("ccyl", ccyl);
3168 map.put("jcyl", jcyl); 3728 map.put("jcyl", jcyl);
@@ -3590,17 +4150,21 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3590,17 +4150,21 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3590 } 4150 }
3591 4151
3592 ScheduleRealInfo leftSch, rightSch = null; 4152 ScheduleRealInfo leftSch, rightSch = null;
3593 - boolean changeRealTime = true;  
3594 for (int i = 0; i < largeList.size(); i++) { 4153 for (int i = 0; i < largeList.size(); i++) {
3595 leftSch = largeList.get(i); 4154 leftSch = largeList.get(i);
3596 if (i < smallList.size()) { 4155 if (i < smallList.size()) {
3597 rightSch = smallList.get(i); 4156 rightSch = smallList.get(i);
3598 ts.add(rightSch); 4157 ts.add(rightSch);
3599 - } else  
3600 - changeRealTime = false; 4158 + } else{
  4159 + //不对称时多出来的
  4160 + lpChangeByLeft(leftSch, largeList.get(i - 1), type);
  4161 + ts.add(leftSch);
  4162 + cars.add(leftSch.getClZbh());
  4163 + continue;
  4164 + }
3601 4165
3602 //调换路牌 4166 //调换路牌
3603 - lpChange(leftSch, rightSch, type, changeRealTime); 4167 + lpChange(leftSch, rightSch, type);
3604 ts.add(leftSch); 4168 ts.add(leftSch);
3605 4169
3606 cars.add(leftSch.getClZbh()); 4170 cars.add(leftSch.getClZbh());
@@ -3636,19 +4200,38 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3636,19 +4200,38 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3636 } 4200 }
3637 4201
3638 @Override 4202 @Override
3639 - public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type, boolean changeRealTime) { 4203 + public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type) {
3640 LpData leftData = new LpData(leftSch); 4204 LpData leftData = new LpData(leftSch);
3641 LpData rightData = new LpData(rightSch); 4205 LpData rightData = new LpData(rightSch);
3642 4206
3643 - leftData.appendTo(rightSch, type, changeRealTime);  
3644 - rightData.appendTo(leftSch, type, changeRealTime); 4207 + leftData.appendTo(rightSch, type);
  4208 + rightData.appendTo(leftSch, type);
  4209 +
  4210 + if(type > 0){
  4211 + //更新车辆和班次映射信息
  4212 + dayOfSchedule.removeNbbm2SchMapp(leftSch, leftData.getNbbm());
  4213 + dayOfSchedule.removeNbbm2SchMapp(rightSch, rightData.getNbbm());
3645 4214
3646 - //更新车辆和班次映射信息  
3647 - dayOfSchedule.removeNbbm2SchMapp(leftSch, leftData.getNbbm());  
3648 - dayOfSchedule.removeNbbm2SchMapp(rightSch, rightData.getNbbm()); 4215 + dayOfSchedule.addNbbm2SchMapp(leftSch, rightData.getNbbm());
  4216 + dayOfSchedule.addNbbm2SchMapp(rightSch, leftData.getNbbm());
  4217 + }
  4218 + }
  4219 +
  4220 + /**
  4221 + * 更换左边班次的路牌,右边不变
  4222 + * @param leftSch
  4223 + * @param rightSch
  4224 + * @param type
  4225 + */
  4226 + public void lpChangeByLeft(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type) {
  4227 + LpData rightData = new LpData(rightSch);
3649 4228
3650 - dayOfSchedule.addNbbm2SchMapp(leftSch, rightData.getNbbm());  
3651 - dayOfSchedule.addNbbm2SchMapp(rightSch, leftData.getNbbm()); 4229 + rightData.appendTo(leftSch, type);
  4230 +
  4231 + if(type > 0){
  4232 + //更新车辆和班次映射信息
  4233 + dayOfSchedule.addNbbm2SchMapp(leftSch, rightData.getNbbm());
  4234 + }
3652 } 4235 }
3653 4236
3654 @Override 4237 @Override
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java
@@ -229,22 +229,22 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -229,22 +229,22 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
229 temp.get(key).add(m); 229 temp.get(key).add(m);
230 } 230 }
231 for(String key : temp.keySet()){ 231 for(String key : temp.keySet()){
232 - Map<Integer, List<Map<String, Object>>> tempList = new HashMap<Integer, List<Map<String,Object>>>();  
233 - List<Integer> keyList = new ArrayList<Integer>(); 232 + Map<Long, List<Map<String, Object>>> tempList = new HashMap<Long, List<Map<String,Object>>>();
  233 + List<Long> keyList = new ArrayList<Long>();
234 for(Map<String, Object> m : temp.get(key)){ 234 for(Map<String, Object> m : temp.get(key)){
235 String lp = m.get("lp").toString(); 235 String lp = m.get("lp").toString();
236 String str = ""; 236 String str = "";
237 for(int i = 0; i < lp.length(); i++){ 237 for(int i = 0; i < lp.length(); i++){
238 str += (int)lp.charAt(i); 238 str += (int)lp.charAt(i);
239 } 239 }
240 - int i = Integer.valueOf(str); 240 + Long i = Long.valueOf(str);
241 if(!tempList.containsKey(i)) 241 if(!tempList.containsKey(i))
242 tempList.put(i, new ArrayList<Map<String, Object>>()); 242 tempList.put(i, new ArrayList<Map<String, Object>>());
243 tempList.get(i).add(m); 243 tempList.get(i).add(m);
244 keyList.add(i); 244 keyList.add(i);
245 } 245 }
246 Collections.sort(keyList); 246 Collections.sort(keyList);
247 - for(Integer i : keyList){ 247 + for(Long i : keyList){
248 for(Map<String, Object> m : tempList.get(i)){ 248 for(Map<String, Object> m : tempList.get(i)){
249 resList.add(m); 249 resList.add(m);
250 } 250 }
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
1 package com.bsth.service.schedule.impl; 1 package com.bsth.service.schedule.impl;
2 2
3 -import com.bsth.entity.Business;  
4 import com.bsth.entity.Line; 3 import com.bsth.entity.Line;
5 -import com.bsth.entity.schedule.*; 4 +import com.bsth.entity.schedule.SchedulePlan;
  5 +import com.bsth.entity.schedule.TTInfo;
6 import com.bsth.entity.schedule.rule.ScheduleRule1Flat; 6 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
7 import com.bsth.repository.schedule.SchedulePlanInfoRepository; 7 import com.bsth.repository.schedule.SchedulePlanInfoRepository;
8 import com.bsth.repository.schedule.SchedulePlanRepository; 8 import com.bsth.repository.schedule.SchedulePlanRepository;
9 import com.bsth.service.BusinessService; 9 import com.bsth.service.BusinessService;
10 import com.bsth.service.LineService; 10 import com.bsth.service.LineService;
11 -import com.bsth.service.schedule.SchedulePlanService;  
12 -import com.bsth.service.schedule.TTInfoDetailService;  
13 -import com.bsth.service.schedule.TTInfoService; 11 +import com.bsth.service.schedule.*;
  12 +import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input;
  13 +import com.bsth.service.schedule.rules.plan.PlanResult;
14 import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; 14 import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
15 -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;  
16 import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; 15 import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
17 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; 16 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
18 import com.bsth.service.schedule.rules.strategy.IStrategy; 17 import com.bsth.service.schedule.rules.strategy.IStrategy;
  18 +import com.bsth.service.schedule.rules.ttinfo.LpInfoResults_output;
  19 +import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input;
  20 +import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output;
  21 +import com.bsth.service.schedule.rules.ttinfo.TTInfo_input;
19 import com.bsth.service.schedule.rules.ttinfo2.CalcuParam; 22 import com.bsth.service.schedule.rules.ttinfo2.CalcuParam;
20 import com.bsth.service.schedule.rules.ttinfo2.Result; 23 import com.bsth.service.schedule.rules.ttinfo2.Result;
21 -import com.google.common.collect.Multimap;  
22 -import org.apache.commons.lang3.StringUtils;  
23 import org.joda.time.DateTime; 24 import org.joda.time.DateTime;
24 import org.kie.api.KieBase; 25 import org.kie.api.KieBase;
25 import org.kie.api.runtime.KieSession; 26 import org.kie.api.runtime.KieSession;
@@ -30,6 +31,7 @@ import org.springframework.stereotype.Service; @@ -30,6 +31,7 @@ import org.springframework.stereotype.Service;
30 import org.springframework.transaction.annotation.Isolation; 31 import org.springframework.transaction.annotation.Isolation;
31 import org.springframework.transaction.annotation.Propagation; 32 import org.springframework.transaction.annotation.Propagation;
32 import org.springframework.transaction.annotation.Transactional; 33 import org.springframework.transaction.annotation.Transactional;
  34 +import org.springframework.util.CollectionUtils;
33 35
34 import java.util.*; 36 import java.util.*;
35 37
@@ -54,19 +56,52 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -54,19 +56,52 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
54 private TTInfoDetailService ttInfoDetailService; 56 private TTInfoDetailService ttInfoDetailService;
55 @Autowired 57 @Autowired
56 private BusinessService businessService; 58 private BusinessService businessService;
  59 + @Autowired
  60 + private CarConfigInfoService carConfigInfoService;
  61 + @Autowired
  62 + private EmployeeConfigInfoService employeeConfigInfoService;
57 63
58 /** 日志记录器 */ 64 /** 日志记录器 */
59 private Logger logger = LoggerFactory.getLogger(SchedulePlanServiceImpl.class); 65 private Logger logger = LoggerFactory.getLogger(SchedulePlanServiceImpl.class);
60 66
61 - @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)  
62 - public SchedulePlan save(SchedulePlan schedulePlan) {  
63 - // 1-1、查找线路具体信息 67 + // 查找线路(未撤销),TODO:到时候放入drl中
  68 + private Line getLine(Integer xlId) {
  69 + Map<String, Object> param = new HashMap<>();
  70 + param.put("id_eq", xlId);
  71 + param.put("destroy_eq", 0); // 未撤销
  72 + List<Line> lines = (List<Line>) lineService.list(param);
  73 + if (CollectionUtils.isEmpty(lines)) {
  74 + throw new RuntimeException("线路找不到,可能已经撤销!");
  75 + }
  76 + return lines.get(0);
  77 + }
  78 + // 查找时刻表(未作废),TODO:到时候放入drl中
  79 + private List<TTInfo> getTTInfos(Integer xlId) {
  80 + // 查询参数
  81 + Map<String, Object> param = new HashMap<>();
  82 + param.put("xl.id_eq", xlId); // 线路Id
  83 + param.put("isCancel_eq", false); // 作废的过滤掉
  84 + Iterator<TTInfo> ttInfoIterator = ttInfoService.list(param).iterator();
  85 + if (!ttInfoIterator.hasNext()) {
  86 + throw new RuntimeException("线路id=" + xlId + " 没有时刻表!");
  87 + }
  88 + List<TTInfo> ttInfos = new ArrayList<>();
  89 + while (ttInfoIterator.hasNext()) {
  90 + TTInfo ttInfo = ttInfoIterator.next();
  91 + ttInfos.add(ttInfo);
  92 + }
  93 + return ttInfos;
  94 + }
  95 +
  96 + /**
  97 + * 循环规则输出。
  98 + * @param schedulePlan
  99 + */
  100 + private ScheduleResults_output loopRuleOutput(SchedulePlan schedulePlan) {
  101 + // 获取主线路
64 Line xl = strategy.getLine(schedulePlan.getXl().getId()); 102 Line xl = strategy.getLine(schedulePlan.getXl().getId());
65 - // 1-2、查出指定线路的所有规则  
66 - TTInfo ttInfo = strategy.getTTInfo(xl.getId()).get(0); // 时刻表id  
67 - schedulePlan.setTtInfo(ttInfo); // TODO:关联的时刻表,之后改掉  
68 103
69 - // 2-1、构造drools规则输入数据,输出数据 104 + // 1-1、构造drools规则输入数据,输出数据
70 // 全局计算参数 105 // 全局计算参数
71 ScheduleCalcuParam_input scheduleCalcuParam_input = new ScheduleCalcuParam_input(schedulePlan); 106 ScheduleCalcuParam_input scheduleCalcuParam_input = new ScheduleCalcuParam_input(schedulePlan);
72 // 每个规则对应的输入参数 107 // 每个规则对应的输入参数
@@ -80,7 +115,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -80,7 +115,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
80 // 规则输出数据 115 // 规则输出数据
81 ScheduleResults_output scheduleResults_output = new ScheduleResults_output(); 116 ScheduleResults_output scheduleResults_output = new ScheduleResults_output();
82 117
83 - // 2-2、构造drools session->载入数据->启动规则->计算->销毁session 118 + // 1-2、构造drools session->载入数据->启动规则->计算->销毁session
84 // 创建session,内部配置的是stateful 119 // 创建session,内部配置的是stateful
85 KieSession session = kieBase.newKieSession(); 120 KieSession session = kieBase.newKieSession();
86 // 设置gloable对象,在drl中通过别名使用 121 // 设置gloable对象,在drl中通过别名使用
@@ -98,117 +133,283 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -98,117 +133,283 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
98 // 执行完毕销毁,有日志的也要关闭 133 // 执行完毕销毁,有日志的也要关闭
99 session.dispose(); 134 session.dispose();
100 135
101 - System.out.println(scheduleResults_output.showGuideboardDesc1()); 136 + logger.info("循环规则输出={}", scheduleResults_output.showGuideboardDesc1());
102 137
103 - // 2-3、如果排班的数据之前已经有了,删除之前的数据  
104 - schedulePlanInfoRepository.deleteByXlAndScheduleDateGreaterThanEqualAndScheduleDateLessThanEqual(  
105 - xl.getId(), schedulePlan.getScheduleFromTime(), schedulePlan.getScheduleToTime()  
106 - ); 138 + return scheduleResults_output;
  139 + }
  140 +
  141 + /**
  142 + * 时刻表选择(判定每天使用的时刻表)。
  143 + * @param schedulePlan
  144 + * @return
  145 + */
  146 + private TTInfoResults_output ttInfoOutput(SchedulePlan schedulePlan) {
  147 + // 获取线路的所有未作废的时刻表
  148 + List<TTInfo> ttInfos = getTTInfos(schedulePlan.getXl().getId());
107 149
108 - // 3、根据规则返回,组合最后的输出数据  
109 - // 3-1、根据注入的策略服务,获取原始数据  
110 - Map<Date, Multimap<Long, TTInfoDetail>> gbdTTinfoMaps = strategy.getGuideboardXlTTInfoDetailMaps(  
111 - xl.getId(), schedulePlan.getScheduleFromTime(), schedulePlan.getScheduleToTime());  
112 -  
113 - Map<Long, CarConfigInfo> carConfigMaps = strategy.getCarConfigMaps(xl.getId()); // 车辆配置对应车辆信息  
114 - Map<Long, EmployeeConfigInfo> employeeConfigMaps = strategy.getEmployeeConfigMaps(xl.getId()); // 人员配置对应的人员信息  
115 -  
116 - // 3-2、循环规则输出  
117 - Map<Long, String> ttInfoMap = new HashMap<>(); // 时刻表映射,id和名字  
118 - List<SchedulePlanInfo> schedulePlanInfos = new ArrayList<>();  
119 - for (ScheduleResult_output scheduleResult_output : scheduleResults_output.getResults()) {  
120 - // 车辆配置对应的车辆  
121 - CarConfigInfo configInfo = carConfigMaps.get(Long.valueOf(scheduleResult_output.getCarConfigId()));  
122 - // 人员配置对应的人员,这里需要分班处理的  
123 - List<EmployeeConfigInfo> employeeConfigInfoList = new ArrayList<>();  
124 - String[] eids = scheduleResult_output.getEmployeeConfigId().split("-");  
125 - for (String eid : eids) {  
126 - employeeConfigInfoList.add(employeeConfigMaps.get(Long.valueOf(eid)));  
127 - }  
128 - // 排班明细(这个要迭代的)  
129 - Collection<TTInfoDetail> ttInfoDetails_ = gbdTTinfoMaps.get(scheduleResult_output.getSd().toDate()).get(  
130 - Long.parseLong(scheduleResult_output.getGuideboardId()));  
131 - List<TTInfoDetail> ttInfoDetails = new ArrayList<>(ttInfoDetails_);  
132 -  
133 - // 排序ttInfoDetails  
134 - Collections.sort(ttInfoDetails, new Comparator<TTInfoDetail>() {  
135 - @Override  
136 - public int compare(TTInfoDetail o1, TTInfoDetail o2) {  
137 - return o1.getFcno().compareTo(o2.getFcno());  
138 - }  
139 - });  
140 -  
141 - Boolean isFb = false; // 是否分班  
142 - for (TTInfoDetail ttInfoDetail : ttInfoDetails) {  
143 - if (ttInfoDetail.getIsFB())  
144 - isFb = ttInfoDetail.getIsFB();  
145 -  
146 - SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo(  
147 - xl,  
148 - scheduleResult_output,  
149 - ttInfoDetail,  
150 - isFb,  
151 - configInfo,  
152 - employeeConfigInfoList,  
153 - schedulePlan);  
154 -  
155 - // 获取公司,分公司信息  
156 - String gsbm = xl.getCompany();  
157 - String fgsbm = xl.getBrancheCompany();  
158 - Business gs = null;  
159 - Business fgs = null;  
160 -  
161 - Map<String, Object> param = new HashMap<>();  
162 -  
163 - if (StringUtils.isNotEmpty(gsbm)) {  
164 - param.clear();  
165 - param.put("businessCode_eq", gsbm);  
166 - Iterator<Business> businessIterator = businessService.list(param).iterator();  
167 - if (businessIterator.hasNext()) {  
168 - gs = businessIterator.next();  
169 - }  
170 - }  
171 - if (StringUtils.isNotEmpty(gsbm) && StringUtils.isNotEmpty(fgsbm)) {  
172 - param.clear();;  
173 - param.put("upCode_eq", gsbm);  
174 - param.put("businessCode_eq", fgsbm);  
175 - Iterator<Business> businessIterator = businessService.list(param).iterator();  
176 - if (businessIterator.hasNext()) {  
177 - fgs = businessIterator.next();  
178 - }  
179 - }  
180 -  
181 - if (gs != null) {  
182 - schedulePlanInfo.setGsBm(gs.getBusinessCode());  
183 - schedulePlanInfo.setGsName(gs.getBusinessName());  
184 - }  
185 - if (fgs != null) {  
186 - schedulePlanInfo.setFgsBm(fgs.getBusinessCode());  
187 - schedulePlanInfo.setFgsName(fgs.getBusinessName());  
188 - }  
189 -  
190 - // 操作人,操作时间  
191 - schedulePlanInfo.setCreateBy(schedulePlan.getCreateBy());  
192 - schedulePlanInfo.setCreateDate(schedulePlan.getCreateDate());  
193 - schedulePlanInfo.setUpdateBy(schedulePlan.getUpdateBy());  
194 - schedulePlanInfo.setUpdateDate(schedulePlan.getUpdateDate());  
195 -  
196 - schedulePlanInfos.add(schedulePlanInfo);  
197 - ttInfoMap.put(ttInfoDetail.getTtinfo().getId(), ttInfoDetail.getTtinfo().getName());  
198 -  
199 - } 150 + // 1-1、构造drools规则输入数据,输出数据
  151 + // 全局计算参数
  152 + TTInfoCalcuParam_input ttInfoCalcuParam_input =
  153 + new TTInfoCalcuParam_input(
  154 + new DateTime(schedulePlan.getScheduleFromTime()),
  155 + new DateTime(schedulePlan.getScheduleToTime()),
  156 + String.valueOf(schedulePlan.getXl().getId())
  157 + );
  158 + // 规则输出数据
  159 + TTInfoResults_output ttInfoResults_output = new TTInfoResults_output();
  160 + LpInfoResults_output lpInfoResults_output = new LpInfoResults_output();
  161 +
  162 + // 1-2、构造drools session->载入数据->启动规则->计算->销毁session
  163 + // 创建session,内部配置的是stateful
  164 + KieSession session = kieBase.newKieSession();
  165 +
  166 + // 设置gloable对象,在drl中通过别名使用
  167 + session.setGlobal("results", ttInfoResults_output);
  168 + session.setGlobal("lpInfoResults_output", lpInfoResults_output);
  169 + session.setGlobal("log", logger); // 设置日志
  170 +
  171 + session.setGlobal("tTInfoDetailService", ttInfoDetailService);
  172 +
  173 + // 载入数据
  174 + session.insert(ttInfoCalcuParam_input);
  175 + for (TTInfo ttInfo : ttInfos) {
  176 + TTInfo_input ttInfo_input = new TTInfo_input(ttInfo);
  177 + session.insert(ttInfo_input);
200 } 178 }
201 179
202 - schedulePlan.setTtInfoId(StringUtils.join(ttInfoMap.keySet(), ","));  
203 - schedulePlan.setTtInfoNames(StringUtils.join(ttInfoMap.values(), ",")); 180 + // 执行rule
  181 + session.fireAllRules();
  182 +
  183 + // 执行完毕销毁,有日志的也要关闭
  184 + session.dispose();
204 185
205 - // 3-2、保存生成的排班和明细  
206 - schedulePlan.getSchedulePlanInfoList().addAll(schedulePlanInfos); // 关联的排班明细信息  
207 - super.save(schedulePlan); 186 + return ttInfoResults_output;
  187 +
  188 + }
  189 +
  190 + private PlanResult planResultOutput(
  191 + SchedulePlan schedulePlan,
  192 + ScheduleResults_output scheduleResults_output,
  193 + TTInfoResults_output ttInfoResults_output) {
  194 +
  195 + // 1-1、构造drools规则输入数据,输出数据
  196 + PlanCalcuParam_input planCalcuParam_input = new PlanCalcuParam_input(
  197 + schedulePlan,
  198 + scheduleResults_output,
  199 + ttInfoResults_output
  200 + );
  201 + // 规则输出数据
  202 + PlanResult planResult = new PlanResult();
  203 +
  204 + // 1-2、构造drools session->载入数据->启动规则->计算->销毁session
  205 + // 创建session,内部配置的是stateful
  206 + KieSession session = kieBase.newKieSession();
  207 +
  208 + // 设置gloable对象,在drl中通过别名使用
  209 + session.setGlobal("planResult", planResult);
  210 + session.setGlobal("tTInfoService", ttInfoService);
  211 + session.setGlobal("tTInfoDetailService", ttInfoDetailService);
  212 + session.setGlobal("carConfigInfoService", carConfigInfoService);
  213 + session.setGlobal("employeeConfigInfoService", employeeConfigInfoService);
  214 + session.setGlobal("lineService", lineService);
  215 + session.setGlobal("businessService", businessService);
  216 + session.setGlobal("log", logger); // 设置日志
  217 +
  218 + // 载入数据
  219 + session.insert(planCalcuParam_input);
  220 +
  221 + // 执行rule
  222 + session.fireAllRules();
  223 +
  224 + // 执行完毕销毁,有日志的也要关闭
  225 + session.dispose();
  226 +
  227 + return planResult;
  228 +
  229 + }
  230 +
  231 + @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
  232 + public SchedulePlan save2(SchedulePlan schedulePlan) {
  233 +// // 1、循环规则计算输出
  234 +// ScheduleResults_output scheduleResults_output = loopRuleOutput(schedulePlan);
  235 + // 2、时刻表选择
  236 + TTInfoResults_output ttInfoResults_output = ttInfoOutput(schedulePlan);
  237 +// // 3、计划输出
  238 +// PlanResult planResult = planResultOutput(schedulePlan, scheduleResults_output, ttInfoResults_output);
  239 +//
  240 +// schedulePlan.getSchedulePlanInfoList().addAll(planResult.getSchedulePlanInfos());
  241 +// schedulePlan.setTtInfoId("todo"); // TODO:待修正
  242 +// schedulePlan.setTtInfoNames("todo"); // TODO:待修正
  243 +//
  244 +// super.save(schedulePlan);
208 245
209 return new SchedulePlan(); 246 return new SchedulePlan();
210 } 247 }
211 248
  249 + @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
  250 + public SchedulePlan save(SchedulePlan schedulePlan) {
  251 + // 2-3、如果排班的数据之前已经有了,删除之前的数据
  252 + schedulePlanInfoRepository.deleteByXlAndScheduleDateGreaterThanEqualAndScheduleDateLessThanEqual(
  253 + schedulePlan.getXl().getId(), schedulePlan.getScheduleFromTime(), schedulePlan.getScheduleToTime()
  254 + );
  255 +
  256 + // 测试
  257 + return save2(schedulePlan);
  258 +
  259 +// // 1-1、查找线路具体信息
  260 +// Line xl = strategy.getLine(schedulePlan.getXl().getId());
  261 +// // 1-2、查出指定线路的所有规则
  262 +// TTInfo ttInfo = strategy.getTTInfo(xl.getId()).get(0); // 时刻表id
  263 +// schedulePlan.setTtInfo(ttInfo); // TODO:关联的时刻表,之后改掉
  264 +//
  265 +// // 2-1、构造drools规则输入数据,输出数据
  266 +// // 全局计算参数
  267 +// ScheduleCalcuParam_input scheduleCalcuParam_input = new ScheduleCalcuParam_input(schedulePlan);
  268 +// // 每个规则对应的输入参数
  269 +// List<ScheduleRule_input> scheduleRule_inputs = new ArrayList<>();
  270 +// Iterator<ScheduleRule1Flat> scheduleRule1FlatIterator = strategy.getScheduleRule(xl.getId()).iterator();
  271 +// while (scheduleRule1FlatIterator.hasNext()) {
  272 +// ScheduleRule1Flat scheduleRule1Flat_temp = scheduleRule1FlatIterator.next();
  273 +// ScheduleRule_input scheduleRule_input = new ScheduleRule_input(scheduleRule1Flat_temp);
  274 +// scheduleRule_inputs.add(scheduleRule_input);
  275 +// }
  276 +// // 规则输出数据
  277 +// ScheduleResults_output scheduleResults_output = new ScheduleResults_output();
  278 +//
  279 +// // 2-2、构造drools session->载入数据->启动规则->计算->销毁session
  280 +// // 创建session,内部配置的是stateful
  281 +// KieSession session = kieBase.newKieSession();
  282 +// // 设置gloable对象,在drl中通过别名使用
  283 +// session.setGlobal("scheduleResult", scheduleResults_output);
  284 +// session.setGlobal("log", logger); // 设置日志
  285 +//
  286 +// // 载入数据
  287 +// session.insert(scheduleCalcuParam_input);
  288 +// for (ScheduleRule_input scheduleRule_input : scheduleRule_inputs) {
  289 +// session.insert(scheduleRule_input);
  290 +// }
  291 +// // 执行rule
  292 +// session.fireAllRules();
  293 +//
  294 +// // 执行完毕销毁,有日志的也要关闭
  295 +// session.dispose();
  296 +//
  297 +// System.out.println(scheduleResults_output.showGuideboardDesc1());
  298 +//
  299 +// // 2-3、如果排班的数据之前已经有了,删除之前的数据
  300 +// schedulePlanInfoRepository.deleteByXlAndScheduleDateGreaterThanEqualAndScheduleDateLessThanEqual(
  301 +// xl.getId(), schedulePlan.getScheduleFromTime(), schedulePlan.getScheduleToTime()
  302 +// );
  303 +//
  304 +// // 3、根据规则返回,组合最后的输出数据
  305 +// // 3-1、根据注入的策略服务,获取原始数据
  306 +// Map<Date, Multimap<Long, TTInfoDetail>> gbdTTinfoMaps = strategy.getGuideboardXlTTInfoDetailMaps(
  307 +// xl.getId(), schedulePlan.getScheduleFromTime(), schedulePlan.getScheduleToTime());
  308 +//
  309 +// Map<Long, CarConfigInfo> carConfigMaps = strategy.getCarConfigMaps(xl.getId()); // 车辆配置对应车辆信息
  310 +// Map<Long, EmployeeConfigInfo> employeeConfigMaps = strategy.getEmployeeConfigMaps(xl.getId()); // 人员配置对应的人员信息
  311 +//
  312 +// // 3-2、循环规则输出
  313 +// Map<Long, String> ttInfoMap = new HashMap<>(); // 时刻表映射,id和名字
  314 +// List<SchedulePlanInfo> schedulePlanInfos = new ArrayList<>();
  315 +// for (ScheduleResult_output scheduleResult_output : scheduleResults_output.getResults()) {
  316 +// // 车辆配置对应的车辆
  317 +// CarConfigInfo configInfo = carConfigMaps.get(Long.valueOf(scheduleResult_output.getCarConfigId()));
  318 +// // 人员配置对应的人员,这里需要分班处理的
  319 +// List<EmployeeConfigInfo> employeeConfigInfoList = new ArrayList<>();
  320 +// String[] eids = scheduleResult_output.getEmployeeConfigId().split("-");
  321 +// for (String eid : eids) {
  322 +// employeeConfigInfoList.add(employeeConfigMaps.get(Long.valueOf(eid)));
  323 +// }
  324 +// // 排班明细(这个要迭代的)
  325 +// Collection<TTInfoDetail> ttInfoDetails_ = gbdTTinfoMaps.get(scheduleResult_output.getSd().toDate()).get(
  326 +// Long.parseLong(scheduleResult_output.getGuideboardId()));
  327 +// List<TTInfoDetail> ttInfoDetails = new ArrayList<>(ttInfoDetails_);
  328 +//
  329 +// // 排序ttInfoDetails
  330 +// Collections.sort(ttInfoDetails, new Comparator<TTInfoDetail>() {
  331 +// @Override
  332 +// public int compare(TTInfoDetail o1, TTInfoDetail o2) {
  333 +// return o1.getFcno().compareTo(o2.getFcno());
  334 +// }
  335 +// });
  336 +//
  337 +// Boolean isFb = false; // 是否分班
  338 +// for (int i = 0; i < ttInfoDetails.size(); i++) {
  339 +// TTInfoDetail ttInfoDetail = ttInfoDetails.get(i);
  340 +//
  341 +// if (ttInfoDetail.getIsFB())
  342 +// isFb = ttInfoDetail.getIsFB();
  343 +//
  344 +// SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo(
  345 +// xl,
  346 +// scheduleResult_output,
  347 +// ttInfoDetail,
  348 +// isFb,
  349 +// configInfo,
  350 +// employeeConfigInfoList,
  351 +// schedulePlan,
  352 +// i == 0,
  353 +// i == ttInfoDetails.size() - 1);
  354 +//
  355 +// // 获取公司,分公司信息
  356 +// String gsbm = xl.getCompany();
  357 +// String fgsbm = xl.getBrancheCompany();
  358 +// Business gs = null;
  359 +// Business fgs = null;
  360 +//
  361 +// Map<String, Object> param = new HashMap<>();
  362 +//
  363 +// if (StringUtils.isNotEmpty(gsbm)) {
  364 +// param.clear();
  365 +// param.put("businessCode_eq", gsbm);
  366 +// Iterator<Business> businessIterator = businessService.list(param).iterator();
  367 +// if (businessIterator.hasNext()) {
  368 +// gs = businessIterator.next();
  369 +// }
  370 +// }
  371 +// if (StringUtils.isNotEmpty(gsbm) && StringUtils.isNotEmpty(fgsbm)) {
  372 +// param.clear();;
  373 +// param.put("upCode_eq", gsbm);
  374 +// param.put("businessCode_eq", fgsbm);
  375 +// Iterator<Business> businessIterator = businessService.list(param).iterator();
  376 +// if (businessIterator.hasNext()) {
  377 +// fgs = businessIterator.next();
  378 +// }
  379 +// }
  380 +//
  381 +// if (gs != null) {
  382 +// schedulePlanInfo.setGsBm(gs.getBusinessCode());
  383 +// schedulePlanInfo.setGsName(gs.getBusinessName());
  384 +// }
  385 +// if (fgs != null) {
  386 +// schedulePlanInfo.setFgsBm(fgs.getBusinessCode());
  387 +// schedulePlanInfo.setFgsName(fgs.getBusinessName());
  388 +// }
  389 +//
  390 +// // 操作人,操作时间
  391 +// schedulePlanInfo.setCreateBy(schedulePlan.getCreateBy());
  392 +// schedulePlanInfo.setCreateDate(schedulePlan.getCreateDate());
  393 +// schedulePlanInfo.setUpdateBy(schedulePlan.getUpdateBy());
  394 +// schedulePlanInfo.setUpdateDate(schedulePlan.getUpdateDate());
  395 +//
  396 +// schedulePlanInfos.add(schedulePlanInfo);
  397 +// ttInfoMap.put(ttInfoDetail.getTtinfo().getId(), ttInfoDetail.getTtinfo().getName());
  398 +//
  399 +// }
  400 +//
  401 +// }
  402 +//
  403 +// schedulePlan.setTtInfoId(StringUtils.join(ttInfoMap.keySet(), ","));
  404 +// schedulePlan.setTtInfoNames(StringUtils.join(ttInfoMap.values(), ","));
  405 +//
  406 +// // 3-2、保存生成的排班和明细
  407 +// schedulePlan.getSchedulePlanInfoList().addAll(schedulePlanInfos); // 关联的排班明细信息
  408 +// super.save(schedulePlan);
  409 +//
  410 +// return new SchedulePlan();
  411 + }
  412 +
212 @Override 413 @Override
213 public SchedulePlan findSchedulePlanTommorw() { 414 public SchedulePlan findSchedulePlanTommorw() {
214 DateTime today = new DateTime(new Date()); 415 DateTime today = new DateTime(new Date());
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
@@ -406,6 +406,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -406,6 +406,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
406 p1.put("line.id_eq", lineid); 406 p1.put("line.id_eq", lineid);
407 p1.put("stationName_eq", cell_con.trim()); 407 p1.put("stationName_eq", cell_con.trim());
408 p1.put("stationMark_eq", "B"); 408 p1.put("stationMark_eq", "B");
  409 + p1.put("destroy_eq", 0); // 未撤销
409 410
410 411
411 // TODO:这里要修改(起点站有启用撤销的标志的) 412 // TODO:这里要修改(起点站有启用撤销的标志的)
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
@@ -58,15 +58,18 @@ public class MyDroolsConfiguration { @@ -58,15 +58,18 @@ public class MyDroolsConfiguration {
58 kfs.write("src/main/resources/HelloWorld.drl", kieServices.getResources() 58 kfs.write("src/main/resources/HelloWorld.drl", kieServices.getResources()
59 .newInputStreamResource(this.getClass().getResourceAsStream( 59 .newInputStreamResource(this.getClass().getResourceAsStream(
60 "/rules/HelloWorld.drl"), "UTF-8")); 60 "/rules/HelloWorld.drl"), "UTF-8"));
61 - kfs.write("src/main/resources/shiftloop.drl", kieServices.getResources() 61 + kfs.write("src/main/resources/shiftloop_fb.drl", kieServices.getResources()
62 .newInputStreamResource(this.getClass().getResourceAsStream( 62 .newInputStreamResource(this.getClass().getResourceAsStream(
63 - "/rules/shiftloop.drl"), "UTF-8")); 63 + "/rules/shiftloop_fb.drl"), "UTF-8"));
64 kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources() 64 kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources()
65 .newInputStreamResource(this.getClass().getResourceAsStream( 65 .newInputStreamResource(this.getClass().getResourceAsStream(
66 "/rules/ttinfo.drl"), "UTF-8")); 66 "/rules/ttinfo.drl"), "UTF-8"));
67 kfs.write("src/main/resources/ttinfo2.drl", kieServices.getResources() 67 kfs.write("src/main/resources/ttinfo2.drl", kieServices.getResources()
68 .newInputStreamResource(this.getClass().getResourceAsStream( 68 .newInputStreamResource(this.getClass().getResourceAsStream(
69 "/rules/ttinfo2.drl"), "UTF-8")); 69 "/rules/ttinfo2.drl"), "UTF-8"));
  70 + kfs.write("src/main/resources/plan.drl", kieServices.getResources()
  71 + .newInputStreamResource(this.getClass().getResourceAsStream(
  72 + "/rules/plan.drl"), "UTF-8"));
70 // TODO:还有其他drl.... 73 // TODO:还有其他drl....
71 74
72 // 4、创建KieBuilder,使用KieFileSystem构建 75 // 4、创建KieBuilder,使用KieFileSystem构建
src/main/java/com/bsth/service/schedule/rules/plan/PlanCalcuParam_input.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.plan;
  2 +
  3 +import com.bsth.entity.schedule.SchedulePlan;
  4 +import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
  5 +import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output;
  6 +
  7 +/**
  8 + * 排班规则-规则输入参数。
  9 + */
  10 +public class PlanCalcuParam_input {
  11 + /** 线路Id */
  12 + private String xlId;
  13 + /** 计划主对象 */
  14 + private SchedulePlan schedulePlan;
  15 + /** 循环规则输出 */
  16 + private ScheduleResults_output scheduleResults_output;
  17 + /** 时刻表选择规则输出 */
  18 + private TTInfoResults_output ttInfoResults_output;
  19 +
  20 + public PlanCalcuParam_input() {
  21 + }
  22 + public PlanCalcuParam_input(
  23 + SchedulePlan schedulePlan,
  24 + ScheduleResults_output scheduleResults_output,
  25 + TTInfoResults_output ttInfoResults_output) {
  26 + this.schedulePlan = schedulePlan;
  27 + this.xlId = String.valueOf(schedulePlan.getXl().getId());
  28 + this.scheduleResults_output = scheduleResults_output;
  29 + this.ttInfoResults_output = ttInfoResults_output;
  30 + }
  31 +
  32 + public String getXlId() {
  33 + return xlId;
  34 + }
  35 +
  36 + public void setXlId(String xlId) {
  37 + this.xlId = xlId;
  38 + }
  39 +
  40 + public ScheduleResults_output getScheduleResults_output() {
  41 + return scheduleResults_output;
  42 + }
  43 +
  44 + public void setScheduleResults_output(ScheduleResults_output scheduleResults_output) {
  45 + this.scheduleResults_output = scheduleResults_output;
  46 + }
  47 +
  48 + public TTInfoResults_output getTtInfoResults_output() {
  49 + return ttInfoResults_output;
  50 + }
  51 +
  52 + public void setTtInfoResults_output(TTInfoResults_output ttInfoResults_output) {
  53 + this.ttInfoResults_output = ttInfoResults_output;
  54 + }
  55 +
  56 + public SchedulePlan getSchedulePlan() {
  57 + return schedulePlan;
  58 + }
  59 +
  60 + public void setSchedulePlan(SchedulePlan schedulePlan) {
  61 + this.schedulePlan = schedulePlan;
  62 + }
  63 +}
src/main/java/com/bsth/service/schedule/rules/plan/PlanResult.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.plan;
  2 +
  3 +import com.bsth.entity.schedule.SchedulePlanInfo;
  4 +
  5 +import java.util.ArrayList;
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * 计划输出。
  10 + */
  11 +public class PlanResult {
  12 + private List<SchedulePlanInfo> schedulePlanInfos = new ArrayList<>();
  13 +
  14 + public PlanResult() {
  15 + }
  16 +
  17 + public void add(SchedulePlanInfo schedulePlanInfo) {
  18 + schedulePlanInfos.add(schedulePlanInfo);
  19 + }
  20 +
  21 + public List<SchedulePlanInfo> getSchedulePlanInfos() {
  22 + return schedulePlanInfos;
  23 + }
  24 +
  25 + public void setSchedulePlanInfos(List<SchedulePlanInfo> schedulePlanInfos) {
  26 + this.schedulePlanInfos = schedulePlanInfos;
  27 + }
  28 +}
src/main/java/com/bsth/service/schedule/rules/plan/readme.txt 0 → 100644
  1 +排班计划规则,构造计划明细输出
  2 +1、使用shiftloop.drl和ttinfo.drl的输出作为输入,进行规则计算
  3 +2、计算后输出排班明细列表
0 \ No newline at end of file 4 \ No newline at end of file
src/main/java/com/bsth/service/schedule/rules/shiftloop/GidFbTimeFunction.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.shiftloop;
  2 +
  3 +import com.bsth.entity.schedule.TTInfoDetail;
  4 +import org.joda.time.LocalTime;
  5 +import org.joda.time.format.DateTimeFormat;
  6 +import org.kie.api.runtime.rule.AccumulateFunction;
  7 +
  8 +import java.io.*;
  9 +
  10 +/**
  11 + * 时刻表路牌下的分班时间(起始时间)。
  12 + */
  13 +public class GidFbTimeFunction implements AccumulateFunction {
  14 + @Override
  15 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  16 + }
  17 +
  18 + @Override
  19 + public void writeExternal(ObjectOutput out) throws IOException {
  20 + }
  21 +
  22 + protected static class GidFbTimeData implements Externalizable {
  23 + public LocalTime fbsj;
  24 + public String fbsj_str;
  25 + public TTInfoDetail ttInfoDetail;
  26 +
  27 + public GidFbTimeData() {}
  28 +
  29 + @Override
  30 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  31 + fbsj_str = (String) in.readObject();
  32 + ttInfoDetail = (TTInfoDetail) in.readObject();
  33 + }
  34 +
  35 + @Override
  36 + public void writeExternal(ObjectOutput out) throws IOException {
  37 + out.writeObject(fbsj_str);
  38 + out.writeObject(ttInfoDetail);
  39 + }
  40 + }
  41 +
  42 + @Override
  43 + public Serializable createContext() {
  44 + return new GidFbTimeData();
  45 + }
  46 +
  47 + @Override
  48 + public void init(Serializable context) throws Exception {
  49 + GidFbTimeData gidFbTimeData = (GidFbTimeData) context;
  50 + gidFbTimeData.fbsj_str = "NULL"; // 注意:因为空的时间也要规则执行,所以返回一个表示空的字符串
  51 + }
  52 +
  53 + @Override
  54 + public void accumulate(Serializable context, Object value) {
  55 + GidFbTimeData gidFbTimeData = (GidFbTimeData) context;
  56 + TTInfoDetail ttInfoDetail = (TTInfoDetail) value;
  57 +
  58 + // 1块路牌有多个分班班次,取最早的时间作为起始分班时间
  59 + if (ttInfoDetail.getIsFB()) {
  60 + LocalTime localTime = LocalTime.parse(ttInfoDetail.getFcsj(), DateTimeFormat.forPattern("HH:mm"));
  61 +
  62 + if (gidFbTimeData.fbsj == null) {
  63 + gidFbTimeData.fbsj = localTime;
  64 + gidFbTimeData.fbsj_str = ttInfoDetail.getFcsj();
  65 + } else if (localTime.isBefore(gidFbTimeData.fbsj)) {
  66 + gidFbTimeData.fbsj = localTime;
  67 + gidFbTimeData.fbsj_str = ttInfoDetail.getFcsj();
  68 + }
  69 + }
  70 + }
  71 +
  72 + @Override
  73 + public void reverse(Serializable serializable, Object o) throws Exception {
  74 +
  75 + }
  76 +
  77 + @Override
  78 + public boolean supportsReverse() {
  79 + return false;
  80 + }
  81 +
  82 + @Override
  83 + public Class<?> getResultType() {
  84 + return String.class;
  85 + }
  86 +
  87 + @Override
  88 + public Object getResult(Serializable context) throws Exception {
  89 + GidFbTimeData gidFbTimeData = (GidFbTimeData) context;
  90 + return gidFbTimeData.fbsj_str;
  91 + }
  92 +}
src/main/java/com/bsth/service/schedule/rules/shiftloop/GidsCountFunction.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.shiftloop;
  2 +
  3 +import com.bsth.entity.schedule.TTInfoDetail;
  4 +import org.kie.api.runtime.rule.AccumulateFunction;
  5 +
  6 +import java.io.*;
  7 +import java.util.ArrayList;
  8 +import java.util.HashSet;
  9 +import java.util.List;
  10 +import java.util.Set;
  11 +
  12 +/**
  13 + * 计算时刻表里的路爬列表。
  14 + */
  15 +public class GidsCountFunction implements AccumulateFunction {
  16 + @Override
  17 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  18 + }
  19 +
  20 + @Override
  21 + public void writeExternal(ObjectOutput out) throws IOException {
  22 + }
  23 +
  24 + protected static class GidsCountData implements Externalizable {
  25 + public List<String> gids = new ArrayList<>();
  26 + public Set<String> gids_temp = new HashSet<>();
  27 + public TTInfoDetail ttInfoDetail;
  28 +
  29 + public GidsCountData() {}
  30 +
  31 + @Override
  32 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  33 + gids = (List<String>) in.readObject();
  34 + ttInfoDetail = (TTInfoDetail) in.readObject();
  35 + }
  36 +
  37 + @Override
  38 + public void writeExternal(ObjectOutput out) throws IOException {
  39 + out.writeObject(gids);
  40 + out.writeObject(ttInfoDetail);
  41 + }
  42 + }
  43 +
  44 + @Override
  45 + public Serializable createContext() {
  46 + return new GidsCountData();
  47 + }
  48 +
  49 + @Override
  50 + public void init(Serializable context) throws Exception {
  51 + GidsCountData gidsCountData = (GidsCountData) context;
  52 + gidsCountData.gids = new ArrayList<>();
  53 + gidsCountData.gids_temp = new HashSet<>();
  54 + }
  55 +
  56 + @Override
  57 + public void accumulate(Serializable context, Object value) {
  58 + GidsCountData gidsCountData = (GidsCountData) context;
  59 + TTInfoDetail ttInfoDetail = (TTInfoDetail) value;
  60 +
  61 + if (ttInfoDetail.getLp() != null) {
  62 + gidsCountData.gids_temp.add(
  63 + String.valueOf(ttInfoDetail.getLp().getId()));
  64 + gidsCountData.gids.clear();
  65 + gidsCountData.gids.addAll(gidsCountData.gids_temp);
  66 + }
  67 +
  68 + // TODO:以后还需要按照路牌排序
  69 + }
  70 +
  71 + @Override
  72 + public void reverse(Serializable serializable, Object o) throws Exception {
  73 +
  74 + }
  75 +
  76 + @Override
  77 + public boolean supportsReverse() {
  78 + return false;
  79 + }
  80 +
  81 + @Override
  82 + public Object getResult(Serializable context) throws Exception {
  83 + GidsCountData gidsCountData = (GidsCountData) context;
  84 + return gidsCountData.gids;
  85 +
  86 + }
  87 +
  88 + @Override
  89 + public Class<?> getResultType() {
  90 + return List.class;
  91 + }
  92 +}
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_input.java
@@ -2,6 +2,7 @@ package com.bsth.service.schedule.rules.shiftloop; @@ -2,6 +2,7 @@ package com.bsth.service.schedule.rules.shiftloop;
2 2
3 import com.bsth.entity.schedule.rule.ScheduleRule1Flat; 3 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
4 import com.google.common.base.Splitter; 4 import com.google.common.base.Splitter;
  5 +import org.apache.commons.lang3.StringUtils;
5 import org.joda.time.DateTime; 6 import org.joda.time.DateTime;
6 7
7 import java.util.ArrayList; 8 import java.util.ArrayList;
@@ -29,7 +30,8 @@ public class ScheduleRule_input { @@ -29,7 +30,8 @@ public class ScheduleRule_input {
29 /** 车辆配置id */ 30 /** 车辆配置id */
30 private String carConfigId; 31 private String carConfigId;
31 32
32 - // TODO:车辆翻班暂时不考虑进去 33 + /** 车辆翻版(周一到周日是否启用) */
  34 + private List<Boolean> weekdays = new ArrayList<>();
33 35
34 public ScheduleRule_input() {} 36 public ScheduleRule_input() {}
35 37
@@ -51,6 +53,23 @@ public class ScheduleRule_input { @@ -51,6 +53,23 @@ public class ScheduleRule_input {
51 // 人员初始索引减1 53 // 人员初始索引减1
52 this.startEIndex = scheduleRule1Flat.getRyStart() - 1; 54 this.startEIndex = scheduleRule1Flat.getRyStart() - 1;
53 this.carConfigId = String.valueOf(scheduleRule1Flat.getCarConfigInfo().getId()); 55 this.carConfigId = String.valueOf(scheduleRule1Flat.getCarConfigInfo().getId());
  56 +
  57 + /** 车辆翻版(周一到周日是否启用)*/
  58 + String fbgs_temp = null;
  59 + if (StringUtils.isEmpty(scheduleRule1Flat.getFbgs()) || "1".equals(scheduleRule1Flat.getFbgs())) {
  60 + fbgs_temp = "1,1,1,1,1,1,1";
  61 + } else {
  62 + fbgs_temp = "1,1,1,1,1,0,0";
  63 +// fbgs_temp = scheduleRule1Flat.getFbgs();
  64 + }
  65 + String[] days = fbgs_temp.split(",");
  66 + for (int i = 0; i < 7; i++) {
  67 + if ("1".equals(days[i])) {
  68 + weekdays.add(true);
  69 + } else {
  70 + weekdays.add(false);
  71 + }
  72 + }
54 } 73 }
55 74
56 public String getRuleId() { 75 public String getRuleId() {
@@ -108,4 +127,12 @@ public class ScheduleRule_input { @@ -108,4 +127,12 @@ public class ScheduleRule_input {
108 public void setCarConfigId(String carConfigId) { 127 public void setCarConfigId(String carConfigId) {
109 this.carConfigId = carConfigId; 128 this.carConfigId = carConfigId;
110 } 129 }
  130 +
  131 + public List<Boolean> getWeekdays() {
  132 + return weekdays;
  133 + }
  134 +
  135 + public void setWeekdays(List<Boolean> weekdays) {
  136 + this.weekdays = weekdays;
  137 + }
111 } 138 }
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResult_output.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import org.joda.time.DateTime;
  4 +
  5 +/**
  6 + * 每日路爬信息。
  7 + */
  8 +public class LpInfoResult_output {
  9 + /** 具体日期 */
  10 + private DateTime dateTime;
  11 + /** 路牌Id */
  12 + private String lpId;
  13 + /** 线路Id */
  14 + private String xlId;
  15 + /** 时刻表Id */
  16 + private String ttInfoId;
  17 +
  18 + public DateTime getDateTime() {
  19 + return dateTime;
  20 + }
  21 +
  22 + public void setDateTime(DateTime dateTime) {
  23 + this.dateTime = dateTime;
  24 + }
  25 +
  26 + public String getLpId() {
  27 + return lpId;
  28 + }
  29 +
  30 + public void setLpId(String lpId) {
  31 + this.lpId = lpId;
  32 + }
  33 +
  34 + public String getXlId() {
  35 + return xlId;
  36 + }
  37 +
  38 + public void setXlId(String xlId) {
  39 + this.xlId = xlId;
  40 + }
  41 +
  42 + public String getTtInfoId() {
  43 + return ttInfoId;
  44 + }
  45 +
  46 + public void setTtInfoId(String ttInfoId) {
  47 + this.ttInfoId = ttInfoId;
  48 + }
  49 +}
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResultsFunction.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import com.bsth.entity.schedule.TTInfoDetail;
  4 +import org.kie.api.runtime.rule.AccumulateFunction;
  5 +
  6 +import java.io.*;
  7 +import java.util.ArrayList;
  8 +import java.util.HashMap;
  9 +import java.util.List;
  10 +import java.util.Map;
  11 +
  12 +/**
  13 + * 路牌信息统计函数。
  14 + */
  15 +public class LpInfoResultsFunction implements AccumulateFunction {
  16 + @Override
  17 + public void writeExternal(ObjectOutput out) throws IOException {
  18 +
  19 + }
  20 +
  21 + @Override
  22 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  23 +
  24 + }
  25 +
  26 + protected static class LpInfoResultsData implements Externalizable {
  27 + public List<LpInfoResult_output> lpInfoResult_outputs = new ArrayList<>();
  28 + public Map<Long, LpInfoResult_output> lpInfoResult_outputMap = new HashMap<>();
  29 + public TTInfoDetail ttInfoDetail;
  30 +
  31 + public LpInfoResultsData() {}
  32 +
  33 + @Override
  34 + public void writeExternal(ObjectOutput out) throws IOException {
  35 + out.writeObject(lpInfoResult_outputs);
  36 + out.writeObject(ttInfoDetail);
  37 + }
  38 +
  39 + @Override
  40 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  41 + lpInfoResult_outputs = (List<LpInfoResult_output>) in.readObject();
  42 + ttInfoDetail = (TTInfoDetail) in.readObject();
  43 + }
  44 + }
  45 +
  46 + @Override
  47 + public Serializable createContext() {
  48 + return new LpInfoResultsData();
  49 + }
  50 +
  51 + @Override
  52 + public void init(Serializable context) throws Exception {
  53 + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;
  54 + lpInfoResultsData.lpInfoResult_outputs = new ArrayList<>();
  55 + lpInfoResultsData.lpInfoResult_outputMap = new HashMap<>();
  56 + }
  57 +
  58 + @Override
  59 + public void accumulate(Serializable context, Object value) {
  60 + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;
  61 + TTInfoDetail ttInfoDetail = (TTInfoDetail) value;
  62 +
  63 + if (ttInfoDetail.getLp() != null) {
  64 + if (lpInfoResultsData.lpInfoResult_outputMap.get(ttInfoDetail.getLp().getId()) == null) {
  65 + LpInfoResult_output lpInfoResult_output = new LpInfoResult_output();
  66 + lpInfoResult_output.setLpId(String.valueOf(ttInfoDetail.getLp().getId()));
  67 + lpInfoResult_output.setXlId(String.valueOf(ttInfoDetail.getXl().getId()));
  68 + lpInfoResult_output.setTtInfoId(String.valueOf(ttInfoDetail.getTtinfo().getId()));
  69 +
  70 + lpInfoResultsData.lpInfoResult_outputMap.put(
  71 + ttInfoDetail.getLp().getId(),
  72 + lpInfoResult_output);
  73 + }
  74 + }
  75 +
  76 + lpInfoResultsData.lpInfoResult_outputs.clear();
  77 + lpInfoResultsData.lpInfoResult_outputs.addAll(
  78 + lpInfoResultsData.lpInfoResult_outputMap.values());
  79 + }
  80 +
  81 + @Override
  82 + public boolean supportsReverse() {
  83 + return true;
  84 + }
  85 +
  86 + @Override
  87 + public void reverse(Serializable context, Object value) throws Exception {
  88 + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;
  89 + TTInfoDetail ttInfoDetail = (TTInfoDetail) value;
  90 +
  91 + lpInfoResultsData.lpInfoResult_outputMap.remove(ttInfoDetail.getLp().getId());
  92 +
  93 + lpInfoResultsData.lpInfoResult_outputs.clear();
  94 + lpInfoResultsData.lpInfoResult_outputs.addAll(
  95 + lpInfoResultsData.lpInfoResult_outputMap.values());
  96 +
  97 + }
  98 +
  99 + @Override
  100 + public Object getResult(Serializable context) throws Exception {
  101 + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;
  102 + return lpInfoResultsData.lpInfoResult_outputs;
  103 + }
  104 +
  105 + @Override
  106 + public Class<?> getResultType() {
  107 + return List.class;
  108 + }
  109 +}
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResults_output.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +/**
  7 + * Created by xu on 17/3/21.
  8 + */
  9 +public class LpInfoResults_output {
  10 +
  11 + private List<LpInfoResult_output> lpInfoResult_outputs = new ArrayList<>();
  12 +
  13 + public List<LpInfoResult_output> getLpInfoResult_outputs() {
  14 + return lpInfoResult_outputs;
  15 + }
  16 +
  17 + public void setLpInfoResult_outputs(List<LpInfoResult_output> lpInfoResult_outputs) {
  18 + this.lpInfoResult_outputs = lpInfoResult_outputs;
  19 + }
  20 +}
src/main/java/com/bsth/util/Arith.java 0 → 100644
  1 +package com.bsth.util;
  2 +
  3 +import java.math.BigDecimal;
  4 +
  5 +public class Arith {
  6 + /**
  7 + * 由于Java的简单类型不能够精确的对浮点数进行运算,这个工具类提供精
  8 + * 确的浮点数运算,包括加减乘除和四舍五入。
  9 + */
  10 + //默认除法运算精度
  11 + private static final int DEF_DIV_SCALE = 10;
  12 +
  13 + //这个类不能实例化
  14 + private Arith(){
  15 + }
  16 +
  17 + /**
  18 + * 提供精确的加法运算。
  19 + * @param v1 被加数
  20 + * @param v2 加数
  21 + * @return 两个参数的和
  22 + */
  23 + public static double add(double v1,double v2){
  24 + BigDecimal b1 = new BigDecimal(Double.toString(v1));
  25 + BigDecimal b2 = new BigDecimal(Double.toString(v2));
  26 + return b1.add(b2).doubleValue();
  27 + }
  28 +
  29 + /**
  30 + * 提供精确的减法运算。
  31 + * @param v1 被减数
  32 + * @param v2 减数
  33 + * @return 两个参数的差
  34 + */
  35 + public static double sub(double v1,double v2){
  36 + BigDecimal b1 = new BigDecimal(Double.toString(v1));
  37 + BigDecimal b2 = new BigDecimal(Double.toString(v2));
  38 + return b1.subtract(b2).doubleValue();
  39 + }
  40 +
  41 + /**
  42 + * 提供精确的乘法运算。
  43 + * @param v1 被乘数
  44 + * @param v2 乘数
  45 + * @return 两个参数的积
  46 + */
  47 + public static double mul(double v1,double v2){
  48 + BigDecimal b1 = new BigDecimal(Double.toString(v1));
  49 + BigDecimal b2 = new BigDecimal(Double.toString(v2));
  50 + return b1.multiply(b2).doubleValue();
  51 + }
  52 +
  53 + /**
  54 + * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到
  55 + * 小数点以后10位,以后的数字四舍五入。
  56 + * @param v1 被除数
  57 + * @param v2 除数
  58 + * @return 两个参数的商
  59 + */
  60 + public static double div(double v1,double v2){
  61 + return div(v1,v2,DEF_DIV_SCALE);
  62 + }
  63 +
  64 + /**
  65 + * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指
  66 + * 定精度,以后的数字四舍五入。
  67 + * @param v1 被除数
  68 + * @param v2 除数
  69 + * @param scale 表示表示需要精确到小数点以后几位。
  70 + * @return 两个参数的商
  71 + */
  72 + public static double div(double v1,double v2,int scale){
  73 + if(scale<0){
  74 + throw new IllegalArgumentException(
  75 + "The scale must be a positive integer or zero");
  76 + }
  77 + BigDecimal b1 = new BigDecimal(Double.toString(v1));
  78 + BigDecimal b2 = new BigDecimal(Double.toString(v2));
  79 + return b1.divide(b2,scale,BigDecimal.ROUND_HALF_UP).doubleValue();
  80 + }
  81 +
  82 + /**
  83 + * 提供精确的小数位四舍五入处理。
  84 + * @param v 需要四舍五入的数字
  85 + * @param scale 小数点后保留几位
  86 + * @return 四舍五入后的结果
  87 + */
  88 + public static double round(double v,int scale){
  89 + if(scale<0){
  90 + throw new IllegalArgumentException(
  91 + "The scale must be a positive integer or zero");
  92 + }
  93 + BigDecimal b = new BigDecimal(Double.toString(v));
  94 + BigDecimal one = new BigDecimal("1");
  95 + return b.divide(one,scale,BigDecimal.ROUND_HALF_UP).doubleValue();
  96 + }
  97 +
  98 + /**
  99 + * 提供精确的类型转换(Float)
  100 + * @param v 需要被转换的数字
  101 + * @return 返回转换结果
  102 + */
  103 + public static float convertsToFloat(double v){
  104 + BigDecimal b = new BigDecimal(v);
  105 + return b.floatValue();
  106 + }
  107 +
  108 + /**
  109 + * 提供精确的类型转换(Int)不进行四舍五入
  110 + * @param v 需要被转换的数字
  111 + * @return 返回转换结果
  112 + */
  113 + public static int convertsToInt(double v){
  114 + BigDecimal b = new BigDecimal(v);
  115 + return b.intValue();
  116 + }
  117 +
  118 + /**
  119 + * 提供精确的类型转换(Long)
  120 + * @param v 需要被转换的数字
  121 + * @return 返回转换结果
  122 + */
  123 + public static long convertsToLong(double v){
  124 + BigDecimal b = new BigDecimal(v);
  125 + return b.longValue();
  126 + }
  127 +
  128 + /**
  129 + * 返回两个数中大的一个值
  130 + * @param v1 需要被对比的第一个数
  131 + * @param v2 需要被对比的第二个数
  132 + * @return 返回两个数中大的一个值
  133 + */
  134 + public static double returnMax(double v1,double v2){
  135 + BigDecimal b1 = new BigDecimal(v1);
  136 + BigDecimal b2 = new BigDecimal(v2);
  137 + return b1.max(b2).doubleValue();
  138 + }
  139 +
  140 + /**
  141 + * 返回两个数中小的一个值
  142 + * @param v1 需要被对比的第一个数
  143 + * @param v2 需要被对比的第二个数
  144 + * @return 返回两个数中小的一个值
  145 + */
  146 + public static double returnMin(double v1,double v2){
  147 + BigDecimal b1 = new BigDecimal(v1);
  148 + BigDecimal b2 = new BigDecimal(v2);
  149 + return b1.min(b2).doubleValue();
  150 + }
  151 +
  152 + /**
  153 + * 精确对比两个数字
  154 + * @param v1 需要被对比的第一个数
  155 + * @param v2 需要被对比的第二个数
  156 + * @return 如果两个数一样则返回0,如果第一个数比第二个数大则返回1,反之返回-1
  157 + */
  158 + public static int compareTo(double v1,double v2){
  159 + BigDecimal b1 = new BigDecimal(v1);
  160 + BigDecimal b2 = new BigDecimal(v2);
  161 + return b1.compareTo(b2);
  162 + }
  163 +}
src/main/resources/ms-jdbc.properties
@@ -6,4 +6,5 @@ ms.mysql.password= 123456 @@ -6,4 +6,5 @@ ms.mysql.password= 123456
6 #ms.mysql.driver= com.mysql.jdbc.Driver 6 #ms.mysql.driver= com.mysql.jdbc.Driver
7 #ms.mysql.url= jdbc:mysql://192.168.168.201:3306/ms?useUnicode=true&characterEncoding=utf-8&useSSL=false 7 #ms.mysql.url= jdbc:mysql://192.168.168.201:3306/ms?useUnicode=true&characterEncoding=utf-8&useSSL=false
8 #ms.mysql.username= root 8 #ms.mysql.username= root
9 -#ms.mysql.password= 123456  
10 \ No newline at end of file 9 \ No newline at end of file
  10 +#ms.mysql.password= 123456
  11 +
src/main/resources/rules/functions.drl
1 package com.bsth.service.schedule; 1 package com.bsth.service.schedule;
2 2
3 -import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction ecount;  
4 \ No newline at end of file 3 \ No newline at end of file
  4 +import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction ecount;
  5 +import accumulate com.bsth.service.schedule.rules.shiftloop.GidsCountFunction gidscount;
  6 +import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbTimeFunction gidfbtime;
  7 +import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction lpinforesult;
5 \ No newline at end of file 8 \ No newline at end of file
src/main/resources/rules/plan.drl 0 → 100644
  1 +package com.bsth.service.schedule.plan;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +
  6 +import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input;
  7 +import com.bsth.service.schedule.rules.plan.PlanResult;
  8 +
  9 +import com.bsth.service.schedule.TTInfoService;
  10 +import com.bsth.service.schedule.TTInfoDetailService;
  11 +import com.bsth.service.schedule.CarConfigInfoService;
  12 +import com.bsth.service.schedule.EmployeeConfigInfoService;
  13 +import com.bsth.service.LineService;
  14 +import com.bsth.service.BusinessService;
  15 +
  16 +import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
  17 +import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
  18 +import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output;
  19 +import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output;
  20 +import com.bsth.entity.Line;
  21 +import com.bsth.entity.Business;
  22 +
  23 +import com.bsth.entity.schedule.CarConfigInfo;
  24 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  25 +import com.bsth.entity.schedule.TTInfo;
  26 +import com.bsth.entity.schedule.TTInfoDetail;
  27 +import com.bsth.entity.schedule.SchedulePlanInfo;
  28 +
  29 +import org.slf4j.Logger
  30 +import org.joda.time.format.DateTimeFormat
  31 +import org.apache.commons.lang3.StringUtils;
  32 +
  33 +
  34 +// 全局日志类(一般使用调用此规则的service类)
  35 +global Logger log;
  36 +global TTInfoDetailService tTInfoDetailService;
  37 +global TTInfoService tTInfoService;
  38 +global CarConfigInfoService carConfigInfoService;
  39 +global EmployeeConfigInfoService employeeConfigInfoService;
  40 +global LineService lineService;
  41 +global BusinessService businessService;
  42 +
  43 +// 输出
  44 +global PlanResult planResult;
  45 +
  46 +function Map ttidParams(String ttid) {
  47 + Map param = new HashMap();
  48 + param.put("ttinfo.id_eq", Long.parseLong(ttid));
  49 + return param;
  50 +}
  51 +
  52 +function Map xlidParams(String xlid) {
  53 + Map param = new HashMap();
  54 + param.put("xl.id_eq", Integer.valueOf(xlid));
  55 + return param;
  56 +}
  57 +
  58 +function List ecList(EmployeeConfigInfoService service, String ecids) {
  59 + List<String> ids = Arrays.asList(ecids.split("-"));
  60 + List rst = new ArrayList();
  61 + for (int i = 0; i < ids.size(); i++) {
  62 + rst.add(service.findById(Long.parseLong(ids.get(i))));
  63 + }
  64 + return rst;
  65 +}
  66 +
  67 +function LocalTime fcsjTime(String fcsj) {
  68 + if ("NULL".equals(fcsj)) {
  69 + return null;
  70 + }
  71 + return LocalTime.parse(fcsj, DateTimeFormat.forPattern("HH:mm"));
  72 +}
  73 +
  74 +function String ttInfoId_sd(Map map, DateTime sd) {
  75 + TTInfoResult_output ttInfoResult_output = (TTInfoResult_output) map.get(sd);
  76 + return ttInfoResult_output.getTtInfoId();
  77 +}
  78 +
  79 +/*
  80 + 规则说明:
  81 + 根据循环规则输出,时刻表选择规则输出,组合计算排班明细
  82 +*/
  83 +
  84 +//-------------------- 第一阶段、计算迭代数据 -----------------//
  85 +declare Loop_result
  86 + xlId: String // 线路id
  87 +
  88 + ruleLoop: List // 每天分配的规则 List<ScheduleResult_output>
  89 +
  90 + ttInfoMapLoop_temp: Map // 每天分配的时刻表 Map<DataTime, Collection<TTInfoResult_output>>
  91 + ttInfoMapLoop: Map // 每天分配的时刻表 Map<DataTime, TTInfoResult_output>
  92 + ttInfoMap: Map // 总共用到的时刻表 Map<id, TTInfoResult_output>
  93 +end
  94 +
  95 +rule "calcu_step1_Loop_result"
  96 + salience 1000
  97 + when
  98 + $param: PlanCalcuParam_input($xlId: xlId)
  99 + then
  100 + Loop_result loop_result = new Loop_result();
  101 + loop_result.setXlId($xlId);
  102 + loop_result.setRuleLoop($param.getScheduleResults_output().getResults());
  103 +
  104 + loop_result.setTtInfoMapLoop(new HashMap());
  105 + loop_result.setTtInfoMap(new HashMap());
  106 +
  107 + com.google.common.collect.Multimap ttInfoMap_temp =
  108 + (com.google.common.collect.Multimap)
  109 + $param.getTtInfoResults_output().getResults().get(
  110 + String.valueOf($xlId));
  111 +
  112 + loop_result.setTtInfoMapLoop_temp(ttInfoMap_temp.asMap());
  113 +
  114 + insert(loop_result);
  115 +
  116 + log.info("calcu_step1_Loop_result");
  117 +end
  118 +
  119 +rule "calcu_step2_loop_result"
  120 + salience 1000
  121 + no-loop
  122 + when
  123 + $param: PlanCalcuParam_input($xlId: xlId)
  124 + $lr: Loop_result(xlId == $xlId)
  125 + $sd: DateTime() from $lr.ttInfoMapLoop_temp.keySet()
  126 + then
  127 + // 当天时刻表只取第一张 TODO:
  128 + Collection col = (Collection) $lr.getTtInfoMapLoop_temp().get($sd);
  129 + Iterator iter = col.iterator();
  130 + TTInfoResult_output ttInfo_result = (TTInfoResult_output) iter.next();
  131 + $lr.getTtInfoMapLoop().put($sd, ttInfo_result);
  132 +
  133 + // 总共使用的时刻表
  134 + $lr.getTtInfoMap().put(ttInfo_result.getTtInfoId(), ttInfo_result);
  135 +
  136 + update($lr);
  137 +end
  138 +
  139 +//-------------------- 第二阶段、将时刻表班次,车辆配置,人员配置信息载入 -----------------//
  140 +
  141 +//--------------- 车辆配置信息载入 -------------//
  142 +declare CarConfig_Wrap
  143 + id: String // 车辆配置id(cast字符串-方便比较)
  144 +
  145 + self: CarConfigInfo // 原始数据
  146 +end
  147 +
  148 +rule "calcu_CarConfig_Wrap"
  149 + salience 800
  150 + when
  151 + $lr: Loop_result($xlId: xlId)
  152 + $ccf: CarConfigInfo() from carConfigInfoService.list(xlidParams($xlId))
  153 + then
  154 + CarConfig_Wrap carConfig_wrap = new CarConfig_Wrap();
  155 + carConfig_wrap.setId(String.valueOf($ccf.getId()));
  156 + carConfig_wrap.setSelf($ccf);
  157 +
  158 + insert(carConfig_wrap);
  159 +end
  160 +
  161 +//--------------- 人员配置信息载入 --------------//
  162 +declare EmployeeConfig_Wrap
  163 + id: String // 人员配置id(cast字符串-方便比较)
  164 +
  165 + self: EmployeeConfigInfo // 原始数据
  166 +end
  167 +
  168 +rule "calcu_EmployeeConfig_Wrap"
  169 + salience 800
  170 + when
  171 + $lr: Loop_result($xlId: xlId)
  172 + $eci: EmployeeConfigInfo() from employeeConfigInfoService.list(xlidParams($xlId))
  173 + then
  174 + EmployeeConfig_Wrap employeeConfig_wrap = new EmployeeConfig_Wrap();
  175 + employeeConfig_wrap.setId(String.valueOf($eci.getId()));
  176 + employeeConfig_wrap.setSelf($eci);
  177 +
  178 + insert(employeeConfig_wrap);
  179 +end
  180 +
  181 +//----------------- 时刻表班次信息载入 -----------------//
  182 +declare TTInfo_gid_stat
  183 + xlId: String // 线路id(cast字符串-方便比较)
  184 + ttInfoId: String // 时刻表id(cast字符串-方便比较)
  185 + gid: String // 路牌id(cast字符串-方便比较)
  186 +
  187 + maxFcno: Integer // 最大发车顺序号
  188 +
  189 + fbTime: LocalTime // 分班时间
  190 +end
  191 +
  192 +rule "calcu_TTInfo_gid_stat"
  193 + salience 800
  194 + when
  195 + $lr: Loop_result($xlId: xlId)
  196 + $ttInfoId: String() from $lr.getTtInfoMap().keySet()
  197 + $gids: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailService.list(ttidParams($ttInfoId)), gidscount($ttd))
  198 + $gid: String() from $gids
  199 + $fbtime_str: String() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailService.list(ttidParams($ttInfoId)), gidfbtime($ttd))
  200 + $maxfcno: Double() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailService.list(ttidParams($ttInfoId)), max($ttd.getFcno()))
  201 + then
  202 + TTInfo_gid_stat ttInfo_gid_stat = new TTInfo_gid_stat();
  203 + ttInfo_gid_stat.setXlId($xlId);
  204 + ttInfo_gid_stat.setTtInfoId($ttInfoId);
  205 + ttInfo_gid_stat.setGid($gid);
  206 +
  207 + ttInfo_gid_stat.setMaxFcno($maxfcno.intValue());
  208 + ttInfo_gid_stat.setFbTime(fcsjTime($fbtime_str));
  209 +
  210 + insert(ttInfo_gid_stat);
  211 +
  212 + log.info("xlid={},ttid={},gid={},maxfcno={},fbtime={}",
  213 + $xlId, $ttInfoId, $gid, ttInfo_gid_stat.getMaxFcno(), ttInfo_gid_stat.getFbTime());
  214 +
  215 +end
  216 +
  217 +declare TTInfoDetail_Wrap
  218 + xlId: String // 线路id(cast字符串-方便比较)
  219 + ttInfoId: String // 时刻表id(cast字符串-方便比较)
  220 + gid: String // 路牌id(cast字符串-方便比较)
  221 +
  222 + isFirstBc: Boolean = false // 是否是当前路牌的第一个班次
  223 + isLastBc: Boolean = false // 是否是当前路牌的最后一个班次
  224 + isFb: Boolean = false // 是否分班
  225 +
  226 + self: TTInfoDetail // 原始数据
  227 +end
  228 +
  229 +rule "calcu_TTInfoDetail_Wrap"
  230 + salience 800
  231 + when
  232 + $lr: Loop_result($xlId: xlId)
  233 + $ttInfoId: String() from $lr.getTtInfoMap().keySet()
  234 + $ttInfoStat: TTInfo_gid_stat(
  235 + ttInfoId == $ttInfoId,
  236 + $gid: gid, $maxFcno: maxFcno)
  237 + $ttInfoDetail: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailService.list(ttidParams($ttInfoId))
  238 + then
  239 + TTInfoDetail_Wrap ttInfoDetail_wrap = new TTInfoDetail_Wrap();
  240 + ttInfoDetail_wrap.setXlId($xlId);
  241 + ttInfoDetail_wrap.setTtInfoId($ttInfoId);
  242 + ttInfoDetail_wrap.setGid($gid);
  243 + ttInfoDetail_wrap.setIsFirstBc(1 == $ttInfoDetail.getFcno());
  244 + ttInfoDetail_wrap.setIsLastBc($maxFcno == $ttInfoDetail.getFcno());
  245 +
  246 + LocalTime fcsj = fcsjTime($ttInfoDetail.getFcsj());
  247 + LocalTime fbsj = $ttInfoStat.getFbTime();
  248 + ttInfoDetail_wrap.setIsFb(fbsj == null ? false : (fcsj.isEqual(fbsj) || fcsj.isAfter(fbsj)));
  249 +
  250 + ttInfoDetail_wrap.setSelf($ttInfoDetail);
  251 +
  252 + insert(ttInfoDetail_wrap);
  253 +
  254 + log.info("xlid={},ttid={},gid={},isFirstBc={},isLastBc={},isFb={},fcsj={}",
  255 + $xlId, $ttInfoId, $gid,
  256 + ttInfoDetail_wrap.getIsFirstBc(),
  257 + ttInfoDetail_wrap.getIsLastBc(),
  258 + ttInfoDetail_wrap.getIsFb(),
  259 + $ttInfoDetail.getFcsj());
  260 +end
  261 +
  262 +//-------------------- 第三阶段、合并计算SchedulePlanInfo -----------------//
  263 +
  264 +rule "Calcu_SchedulePlanInfo"
  265 + salience 600
  266 + when
  267 + $param: PlanCalcuParam_input($xlId: xlId)
  268 + $lr: Loop_result(xlId == $xlId)
  269 + $sro: ScheduleResult_output($sd: sd, $gid: guideboardId) from $lr.getRuleLoop()
  270 + CarConfig_Wrap(id == $sro.carConfigId, $cc: self)
  271 + TTInfoDetail_Wrap(
  272 + ttInfoId == ttInfoId_sd($lr.getTtInfoMapLoop(), $sd),
  273 + gid == $gid,
  274 + $isFb: isFb, $isFirstBc: isFirstBc, $isLastBc: isLastBc,
  275 + $ttInfoDetail: self
  276 + )
  277 + then
  278 + // 线路
  279 + Line xl = lineService.findById(Integer.valueOf($xlId));
  280 +
  281 + SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo(
  282 + xl,
  283 + $sro,
  284 + $ttInfoDetail,
  285 + $isFb,
  286 + $cc,
  287 + ecList(employeeConfigInfoService, $sro.getEmployeeConfigId()),
  288 + $param.getSchedulePlan(),
  289 + $isFirstBc,
  290 + $isLastBc
  291 + );
  292 +
  293 + // 获取公司,分公司信息
  294 + String gsbm = xl.getCompany();
  295 + String fgsbm = xl.getBrancheCompany();
  296 + Business gs = null;
  297 + Business fgs = null;
  298 +
  299 + Map<String, Object> param = new HashMap<>();
  300 +
  301 + if (StringUtils.isNotEmpty(gsbm)) {
  302 + param.clear();
  303 + param.put("businessCode_eq", gsbm);
  304 + Iterator<Business> businessIterator = businessService.list(param).iterator();
  305 + if (businessIterator.hasNext()) {
  306 + gs = businessIterator.next();
  307 + }
  308 + }
  309 + if (StringUtils.isNotEmpty(gsbm) && StringUtils.isNotEmpty(fgsbm)) {
  310 + param.clear();;
  311 + param.put("upCode_eq", gsbm);
  312 + param.put("businessCode_eq", fgsbm);
  313 + Iterator<Business> businessIterator = businessService.list(param).iterator();
  314 + if (businessIterator.hasNext()) {
  315 + fgs = businessIterator.next();
  316 + }
  317 + }
  318 +
  319 + if (gs != null) {
  320 + schedulePlanInfo.setGsBm(gs.getBusinessCode());
  321 + schedulePlanInfo.setGsName(gs.getBusinessName());
  322 + }
  323 + if (fgs != null) {
  324 + schedulePlanInfo.setFgsBm(fgs.getBusinessCode());
  325 + schedulePlanInfo.setFgsName(fgs.getBusinessName());
  326 + }
  327 +
  328 + // 操作人,操作时间
  329 + schedulePlanInfo.setCreateBy($param.getSchedulePlan().getCreateBy());
  330 + schedulePlanInfo.setCreateDate($param.getSchedulePlan().getCreateDate());
  331 + schedulePlanInfo.setUpdateBy($param.getSchedulePlan().getUpdateBy());
  332 + schedulePlanInfo.setUpdateDate($param.getSchedulePlan().getUpdateDate());
  333 +
  334 + // TODO:
  335 + $param.getSchedulePlan().setTtInfo($ttInfoDetail.getTtinfo());
  336 +
  337 + // result 输出
  338 + planResult.getSchedulePlanInfos().add(schedulePlanInfo);
  339 +
  340 + log.info("gid={},ecid={},ttInfoId={}",
  341 + $gid, ecList(employeeConfigInfoService, $sro.getEmployeeConfigId()),
  342 + ttInfoId_sd($lr.getTtInfoMapLoop(), $sd));
  343 +
  344 +end
  345 +
  346 +
  347 +
  348 +
  349 +
  350 +
  351 +
  352 +
  353 +
  354 +
  355 +
  356 +
  357 +
  358 +
  359 +
src/main/resources/rules/shiftloop.drl
@@ -145,6 +145,7 @@ rule &quot;calcu_guideboard_index_1&quot; @@ -145,6 +145,7 @@ rule &quot;calcu_guideboard_index_1&quot;
145 insert(cgir); 145 insert(cgir);
146 end 146 end
147 147
  148 +// 启用日期大于开始日期
148 rule "calcu_guideboard_index_2" 149 rule "calcu_guideboard_index_2"
149 when 150 when
150 $calcu_days_result : Calcu_days_result($ruleId: ruleId, $qyrq_days: qyrq_days , qyrq_days > 0) 151 $calcu_days_result : Calcu_days_result($ruleId: ruleId, $qyrq_days: qyrq_days , qyrq_days > 0)
@@ -515,49 +516,70 @@ rule &quot;calcu_loop_guideboard&quot; @@ -515,49 +516,70 @@ rule &quot;calcu_loop_guideboard&quot;
515 when 516 when
516 $loopData : Calcu_guideboard_range_loop_result($ruleId : ruleId, rangeSize >= 0) 517 $loopData : Calcu_guideboard_range_loop_result($ruleId : ruleId, rangeSize >= 0)
517 $indexData : Calcu_guideboard_index_result(ruleId == $ruleId) 518 $indexData : Calcu_guideboard_index_result(ruleId == $ruleId)
518 - $ruleData : ScheduleRule_input(ruleId == $ruleId)  
519 - Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date) 519 + $ruleData : ScheduleRule_input(ruleId == $ruleId, $weekdays: weekdays)
  520 + Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date, $calcu_end_date: calcu_end_date)
520 then 521 then
521 // 循环计算路牌 522 // 循环计算路牌
522 - DateTime initDate = $startDate; 523 + DateTime initDate = $startDate; // 开始时间
  524 + DateTime endDate = $calcu_end_date; // 结束实际
523 List<ScheduleResult_output> scheduleResult_outputs = new ArrayList<ScheduleResult_output>(); 525 List<ScheduleResult_output> scheduleResult_outputs = new ArrayList<ScheduleResult_output>();
524 526
525 // 1、初始组循环 527 // 1、初始组循环
526 - for (int i = $indexData.getCalcu_index(); i<= $loopData.getFirstLoopSize(); i++) {  
527 - ScheduleResult_output ro = new ScheduleResult_output();  
528 - ro.setRuleId($ruleId);  
529 - ro.setSd(initDate);  
530 - ro.setGuideboardId($ruleData.getGuideboardIds().get(i));  
531 - ro.setCarConfigId($ruleData.getCarConfigId());  
532 - scheduleResult_outputs.add(ro);  
533 -  
534 - initDate = initDate.plusDays(1); 528 + int i = $indexData.getCalcu_index();
  529 + while (!initDate.isAfter(endDate) && i <= $loopData.getFirstLoopSize()) {
  530 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  531 + ScheduleResult_output ro = new ScheduleResult_output();
  532 + ro.setRuleId($ruleId);
  533 + ro.setSd(initDate);
  534 + ro.setGuideboardId($ruleData.getGuideboardIds().get(i));
  535 + ro.setCarConfigId($ruleData.getCarConfigId());
  536 + scheduleResult_outputs.add(ro);
  537 +
  538 + initDate = initDate.plusDays(1);
  539 + i++;
  540 + } else {
  541 + initDate = initDate.plusDays(1);
  542 + }
535 } 543 }
536 544
537 // 2、组循环 545 // 2、组循环
538 - for (int j = 0; j < $loopData.getMiddelLoopCount(); j++) {  
539 - for (int k = 0; k < $loopData.getRangeSize(); k++) {  
540 - ScheduleResult_output ro2 = new ScheduleResult_output();  
541 - ro2.setRuleId($ruleId);  
542 - ro2.setSd(initDate);  
543 - ro2.setGuideboardId($ruleData.getGuideboardIds().get(k));  
544 - ro2.setCarConfigId($ruleData.getCarConfigId());  
545 - scheduleResult_outputs.add(ro2);  
546 -  
547 - initDate = initDate.plusDays(1); 546 + int j = 0;
  547 + while (!initDate.isAfter(endDate) && j < $loopData.getMiddelLoopCount()) {
  548 + int k = 0;
  549 + while (!initDate.isAfter(endDate) && k < $loopData.getRangeSize()) {
  550 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  551 + ScheduleResult_output ro2 = new ScheduleResult_output();
  552 + ro2.setRuleId($ruleId);
  553 + ro2.setSd(initDate);
  554 + ro2.setGuideboardId($ruleData.getGuideboardIds().get(k));
  555 + ro2.setCarConfigId($ruleData.getCarConfigId());
  556 + scheduleResult_outputs.add(ro2);
  557 +
  558 + initDate = initDate.plusDays(1);
  559 + k++;
  560 + } else {
  561 + initDate = initDate.plusDays(1);
  562 + }
548 } 563 }
  564 + j++;
549 } 565 }
550 566
551 // 3、余下组循环 567 // 3、余下组循环
552 - for (int l = 0; l < $loopData.getLastLoopSize(); l++) {  
553 - ScheduleResult_output ro3 = new ScheduleResult_output();  
554 - ro3.setRuleId($ruleId);  
555 - ro3.setSd(initDate);  
556 - ro3.setGuideboardId($ruleData.getGuideboardIds().get(l));  
557 - ro3.setCarConfigId($ruleData.getCarConfigId());  
558 - scheduleResult_outputs.add(ro3);  
559 -  
560 - initDate = initDate.plusDays(1); 568 + int l = 0;
  569 + while (!initDate.isAfter(endDate) && l < $loopData.getLastLoopSize()) {
  570 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  571 + ScheduleResult_output ro3 = new ScheduleResult_output();
  572 + ro3.setRuleId($ruleId);
  573 + ro3.setSd(initDate);
  574 + ro3.setGuideboardId($ruleData.getGuideboardIds().get(l));
  575 + ro3.setCarConfigId($ruleData.getCarConfigId());
  576 + scheduleResult_outputs.add(ro3);
  577 +
  578 + initDate = initDate.plusDays(1);
  579 + l++;
  580 + } else {
  581 + initDate = initDate.plusDays(1);
  582 + }
561 } 583 }
562 584
563 Calcu_loop_guideboard_result clgr = new Calcu_loop_guideboard_result(); 585 Calcu_loop_guideboard_result clgr = new Calcu_loop_guideboard_result();
@@ -579,49 +601,70 @@ rule &quot;calcu_loop_employee&quot; @@ -579,49 +601,70 @@ rule &quot;calcu_loop_employee&quot;
579 when 601 when
580 $loopData : Calcu_employee_range_loop_result($ruleId : ruleId, rangeSize >= 0) 602 $loopData : Calcu_employee_range_loop_result($ruleId : ruleId, rangeSize >= 0)
581 $indexData : Calcu_employee_index_result(ruleId == $ruleId) 603 $indexData : Calcu_employee_index_result(ruleId == $ruleId)
582 - $ruleData : ScheduleRule_input(ruleId == $ruleId)  
583 - Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date) 604 + $ruleData : ScheduleRule_input(ruleId == $ruleId, $weekdays: weekdays)
  605 + Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date, $calcu_end_date: calcu_end_date)
584 then 606 then
585 // 循环计算路牌 607 // 循环计算路牌
586 - DateTime initDate = $startDate; 608 + DateTime initDate = $startDate; // 开始时间
  609 + DateTime endDate = $calcu_end_date; // 结束实际
587 List<ScheduleResult_output> scheduleResult_outputs = new ArrayList<ScheduleResult_output>(); 610 List<ScheduleResult_output> scheduleResult_outputs = new ArrayList<ScheduleResult_output>();
588 611
589 // 1、初始组循环 612 // 1、初始组循环
590 - for (int i = $indexData.getCalcu_index(); i<= $loopData.getFirstLoopSize(); i++) {  
591 - ScheduleResult_output ro = new ScheduleResult_output();  
592 - ro.setRuleId($ruleId);  
593 - ro.setSd(initDate);  
594 - ro.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(i));  
595 - ro.setCarConfigId($ruleData.getCarConfigId());  
596 - scheduleResult_outputs.add(ro);  
597 -  
598 - initDate = initDate.plusDays(1); 613 + int i = $indexData.getCalcu_index();
  614 + while (!initDate.isAfter(endDate) && i<= $loopData.getFirstLoopSize()) {
  615 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  616 + ScheduleResult_output ro = new ScheduleResult_output();
  617 + ro.setRuleId($ruleId);
  618 + ro.setSd(initDate);
  619 + ro.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(i));
  620 + ro.setCarConfigId($ruleData.getCarConfigId());
  621 + scheduleResult_outputs.add(ro);
  622 +
  623 + initDate = initDate.plusDays(1);
  624 + i++;
  625 + } else {
  626 + initDate = initDate.plusDays(1);
  627 + }
599 } 628 }
600 629
601 // 2、组循环 630 // 2、组循环
602 - for (int j = 0; j < $loopData.getMiddelLoopCount(); j++) {  
603 - for (int k = 0; k < $loopData.getRangeSize(); k++) {  
604 - ScheduleResult_output ro2 = new ScheduleResult_output();  
605 - ro2.setRuleId($ruleId);  
606 - ro2.setSd(initDate);  
607 - ro2.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(k));  
608 - ro2.setCarConfigId($ruleData.getCarConfigId());  
609 - scheduleResult_outputs.add(ro2);  
610 -  
611 - initDate = initDate.plusDays(1); 631 + int j = 0;
  632 + while (!initDate.isAfter(endDate) && j < $loopData.getMiddelLoopCount()) {
  633 + int k = 0;
  634 + while (!initDate.isAfter(endDate) && k < $loopData.getRangeSize()) {
  635 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  636 + ScheduleResult_output ro2 = new ScheduleResult_output();
  637 + ro2.setRuleId($ruleId);
  638 + ro2.setSd(initDate);
  639 + ro2.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(k));
  640 + ro2.setCarConfigId($ruleData.getCarConfigId());
  641 + scheduleResult_outputs.add(ro2);
  642 +
  643 + initDate = initDate.plusDays(1);
  644 + k++;
  645 + } else {
  646 + initDate = initDate.plusDays(1);
  647 + }
612 } 648 }
  649 + j++;
613 } 650 }
614 651
615 // 3、余下组循环 652 // 3、余下组循环
616 - for (int l = 0; l < $loopData.getLastLoopSize(); l++) {  
617 - ScheduleResult_output ro3 = new ScheduleResult_output();  
618 - ro3.setRuleId($ruleId);  
619 - ro3.setSd(initDate);  
620 - ro3.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(l));  
621 - ro3.setCarConfigId($ruleData.getCarConfigId());  
622 - scheduleResult_outputs.add(ro3);  
623 -  
624 - initDate = initDate.plusDays(1); 653 + int l = 0;
  654 + while (!initDate.isAfter(endDate) && l < $loopData.getLastLoopSize()) {
  655 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  656 + ScheduleResult_output ro3 = new ScheduleResult_output();
  657 + ro3.setRuleId($ruleId);
  658 + ro3.setSd(initDate);
  659 + ro3.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(l));
  660 + ro3.setCarConfigId($ruleData.getCarConfigId());
  661 + scheduleResult_outputs.add(ro3);
  662 +
  663 + initDate = initDate.plusDays(1);
  664 + l++;
  665 + } else {
  666 + initDate = initDate.plusDays(1);
  667 + }
625 } 668 }
626 669
627 Calcu_loop_employee_result clgr = new Calcu_loop_employee_result(); 670 Calcu_loop_employee_result clgr = new Calcu_loop_employee_result();
src/main/resources/rules/shiftloop_fb.drl 0 → 100644
  1 +package com.bsth.service.schedule.shiftloop;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +
  6 +import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
  7 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
  8 +import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
  9 +import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
  10 +
  11 +import org.slf4j.Logger;
  12 +
  13 +global Logger log;
  14 +
  15 +/*
  16 + 存在(翻班格式)
  17 +*/
  18 +
  19 +//------------------------- 第一阶段、计算规则准备数据(天数) ----------------------------//
  20 +
  21 +declare Calcu_days_result
  22 + ruleId : String // 规则Id
  23 + qyrq_days : Integer // 开始日期离启用日期的天数
  24 + sdays : Integer // 总共需要排班的天数
  25 + calcu_start_date : DateTime // 开始计算日期
  26 + calcu_end_date : DateTime // 结束计算日期
  27 +end
  28 +
  29 +/*
  30 + 计算启用日期,开始计算日期,结束计算日期,相差天数
  31 + 1、规则启用日期小于开始计算日期
  32 + 2、规则启用日期大于等于开始日期,小于等于结束日期
  33 +*/
  34 +rule "calcu_days_1"
  35 + salience 100
  36 + when
  37 + ScheduleCalcuParam_input(
  38 + fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
  39 + $fromDate : fromDate,
  40 + $toDate : toDate
  41 + )
  42 + ScheduleRule_input($ruleId : ruleId, $qyrq : qyrq)
  43 + eval($qyrq.isBefore($fromDate))
  44 + then
  45 + // 构造Calcu_days_result对象,进行下一阶段计算
  46 + Calcu_days_result cdr = new Calcu_days_result();
  47 + cdr.setRuleId($ruleId);
  48 + Period p1 = new Period($qyrq, $fromDate, PeriodType.days());
  49 + cdr.setQyrq_days(p1.getDays());
  50 + Period p2 = new Period($fromDate, $toDate, PeriodType.days());
  51 + cdr.setSdays(p2.getDays() + 1);
  52 + cdr.setCalcu_start_date($fromDate);
  53 + cdr.setCalcu_end_date($toDate);
  54 +
  55 + log.info("开始日期离启用日期的天数 qyrq_days={}", p1.getDays());
  56 + log.info("总共需要排班的天数 sdays={}", (p2.getDays() + 1));
  57 +
  58 + insert(cdr); // 插入fact数据,进入下一个阶段
  59 +end
  60 +
  61 +rule "calcu_days_2"
  62 + salience 100
  63 + when
  64 + ScheduleCalcuParam_input(
  65 + fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
  66 + $fromDate : fromDate,
  67 + $toDate : toDate
  68 + )
  69 + ScheduleRule_input($ruleId : ruleId, $qyrq : qyrq)
  70 + eval((!$qyrq.isBefore($fromDate)) && (!$qyrq.isAfter($toDate)))
  71 + then
  72 + // 构造Calcu_days_result对象,进行下一阶段计算
  73 + Calcu_days_result cdr = new Calcu_days_result();
  74 + cdr.setRuleId($ruleId);
  75 + cdr.setQyrq_days(0);
  76 + Period p2 = new Period($qyrq, $toDate, PeriodType.days());
  77 + cdr.setSdays(Integer.valueOf(p2.getDays() + 1));
  78 + cdr.setCalcu_start_date($qyrq);
  79 + cdr.setCalcu_end_date($toDate);
  80 +
  81 + log.info("开始日期离启用日期的天数 qyrq_days=0");
  82 + log.info("总共需要排班的天数 sdays={}", (p2.getDays() + 1));
  83 +
  84 + insert(cdr); // 插入fact数据,进入下一个阶段
  85 +end
  86 +
  87 +//------------------------- 第二阶段、计算规则准备数据2(起始索引) ----------------------------//
  88 +
  89 +//----------------------- 路牌范围循环计算 ------------------------//
  90 +
  91 +declare Calcu_guideboard_index_result
  92 + ruleId : String // 规则Id
  93 + calcu_index : Integer // 计算之后的起始索引
  94 +end
  95 +
  96 +// 启用日期等于开始日期
  97 +rule "calcu_guideboard_index_qyrq_eq_startrq"
  98 + when
  99 + $calcu_days_result : Calcu_days_result(
  100 + qyrq_days == 0,
  101 + $ruleId: ruleId
  102 + )
  103 + $scheduleRule_input : ScheduleRule_input(
  104 + ruleId == $ruleId,
  105 + $oindex : startGbdIndex
  106 + )
  107 + then
  108 + Calcu_guideboard_index_result cgir = new Calcu_guideboard_index_result();
  109 + cgir.setRuleId($ruleId);
  110 + cgir.setCalcu_index($oindex);
  111 +
  112 + log.info("calcu_guideboard_index_qyrq_eq_startrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());
  113 +
  114 + insert(cgir);
  115 +end
  116 +
  117 +// 开始日期大于启用日期
  118 +rule "calcu_guideboard_index_startrq_gt_qyrq"
  119 + when
  120 + $calcu_days_result : Calcu_days_result(
  121 + qyrq_days > 0,
  122 + $ruleId: ruleId, $qyrq_days: qyrq_days,
  123 + $calcu_start_date: calcu_start_date
  124 + )
  125 + $scheduleRule_input : ScheduleRule_input(
  126 + ruleId == $ruleId,
  127 + $qyrq: qyrq,
  128 + $rangesize : guideboardIds.size(),
  129 + $oindex : startGbdIndex,
  130 + $weekdays: weekdays
  131 + )
  132 + then
  133 + // 开始时间
  134 + DateTime initDate = $qyrq;
  135 + int index = $oindex;
  136 + int resultIndex = index;
  137 +
  138 + while (!initDate.isAfter($calcu_start_date)) {
  139 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  140 + resultIndex = index;
  141 + index = (index + 1) % $rangesize;
  142 + }
  143 + initDate = initDate.plusDays(1);
  144 + }
  145 +
  146 + Calcu_guideboard_index_result cgir = new Calcu_guideboard_index_result();
  147 + cgir.setRuleId($ruleId);
  148 + cgir.setCalcu_index(resultIndex);
  149 +
  150 + log.info("calcu_guideboard_index_startrq_gt_qyrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());
  151 +
  152 + insert(cgir);
  153 +end
  154 +
  155 +//----------------------- 人员范围循环计算 ------------------------//
  156 +
  157 +declare Calcu_employee_index_result
  158 + ruleId : String // 规则Id
  159 + calcu_index : Integer // 计算之后的起始索引
  160 +end
  161 +
  162 +// 启用日期等于开始日期
  163 +rule "calcu_employee_index_qyrq_eq_startrq"
  164 + when
  165 + $calcu_days_result : Calcu_days_result(
  166 + qyrq_days == 0,
  167 + $ruleId: ruleId)
  168 + $scheduleRule_input : ScheduleRule_input(
  169 + ruleId == $ruleId,
  170 + $oindex : startEIndex)
  171 + then
  172 + Calcu_employee_index_result cgir = new Calcu_employee_index_result();
  173 + cgir.setRuleId($ruleId);
  174 + cgir.setCalcu_index($oindex);
  175 +
  176 + log.info("calcu_employee_index_qyrq_eq_startrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());
  177 +
  178 + insert(cgir);
  179 +end
  180 +
  181 +// 开始日期大于启用日期
  182 +rule "calcu_employee_index_startrq_gt_qyrq"
  183 + when
  184 + $calcu_days_result : Calcu_days_result(
  185 + qyrq_days > 0,
  186 + $ruleId: ruleId, $qyrq_days: qyrq_days,
  187 + $calcu_start_date: calcu_start_date
  188 + )
  189 + $scheduleRule_input : ScheduleRule_input(
  190 + ruleId == $ruleId,
  191 + $qyrq: qyrq,
  192 + $rangesize : employeeConfigIds.size(),
  193 + $oindex : startEIndex,
  194 + $weekdays: weekdays
  195 + )
  196 + then
  197 + // 开始时间
  198 + DateTime initDate = $qyrq;
  199 + int index = $oindex;
  200 + int resultIndex = index;
  201 +
  202 + while (!initDate.isAfter($calcu_start_date)) {
  203 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  204 + resultIndex = index;
  205 + index = (index + 1) % $rangesize;
  206 + }
  207 + initDate = initDate.plusDays(1);
  208 + }
  209 +
  210 + Calcu_employee_index_result cgir = new Calcu_employee_index_result();
  211 + cgir.setRuleId($ruleId);
  212 + cgir.setCalcu_index(resultIndex);
  213 +
  214 + log.info("calcu_employee_index_startrq_gt_qyrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());
  215 +
  216 + insert(cgir);
  217 +
  218 +end
  219 +
  220 +//------------------------- 第三阶段、循环计算 ------------------------//
  221 +
  222 +//----------------------- 路牌范围循环计算 ------------------------//
  223 +declare loop_guideboard_result
  224 + ruleId : String // 规则id
  225 + go_list : List // 路牌循环的列表
  226 +end
  227 +
  228 +// 循环路牌计算
  229 +rule "Calcu_loop_guideboard_result"
  230 + when
  231 + Calcu_days_result(
  232 + $ruleId: ruleId,
  233 + $startDate : calcu_start_date,
  234 + $calcu_end_date: calcu_end_date
  235 + )
  236 + $ruleData : ScheduleRule_input(
  237 + ruleId == $ruleId,
  238 + $rangesize : guideboardIds.size(),
  239 + $weekdays: weekdays
  240 + )
  241 + $indexData : Calcu_guideboard_index_result(
  242 + ruleId == $ruleId
  243 + )
  244 + then
  245 + DateTime initDate = $startDate; // 开始时间
  246 + DateTime endDate = $calcu_end_date; // 结束实际
  247 + List<ScheduleResult_output> scheduleResult_outputs =
  248 + new ArrayList<ScheduleResult_output>();
  249 +
  250 + int i = $indexData.getCalcu_index();
  251 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue() == false) {
  252 + i = (i + 1) % $rangesize;
  253 + }
  254 +
  255 + while (!initDate.isAfter(endDate)) {
  256 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  257 + ScheduleResult_output ro = new ScheduleResult_output();
  258 + ro.setRuleId($ruleId);
  259 + ro.setSd(initDate);
  260 + ro.setGuideboardId($ruleData.getGuideboardIds().get(i));
  261 + ro.setCarConfigId($ruleData.getCarConfigId());
  262 + scheduleResult_outputs.add(ro);
  263 +
  264 + i = (i + 1) % $rangesize;
  265 + }
  266 +
  267 + initDate = initDate.plusDays(1);
  268 + }
  269 +
  270 + loop_guideboard_result clgr = new loop_guideboard_result();
  271 + clgr.setRuleId($ruleId);
  272 + clgr.setGo_list(scheduleResult_outputs);
  273 +
  274 + log.info(String.valueOf(scheduleResult_outputs.size()));
  275 +
  276 + insert(clgr);
  277 +
  278 +end
  279 +
  280 +//----------------------- 人员范围循环计算 ------------------------//
  281 +declare loop_employee_result
  282 + ruleId : String // 规则id
  283 + eo_list : List // 人员循环的列表
  284 +end
  285 +
  286 +// 循环人员计算
  287 +rule "Calcu_loop_employee_result"
  288 + when
  289 + Calcu_days_result(
  290 + $ruleId: ruleId,
  291 + $startDate : calcu_start_date,
  292 + $calcu_end_date: calcu_end_date
  293 + )
  294 + $ruleData : ScheduleRule_input(
  295 + ruleId == $ruleId,
  296 + $rangesize : employeeConfigIds.size(),
  297 + $weekdays: weekdays
  298 + )
  299 + $indexData : Calcu_employee_index_result(
  300 + ruleId == $ruleId
  301 + )
  302 + then
  303 + DateTime initDate = $startDate; // 开始时间
  304 + DateTime endDate = $calcu_end_date; // 结束实际
  305 + List<ScheduleResult_output> scheduleResult_outputs =
  306 + new ArrayList<ScheduleResult_output>();
  307 +
  308 + int i = $indexData.getCalcu_index();
  309 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue() == false) {
  310 + i = (i + 1) % $rangesize;
  311 + }
  312 +
  313 + while (!initDate.isAfter(endDate)) {
  314 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  315 + ScheduleResult_output ro = new ScheduleResult_output();
  316 + ro.setRuleId($ruleId);
  317 + ro.setSd(initDate);
  318 + ro.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(i));
  319 + ro.setCarConfigId($ruleData.getCarConfigId());
  320 + scheduleResult_outputs.add(ro);
  321 +
  322 + i = (i + 1) % $rangesize;
  323 + }
  324 +
  325 + initDate = initDate.plusDays(1);
  326 + }
  327 +
  328 + loop_employee_result clgr = new loop_employee_result();
  329 + clgr.setRuleId($ruleId);
  330 + clgr.setEo_list(scheduleResult_outputs);
  331 +
  332 + log.info(String.valueOf(scheduleResult_outputs.size()));
  333 +
  334 + insert(clgr);
  335 +end
  336 +
  337 +//------------------------- 第四阶段、范围组循环计算 ----------------------------//
  338 +
  339 +global ScheduleResults_output scheduleResult;
  340 +
  341 +rule "output"
  342 + when
  343 + loop_guideboard_result(
  344 + go_list.size() > 0,
  345 + $ruleId : ruleId, $go_list : go_list
  346 + )
  347 + loop_employee_result(
  348 + ruleId == $ruleId,
  349 + eo_list.size() == $go_list.size(),
  350 + $eo_list : eo_list
  351 + )
  352 + then
  353 + for (int i = 0; i < $go_list.size(); i++) {
  354 + ScheduleResult_output go = (ScheduleResult_output) $go_list.get(i);
  355 + ScheduleResult_output eo = (ScheduleResult_output) $eo_list.get(i);
  356 + go.setEmployeeConfigId(eo.getEmployeeConfigId());
  357 + scheduleResult.getResults().add(go);
  358 + }
  359 +
  360 +end
  361 +
  362 +
  363 +
  364 +
  365 +
  366 +
  367 +
  368 +
  369 +
  370 +
  371 +
  372 +
  373 +
  374 +
  375 +
  376 +
src/main/resources/rules/ttinfo.drl
@@ -7,13 +7,31 @@ import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input; @@ -7,13 +7,31 @@ import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input;
7 import com.bsth.service.schedule.rules.ttinfo.TTInfo_input; 7 import com.bsth.service.schedule.rules.ttinfo.TTInfo_input;
8 import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output; 8 import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output;
9 import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; 9 import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output;
  10 +import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;
  11 +import com.bsth.service.schedule.rules.ttinfo.LpInfoResults_output;
10 12
11 -import org.slf4j.Logger; 13 +import com.bsth.service.schedule.TTInfoDetailService;
  14 +
  15 +import com.bsth.entity.schedule.TTInfo;
  16 +import com.bsth.entity.schedule.TTInfoDetail;
  17 +
  18 +import org.slf4j.Logger
12 19
13 // 全局日志 20 // 全局日志
14 global Logger log; 21 global Logger log;
  22 +// service
  23 +global TTInfoDetailService tTInfoDetailService;
15 // return输出 24 // return输出
16 global TTInfoResults_output results 25 global TTInfoResults_output results
  26 +global LpInfoResults_output lpInfoResults_output
  27 +
  28 +function Map ttidParams(List ttinfolist) {
  29 + // 获取第一张时刻表id
  30 + TTInfo_input ttInfo_input = (TTInfo_input) ttinfolist.get(0);
  31 + Map param = new HashMap();
  32 + param.put("ttinfo.id_eq", Long.parseLong(ttInfo_input.getTtInfoId()));
  33 + return param;
  34 +}
17 35
18 36
19 /* 37 /*
@@ -91,6 +109,7 @@ rule &quot;calcu_ttinfo_special_day&quot; // 特殊日期匹配 @@ -91,6 +109,7 @@ rule &quot;calcu_ttinfo_special_day&quot; // 特殊日期匹配
91 $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list) 109 $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
92 $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day) 110 $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day)
93 $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays contains $calcu_date) from $ttInfo_input_list) 111 $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays contains $calcu_date) from $ttInfo_input_list)
  112 + $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailService.list(ttidParams($ttinfolist)), lpinforesult($ttd))
94 then 113 then
95 // 更新Calcu_days_result对象 114 // 更新Calcu_days_result对象
96 int new_calcu_day = $calcu_day + 1; 115 int new_calcu_day = $calcu_day + 1;
@@ -105,6 +124,13 @@ rule &quot;calcu_ttinfo_special_day&quot; // 特殊日期匹配 @@ -105,6 +124,13 @@ rule &quot;calcu_ttinfo_special_day&quot; // 特殊日期匹配
105 Collections.sort($ttinfolist); 124 Collections.sort($ttinfolist);
106 results.addXlTTInfos($xlId, $calcu_date, $ttinfolist); 125 results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
107 126
  127 + // lp输出
  128 + for (int i = 0; i < $lpInfoResults.size(); i++) {
  129 + LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i);
  130 + lpInfoResult_output.setDateTime($calcu_date); // 设定时间
  131 + lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output);
  132 + }
  133 +
108 update($calcu_days_result); 134 update($calcu_days_result);
109 end 135 end
110 136
@@ -114,6 +140,7 @@ rule &quot;calcu_ttinfo_normal_day&quot; // 平日匹配 @@ -114,6 +140,7 @@ rule &quot;calcu_ttinfo_normal_day&quot; // 平日匹配
114 $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list) 140 $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
115 $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday) 141 $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday)
116 $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == true) from $ttInfo_input_list) 142 $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == true) from $ttInfo_input_list)
  143 + $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailService.list(ttidParams($ttinfolist)), lpinforesult($ttd))
117 then 144 then
118 // 更新Calcu_days_result对象 145 // 更新Calcu_days_result对象
119 int new_calcu_day = $calcu_day + 1; 146 int new_calcu_day = $calcu_day + 1;
@@ -122,12 +149,19 @@ rule &quot;calcu_ttinfo_normal_day&quot; // 平日匹配 @@ -122,12 +149,19 @@ rule &quot;calcu_ttinfo_normal_day&quot; // 平日匹配
122 $calcu_days_result.setCalcu_date(new_calcu_date); 149 $calcu_days_result.setCalcu_date(new_calcu_date);
123 $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek()); 150 $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
124 151
125 - log.info("启用常规日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday); 152 + log.info("启用常规日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={} 路牌size={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday, $lpInfoResults.size());
126 153
127 // $ttinfolist按时间倒排序,result输出 154 // $ttinfolist按时间倒排序,result输出
128 Collections.sort($ttinfolist); 155 Collections.sort($ttinfolist);
129 results.addXlTTInfos($xlId, $calcu_date, $ttinfolist); 156 results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
130 157
  158 + // lp输出
  159 + for (int i = 0; i < $lpInfoResults.size(); i++) {
  160 + LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i);
  161 + lpInfoResult_output.setDateTime($calcu_date); // 设定时间
  162 + lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output);
  163 + }
  164 +
131 update($calcu_days_result); 165 update($calcu_days_result);
132 end 166 end
133 167
@@ -137,6 +171,7 @@ rule &quot;calcu_ttinfo_other_day&quot; // 都没有的情况下,匹配 @@ -137,6 +171,7 @@ rule &quot;calcu_ttinfo_other_day&quot; // 都没有的情况下,匹配
137 $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list) 171 $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list)
138 $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday) 172 $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday)
139 $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == false) from $ttInfo_input_list) 173 $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == false) from $ttInfo_input_list)
  174 + $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailService.list(ttidParams($ttinfolist)), lpinforesult($ttd))
140 then 175 then
141 // 更新Calcu_days_result对象 176 // 更新Calcu_days_result对象
142 int new_calcu_day = $calcu_day + 1; 177 int new_calcu_day = $calcu_day + 1;
@@ -151,6 +186,13 @@ rule &quot;calcu_ttinfo_other_day&quot; // 都没有的情况下,匹配 @@ -151,6 +186,13 @@ rule &quot;calcu_ttinfo_other_day&quot; // 都没有的情况下,匹配
151 Collections.sort($ttinfolist); 186 Collections.sort($ttinfolist);
152 results.addXlTTInfos($xlId, $calcu_date, $ttinfolist); 187 results.addXlTTInfos($xlId, $calcu_date, $ttinfolist);
153 188
  189 + // lp输出
  190 + for (int i = 0; i < $lpInfoResults.size(); i++) {
  191 + LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i);
  192 + lpInfoResult_output.setDateTime($calcu_date); // 设定时间
  193 + lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output);
  194 + }
  195 +
154 update($calcu_days_result); 196 update($calcu_days_result);
155 197
156 end 198 end
157 \ No newline at end of file 199 \ No newline at end of file
src/main/resources/static/pages/electricity/cdl/cdlAdd.html 0 → 100644
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>添加用户</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  9 + <li><span class="active">用油管理</span> <i class="fa fa-circle"></i></li>
  10 + <li><a href="cylList.html" data-pjax>车辆存电</a> <i class="fa fa-circle"></i></li>
  11 + <li><span class="active">添加存电</span></li>
  12 +</ul>
  13 +
  14 +<div class="portlet light bordered">
  15 + <div class="portlet-title">
  16 + <div class="caption">
  17 + <i class="icon-equalizer font-red-sunglo"></i> <span
  18 + class="caption-subject font-red-sunglo bold uppercase">表单</span>
  19 + </div>
  20 + </div>
  21 + <div class="portlet-body form">
  22 + <form action="/addCyl" class="form-horizontal" id="cyl_add_form" >
  23 + <div class="alert alert-danger display-hide">
  24 + <button class="close" data-close="alert"></button>
  25 + 您的输入有误,请检查下面的输入项
  26 + </div>
  27 + <div class="form-body">
  28 + <div class="form-group" id="gsdmDivId">
  29 + <label class="col-md-3 control-label">公司</label>
  30 + <div class="col-md-4">
  31 + <select class="form-control" name="gsdm" id="gsdm" ></select>
  32 + <span class="help-block"> 公司</span>
  33 + </div>
  34 + </div>
  35 + <div class="form-group" id="fgsdmDivId">
  36 + <label class="col-md-3 control-label">分公司</label>
  37 + <div class="col-md-4">
  38 + <select class="form-control" name="fgsdm" id="fgsdm" ></select>
  39 + <span class="help-block"> 分公司</span>
  40 + </div>
  41 + </div>
  42 + <div class="form-group">
  43 + <label class="col-md-3 control-label">内部编号</label>
  44 + <div class="col-md-4">
  45 + <input type="text" class="form-control" name="nbbm" >
  46 + <span class="help-block"> 车辆内部编号</span>
  47 + </div>
  48 + </div>
  49 + <div class="form-group">
  50 + <label class="col-md-3 control-label">恒定存电量</label>
  51 + <div class="col-md-4">
  52 +
  53 + <input type="text" style=" width:120px; height: 34px; padding: 6px 12px ; background-color: #fff;border: 1px solid #c2cad8;"
  54 + name="clcd" >
  55 + <span style="font-size: 30px">%
  56 + </span>
  57 +
  58 + </div>
  59 + </div>
  60 + </div>
  61 + <div class="form-actions">
  62 + <div class="row">
  63 + <div class="col-md-offset-3 col-md-4">
  64 + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  65 + <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
  66 + </div>
  67 + </div>
  68 + </div>
  69 + </form>
  70 + <!-- END FORM-->
  71 + </div>
  72 +</div>
  73 +<script>
  74 + $(function(){
  75 +
  76 + var form = $('#cyl_add_form');
  77 + var error = $('.alert-danger', form);
  78 +
  79 + var obj = [];
  80 + $.get('/user/companyData', function(result){
  81 + obj = result;
  82 + var options = '';
  83 + for(var i = 0; i < obj.length; i++){
  84 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  85 + }
  86 +
  87 + if(obj.length ==0){
  88 + $("#gsdmDivId").css('display','none');
  89 + $('#fgsdmDivId').css('display','none');
  90 + }else if(obj.length ==1){
  91 + $("#gsdmDivId").css('display','none');
  92 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  93 + $('#fgsdmDivId').css('display','none');
  94 + }
  95 + $('#gsdm').html(options);
  96 + updateCompany();
  97 + });
  98 +
  99 + $("#gsdm").on("change",updateCompany);
  100 + function updateCompany(){
  101 + var company = $('#gsdm').val();
  102 + var options = '';
  103 + for(var i = 0; i < obj.length; i++){
  104 + if(obj[i].companyCode == company){
  105 + var children = obj[i].children;
  106 + for(var j = 0; j < children.length; j++){
  107 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  108 + }
  109 + }
  110 + }
  111 + $('#fgsdm').html(options);
  112 + }
  113 +
  114 +
  115 + //表单 validate
  116 + form.validate({
  117 + errorElement : 'span',
  118 + errorClass : 'help-block help-block-error',
  119 + focusInvalid : false,
  120 + rules : {
  121 + 'nbbm' : {
  122 + minlength : 2,
  123 + required : true,
  124 + maxlength : 10
  125 + },
  126 + 'clcd' : {
  127 + number:true,
  128 + required : true,
  129 + min:0
  130 + }
  131 + },
  132 + invalidHandler : function(event, validator) {
  133 + error.show();
  134 + App.scrollTo(error, -200);
  135 + },
  136 +
  137 + highlight : function(element) {
  138 + $(element).closest('.form-group').addClass('has-error');
  139 + },
  140 +
  141 + unhighlight : function(element) {
  142 + $(element).closest('.form-group').removeClass('has-error');
  143 + },
  144 +
  145 + success : function(label) {
  146 + label.closest('.form-group').removeClass('has-error');
  147 + },
  148 +
  149 + submitHandler : function(f) {
  150 + var params = form.serializeJSON();
  151 + error.hide();
  152 + //检查一下车辆是否存在
  153 + $get('/cdl/all', {nbbm_eq: params.nbbm}, function(list){
  154 + if(!list || list.length == 0){
  155 + $.ajax({
  156 + url: '/cdl/save',
  157 + type: 'POST',
  158 + traditional: true,
  159 + data: params,
  160 + success: function(res){
  161 + layer.msg('添加信息成功.');
  162 + loadPage('cdlList.html');
  163 + }
  164 + });
  165 + }
  166 + else
  167 + layer.alert('内部编码【' + params.nbbm + '】已存在', {icon: 2, title: '提交被拒绝'});
  168 + });
  169 + }
  170 + });
  171 + });
  172 +</script>
0 \ No newline at end of file 173 \ No newline at end of file
src/main/resources/static/pages/electricity/cdl/cdlList.html 0 → 100644
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>车辆存电</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  9 + <li><span class="active">用点管理</span> <i class="fa fa-circle"></i></li>
  10 + <li><span class="active">车辆存电</span></li>
  11 +</ul>
  12 +
  13 +<div class="row">
  14 + <div class="col-md-12">
  15 + <!-- Begin: life time stats -->
  16 + <div class="portlet light portlet-fit portlet-datatable bordered">
  17 + <div class="portlet-title">
  18 + <div class="caption">
  19 + <i class="fa fa-users font-dark"></i> <span
  20 + class="caption-subject font-dark sbold uppercase">车辆存电信息表</span>
  21 + </div>
  22 + <div class="actions">
  23 + <a class="btn btn-circle blue" href="cdlAdd.html" data-pjax><i class="fa fa-plus"></i> 添加</a>
  24 + </div>
  25 + </div>
  26 + <div class="portlet-body">
  27 + <div class="table-container" style="margin-top: 10px">
  28 + <table
  29 + class="table table-striped table-bordered table-hover table-checkable"
  30 + id="datatable_cdl">
  31 + <thead>
  32 + <tr role="row" class="heading">
  33 + <th width="3%">#</th>
  34 + <th width="15%">公司</th>
  35 + <th width="15%">分公司</th>
  36 + <th width="14%">车辆编码</th>
  37 + <th width="16%">车辆存电</th>
  38 + <th width="18%">最后更新时间</th>
  39 + <th width="19%">操作</th>
  40 + </tr>
  41 + <tr role="row" class="filter">
  42 + <td></td>
  43 + <td>
  44 + <select class="form-control" name="gsdm_like" id="cylListGsdmId" ></select>
  45 + </td>
  46 + <td>
  47 + <select class="form-control" name="fgsdm_like" id="cylListFgsdmId" ></select>
  48 + </td>
  49 + <td>
  50 + <input type="text" class="form-control form-filter input-sm" name="nbbm_like">
  51 + </td>
  52 + <td></td>
  53 + <td></td>
  54 + <td>
  55 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
  56 + <i class="fa fa-search"></i> 搜索</button>
  57 +
  58 + <button class="btn btn-sm red btn-outline filter-cancel">
  59 + <i class="fa fa-times"></i> 重置</button>
  60 + </td>
  61 + </tr>
  62 + </thead>
  63 + <tbody></tbody>
  64 + </table>
  65 + <div style="text-align: right;">
  66 + <ul id="pagination" class="pagination"></ul>
  67 + </div>
  68 + </div>
  69 + </div>
  70 + </div>
  71 + </div>
  72 +</div>
  73 +
  74 +<script id="cdl_list_temp" type="text/html">
  75 +{{each list as obj i}}
  76 +<tr>
  77 + <td style="vertical-align: middle;">
  78 + <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}">
  79 + </td>
  80 + <td>
  81 + {{obj.gsname}}
  82 + </td>
  83 + <td>
  84 + {{obj.fgsname}}
  85 + </td>
  86 + <td>
  87 + {{obj.nbbm}}
  88 + </td>
  89 + <td>
  90 + {{obj.clcd}}%
  91 + </td>
  92 + <td>
  93 + {{obj.updatetime}}
  94 + </td>
  95 + <td>
  96 + <!--<a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a>-->
  97 + </td>
  98 +</tr>
  99 +{{/each}}
  100 +{{if list.length == 0}}
  101 +<tr>
  102 + <td colspan=8><h6 class="muted">没有找到相关数据</h6></td>
  103 +</tr>
  104 +{{/if}}
  105 +</script>
  106 +
  107 +<script>
  108 +$(function(){
  109 + var page = 0, initPagination;
  110 + var icheckOptions = {
  111 + checkboxClass: 'icheckbox_flat-blue',
  112 + increaseArea: '20%'
  113 + }
  114 +
  115 +// var gsqx="";
  116 +// var fgsqx="";
  117 +
  118 + $.get('/user/companyData', function(result){
  119 + obj = result;
  120 + var options = '';
  121 +// '<option value="">请选择</option>';
  122 + for(var i = 0; i < obj.length; i++){
  123 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  124 +// setFgsqx(obj[i].companyCode);
  125 +// gsqx +=obj[i].companyCode+",";
  126 + }
  127 + $('#cylListGsdmId').html(options);
  128 + updateCompany();
  129 +// jsDoQuery(null,true);
  130 + });
  131 +
  132 + /* function setFgsqx(gs){
  133 + var company =gs
  134 + var options = '';
  135 + for(var i = 0; i < obj.length; i++){
  136 + if(obj[i].companyCode == company){
  137 + var children = obj[i].children;
  138 + for(var j = 0; j < children.length; j++){
  139 + fgsqx +=children[j].code+",";
  140 + }
  141 + }
  142 + }
  143 + } */
  144 +
  145 + $("#cylListGsdmId").on("change",updateCompany);
  146 + function updateCompany(){
  147 + var company = $('#cylListGsdmId').val();
  148 + var options = '';
  149 +// '<option value="">请选择</option>';
  150 + for(var i = 0; i < obj.length; i++){
  151 + if(obj[i].companyCode == company){
  152 + var children = obj[i].children;
  153 + for(var j = 0; j < children.length; j++){
  154 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  155 + }
  156 + }
  157 + }
  158 + $('#cylListFgsdmId').html(options);
  159 + }
  160 +
  161 + //重置
  162 + $('tr.filter .filter-cancel').on('click', function(){
  163 + $('tr.filter input, select').val('').change();
  164 +// jsDoQuery(null, true);
  165 + });
  166 +
  167 + //提交
  168 + $('tr.filter .filter-submit').on('click', function(){
  169 + var cylGsdm=$("#cylListGsdmId").val();
  170 + var cylFgsdm=$("#cylListFgsdmId").val();
  171 + if(cylGsdm=="" ||cylGsdm ==null ||cylFgsdm=="" ||cylFgsdm ==null){
  172 + layer.msg("请选择公司和分公司");
  173 + }else{
  174 + var cells = $('tr.filter')[0].cells
  175 + ,params = {}
  176 + ,name;
  177 + $.each(cells, function(i, cell){
  178 + var items = $('input,select', cell);
  179 + for(var j = 0, item; item = items[j++];){
  180 + name = $(item).attr('name');
  181 + if(name){
  182 + params[name] = $(item).val();
  183 + }
  184 + }
  185 + });
  186 + page = 0;
  187 + jsDoQuery(params, true);
  188 + }
  189 + });
  190 +
  191 +
  192 +
  193 + /*
  194 + * 获取数据 p: 要提交的参数, pagination: 是否重新分页
  195 + */
  196 + function jsDoQuery(p, pagination){
  197 + var params = {};
  198 + if(p)
  199 + params = p;
  200 + //更新时间排序
  201 + params['order'] = 'nbbm';
  202 + params['page'] = page;
  203 + var i = 2;
  204 + /* var cylGsdm=$("#cylListGsdmId").val();
  205 + var cylFgsdm=$("#cylListFgsdmId").val();
  206 + if(cylGsdm==''|| cylGsdm==null){
  207 + params['gsdm_in']=gsqx;
  208 + params['fgsdm_in']=fgsqx;
  209 + }else{
  210 + if(cylFgsdm==''||cylFgsdm==null){
  211 + var fgsqx1='';
  212 + for(var i = 0; i < obj.length; i++){
  213 + if(obj[i].companyCode == cylGsdm){
  214 + var children = obj[i].children;
  215 + for(var j = 0; j < children.length; j++){
  216 + fgsqx1 +=children[j].code+",";
  217 + }
  218 + }
  219 + }
  220 + params['fgsdm_in']=fgsqx1;
  221 + }
  222 + } */
  223 + $get('/cdl' ,params, function(data){
  224 + $.each(data.content, function(i, obj) {
  225 + obj.updatetime = moment(obj.updatetime).format("YYYY-MM-DD");
  226 + });
  227 + var bodyHtm = template('cdl_list_temp', {list: data.content});
  228 +
  229 + $('#datatable_cdl tbody').html(bodyHtm)
  230 + .find('.icheck').iCheck(icheckOptions)
  231 + .on('ifChanged', iCheckChange);
  232 + if(pagination && data.content.length > 0){
  233 + //重新分页
  234 + initPagination = true;
  235 + showPagination(data);
  236 + }
  237 + layer.close(i);
  238 + });
  239 + }
  240 +
  241 + function iCheckChange(){
  242 + var tr = $(this).parents('tr');
  243 + if(this.checked)
  244 + tr.addClass('row-active');
  245 + else
  246 + tr.removeClass('row-active');
  247 +
  248 + if($('#datatable_resource input.icheck:checked').length == 1)
  249 + $('#removeButton').removeAttr('disabled');
  250 + else
  251 + $('#removeButton').attr('disabled', 'disabled');
  252 + }
  253 +
  254 + function showPagination(data){
  255 + //分页
  256 + $('#pagination').jqPaginator({
  257 + totalPages: data.totalPages,
  258 + visiblePages: 6,
  259 + currentPage: page + 1,
  260 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  261 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  262 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  263 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  264 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  265 + onPageChange: function (num, type) {
  266 + if(initPagination){
  267 + initPagination = false;
  268 + return;
  269 + }
  270 + page = num - 1;
  271 + var cells = $('tr.filter')[0].cells
  272 + ,params = {}
  273 + ,name;
  274 + $.each(cells, function(i, cell){
  275 + var items = $('input,select', cell);
  276 + for(var j = 0, item; item = items[j++];){
  277 + name = $(item).attr('name');
  278 + if(name){
  279 + params[name] = $(item).val();
  280 + }
  281 + }
  282 + });
  283 + jsDoQuery(params, false);
  284 + }
  285 + });
  286 + }
  287 +
  288 +
  289 + //删除
  290 + $('#removeButton').on('click', function(){
  291 + if($(this).attr('disabled'))
  292 + return;
  293 +
  294 + var id = $('#datatable_resource input.icheck:checked').data('id');
  295 +
  296 + removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){
  297 + $('tr.filter .filter-submit').click();
  298 + });
  299 + });
  300 +});
  301 +</script>
0 \ No newline at end of file 302 \ No newline at end of file
src/main/resources/static/pages/electricity/list/list.html
@@ -10,26 +10,29 @@ @@ -10,26 +10,29 @@
10 <li><span class="active">进出场存电量</span></li> 10 <li><span class="active">进出场存电量</span></li>
11 </ul> 11 </ul>
12 12
13 -<div class="row" id="ll_oil_list"> 13 +<div class="row" id="ll_dlb_list">
14 <div class="col-md-12"> 14 <div class="col-md-12">
15 <!-- Begin: life time stats --> 15 <!-- Begin: life time stats -->
16 <div class="portlet light portlet-fit portlet-datatable bordered"> 16 <div class="portlet light portlet-fit portlet-datatable bordered">
17 <div class="portlet-title"> 17 <div class="portlet-title">
18 <div class="caption"> 18 <div class="caption">
19 - <i class="fa fa-fire-extinguisher"></i> <span 19 + <i class="fa fa-battery-quarter"></i> <span
20 class="caption-subject font-dark sbold uppercase">进出场存电量表</span> 20 class="caption-subject font-dark sbold uppercase">进出场存电量表</span>
21 </div> 21 </div>
22 <div class="actions"> 22 <div class="actions">
23 <!-- <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button> --> 23 <!-- <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button> -->
  24 + <button type="button" class="btn btn-circle blue" id="sortButton"><i class="fa fa-minus-square"></i>
  25 + 保存
  26 + </button>
24 <button type="button" class="btn btn-circle blue" id="obtain"><i class="fa fa-hourglass-half"></i> 27 <button type="button" class="btn btn-circle blue" id="obtain"><i class="fa fa-hourglass-half"></i>
25 获取加/存电信息 28 获取加/存电信息
26 </button> 29 </button>
27 - <button type="button" class="btn btn-circle blue" id="checkYl"><i class="fa fa-gg-circle"></i> 30 + <button type="button" class="btn btn-circle blue" id="checkDl"><i class="fa fa-gg-circle"></i>
28 核对加注量(有加电无里程) 31 核对加注量(有加电无里程)
29 </button> 32 </button>
30 - <button type="button" class="btn btn-circle blue" id="export"><i class="fa fa-file-excel-o"></i> 33 + <!-- <button type="button" class="btn btn-circle blue" id="export"><i class="fa fa-file-excel-o"></i>
31 导出Excel 34 导出Excel
32 - </button> 35 + </button> -->
33 <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> --> 36 <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> -->
34 </div> 37 </div>
35 </div> 38 </div>
@@ -117,7 +120,7 @@ @@ -117,7 +120,7 @@
117 </div> 120 </div>
118 </div> 121 </div>
119 122
120 -<script id="ylb_list_temp" type="text/html"> 123 +<script id="dlb_list_temp" type="text/html">
121 {{each list as obj i}} 124 {{each list as obj i}}
122 <tr> 125 <tr>
123 <td style="vertical-align: middle;"> 126 <td style="vertical-align: middle;">
@@ -140,7 +143,7 @@ @@ -140,7 +143,7 @@
140 {{obj.jsy}} 143 {{obj.jsy}}
141 </td> 144 </td>
142 <td> 145 <td>
143 - {{obj.jzl}} 146 + {{obj.cdl}}
144 </td> 147 </td>
145 <td> 148 <td>
146 {{obj.czlc}} 149 {{obj.czlc}}
@@ -149,15 +152,19 @@ @@ -149,15 +152,19 @@
149 {{obj.jzlc}} 152 {{obj.jzlc}}
150 </td> 153 </td>
151 <td> 154 <td>
152 - {{obj.czyl}} 155 + {{obj.czcd}}
153 </td> 156 </td>
154 <td> 157 <td>
155 - <a data-id="{{obj.id}}" href="javascript:;" class="in_carpark_jzyl">  
156 - {{obj.jzyl}} 158 + <a data-id="{{obj.id}}" href="javascript:;" class="in_carpark_jzdl">
  159 + {{obj.jzcd}}
157 </a> 160 </a>
  161 + %
158 </td> 162 </td>
159 <td> 163 <td>
160 - {{obj.yh}} 164 +
  165 + <a data-id="{{obj.id}}" href="javascript:;" class="in_carpark_hdl">
  166 + {{obj.hd}}
  167 + </a>
161 </td> 168 </td>
162 <td> 169 <td>
163 {{obj.ns}} 170 {{obj.ns}}
@@ -177,9 +184,7 @@ @@ -177,9 +184,7 @@
177 <td> 184 <td>
178 {{obj.bglyh}} 185 {{obj.bglyh}}
179 </td> 186 </td>
180 - <td>  
181 - <!--<a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a>-->  
182 - </td> 187 +
183 </tr> 188 </tr>
184 {{/each}} 189 {{/each}}
185 {{if list.length == 0}} 190 {{if list.length == 0}}
@@ -192,9 +197,9 @@ @@ -192,9 +197,9 @@
192 <script> 197 <script>
193 $(function () { 198 $(function () {
194 //var id = 15; 199 //var id = 15;
195 - //$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list') 200 + //$('.in_carpark_jzdl[data-id='+id+']', '#ll_dlb_list')
196 201
197 - $("#checkYl").on('click', function () { 202 + $("#checkDl").on('click', function () {
198 if ($("#rq").val() != "") { 203 if ($("#rq").val() != "") {
199 var cells = $('tr.filter')[0].cells 204 var cells = $('tr.filter')[0].cells
200 , params = {} 205 , params = {}
@@ -208,15 +213,67 @@ @@ -208,15 +213,67 @@
208 } 213 }
209 } 214 }
210 }); 215 });
211 - $get('/ylb/checkYl', params, function () {  
212 - jsDoQuery(null, true); 216 + var i = layer.load(2);
  217 + $get('/dlb/checkDl', params, function () {
  218 + layer.close(i);
  219 + var cells = $('tr.filter')[0].cells
  220 + , params1 = {}
  221 + , name;
  222 + $.each(cells, function (i, cell) {
  223 + var items = $('input,select', cell);
  224 + for (var j = 0, item; item = items[j++];) {
  225 + name = $(item).attr('name');
  226 + if (name) {
  227 + params1[name] = $(item).val();
  228 + }
  229 + }
  230 + });
  231 + jsDoQuery(params1, true);
213 }); 232 });
214 } else { 233 } else {
215 layer.msg('请选择日期.'); 234 layer.msg('请选择日期.');
216 } 235 }
217 }) 236 })
218 237
219 - 238 + //拆分
  239 + $("#sortButton").on('click', function () {
  240 + if ($("#rq").val() != "") {
  241 + var id = $('input.icheck:checked').data('id');
  242 +
  243 + if (typeof(id) == 'undefined') {
  244 + layer.msg("请选择一行进行拆分");
  245 + } else {
  246 + //获取输入的进场存油
  247 + var jzdl = $('.in_carpark_jzdl[data-id='+id+']', '#ll_dlb_list').html();
  248 + var hdl= $('.in_carpark_hdl[data-id='+id+']', '#ll_dlb_list').html();
  249 + // $("#jzyl" + id).html();
  250 + var params = {};
  251 + params['jzdl'] = jzdl;
  252 + params['id'] = id;
  253 + params['hdl']=hdl;
  254 + var i = layer.load(2);
  255 + $get('/dlb/sort', params, function () {
  256 + layer.close(i);
  257 + var cells = $('tr.filter')[0].cells
  258 + , params1 = {}
  259 + , name;
  260 + $.each(cells, function (i, cell) {
  261 + var items = $('input,select', cell);
  262 + for (var j = 0, item; item = items[j++];) {
  263 + name = $(item).attr('name');
  264 + if (name) {
  265 + params1[name] = $(item).val();
  266 + }
  267 + }
  268 + });
  269 + jsDoQuery(params1, true);
  270 + });
  271 +
  272 + }
  273 + } else {
  274 + layer.msg('请选择日期.');
  275 + }
  276 + })
220 //获取加存信息 277 //获取加存信息
221 $("#obtain").on('click', function () { 278 $("#obtain").on('click', function () {
222 if ($("#rq").val() != "") { 279 if ($("#rq").val() != "") {
@@ -232,7 +289,9 @@ @@ -232,7 +289,9 @@
232 } 289 }
233 } 290 }
234 }); 291 });
235 - $get('/ylb/obtain', params, function () { 292 + var i = layer.load(2);
  293 + $get('/dlb/obtain', params, function (s) {
  294 + layer.close(i);
236 jsDoQuery(params, true); 295 jsDoQuery(params, true);
237 }); 296 });
238 } else { 297 } else {
@@ -355,11 +414,11 @@ @@ -355,11 +414,11 @@
355 } 414 }
356 } */ 415 } */
357 var i = layer.load(2); 416 var i = layer.load(2);
358 - $get('/ylb', params, function (data) { 417 + $get('/dlb', params, function (data) {
359 $.each(data.content, function (i, obj) { 418 $.each(data.content, function (i, obj) {
360 obj.rq = moment(obj.rq).format("YYYY-MM-DD"); 419 obj.rq = moment(obj.rq).format("YYYY-MM-DD");
361 }); 420 });
362 - var bodyHtm = template('ylb_list_temp', {list: data.content}); 421 + var bodyHtm = template('dlb_list_temp', {list: data.content});
363 422
364 $('#datatable_dlb tbody').html(bodyHtm) 423 $('#datatable_dlb tbody').html(bodyHtm)
365 .find('.icheck').iCheck(icheckOptions) 424 .find('.icheck').iCheck(icheckOptions)
@@ -371,7 +430,9 @@ @@ -371,7 +430,9 @@
371 } 430 }
372 layer.close(i); 431 layer.close(i);
373 432
374 - startOptJzylLink($('#ll_oil_list .in_carpark_jzyl')); 433 + startOptHdlLink($('#ll_dlb_list .in_carpark_hdl'));
  434 + startOptJzylLink($('#ll_dlb_list .in_carpark_jzdl'));
  435 +
375 }); 436 });
376 } 437 }
377 438
@@ -389,6 +450,29 @@ @@ -389,6 +450,29 @@
389 return '只能为数字!'; 450 return '只能为数字!';
390 if (value < 0) 451 if (value < 0)
391 return '值不能小于0!'; 452 return '值不能小于0!';
  453 + if (value > 100)
  454 + return '值不能大于100!';
  455 + },
  456 + inputclass: 'form-control input-medium input-edtable-sm'
  457 + })
  458 + .on('save', function (e, params) {
  459 + $(this).text(params.newValue);
  460 + });
  461 + }
  462 +
  463 + function startOptHdlLink(es2) {
  464 + es2.editable({
  465 + type: 'text',
  466 + placement: 'right',
  467 + width: 100,
  468 + display: false,
  469 + validate: function (value) {
  470 + if (!value)
  471 + return '值不能为空!';
  472 + if (isNaN(value))
  473 + return '只能为数字!';
  474 + if (value < 0)
  475 + return '值不能小于0!';
392 }, 476 },
393 inputclass: 'form-control input-medium input-edtable-sm' 477 inputclass: 'form-control input-medium input-edtable-sm'
394 }) 478 })
src/main/resources/static/pages/forms/statement/jobSummary.html
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 18
19 <div class="page-head"> 19 <div class="page-head">
20 <div class="page-title"> 20 <div class="page-title">
21 - <h1>统计日报</h1> 21 + <h1>工作汇总</h1>
22 </div> 22 </div>
23 </div> 23 </div>
24 24
src/main/resources/static/pages/forms/statement/lineTimeAnaly.html
@@ -288,6 +288,7 @@ @@ -288,6 +288,7 @@
288 params['type'] = "query"; 288 params['type'] = "query";
289 $("#forms .hidden").removeClass("hidden"); 289 $("#forms .hidden").removeClass("hidden");
290 $get('/busInterval/lineTimeAnaliy', params, function(result){ 290 $get('/busInterval/lineTimeAnaliy', params, function(result){
  291 + console.log(result);
291 // 把数据填充到模版中 292 // 把数据填充到模版中
292 var tbodyHtml = template('list_lineTimeAnaly',{list:result}); 293 var tbodyHtml = template('list_lineTimeAnaly',{list:result});
293 // 把渲染好的模版html文本追加到表格中 294 // 把渲染好的模版html文本追加到表格中
src/main/resources/static/pages/forms/statement/scheduleDaily.html
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 </div> 37 </div>
38 <div class="form-group"> 38 <div class="form-group">
39 <input class="btn btn-default" type="button" id="query" value="查询"/> 39 <input class="btn btn-default" type="button" id="query" value="查询"/>
40 - <input class="btn btn-default" type="button" id="month" value="按月查询"/> 40 +<!-- <input class="btn btn-default" type="button" id="month" value="按月查询"/> -->
41 <input class="btn btn-default" type="button" id="export" value="导出"/> 41 <input class="btn btn-default" type="button" id="export" value="导出"/>
42 </div> 42 </div>
43 </form> 43 </form>
@@ -345,7 +345,7 @@ @@ -345,7 +345,7 @@
345 }); 345 });
346 346
347 //按月查询 347 //按月查询
348 - $("#month").on('click',function(){ 348 + /* $("#month").on('click',function(){
349 line = $("#line").val(); 349 line = $("#line").val();
350 xlName = $("#select2-line-container").html(); 350 xlName = $("#select2-line-container").html();
351 date = $("#date").val(); 351 date = $("#date").val();
@@ -363,7 +363,7 @@ @@ -363,7 +363,7 @@
363 $('#forms .scheduleDaily_2').html(""); 363 $('#forms .scheduleDaily_2').html("");
364 $('#forms .scheduleDaily_3').html(""); 364 $('#forms .scheduleDaily_3').html("");
365 365
366 - }); 366 + }); */
367 367
368 $("#export").on("click",function(){ 368 $("#export").on("click",function(){
369 var params = {}; 369 var params = {};
src/main/resources/static/pages/forms/statement/statisticsDaily.html
@@ -32,9 +32,13 @@ @@ -32,9 +32,13 @@
32 <select class="form-control" name="line" id="line" style="width: 180px;"></select> 32 <select class="form-control" name="line" id="line" style="width: 180px;"></select>
33 </div> 33 </div>
34 <div style="display: inline-block;margin-left: 15px;"> 34 <div style="display: inline-block;margin-left: 15px;">
35 - <span class="item-label" style="width: 80px;">时间: </span> 35 + <span class="item-label" style="width: 80px;">开始时间: </span>
36 <input class="form-control" type="text" id="date" style="width: 180px;"/> 36 <input class="form-control" type="text" id="date" style="width: 180px;"/>
37 </div> 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="date2" style="width: 180px;"/>
  41 + </div>
38 <div class="form-group"> 42 <div class="form-group">
39 <input class="btn btn-default" type="button" id="query" value="查询"/> 43 <input class="btn btn-default" type="button" id="query" value="查询"/>
40 <input class="btn btn-default" type="button" id="export" value="导出"/> 44 <input class="btn btn-default" type="button" id="export" value="导出"/>
@@ -124,6 +128,22 @@ @@ -124,6 +128,22 @@
124 format : 'YYYY-MM-DD', 128 format : 'YYYY-MM-DD',
125 locale : 'zh-cn' 129 locale : 'zh-cn'
126 }); 130 });
  131 +
  132 + $("#date2").datetimepicker({
  133 + format : 'YYYY-MM-DD',
  134 + locale : 'zh-cn'
  135 + });
  136 + var d = new Date();
  137 + var year = d.getFullYear();
  138 + var month = d.getMonth() + 1;
  139 + var day = d.getDate();
  140 + if(month < 10)
  141 + month = "0" + month;
  142 + if(day < 10)
  143 + day = "0" + day;
  144 + $("#date").val(year + "-" + month + "-" + day);
  145 +
  146 + $("#date2").val(year + "-" + month + "-" + day);
127 $.get('/basic/lineCode2Name',function(result){ 147 $.get('/basic/lineCode2Name',function(result){
128 var data=[]; 148 var data=[];
129 149
@@ -139,24 +159,31 @@ @@ -139,24 +159,31 @@
139 var line =""; 159 var line ="";
140 var xlName =""; 160 var xlName ="";
141 var date = ""; 161 var date = "";
  162 + var date2 ="";
142 $("#query").on("click",function(){ 163 $("#query").on("click",function(){
143 line = $("#line").val(); 164 line = $("#line").val();
144 xlName = $("#select2-line-container").html(); 165 xlName = $("#select2-line-container").html();
145 date = $("#date").val(); 166 date = $("#date").val();
  167 + date2 =$("#date2").val();
146 if(line=="请选择"){ 168 if(line=="请选择"){
147 line=""; 169 line="";
148 } 170 }
149 - $get('/realSchedule/statisticsDaily',{line:line,date:date,xlName:xlName,type:"query"},function(result){  
150 - // 把数据填充到模版中  
151 - var tbodyHtml = template('statisticsDaily',{list:result});  
152 - // 把渲染好的模版html文本追加到表格中  
153 - $('#forms .statisticsDaily').html(tbodyHtml);  
154 -  
155 - if(result.length == 0)  
156 - $("#export").attr('disabled',"true");  
157 - else  
158 - $("#export").removeAttr("disabled");  
159 - }); 171 + if(date==null || date =="" ||date2==null || date2 ==""){
  172 + layer.msg('请选择时间段.');
  173 + }else{
  174 + $get('/realSchedule/statisticsDailyTj',{line:line,date:date,date2:date2,xlName:xlName,type:"query"},function(result){
  175 + // 把数据填充到模版中
  176 + var tbodyHtml = template('statisticsDaily',{list:result});
  177 + // 把渲染好的模版html文本追加到表格中
  178 + $('#forms .statisticsDaily').html(tbodyHtml);
  179 +
  180 + if(result.length == 0)
  181 + $("#export").attr('disabled',"true");
  182 + else
  183 + $("#export").removeAttr("disabled");
  184 + });
  185 + }
  186 +
160 }); 187 });
161 188
162 $("#export").on("click",function(){ 189 $("#export").on("click",function(){
src/main/resources/static/pages/forms/statement/waybill.html
@@ -238,23 +238,24 @@ @@ -238,23 +238,24 @@
238 // 把渲染好的模版html文本追加到表格中 238 // 把渲染好的模版html文本追加到表格中
239 $('#forms .ludan_1').html(ludan_1); 239 $('#forms .ludan_1').html(ludan_1);
240 }); 240 });
241 - $post('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){ 241 + $get('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
242 getTime(result); 242 getTime(result);
243 var ludan_2 = template('ludan_2',{list:result}); 243 var ludan_2 = template('ludan_2',{list:result});
244 // 把渲染好的模版html文本追加到表格中 244 // 把渲染好的模版html文本追加到表格中
245 $('#forms .ludan_2').html(ludan_2); 245 $('#forms .ludan_2').html(ludan_2);
246 }); 246 });
247 - $post('/realSchedule/findKMBC',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){ 247 + $get('/realSchedule/findKMBC',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
248 var ludan_3 = template('ludan_3',result); 248 var ludan_3 = template('ludan_3',result);
249 $('#forms .ludan_3').html(ludan_3); 249 $('#forms .ludan_3').html(ludan_3);
250 }); 250 });
251 251
252 }); 252 });
  253 +
253 $("#export").on("click",function(){ 254 $("#export").on("click",function(){
254 if(params.length < 1){ 255 if(params.length < 1){
255 return; 256 return;
256 } 257 }
257 - $post('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){ 258 + $get('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
258 window.open("/downloadFile/download?fileName="+date+"-"+jName+"-"+params[1]+"-"+params[2]+"-行车路单"); 259 window.open("/downloadFile/download?fileName="+date+"-"+jName+"-"+params[1]+"-"+params[2]+"-行车路单");
259 }); 260 });
260 }); 261 });
src/main/resources/static/pages/forms/statement/waybillBf.html
@@ -22,90 +22,48 @@ @@ -22,90 +22,48 @@
22 </div> 22 </div>
23 </div> 23 </div>
24 24
25 -  
26 <div class="row"> 25 <div class="row">
27 -  
28 <div class="col-md-12"> 26 <div class="col-md-12">
29 -  
30 <div class="portlet light porttlet-fit bordered"> 27 <div class="portlet light porttlet-fit bordered">
31 -  
32 <div class="portlet-title"> 28 <div class="portlet-title">
33 -  
34 <form class="form-inline" action=""> 29 <form class="form-inline" action="">
35 -  
36 <div style="display: inline-block;"> 30 <div style="display: inline-block;">
37 -  
38 <span class="item-label" style="width: 80px;">线路: </span> 31 <span class="item-label" style="width: 80px;">线路: </span>
39 <select class="form-control" name="line" id="line" style="width: 180px;"></select> 32 <select class="form-control" name="line" id="line" style="width: 180px;"></select>
40 -  
41 </div> 33 </div>
42 -  
43 <div style="display: inline-block;margin-left: 15px;"> 34 <div style="display: inline-block;margin-left: 15px;">
44 -  
45 <span class="item-label" style="width: 80px;">时间: </span> 35 <span class="item-label" style="width: 80px;">时间: </span>
46 -  
47 <input class="form-control" type="text" id="date" style="width: 180px;"/> 36 <input class="form-control" type="text" id="date" style="width: 180px;"/>
48 -  
49 </div> 37 </div>
50 -  
51 <div class="form-group" style="display: inline-block;margin-left: 15px;"> 38 <div class="form-group" style="display: inline-block;margin-left: 15px;">
52 -  
53 <input class="btn btn-default" type="button" id="query" value="查询"/> 39 <input class="btn btn-default" type="button" id="query" value="查询"/>
54 -  
55 <input class="btn btn-default" type="button" id="export" value="导出"/> 40 <input class="btn btn-default" type="button" id="export" value="导出"/>
56 -  
57 <input class="btn btn-default" type="button" id="print" value="打印"/> 41 <input class="btn btn-default" type="button" id="print" value="打印"/>
58 -  
59 <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/> 42 <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/>
60 -  
61 </div> 43 </div>
62 -  
63 </form> 44 </form>
64 -  
65 </div> 45 </div>
66 -  
67 <div class="portlet-body"> 46 <div class="portlet-body">
68 -  
69 <div class="row"> 47 <div class="row">
70 -  
71 <div class="col-md-3"> 48 <div class="col-md-3">
72 -  
73 <div class="" style="margin-top: 10px;overflow:auto;height: 860px"> 49 <div class="" style="margin-top: 10px;overflow:auto;height: 860px">
74 -  
75 <table class="table table-bordered table-hover table-checkable pre-scrollable" id="info"> 50 <table class="table table-bordered table-hover table-checkable pre-scrollable" id="info">
76 -  
77 <thead> 51 <thead>
78 -  
79 <tr class="hidden"> 52 <tr class="hidden">
80 -  
81 - <th>人员</th>  
82 -  
83 - <th>自编号</th>  
84 -  
85 - <th>路牌</th>  
86 - 53 + <th class="rypx" style="cursor:pointer ">人员</th>
  54 + <th class="zbhpx" style="cursor:pointer ">自编号</th>
  55 + <th class="lppx" style="cursor:pointer ">路牌</th>
87 </tr> 56 </tr>
88 -  
89 </thead> 57 </thead>
90 -  
91 <tbody> 58 <tbody>
92 -  
93 59
94 -  
95 </tbody> 60 </tbody>
96 -  
97 </table> 61 </table>
98 -  
99 </div> 62 </div>
100 -  
101 </div> 63 </div>
102 -  
103 <div class="col-md-9" id="printArea"> 64 <div class="col-md-9" id="printArea">
104 -  
105 <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> 65 <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
106 -  
107 <table class="table table-bordered table-checkable" id="forms"> 66 <table class="table table-bordered table-checkable" id="forms">
108 -  
109 <tbody class="ludan_1"> 67 <tbody class="ludan_1">
110 68
111 </tbody> 69 </tbody>
@@ -118,45 +76,46 @@ @@ -118,45 +76,46 @@
118 <tbody class="ludan_4"> 76 <tbody class="ludan_4">
119 77
120 </tbody> 78 </tbody>
121 -  
122 </table> 79 </table>
123 -  
124 </div> 80 </div>
125 -  
126 </div> 81 </div>
127 -  
128 </div> 82 </div>
129 -  
130 </div> 83 </div>
131 -  
132 </div> 84 </div>
133 -  
134 </div> 85 </div>
135 -  
136 </div> 86 </div>
137 87
138 -  
139 -  
140 <script> 88 <script>
141 -  
142 $(function(){ 89 $(function(){
143 -  
144 // 关闭左侧栏 90 // 关闭左侧栏
145 -  
146 if (!$('body').hasClass('page-sidebar-closed')) 91 if (!$('body').hasClass('page-sidebar-closed'))
147 -  
148 $('.menu-toggler.sidebar-toggler').click(); 92 $('.menu-toggler.sidebar-toggler').click();
149 93
150 -  
151 $("#date").datetimepicker({ 94 $("#date").datetimepicker({
152 -  
153 format : 'YYYY-MM-DD', 95 format : 'YYYY-MM-DD',
154 -  
155 locale : 'zh-cn' 96 locale : 'zh-cn'
156 -  
157 }); 97 });
  98 +
  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);
  108 + $.get('/basic/lineCode2Name',function(result){
  109 + var data=[];
  110 +
  111 + for(var code in result){
  112 + data.push({id: code, text: result[code]});
  113 + }
  114 + initPinYinSelect2('#line',data,'');
  115 +
  116 + })
158 117
159 - $('#line').select2({ 118 + /* $('#line').select2({
160 ajax: { 119 ajax: {
161 url: '/realSchedule/findLine', 120 url: '/realSchedule/findLine',
162 type: 'post', 121 type: 'post',
@@ -194,80 +153,163 @@ @@ -194,80 +153,163 @@
194 } 153 }
195 } 154 }
196 }); 155 });
  156 + */
197 157
198 var date = ''; 158 var date = '';
199 - 159 + var line ='';
200 $("#query").on("click",function(){ 160 $("#query").on("click",function(){
201 -  
202 - var line = $("#line").val();  
203 - 161 + line = $("#line").val();
204 date = $("#date").val(); 162 date = $("#date").val();
205 $(".hidden").removeClass("hidden"); 163 $(".hidden").removeClass("hidden");
206 -  
207 - $get('/realSchedule/queryUserInfo',{line:line,date:date},function(result){  
208 - 164 + $get('/realSchedule/queryUserInfo',{line:line,date:date,state:2},function(result){
209 // 把数据填充到模版中 165 // 把数据填充到模版中
210 -  
211 var tbodyHtml = template('list_info',{list:result}); 166 var tbodyHtml = template('list_info',{list:result});
212 -  
213 // 把渲染好的模版html文本追加到表格中 167 // 把渲染好的模版html文本追加到表格中
214 -  
215 $('#info tbody').html(tbodyHtml); 168 $('#info tbody').html(tbodyHtml);
216 -  
217 }); 169 });
218 -  
219 }); 170 });
  171 + var type="desc";
  172 + $(".rypx").on("click",function(){
  173 + line = $("#line").val();
  174 + date = $("#date").val();
  175 + $(".hidden").removeClass("hidden");
  176 + $get('/realSchedule/queryUserInfoPx',{line:line,date:date,state:"j_Gh",type:type},function(result){
  177 + if(type=="desc"){
  178 + type ="asc";
  179 + }else{
  180 + type ="desc";
  181 + }
  182 + // 把数据填充到模版中
  183 + var tbodyHtml = template('list_info_px',{list:result});
  184 + // 把渲染好的模版html文本追加到表格中
  185 + $('#info tbody').html(tbodyHtml);
  186 + });
  187 + })
  188 +
  189 + $(".zbhpx").on("click",function(){
  190 + line = $("#line").val();
  191 + date = $("#date").val();
  192 + $(".hidden").removeClass("hidden");
  193 + $get('/realSchedule/queryUserInfoPx',{line:line,date:date,state:"clZbh",type:type},function(result){
  194 + if(type=="desc"){
  195 + type ="asc";
  196 + }else{
  197 + type ="desc";
  198 + }
  199 + // 把数据填充到模版中
  200 + var tbodyHtml = template('list_info_px',{list:result});
  201 + // 把渲染好的模版html文本追加到表格中
  202 + $('#info tbody').html(tbodyHtml);
  203 + });
  204 + })
  205 +
  206 + $(".lppx").on("click",function(){
  207 + line = $("#line").val();
  208 + date = $("#date").val();
  209 + $(".hidden").removeClass("hidden");
  210 + $get('/realSchedule/queryUserInfoPx',{line:line,date:date,state:"lpName",type:type},function(result){
  211 + if(type=="desc"){
  212 + type ="asc";
  213 + }else{
  214 + type ="desc";
  215 + }
  216 + // 把数据填充到模版中
  217 + var tbodyHtml = template('list_info_px',{list:result});
  218 + // 把渲染好的模版html文本追加到表格中
  219 + $('#info tbody').html(tbodyHtml);
  220 + });
  221 + })
220 222
221 var params = new Array(); 223 var params = new Array();
222 var jName = ''; 224 var jName = '';
223 -  
224 $("#info tbody").on("click","tr",function(){ 225 $("#info tbody").on("click","tr",function(){
225 if($(this).children().size() < 2){ 226 if($(this).children().size() < 2){
226 return; 227 return;
227 } 228 }
228 -  
229 229
230 -  
231 $(this).children().each(function(index){ 230 $(this).children().each(function(index){
232 -  
233 params[index] = $(this).text(); 231 params[index] = $(this).text();
234 -  
235 }); 232 });
236 jName = params[0].split("\\")[0]; 233 jName = params[0].split("\\")[0];
237 var id = $("#"+params[1]).val(); 234 var id = $("#"+params[1]).val();
238 - $get('/realSchedule/'+id,null,function(result){ 235 + $get('/realSchedule/MapById',{id:id},function(result){
239 result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD"); 236 result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD");
240 var ludan_1 = template('ludan_1',result); 237 var ludan_1 = template('ludan_1',result);
241 - //var ludan_4 = template('ludan_4',result);  
242 // 把渲染好的模版html文本追加到表格中 238 // 把渲染好的模版html文本追加到表格中
243 $('#forms .ludan_1').html(ludan_1); 239 $('#forms .ludan_1').html(ludan_1);
244 - //$('#forms .ludan_4').html(ludan_4);  
245 }); 240 });
246 -  
247 - $post('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date},function(result){ 241 + $get('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
248 getTime(result); 242 getTime(result);
249 -  
250 var ludan_2 = template('ludan_2',{list:result}); 243 var ludan_2 = template('ludan_2',{list:result});
251 -  
252 // 把渲染好的模版html文本追加到表格中 244 // 把渲染好的模版html文本追加到表格中
253 -  
254 $('#forms .ludan_2').html(ludan_2); 245 $('#forms .ludan_2').html(ludan_2);
255 -  
256 }); 246 });
257 - $post('/realSchedule/findKMBC',{jName:jName,clZbh:params[1],lpName:params[2],date:date},function(result){ 247 + $get('/realSchedule/findKMBC',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
  248 +
  249 + var gl=accAdd(result.ksgl,result.jcclc);
  250 + result.ljgl=gl;
  251 +
  252 + var ljjcc1=accAdd(result.ksgl,result.jcclc);
  253 + //临加进出场公里
  254 + var ljjcc=numSubtr(result.zkslc,ljjcc1);
  255 + result.zlcgl=numSubtr(result.realMileage,ljjcc);
  256 +
258 var ludan_3 = template('ludan_3',result); 257 var ludan_3 = template('ludan_3',result);
259 $('#forms .ludan_3').html(ludan_3); 258 $('#forms .ludan_3').html(ludan_3);
260 }); 259 });
261 260
262 -  
263 }); 261 });
264 262
  263 + var accAdd = function (a, b) {
  264 + var c, d, e;
  265 + try {
  266 + c = a.toString().split(".")[1].length;
  267 + } catch (f) {
  268 + c = 0;
  269 + }
  270 + try {
  271 + d = b.toString().split(".")[1].length;
  272 + } catch (f) {
  273 + d = 0;
  274 + }
  275 + return e = Math.pow(10, Math.max(c, d)), (mul(a, e) + mul(b, e)) / e;
  276 + };
  277 +
  278 + var numSubtr = function (a, b) {
  279 + var c, d, e;
  280 + try {
  281 + c = a.toString().split(".")[1].length;
  282 + } catch (f) {
  283 + c = 0;
  284 + }
  285 + try {
  286 + d = b.toString().split(".")[1].length;
  287 + } catch (f) {
  288 + d = 0;
  289 + }
  290 + return e = Math.pow(10, Math.max(c, d)), (a * e - b * e) / e;
  291 + };
  292 +
  293 + function mul(a, b) {
  294 + var c = 0,
  295 + d = a.toString(),
  296 + e = b.toString();
  297 + try {
  298 + c += d.split(".")[1].length;
  299 + } catch (f) {
  300 + }
  301 + try {
  302 + c += e.split(".")[1].length;
  303 + } catch (f) {
  304 + }
  305 + return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c);
  306 + }
265 $("#export").on("click",function(){ 307 $("#export").on("click",function(){
266 if(params.length < 1){ 308 if(params.length < 1){
267 return; 309 return;
268 } 310 }
269 - $post('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date},function(result){  
270 - window.open("/downloadFile/download?fileName="+jName); 311 + $get('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
  312 + window.open("/downloadFile/download?fileName="+date+"-"+jName+"-"+params[1]+"-"+params[2]+"-行车路单");
271 }); 313 });
272 }); 314 });
273 315
@@ -276,9 +318,17 @@ @@ -276,9 +318,17 @@
276 }); 318 });
277 319
278 $("#exportMore").on("click",function(){ 320 $("#exportMore").on("click",function(){
279 - return;  
280 - $post('/realSchedule/exportWaybillMore',{date:date},function(result){  
281 - window.open("/downloadFile/download?fileName="+jName); 321 + if($("#info tbody tr td").length <= 1)
  322 + return;
  323 + var param = new Array();
  324 + $("#info tbody tr").each(function(index){
  325 + param[index] = new Array();
  326 + $(this).children().each(function(i){
  327 + param[index][i] = $(this).text().split("\\")[0];
  328 + });
  329 + });
  330 + $post('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){
  331 + window.open("/downloadFile/downloadList?fileName="+result.fileName);
282 }); 332 });
283 }); 333 });
284 334
@@ -296,37 +346,35 @@ @@ -296,37 +346,35 @@
296 } 346 }
297 }); 347 });
298 } 348 }
299 -  
300 }); 349 });
301 -  
302 </script> 350 </script>
303 -  
304 <script type="text/html" id="list_info"> 351 <script type="text/html" id="list_info">
305 -  
306 {{each list as obj i}} 352 {{each list as obj i}}
307 -  
308 <tr> 353 <tr>
309 -  
310 <td width="45%">{{obj[4]}}\{{obj[1]}}</td> 354 <td width="45%">{{obj[4]}}\{{obj[1]}}</td>
311 -  
312 <td width="32%">{{obj[2]}}</td> 355 <td width="32%">{{obj[2]}}</td>
313 -  
314 <td width="23%">{{obj[3]}}<input type="hidden" id="{{obj[2]}}" value="{{obj[0]}}"></td> 356 <td width="23%">{{obj[3]}}<input type="hidden" id="{{obj[2]}}" value="{{obj[0]}}"></td>
315 -  
316 </tr> 357 </tr>
317 -  
318 {{/each}} 358 {{/each}}
319 -  
320 {{if list.length == 0}} 359 {{if list.length == 0}}
321 -  
322 <tr> 360 <tr>
323 -  
324 <td colspan="3"><h6 class="muted">没有找到相关数据</h6></td> 361 <td colspan="3"><h6 class="muted">没有找到相关数据</h6></td>
325 -  
326 </tr> 362 </tr>
327 -  
328 {{/if}} 363 {{/if}}
329 - 364 +</script>
  365 +<script type="text/html" id="list_info_px">
  366 + {{each list as obj i}}
  367 + <tr>
  368 + <td width="45%">{{obj.jName}}\{{obj.jGh}}</td>
  369 + <td width="32%">{{obj.clZbh}}</td>
  370 + <td width="23%">{{obj.lpName}}<input type="hidden" id="{{obj.clZbh}}" value="{{obj.id}}"></td>
  371 + </tr>
  372 + {{/each}}
  373 + {{if list.length == 0}}
  374 + <tr>
  375 + <td colspan="3"><h6 class="muted">没有找到相关数据</h6></td>
  376 + </tr>
  377 + {{/if}}
330 </script> 378 </script>
331 <script type="text/html" id="ludan_1"> 379 <script type="text/html" id="ludan_1">
332 <tr> 380 <tr>
@@ -336,11 +384,11 @@ @@ -336,11 +384,11 @@
336 <td colspan="14">路别:{{xlName}} 路牌:{{lpName}} 车号:{{clZbh}} 出场时间:{{fcsjActual}} 到达站名:{{zdzName}} 当班调派:&nbsp; 日期:{{scheduleDate}}</td> 384 <td colspan="14">路别:{{xlName}} 路牌:{{lpName}} 车号:{{clZbh}} 出场时间:{{fcsjActual}} 到达站名:{{zdzName}} 当班调派:&nbsp; 日期:{{scheduleDate}}</td>
337 </tr> 385 </tr>
338 <tr> 386 <tr>
339 - <td colspan="2">出场存油 &nbsp;升</td>  
340 - <td colspan="2">加注油量 &nbsp;升</td>  
341 - <td colspan="2">进场存油 &nbsp;升</td> 387 + <td colspan="2">出场存油 {{ccyl}};升</td>
  388 + <td colspan="2">加注油量 {{jzl}}升</td>
  389 + <td colspan="2">进场存油 {{jcyl}}升</td>
342 <td colspan="4">加注机油 &nbsp;升</td> 390 <td colspan="4">加注机油 &nbsp;升</td>
343 - <td colspan="4">本日耗油 &nbsp;升</td> 391 + <td colspan="4">本日耗油 {{yh}}升</td>
344 </tr> 392 </tr>
345 <tr> 393 <tr>
346 <td rowspan="2">调度章</td> 394 <td rowspan="2">调度章</td>
@@ -388,175 +436,65 @@ @@ -388,175 +436,65 @@
388 <td colspan="1">慢</td> 436 <td colspan="1">慢</td>
389 </tr> 437 </tr>
390 </script> 438 </script>
391 -  
392 <script type="text/html" id="ludan_2"> 439 <script type="text/html" id="ludan_2">
393 -  
394 {{each list as obj i}} 440 {{each list as obj i}}
395 -  
396 <tr> 441 <tr>
397 -  
398 - <td>{{i+1}}</td>  
399 -  
400 - <td>{{obj.jName}}</td>  
401 -  
402 - <td>{{obj.sName}}</td>  
403 - 442 + <td>{{obj.adjustExps}}</td>
  443 + <td>{{obj.jGh}}{{obj.jName}}</td>
  444 + <td>{{if obj.sGh !=null}}
  445 + {{obj.sGh}}{{obj.sName}}
  446 + {{/if}}
  447 + </td>
404 <td>&nbsp;</td> 448 <td>&nbsp;</td>
405 -  
406 <td>{{obj.qdzName}}</td> 449 <td>{{obj.qdzName}}</td>
407 -  
408 <td>{{obj.zdzName}}</td> 450 <td>{{obj.zdzName}}</td>
409 -  
410 <td>{{obj.fcsj}}</td> 451 <td>{{obj.fcsj}}</td>
411 -  
412 <td>{{obj.fcsjActual}}</td> 452 <td>{{obj.fcsjActual}}</td>
413 -  
414 <td>{{obj.zdsj}}</td> 453 <td>{{obj.zdsj}}</td>
415 -  
416 <td>{{obj.zdsjActual}}</td> 454 <td>{{obj.zdsjActual}}</td>
417 -  
418 <td>{{obj.fast}}</td> 455 <td>{{obj.fast}}</td>
419 -  
420 <td>{{obj.slow}}</td> 456 <td>{{obj.slow}}</td>
421 -  
422 <td>{{obj.jhlc}}</td> 457 <td>{{obj.jhlc}}</td>
423 - <td>{{obj.remarks}}</td>  
424 - 458 + <td >
  459 + {{obj.remarks}}
  460 + </td>
425 </tr> 461 </tr>
426 -  
427 {{/each}} 462 {{/each}}
428 {{if list.length == 0}} 463 {{if list.length == 0}}
429 <tr> 464 <tr>
430 <td colspan="14"><h6 class="muted">没有找到相关数据</h6></td> 465 <td colspan="14"><h6 class="muted">没有找到相关数据</h6></td>
431 </tr> 466 </tr>
432 {{/if}} 467 {{/if}}
433 -  
434 </script> 468 </script>
435 <script type="text/html" id="ludan_3"> 469 <script type="text/html" id="ludan_3">
436 <tr> 470 <tr>
437 - <td colspan="2">计划公里</td>  
438 - <td>{{jhlc}}</td>  
439 - <td colspan="2">烂班公里</td>  
440 - <td>{{remMileage}}</td>  
441 - <td colspan="2">临加公里</td>  
442 - <td>{{addMileage}}</td>  
443 - <td colspan="2">营运公里</td>  
444 - <td colspan="3">{{yygl}}</td>  
445 - </tr>  
446 - <tr>  
447 - <td colspan="2">空驶公里</td>  
448 - <td>{{ksgl}}</td>  
449 - <td colspan="2">总公里</td>  
450 - <td>{{realMileage}}</td>  
451 <td colspan="2">计划班次</td> 471 <td colspan="2">计划班次</td>
452 <td>{{jhbc}}</td> 472 <td>{{jhbc}}</td>
  473 + <td colspan="2">计划公里</td>
  474 + <td>{{jhlc}}</td>
453 <td colspan="2">烂班班次</td> 475 <td colspan="2">烂班班次</td>
454 - <td colspan="3">{{cjbc}}</td> 476 + <td>{{cjbc}}</td>
  477 + <td colspan="3"> 烂班公里</td>
  478 + <td colspan="2">{{remMileage}}</td>
455 </tr> 479 </tr>
456 <tr> 480 <tr>
457 - <td colspan="2">加班次</td> 481 + <td colspan="2">加班次</td>
458 <td>{{ljbc}}</td> 482 <td>{{ljbc}}</td>
  483 + <td colspan="2">临加公里</td>
  484 + <td>{{addMileage}}</td>
459 <td colspan="2">实际班次</td> 485 <td colspan="2">实际班次</td>
460 <td>{{sjbc}}</td> 486 <td>{{sjbc}}</td>
  487 + <td colspan="3">营运公里</td>
  488 + <td colspan="2">{{yygl}}</td>
  489 + </tr>
  490 + <tr>
  491 + <td colspan="2">空驶公里</td>
  492 + <td>{{ljgl}}</td>
  493 + <td colspan="2">总公里</td>
  494 + <td>{{zlcgl}}</td>
461 <td colspan="2"></td> 495 <td colspan="2"></td>
462 <td></td> 496 <td></td>
463 - <td colspan="2"></td>  
464 <td colspan="3"></td> 497 <td colspan="3"></td>
  498 + <td colspan="2"></td>
465 </tr> 499 </tr>
466 </script> 500 </script>
467 -<script type="text/html" id="ludan_4">  
468 - <tr>  
469 - <td colspan="12">认真做好终点项目的例保保修工作,杜绝机械火警事故!</td>  
470 - <td>轮胎</td>  
471 - <td>&nbsp;</td>  
472 - </tr>  
473 - <tr>  
474 - <td colspan="3">重点例保项目</td>  
475 - <td>1</td>  
476 - <td>2</td>  
477 - <td>3</td>  
478 - <td colspan="3">重点例保项目</td>  
479 - <td>1</td>  
480 - <td>2</td>  
481 - <td>3</td>  
482 - <td>灭火机</td>  
483 - <td>&nbsp;</td>  
484 - </tr>  
485 - <tr>  
486 - <td colspan="3">各类制动</td>  
487 - <td>&nbsp;</td>  
488 - <td>&nbsp;</td>  
489 - <td>&nbsp;</td>  
490 - <td colspan="3">各类灯光</td>  
491 - <td>&nbsp;</td>  
492 - <td>&nbsp;</td>  
493 - <td>&nbsp;</td>  
494 - <td colspan="2">出场路码表里程</td>  
495 - </tr>  
496 - <tr>  
497 - <td colspan="3">方向机</td>  
498 - <td>&nbsp;</td>  
499 - <td>&nbsp;</td>  
500 - <td>&nbsp;</td>  
501 - <td colspan="3">各类仪表</td>  
502 - <td>&nbsp;</td>  
503 - <td>&nbsp;</td>  
504 - <td>&nbsp;</td>  
505 - <td colspan="2" rowspan="2">&nbsp;</td>  
506 - </tr>  
507 - <tr>  
508 - <td colspan="3">欠压报警器</td>  
509 - <td>&nbsp;</td>  
510 - <td>&nbsp;</td>  
511 - <td>&nbsp;</td>  
512 - <td colspan="3">各类皮带</td>  
513 - <td>&nbsp;</td>  
514 - <td>&nbsp;</td>  
515 - <td>&nbsp;</td>  
516 - </tr>  
517 - <tr>  
518 - <td colspan="3">发动机清洁及响声</td>  
519 - <td>&nbsp;</td>  
520 - <td>&nbsp;</td>  
521 - <td>&nbsp;</td>  
522 - <td colspan="3">油箱及托架</td>  
523 - <td>&nbsp;</td>  
524 - <td>&nbsp;</td>  
525 - <td>&nbsp;</td>  
526 - <td colspan="2">出场路码表里程</td>  
527 - </tr>  
528 - <tr>  
529 - <td colspan="3">地盘响声</td>  
530 - <td>&nbsp;</td>  
531 - <td>&nbsp;</td>  
532 - <td>&nbsp;</td>  
533 - <td colspan="3">轮胎、半轴螺栓螺母</td>  
534 - <td>&nbsp;</td>  
535 - <td>&nbsp;</td>  
536 - <td>&nbsp;</td>  
537 - <td colspan="2" rowspan="3">&nbsp;</td>  
538 - </tr>  
539 - <tr>  
540 - <td colspan="3">化油器及油路</td>  
541 - <td>&nbsp;</td>  
542 - <td>&nbsp;</td>  
543 - <td>&nbsp;</td>  
544 - <td colspan="3">油、电、水、气</td>  
545 - <td>&nbsp;</td>  
546 - <td>&nbsp;</td>  
547 - <td>&nbsp;</td>  
548 - </tr>  
549 - <tr>  
550 - <td colspan="3">进排歧管及排气管</td>  
551 - <td>&nbsp;</td>  
552 - <td>&nbsp;</td>  
553 - <td>&nbsp;</td>  
554 - <td colspan="3">内外车身及附件</td>  
555 - <td>&nbsp;</td>  
556 - <td>&nbsp;</td>  
557 - <td>&nbsp;</td>  
558 - </tr>  
559 - <tr>  
560 - <td colspan="14">1 首次出场,2 复使中途,3 某次进场。√正常,ⓧ报修,×尚未报修</td>  
561 - </tr>  
562 -</script>  
563 \ No newline at end of file 501 \ No newline at end of file
src/main/resources/static/pages/forms/statement/waybillQp.html
@@ -181,13 +181,13 @@ @@ -181,13 +181,13 @@
181 $('#forms .ludan_1').html(ludan_1); 181 $('#forms .ludan_1').html(ludan_1);
182 //$('#forms .ludan_4').html(ludan_4); 182 //$('#forms .ludan_4').html(ludan_4);
183 }); 183 });
184 - $post('/realSchedule/queryListWaybillQp',{clZbh:params[0],date:date,line:line},function(result){ 184 + $get('/realSchedule/queryListWaybillQp',{clZbh:params[0],date:date,line:line},function(result){
185 getTime(result); 185 getTime(result);
186 var ludan_2 = template('ludan_2',{list:result}); 186 var ludan_2 = template('ludan_2',{list:result});
187 // 把渲染好的模版html文本追加到表格中 187 // 把渲染好的模版html文本追加到表格中
188 $('#forms .ludan_2').html(ludan_2); 188 $('#forms .ludan_2').html(ludan_2);
189 }); 189 });
190 - $post('/realSchedule/findKMBCQp',{clZbh:params[0],date:date,line:line},function(result){ 190 + $get('/realSchedule/findKMBCQp',{clZbh:params[0],date:date,line:line},function(result){
191 console.log(result); 191 console.log(result);
192 var ludan_3 = template('ludan_3',{map:result}); 192 var ludan_3 = template('ludan_3',{map:result});
193 $('#forms .ludan_3').html(ludan_3); 193 $('#forms .ludan_3').html(ludan_3);
@@ -199,7 +199,7 @@ @@ -199,7 +199,7 @@
199 if(params.length < 1){ 199 if(params.length < 1){
200 return; 200 return;
201 } 201 }
202 - $post('/realSchedule/exportWaybillQp',{clZbh:params[0],date:date,line:line},function(result){ 202 + $get('/realSchedule/exportWaybillQp',{clZbh:params[0],date:date,line:line},function(result){
203 var fileName=date+"-"+params[0]+"-行车路单" 203 var fileName=date+"-"+params[0]+"-行车路单"
204 window.open("/downloadFile/download?fileName="+fileName); 204 window.open("/downloadFile/download?fileName="+fileName);
205 // window.open("/downloadFile/download?fileName="+encodeURIComponent(encodeURIComponent(fileName))); 205 // window.open("/downloadFile/download?fileName="+encodeURIComponent(encodeURIComponent(fileName)));
src/main/resources/static/pages/mforms/changetochanges/changetochange.html
@@ -59,6 +59,7 @@ @@ -59,6 +59,7 @@
59 <span class="item-label" style="width: 80px;">线路: </span> <select 59 <span class="item-label" style="width: 80px;">线路: </span> <select
60 class="form-control" name="line" id="line" style="width: 180px;"></select> 60 class="form-control" name="line" id="line" style="width: 180px;"></select>
61 </div> 61 </div>
  62 + <div style="margin-top: 10px"></div>
62 <div style="display: inline-block; margin-left: 15px;"> 63 <div style="display: inline-block; margin-left: 15px;">
63 <span class="item-label" style="width: 80px;">开始时间: </span> <input 64 <span class="item-label" style="width: 80px;">开始时间: </span> <input
64 class="form-control" type="text" id="startDate" 65 class="form-control" type="text" id="startDate"
src/main/resources/static/pages/mforms/shifdays/shifday.html
@@ -156,15 +156,19 @@ $(function(){ @@ -156,15 +156,19 @@ $(function(){
156 var date = $("#date").val(); 156 var date = $("#date").val();
157 var gsdmShif = $("#gsdmShif").val(); 157 var gsdmShif = $("#gsdmShif").val();
158 var fgsdmShif = $("#fgsdmShif").val(); 158 var fgsdmShif = $("#fgsdmShif").val();
159 - $post('/mcy_forms/shifday',{gsdmShif:gsdmShif,fgsdmShif:fgsdmShif, line:line,date:date},function(result){  
160 - $.each(result, function(i, obj) {  
161 - obj.requestType = reqCodeMap[obj.requestType];  
162 - });  
163 - // 把数据填充到模版中  
164 - var tbodyHtml = template('shifday',{list:result});  
165 - // 把渲染好的模版html文本追加到表格中  
166 - $('#forms tbody').html(tbodyHtml);  
167 - }); 159 + if(date=="" || date ==null){
  160 + layer.msg('请选择日期.');
  161 + }else{
  162 + $post('/mcy_forms/shifday',{gsdmShif:gsdmShif,fgsdmShif:fgsdmShif, line:line,date:date},function(result){
  163 + $.each(result, function(i, obj) {
  164 + obj.requestType = reqCodeMap[obj.requestType];
  165 + });
  166 + // 把数据填充到模版中
  167 + var tbodyHtml = template('shifday',{list:result});
  168 + // 把渲染好的模版html文本追加到表格中
  169 + $('#forms tbody').html(tbodyHtml);
  170 + });
  171 + }
168 }); 172 });
169 173
170 $("#export").on("click",function(){ 174 $("#export").on("click",function(){
src/main/resources/static/pages/mforms/shiftuehiclemanths/shiftuehiclemanth.html
@@ -40,6 +40,9 @@ @@ -40,6 +40,9 @@
40 <span class="item-label" style="width: 80px;">线路: </span> 40 <span class="item-label" style="width: 80px;">线路: </span>
41 <select class="form-control" name="line" id="line" style="width: 136px;"></select> 41 <select class="form-control" name="line" id="line" style="width: 136px;"></select>
42 </div> 42 </div>
  43 + <div style="margin-top: 10px">
  44 +
  45 + </div>
43 <div style="display: inline-block;margin-left: 15px;"> 46 <div style="display: inline-block;margin-left: 15px;">
44 <span class="item-label" style="width: 80px;">开始时间: </span> 47 <span class="item-label" style="width: 80px;">开始时间: </span>
45 <input class="form-control" type="text" id="startDate" style="width: 120px;"/> 48 <input class="form-control" type="text" id="startDate" style="width: 120px;"/>
src/main/resources/static/pages/mforms/singledatas/singledata.html
@@ -40,6 +40,7 @@ @@ -40,6 +40,7 @@
40 <span class="item-label" style="width: 80px;">线路: </span> 40 <span class="item-label" style="width: 80px;">线路: </span>
41 <select class="form-control" name="line" id="line" style="width: 136px;"></select> 41 <select class="form-control" name="line" id="line" style="width: 136px;"></select>
42 </div> 42 </div>
  43 + <div style="margin-top: 10px"></div>
43 <div style="display: inline-block;margin-left: 15px;"> 44 <div style="display: inline-block;margin-left: 15px;">
44 <span class="item-label" style="width: 80px;">开始时间: </span> 45 <span class="item-label" style="width: 80px;">开始时间: </span>
45 <input class="form-control" type="text" id="startDate" style="width: 120px;"/> 46 <input class="form-control" type="text" id="startDate" style="width: 120px;"/>
src/main/resources/static/pages/mforms/turnoutrates/turnoutrate.html
@@ -183,7 +183,9 @@ @@ -183,7 +183,9 @@
183 gsdmTurn=$("#gsdmTurn").val(); 183 gsdmTurn=$("#gsdmTurn").val();
184 fgsdmTurn=$("#fgsdmTurn").val(); 184 fgsdmTurn=$("#fgsdmTurn").val();
185 if(startDate1!=''&&endDate1!=''){ 185 if(startDate1!=''&&endDate1!=''){
186 - $post('/mcy_forms/turnoutrate',{ gsdmTurn:gsdmTurn,fgsdmTurn:fgsdmTurn, line:line,startDate:$("#startDate").val(),endDate:$("#endDate").val(),type:'query'},function(result){ 186 +// $post('/mcy_forms/turnoutrate',
  187 +// { gsdmTurn:gsdmTurn,fgsdmTurn:fgsdmTurn, line:line,startDate:$("#startDate").val(),endDate:$("#endDate").val(),type:'query'},function(result){
  188 + var result=[];
187 // 把数据填充到模版中 189 // 把数据填充到模版中
188 var tbodyHtml = template('turnoutrate',{list:result}); 190 var tbodyHtml = template('turnoutrate',{list:result});
189 // 把渲染好的模版html文本追加到表格中 191 // 把渲染好的模版html文本追加到表格中
@@ -235,7 +237,7 @@ @@ -235,7 +237,7 @@
235 obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss"); 237 obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss");
236 }); 238 });
237 239
238 - }) 240 +// })
239 241
240 }else{ 242 }else{
241 alert("请选择时间范围!"); 243 alert("请选择时间范围!");
src/main/resources/static/pages/mforms/waybilldays/waybillday.html
@@ -141,16 +141,19 @@ @@ -141,16 +141,19 @@
141 date = $("#date").val(); 141 date = $("#date").val();
142 gsdmWaybillday=$("#gsdmWaybillday").val(); 142 gsdmWaybillday=$("#gsdmWaybillday").val();
143 fgsdmWaybillday = $("#fgsdmWaybillday").val(); 143 fgsdmWaybillday = $("#fgsdmWaybillday").val();
144 -  
145 - $post('/mcy_forms/waybillday',{gsdmWaybillday:gsdmWaybillday,fgsdmWaybillday:fgsdmWaybillday, line:line,date:$("#date").val(),type:'query'},function(result){  
146 - $.each(result, function(i, obj) {  
147 - obj.requestType = reqCodeMap[obj.requestType];  
148 - });  
149 - // 把数据填充到模版中  
150 - var tbodyHtml = template('waybillday',{list:result});  
151 - // 把渲染好的模版html文本追加到表格中  
152 - $('#forms tbody').html(tbodyHtml);  
153 - }); 144 + if(date=="" || date ==null){
  145 + layer.msg('请选择日期.');
  146 + }else{
  147 + $post('/mcy_forms/waybillday',{gsdmWaybillday:gsdmWaybillday,fgsdmWaybillday:fgsdmWaybillday, line:line,date:date,type:'query'},function(result){
  148 + $.each(result, function(i, obj) {
  149 + obj.requestType = reqCodeMap[obj.requestType];
  150 + });
  151 + // 把数据填充到模版中
  152 + var tbodyHtml = template('waybillday',{list:result});
  153 + // 把渲染好的模版html文本追加到表格中
  154 + $('#forms tbody').html(tbodyHtml);
  155 + });
  156 + }
154 }); 157 });
155 158
156 $("#export").on("click",function(){ 159 $("#export").on("click",function(){
src/main/resources/static/pages/oil/checkJyryList.html
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 class="caption-subject font-dark sbold uppercase">加油人员不符</span> 20 class="caption-subject font-dark sbold uppercase">加油人员不符</span>
21 </div> 21 </div>
22 <div class="actions"> 22 <div class="actions">
23 - <a class="btn btn-circle blue" href="cylAdd.html" data-pjax><i class="fa fa-plus"></i> 添加</a> 23 +<!-- <a class="btn btn-circle blue" href="cylAdd.html" data-pjax><i class="fa fa-plus"></i> 添加</a> -->
24 <button type="button" class="btn btn-circle blue" id="saveButton"><i class="fa fa-minus-square"></i> 保存</button> 24 <button type="button" class="btn btn-circle blue" id="saveButton"><i class="fa fa-minus-square"></i> 保存</button>
25 <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> --> 25 <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> -->
26 <!-- <div class="btn-group"> 26 <!-- <div class="btn-group">
src/main/resources/static/pages/oil/list_ph.html
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 </div> 21 </div>
22 <div class="actions"> 22 <div class="actions">
23 <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加</a> 23 <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加</a>
24 - <!-- <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button> --> 24 + <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button>
25 <button type="button" class="btn btn-circle blue" id="sortButton"><i class="fa fa-minus-square"></i> 25 <button type="button" class="btn btn-circle blue" id="sortButton"><i class="fa fa-minus-square"></i>
26 拆分/保存 26 拆分/保存
27 </button> 27 </button>
@@ -58,51 +58,99 @@ @@ -58,51 +58,99 @@
58 id="datatable_ylb"> 58 id="datatable_ylb">
59 <thead> 59 <thead>
60 <tr role="row" class="filter"> 60 <tr role="row" class="filter">
61 - <td> 公司:</td>  
62 - <td colspan="2">  
63 -  
64 - <select class="form-control" name="ssgsdm_like" id="ylbListGsdmId" ></select>  
65 -  
66 - </td>  
67 - <td>  
68 - 分公司:  
69 - </td>  
70 - <td colspan="2">  
71 -  
72 - <select class="form-control" name="fgsdm_like" id="ylbListFgsdmId" ></select>  
73 - </td>  
74 -  
75 - <td>  
76 - 日期:  
77 - </td>  
78 - <td>  
79 - <input type="text" style="width: 80px" name="rq" id="rq"/>  
80 - </td>  
81 - <td >  
82 - 线路:  
83 - </td>  
84 - <td colspan="3">  
85 - <select class="form-control" name="xlbm_eq" id="xlbm" style="width: 120px;"></select>  
86 - <input type="hidden" name="xlbm_like" value=""/>  
87 - &nbsp;  
88 - </td>  
89 - <td >  
90 - 内部编码:  
91 - </td>  
92 - <td colspan="3">  
93 - <select class="form-control" name="nbbm_eq" id="nbbm" style="width: 120px;"></select>  
94 - </td>  
95 - <td colspan="4">  
96 - <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px">  
97 - <i class="fa fa-search"></i> 搜索  
98 - </button> 61 + <td colspan="2">
  62 + <div style="float: right; " >&nbsp;公司&nbsp;</div>
  63 + </td>
  64 + <td colspan="3">
  65 + <div style="float: left;width: 150px">
  66 + <select class="form-control" name="ssgsdm_like"
  67 + id="ylbListGsdmId"></select>
  68 + </div>
  69 + </td>
  70 + <td colspan="2">
  71 + <div style="float: right; " >&nbsp;分公司&nbsp;</div>
  72 + </td>
  73 + <td colspan="4">
  74 + <div style="float: left;">
  75 + <select class="form-control" name="fgsdm_like"
  76 + id="ylbListFgsdmId" style="width: 150px"></select>
  77 + </div>
  78 + </td>
  79 + <td >
  80 + <div style="float: right; ">日期</div>
  81 + </td>
  82 + <td colspan="3">
  83 + <div style="float: left;">
  84 + <input type="text" style="width: 120px" name="rq" id="rq" />
  85 + </div>
  86 + </td>
  87 + <td rowspan="2" colspan="2">
  88 + <div style="float: left;">
  89 + &nbsp;<button
  90 + class="btn btn-sm green btn-outline filter-submit margin-bottom"
  91 + style="margin-right: 0px">
  92 + <i class="fa fa-search"></i> 搜索
  93 + </button> <!-- <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> -->
  94 + <!-- <i class="fa fa-times"></i> 重置 -->
  95 + <!-- </button> -->
99 96
100 - <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px">  
101 - <i class="fa fa-times"></i> 重置  
102 - </button>  
103 -  
104 - </td> 97 + </div>
  98 + </td>
105 </tr> 99 </tr>
  100 + <tr class="filter2">
  101 + <td colspan="2">
  102 + <div style="float: right; ">&nbsp;线路</div>
  103 + </td>
  104 + <td colspan="3">
  105 + <div style="float: left;">
  106 + <select class="form-control" name="xlbm_like" id="xlbm"
  107 + style="width: 150px;"></select>
  108 + </div>
  109 + </td>
  110 + <td colspan="2">
  111 + <div style="float: right;">&nbsp;内部编码</div>
  112 + </td>
  113 + <td colspan="4">
  114 + <div style="float: left;">
  115 + <select class="form-control" name="nbbm_eq" id="nbbm"
  116 + style="width: 120px;"></select>
  117 + </div>
  118 + <div style="float: left;">
  119 + <button class="btn btn-sm #000 btn-outline filter-cancel"
  120 + style="margin-right: 0px">
  121 + <i class="fa fa-times"></i>
  122 + </button>
  123 + </div>
  124 + </td>
  125 + <td >
  126 + <div style="float: right;">
  127 + 类型
  128 + </div>
  129 + </td>
  130 + <td colspan="3">
  131 + <div style="float: left;">
  132 + <select class="form-control" name="sxtj">
  133 + <option value="0">全部</option>
  134 + <option value="1">一车一单</option>
  135 + <option value="2">一车多单</option>
  136 + </select>
  137 + </div>
  138 +
  139 + </td>
  140 + </tr>
  141 + <tr>
  142 + <td colspan="17">
  143 + <div style="float: left;">
  144 + 总计
  145 + &nbsp;&nbsp;
  146 + 加注量:&nbsp;<label id="sumJzl"></label>
  147 + &nbsp;&nbsp;
  148 + 耗油量:&nbsp;<label id="sumYh"></label>
  149 + &nbsp;&nbsp;
  150 + 损耗量:&nbsp;<label id="sumSh"></label>
  151 + </div>
  152 + </td>
  153 + </tr>
106 <tr role="row" class="heading"> 154 <tr role="row" class="heading">
107 <th width="2%">#</th> 155 <th width="2%">#</th>
108 <th width="8%">日期</th> 156 <th width="8%">日期</th>
@@ -111,8 +159,6 @@ @@ -111,8 +159,6 @@
111 <th width="5%">自编号</th> 159 <th width="5%">自编号</th>
112 <th width="6%">驾驶员</th> 160 <th width="6%">驾驶员</th>
113 <th width="4%">加油量</th> 161 <th width="4%">加油量</th>
114 - <th width="5%">出场公里</th>  
115 - <th width="4%">进场公里</th>  
116 <th width="4%">出场存油</th> 162 <th width="4%">出场存油</th>
117 <th width="4%">进场存油</th> 163 <th width="4%">进场存油</th>
118 <th width="5%">油耗</th> 164 <th width="5%">油耗</th>
@@ -123,7 +169,7 @@ @@ -123,7 +169,7 @@
123 <th width="5%">当日总里程</th> 169 <th width="5%">当日总里程</th>
124 <th width="5%">数据类型</th> 170 <th width="5%">数据类型</th>
125 <th width="5%">百公里油耗</th> 171 <th width="5%">百公里油耗</th>
126 - <!-- <th width="5%">操作</th> --> 172 +<!-- <th width="5%">操作</th> -->
127 </tr> 173 </tr>
128 </thead> 174 </thead>
129 <tbody></tbody> 175 <tbody></tbody>
@@ -163,12 +209,6 @@ @@ -163,12 +209,6 @@
163 {{obj.jzl}} 209 {{obj.jzl}}
164 </td> 210 </td>
165 <td> 211 <td>
166 - {{obj.czlc}}  
167 - </td>  
168 - <td>  
169 - {{obj.jzlc}}  
170 - </td>  
171 - <td>  
172 {{obj.czyl}} 212 {{obj.czyl}}
173 </td> 213 </td>
174 <td> 214 <td>
@@ -186,10 +226,22 @@ @@ -186,10 +226,22 @@
186 {{obj.ns}} 226 {{obj.ns}}
187 </td> 227 </td>
188 <td> 228 <td>
189 - {{obj.shyy}} 229 + <select data-id="{{obj.id}}" class="in_carpark_shyy">
  230 + <option value='0' {{if obj.shyy==0}} selected = 'selected' {{/if}}>请选择</option>
  231 + <option value='1' {{if obj.shyy==1}} selected = 'selected' {{/if}}>票务用油</option>
  232 + <option value='2' {{if obj.shyy==2}} selected = 'selected' {{/if}}>保养用油</option>
  233 + <option value='3' {{if obj.shyy==3}} selected = 'selected' {{/if}}>报废车用油</option>
  234 + <option value='4' {{if obj.shyy==4}} selected = 'selected' {{/if}}>其它用油</option>
  235 + <option value='5' {{if obj.shyy==5}} selected = 'selected' {{/if}}>人保部</option>
  236 + <option value='6' {{if obj.shyy==6}} selected = 'selected' {{/if}}>车队</option>
  237 + <option value='7' {{if obj.shyy==7}} selected = 'selected' {{/if}}>车间(高保)</option>
  238 + <option value='8' {{if obj.shyy==8}} selected = 'selected' {{/if}}>车间(小修)</option>
  239 + </select>
190 </td> 240 </td>
191 <td> 241 <td>
192 - {{obj.sh}} 242 + <a data-id="{{obj.id}}" href="javascript:;" class="in_carpark_shyl">
  243 + {{obj.sh}}
  244 + </a>
193 </td> 245 </td>
194 <td> 246 <td>
195 {{obj.zlc}} 247 {{obj.zlc}}
@@ -200,14 +252,11 @@ @@ -200,14 +252,11 @@
200 <td> 252 <td>
201 {{obj.bglyh}} 253 {{obj.bglyh}}
202 </td> 254 </td>
203 - <td>  
204 - <!--<a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a>-->  
205 - </td>  
206 </tr> 255 </tr>
207 {{/each}} 256 {{/each}}
208 {{if list.length == 0}} 257 {{if list.length == 0}}
209 <tr> 258 <tr>
210 - <td colspan=20><h6 class="muted">没有找到相关数据</h6></td> 259 + <td colspan=17><h6 class="muted">没有找到相关数据</h6></td>
211 </tr> 260 </tr>
212 {{/if}} 261 {{/if}}
213 </script> 262 </script>
@@ -220,18 +269,7 @@ @@ -220,18 +269,7 @@
220 $("#checkYl").on('click', function () { 269 $("#checkYl").on('click', function () {
221 console.log("核对加注量"); 270 console.log("核对加注量");
222 if ($("#rq").val() != "") { 271 if ($("#rq").val() != "") {
223 - var cells = $('tr.filter')[0].cells  
224 - , params = {}  
225 - , name;  
226 - $.each(cells, function (i, cell) {  
227 - var items = $('input,select', cell);  
228 - for (var j = 0, item; item = items[j++];) {  
229 - name = $(item).attr('name');  
230 - if (name) {  
231 - params[name] = $(item).val();  
232 - }  
233 - }  
234 - }); 272 + var params=getParamsList();
235 var i = layer.load(2); 273 var i = layer.load(2);
236 $get('/ylb/checkYl', params, function () { 274 $get('/ylb/checkYl', params, function () {
237 layer.close(i); 275 layer.close(i);
@@ -246,18 +284,7 @@ @@ -246,18 +284,7 @@
246 $("#outAndIn").on('click', function () { 284 $("#outAndIn").on('click', function () {
247 console.log("进场油量等于出场油量"); 285 console.log("进场油量等于出场油量");
248 if ($("#rq").val() != "") { 286 if ($("#rq").val() != "") {
249 - var cells = $('tr.filter')[0].cells  
250 - , params = {}  
251 - , name;  
252 - $.each(cells, function (i, cell) {  
253 - var items = $('input,select', cell);  
254 - for (var j = 0, item; item = items[j++];) {  
255 - name = $(item).attr('name');  
256 - if (name) {  
257 - params[name] = $(item).val();  
258 - }  
259 - }  
260 - }); 287 + var params=getParamsList();
261 var i = layer.load(2); 288 var i = layer.load(2);
262 $get('/ylb/outAndIn', params, function () { 289 $get('/ylb/outAndIn', params, function () {
263 layer.close(i); 290 layer.close(i);
@@ -266,7 +293,8 @@ @@ -266,7 +293,8 @@
266 } else { 293 } else {
267 layer.msg('请选择日期.'); 294 layer.msg('请选择日期.');
268 } 295 }
269 - }) 296 + });
  297 +
270 //拆分 298 //拆分
271 $("#sortButton").on('click', function () { 299 $("#sortButton").on('click', function () {
272 if ($("#rq").val() != "") { 300 if ($("#rq").val() != "") {
@@ -277,27 +305,20 @@ @@ -277,27 +305,20 @@
277 } else { 305 } else {
278 //获取输入的进场存油 306 //获取输入的进场存油
279 var jzyl = $('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').html(); 307 var jzyl = $('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').html();
  308 + var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').html();
  309 + var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val();
280 // $("#jzyl" + id).html(); 310 // $("#jzyl" + id).html();
281 var params = {}; 311 var params = {};
282 params['jzyl'] = jzyl; 312 params['jzyl'] = jzyl;
  313 + params['sh'] =sh;
  314 + params['shyy']=shyy;
283 params['id'] = id; 315 params['id'] = id;
284 - var i = layer.load(2); 316 + var i = layer.load(2);
285 $get('/ylb/sort', params, function () { 317 $get('/ylb/sort', params, function () {
286 layer.close(i); 318 layer.close(i);
287 - var cells = $('tr.filter')[0].cells  
288 - , params1 = {}  
289 - , name;  
290 - $.each(cells, function (i, cell) {  
291 - var items = $('input,select', cell);  
292 - for (var j = 0, item; item = items[j++];) {  
293 - name = $(item).attr('name');  
294 - if (name) {  
295 - params1[name] = $(item).val();  
296 - }  
297 - }  
298 - }); 319 + var params1 =getParamsList();
299 jsDoQuery(params1, true); 320 jsDoQuery(params1, true);
300 - }); 321 + });
301 322
302 } 323 }
303 } else { 324 } else {
@@ -308,18 +329,8 @@ @@ -308,18 +329,8 @@
308 $("#obtain").on('click', function () { 329 $("#obtain").on('click', function () {
309 console.log("获取加存"); 330 console.log("获取加存");
310 if ($("#rq").val() != "") { 331 if ($("#rq").val() != "") {
311 - var cells = $('tr.filter')[0].cells  
312 - , params = {}  
313 - , name;  
314 - $.each(cells, function (i, cell) {  
315 - var items = $('input,select', cell);  
316 - for (var j = 0, item; item = items[j++];) {  
317 - name = $(item).attr('name');  
318 - if (name) {  
319 - params[name] = $(item).val();  
320 - }  
321 - }  
322 - }); 332 + var params =getParamsList();
  333 +
323 var i = layer.load(2); 334 var i = layer.load(2);
324 $get('/ylb/obtain', params, function () { 335 $get('/ylb/obtain', params, function () {
325 layer.close(i); 336 layer.close(i);
@@ -342,8 +353,8 @@ @@ -342,8 +353,8 @@
342 } 353 }
343 354
344 //重置 355 //重置
345 - $('tr.filter .filter-cancel').on('click', function () {  
346 - $('tr.filter input, select').val('').change(); 356 + $('tr.filter2 .filter-cancel').on('click', function () {
  357 + $('tr.filter2 , #nbbm').val('').change();
347 }); 358 });
348 359
349 //提交 360 //提交
@@ -355,23 +366,39 @@ @@ -355,23 +366,39 @@
355 }else if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){ 366 }else if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){
356 layer.msg('请选择公司和分公司.'); 367 layer.msg('请选择公司和分公司.');
357 }else { 368 }else {
358 - var cells = $('tr.filter')[0].cells  
359 - , params = {}  
360 - , name;  
361 - $.each(cells, function (i, cell) {  
362 - var items = $('input,select', cell);  
363 - for (var j = 0, item; item = items[j++];) {  
364 - name = $(item).attr('name');  
365 - if (name) {  
366 - params[name] = $(item).val();  
367 - }  
368 - }  
369 - }); 369 + var params = getParamsList();
  370 +
  371 +
370 page = 0; 372 page = 0;
371 jsDoQuery(params, true); 373 jsDoQuery(params, true);
372 } 374 }
373 }); 375 });
374 376
  377 + function getParamsList(){
  378 + var cells = $('tr.filter')[0].cells
  379 + , cells1 = $('tr.filter2')[0].cells,params = {}
  380 + , name;
  381 + $.each(cells, function (i, cell) {
  382 + var items = $('input,select', cell);
  383 + for (var j = 0, item; item = items[j++];) {
  384 + name = $(item).attr('name');
  385 + if (name) {
  386 + params[name] = $(item).val();
  387 + }
  388 + }
  389 + });
  390 + $.each(cells1, function (i, cell) {
  391 + var items = $('input,select', cell);
  392 + for (var j = 0, item; item = items[j++];) {
  393 + name = $(item).attr('name');
  394 + if (name) {
  395 + params[name] = $(item).val();
  396 + }
  397 + }
  398 + });
  399 +
  400 + return params;
  401 + }
375 402
376 // var gsqxdm=""; 403 // var gsqxdm="";
377 404
@@ -444,13 +471,15 @@ @@ -444,13 +471,15 @@
444 params['fgsdm_in']=fgsqx1; 471 params['fgsdm_in']=fgsqx1;
445 } 472 }
446 } */ 473 } */
447 - var i = layer.load(2); 474 +
  475 + var l = layer.load(2);
448 $get('/ylb', params, function (data) { 476 $get('/ylb', params, function (data) {
  477 +
449 $.each(data.content, function (i, obj) { 478 $.each(data.content, function (i, obj) {
450 obj.rq = moment(obj.rq).format("YYYY-MM-DD"); 479 obj.rq = moment(obj.rq).format("YYYY-MM-DD");
451 }); 480 });
452 var bodyHtm = template('ylb_list_temp', {list: data.content}); 481 var bodyHtm = template('ylb_list_temp', {list: data.content});
453 - 482 +
454 $('#datatable_ylb tbody').html(bodyHtm) 483 $('#datatable_ylb tbody').html(bodyHtm)
455 .find('.icheck').iCheck(icheckOptions) 484 .find('.icheck').iCheck(icheckOptions)
456 .on('ifChanged', iCheckChange); 485 .on('ifChanged', iCheckChange);
@@ -459,9 +488,16 @@ @@ -459,9 +488,16 @@
459 initPagination = true; 488 initPagination = true;
460 showPagination(data); 489 showPagination(data);
461 } 490 }
462 - layer.close(i);  
463 - 491 + layer.close(l);
  492 + $get('/ylb/sumYlb',params,function(returns){
  493 + console.log(returns);
  494 + console.log(returns.jzl);
  495 + $("#sumJzl").html(returns.jzl);
  496 + $("#sumYh").html(returns.yh);
  497 + $("#sumSh").html(returns.sh);
  498 + });
464 startOptJzylLink($('#ll_oil_list .in_carpark_jzyl')); 499 startOptJzylLink($('#ll_oil_list .in_carpark_jzyl'));
  500 + startOptShylLink($('#ll_oil_list .in_carpark_shyl'));
465 }); 501 });
466 } 502 }
467 503
@@ -487,6 +523,27 @@ @@ -487,6 +523,27 @@
487 }); 523 });
488 } 524 }
489 525
  526 + //改变状态
  527 + function startOptShylLink(es) {
  528 + es.editable({
  529 + type: 'text',
  530 + placement: 'right',
  531 + width: 100,
  532 + display: false,
  533 + validate: function (value) {
  534 + if (!value)
  535 + return '值不能为空!';
  536 + if (isNaN(value))
  537 + return '只能为数字!';
  538 + if (value < 0)
  539 + return '值不能小于0!';
  540 + },
  541 + inputclass: 'form-control input-medium input-edtable-sm'
  542 + })
  543 + .on('save', function (e, params) {
  544 + $(this).text(params.newValue);
  545 + });
  546 + }
490 function iCheckChange() { 547 function iCheckChange() {
491 var tr = $(this).parents('tr'); 548 var tr = $(this).parents('tr');
492 if (this.checked) 549 if (this.checked)
@@ -517,18 +574,7 @@ @@ -517,18 +574,7 @@
517 return; 574 return;
518 } 575 }
519 576
520 - var cells = $('tr.filter')[0].cells  
521 - , params = {}  
522 - , name;  
523 - $.each(cells, function (i, cell) {  
524 - var items = $('input,select', cell);  
525 - for (var j = 0, item; item = items[j++];) {  
526 - name = $(item).attr('name');  
527 - if (name) {  
528 - params[name] = $(item).val();  
529 - }  
530 - }  
531 - }); 577 + var params=getParamsList();
532 page = num - 1; 578 page = num - 1;
533 jsDoQuery(params, true); 579 jsDoQuery(params, true);
534 } 580 }
@@ -538,27 +584,28 @@ @@ -538,27 +584,28 @@
538 584
539 //删除 585 //删除
540 $('#removeButton').on('click', function () { 586 $('#removeButton').on('click', function () {
541 - if ($(this).attr('disabled'))  
542 - return;  
543 -  
544 - var id = $('input.icheck:checked').data('id');  
545 - removeConfirm('确定要删除选中的数据?', '/resource/' + id, function () {  
546 - $('tr.filter .filter-submit').click();  
547 - }); 587 + var id = $('input.icheck:checked').data('id');
  588 + if (typeof(id) == 'undefined') {
  589 + layer.msg("请选择要删除的数据");
  590 + }else{
  591 + removeConfirm('确定要删除选中的数据?', '/ylb/' + id, function () {
  592 + var params=getParamsList();
  593 + jsDoQuery(params, true);
  594 + });
  595 + }
548 }); 596 });
549 597
550 //搜索线路 598 //搜索线路
551 $.get('/basic/lineCode2Name',function(result){ 599 $.get('/basic/lineCode2Name',function(result){
552 var data=[]; 600 var data=[];
553 -// data.push({id: " ", text: "全部线路"}); 601 + data.push({id: " ", text: "全部线路"});
554 for(var code in result){ 602 for(var code in result){
555 data.push({id: code, text: result[code]}); 603 data.push({id: code, text: result[code]});
556 } 604 }
557 - console.log(data);  
558 initPinYinSelect2('#xlbm',data,''); 605 initPinYinSelect2('#xlbm',data,'');
559 606
560 }) 607 })
561 - 608 +
562 $('#nbbm').select2({ 609 $('#nbbm').select2({
563 placeholder: '搜索车辆...', 610 placeholder: '搜索车辆...',
564 ajax: { 611 ajax: {
@@ -599,28 +646,14 @@ @@ -599,28 +646,14 @@
599 return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>'; 646 return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
600 } 647 }
601 } 648 }
602 - })  
603 - 649 + });
604 650
605 //导出 651 //导出
606 652
607 $("#export").on("click", function () { 653 $("#export").on("click", function () {
608 if ($("#rq").val() != "") { 654 if ($("#rq").val() != "") {
609 - var cells = $('tr.filter')[0].cells  
610 - , params = {}  
611 - , name;  
612 - $.each(cells, function (i, cell) {  
613 - var items = $('input,select', cell);  
614 - for (var j = 0, item; item = items[j++];) {  
615 - name = $(item).attr('name');  
616 - if (name) {  
617 - params[name] = $(item).val();  
618 - }  
619 - }  
620 - });  
621 - console.log(params); 655 + var params=getParamsList();
622 $post('/ylb/listExport', params, function (result) { 656 $post('/ylb/listExport', params, function (result) {
623 - console.log(result);  
624 window.open("/downloadFile/download?fileName=进出场存油量" + moment($("#rq").val()).format("YYYYMMDD")); 657 window.open("/downloadFile/download?fileName=进出场存油量" + moment($("#rq").val()).format("YYYYMMDD"));
625 }); 658 });
626 } else { 659 } else {
src/main/resources/static/pages/scheduleApp/module/core/busConfig/edit.html
@@ -135,11 +135,11 @@ @@ -135,11 +135,11 @@
135 <div class="form-group has-success has-feedback"> 135 <div class="form-group has-success has-feedback">
136 <label class="col-md-2 control-label">停车场*:</label> 136 <label class="col-md-2 control-label">停车场*:</label>
137 <div class="col-md-3"> 137 <div class="col-md-3">
138 - <sa-Select5 name="tcd" 138 + <sa-Select5 name="tcc"
139 model="ctrl.busConfigForSave" 139 model="ctrl.busConfigForSave"
140 - cmaps="{'tcd': 'parkName'}"  
141 - dcname="tcd"  
142 - icname="parkName" 140 + cmaps="{'tcc.id': 'id', 'tcd': 'parkName'}"
  141 + dcname="tcc.id"
  142 + icname="id"
143 dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'tcc' } | json }}" 143 dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'tcc' } | json }}"
144 iterobjname="item" 144 iterobjname="item"
145 iterobjexp="item.parkName" 145 iterobjexp="item.parkName"
@@ -149,7 +149,7 @@ @@ -149,7 +149,7 @@
149 </sa-Select5> 149 </sa-Select5>
150 </div> 150 </div>
151 <!-- 隐藏块,显示验证信息 --> 151 <!-- 隐藏块,显示验证信息 -->
152 - <div class="alert alert-danger well-sm" ng-show="myForm.tcd.$error.required"> 152 + <div class="alert alert-danger well-sm" ng-show="myForm.tcc.$error.required">
153 停车场必须填写 153 停车场必须填写
154 </div> 154 </div>
155 </div> 155 </div>
src/main/resources/static/pages/scheduleApp/module/core/busConfig/form.html
@@ -135,11 +135,11 @@ @@ -135,11 +135,11 @@
135 <div class="form-group has-success has-feedback"> 135 <div class="form-group has-success has-feedback">
136 <label class="col-md-2 control-label">停车场*:</label> 136 <label class="col-md-2 control-label">停车场*:</label>
137 <div class="col-md-3"> 137 <div class="col-md-3">
138 - <sa-Select5 name="tcd" 138 + <sa-Select5 name="tcc"
139 model="ctrl.busConfigForSave" 139 model="ctrl.busConfigForSave"
140 - cmaps="{'tcd': 'parkName'}"  
141 - dcname="tcd"  
142 - icname="parkName" 140 + cmaps="{'tcc.id': 'id', 'tcd': 'parkName'}"
  141 + dcname="tcc.id"
  142 + icname="id"
143 dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'tcc' } | json }}" 143 dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'tcc' } | json }}"
144 iterobjname="item" 144 iterobjname="item"
145 iterobjexp="item.parkName" 145 iterobjexp="item.parkName"
@@ -149,7 +149,7 @@ @@ -149,7 +149,7 @@
149 </sa-Select5> 149 </sa-Select5>
150 </div> 150 </div>
151 <!-- 隐藏块,显示验证信息 --> 151 <!-- 隐藏块,显示验证信息 -->
152 - <div class="alert alert-danger well-sm" ng-show="myForm.tcd.$error.required"> 152 + <div class="alert alert-danger well-sm" ng-show="myForm.tcc.$error.required">
153 停车场必须填写 153 停车场必须填写
154 </div> 154 </div>
155 </div> 155 </div>
src/main/resources/static/pages/scheduleApp/module/core/busConfig/module.js
@@ -237,12 +237,17 @@ angular.module(&#39;ScheduleApp&#39;).controller( @@ -237,12 +237,17 @@ angular.module(&#39;ScheduleApp&#39;).controller(
237 self.busConfigForSave = new BusConfig; 237 self.busConfigForSave = new BusConfig;
238 self.busConfigForSave.xl = {}; 238 self.busConfigForSave.xl = {};
239 self.busConfigForSave.cl = {}; 239 self.busConfigForSave.cl = {};
  240 + self.busConfigForSave.tcc = {};
240 241
241 // 获取传过来的id,有的话就是修改,获取一遍数据 242 // 获取传过来的id,有的话就是修改,获取一遍数据
242 var id = $stateParams.id; 243 var id = $stateParams.id;
243 if (id) { 244 if (id) {
244 BusConfig.get({id: id}, function(value) { 245 BusConfig.get({id: id}, function(value) {
245 self.busConfigForSave = value; 246 self.busConfigForSave = value;
  247 +
  248 + if (!self.busConfigForSave.tcc) {
  249 + self.busConfigForSave.tcc = {};
  250 + }
246 }); 251 });
247 } else { 252 } else {
248 // 初始表单,从查询条件中获取线路id 253 // 初始表单,从查询条件中获取线路id
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/info/list_info.html
@@ -8,12 +8,14 @@ @@ -8,12 +8,14 @@
8 <th style="width: 80px;">线路</th> 8 <th style="width: 80px;">线路</th>
9 <th style="width: 150px;">日期</th> 9 <th style="width: 150px;">日期</th>
10 <th style="width: 50px;">路牌</th> 10 <th style="width: 50px;">路牌</th>
11 - <th style="width: 120px;">车辆</th> 11 + <th style="width: 100px;">车辆</th>
12 <th style="width: 120px;">驾驶员(工号)</th> 12 <th style="width: 120px;">驾驶员(工号)</th>
13 - <th style="width: 120px;">售票员(工号)</th> 13 + <!--<th style="width: 120px;">售票员(工号)</th>-->
14 <th style="width: 80px;">班次类型</th> 14 <th style="width: 80px;">班次类型</th>
15 <th style="width: 80px;">上下行</th> 15 <th style="width: 80px;">上下行</th>
16 <th style="width: 80px;">发车时间</th> 16 <th style="width: 80px;">发车时间</th>
  17 + <th style="width: 100px;">起点站</th>
  18 + <th style="width: 100px;">终点站</th>
17 <th style="width: 100%">时刻表</th> 19 <th style="width: 100%">时刻表</th>
18 <th style="width: 90px;">修改人</th> 20 <th style="width: 90px;">修改人</th>
19 <th style="width: 90px;">修改时间</th> 21 <th style="width: 90px;">修改时间</th>
@@ -48,6 +50,7 @@ @@ -48,6 +50,7 @@
48 <td></td> 50 <td></td>
49 <td></td> 51 <td></td>
50 <td></td> 52 <td></td>
  53 + <td></td>
51 54
52 </tr> 55 </tr>
53 </thead> 56 </thead>
@@ -73,9 +76,9 @@ @@ -73,9 +76,9 @@
73 <span>{{info.jName ? info.jName + '(' + info.jGh + ')' : ''}}</span> 76 <span>{{info.jName ? info.jName + '(' + info.jGh + ')' : ''}}</span>
74 77
75 </td> 78 </td>
76 - <td>  
77 - <span>{{info.sGh ? info.sName + '(' + info.sGh + ')' : ''}}</span>  
78 - </td> 79 + <!--<td>-->
  80 + <!--<span>{{info.sGh ? info.sName + '(' + info.sGh + ')' : ''}}</span>-->
  81 + <!--</td>-->
79 <td> 82 <td>
80 <span ng-bind="info.bcType | dict:'ScheduleType':'未知' "></span> 83 <span ng-bind="info.bcType | dict:'ScheduleType':'未知' "></span>
81 </td> 84 </td>
@@ -86,7 +89,31 @@ @@ -86,7 +89,31 @@
86 <span ng-bind="info.fcsj"></span> 89 <span ng-bind="info.fcsj"></span>
87 </td> 90 </td>
88 <td> 91 <td>
89 - <span ng-bind="info.ttInfoName"></span> 92 + <a href="#"
  93 + tooltip-animation="false"
  94 + tooltip-placement="top"
  95 + uib-tooltip="{{info.qdzName}}"
  96 + tooltip-class="headClass">
  97 + {{info.qdzName}}
  98 + </a>
  99 + </td>
  100 + <td>
  101 + <a href="#"
  102 + tooltip-animation="false"
  103 + tooltip-placement="top"
  104 + uib-tooltip="{{info.zdzName}}"
  105 + tooltip-class="headClass">
  106 + {{info.zdzName}}
  107 + </a>
  108 + </td>
  109 + <td>
  110 + <a href="#"
  111 + tooltip-animation="false"
  112 + tooltip-placement="top"
  113 + uib-tooltip="{{info.ttInfoName}}"
  114 + tooltip-class="headClass">
  115 + {{info.ttInfoName}}
  116 + </a>
90 </td> 117 </td>
91 <td> 118 <td>
92 <span ng-bind="info.updateBy.userName"></span> 119 <span ng-bind="info.updateBy.userName"></span>
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/edit.html
@@ -148,6 +148,21 @@ @@ -148,6 +148,21 @@
148 </div> 148 </div>
149 </div> 149 </div>
150 150
  151 + <div class="form-group has-success has-feedback">
  152 + <label class="col-md-2 control-label">翻班格式*:</label>
  153 + <div class="col-md-6">
  154 + <sa-Checkboxgroup model="ctrl.scheduleRuleManageForSave"
  155 + name="fbgs"
  156 + dcvalue="{{ctrl.scheduleRuleManageForSave.fbgs}}"
  157 + dcname="fbgs"
  158 + required >
  159 + </sa-Checkboxgroup>
  160 + </div>
  161 + <div class="alert alert-danger well-sm" ng-show="myForm.fbgs.$error.required">
  162 + 请操作一下1
  163 + </div>
  164 + </div>
  165 +
151 <!--<div class="form-group">--> 166 <!--<div class="form-group">-->
152 <!--<label class="col-md-2 control-label">翻班格式:</label>--> 167 <!--<label class="col-md-2 control-label">翻班格式:</label>-->
153 <!--<div class="col-md-4">--> 168 <!--<div class="col-md-4">-->
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/list.html
@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
12 <th>路牌范围</th> 12 <th>路牌范围</th>
13 <th>起始人员</th> 13 <th>起始人员</th>
14 <th>人员范围</th> 14 <th>人员范围</th>
  15 + <th>翻版格式</th>
15 <th style="width: 21%">操作</th> 16 <th style="width: 21%">操作</th>
16 </tr> 17 </tr>
17 <tr role="row" class="filter"> 18 <tr role="row" class="filter">
@@ -37,6 +38,7 @@ @@ -37,6 +38,7 @@
37 <td></td> 38 <td></td>
38 <td></td> 39 <td></td>
39 <td></td> 40 <td></td>
  41 + <td></td>
40 <td> 42 <td>
41 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" 43 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
42 ng-click="ctrl.doPage()"> 44 ng-click="ctrl.doPage()">
@@ -72,13 +74,34 @@ @@ -72,13 +74,34 @@
72 <span ng-bind="info.lpStart"></span> 74 <span ng-bind="info.lpStart"></span>
73 </td> 75 </td>
74 <td> 76 <td>
75 - <span ng-bind="info.lpNames"></span> 77 + <a href="#"
  78 + tooltip-animation="false"
  79 + tooltip-placement="left-top"
  80 + uib-tooltip="{{info.lpNames}}"
  81 + tooltip-class="headClass">
  82 + {{info.lpNames}}
  83 + </a>
76 </td> 84 </td>
77 <td> 85 <td>
78 <span ng-bind="info.ryStart"></span> 86 <span ng-bind="info.ryStart"></span>
79 </td> 87 </td>
80 <td> 88 <td>
81 - <span ng-bind="info.ryDbbms"></span> 89 + <a href="#"
  90 + tooltip-animation="false"
  91 + tooltip-placement="top"
  92 + uib-tooltip="{{info.ryDbbms}}"
  93 + tooltip-class="headClass">
  94 + {{info.ryDbbms}}
  95 + </a>
  96 + </td>
  97 + <td>
  98 + <a href="#"
  99 + tooltip-animation="false"
  100 + tooltip-placement="top"
  101 + uib-tooltip="{{info.fbgs}}"
  102 + tooltip-class="headClass">
  103 + {{info.fbgs}}
  104 + </a>
82 </td> 105 </td>
83 <td> 106 <td>
84 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> 107 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
src/main/resources/static/real_control_v2/css/ct_table.css
@@ -33,6 +33,7 @@ @@ -33,6 +33,7 @@
33 .ct_table>.ct_table_body { 33 .ct_table>.ct_table_body {
34 width: 100%; 34 width: 100%;
35 border-bottom: 1px solid #dedede; 35 border-bottom: 1px solid #dedede;
  36 + color: #000;
36 } 37 }
37 38
38 .ct_table dl { 39 .ct_table dl {
src/main/resources/static/real_control_v2/css/line_schedule.css
@@ -95,7 +95,7 @@ @@ -95,7 +95,7 @@
95 } 95 }
96 96
97 .line-schedule-table dl dt:nth-of-type(3), .line-schedule-table dl dd:nth-of-type(3) { 97 .line-schedule-table dl dt:nth-of-type(3), .line-schedule-table dl dd:nth-of-type(3) {
98 - width: calc(2% + 86px); 98 + width: calc(2% + 66px);
99 } 99 }
100 100
101 .line-schedule-table dl dt:nth-of-type(4), .line-schedule-table dl dd:nth-of-type(4) { 101 .line-schedule-table dl dt:nth-of-type(4), .line-schedule-table dl dd:nth-of-type(4) {
@@ -121,7 +121,7 @@ @@ -121,7 +121,7 @@
121 } 121 }
122 122
123 .line-schedule-table dl dt:nth-of-type(9), .line-schedule-table dl dd:nth-of-type(9) { 123 .line-schedule-table dl dt:nth-of-type(9), .line-schedule-table dl dd:nth-of-type(9) {
124 - width: 50px; 124 + width: 70px;
125 border-right: 0; 125 border-right: 0;
126 } 126 }
127 127
@@ -237,6 +237,10 @@ @@ -237,6 +237,10 @@
237 height: 36px; 237 height: 36px;
238 } 238 }
239 239
  240 +.schedule-body .ct_table dl:nth-child(even){
  241 + background: rgba(101, 204, 220, 0.13);
  242 +}
  243 +
240 span.fcsj-diff { 244 span.fcsj-diff {
241 color: gray; 245 color: gray;
242 margin-left: 3px; 246 margin-left: 3px;
@@ -527,8 +531,7 @@ div.drop-rail[data-type=&quot;car&quot;]:before { @@ -527,8 +531,7 @@ div.drop-rail[data-type=&quot;car&quot;]:before {
527 } 531 }
528 532
529 dl.relevance-active dd:nth-child(n+2) { 533 dl.relevance-active dd:nth-child(n+2) {
530 - background: #f1efef !important;  
531 - color: #333; 534 + background: #d2d2d2 !important;
532 } 535 }
533 536
534 dl.relevance-active.intimity dd:nth-child(n+2) { 537 dl.relevance-active.intimity dd:nth-child(n+2) {
src/main/resources/static/real_control_v2/css/main.css
@@ -863,4 +863,40 @@ svg rect.offline{ @@ -863,4 +863,40 @@ svg rect.offline{
863 color: white; 863 color: white;
864 box-shadow: 0px 4px 6px 0 rgba(0, 0, 0, 0.2), 0px 4px 10px 0 rgba(0, 0, 0, 0.19); 864 box-shadow: 0px 4px 6px 0 rgba(0, 0, 0, 0.2), 0px 4px 10px 0 rgba(0, 0, 0, 0.19);
865 border-radius: 1px 1px 4px 4px; 865 border-radius: 1px 1px 4px 4px;
  866 +}
  867 +
  868 +#oil_station-modal.ct-form-modal form.uk-form-horizontal .uk-form-label{
  869 + width: 120px;
  870 +}
  871 +
  872 +#oil_station-modal.ct-form-modal form.uk-form-horizontal .uk-form-controls{
  873 + margin-left: 125px;
  874 +}
  875 +
  876 +#oil_station-modal .uk-form-icon>[class*=uk-icon-]{
  877 + right: 23px;
  878 +}
  879 +
  880 +#oil_station-modal .uk-form-icon:not(.uk-form-icon-flip)>input{
  881 + padding-left: 10px !important;
  882 +}
  883 +
  884 +#oil_station-modal .uk-form-icon{
  885 + width: calc(100% - 145px);
  886 +}
  887 +
  888 +#oil_station-modal .uk-icon-mile:before{
  889 + content: '公里';
  890 +}
  891 +
  892 +#oil_station-modal .uk-icon-minute:before{
  893 + content: '分钟';
  894 +}
  895 +
  896 +option.oil_station_opt{
  897 + color: red;
  898 +}
  899 +
  900 +#oil_station-modal .uk-modal .uk-form.fv-form{
  901 + margin-bottom: 0 !important;
866 } 902 }
867 \ No newline at end of file 903 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/add_temp_sch.html
@@ -182,6 +182,14 @@ @@ -182,6 +182,14 @@
182 delete data.spy; 182 delete data.spy;
183 } 183 }
184 184
  185 + //公司信息
  186 + var line = gb_data_basic.findLineByCodes([data.xlBm]);
  187 + if(line && line.length > 0){
  188 + line = line[0];
  189 + data.gsBm = line.company;
  190 + data.fgsBm = line.brancheCompany;
  191 + }
  192 +
185 gb_common.$post('/realSchedule', data, function (rs) { 193 gb_common.$post('/realSchedule', data, function (rs) {
186 //插入 194 //插入
187 gb_schedule_table.insertSchedule(rs.t, rs.ts); 195 gb_schedule_table.insertSchedule(rs.t, rs.ts);
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/fcxxwt.html
@@ -141,7 +141,7 @@ @@ -141,7 +141,7 @@
141 <div class="uk-form-row"> 141 <div class="uk-form-row">
142 <label class="uk-form-label" >里程</label> 142 <label class="uk-form-label" >里程</label>
143 <div class="uk-form-controls"> 143 <div class="uk-form-controls">
144 - <input type="text" value="{{if sch.status==-1}}0{{else}}{{sch.jhlc}}{{/if}}" name="jhlc" > 144 + <input type="text" value="{{if sch.status==-1}}0{{else}}{{sch.jhlc}}{{/if}}" name="jhlc" required>
145 </div> 145 </div>
146 </div> 146 </div>
147 </div> 147 </div>
@@ -197,7 +197,7 @@ @@ -197,7 +197,7 @@
197 } 197 }
198 198
199 //里程有修改 199 //里程有修改
200 - if(data.jhlc != sch.jhlc){ 200 + if(data.jhlc != sch.jhlc && data.jhlc != 0){
201 var confHtml = '<h4 style="color: #c04c4c;margin-bottom: 9px;">确认要将班次里程由'+sch.jhlc+' 修改为'+data.jhlc+' </h4><small>备注:</small>'; 201 var confHtml = '<h4 style="color: #c04c4c;margin-bottom: 9px;">确认要将班次里程由'+sch.jhlc+' 修改为'+data.jhlc+' </h4><small>备注:</small>';
202 UIkit.modal.prompt(confHtml, data.remarks, function(remarks){ 202 UIkit.modal.prompt(confHtml, data.remarks, function(remarks){
203 if(remarks){ 203 if(remarks){
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/lj_zrw.html
@@ -267,7 +267,7 @@ @@ -267,7 +267,7 @@
267 } 267 }
268 }); 268 });
269 //公里与主任务不符合 269 //公里与主任务不符合
270 - if (sum != sch.jhlc) { 270 + if (sum != sch.jhlcOrig) {
271 if (i > 1) 271 if (i > 1)
272 calcs += ('=' + sum); 272 calcs += ('=' + sum);
273 calcs += (' ≠ ' + sch.jhlc); 273 calcs += (' ≠ ' + sch.jhlc);
@@ -320,6 +320,11 @@ @@ -320,6 +320,11 @@
320 var sch = getActiveSch(); 320 var sch = getActiveSch();
321 if (!sch) 321 if (!sch)
322 return notify_err('无法获取到主任务信息!'); 322 return notify_err('无法获取到主任务信息!');
  323 +
  324 + if(sch.bcType == 'out' || sch.bcType == 'in'){
  325 + notify_err('暂不能在进出场班次上做回场子任务!');
  326 + return;
  327 + }
323 open_modal(folder + '/sub_task/add_sub_task_inpark.html', { 328 open_modal(folder + '/sub_task/add_sub_task_inpark.html', {
324 sch: sch 329 sch: sch
325 }, modal_opts); 330 }, modal_opts);
@@ -330,6 +335,10 @@ @@ -330,6 +335,10 @@
330 var sch = getActiveSch(); 335 var sch = getActiveSch();
331 if (!sch) 336 if (!sch)
332 return notify_err('无法获取到主任务信息!'); 337 return notify_err('无法获取到主任务信息!');
  338 + if(sch.bcType == 'out' || sch.bcType == 'in'){
  339 + notify_err('暂不能在进出场班次上做出场子任务!');
  340 + return;
  341 + }
333 open_modal(folder + '/sub_task/add_sub_task_outpark.html', { 342 open_modal(folder + '/sub_task/add_sub_task_outpark.html', {
334 sch: sch 343 sch: sch
335 }, modal_opts); 344 }, modal_opts);
@@ -369,6 +378,20 @@ @@ -369,6 +378,20 @@
369 }); 378 });
370 }, '确定删除'); 379 }, '确定删除');
371 }; 380 };
  381 + //加油
  382 + var add_oil = function () {
  383 + var sch = getActiveSch();
  384 + if (!sch)
  385 + return notify_err('无法获取到主任务信息!');
  386 +
  387 + if(sch.bcType == 'out' || sch.bcType == 'in'){
  388 + notify_err('暂不能在进出场班次上做加油子任务!');
  389 + return;
  390 + }
  391 + open_modal(folder + '/sub_task/add_sub_task_oil.html', {
  392 + sch: sch
  393 + }, modal_opts);
  394 + };
372 395
373 var callbackHandler = { 396 var callbackHandler = {
374 add_temp_sch: add_temp_sch, 397 add_temp_sch: add_temp_sch,
@@ -377,7 +400,8 @@ @@ -377,7 +400,8 @@
377 add_sub_task_in: add_sub_task_in, 400 add_sub_task_in: add_sub_task_in,
378 remove_sub_task: remove_sub_task, 401 remove_sub_task: remove_sub_task,
379 add_sub_task_out: add_sub_task_out, 402 add_sub_task_out: add_sub_task_out,
380 - add_sub_task_range_turn: add_sub_task_range_turn 403 + add_sub_task_range_turn: add_sub_task_range_turn,
  404 + add_oil: add_oil
381 }; 405 };
382 406
383 //右键菜单 407 //右键菜单
@@ -394,6 +418,9 @@ @@ -394,6 +418,9 @@
394 "add_sub_task": { 418 "add_sub_task": {
395 name: "添加子任务", 419 name: "添加子任务",
396 items: { 420 items: {
  421 + 'add_oil':{
  422 + name: '加油'
  423 + },
397 'add_sub_task_in': { 424 'add_sub_task_in': {
398 name: '回场' 425 name: '回场'
399 }, 426 },
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_inpark.html
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 </div> 52 </div>
53 </div> 53 </div>
54 <div class="uk-width-7-10 pl5"> 54 <div class="uk-width-7-10 pl5">
55 - <input type="text" name="mileage" required> 55 + <input type="number" step="0.01" name="mileage" required>
56 </div> 56 </div>
57 </div> 57 </div>
58 <div class="uk-grid"> 58 <div class="uk-grid">
@@ -125,7 +125,7 @@ @@ -125,7 +125,7 @@
125 </div> 125 </div>
126 </div> 126 </div>
127 <div class="uk-width-7-10 pl5"> 127 <div class="uk-width-7-10 pl5">
128 - <input type="text" name="mileage" required style="width: calc(100% - 62px);"> 128 + <input type="number" step="0.01" name="mileage" required style="width: calc(100% - 62px);">
129 <a style="font-size: 12px;color: grey;cursor: default;" data-uk-tooltip title="可选择回场路径,设置途径点位。暂不开放" id="inpark_paths_link">路径(<span>0</span>)</a> 129 <a style="font-size: 12px;color: grey;cursor: default;" data-uk-tooltip title="可选择回场路径,设置途径点位。暂不开放" id="inpark_paths_link">路径(<span>0</span>)</a>
130 </div> 130 </div>
131 </div> 131 </div>
@@ -190,7 +190,7 @@ @@ -190,7 +190,7 @@
190 </div> 190 </div>
191 </div> 191 </div>
192 <div class="uk-width-7-10 pl5"> 192 <div class="uk-width-7-10 pl5">
193 - <input type="text" name="mileage" required> 193 + <input type="number" step="0.01" name="mileage" required>
194 </div> 194 </div>
195 </div> 195 </div>
196 <div class="uk-grid"> 196 <div class="uk-grid">
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_oil.html 0 → 100644
  1 +<div class="uk-modal ct-form-modal" id="schedule-addsch_oil-modal">
  2 + <div class="uk-modal-dialog" style="width: 1201px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>加油</h2></div>
  6 +
  7 + <div class="uk-grid">
  8 + <div class="uk-width-1-3">
  9 + <form class="uk-form uk-form-horizontal ">
  10 + <input type="hidden" name="type1" value="正常">
  11 + <input type="hidden" name="type2" value="1">
  12 + <input type="hidden" name="mileageType" value="service">
  13 +
  14 + <div class="uk-panel uk-panel-box uk-panel-box-primary">
  15 + <div class="uk-panel-badge uk-badge ">营运</div>
  16 + <h3 class="uk-panel-title">线路上站点间</h3>
  17 + <div class="uk-form-row">
  18 + <label class="uk-form-label">起点站</label>
  19 + <div class="uk-form-controls">
  20 + <input type="hidden" name="startStation">
  21 + <input type="text" name="startStationName" disabled>
  22 + </div>
  23 + </div>
  24 + <div class="uk-form-row">
  25 + <label class="uk-form-label">终点站</label>
  26 + <div class="uk-form-controls">
  27 + <input type="hidden" name="endStation">
  28 + <input type="text" name="endStationName" disabled>
  29 + </div>
  30 + </div>
  31 + <div class="uk-form-row">
  32 + <label class="uk-form-label">里程</label>
  33 + <div class="uk-form-controls">
  34 + <input type="number" step="0.01" name="mileage" max=222
  35 + data-fv-lessthan-inclusive="false"
  36 + disabled>
  37 + </div>
  38 + </div>
  39 + <div class="uk-form-row">
  40 + <label class="uk-form-label">开始时间</label>
  41 + <div class="uk-form-controls">
  42 + <input type="time" name="startDate" required>
  43 + </div>
  44 + </div>
  45 + <div class="uk-form-row">
  46 + <label class="uk-form-label">结束时间</label>
  47 + <div class="uk-form-controls">
  48 + <input type="time" name="endDate" required>
  49 + </div>
  50 + </div>
  51 + </div>
  52 + </form>
  53 + </div>
  54 +
  55 + <div class="uk-width-1-3">
  56 + <form class="uk-form uk-form-horizontal">
  57 + <input type="hidden" name="type1" value="临加">
  58 + <input type="hidden" name="type2" value="2">
  59 + <input type="hidden" name="mileageType" value="empty">
  60 +
  61 + <div class="uk-panel uk-panel-box uk-panel-box-secondary">
  62 + <div class="uk-panel-badge uk-badge uk-badge-default">空驶</div>
  63 + <h3 class="uk-panel-title">进场</h3>
  64 + <div class="uk-form-row">
  65 + <label class="uk-form-label">起点站</label>
  66 + <div class="uk-form-controls">
  67 + <select name="startStation" required>
  68 + </select>
  69 + <input type="hidden" name="startStationName" disabled>
  70 + </div>
  71 + </div>
  72 + <div class="uk-form-row">
  73 + <label class="uk-form-label">终点站</label>
  74 + <div class="uk-form-controls">
  75 + <select name="endStation" required>
  76 + </select>
  77 + <input type="hidden" name="endStationName" disabled>
  78 + </div>
  79 + </div>
  80 + <div class="uk-form-row">
  81 + <label class="uk-form-label">里程</label>
  82 + <div class="uk-form-controls">
  83 + <input type="number" step="0.01" name="mileage" max=222
  84 + data-fv-lessthan-inclusive="false"
  85 + required>
  86 + </div>
  87 + </div>
  88 + <div class="uk-form-row">
  89 + <label class="uk-form-label">开始时间</label>
  90 + <div class="uk-form-controls">
  91 + <input type="time" name="startDate" required>
  92 + </div>
  93 + </div>
  94 + <div class="uk-form-row">
  95 + <label class="uk-form-label">结束时间</label>
  96 + <div class="uk-form-controls">
  97 + <input type="time" name="endDate" required>
  98 + </div>
  99 + </div>
  100 + </div>
  101 + </form>
  102 + </div>
  103 +
  104 + <div class="uk-width-1-3">
  105 + <form class="uk-form uk-form-horizontal">
  106 + <input type="hidden" name="type1" value="临加">
  107 + <input type="hidden" name="type2" value="3">
  108 + <input type="hidden" name="mileageType" value="empty">
  109 +
  110 + <div class="uk-panel uk-panel-box uk-panel-box-secondary">
  111 + <div class="uk-panel-badge uk-badge uk-badge-default">空驶</div>
  112 + <h3 class="uk-panel-title">出场</h3>
  113 + <div class="uk-form-row">
  114 + <label class="uk-form-label">起点站</label>
  115 + <div class="uk-form-controls">
  116 + <select name="startStation" required>
  117 + </select>
  118 + <input type="hidden" name="startStationName" disabled>
  119 + </div>
  120 + </div>
  121 + <div class="uk-form-row">
  122 + <label class="uk-form-label">终点站</label>
  123 + <div class="uk-form-controls">
  124 + <select name="endStation" required>
  125 + </select>
  126 + <input type="hidden" name="endStationName" disabled>
  127 + </div>
  128 + </div>
  129 + <div class="uk-form-row">
  130 + <label class="uk-form-label">里程</label>
  131 + <div class="uk-form-controls">
  132 + <input type="number" step="0.01" name="mileage" max=222
  133 + data-fv-lessthan-inclusive="false"
  134 + required>
  135 + </div>
  136 + </div>
  137 + <div class="uk-form-row">
  138 + <label class="uk-form-label">开始时间</label>
  139 + <div class="uk-form-controls">
  140 + <input type="time" name="startDate" required>
  141 + </div>
  142 + </div>
  143 + <div class="uk-form-row">
  144 + <label class="uk-form-label">结束时间</label>
  145 + <div class="uk-form-controls">
  146 + <input type="time" name="endDate" required>
  147 + </div>
  148 + </div>
  149 + </div>
  150 + </form>
  151 + </div>
  152 + </div>
  153 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
  154 + <span class="bind_gas_station_panel" style="position: absolute;left: 30px;text-decoration: underline;"></span>
  155 + <button type="button" class="uk-button uk-modal-close">取消</button>
  156 + <button type="submit" id="submitChildTaskBtn" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  157 + </div>
  158 + </div>
  159 +
  160 + <script id="schedule-addsch_oil-form-temp" type="text/html">
  161 +
  162 + </script>
  163 +
  164 + <script>
  165 + (function () {
  166 + var modal = '#schedule-addsch_oil-modal',
  167 + sch, stationRoutes, parks, oilStation;
  168 + var yyForm = $('form', modal)[0];
  169 + var jcForm = $('form', modal)[1];
  170 + var ccForm = $('form', modal)[2];
  171 + var oilId;
  172 + var lineInfo;
  173 +
  174 + var folder = '/real_control_v2/fragments/line_schedule/context_menu';
  175 + $(modal).on('init', function (e, data) {
  176 + e.stopPropagation();
  177 + sch = data.sch;
  178 + oilId = sch.xlBm + '_oil_station';
  179 + lineInfo = gb_data_basic.codeToLine[sch.xlBm];
  180 +
  181 + //站点路由
  182 + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) {
  183 + return a.stationRouteCode - b.stationRouteCode;
  184 + }), 'directions');
  185 +
  186 + setDefaultVal();
  187 + //停车场
  188 + $.get('/basic/parks', function (rs) {
  189 + parks = rs;
  190 + var opts = '';
  191 + for (var code in parks) {
  192 + opts += '<option value="' + code + '">' + parks[code] + '</option>';
  193 + }
  194 + $('[name=endStation]', jcForm).html(opts);
  195 + $('[name=startStation]', ccForm).html(opts);
  196 + });
  197 +
  198 + //切换空驶起终点
  199 + $('[name=endStation]', jcForm).on('change', reCalcIn);
  200 + $('[name=startStation]', jcForm).on('change', reCalcIn);
  201 +
  202 + $('[name=endStation]', ccForm).on('change', reCalcOut);
  203 + $('[name=startStation]', ccForm).on('change', reCalcOut);
  204 + //修改开始时间
  205 + $('[name=startDate]', jcForm).on('change', reCalcIn);
  206 + $('[name=startDate]', ccForm).on('change', reCalcOut);
  207 +
  208 + //绑定的社会加油站
  209 + $.get('/oilStation/'+sch.xlBm, function (rs) {
  210 + var htmlStr;
  211 + oilStation = rs;
  212 + if(oilStation){
  213 + htmlStr = '<a><i class="uk-icon-product-hunt"></i> '+oilStation.stationName+'</a>';
  214 +
  215 + var opt = '<option value="'+oilId+'" class="oil_station_opt">'+oilStation.stationName+'</option>';
  216 + $('[name=endStation]', jcForm).prepend(opt).val(oilId).change();
  217 + $('[name=startStation]', ccForm).prepend(opt).val(oilId).change();
  218 + }
  219 + else
  220 + htmlStr = '<a>为'+sch.xlName+'绑定一个社会加油站</a>';
  221 +
  222 + $('.bind_gas_station_panel', modal).html(htmlStr);
  223 + $('.bind_gas_station_panel a', modal).on('click', function () {
  224 + open_modal(folder + '/sub_task//oil_station.html', {
  225 + sch: sch
  226 + }, {center: false, bgclose: false, modal: false});
  227 + });
  228 + });
  229 + });
  230 +
  231 + var dataArray = [];
  232 + var fs = $('form', modal).formValidation({
  233 + framework: 'uikit',
  234 + locale: 'zh_CN'
  235 + });
  236 + fs.on('success.form.fv', function(e) {
  237 + e.preventDefault();
  238 + if($(this).is(':hidden'))
  239 + return;
  240 + dataArray.push($.extend($(this).serializeJSON(), getDisabledVal(this)
  241 + , {remarks: '加油', 'schedule.id': sch.id}));
  242 + $(this).data('valid', true);
  243 +
  244 + if(allValidSuccess()){
  245 + var i = 0;
  246 + (function () {
  247 + var f = arguments.callee;
  248 + if(i >= dataArray.length){
  249 + UIkit.modal(modal).hide();
  250 + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch});
  251 + return;
  252 + }
  253 + var data = dataArray[i];
  254 + //里程为0的不保存
  255 + if(data.mileage==0){
  256 + i++;
  257 + f();
  258 + }
  259 + else{
  260 + gb_common.$post('/childTask', data, function (rs) {
  261 + notify_succ('子任务添加成功');
  262 + gb_schedule_table.updateSchedule(rs.t);
  263 + i++;
  264 + f();
  265 + });
  266 + }
  267 + })();
  268 + }
  269 + });
  270 +
  271 + //校验不过
  272 + fs.on('err.field.fv', function () {
  273 + $('#submitChildTaskBtn', modal).removeClass('disabled').removeAttr('disabled');
  274 + });
  275 +
  276 + //submit
  277 + $('#submitChildTaskBtn', modal).on('click', function () {
  278 + //空驶的进场终点名称
  279 + if(!oilStation || $('[name=endStation]', jcForm).val() != oilId)
  280 + $('[name=endStationName]', jcForm).val('');
  281 + else
  282 + $('[name=endStationName]', jcForm).val(oilStation.stationName);
  283 +
  284 + //空驶的出场起点名称
  285 + if(!oilStation || $('[name=startStation]', ccForm).val() != oilId)
  286 + $('[name=startStationName]', ccForm).val('');
  287 + else
  288 + $('[name=startStationName]', ccForm).val(oilStation.stationName);
  289 +
  290 +
  291 + //提交表单
  292 + $(this).addClass('disabled').attr('disabled','disabled');
  293 + dataArray = [];
  294 + fs.data('valid', false);
  295 + fs.formValidation('validate');
  296 + //fs.submit();
  297 + });
  298 +
  299 + //获取表单disabled 项的值
  300 + function getDisabledVal(f) {
  301 + var rs = {};
  302 + $('input,select', f).each(function () {
  303 + if($(this).attr('disabled')){
  304 + rs[$(this).attr('name')]=$(this).val();
  305 + }
  306 + });
  307 + return rs;
  308 + }
  309 +
  310 + function allValidSuccess() {
  311 + var flag = true;
  312 + $('form:visible', modal).each(function (i, f) {
  313 + if(!$(f).data('valid')){
  314 + flag = false;
  315 + return false;
  316 + }
  317 + });
  318 + return flag;
  319 + }
  320 +
  321 + function setDefaultVal() {
  322 + //营运班次
  323 + $('[name=startStation]', yyForm).val(sch.qdzCode);
  324 + $('[name=startStationName]', yyForm).val(sch.qdzName);
  325 + $('[name=endStation]', yyForm).val(sch.zdzCode);
  326 + $('[name=endStationName]', yyForm).val(sch.zdzName);
  327 + $('[name=mileage]', yyForm).val(sch.jhlc);
  328 + $('[name=startDate]', yyForm).val(sch.fcsjActual==null?sch.dfsj:sch.fcsjActual);
  329 + $('[name=endDate]', yyForm).val(sch.zdsjActual==null?sch.zdsj:sch.zdsjActual);
  330 +
  331 + //设置进场默认值
  332 + $('[name=startStation]', jcForm).html(createStationOpts(stationRoutes[sch.xlDir]));
  333 + $('[name=startDate]', jcForm).val(sch.zdsjActual==null?sch.zdsj:sch.zdsjActual);
  334 + $('[name=startStation]', jcForm).val(sch.zdzCode);
  335 +
  336 + //设置出场默认值
  337 + $('[name=endStation]', ccForm).html(createStationOpts(stationRoutes[sch.xlDir]));
  338 + $('[name=endStation]', ccForm).val(sch.zdzCode);
  339 + }
  340 +
  341 + function createStationOpts(list) {
  342 + var opts = '';
  343 + $.each(list, function () {
  344 + opts += '<option value="'+this.station.stationCod+'">'+this.stationName+'</option>';
  345 + });
  346 + return opts;
  347 + }
  348 +
  349 + function reCalcIn() {
  350 + if(!oilStation || $('[name=endStation]', jcForm).val() != oilId)
  351 + return;
  352 +
  353 + var data;
  354 + var qdz = $('[name=startStation]', jcForm).find("option:selected").text();
  355 + if(qdz == lineInfo.startStationName){
  356 + //起点进场
  357 + data = {
  358 + mileage: oilStation.upInMile,
  359 + time: oilStation.upInTime
  360 + }
  361 + }
  362 + else if(qdz == lineInfo.endStationName){
  363 + //终点进场
  364 + data = {
  365 + mileage: oilStation.downInMile,
  366 + time: oilStation.downInTime
  367 + }
  368 + }
  369 + if(!data)
  370 + return;
  371 +
  372 + $('[name=mileage]', jcForm).val(data.mileage);
  373 + var st = $('[name=startDate]', jcForm).val();
  374 + if(!st)
  375 + return;
  376 + var ets = moment(st, 'HH:mm').add(data.time, 'minute').format('HH:mm');
  377 + $('[name=endDate]', jcForm).val(ets);
  378 +
  379 + //出场时间 + 1 分钟
  380 + $('[name=startDate]', ccForm).val(moment(ets, 'HH:mm').add(1, 'minute').format('HH:mm'));
  381 + }
  382 +
  383 + function reCalcOut() {
  384 + if(!oilStation || $('[name=startStation]', ccForm).val() != oilId)
  385 + return;
  386 +
  387 + var data;
  388 + var zdz = $('[name=endStation]', ccForm).find("option:selected").text();
  389 + if(zdz == lineInfo.startStationName){
  390 + //出场到起点
  391 + data = {
  392 + mileage: oilStation.upOutMile,
  393 + time: oilStation.upOutTime
  394 + }
  395 + }
  396 + else if(zdz == lineInfo.endStationName){
  397 + //出场到终点
  398 + data = {
  399 + mileage: oilStation.downOutMile,
  400 + time: oilStation.downOutTime
  401 + }
  402 + }
  403 + if(!data)
  404 + return;
  405 +
  406 + $('[name=mileage]', ccForm).val(data.mileage);
  407 + var st = $('[name=startDate]', ccForm).val();
  408 + if(!st)
  409 + return;
  410 + var ets = moment(st, 'HH:mm').add(data.time, 'minute').format('HH:mm');
  411 + $('[name=endDate]', ccForm).val(ets);
  412 + }
  413 + })();
  414 + </script>
  415 +</div>
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_outpark.html
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 </div> 52 </div>
53 </div> 53 </div>
54 <div class="uk-width-7-10 pl5"> 54 <div class="uk-width-7-10 pl5">
55 - <input type="text" name="mileage" required style="width: calc(100% - 62px);"> 55 + <input type="number" step="0.01" name="mileage" required style="width: calc(100% - 62px);">
56 <a style="font-size: 12px;color: grey;cursor: default;" target="_blank" 56 <a style="font-size: 12px;color: grey;cursor: default;" target="_blank"
57 class="linkToLineInfo">线路标准</a> 57 class="linkToLineInfo">线路标准</a>
58 </div> 58 </div>
@@ -128,7 +128,7 @@ @@ -128,7 +128,7 @@
128 </div> 128 </div>
129 </div> 129 </div>
130 <div class="uk-width-7-10 pl5"> 130 <div class="uk-width-7-10 pl5">
131 - <input type="text" name="mileage" disabled> 131 + <input type="number" step="0.01" name="mileage" disabled>
132 </div> 132 </div>
133 </div> 133 </div>
134 <div class="uk-grid"> 134 <div class="uk-grid">
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_range_turn.html
@@ -168,7 +168,7 @@ @@ -168,7 +168,7 @@
168 </div> 168 </div>
169 </div> 169 </div>
170 <div class="uk-width-7-10 pl5"> 170 <div class="uk-width-7-10 pl5">
171 - <input type="text" name="mileage" value="{{sch.jhlc}}" required> 171 + <input type="number" step="0.01" name="mileage" value="{{sch.jhlc}}" required>
172 </div> 172 </div>
173 </div> 173 </div>
174 <div class="uk-grid"> 174 <div class="uk-grid">
@@ -237,7 +237,7 @@ @@ -237,7 +237,7 @@
237 </div> 237 </div>
238 </div> 238 </div>
239 <div class="uk-width-7-10 pl5"> 239 <div class="uk-width-7-10 pl5">
240 - <input type="text" name="mileage" required> 240 + <input type="number" step="0.01" name="mileage" required>
241 </div> 241 </div>
242 </div> 242 </div>
243 <div class="uk-grid"> 243 <div class="uk-grid">
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/oil_station.html 0 → 100644
  1 +<div class="uk-modal ct-form-modal" id="oil_station-modal">
  2 + <div class="uk-modal-dialog" style="width: 450px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>社会加油站</h2></div>
  6 +
  7 + <form class="uk-form uk-form-horizontal " style="margin-bottom: 0 !important;">
  8 + <div class="uk-form-row">
  9 + <label class="uk-form-label">线路</label>
  10 + <div class="uk-form-icon">
  11 + <input type="hidden" name="lineCode">
  12 + <input type="text" name="qdzName" disabled>
  13 + </div>
  14 + </div>
  15 + <div class="uk-form-row">
  16 + <label class="uk-form-label">加油站名称</label>
  17 + <div class="uk-form-icon">
  18 + <input type="text" name="stationName" value="社会加油站" required>
  19 + </div>
  20 + </div>
  21 + <div class="uk-form-row">
  22 + <label class="uk-form-label">起点进场里程</label>
  23 + <div class="uk-form-icon">
  24 + <i class="uk-icon-mile"></i>
  25 + <input type="number" name="upInMile" step="0.01" required>
  26 + </div>
  27 + </div>
  28 + <div class="uk-form-row">
  29 + <label class="uk-form-label">终点进场里程</label>
  30 + <div class="uk-form-icon">
  31 + <i class="uk-icon-mile"></i>
  32 + <input type="number" name="downInMile" step="0.01" required>
  33 + </div>
  34 + </div>
  35 + <div class="uk-form-row">
  36 + <label class="uk-form-label">起点进场时间</label>
  37 + <div class="uk-form-icon">
  38 + <i class="uk-icon-minute"></i>
  39 + <input type="text" name="upInTime" required>
  40 + </div>
  41 + </div>
  42 + <div class="uk-form-row">
  43 + <label class="uk-form-label">终点进场时间</label>
  44 + <div class="uk-form-icon">
  45 + <i class="uk-icon-minute"></i>
  46 + <input type="text" name="downInTime" required>
  47 + </div>
  48 + </div>
  49 +
  50 + <hr>
  51 + <div class="uk-form-row">
  52 + <label class="uk-form-label">出场到起点里程</label>
  53 + <div class="uk-form-icon">
  54 + <i class="uk-icon-mile"></i>
  55 + <input type="number" name="upOutMile" step="0.01" required>
  56 + </div>
  57 + </div>
  58 + <div class="uk-form-row">
  59 + <label class="uk-form-label">出场到终点里程</label>
  60 + <div class="uk-form-icon">
  61 + <i class="uk-icon-mile"></i>
  62 + <input type="number" name="downOutMile" step="0.01" required>
  63 + </div>
  64 + </div>
  65 + <div class="uk-form-row">
  66 + <label class="uk-form-label">出场到起点时间</label>
  67 + <div class="uk-form-icon">
  68 + <i class="uk-icon-minute"></i>
  69 + <input type="text" name="upOutTime" required>
  70 + </div>
  71 + </div>
  72 + <div class="uk-form-row">
  73 + <label class="uk-form-label">出场到终点时间</label>
  74 + <div class="uk-form-icon">
  75 + <i class="uk-icon-minute"></i>
  76 + <input type="text" name="downOutTime" required>
  77 + </div>
  78 + </div>
  79 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
  80 + <button type="button" class="uk-button uk-modal-close">取消</button>
  81 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  82 + </div>
  83 + </form>
  84 + </div>
  85 +
  86 + <script id="" type="text/html">
  87 +
  88 + </script>
  89 +
  90 + <script>
  91 + (function () {
  92 + var modal = '#oil_station-modal',
  93 + sch, oilStation;
  94 +
  95 + var cognates = {
  96 + 'upInMile': 'upOutMile',
  97 + 'downInMile': 'downOutMile',
  98 + 'upInTime': 'upOutTime',
  99 + 'downInTime': 'downOutTime'
  100 + };
  101 + $(modal).on('init', function (e, data) {
  102 + e.stopPropagation();
  103 + sch = data.sch;
  104 +
  105 + $.get('/oilStation/'+sch.xlBm, function (rs) {
  106 + oilStation = rs;
  107 + setDefaultVal(oilStation);
  108 + });
  109 +
  110 + $('form [name=qdzName]', modal).val(sch.xlName);
  111 + $('form [name=lineCode]', modal).val(sch.xlBm);
  112 +
  113 + //submit
  114 + var f = $('form', modal).formValidation(gb_form_validation_opts);
  115 + f.on('success.form.fv', function(e) {
  116 + e.preventDefault();
  117 + var data = $(this).serializeJSON();
  118 +
  119 + gb_common.$post('/oilStation', data, function (rs) {
  120 + notify_succ('添加成功!');
  121 + UIkit.modal(modal).hide();
  122 + $('#schedule-addsch_oil-modal').trigger('init', {sch: sch});
  123 + });
  124 + });
  125 +
  126 + $('form input', modal).on('input', function () {
  127 + var name = $(this).attr('name');
  128 + if(cognates[name]){
  129 + $('form [name='+cognates[name]+']', modal).val($(this).val());
  130 + }
  131 + });
  132 + });
  133 +
  134 + function setDefaultVal(obj) {
  135 + if(!obj)
  136 + return;
  137 + $('form input', modal).each(function () {
  138 + var name = $(this).attr('name');
  139 + if(obj[name])
  140 + $(this).val(obj[name]);
  141 + });
  142 + }
  143 + })();
  144 + </script>
  145 +</div>
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
@@ -132,7 +132,7 @@ var gb_schedule_context_menu = (function () { @@ -132,7 +132,7 @@ var gb_schedule_context_menu = (function () {
132 }, modal_opts); 132 }, modal_opts);
133 }, 133 },
134 cxzx: function (sch) { 134 cxzx: function (sch) {
135 - if (!sch.zdsjActual) 135 + if (!sch.zdsjActual && !sch.fcsjActual)
136 return notify_err('车辆未执行,无法撤销执行!'); 136 return notify_err('车辆未执行,无法撤销执行!');
137 137
138 var content = '<h3>确定要撤销<span style="color:red;margin: 0 5px;">' + sch.clZbh + '( ' + sch.dfsj + ' )</span>的实达时间?</h3>' 138 var content = '<h3>确定要撤销<span style="color:red;margin: 0 5px;">' + sch.clZbh + '( ' + sch.dfsj + ' )</span>的实达时间?</h3>'
@@ -144,6 +144,41 @@ var gb_schedule_context_menu = (function () { @@ -144,6 +144,41 @@ var gb_schedule_context_menu = (function () {
144 notify_succ('撤销执行成功!'); 144 notify_succ('撤销执行成功!');
145 }); 145 });
146 }, '确认撤销执行'); 146 }, '确认撤销执行');
  147 + },
  148 +
  149 + add_sub_task_in: function (sch) {
  150 + if(sch.bcType == 'out' || sch.bcType == 'in'){
  151 + notify_err('暂不能在进出场班次上做回场子任务!');
  152 + return;
  153 + }
  154 + open_modal(folder + '/sub_task/add_sub_task_inpark.html', {
  155 + sch: sch
  156 + }, modal_opts);
  157 + },
  158 + add_sub_task_out: function (sch) {
  159 + if(sch.bcType == 'out' || sch.bcType == 'in'){
  160 + notify_err('暂不能在进出场班次上做出场子任务!');
  161 + return;
  162 + }
  163 + open_modal(folder + '/sub_task/add_sub_task_outpark.html', {
  164 + sch: sch
  165 + }, modal_opts);
  166 + },
  167 + add_sub_task_range_turn: function (sch) {
  168 + if(sch.bcType == 'out' || sch.bcType == 'in')
  169 + return notify_err('进出场班次不能做区间掉头!');
  170 + open_modal(folder + '/sub_task/add_sub_task_range_turn.html', {
  171 + sch: sch
  172 + }, modal_opts);
  173 + },
  174 + add_oil: function (sch) {
  175 + if(sch.bcType == 'out' || sch.bcType == 'in'){
  176 + notify_err('暂不能在进出场班次上做加油子任务!');
  177 + return;
  178 + }
  179 + open_modal(folder + '/sub_task/add_sub_task_oil.html', {
  180 + sch: sch
  181 + }, modal_opts);
147 } 182 }
148 }; 183 };
149 184
@@ -185,6 +220,23 @@ var gb_schedule_context_menu = (function () { @@ -185,6 +220,23 @@ var gb_schedule_context_menu = (function () {
185 'lj_zrw': { 220 'lj_zrw': {
186 name: '临加/子任务' 221 name: '临加/子任务'
187 }, 222 },
  223 + 'shortcut': {
  224 + name: '...',
  225 + items: {
  226 + 'add_oil': {
  227 + name: '(子任务)加油'
  228 + },
  229 + 'add_sub_task_in': {
  230 + name: '(子任务)回场'
  231 + },
  232 + 'add_sub_task_out': {
  233 + name: '(子任务)出场'
  234 + },
  235 + 'add_sub_task_range_turn': {
  236 + name: '(子任务)区间调头'
  237 + }
  238 + }
  239 + },
188 'sep4': '---------', 240 'sep4': '---------',
189 'tzrc': { 241 'tzrc': {
190 name: '调整人车' 242 name: '调整人车'
src/main/resources/static/real_control_v2/js/north/toolbar.js
@@ -182,6 +182,9 @@ var gb_northToolbar = (function () { @@ -182,6 +182,9 @@ var gb_northToolbar = (function () {
182 }, 182 },
183 form_schedule_daily_qp: function () { 183 form_schedule_daily_qp: function () {
184 gb_embed_form_hanlde.open_modal_form_fragment('/pages/forms/statement/scheduleDailyQp.html', '调度工作日报表'); 184 gb_embed_form_hanlde.open_modal_form_fragment('/pages/forms/statement/scheduleDailyQp.html', '调度工作日报表');
  185 + },
  186 + form_schedule_daily: function () {
  187 + gb_embed_form_hanlde.open_modal_form_fragment('/pages/forms/statement/scheduleDaily.html', '调度工作日报表');
185 } 188 }
186 }; 189 };
187 190
src/test/java/com/bsth/service/schedule/rules/DroolsRulesTest2.java 0 → 100644
  1 +package com.bsth.service.schedule.rules;
  2 +
  3 +import com.bsth.Application;
  4 +import org.junit.runner.RunWith;
  5 +import org.kie.api.KieBase;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.boot.test.SpringApplicationConfiguration;
  8 +import org.springframework.context.annotation.ComponentScan;
  9 +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  10 +
  11 +/**
  12 + * 测试类。
  13 + */
  14 +@RunWith(SpringJUnit4ClassRunner.class)
  15 +@SpringApplicationConfiguration(classes = {Application.class})
  16 +@ComponentScan(basePackages = {"com.bsth.entity"})
  17 +public class DroolsRulesTest2 {
  18 + @Autowired
  19 + private KieBase kieBase;
  20 +
  21 + @org.junit.Test
  22 + public void test1() throws Exception {
  23 + System.out.println("dfdfdfdfd");
  24 + }
  25 +
  26 +}
src/test/resources/test.properties 0 → 100644