Commit b59169e56dbc66f516d164a1beae18d7af05a645
Merge branch 'minhang' into qingpu
# Conflicts: # src/main/resources/static/real_control_v2/main.html
Showing
77 changed files
with
2738 additions
and
593 deletions
Too many changes to show.
To preserve performance only 77 of 220 files are displayed.
pom.xml
src/main/java/com/bsth/controller/DownloadController.java
| ... | ... | @@ -20,6 +20,7 @@ import org.springframework.http.ResponseEntity; |
| 20 | 20 | import org.springframework.stereotype.Component; |
| 21 | 21 | import org.springframework.web.bind.annotation.RequestMapping; |
| 22 | 22 | |
| 23 | +import com.google.protobuf.UnknownFieldSet.Field; | |
| 23 | 24 | import com.mysql.fabric.Response; |
| 24 | 25 | |
| 25 | 26 | /** |
| ... | ... | @@ -39,9 +40,8 @@ public class DownloadController |
| 39 | 40 | |
| 40 | 41 | @RequestMapping("download2") |
| 41 | 42 | public ResponseEntity<byte[]> download2(String fileName) throws IOException { |
| 42 | -// fileName = fileName+".xls"; | |
| 43 | 43 | String fileNames=URLDecoder.decode(fileName,"UTF-8"); |
| 44 | - fileNames =fileNames + ".xls"; | |
| 44 | + fileNames = fileNames + ".xls"; | |
| 45 | 45 | String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileNames; |
| 46 | 46 | System.out.println(moudelPath); |
| 47 | 47 | // String path="D:\\export\\target\\"+jName+".xls"; |
| ... | ... | @@ -75,5 +75,29 @@ public class DownloadController |
| 75 | 75 | os.write(buffer);// 输出文件 |
| 76 | 76 | os.flush(); |
| 77 | 77 | os.close(); |
| 78 | + file.delete(); | |
| 79 | + } | |
| 80 | + | |
| 81 | + @RequestMapping("downloadList") | |
| 82 | + public void downloadList(HttpServletResponse response,String fileName) | |
| 83 | + throws IOException { | |
| 84 | +// String fileNames=URLDecoder.decode(fileName,"UTF-8"); | |
| 85 | + fileName = fileName + ".zip"; | |
| 86 | + String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; | |
| 87 | + File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 | |
| 88 | +// String filename = file.getName();// 获取日志文件名称 | |
| 89 | + InputStream fis = new BufferedInputStream(new FileInputStream(moudelPath)); | |
| 90 | + byte[] buffer = new byte[fis.available()]; | |
| 91 | + fis.read(buffer); | |
| 92 | + fis.close(); | |
| 93 | + response.reset(); | |
| 94 | + response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"),"iso8859-1")); | |
| 95 | + response.addHeader("Content-Length", "" + file.length()); | |
| 96 | + OutputStream os = new BufferedOutputStream(response.getOutputStream()); | |
| 97 | + response.setContentType("application/octet-stream"); | |
| 98 | + os.write(buffer);// 输出文件 | |
| 99 | + os.flush(); | |
| 100 | + os.close(); | |
| 101 | + file.delete(); | |
| 78 | 102 | } |
| 79 | 103 | } | ... | ... |
src/main/java/com/bsth/controller/oil/DlbController.java
0 → 100644
| 1 | +package com.bsth.controller.oil; | |
| 2 | + | |
| 3 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 4 | +import org.springframework.web.bind.annotation.RestController; | |
| 5 | +import com.bsth.controller.BaseController; | |
| 6 | +import com.bsth.entity.oil.Dlb; | |
| 7 | + | |
| 8 | +@RestController | |
| 9 | +@RequestMapping("dlb") | |
| 10 | +public class DlbController extends BaseController<Dlb, Integer>{ | |
| 11 | + | |
| 12 | +} | ... | ... |
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
| ... | ... | @@ -2,8 +2,13 @@ package com.bsth.controller.realcontrol; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.serializer.PropertyFilter; |
| 5 | +import com.bsth.common.ResponseCode; | |
| 5 | 6 | import com.bsth.data.BasicData; |
| 7 | +import org.slf4j.Logger; | |
| 8 | +import org.slf4j.LoggerFactory; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 6 | 10 | import org.springframework.web.bind.annotation.RequestMapping; |
| 11 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 7 | 12 | import org.springframework.web.bind.annotation.RestController; |
| 8 | 13 | |
| 9 | 14 | import java.util.HashMap; |
| ... | ... | @@ -14,6 +19,13 @@ import java.util.Map; |
| 14 | 19 | @RequestMapping("/basic") |
| 15 | 20 | public class BasicDataController { |
| 16 | 21 | |
| 22 | + @Autowired | |
| 23 | + BasicData.BasicDataLoader dataLoader; | |
| 24 | + | |
| 25 | + @Autowired | |
| 26 | + BasicData basicData; | |
| 27 | + | |
| 28 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 17 | 29 | |
| 18 | 30 | @RequestMapping("/cars") |
| 19 | 31 | public Iterable<String> findAllNbbm(Map<String, Object> map){ |
| ... | ... | @@ -53,10 +65,6 @@ public class BasicDataController { |
| 53 | 65 | |
| 54 | 66 | @RequestMapping("/all_personnel") |
| 55 | 67 | public Map<String, String> all_personnel(){ |
| 56 | - //Map<String, Object> rs = new HashMap<>(); | |
| 57 | - //PersonnelFieldFilter filter=new PersonnelFieldFilter(); | |
| 58 | - | |
| 59 | - //rs.put("list", JSON.parse(JSON.toJSONString(BasicData.jsyMap.values(), filter))); | |
| 60 | 68 | return BasicData.allPerson; |
| 61 | 69 | } |
| 62 | 70 | |
| ... | ... | @@ -72,6 +80,50 @@ public class BasicDataController { |
| 72 | 80 | } |
| 73 | 81 | return false; |
| 74 | 82 | } |
| 75 | - | |
| 83 | + } | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 刷新车辆和设备号对照数据 | |
| 87 | + * @return | |
| 88 | + */ | |
| 89 | + @RequestMapping(value = "/refresh_nbbm2Device", method = RequestMethod.POST) | |
| 90 | + public Map<String, Object> refreshNbbm2DeviceId(){ | |
| 91 | + Map<String, Object> rs = new HashMap<>(); | |
| 92 | + try { | |
| 93 | + dataLoader.loadDeviceInfo(); | |
| 94 | + rs.put("status", ResponseCode.SUCCESS); | |
| 95 | + }catch (Exception e){ | |
| 96 | + rs.put("status", ResponseCode.ERROR); | |
| 97 | + rs.put("msg", e.getMessage()); | |
| 98 | + logger.error("", e); | |
| 99 | + } | |
| 100 | + return rs; | |
| 101 | + } | |
| 102 | + | |
| 103 | + /** | |
| 104 | + * 刷新员工对照数据 | |
| 105 | + * @return | |
| 106 | + */ | |
| 107 | + @RequestMapping(value = "/refresh_person_data", method = RequestMethod.POST) | |
| 108 | + public Map<String, Object> refreshPersonData(){ | |
| 109 | + Map<String, Object> rs = new HashMap<>(); | |
| 110 | + try { | |
| 111 | + dataLoader.loadPersonnelInfo(); | |
| 112 | + rs.put("status", ResponseCode.SUCCESS); | |
| 113 | + }catch (Exception e){ | |
| 114 | + rs.put("status", ResponseCode.ERROR); | |
| 115 | + rs.put("msg", e.getMessage()); | |
| 116 | + logger.error("", e); | |
| 117 | + } | |
| 118 | + return rs; | |
| 119 | + } | |
| 120 | + | |
| 121 | + /** | |
| 122 | + * 车辆自编号和车牌号对照 | |
| 123 | + * @return | |
| 124 | + */ | |
| 125 | + @RequestMapping("/nbbm2PlateNo") | |
| 126 | + public Map<String, String> nbbm2PlateNo(){ | |
| 127 | + return basicData.getNbbm2PlateNo(); | |
| 76 | 128 | } |
| 77 | 129 | } | ... | ... |
src/main/java/com/bsth/controller/realcontrol/PageForwardingController.java
| 1 | -package com.bsth.controller.realcontrol; | |
| 2 | - | |
| 3 | -import com.bsth.entity.sys.SysUser; | |
| 4 | -import com.bsth.security.util.SecurityUtils; | |
| 5 | -import org.springframework.stereotype.Controller; | |
| 6 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 7 | -import org.springframework.web.servlet.ModelAndView; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * 线调登入页面转发 | |
| 11 | - * Created by panzhao on 2017/1/21. | |
| 12 | - */ | |
| 13 | -@Controller | |
| 14 | -@RequestMapping("real_control") | |
| 15 | -public class PageForwardingController { | |
| 16 | - | |
| 17 | - @RequestMapping("/v2") | |
| 18 | - public ModelAndView v2(){ | |
| 19 | - ModelAndView mv = new ModelAndView(); | |
| 20 | - SysUser user = SecurityUtils.getCurrentUser(); | |
| 21 | - | |
| 22 | - //班次管理员 | |
| 23 | - if(user.getUserName().equals("bcgly")){ | |
| 24 | - mv.setViewName("/real_control_v2/sch_manage/sch_imitate.html"); | |
| 25 | - } | |
| 26 | - //正常线调主页 | |
| 27 | - else | |
| 28 | - mv.setViewName("/real_control_v2/main.html"); | |
| 29 | - return mv; | |
| 30 | - } | |
| 31 | -} | |
| 1 | +package com.bsth.controller.realcontrol; | |
| 2 | + | |
| 3 | +import com.bsth.entity.sys.SysUser; | |
| 4 | +import com.bsth.security.util.SecurityUtils; | |
| 5 | +import org.springframework.stereotype.Controller; | |
| 6 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 7 | +import org.springframework.web.servlet.ModelAndView; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 线调登入页面转发 | |
| 11 | + * Created by panzhao on 2017/1/21. | |
| 12 | + */ | |
| 13 | +@Controller | |
| 14 | +@RequestMapping("real_control") | |
| 15 | +public class PageForwardingController { | |
| 16 | + | |
| 17 | + @RequestMapping("/v2") | |
| 18 | + public ModelAndView v2(){ | |
| 19 | + ModelAndView mv = new ModelAndView(); | |
| 20 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 21 | + | |
| 22 | + //班次管理员 | |
| 23 | + if(user.getUserName().equals("bcgly")){ | |
| 24 | + mv.setViewName("/real_control_v2/sch_manage/sch_imitate.html"); | |
| 25 | + } | |
| 26 | + //正常线调主页 | |
| 27 | + else | |
| 28 | + mv.setViewName("/real_control_v2/main.html"); | |
| 29 | + return mv; | |
| 30 | + } | |
| 31 | +} | ... | ... |
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
| ... | ... | @@ -49,6 +49,11 @@ public class RealMapController { |
| 49 | 49 | return realMapService.findRouteByLine(lineCode); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | + @RequestMapping(value = "/multiRouteByLine") | |
| 53 | + public Map<String, Object> multiRouteByLine(@RequestParam String codeStr) { | |
| 54 | + return realMapService.multiRouteByLine(codeStr); | |
| 55 | + } | |
| 56 | + | |
| 52 | 57 | |
| 53 | 58 | /** |
| 54 | 59 | * 获取线路的路段路由 和 站点路由信息 (为前端站间距计算提供数据源) | ... | ... |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| ... | ... | @@ -7,6 +7,7 @@ import com.bsth.controller.realcontrol.dto.DfsjChange; |
| 7 | 7 | import com.bsth.data.BasicData; |
| 8 | 8 | import com.bsth.data.schedule.DayOfSchedule; |
| 9 | 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 10 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 10 | 11 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 11 | 12 | import org.apache.commons.lang3.StringEscapeUtils; |
| 12 | 13 | import org.joda.time.format.DateTimeFormat; |
| ... | ... | @@ -429,4 +430,23 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 429 | 430 | public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){ |
| 430 | 431 | return scheduleRealInfoService.scheduleDailyQp(line,date); |
| 431 | 432 | } |
| 433 | + | |
| 434 | + @RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET) | |
| 435 | + public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){ | |
| 436 | + return scheduleRealInfoService.scheduleDailyExport(map); | |
| 437 | + } | |
| 438 | + | |
| 439 | + @RequestMapping(value = "exportWaybillMore", method = RequestMethod.POST) | |
| 440 | + public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){ | |
| 441 | + return scheduleRealInfoService.exportWaybillMore(map); | |
| 442 | + } | |
| 443 | + | |
| 444 | + /** | |
| 445 | + * 获取当日计划排班 , 从计划表抓取数据 | |
| 446 | + * @return | |
| 447 | + */ | |
| 448 | + @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET) | |
| 449 | + public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){ | |
| 450 | + return scheduleRealInfoService.currentSchedulePlan(lineCode); | |
| 451 | + } | |
| 432 | 452 | } | ... | ... |
src/main/java/com/bsth/controller/schedule/BController.java
| ... | ... | @@ -40,9 +40,12 @@ public class BController<T, ID extends Serializable> { |
| 40 | 40 | SysUser sysUser = sysUserService.findByUserName(userName); |
| 41 | 41 | BEntity t_b = null; |
| 42 | 42 | if (t instanceof BEntity) { |
| 43 | + Date cdate = new Date(); | |
| 43 | 44 | t_b = (BEntity) t; |
| 44 | 45 | t_b.setCreateBy(sysUser); |
| 45 | - t_b.setCreateDate(new Date()); | |
| 46 | + t_b.setCreateDate(cdate); | |
| 47 | + t_b.setUpdateBy(sysUser); | |
| 48 | + t_b.setUpdateDate(cdate); | |
| 46 | 49 | } |
| 47 | 50 | |
| 48 | 51 | T t_saved = bService.save(t_b == null ? t : (T) t_b); | ... | ... |
src/main/java/com/bsth/controller/schedule/SchedulePlanController.java deleted
100644 → 0
| 1 | -package com.bsth.controller.schedule; | |
| 2 | - | |
| 3 | -import com.bsth.controller.BaseController; | |
| 4 | -import com.bsth.entity.schedule.SchedulePlan; | |
| 5 | -import com.bsth.service.schedule.SchedulePlanService; | |
| 6 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | -import org.springframework.web.bind.annotation.RequestBody; | |
| 8 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 9 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 10 | -import org.springframework.web.bind.annotation.RestController; | |
| 11 | - | |
| 12 | -import java.util.Map; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * Created by xu on 16/6/16. | |
| 16 | - */ | |
| 17 | -@RestController | |
| 18 | -@RequestMapping("spc") | |
| 19 | -public class SchedulePlanController extends BaseController<SchedulePlan, Long> { | |
| 20 | - @Autowired | |
| 21 | - private SchedulePlanService schedulePlanService; | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody | |
| 25 | - * @Title: save | |
| 26 | - * @Description: TODO(持久化对象) | |
| 27 | - * @param @param t | |
| 28 | - * @param @return 设定文件 | |
| 29 | - * @return Map<String,Object> {status: 1(成功),-1(失败)} | |
| 30 | - * @throws | |
| 31 | - */ | |
| 32 | - @RequestMapping(method = RequestMethod.POST) | |
| 33 | - public Map<String, Object> save(@RequestBody SchedulePlan t){ | |
| 34 | - | |
| 35 | - return baseService.save(t); | |
| 36 | - } | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 获取明天的一歌排班计划。 | |
| 40 | - * @return | |
| 41 | - * @throws Exception | |
| 42 | - */ | |
| 43 | - @RequestMapping(value = "/tommorw", method = RequestMethod.GET) | |
| 44 | - public SchedulePlan getTommorwPlan() throws Exception { | |
| 45 | - try { | |
| 46 | - return schedulePlanService.findSchedulePlanTommorw(); | |
| 47 | - } catch (Exception exp) { | |
| 48 | - throw new Exception(exp.getCause()); | |
| 49 | - } | |
| 50 | - } | |
| 51 | - | |
| 52 | -} |
src/main/java/com/bsth/controller/schedule/core/GuideboardInfoController.java
| ... | ... | @@ -27,22 +27,10 @@ import java.util.Map; |
| 27 | 27 | public class GuideboardInfoController extends BController<GuideboardInfo, Long> { |
| 28 | 28 | @Autowired |
| 29 | 29 | private GuideboardInfoService guideboardInfoService; |
| 30 | -// @Autowired | |
| 31 | -// private DataToolsProperties dataToolsProperties; | |
| 30 | + | |
| 32 | 31 | @Autowired |
| 33 | 32 | private GuideboardInfoRepository guideboardInfoRepository; |
| 34 | -// | |
| 35 | -// @Override | |
| 36 | -// protected String getDataImportKtrClasspath() { | |
| 37 | -// return dataToolsProperties.getGuideboardsDatainputktr(); | |
| 38 | -// } | |
| 39 | -// | |
| 40 | -// @Override | |
| 41 | -// public GuideboardInfo findById(@PathVariable("id") Long aLong) { | |
| 42 | -// return guideboardInfoRepository.findOneExtend(aLong); | |
| 43 | -// } | |
| 44 | -// | |
| 45 | -// | |
| 33 | + | |
| 46 | 34 | @RequestMapping(value = "/ttlpnames", method = RequestMethod.GET) |
| 47 | 35 | public List<Map<String, Object>> findLpName(Long ttid) { |
| 48 | 36 | return guideboardInfoRepository.findLpName(ttid); | ... | ... |
src/main/java/com/bsth/controller/schedule/core/SchedulePlanController.java
0 → 100644
| 1 | +package com.bsth.controller.schedule.core; | |
| 2 | + | |
| 3 | +import com.bsth.common.Constants; | |
| 4 | +import com.bsth.common.ResponseCode; | |
| 5 | +import com.bsth.controller.schedule.BController; | |
| 6 | +import com.bsth.entity.schedule.SchedulePlan; | |
| 7 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 8 | +import com.bsth.entity.sys.SysUser; | |
| 9 | +import com.bsth.service.schedule.SchedulePlanService; | |
| 10 | +import com.bsth.service.sys.SysUserService; | |
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | +import org.springframework.web.bind.annotation.*; | |
| 13 | + | |
| 14 | +import javax.servlet.http.HttpSession; | |
| 15 | +import java.util.Date; | |
| 16 | +import java.util.HashMap; | |
| 17 | +import java.util.List; | |
| 18 | +import java.util.Map; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * Created by xu on 16/6/16. | |
| 22 | + */ | |
| 23 | +@RestController | |
| 24 | +@RequestMapping("spc") | |
| 25 | +public class SchedulePlanController extends BController<SchedulePlan, Long> { | |
| 26 | + @Autowired | |
| 27 | + private SchedulePlanService schedulePlanService; | |
| 28 | + @Autowired | |
| 29 | + private SysUserService sysUserService; | |
| 30 | + | |
| 31 | + @Override | |
| 32 | + public Map<String, Object> save(@RequestBody SchedulePlan schedulePlan, HttpSession httpSession) { | |
| 33 | + // 用户信息 | |
| 34 | + String userName = String.valueOf(httpSession.getAttribute(Constants.SESSION_USERNAME)); | |
| 35 | + SysUser sysUser = sysUserService.findByUserName(userName); | |
| 36 | + | |
| 37 | + Date cdate = new Date(); | |
| 38 | + schedulePlan.setCreateBy(sysUser); | |
| 39 | + schedulePlan.setCreateDate(cdate); | |
| 40 | + schedulePlan.setUpdateBy(sysUser); | |
| 41 | + schedulePlan.setUpdateDate(cdate); | |
| 42 | + | |
| 43 | + // 如果多个公司,选第一个,以后改成页面控制 | |
| 44 | + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) httpSession.getAttribute(Constants.COMPANY_AUTHORITYS); | |
| 45 | + if (cmyAuths == null || cmyAuths.size() == 0) | |
| 46 | + schedulePlanService.save(schedulePlan, new CompanyAuthority()); | |
| 47 | + else | |
| 48 | + schedulePlanService.save(schedulePlan, cmyAuths.get(0)); | |
| 49 | + | |
| 50 | + Map<String, Object> rtn = new HashMap<>(); | |
| 51 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 52 | + rtn.put("data", new Object()); | |
| 53 | + return rtn; | |
| 54 | + } | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 获取明天的一歌排班计划。 | |
| 58 | + * @return | |
| 59 | + * @throws Exception | |
| 60 | + */ | |
| 61 | + @RequestMapping(value = "/tommorw", method = RequestMethod.GET) | |
| 62 | + public SchedulePlan getTommorwPlan() throws Exception { | |
| 63 | + try { | |
| 64 | + return schedulePlanService.findSchedulePlanTommorw(); | |
| 65 | + } catch (Exception exp) { | |
| 66 | + throw new Exception(exp.getCause()); | |
| 67 | + } | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 创建指定线路,指定时间范围内的排班计划,使用的时刻表情况 | |
| 72 | + * @param xlid 线路id | |
| 73 | + * @param from 开始时间 | |
| 74 | + * @param to 结束时间 | |
| 75 | + * @return | |
| 76 | + * @throws Exception | |
| 77 | + */ | |
| 78 | + @RequestMapping(value = "/valttinfo/{xlid}/{from}/{to}", method = RequestMethod.GET) | |
| 79 | + public Map<String, Object> validateTTInfo( | |
| 80 | + @PathVariable(value = "xlid") Integer xlid, | |
| 81 | + @PathVariable(value = "from") Date from, | |
| 82 | + @PathVariable(value = "to") Date to | |
| 83 | + ) throws Exception { | |
| 84 | + Map<String, Object> rtn = new HashMap<>(); | |
| 85 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 86 | + rtn.put("data", schedulePlanService.validateTTInfo(xlid, from, to)); | |
| 87 | + return rtn; | |
| 88 | + } | |
| 89 | + | |
| 90 | +} | ... | ... |
src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController.java
| ... | ... | @@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 8 | import org.springframework.web.bind.annotation.PathVariable; |
| 9 | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
| 10 | 10 | import org.springframework.web.bind.annotation.RequestMethod; |
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 11 | 12 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 13 | |
| 13 | 14 | import java.util.HashMap; |
| ... | ... | @@ -87,5 +88,16 @@ public class TTInfoDetailController extends BController<TTInfoDetail, Long> { |
| 87 | 88 | } |
| 88 | 89 | return rtn; |
| 89 | 90 | } |
| 90 | - | |
| 91 | + | |
| 92 | + /** | |
| 93 | + * 时刻表明细批量插入 | |
| 94 | + * | |
| 95 | + * @param entities | |
| 96 | + * | |
| 97 | + * @return | |
| 98 | + */ | |
| 99 | + @RequestMapping(value = "/skbDetailMxSave" ,method = RequestMethod.POST) | |
| 100 | + public Map<String, Object> skbDetailMxSave(@RequestParam Map<String, Object> entities){ | |
| 101 | + return ttInfoDetailService.skbDetailMxSave(entities); | |
| 102 | + } | |
| 91 | 103 | } | ... | ... |
src/main/java/com/bsth/controller/sys/RealControAuthorityController.java
0 → 100644
| 1 | +package com.bsth.controller.sys; | |
| 2 | + | |
| 3 | +import com.bsth.controller.BaseController; | |
| 4 | +import com.bsth.entity.sys.RealControAuthority; | |
| 5 | +import com.bsth.security.util.SecurityUtils; | |
| 6 | +import com.bsth.service.sys.RealControAuthorityService; | |
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 8 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 10 | +import org.springframework.web.bind.annotation.RestController; | |
| 11 | + | |
| 12 | +import javax.servlet.http.HttpServletRequest; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * Created by panzhao on 2017/2/14. | |
| 16 | + */ | |
| 17 | +@RestController | |
| 18 | +@RequestMapping("realControAuthority") | |
| 19 | +public class RealControAuthorityController extends BaseController<RealControAuthority, Integer> { | |
| 20 | + | |
| 21 | + @Autowired | |
| 22 | + RealControAuthorityService realControAuthorityService; | |
| 23 | + | |
| 24 | + @RequestMapping("findByUserId") | |
| 25 | + public RealControAuthority findByUserId(@RequestParam Integer userId){ | |
| 26 | + | |
| 27 | + return realControAuthorityService.findByUserId(userId); | |
| 28 | + } | |
| 29 | + | |
| 30 | + @RequestMapping("findByCurrentUser") | |
| 31 | + public RealControAuthority findByUserId(HttpServletRequest request){ | |
| 32 | + return realControAuthorityService.findByUserId(SecurityUtils.getCurrentUser().getId()); | |
| 33 | + } | |
| 34 | +} | ... | ... |
src/main/java/com/bsth/data/BasicData.java
| ... | ... | @@ -13,6 +13,7 @@ import org.slf4j.Logger; |
| 13 | 13 | import org.slf4j.LoggerFactory; |
| 14 | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | 15 | import org.springframework.boot.CommandLineRunner; |
| 16 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 16 | 17 | import org.springframework.stereotype.Component; |
| 17 | 18 | |
| 18 | 19 | import java.util.*; |
| ... | ... | @@ -89,6 +90,18 @@ public class BasicData implements CommandLineRunner { |
| 89 | 90 | return name != null? name: stationCode2NameMap.get(prefix + code); |
| 90 | 91 | } |
| 91 | 92 | |
| 93 | + @Autowired | |
| 94 | + JdbcTemplate jdbcTemplate; | |
| 95 | + public Map<String, String> getNbbm2PlateNo(){ | |
| 96 | + List<Map<String, Object>> list = jdbcTemplate.queryForList("select CAR_CODE,CAR_PLATE from bsth_c_cars where CAR_CODE is not null and CAR_PLATE is not null"); | |
| 97 | + | |
| 98 | + Map<String, String> rs = new HashMap<>(); | |
| 99 | + for(Map<String, Object> map : list){ | |
| 100 | + rs.put(map.get("CAR_CODE").toString(), map.get("CAR_PLATE").toString()); | |
| 101 | + } | |
| 102 | + return rs; | |
| 103 | + } | |
| 104 | + | |
| 92 | 105 | @Component |
| 93 | 106 | public static class BasicDataLoader extends Thread { |
| 94 | 107 | |
| ... | ... | @@ -309,9 +322,6 @@ public class BasicData implements CommandLineRunner { |
| 309 | 322 | if (StringUtils.isEmpty(jobCode)) |
| 310 | 323 | continue; |
| 311 | 324 | |
| 312 | - /*if (jobCode.indexOf("-") != -1) { | |
| 313 | - jobCode = jobCode.split("-")[1]; | |
| 314 | - }*/ | |
| 315 | 325 | if (p.getPosts() != null) { |
| 316 | 326 | if (p.getPosts().equals("1")) |
| 317 | 327 | jsyTempMap.put(jobCode, p); | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
| ... | ... | @@ -88,6 +88,9 @@ public class GpsEntity { |
| 88 | 88 | /** 越界距离 */ |
| 89 | 89 | private double outOfBoundDistance; |
| 90 | 90 | |
| 91 | + /** gps是否有效 设备端发送的状态 */ | |
| 92 | + private int valid; | |
| 93 | + | |
| 91 | 94 | public Integer getCompanyCode() { |
| 92 | 95 | return companyCode; |
| 93 | 96 | } |
| ... | ... | @@ -280,4 +283,12 @@ public class GpsEntity { |
| 280 | 283 | public void setOutOfBoundDistance(double outOfBoundDistance) { |
| 281 | 284 | this.outOfBoundDistance = outOfBoundDistance; |
| 282 | 285 | } |
| 286 | + | |
| 287 | + public int getValid() { | |
| 288 | + return valid; | |
| 289 | + } | |
| 290 | + | |
| 291 | + public void setValid(int valid) { | |
| 292 | + this.valid = valid; | |
| 293 | + } | |
| 283 | 294 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.data.gpsdata; |
| 3 | 3 | import com.bsth.data.BasicData; |
| 4 | 4 | import com.bsth.data.forecast.ForecastRealServer; |
| 5 | 5 | import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; |
| 6 | +import com.bsth.data.gpsdata.thread.OfflineMonitorThread; | |
| 6 | 7 | import com.bsth.data.schedule.DayOfSchedule; |
| 7 | 8 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 8 | 9 | import com.google.common.collect.TreeMultimap; |
| ... | ... | @@ -35,6 +36,9 @@ public class GpsRealData implements CommandLineRunner { |
| 35 | 36 | GpsDataLoaderThread gpsDataLoader; |
| 36 | 37 | |
| 37 | 38 | @Autowired |
| 39 | + OfflineMonitorThread offlineMonitorThread; | |
| 40 | + | |
| 41 | + @Autowired | |
| 38 | 42 | DayOfSchedule dayOfSchedule; |
| 39 | 43 | |
| 40 | 44 | @Autowired |
| ... | ... | @@ -54,9 +58,10 @@ public class GpsRealData implements CommandLineRunner { |
| 54 | 58 | //定时从网关获取GPS数据 |
| 55 | 59 | //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS); |
| 56 | 60 | //定时扫描掉离线 |
| 57 | - | |
| 61 | + //Application.mainServices.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); | |
| 58 | 62 | } |
| 59 | 63 | |
| 64 | + | |
| 60 | 65 | public void put(GpsEntity gps) { |
| 61 | 66 | String device = gps.getDeviceId(); |
| 62 | 67 | GpsEntity old = gpsMap.get(device); | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/SignalHandle.java
| ... | ... | @@ -19,10 +19,22 @@ public abstract class SignalHandle { |
| 19 | 19 | return prevs != null && prevs.size() > 0 && prevs.getTail() != null; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - protected boolean isDriftSignal(GpsEntity gps) { | |
| 22 | +/* protected boolean isDriftSignal(GpsEntity gps) { | |
| 23 | + return gps.getLat() == 0 || gps.getLon() == 0; | |
| 24 | + }*/ | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * gps掉线 | |
| 28 | + * @param gps | |
| 29 | + * @return | |
| 30 | + */ | |
| 31 | + protected boolean isGpsOffline(GpsEntity gps){ | |
| 23 | 32 | return gps.getLat() == 0 || gps.getLon() == 0; |
| 24 | 33 | } |
| 25 | 34 | |
| 35 | + protected boolean isOffline(GpsEntity gps){ | |
| 36 | + return gps.getAbnormalStatus() != null && gps.getAbnormalStatus().equals("offline"); | |
| 37 | + } | |
| 26 | 38 | /** |
| 27 | 39 | * 是不是异常信号 |
| 28 | 40 | * |
| ... | ... | @@ -34,7 +46,7 @@ public abstract class SignalHandle { |
| 34 | 46 | /** |
| 35 | 47 | * 连续异常信号个数统计 |
| 36 | 48 | * |
| 37 | - * @param prevs | |
| 49 | + * @param | |
| 38 | 50 | * @return protected int abnormalCount(CircleQueue<GpsEntity> prevs) { |
| 39 | 51 | * int count = 0; |
| 40 | 52 | * <p> |
| ... | ... | @@ -78,9 +90,9 @@ public abstract class SignalHandle { |
| 78 | 90 | return false; |
| 79 | 91 | |
| 80 | 92 | GpsEntity prev = prevs.getTail(); |
| 81 | - //从漂移状态恢复 | |
| 82 | - if (isDriftSignal(prev) | |
| 83 | - && !isDriftSignal(gps)) { | |
| 93 | + //从异常状态恢复 | |
| 94 | + if (isGpsOffline(prev) | |
| 95 | + && !isGpsOffline(gps)) { | |
| 84 | 96 | return true; |
| 85 | 97 | } |
| 86 | 98 | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/entity/ArrivalInfo.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.arrival.entity; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 到离站信息 | |
| 5 | + * Created by panzhao on 2017/2/20. | |
| 6 | + */ | |
| 7 | +public class ArrivalInfo { | |
| 8 | + | |
| 9 | + private String lineCode; | |
| 10 | + | |
| 11 | + private String deviceId; | |
| 12 | + | |
| 13 | + /** 时间戳 */ | |
| 14 | + private Long ts; | |
| 15 | + | |
| 16 | + private String stop; | |
| 17 | + | |
| 18 | + private Integer upDown; | |
| 19 | + | |
| 20 | + private int inOut; | |
| 21 | + | |
| 22 | + | |
| 23 | +} | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/AbnormalStateHandle.java
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
| ... | ... | @@ -46,10 +46,13 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 46 | 46 | |
| 47 | 47 | private final static int MAX_BEFORE_TIME = 1000 * 60 * 72; |
| 48 | 48 | |
| 49 | + //最大的班次时间差,防止异常的GPS时间打乱数据 | |
| 50 | + private final static int MAX_NORMAL_DIFF = 1000 * 60 * 60 * 12; | |
| 51 | + | |
| 49 | 52 | @Override |
| 50 | 53 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { |
| 51 | - //忽略漂移信号 | |
| 52 | - if(isDriftSignal(gps)) | |
| 54 | + //忽略掉线信号 | |
| 55 | + if(isGpsOffline(gps)) | |
| 53 | 56 | return false; |
| 54 | 57 | |
| 55 | 58 | //从异常状态恢复的第一个信号 |
| ... | ... | @@ -106,8 +109,14 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 106 | 109 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); |
| 107 | 110 | String qdzCode = sch.getQdzCode(); |
| 108 | 111 | |
| 112 | + int diff = (int) (sch.getDfsjT() - gps.getTimestamp()); | |
| 113 | + | |
| 109 | 114 | //首班出场最多提前1.2小时 |
| 110 | - if(dayOfSchedule.isFirstOut(sch) && sch.getDfsjT() - gps.getTimestamp() > MAX_BEFORE_TIME) | |
| 115 | + if(dayOfSchedule.isFirstOut(sch) && diff > MAX_BEFORE_TIME) | |
| 116 | + return; | |
| 117 | + | |
| 118 | + //正常班次最大时间差 | |
| 119 | + if(Math.abs(diff) > MAX_NORMAL_DIFF) | |
| 111 | 120 | return; |
| 112 | 121 | |
| 113 | 122 | //起点发车 |
| ... | ... | @@ -169,8 +178,13 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 169 | 178 | |
| 170 | 179 | if(gps.getStopNo().equals(sch.getZdzCode())){ |
| 171 | 180 | |
| 181 | + int diff = (int) (sch.getZdsjT() - gps.getTimestamp()); | |
| 172 | 182 | //进场最多提前1.2小时 |
| 173 | - if(sch.getBcType().equals("in") && sch.getZdsjT() - gps.getTimestamp() > MAX_BEFORE_TIME) | |
| 183 | + if(sch.getBcType().equals("in") && diff > MAX_BEFORE_TIME) | |
| 184 | + return; | |
| 185 | + | |
| 186 | + //正常班次最大时间差 | |
| 187 | + if(Math.abs(diff) > MAX_NORMAL_DIFF) | |
| 174 | 188 | return; |
| 175 | 189 | |
| 176 | 190 | //实达时间不覆盖 |
| ... | ... | @@ -195,7 +209,7 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 195 | 209 | //进站既进场 |
| 196 | 210 | inStationAndInPark(sch, next); |
| 197 | 211 | //将gps转换为下一个班次走向的站内信号 |
| 198 | - transformUpdown(gps, sch); | |
| 212 | + transformUpdown(gps, next); | |
| 199 | 213 | } |
| 200 | 214 | } |
| 201 | 215 | else if(sch.getFcsjActual() == null){ |
| ... | ... | @@ -217,6 +231,11 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 217 | 231 | |
| 218 | 232 | sendUtils.refreshSch(next); |
| 219 | 233 | dayOfSchedule.save(next); |
| 234 | + | |
| 235 | + //分班的时候,需要再跳过1个班次 | |
| 236 | + next = dayOfSchedule.next(next); | |
| 237 | + if(next != null) | |
| 238 | + dayOfSchedule.addExecPlan(next); | |
| 220 | 239 | } |
| 221 | 240 | } |
| 222 | 241 | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/OfflineSignalHandle.java
| ... | ... | @@ -21,9 +21,10 @@ public class OfflineSignalHandle extends SignalHandle{ |
| 21 | 21 | |
| 22 | 22 | @Override |
| 23 | 23 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { |
| 24 | - //漂移信号不管 | |
| 25 | - if(isDriftSignal(gps)){ | |
| 24 | + //掉线信号不管 | |
| 25 | + if(isGpsOffline(gps)){ | |
| 26 | 26 | gps.setSignalState("drift"); |
| 27 | + gps.setAbnormalStatus("gps-offline"); | |
| 27 | 28 | return true; |
| 28 | 29 | } |
| 29 | 30 | ... | ... |
src/main/java/com/bsth/data/gpsdata/thread/GpsDataLoaderThread.java
src/main/java/com/bsth/data/gpsdata/thread/OfflineMonitorThread.java
| ... | ... | @@ -2,7 +2,11 @@ package com.bsth.data.gpsdata.thread; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.data.gpsdata.GpsEntity; |
| 4 | 4 | import com.bsth.data.gpsdata.GpsRealData; |
| 5 | +import com.bsth.websocket.handler.SendUtils; | |
| 6 | +import org.slf4j.Logger; | |
| 7 | +import org.slf4j.LoggerFactory; | |
| 5 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | +import org.springframework.stereotype.Component; | |
| 6 | 10 | |
| 7 | 11 | import java.util.Collection; |
| 8 | 12 | |
| ... | ... | @@ -10,35 +14,45 @@ import java.util.Collection; |
| 10 | 14 | * GPS掉离线监控 |
| 11 | 15 | * Created by panzhao on 2017/1/11. |
| 12 | 16 | */ |
| 17 | +@Component | |
| 13 | 18 | public class OfflineMonitorThread extends Thread{ |
| 14 | 19 | |
| 15 | 20 | @Autowired |
| 16 | 21 | GpsRealData gpsRealData; |
| 17 | 22 | |
| 18 | - //有任务时 掉线阈值 | |
| 19 | - private final static int LOSE_TIME = 1000 * 60 * 2; | |
| 23 | + //掉线阈值 | |
| 24 | + private final static int LOSE_TIME = 1000 * 60 * 10; | |
| 25 | + | |
| 26 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 27 | + | |
| 28 | + @Autowired | |
| 29 | + SendUtils sendUtils; | |
| 20 | 30 | |
| 21 | 31 | //无任务时 离线阈值 |
| 22 | - private final static int OFFLINE_TIME = 1000 * 60 * 10; | |
| 32 | + //private final static int OFFLINE_TIME = 1000 * 60 * 10; | |
| 23 | 33 | |
| 24 | 34 | @Override |
| 25 | 35 | public void run() { |
| 26 | - long t = System.currentTimeMillis(); | |
| 27 | - Collection<GpsEntity> list = gpsRealData.all(); | |
| 28 | - | |
| 29 | - String state; | |
| 30 | - for(GpsEntity gps : list){ | |
| 31 | - state = gps.getAbnormalStatus(); | |
| 32 | - | |
| 33 | - if(state.equals("offline")) | |
| 34 | - continue; | |
| 35 | - | |
| 36 | - | |
| 37 | - //if(state.equals("lose")) | |
| 38 | - //if(!state.equals("lose")) | |
| 39 | - //if(state.equals("")) | |
| 40 | - //if(gps.getTimestamp()) | |
| 41 | - //if(gps.getAbnormalStatus().equals("lose")) | |
| 36 | + try{ | |
| 37 | + long t = System.currentTimeMillis(); | |
| 38 | + Collection<GpsEntity> list = gpsRealData.all(); | |
| 39 | + | |
| 40 | + String state; | |
| 41 | + for(GpsEntity gps : list){ | |
| 42 | + state = gps.getAbnormalStatus(); | |
| 43 | + | |
| 44 | + if(state != null && state.equals("offline")) | |
| 45 | + continue; | |
| 46 | + | |
| 47 | + if (t - gps.getTimestamp() > LOSE_TIME){ | |
| 48 | + gps.setAbnormalStatus("offline"); | |
| 49 | + | |
| 50 | + //通知页面有设备掉线 | |
| 51 | + sendUtils.deviceOffline(gps); | |
| 52 | + } | |
| 53 | + } | |
| 54 | + }catch (Exception e){ | |
| 55 | + logger.error("", e); | |
| 42 | 56 | } |
| 43 | 57 | } |
| 44 | 58 | } | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -49,6 +49,9 @@ public class DayOfSchedule implements CommandLineRunner { |
| 49 | 49 | |
| 50 | 50 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 51 | 51 | |
| 52 | + //按线路分组的 “计划” 排班数据 | |
| 53 | + public static Map<String, List<SchedulePlanInfo>> schedulePlanMap; | |
| 54 | + | |
| 52 | 55 | // 按车辆分组的班次数据 |
| 53 | 56 | private static ArrayListMultimap<String, ScheduleRealInfo> nbbmScheduleMap; |
| 54 | 57 | |
| ... | ... | @@ -101,6 +104,8 @@ public class DayOfSchedule implements CommandLineRunner { |
| 101 | 104 | currSchDateMap = new HashMap<>(); |
| 102 | 105 | nbbm2SEStationMap = TreeMultimap.create(); |
| 103 | 106 | carExecutePlanMap = new HashMap<>(); |
| 107 | + | |
| 108 | + schedulePlanMap = new HashMap<>(); | |
| 104 | 109 | } |
| 105 | 110 | |
| 106 | 111 | @Autowired |
| ... | ... | @@ -328,6 +333,8 @@ public class DayOfSchedule implements CommandLineRunner { |
| 328 | 333 | |
| 329 | 334 | // 查询计划排班 |
| 330 | 335 | List<SchedulePlanInfo> planItr = cleanSchPlanItr(schPlanService.list(data).iterator()); |
| 336 | + //保存一份原始计划排班数据 | |
| 337 | + schedulePlanMap.put(lineCode, planItr); | |
| 331 | 338 | |
| 332 | 339 | // 转换为实际排班 |
| 333 | 340 | realList = JSONArray.parseArray(JSON.toJSONString(planItr), ScheduleRealInfo.class); |
| ... | ... | @@ -341,6 +348,13 @@ public class DayOfSchedule implements CommandLineRunner { |
| 341 | 348 | if (StringUtils.isEmpty(sch.getFcsj())) |
| 342 | 349 | sch.setFcsj("00:00"); |
| 343 | 350 | |
| 351 | + if(sch.getFcsj().equals("24:00")) | |
| 352 | + sch.setFcsj("23:59"); | |
| 353 | + | |
| 354 | + if(sch.getFcsj().substring(0, 2).equals("24")){ | |
| 355 | + sch.setFcsj("00" + sch.getFcsj().substring(2)); | |
| 356 | + } | |
| 357 | + | |
| 344 | 358 | fcsj = sch.getFcsj().trim(); |
| 345 | 359 | //处理一下发车时间格式没有:号的问题 |
| 346 | 360 | if (fcsj.indexOf(":") == -1 && fcsj.length() >= 4) { |
| ... | ... | @@ -367,6 +381,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 367 | 381 | } catch (Exception e) { |
| 368 | 382 | logger.error("", e); |
| 369 | 383 | } |
| 384 | + | |
| 370 | 385 | return realList; |
| 371 | 386 | } |
| 372 | 387 | |
| ... | ... | @@ -392,7 +407,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 392 | 407 | new BatchSaveUtils<ScheduleRealInfo>().saveList(list, ScheduleRealInfo.class); |
| 393 | 408 | } |
| 394 | 409 | |
| 395 | - private List<SchedulePlanInfo> cleanSchPlanItr(Iterator<SchedulePlanInfo> itrab) { | |
| 410 | + public List<SchedulePlanInfo> cleanSchPlanItr(Iterator<SchedulePlanInfo> itrab) { | |
| 396 | 411 | List<SchedulePlanInfo> list = new ArrayList<>(); |
| 397 | 412 | |
| 398 | 413 | SchedulePlanInfo sp; |
| ... | ... | @@ -823,8 +838,8 @@ public class DayOfSchedule implements CommandLineRunner { |
| 823 | 838 | first = executeCurr(nbbm); |
| 824 | 839 | |
| 825 | 840 | if(first.getBcType().equals("out") |
| 826 | - && first.getDfsjT() < second.getDfsjT() | |
| 827 | - && doneSum(nbbm) == 0 && second.getDfsjT() > time) | |
| 841 | + && first.getDfsjT() < second.getDfsjT() | |
| 842 | + && doneSum(nbbm) == 0 && second.getDfsjT() > time) | |
| 828 | 843 | return true; |
| 829 | 844 | } catch (Exception e) { |
| 830 | 845 | logger.error("", e); |
| ... | ... | @@ -840,10 +855,10 @@ public class DayOfSchedule implements CommandLineRunner { |
| 840 | 855 | |
| 841 | 856 | public int stopTimePlan(Object task) { |
| 842 | 857 | |
| 843 | - ScheduleRealInfo sch = prev((ScheduleRealInfo) task); | |
| 858 | + ScheduleRealInfo sch = prev((ScheduleRealInfo) task); | |
| 844 | 859 | |
| 845 | - sch.getzdsj | |
| 846 | - return -1; | |
| 860 | + sch.getzdsj | |
| 861 | + return -1; | |
| 847 | 862 | }*/ |
| 848 | 863 | |
| 849 | 864 | /** | ... | ... |
src/main/java/com/bsth/entity/SectionRoute.java
src/main/java/com/bsth/entity/oil/Dlb.java
0 → 100644
| 1 | +package com.bsth.entity.oil; | |
| 2 | + | |
| 3 | +import java.text.DecimalFormat; | |
| 4 | +import java.util.Date; | |
| 5 | + | |
| 6 | +import javax.persistence.Entity; | |
| 7 | +import javax.persistence.GeneratedValue; | |
| 8 | +import javax.persistence.Id; | |
| 9 | +import javax.persistence.Table; | |
| 10 | +import javax.persistence.Transient; | |
| 11 | + | |
| 12 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 13 | + | |
| 14 | +import com.bsth.data.BasicData; | |
| 15 | + | |
| 16 | +@Entity | |
| 17 | +@Table(name = "bsth_c_dlb") | |
| 18 | +public class Dlb { | |
| 19 | + @Id | |
| 20 | + @GeneratedValue | |
| 21 | + private Integer id; | |
| 22 | + @DateTimeFormat(pattern="yyyy-MM-dd") | |
| 23 | + private Date rq; | |
| 24 | + private String xlbm; | |
| 25 | + private String ssgsdm; | |
| 26 | + private String fgsdm; | |
| 27 | + private String nbbm; | |
| 28 | + private String jsy; | |
| 29 | + private Double czlc=0.0; | |
| 30 | + private Double jzlc=0.0; | |
| 31 | + //出站存电 | |
| 32 | + private Double czcd=0.0; | |
| 33 | + //进站存电 | |
| 34 | + private Double jzcd=0.0; | |
| 35 | + //充电量 | |
| 36 | + private Double cdl; | |
| 37 | + private int sfkt; | |
| 38 | + private String jhsj; | |
| 39 | + //耗电 | |
| 40 | + private Double hd=0.0; | |
| 41 | + private Double sh=0.0; | |
| 42 | + private String shyy; | |
| 43 | + private Double zlc=0.0; | |
| 44 | + private int yhlx; | |
| 45 | + | |
| 46 | + private Double ns=0.0; | |
| 47 | + private Double fyylc=0.0; | |
| 48 | + private Double jhzlc=0.0; | |
| 49 | + private Double jhfyylc=0.0; | |
| 50 | + private int jhzbc; | |
| 51 | + private int jhbc; | |
| 52 | + private int sjzbc; | |
| 53 | + private int sjbc; | |
| 54 | + private String edituser; | |
| 55 | + private Date edittime; | |
| 56 | + private Date createtime; | |
| 57 | + private int nylx; | |
| 58 | + //进场顺序(根据最先出场和最后进场来关联车辆的存油量) | |
| 59 | + private int jcsx; | |
| 60 | + | |
| 61 | + @Transient | |
| 62 | + private String bglyh; | |
| 63 | + | |
| 64 | + @Transient | |
| 65 | + private String xlname; | |
| 66 | + | |
| 67 | + @Transient | |
| 68 | + private String gsname; | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + public Integer getId() { | |
| 74 | + return id; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void setId(Integer id) { | |
| 78 | + this.id = id; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public Date getRq() { | |
| 82 | + return rq; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public void setRq(Date rq) { | |
| 86 | + this.rq = rq; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public String getXlbm() { | |
| 90 | + return xlbm; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public void setXlbm(String xlbm) { | |
| 94 | + this.xlbm = xlbm; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public String getSsgsdm() { | |
| 98 | + return ssgsdm; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public void setSsgsdm(String ssgsdm) { | |
| 102 | + this.ssgsdm = ssgsdm; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public String getFgsdm() { | |
| 106 | + return fgsdm; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public void setFgsdm(String fgsdm) { | |
| 110 | + this.fgsdm = fgsdm; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public String getNbbm() { | |
| 114 | + return nbbm; | |
| 115 | + } | |
| 116 | + | |
| 117 | + public void setNbbm(String nbbm) { | |
| 118 | + this.nbbm = nbbm; | |
| 119 | + } | |
| 120 | + | |
| 121 | + public String getJsy() { | |
| 122 | + return jsy; | |
| 123 | + } | |
| 124 | + | |
| 125 | + public void setJsy(String jsy) { | |
| 126 | + this.jsy = jsy; | |
| 127 | + } | |
| 128 | + | |
| 129 | + public Double getCzlc() { | |
| 130 | + return czlc; | |
| 131 | + } | |
| 132 | + | |
| 133 | + public void setCzlc(Double czlc) { | |
| 134 | + this.czlc = czlc; | |
| 135 | + } | |
| 136 | + | |
| 137 | + public Double getJzlc() { | |
| 138 | + return jzlc; | |
| 139 | + } | |
| 140 | + | |
| 141 | + public void setJzlc(Double jzlc) { | |
| 142 | + this.jzlc = jzlc; | |
| 143 | + } | |
| 144 | + | |
| 145 | + public Double getCzcd() { | |
| 146 | + return czcd; | |
| 147 | + } | |
| 148 | + | |
| 149 | + public void setCzcd(Double czcd) { | |
| 150 | + this.czcd = czcd; | |
| 151 | + } | |
| 152 | + | |
| 153 | + public Double getJzcd() { | |
| 154 | + return jzcd; | |
| 155 | + } | |
| 156 | + | |
| 157 | + public void setJzcd(Double jzcd) { | |
| 158 | + this.jzcd = jzcd; | |
| 159 | + } | |
| 160 | + | |
| 161 | + public Double getCdl() { | |
| 162 | + return cdl; | |
| 163 | + } | |
| 164 | + | |
| 165 | + public void setCdl(Double cdl) { | |
| 166 | + this.cdl = cdl; | |
| 167 | + } | |
| 168 | + | |
| 169 | + public int getSfkt() { | |
| 170 | + return sfkt; | |
| 171 | + } | |
| 172 | + | |
| 173 | + public void setSfkt(int sfkt) { | |
| 174 | + this.sfkt = sfkt; | |
| 175 | + } | |
| 176 | + | |
| 177 | + public String getJhsj() { | |
| 178 | + return jhsj; | |
| 179 | + } | |
| 180 | + | |
| 181 | + public void setJhsj(String jhsj) { | |
| 182 | + this.jhsj = jhsj; | |
| 183 | + } | |
| 184 | + | |
| 185 | + public Double getHd() { | |
| 186 | + return hd; | |
| 187 | + } | |
| 188 | + | |
| 189 | + public void setHd(Double hd) { | |
| 190 | + this.hd = hd; | |
| 191 | + } | |
| 192 | + | |
| 193 | + public Double getSh() { | |
| 194 | + return sh; | |
| 195 | + } | |
| 196 | + | |
| 197 | + public void setSh(Double sh) { | |
| 198 | + this.sh = sh; | |
| 199 | + } | |
| 200 | + | |
| 201 | + public String getShyy() { | |
| 202 | + return shyy; | |
| 203 | + } | |
| 204 | + | |
| 205 | + public void setShyy(String shyy) { | |
| 206 | + this.shyy = shyy; | |
| 207 | + } | |
| 208 | + | |
| 209 | + public Double getZlc() { | |
| 210 | + return zlc; | |
| 211 | + } | |
| 212 | + | |
| 213 | + public void setZlc(Double zlc) { | |
| 214 | + this.zlc = zlc; | |
| 215 | + } | |
| 216 | + | |
| 217 | + public int getYhlx() { | |
| 218 | + return yhlx; | |
| 219 | + } | |
| 220 | + | |
| 221 | + public void setYhlx(int yhlx) { | |
| 222 | + this.yhlx = yhlx; | |
| 223 | + } | |
| 224 | + | |
| 225 | + public Double getNs() { | |
| 226 | + return ns; | |
| 227 | + } | |
| 228 | + | |
| 229 | + public void setNs(Double ns) { | |
| 230 | + this.ns = ns; | |
| 231 | + } | |
| 232 | + | |
| 233 | + public Double getFyylc() { | |
| 234 | + return fyylc; | |
| 235 | + } | |
| 236 | + | |
| 237 | + public void setFyylc(Double fyylc) { | |
| 238 | + this.fyylc = fyylc; | |
| 239 | + } | |
| 240 | + | |
| 241 | + public Double getJhzlc() { | |
| 242 | + return jhzlc; | |
| 243 | + } | |
| 244 | + | |
| 245 | + public void setJhzlc(Double jhzlc) { | |
| 246 | + this.jhzlc = jhzlc; | |
| 247 | + } | |
| 248 | + | |
| 249 | + public Double getJhfyylc() { | |
| 250 | + return jhfyylc; | |
| 251 | + } | |
| 252 | + | |
| 253 | + public void setJhfyylc(Double jhfyylc) { | |
| 254 | + this.jhfyylc = jhfyylc; | |
| 255 | + } | |
| 256 | + | |
| 257 | + public int getJhzbc() { | |
| 258 | + return jhzbc; | |
| 259 | + } | |
| 260 | + | |
| 261 | + public void setJhzbc(int jhzbc) { | |
| 262 | + this.jhzbc = jhzbc; | |
| 263 | + } | |
| 264 | + | |
| 265 | + public int getJhbc() { | |
| 266 | + return jhbc; | |
| 267 | + } | |
| 268 | + | |
| 269 | + public void setJhbc(int jhbc) { | |
| 270 | + this.jhbc = jhbc; | |
| 271 | + } | |
| 272 | + | |
| 273 | + public int getSjzbc() { | |
| 274 | + return sjzbc; | |
| 275 | + } | |
| 276 | + | |
| 277 | + public void setSjzbc(int sjzbc) { | |
| 278 | + this.sjzbc = sjzbc; | |
| 279 | + } | |
| 280 | + | |
| 281 | + public int getSjbc() { | |
| 282 | + return sjbc; | |
| 283 | + } | |
| 284 | + | |
| 285 | + public void setSjbc(int sjbc) { | |
| 286 | + this.sjbc = sjbc; | |
| 287 | + } | |
| 288 | + | |
| 289 | + public String getEdituser() { | |
| 290 | + return edituser; | |
| 291 | + } | |
| 292 | + | |
| 293 | + public void setEdituser(String edituser) { | |
| 294 | + this.edituser = edituser; | |
| 295 | + } | |
| 296 | + | |
| 297 | + public Date getEdittime() { | |
| 298 | + return edittime; | |
| 299 | + } | |
| 300 | + | |
| 301 | + public void setEdittime(Date edittime) { | |
| 302 | + this.edittime = edittime; | |
| 303 | + } | |
| 304 | + | |
| 305 | + public Date getCreatetime() { | |
| 306 | + return createtime; | |
| 307 | + } | |
| 308 | + | |
| 309 | + public void setCreatetime(Date createtime) { | |
| 310 | + this.createtime = createtime; | |
| 311 | + } | |
| 312 | + | |
| 313 | + public int getNylx() { | |
| 314 | + return nylx; | |
| 315 | + } | |
| 316 | + | |
| 317 | + public void setNylx(int nylx) { | |
| 318 | + this.nylx = nylx; | |
| 319 | + } | |
| 320 | + | |
| 321 | + public int getJcsx() { | |
| 322 | + return jcsx; | |
| 323 | + } | |
| 324 | + | |
| 325 | + public void setJcsx(int jcsx) { | |
| 326 | + this.jcsx = jcsx; | |
| 327 | + } | |
| 328 | + | |
| 329 | + public String getBglyh() { | |
| 330 | + if(this.getZlc()==0){ | |
| 331 | + return "0.00"; | |
| 332 | + }else{ | |
| 333 | + DecimalFormat df = new DecimalFormat("0.00"); | |
| 334 | + return df.format(this.getHd()/this.getZlc()*100); | |
| 335 | + } | |
| 336 | + } | |
| 337 | + | |
| 338 | + public void setBglyh(String bglyh) { | |
| 339 | + this.bglyh = bglyh; | |
| 340 | + } | |
| 341 | + | |
| 342 | + public String getXlname() { | |
| 343 | + return BasicData.lineCode2NameMap.get(this.xlbm); | |
| 344 | + } | |
| 345 | + | |
| 346 | + public void setXlname(String xlname) { | |
| 347 | + this.xlname = xlname; | |
| 348 | + } | |
| 349 | + | |
| 350 | + public String getGsname() { | |
| 351 | + return BasicData.businessCodeNameMap.get(this.ssgsdm); | |
| 352 | + } | |
| 353 | + | |
| 354 | + public void setGsname(String gsname) { | |
| 355 | + this.gsname = gsname; | |
| 356 | + } | |
| 357 | + | |
| 358 | + | |
| 359 | +} | ... | ... |
src/main/java/com/bsth/entity/oil/Jdl.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 | + | |
| 10 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 11 | + | |
| 12 | +@Entity | |
| 13 | +@Table(name = "bsth_c_jdl") | |
| 14 | +public class Jdl { | |
| 15 | + @Id | |
| 16 | + @GeneratedValue | |
| 17 | + private Integer id; | |
| 18 | + @DateTimeFormat(pattern="yyyy-MM-dd") | |
| 19 | + private Date rq; | |
| 20 | + private String gsBm; | |
| 21 | + private String gsName; | |
| 22 | + private String fgsBm; | |
| 23 | + private String fgsName; | |
| 24 | + private String clZbh; | |
| 25 | + private Double jdl = 0.0; | |
| 26 | + private String jdz; | |
| 27 | + private String remarks; | |
| 28 | + | |
| 29 | + | |
| 30 | + public Integer getId() { | |
| 31 | + return id; | |
| 32 | + } | |
| 33 | + public void setId(Integer id) { | |
| 34 | + this.id = id; | |
| 35 | + } | |
| 36 | + public Date getRq() { | |
| 37 | + return rq; | |
| 38 | + } | |
| 39 | + public void setRq(Date rq) { | |
| 40 | + this.rq = rq; | |
| 41 | + } | |
| 42 | + public String getGsBm() { | |
| 43 | + return gsBm; | |
| 44 | + } | |
| 45 | + public void setGsBm(String gsBm) { | |
| 46 | + this.gsBm = gsBm; | |
| 47 | + } | |
| 48 | + public String getGsName() { | |
| 49 | + return gsName; | |
| 50 | + } | |
| 51 | + public void setGsName(String gsName) { | |
| 52 | + this.gsName = gsName; | |
| 53 | + } | |
| 54 | + public String getFgsBm() { | |
| 55 | + return fgsBm; | |
| 56 | + } | |
| 57 | + public void setFgsBm(String fgsBm) { | |
| 58 | + this.fgsBm = fgsBm; | |
| 59 | + } | |
| 60 | + public String getFgsName() { | |
| 61 | + return fgsName; | |
| 62 | + } | |
| 63 | + public void setFgsName(String fgsName) { | |
| 64 | + this.fgsName = fgsName; | |
| 65 | + } | |
| 66 | + public String getClZbh() { | |
| 67 | + return clZbh; | |
| 68 | + } | |
| 69 | + public void setClZbh(String clZbh) { | |
| 70 | + this.clZbh = clZbh; | |
| 71 | + } | |
| 72 | + public Double getJdl() { | |
| 73 | + return jdl; | |
| 74 | + } | |
| 75 | + public void setJdl(Double jdl) { | |
| 76 | + this.jdl = jdl; | |
| 77 | + } | |
| 78 | + public String getJdz() { | |
| 79 | + return jdz; | |
| 80 | + } | |
| 81 | + public void setJdz(String jdz) { | |
| 82 | + this.jdz = jdz; | |
| 83 | + } | |
| 84 | + public String getRemarks() { | |
| 85 | + return remarks; | |
| 86 | + } | |
| 87 | + public void setRemarks(String remarks) { | |
| 88 | + this.remarks = remarks; | |
| 89 | + } | |
| 90 | + | |
| 91 | +} | ... | ... |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| ... | ... | @@ -344,6 +344,8 @@ public class ScheduleRealInfo { |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | public String getsGh() { |
| 347 | + if(sGh == null) | |
| 348 | + return ""; | |
| 347 | 349 | return sGh; |
| 348 | 350 | } |
| 349 | 351 | |
| ... | ... | @@ -352,6 +354,8 @@ public class ScheduleRealInfo { |
| 352 | 354 | } |
| 353 | 355 | |
| 354 | 356 | public String getsName() { |
| 357 | + if(sGh == null) | |
| 358 | + return ""; | |
| 355 | 359 | return sName; |
| 356 | 360 | } |
| 357 | 361 | ... | ... |
src/main/java/com/bsth/entity/schedule/SchedulePlan.java
| ... | ... | @@ -2,7 +2,6 @@ package com.bsth.entity.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.Line; |
| 4 | 4 | import com.bsth.entity.schedule.rule.ScheduleRule1; |
| 5 | -import com.bsth.entity.sys.SysUser; | |
| 6 | 5 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 7 | 6 | |
| 8 | 7 | import javax.persistence.*; |
| ... | ... | @@ -21,7 +20,7 @@ import java.util.List; |
| 21 | 20 | @NamedAttributeNode("ttInfo") |
| 22 | 21 | }) |
| 23 | 22 | }) |
| 24 | -public class SchedulePlan { | |
| 23 | +public class SchedulePlan extends BEntity { | |
| 25 | 24 | |
| 26 | 25 | /** 主键Id */ |
| 27 | 26 | @Id |
| ... | ... | @@ -60,19 +59,6 @@ public class SchedulePlan { |
| 60 | 59 | @OneToMany(mappedBy = "schedulePlan", cascade = CascadeType.ALL, fetch = FetchType.LAZY) |
| 61 | 60 | private List<SchedulePlanInfo> schedulePlanInfoList = new ArrayList<>(); |
| 62 | 61 | |
| 63 | - /** 创建人 */ | |
| 64 | - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) | |
| 65 | - private SysUser createBy; | |
| 66 | - /** 修改人 */ | |
| 67 | - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) | |
| 68 | - private SysUser updateBy; | |
| 69 | - /** 创建日期 */ | |
| 70 | - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 71 | - private Date createDate; | |
| 72 | - /** 修改日期 */ | |
| 73 | - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 74 | - private Date updateDate; | |
| 75 | - | |
| 76 | 62 | public Long getId() { |
| 77 | 63 | return id; |
| 78 | 64 | } |
| ... | ... | @@ -129,38 +115,6 @@ public class SchedulePlan { |
| 129 | 115 | this.schedulePlanInfoList = schedulePlanInfoList; |
| 130 | 116 | } |
| 131 | 117 | |
| 132 | - public SysUser getCreateBy() { | |
| 133 | - return createBy; | |
| 134 | - } | |
| 135 | - | |
| 136 | - public void setCreateBy(SysUser createBy) { | |
| 137 | - this.createBy = createBy; | |
| 138 | - } | |
| 139 | - | |
| 140 | - public SysUser getUpdateBy() { | |
| 141 | - return updateBy; | |
| 142 | - } | |
| 143 | - | |
| 144 | - public void setUpdateBy(SysUser updateBy) { | |
| 145 | - this.updateBy = updateBy; | |
| 146 | - } | |
| 147 | - | |
| 148 | - public Date getCreateDate() { | |
| 149 | - return createDate; | |
| 150 | - } | |
| 151 | - | |
| 152 | - public void setCreateDate(Date createDate) { | |
| 153 | - this.createDate = createDate; | |
| 154 | - } | |
| 155 | - | |
| 156 | - public Date getUpdateDate() { | |
| 157 | - return updateDate; | |
| 158 | - } | |
| 159 | - | |
| 160 | - public void setUpdateDate(Date updateDate) { | |
| 161 | - this.updateDate = updateDate; | |
| 162 | - } | |
| 163 | - | |
| 164 | 118 | public String getTtInfoNames() { |
| 165 | 119 | return ttInfoNames; |
| 166 | 120 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
| ... | ... | @@ -157,6 +157,7 @@ public class SchedulePlanInfo { |
| 157 | 157 | Line xl, |
| 158 | 158 | ScheduleResult_output scheduleResult_output, |
| 159 | 159 | TTInfoDetail ttInfoDetail, |
| 160 | + Boolean isFb, | |
| 160 | 161 | CarConfigInfo carConfigInfo, |
| 161 | 162 | List<EmployeeConfigInfo> employeeConfigInfoList, |
| 162 | 163 | SchedulePlan schedulePlan) { |
| ... | ... | @@ -191,7 +192,7 @@ public class SchedulePlanInfo { |
| 191 | 192 | // TODO:报道时间,出场时间没有 |
| 192 | 193 | // 关联的驾驶员 |
| 193 | 194 | EmployeeConfigInfo employeeConfigInfo = null; |
| 194 | - if (ttInfoDetail.getIsFB()) { | |
| 195 | + if (isFb) { | |
| 195 | 196 | if (employeeConfigInfoList.size() > 1) { |
| 196 | 197 | employeeConfigInfo = employeeConfigInfoList.get(1); |
| 197 | 198 | } else { | ... | ... |
src/main/java/com/bsth/entity/sys/RealControAuthority.java
0 → 100644
| 1 | +package com.bsth.entity.sys; | |
| 2 | + | |
| 3 | +import javax.persistence.*; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 线调权限配置 | |
| 7 | + * Created by panzhao on 2017/2/14. | |
| 8 | + */ | |
| 9 | +@Entity | |
| 10 | +@Table(name = "bsth_c_real_control_authority") | |
| 11 | +public class RealControAuthority { | |
| 12 | + | |
| 13 | + @Id | |
| 14 | + private Integer userId; | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 可调度的线路 , 分隔多个 | |
| 18 | + */ | |
| 19 | + private String lineCodeStr; | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 调度模式 0: 监控模式 1:主调模式 | |
| 23 | + */ | |
| 24 | + private int pattern; | |
| 25 | + | |
| 26 | + public Integer getUserId() { | |
| 27 | + return userId; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public void setUserId(Integer userId) { | |
| 31 | + this.userId = userId; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public String getLineCodeStr() { | |
| 35 | + return lineCodeStr; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public void setLineCodeStr(String lineCodeStr) { | |
| 39 | + this.lineCodeStr = lineCodeStr; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public int getPattern() { | |
| 43 | + return pattern; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public void setPattern(int pattern) { | |
| 47 | + this.pattern = pattern; | |
| 48 | + } | |
| 49 | +} | ... | ... |
src/main/java/com/bsth/entity/sys/UserLine.java
| 1 | 1 | package com.bsth.entity.sys; |
| 2 | 2 | |
| 3 | -import javax.persistence.Entity; | |
| 4 | -import javax.persistence.GeneratedValue; | |
| 5 | -import javax.persistence.GenerationType; | |
| 6 | -import javax.persistence.Id; | |
| 7 | -import javax.persistence.ManyToOne; | |
| 8 | -import javax.persistence.Table; | |
| 9 | - | |
| 10 | 3 | import com.bsth.entity.Line; |
| 11 | 4 | |
| 5 | +import javax.persistence.*; | |
| 6 | + | |
| 12 | 7 | /** |
| 13 | 8 | * |
| 14 | 9 | * @ClassName: Line(用户线路分配实体类) |
| ... | ... | @@ -20,6 +15,8 @@ import com.bsth.entity.Line; |
| 20 | 15 | * @Date 2016年8月26日 09:03:33 |
| 21 | 16 | * |
| 22 | 17 | * @Version 公交调度系统BS版 0.1 |
| 18 | + * | |
| 19 | + * PS:这个类缺少主调监控模式的配置,暂不使用 | |
| 23 | 20 | * |
| 24 | 21 | */ |
| 25 | 22 | ... | ... |
src/main/java/com/bsth/filter/ResourceFilter.java
| 1 | 1 | package com.bsth.filter; |
| 2 | 2 | |
| 3 | -import java.io.File; | |
| 4 | -import java.io.IOException; | |
| 3 | +import com.bsth.util.RequestUtils; | |
| 4 | +import org.apache.commons.lang3.StringUtils; | |
| 5 | 5 | |
| 6 | 6 | import javax.servlet.FilterChain; |
| 7 | 7 | import javax.servlet.ServletException; |
| 8 | 8 | import javax.servlet.http.HttpServletRequest; |
| 9 | 9 | import javax.servlet.http.HttpServletResponse; |
| 10 | - | |
| 11 | -import org.apache.commons.lang3.StringUtils; | |
| 12 | - | |
| 13 | -import com.bsth.util.RequestUtils; | |
| 10 | +import java.io.File; | |
| 11 | +import java.io.IOException; | |
| 14 | 12 | |
| 15 | 13 | /** |
| 16 | - * | |
| 14 | + * @author PanZhao | |
| 17 | 15 | * @ClassName: ResourceFilter |
| 18 | 16 | * @Description: TODO(HTML片段过滤器) |
| 19 | - * @author PanZhao | |
| 20 | 17 | * @date 2016年3月19日 下午10:10:11 |
| 21 | - * | |
| 22 | 18 | */ |
| 23 | 19 | public class ResourceFilter extends BaseFilter { |
| 24 | - | |
| 25 | - String[] params = new String[]{"no"}; | |
| 26 | 20 | |
| 27 | - @Override | |
| 28 | - public void doFilter(HttpServletRequest request, | |
| 29 | - HttpServletResponse response, FilterChain chain) | |
| 30 | - throws IOException, ServletException { | |
| 31 | - | |
| 32 | - String uri = request.getRequestURI(); | |
| 33 | - int len = uri.length(); | |
| 34 | - if (RequestUtils.isAjaxRequest(request) || | |
| 35 | - !uri.substring(len - 5, len).equals(".html")) { | |
| 36 | - super.doFilter(request, response, chain); | |
| 37 | - } else { | |
| 38 | - | |
| 39 | - String fPath = this.getClass().getResource("/").getPath() | |
| 40 | - + "static/" + uri; | |
| 41 | - | |
| 42 | - File f = new File(fPath); | |
| 43 | - | |
| 44 | - | |
| 45 | - if (f.exists() && f.isFile() ){ | |
| 46 | - request.getRequestDispatcher("/?initFragment=" + joinParam(request)).forward(request, response);; | |
| 47 | - }else | |
| 48 | - response.sendRedirect("/"); | |
| 49 | - } | |
| 50 | - } | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * 拼接参数 | |
| 54 | - * @param request | |
| 55 | - * @return | |
| 56 | - */ | |
| 57 | - public String joinParam(HttpServletRequest request){ | |
| 58 | - | |
| 59 | - StringBuilder sb = new StringBuilder(); | |
| 60 | - | |
| 61 | - String v | |
| 62 | - ,url = request.getRequestURI(); | |
| 63 | - for(String p : params){ | |
| 64 | - v = request.getParameter(p); | |
| 65 | - if(!StringUtils.isEmpty(v)) | |
| 66 | - sb.append("&" + p + "=" + v); | |
| 67 | - } | |
| 68 | - | |
| 69 | - if(sb.length() > 0) | |
| 70 | - url += "?" + sb.substring(1, sb.length()); | |
| 71 | - return url; | |
| 72 | - } | |
| 21 | + String[] params = new String[]{"no"}; | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + public void doFilter(HttpServletRequest request, | |
| 25 | + HttpServletResponse response, FilterChain chain) | |
| 26 | + throws IOException, ServletException { | |
| 27 | + | |
| 28 | + String uri = request.getRequestURI(); | |
| 29 | + String origin = request.getParameter("origin"); | |
| 30 | + int len = uri.length(); | |
| 31 | + if (RequestUtils.isAjaxRequest(request) | |
| 32 | + || (origin != null && origin.equals("real_control_iframe"))//来自线调 iframe 的请求 | |
| 33 | + || !uri.substring(len - 5, len).equals(".html")) { | |
| 34 | + super.doFilter(request, response, chain); | |
| 35 | + } else { | |
| 36 | + | |
| 37 | + String fPath = this.getClass().getResource("/").getPath() | |
| 38 | + + "static/" + uri; | |
| 39 | + | |
| 40 | + File f = new File(fPath); | |
| 41 | + | |
| 42 | + | |
| 43 | + if (f.exists() && f.isFile()) { | |
| 44 | + request.getRequestDispatcher("/?initFragment=" + joinParam(request)).forward(request, response); | |
| 45 | + ; | |
| 46 | + } else | |
| 47 | + response.sendRedirect("/"); | |
| 48 | + } | |
| 49 | + } | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 拼接参数 | |
| 53 | + * | |
| 54 | + * @param request | |
| 55 | + * @return | |
| 56 | + */ | |
| 57 | + public String joinParam(HttpServletRequest request) { | |
| 58 | + | |
| 59 | + StringBuilder sb = new StringBuilder(); | |
| 60 | + | |
| 61 | + String v, url = request.getRequestURI(); | |
| 62 | + for (String p : params) { | |
| 63 | + v = request.getParameter(p); | |
| 64 | + if (!StringUtils.isEmpty(v)) | |
| 65 | + sb.append("&" + p + "=" + v); | |
| 66 | + } | |
| 67 | + | |
| 68 | + if (sb.length() > 0) | |
| 69 | + url += "?" + sb.substring(1, sb.length()); | |
| 70 | + return url; | |
| 71 | + } | |
| 73 | 72 | } | ... | ... |
src/main/java/com/bsth/repository/oil/DlbRepository.java
0 → 100644
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| ... | ... | @@ -28,9 +28,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 28 | 28 | @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.id,s.jGh,s.clZbh,s.lpName order by (lpName+1)") |
| 29 | 29 | List<ScheduleRealInfo> queryUserInfo(String line,String date); |
| 30 | 30 | |
| 31 | - @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName order by (lpName+1)") | |
| 31 | + @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName,s.sGh,s.sName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName,s.sGh,s.sName order by (lpName+1)") | |
| 32 | 32 | List<ScheduleRealInfo> queryUserInfo2(String line,String date); |
| 33 | - | |
| 33 | + | |
| 34 | 34 | @Query(value="select min(s.id), s.clZbh from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.clZbh ") |
| 35 | 35 | List<ScheduleRealInfo> queryUserInfo3(String line,String date); |
| 36 | 36 | |
| ... | ... | @@ -119,6 +119,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 119 | 119 | |
| 120 | 120 | @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType not in ('in','out') order by s.xlBm") |
| 121 | 121 | List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date); |
| 122 | + | |
| 123 | + //按月统计 | |
| 124 | + @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") | |
| 125 | + List<ScheduleRealInfo> scheduleByDateAndLine3(String line,String date); | |
| 122 | 126 | |
| 123 | 127 | @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 realExecDate,fcsj,xlBm,clZbh") |
| 124 | 128 | List<Map<String,Object>> yesterdayDataList(String line,String date); | ... | ... |
src/main/java/com/bsth/repository/schedule/GuideboardInfoRepository.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.repository.schedule; |
| 3 | 3 | import java.util.List; |
| 4 | 4 | import java.util.Map; |
| 5 | 5 | |
| 6 | +import com.bsth.entity.Line; | |
| 6 | 7 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 7 | 8 | import com.bsth.entity.schedule.GuideboardInfo; |
| 8 | 9 | import com.bsth.repository.BaseRepository; |
| ... | ... | @@ -37,4 +38,8 @@ public interface GuideboardInfoRepository extends BaseRepository<GuideboardInfo, |
| 37 | 38 | "where td.ttinfo.id=?1 " + |
| 38 | 39 | "group by td.ttinfo.id, td.lp.id, td.lp.lpName") |
| 39 | 40 | List<Map<String, Object>> findLpName(Long ttid); |
| 41 | + | |
| 42 | + @Query(value = "SELECT g FROM GuideboardInfo g where g.xl =?1 and g.lpName = ?2 and g.lpNo = ?3 and lpType =?4 and isCancel = 0") | |
| 43 | + List<GuideboardInfo> validateLp(Line xl,String lpName , int lpNo,String lpType); | |
| 44 | + | |
| 40 | 45 | } | ... | ... |
src/main/java/com/bsth/repository/schedule/SchedulePlanInfoRepository.java
| ... | ... | @@ -33,17 +33,18 @@ public interface SchedulePlanInfoRepository extends BaseRepository<SchedulePlanI |
| 33 | 33 | "lp_name as lpName, " + |
| 34 | 34 | "cl as clId, " + |
| 35 | 35 | "cl_zbh as clZbh, " + |
| 36 | - "group_concat(distinct fcsj) ccsj, " + | |
| 36 | + "group_concat(fcsj) ccsj, " + | |
| 37 | + "group_concat(bc_type) bctype, " + | |
| 37 | 38 | "group_concat(distinct j) jsyId, " + |
| 38 | 39 | "group_concat(distinct j_gh) jsyGh, " + |
| 39 | 40 | "group_concat(distinct j_name) jsyName, " + |
| 40 | 41 | "group_concat(distinct s) spyId, " + |
| 41 | 42 | "group_concat(distinct s_gh) spyGh, " + |
| 42 | 43 | "group_concat(distinct s_name) spyName, " + |
| 43 | - "max(create_date) as createDate " + | |
| 44 | + "max(create_date) as createDate, " + | |
| 45 | + "group_concat(fcno) fcno " + | |
| 44 | 46 | "from bsth_c_s_sp_info " + |
| 45 | - "where bc_type = 'out' and " + | |
| 46 | - "xl = ?1 and " + | |
| 47 | + "where xl = ?1 and " + | |
| 47 | 48 | "schedule_date = ?2 " + |
| 48 | 49 | "group by xl_name, schedule_date, lp, lp_name, cl, cl_zbh " + |
| 49 | 50 | "order by xl_name, schedule_date, lp ", nativeQuery = true) |
| ... | ... | @@ -71,14 +72,16 @@ public interface SchedulePlanInfoRepository extends BaseRepository<SchedulePlanI |
| 71 | 72 | "scpinfo.scheduleDate = :p3 and " + |
| 72 | 73 | "scpinfo.lpName = :p4 and " + |
| 73 | 74 | "scpinfo.fcsj = :p5 and " + |
| 74 | - "scpinfo.bcType = :p6 ") | |
| 75 | + "scpinfo.bcType = :p6 and " + | |
| 76 | + "scpinfo.fcno = :p7 " ) | |
| 75 | 77 | int updateGroupInfo_type_2_4( |
| 76 | 78 | @Param("p1") String fcsj, |
| 77 | 79 | @Param("p2") Integer xlid, |
| 78 | 80 | @Param("p3") Date scheduleDate, |
| 79 | 81 | @Param("p4") String lpName, |
| 80 | 82 | @Param("p5") String fcsj_src, |
| 81 | - @Param("p6") String bcType); | |
| 83 | + @Param("p6") String bcType, | |
| 84 | + @Param("p7") Integer fcno); | |
| 82 | 85 | |
| 83 | 86 | @Modifying |
| 84 | 87 | @Query(value = "update " + | ... | ... |
src/main/java/com/bsth/repository/sys/RealControAuthorityRepository.java
0 → 100644
| 1 | +package com.bsth.repository.sys; | |
| 2 | + | |
| 3 | +import com.bsth.entity.sys.RealControAuthority; | |
| 4 | +import com.bsth.repository.BaseRepository; | |
| 5 | +import org.springframework.data.jpa.repository.Query; | |
| 6 | +import org.springframework.stereotype.Repository; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Created by panzhao on 2017/2/14. | |
| 10 | + */ | |
| 11 | +@Repository | |
| 12 | +public interface RealControAuthorityRepository extends BaseRepository<RealControAuthority, Integer>{ | |
| 13 | + | |
| 14 | + @Query("select t from RealControAuthority t where t.userId=?1") | |
| 15 | + RealControAuthority findByUserId(Integer userId); | |
| 16 | +} | ... | ... |
src/main/java/com/bsth/security/WebSecurityConfig.java
| ... | ... | @@ -54,14 +54,13 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
| 54 | 54 | //指定登录页 |
| 55 | 55 | .loginPage(Constants.LOGIN_PAGE) |
| 56 | 56 | .loginProcessingUrl(Constants.LOGIN).permitAll() |
| 57 | - //.failureUrl(Constants.LOGIN_PAGE + "?error=true")登录失败跳转的链接 | |
| 58 | - //.successHandler(loginSuccessHandler())登录成功后处理 | |
| 59 | 57 | .and().logout() |
| 60 | - //.addLogoutHandler(logoutHandler()) | |
| 61 | 58 | //禁用CXRF |
| 62 | 59 | .and().csrf().disable() |
| 63 | 60 | //禁用匿名用户功能 |
| 64 | - .anonymous().disable(); | |
| 61 | + .anonymous().disable() | |
| 62 | + //允许同源 iframe | |
| 63 | + .headers().frameOptions().sameOrigin().httpStrictTransportSecurity().disable(); | |
| 65 | 64 | |
| 66 | 65 | // 同时只保持一个回话 |
| 67 | 66 | http.sessionManagement().maximumSessions(1) | ... | ... |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| ... | ... | @@ -477,8 +477,8 @@ public class GpsServiceImpl implements GpsService { |
| 477 | 477 | sqlBefore += (k + ","); |
| 478 | 478 | sqlValues += "?,"; |
| 479 | 479 | } |
| 480 | - sqlBefore = sqlBefore.substring(0, sqlBefore.length() - 1) + ")"; | |
| 481 | - sqlValues = sqlValues.substring(0, sqlValues.length() - 1) + ")"; | |
| 480 | + sqlBefore = sqlBefore.substring(0, sqlBefore.length() - 1) + ", create_ts)"; | |
| 481 | + sqlValues = sqlValues.substring(0, sqlValues.length() - 1) + ", "+System.currentTimeMillis()+")"; | |
| 482 | 482 | sql = sqlBefore + " " + sqlValues; |
| 483 | 483 | |
| 484 | 484 | Connection conn = DBUtils_MS.getConnection(); | ... | ... |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| ... | ... | @@ -11,6 +11,8 @@ import com.bsth.repository.StationRouteRepository; |
| 11 | 11 | import com.bsth.service.StationRouteService; |
| 12 | 12 | import com.bsth.util.FTPClientUtils; |
| 13 | 13 | import com.bsth.util.PackTarGZUtils; |
| 14 | +import com.bsth.util.Geo.GeoUtils; | |
| 15 | +import com.bsth.util.Geo.Point; | |
| 14 | 16 | import com.bsth.util.db.DBUtils_MS; |
| 15 | 17 | import com.google.common.base.Splitter; |
| 16 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -556,9 +558,15 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 556 | 558 | |
| 557 | 559 | clientUtils.deleteFtpFile(url, port, username, password, remotePath, textFileName); |
| 558 | 560 | |
| 559 | - /** 行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/ | |
| 560 | - String textStr = newTextFileToFTP(objects,lineId); | |
| 561 | + String textStr = ""; | |
| 561 | 562 | |
| 563 | + boolean tempTag = ishxType(objects); | |
| 564 | + | |
| 565 | + if(tempTag) | |
| 566 | + textStr = hxTextFileToFtp(objects,lineId);// 环线行单文件内容 | |
| 567 | + else | |
| 568 | + textStr = newTextFileToFTP(objects,lineId);/** 双向行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/ | |
| 569 | + | |
| 562 | 570 | /*textStr = line.getName() + "\t" + "2" + "\r" + textStr;*/ |
| 563 | 571 | |
| 564 | 572 | textStr = line.getName() + " " + "2" + "\r" + textStr; |
| ... | ... | @@ -574,9 +582,6 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 574 | 582 | /** 获取txt文件 */ |
| 575 | 583 | File textFile = clientUtils.GetFtpFile(url, port, username, password, remotePath, textFileName); |
| 576 | 584 | |
| 577 | - /*File[] sources = new File[] {textFile};*/ | |
| 578 | - //File[] sources = new File[] {textFile}; | |
| 579 | - | |
| 580 | 585 | File target = new File(odlGzFileName); |
| 581 | 586 | |
| 582 | 587 | // 将txt文件打包 |
| ... | ... | @@ -603,6 +608,24 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 603 | 608 | } |
| 604 | 609 | return resultMap; |
| 605 | 610 | } |
| 611 | + public boolean ishxType(List<Object[]> listObj) { | |
| 612 | + boolean tag = true; | |
| 613 | + String pointBStr[] = null,pointEStr[] = null; | |
| 614 | + int numzd = 0; | |
| 615 | + for(int i =0;i<listObj.size();i++) { | |
| 616 | + if(listObj.get(i)[3].equals("B") && Integer.valueOf(listObj.get(i)[8].toString())==0) | |
| 617 | + pointBStr = listObj.get(i)[2].toString().split(" "); | |
| 618 | + else if(listObj.get(i)[3].equals("E") && Integer.valueOf(listObj.get(i)[8].toString())==0) | |
| 619 | + pointEStr = listObj.get(i)[2].toString().split(" "); | |
| 620 | + if(Integer.valueOf(listObj.get(i)[8].toString())==1) | |
| 621 | + numzd++; | |
| 622 | + } | |
| 623 | + Point p1 = new Point(Double.valueOf(pointBStr[0]),Double.valueOf(pointBStr[1])); | |
| 624 | + Point p2 = new Point(Double.valueOf(pointEStr[0]),Double.valueOf(pointEStr[1])); | |
| 625 | + if(GeoUtils.getDistance(p1, p2)>100 && numzd>2) | |
| 626 | + tag = false; | |
| 627 | + return tag; | |
| 628 | + } | |
| 606 | 629 | |
| 607 | 630 | /** |
| 608 | 631 | * @Description : TODO(形成行单文件内容) |
| ... | ... | @@ -717,31 +740,79 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 717 | 740 | } |
| 718 | 741 | |
| 719 | 742 | } |
| 720 | - | |
| 721 | - /* | |
| 722 | - String bdJWPointStr = objects.get(i)[2].toString(); | |
| 723 | - | |
| 724 | - String bdJWPointA[] = bdJWPointStr.split(" "); | |
| 725 | - | |
| 726 | - Map<String, Object> pointsM = new HashMap<String,Object>(); | |
| 727 | - | |
| 728 | - pointsM.put("lng", bdJWPointA[0]); | |
| 729 | - | |
| 730 | - pointsM.put("lat", bdJWPointA[1]); | |
| 731 | - | |
| 732 | - System.out.println(objects.get(i)[7].toString()); | |
| 733 | - | |
| 734 | - sleepStr = sleepStr + GetFormPointOnPolylineSeleepLimit(pointsM,sobje);*/ | |
| 735 | 743 | } |
| 736 | 744 | |
| 737 | 745 | stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; |
| 738 | - | |
| 739 | 746 | } |
| 740 | 747 | |
| 741 | 748 | } |
| 742 | - | |
| 743 | 749 | return stationRStr; |
| 744 | - | |
| 750 | + } | |
| 751 | + | |
| 752 | + public String hxTextFileToFtp(List<Object[]> objects,Integer lineId) { | |
| 753 | + String restStr = ""; | |
| 754 | + // windows下的文本文件换行符 | |
| 755 | + //String enterStr = "\r\n"; | |
| 756 | + // linux/unix下的文本文件换行符 | |
| 757 | + String enterStr = "\r"; | |
| 758 | + int xh = 1 ; | |
| 759 | + for(int x =0;x<2;x++) { | |
| 760 | + for(int i = 0; i<objects.size();i++) { | |
| 761 | + if(Integer.valueOf(objects.get(i)[8].toString())==0) { | |
| 762 | + // 经度 | |
| 763 | + String lng = objects.get(i)[0].equals("") ? "" : objects.get(i)[0].toString(); | |
| 764 | + // 纬度 | |
| 765 | + String lat = objects.get(i)[1].equals("") ? "" : objects.get(i)[1].toString(); | |
| 766 | + lat = "\t" + lat; | |
| 767 | + // 站点类型 | |
| 768 | + String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); | |
| 769 | + String stationMake = ""; | |
| 770 | + if(stationMakeStr.equals("E")) { | |
| 771 | + stationMake = "\t2"; | |
| 772 | + }else { | |
| 773 | + stationMake ="\t1"; | |
| 774 | + } | |
| 775 | + // 站点序号 | |
| 776 | + // String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); | |
| 777 | + String stationNo = "\t" + xh; | |
| 778 | + // 站点编码 | |
| 779 | + String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); | |
| 780 | + stationCode = "\t" +stationCode; | |
| 781 | + double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; | |
| 782 | + String tempDistc = String.valueOf((int) dis); | |
| 783 | + // 站点距离 | |
| 784 | + String staitondistance = "\t" + tempDistc; | |
| 785 | + // 站点名称 | |
| 786 | + String stationName = objects.get(i)[7].equals("") ? "" : objects.get(i)[7].toString(); | |
| 787 | + stationName = "\t" +stationName; | |
| 788 | + // 限速 | |
| 789 | + String sleepStr = ""; | |
| 790 | + // 方向 | |
| 791 | + int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); | |
| 792 | + /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ | |
| 793 | + List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); | |
| 794 | + if(sobje.size()==1) { | |
| 795 | + double dsleepStr = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString()); | |
| 796 | + sleepStr = "\t" + new DecimalFormat("0").format(dsleepStr); | |
| 797 | + }else if(sobje.size()>1){ | |
| 798 | + /** 这里暂时只根据站点名称去匹配所在路段的限速值 ,如果路段名称"至"之前的地名与站点名称等同,就认为站点在路段上。 */ | |
| 799 | + for(int j =0;j<sobje.size();j++) { | |
| 800 | + String sectionName = sobje.get(j)[3].toString(); | |
| 801 | + String sectionNameA[] = sectionName.split("至"); | |
| 802 | + if(stationName.equals(sectionNameA[0])){ | |
| 803 | + /*sleepStr = sobje.get(j)[2].toString();*/ | |
| 804 | + double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | |
| 805 | + sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt); | |
| 806 | + } | |
| 807 | + } | |
| 808 | + } | |
| 809 | + xh++; | |
| 810 | + restStr = restStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; | |
| 811 | + } | |
| 812 | + } | |
| 813 | + } | |
| 814 | + System.out.println(restStr); | |
| 815 | + return restStr; | |
| 745 | 816 | } |
| 746 | 817 | |
| 747 | 818 | public String GetFormPointOnPolylineSeleepLimit(Map<String, Object> p,List<Object[]> listObjArra) { | ... | ... |
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| ... | ... | @@ -328,10 +328,21 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 328 | 328 | if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("lpName")+"") |
| 329 | 329 | .equals(scheduleRealInfo.getLpName()) |
| 330 | 330 | && (schRealInfo.get("clZbh")+"").equals(scheduleRealInfo.getClZbh())){ |
| 331 | - if(scheduleRealInfo.getFcsjActual() == null ||scheduleRealInfo.getBcType().equals("in") | |
| 331 | + | |
| 332 | + if(scheduleRealInfo.isDestroy()){ | |
| 333 | + if(scheduleRealInfo.isReissue()){ | |
| 334 | + scheduleRealInfo.setFcsjActualAll(scheduleRealInfo.getDfsj()); | |
| 335 | + scheduleRealInfo.setZdsjActualAll(scheduleRealInfo.getZdsj()); | |
| 336 | + } | |
| 337 | + else | |
| 338 | + continue; | |
| 339 | + } | |
| 340 | + | |
| 341 | + if(scheduleRealInfo.getBcType().equals("in") | |
| 332 | 342 | || scheduleRealInfo.getBcType().equals("out")){ |
| 333 | 343 | continue; |
| 334 | 344 | } |
| 345 | + | |
| 335 | 346 | scheduleRealInfo.getQdzCode(); |
| 336 | 347 | sf.append("<LD>"); |
| 337 | 348 | sf.append("<SJGH>"+scheduleRealInfo.getjGh()+"</SJGH>"); | ... | ... |
src/main/java/com/bsth/service/oil/DlbService.java
0 → 100644
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.oil.impl; | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | +import org.springframework.stereotype.Service; | |
| 6 | + | |
| 7 | +import com.bsth.entity.oil.Dlb; | |
| 8 | +import com.bsth.service.impl.BaseServiceImpl; | |
| 9 | +import com.bsth.service.oil.DlbService; | |
| 10 | + | |
| 11 | +@Service | |
| 12 | +public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbService{ | |
| 13 | + | |
| 14 | + | |
| 15 | +} | ... | ... |
src/main/java/com/bsth/service/realcontrol/RealMapService.java
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.service.realcontrol; |
| 3 | 3 | import com.bsth.controller.realcontrol.dto.ChangePersonCar; |
| 4 | 4 | import com.bsth.controller.realcontrol.dto.DfsjChange; |
| 5 | 5 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 6 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 6 | 7 | import com.bsth.service.BaseService; |
| 7 | 8 | import org.springframework.stereotype.Service; |
| 8 | 9 | |
| ... | ... | @@ -144,4 +145,10 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L |
| 144 | 145 | Map<String,Object> addRemarks(Long id, String remarks); |
| 145 | 146 | |
| 146 | 147 | List<Map<String, Object>> scheduleDailyQp(String line ,String date); |
| 148 | + | |
| 149 | + List<Map<String, Object>> scheduleDailyExport(Map<String, Object> map); | |
| 150 | + | |
| 151 | + Map<String, Object> exportWaybillMore(Map<String, Object> map); | |
| 152 | + | |
| 153 | + List<SchedulePlanInfo> currentSchedulePlan(String lineCode); | |
| 147 | 154 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
| ... | ... | @@ -159,6 +159,17 @@ public class RealMapServiceImpl implements RealMapService { |
| 159 | 159 | return rs; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | + @Override | |
| 163 | + public Map<String, Object> multiRouteByLine(String codeStr) { | |
| 164 | + List<String> codeArray = Splitter.on(",").splitToList(codeStr); | |
| 165 | + Map<String, Object> rs = new HashMap<>(); | |
| 166 | + | |
| 167 | + for(String code : codeArray){ | |
| 168 | + rs.put(code + "_route" ,findRouteByLine(code)); | |
| 169 | + } | |
| 170 | + return rs; | |
| 171 | + } | |
| 172 | + | |
| 162 | 173 | /** |
| 163 | 174 | * wgs 坐标数组转 百度 |
| 164 | 175 | * | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| 1 | 1 | package com.bsth.service.realcontrol.impl; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSON; | |
| 3 | 4 | import com.alibaba.fastjson.JSONArray; |
| 4 | 5 | import com.alibaba.fastjson.JSONObject; |
| 5 | 6 | import com.bsth.common.ResponseCode; |
| ... | ... | @@ -23,6 +24,7 @@ import com.bsth.entity.realcontrol.SvgAttribute; |
| 23 | 24 | import com.bsth.entity.schedule.CarConfigInfo; |
| 24 | 25 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 25 | 26 | import com.bsth.entity.schedule.GuideboardInfo; |
| 27 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 26 | 28 | import com.bsth.entity.sys.DutyEmployee; |
| 27 | 29 | import com.bsth.entity.sys.SysUser; |
| 28 | 30 | import com.bsth.repository.LineRepository; |
| ... | ... | @@ -37,6 +39,7 @@ import com.bsth.security.util.SecurityUtils; |
| 37 | 39 | import com.bsth.service.SectionRouteService; |
| 38 | 40 | import com.bsth.service.impl.BaseServiceImpl; |
| 39 | 41 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 42 | +import com.bsth.service.schedule.SchedulePlanInfoService; | |
| 40 | 43 | import com.bsth.service.sys.DutyEmployeeService; |
| 41 | 44 | import com.bsth.util.*; |
| 42 | 45 | import com.bsth.websocket.handler.SendUtils; |
| ... | ... | @@ -54,10 +57,13 @@ import org.slf4j.LoggerFactory; |
| 54 | 57 | import org.springframework.beans.factory.annotation.Autowired; |
| 55 | 58 | import org.springframework.stereotype.Service; |
| 56 | 59 | |
| 60 | +import java.io.*; | |
| 57 | 61 | import java.text.DecimalFormat; |
| 58 | 62 | import java.text.ParseException; |
| 59 | 63 | import java.text.SimpleDateFormat; |
| 60 | 64 | import java.util.*; |
| 65 | +import java.util.zip.ZipEntry; | |
| 66 | +import java.util.zip.ZipOutputStream; | |
| 61 | 67 | |
| 62 | 68 | @Service |
| 63 | 69 | public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long> |
| ... | ... | @@ -124,6 +130,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 124 | 130 | } |
| 125 | 131 | |
| 126 | 132 | private final static long DAY_TIME = 1000 * 60 * 60 * 24L; |
| 133 | + | |
| 134 | + private static int BUF_SIZE = 1024; | |
| 135 | + | |
| 127 | 136 | private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"); |
| 128 | 137 | |
| 129 | 138 | @Override |
| ... | ... | @@ -1340,29 +1349,52 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1340 | 1349 | @Override |
| 1341 | 1350 | public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh, |
| 1342 | 1351 | String lpName, String date,String line) { |
| 1352 | + List<ScheduleRealInfo> listSchedule=new ArrayList<ScheduleRealInfo>(); | |
| 1343 | 1353 | List<ScheduleRealInfo> list = null; |
| 1344 | 1354 | list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date,line); |
| 1345 | 1355 | for (int i = 0; i < list.size(); i++) { |
| 1346 | 1356 | ScheduleRealInfo s = list.get(i); |
| 1357 | + s.setAdjustExps(i+1+""); | |
| 1347 | 1358 | String remarks = ""; |
| 1348 | 1359 | if (s.getRemarks() != null) { |
| 1349 | 1360 | remarks += s.getRemarks(); |
| 1350 | 1361 | } |
| 1362 | + | |
| 1351 | 1363 | Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); |
| 1352 | - if (!childTaskPlans.isEmpty()) { | |
| 1353 | - Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 1354 | - while (it.hasNext()) { | |
| 1355 | - ChildTaskPlan c = it.next(); | |
| 1356 | - if (c.getRemarks() != null && c.getRemarks().length() > 0) { | |
| 1357 | - remarks += c.getRemarks(); | |
| 1358 | - } | |
| 1359 | - | |
| 1360 | - } | |
| 1364 | + if (childTaskPlans.isEmpty()) { | |
| 1365 | + if(s.getStatus()==-1){ | |
| 1366 | + if(remarks.indexOf("烂班")>-1){ | |
| 1367 | + remarks +="(烂班)"; | |
| 1368 | + } | |
| 1369 | + s.setRemarks(remarks); | |
| 1370 | + } | |
| 1371 | + | |
| 1372 | + }else{ | |
| 1373 | + s.setFcsjActual(""); | |
| 1374 | + s.setZdsjActual(""); | |
| 1361 | 1375 | } |
| 1362 | - s.setRemarks(remarks); | |
| 1376 | + listSchedule.add(s); | |
| 1377 | + if(!childTaskPlans.isEmpty()){ | |
| 1378 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 1379 | + while (it.hasNext()) { | |
| 1380 | + ChildTaskPlan c = it.next(); | |
| 1381 | + if(!c.isDestroy()){ | |
| 1382 | + ScheduleRealInfo t=new ScheduleRealInfo(); | |
| 1383 | + t.setFcsjActual(c.getStartDate()); | |
| 1384 | + t.setZdsjActual(c.getEndDate()); | |
| 1385 | + t.setQdzName(c.getStartStationName()); | |
| 1386 | + t.setZdzName(c.getEndStationName()); | |
| 1387 | + t.setJhlc( Double.parseDouble(String.valueOf(c.getMileage()))); | |
| 1388 | + t.setRemarks(c.getRemarks()); | |
| 1389 | + t.setAdjustExps("子"); | |
| 1390 | + listSchedule.add(t); | |
| 1391 | + } | |
| 1392 | + } | |
| 1393 | + } | |
| 1394 | + | |
| 1363 | 1395 | } |
| 1364 | 1396 | |
| 1365 | - return list; | |
| 1397 | + return listSchedule; | |
| 1366 | 1398 | } |
| 1367 | 1399 | |
| 1368 | 1400 | @Override |
| ... | ... | @@ -1386,13 +1418,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1386 | 1418 | @Override |
| 1387 | 1419 | public List<Map<String, Object>> statisticsDaily(String line, String date, |
| 1388 | 1420 | String xlName, String type) { |
| 1389 | - List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date); | |
| 1421 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 1422 | + if(date.length() == 10) | |
| 1423 | + list = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date); | |
| 1424 | + else if(date.length() == 7) | |
| 1425 | + list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date); | |
| 1390 | 1426 | |
| 1391 | 1427 | List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); |
| 1392 | 1428 | DecimalFormat format = new DecimalFormat("0.00"); |
| 1393 | 1429 | double jhlc = 0, tempJhlc = 0, childMileage = 0; |
| 1394 | 1430 | 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; |
| 1395 | 1431 | //班次 |
| 1432 | + 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; | |
| 1396 | 1433 | int sj_0 = 6 * 60 + 31, sj_1 = 8 * 60 + 30, sj_2 = 16 * 60 + 1, sj_3 = 18 * 60; |
| 1397 | 1434 | int jhbc = 0, jhbc_m = 0, jhbc_a = 0; |
| 1398 | 1435 | int sjbc = 0, sjbc_m = 0, sjbc_a = 0; |
| ... | ... | @@ -1406,6 +1443,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1406 | 1443 | ssgl_gzZ = 0f, ssgl_jfZ = 0f, ssgl_zsZ = 0f, ssgl_qrZ = 0f, ssgl_qcZ = 0f, |
| 1407 | 1444 | ssgl_kxZ = 0f, ssgl_qhZ = 0f, ssgl_ywZ = 0f, ssgl_otherZ = 0f, ljglZ = 0f; |
| 1408 | 1445 | //班次 |
| 1446 | + 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; | |
| 1409 | 1447 | int jhbcZ = 0, jhbc_mZ = 0, jhbc_aZ = 0; |
| 1410 | 1448 | int sjbcZ = 0, sjbc_mZ = 0, sjbc_aZ = 0; |
| 1411 | 1449 | int ljbcZ = 0, ljbc_mZ = 0, ljbc_aZ = 0; |
| ... | ... | @@ -1431,39 +1469,63 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1431 | 1469 | if (scheduleRealInfo.getStatus() == -1) { |
| 1432 | 1470 | ssgl += tempJhlc; |
| 1433 | 1471 | ssglZ += tempJhlc; |
| 1472 | + ssbc++; | |
| 1473 | + ssbcZ++; | |
| 1434 | 1474 | if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("路阻") != -1) { |
| 1435 | 1475 | ssgl_lz += tempJhlc; |
| 1436 | 1476 | ssgl_lzZ += tempJhlc; |
| 1477 | + ssbc_lz++; | |
| 1478 | + ssbc_lzZ++; | |
| 1437 | 1479 | } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("吊慢") != -1) { |
| 1438 | 1480 | ssgl_dm += tempJhlc; |
| 1439 | 1481 | ssgl_dmZ += tempJhlc; |
| 1482 | + ssbc_dm++; | |
| 1483 | + ssbc_dmZ++; | |
| 1440 | 1484 | } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("故障") != -1) { |
| 1441 | 1485 | ssgl_gz += tempJhlc; |
| 1442 | 1486 | ssgl_gzZ += tempJhlc; |
| 1487 | + ssbc_gz++; | |
| 1488 | + ssbc_gzZ++; | |
| 1443 | 1489 | } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("纠纷") != -1) { |
| 1444 | 1490 | ssgl_jf += tempJhlc; |
| 1445 | 1491 | ssgl_jfZ += tempJhlc; |
| 1492 | + ssbc_jf++; | |
| 1493 | + ssbc_jfZ++; | |
| 1446 | 1494 | } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("肇事") != -1) { |
| 1447 | 1495 | ssgl_zs += tempJhlc; |
| 1448 | 1496 | ssgl_zsZ += tempJhlc; |
| 1497 | + ssbc_zs++; | |
| 1498 | + ssbc_zsZ++; | |
| 1449 | 1499 | } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("缺人") != -1) { |
| 1450 | 1500 | ssgl_qr += tempJhlc; |
| 1451 | 1501 | ssgl_qrZ += tempJhlc; |
| 1502 | + ssbc_qr++; | |
| 1503 | + ssbc_qrZ++; | |
| 1452 | 1504 | } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("缺车") != -1) { |
| 1453 | 1505 | ssgl_qc += tempJhlc; |
| 1454 | 1506 | ssgl_qcZ += tempJhlc; |
| 1507 | + ssbc_qc++; | |
| 1508 | + ssbc_qcZ++; | |
| 1455 | 1509 | } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("客稀") != -1) { |
| 1456 | 1510 | ssgl_kx += tempJhlc; |
| 1457 | 1511 | ssgl_kxZ += tempJhlc; |
| 1512 | + ssbc_kx++; | |
| 1513 | + ssbc_kxZ++; | |
| 1458 | 1514 | } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("气候") != -1) { |
| 1459 | 1515 | ssgl_qh += tempJhlc; |
| 1460 | 1516 | ssgl_qhZ += tempJhlc; |
| 1517 | + ssbc_qh++; | |
| 1518 | + ssbc_qhZ++; | |
| 1461 | 1519 | } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("援外") != -1) { |
| 1462 | 1520 | ssgl_yw += tempJhlc; |
| 1463 | 1521 | ssgl_ywZ += tempJhlc; |
| 1522 | + ssbc_yw++; | |
| 1523 | + ssbc_ywZ++; | |
| 1464 | 1524 | } else { |
| 1465 | 1525 | ssgl_other += tempJhlc; |
| 1466 | 1526 | ssgl_otherZ += tempJhlc; |
| 1527 | + ssbc_other++; | |
| 1528 | + ssbc_otherZ++; | |
| 1467 | 1529 | } |
| 1468 | 1530 | }else { |
| 1469 | 1531 | sjgl += tempJhlc; |
| ... | ... | @@ -1479,39 +1541,63 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1479 | 1541 | if (childTaskPlan.isDestroy()) { |
| 1480 | 1542 | ssgl += childMileage; |
| 1481 | 1543 | ssglZ += childMileage; |
| 1544 | + ssbc++; | |
| 1545 | + ssbcZ++; | |
| 1482 | 1546 | if (childTaskPlan.getDestroyReason().equals("路阻")) { |
| 1483 | 1547 | ssgl_lz += childTaskPlan.getMileage(); |
| 1484 | 1548 | ssgl_lzZ += childTaskPlan.getMileage(); |
| 1549 | + ssbc_lzZ++; | |
| 1550 | + ssbc_lzZ++; | |
| 1485 | 1551 | } else if (childTaskPlan.getDestroyReason().equals("吊慢")) { |
| 1486 | 1552 | ssgl_dm += childTaskPlan.getMileage(); |
| 1487 | 1553 | ssgl_dmZ += childTaskPlan.getMileage(); |
| 1554 | + ssbc_dm++; | |
| 1555 | + ssbc_dmZ++; | |
| 1488 | 1556 | } else if (childTaskPlan.getDestroyReason().equals("故障")) { |
| 1489 | 1557 | ssgl_gz += childTaskPlan.getMileage(); |
| 1490 | 1558 | ssgl_gzZ += childTaskPlan.getMileage(); |
| 1559 | + ssbc_gz++; | |
| 1560 | + ssbc_gzZ++; | |
| 1491 | 1561 | } else if (childTaskPlan.getDestroyReason().equals("纠纷")) { |
| 1492 | 1562 | ssgl_jf += childTaskPlan.getMileage(); |
| 1493 | 1563 | ssgl_jfZ += childTaskPlan.getMileage(); |
| 1564 | + ssbc_jf++; | |
| 1565 | + ssbc_jfZ++; | |
| 1494 | 1566 | } else if (childTaskPlan.getDestroyReason().equals("肇事")) { |
| 1495 | 1567 | ssgl_zs += childTaskPlan.getMileage(); |
| 1496 | 1568 | ssgl_zsZ += childTaskPlan.getMileage(); |
| 1569 | + ssbc_zs++; | |
| 1570 | + ssbc_zsZ++; | |
| 1497 | 1571 | } else if (childTaskPlan.getDestroyReason().equals("缺人")) { |
| 1498 | 1572 | ssgl_qr += childTaskPlan.getMileage(); |
| 1499 | 1573 | ssgl_qrZ += childTaskPlan.getMileage(); |
| 1574 | + ssbc_qr++; | |
| 1575 | + ssbc_qrZ++; | |
| 1500 | 1576 | } else if (childTaskPlan.getDestroyReason().equals("缺车")) { |
| 1501 | 1577 | ssgl_qc += childTaskPlan.getMileage(); |
| 1502 | 1578 | ssgl_qcZ += childTaskPlan.getMileage(); |
| 1579 | + ssbc_qc++; | |
| 1580 | + ssbc_qcZ++; | |
| 1503 | 1581 | } else if (childTaskPlan.getDestroyReason().equals("客稀")) { |
| 1504 | 1582 | ssgl_kx += childTaskPlan.getMileage(); |
| 1505 | 1583 | ssgl_kxZ += childTaskPlan.getMileage(); |
| 1584 | + ssbc_kx++; | |
| 1585 | + ssbc_kxZ++; | |
| 1506 | 1586 | } else if (childTaskPlan.getDestroyReason().equals("气候")) { |
| 1507 | 1587 | ssgl_qh += childTaskPlan.getMileage(); |
| 1508 | 1588 | ssgl_qhZ += childTaskPlan.getMileage(); |
| 1589 | + ssbc_qh++; | |
| 1590 | + ssbc_qhZ++; | |
| 1509 | 1591 | } else if (childTaskPlan.getDestroyReason().equals("援外")) { |
| 1510 | 1592 | ssgl_yw += childTaskPlan.getMileage(); |
| 1511 | 1593 | ssgl_ywZ += childTaskPlan.getMileage(); |
| 1594 | + ssbc_yw++; | |
| 1595 | + ssbc_ywZ++; | |
| 1512 | 1596 | } else { |
| 1513 | 1597 | ssgl_other += childTaskPlan.getMileage(); |
| 1514 | 1598 | ssgl_otherZ += childTaskPlan.getMileage(); |
| 1599 | + ssbc_other++; | |
| 1600 | + ssbc_otherZ++; | |
| 1515 | 1601 | } |
| 1516 | 1602 | } else { |
| 1517 | 1603 | sjgl += childMileage; |
| ... | ... | @@ -1522,6 +1608,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1522 | 1608 | |
| 1523 | 1609 | //班次 |
| 1524 | 1610 | jhbc++; |
| 1611 | + jhbcZ++; | |
| 1525 | 1612 | String[] fcsj = scheduleRealInfo.getFcsj().split(":"); |
| 1526 | 1613 | String[] fcsjActual = (scheduleRealInfo.getFcsjActual() == null ? "0:00" : scheduleRealInfo.getFcsjActual()).split(":"); |
| 1527 | 1614 | if ((Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) > sj_0 && (Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) < sj_1) { |
| ... | ... | @@ -1584,6 +1671,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1584 | 1671 | map.put("ssgl_qh", ssgl_qh == 0 ? 0 : format.format(ssgl_qh)); |
| 1585 | 1672 | map.put("ssgl_yw", ssgl_yw == 0 ? 0 : format.format(ssgl_yw)); |
| 1586 | 1673 | map.put("ssgl_other", ssgl_other == 0 ? 0 : format.format(ssgl_other)); |
| 1674 | + map.put("ssbc", ssbc); | |
| 1675 | + map.put("ssbc_lz", ssbc_lz); | |
| 1676 | + map.put("ssbc_dm", ssbc_dm); | |
| 1677 | + map.put("ssbc_gz", ssbc_gz); | |
| 1678 | + map.put("ssbc_jf", ssbc_jf); | |
| 1679 | + map.put("ssbc_zs", ssbc_zs); | |
| 1680 | + map.put("ssbc_qr", ssbc_qr); | |
| 1681 | + map.put("ssbc_qc", ssbc_qc); | |
| 1682 | + map.put("ssbc_kx", ssbc_kx); | |
| 1683 | + map.put("ssbc_qh", ssbc_qh); | |
| 1684 | + map.put("ssbc_yw", ssbc_yw); | |
| 1685 | + map.put("ssbc_other", ssbc_other); | |
| 1587 | 1686 | map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl)); |
| 1588 | 1687 | map.put("jhbc", jhbc); |
| 1589 | 1688 | map.put("jhbc_m", jhbc_m); |
| ... | ... | @@ -1634,6 +1733,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1634 | 1733 | map.put("ssgl_qh", ssgl_qh == 0 ? 0 : format.format(ssgl_qh)); |
| 1635 | 1734 | map.put("ssgl_yw", ssgl_yw == 0 ? 0 : format.format(ssgl_yw)); |
| 1636 | 1735 | map.put("ssgl_other", ssgl_other == 0 ? 0 : format.format(ssgl_other)); |
| 1736 | + map.put("ssbc", ssbc); | |
| 1737 | + map.put("ssbc_lz", ssbc_lz); | |
| 1738 | + map.put("ssbc_dm", ssbc_dm); | |
| 1739 | + map.put("ssbc_gz", ssbc_gz); | |
| 1740 | + map.put("ssbc_jf", ssbc_jf); | |
| 1741 | + map.put("ssbc_zs", ssbc_zs); | |
| 1742 | + map.put("ssbc_qr", ssbc_qr); | |
| 1743 | + map.put("ssbc_qc", ssbc_qc); | |
| 1744 | + map.put("ssbc_kx", ssbc_kx); | |
| 1745 | + map.put("ssbc_qh", ssbc_qh); | |
| 1746 | + map.put("ssbc_yw", ssbc_yw); | |
| 1747 | + map.put("ssbc_other", ssbc_other); | |
| 1637 | 1748 | map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl)); |
| 1638 | 1749 | map.put("jhbc", jhbc); |
| 1639 | 1750 | map.put("jhbc_m", jhbc_m); |
| ... | ... | @@ -1685,6 +1796,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1685 | 1796 | map.put("ssgl_qh", ssgl_qhZ == 0 ? 0 : format.format(ssgl_qhZ)); |
| 1686 | 1797 | map.put("ssgl_yw", ssgl_ywZ == 0 ? 0 : format.format(ssgl_ywZ)); |
| 1687 | 1798 | map.put("ssgl_other", ssgl_otherZ == 0 ? 0 : format.format(ssgl_otherZ)); |
| 1799 | + map.put("ssbc", ssbcZ); | |
| 1800 | + map.put("ssbc_lz", ssbc_lzZ); | |
| 1801 | + map.put("ssbc_dm", ssbc_lzZ); | |
| 1802 | + map.put("ssbc_gz", ssbc_gzZ); | |
| 1803 | + map.put("ssbc_jf", ssbc_jfZ); | |
| 1804 | + map.put("ssbc_zs", ssbc_zsZ); | |
| 1805 | + map.put("ssbc_qr", ssbc_qrZ); | |
| 1806 | + map.put("ssbc_qc", ssbc_qcZ); | |
| 1807 | + map.put("ssbc_kx", ssbc_qcZ); | |
| 1808 | + map.put("ssbc_qh", ssbc_qhZ); | |
| 1809 | + map.put("ssbc_yw", ssbc_ywZ); | |
| 1810 | + map.put("ssbc_other", ssbc_otherZ); | |
| 1688 | 1811 | map.put("ljgl", ljglZ == 0 ? 0 : format.format(ljglZ)); |
| 1689 | 1812 | map.put("jhbc", jhbcZ); |
| 1690 | 1813 | map.put("jhbc_m", jhbc_mZ); |
| ... | ... | @@ -2054,7 +2177,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2054 | 2177 | |
| 2055 | 2178 | for (ChangePersonCar cpc : cpcs) { |
| 2056 | 2179 | |
| 2057 | - if (map.get(cpc.getClZbh()) == null) { | |
| 2180 | + if (cpc.getClZbh() != null && map.get(cpc.getClZbh()) == null) { | |
| 2058 | 2181 | rs.put("msg", "车辆 " + cpc.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); |
| 2059 | 2182 | rs.put("status", ResponseCode.ERROR); |
| 2060 | 2183 | return rs; |
| ... | ... | @@ -2476,7 +2599,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2476 | 2599 | map.put("fast", ""); |
| 2477 | 2600 | map.put("slow", ""); |
| 2478 | 2601 | } |
| 2479 | - listMap.add(map); | |
| 2602 | + System.out.println(map); | |
| 2603 | + listMap.add(map); | |
| 2480 | 2604 | } catch (Exception e) { |
| 2481 | 2605 | e.printStackTrace(); |
| 2482 | 2606 | } |
| ... | ... | @@ -2504,13 +2628,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2504 | 2628 | map.put("jzl", jzl); |
| 2505 | 2629 | map.put("jhlc", format.format(jhlc+jcclc)); |
| 2506 | 2630 | map.put("yygljh", format.format(jhlc)); |
| 2507 | - map.put("ssgl", format.format(remgl)); | |
| 2631 | + map.put("ssgl", format.format(remMileage)); | |
| 2508 | 2632 | map.put("ksgl", format.format(ksgl)); |
| 2509 | 2633 | map.put("yyglsj", format.format(yygl)); |
| 2510 | 2634 | map.put("jhbc", jhbc); |
| 2511 | 2635 | map.put("jcclc", jcclc); |
| 2512 | 2636 | |
| 2513 | - map.put("ljgl", format.format(addgl)); | |
| 2637 | + map.put("ljgl", format.format(addMileage)); | |
| 2514 | 2638 | map.put("ssbc", cjbc); |
| 2515 | 2639 | map.put("ysgl", format.format(yygl)); |
| 2516 | 2640 | map.put("sjbc", jhbc-cjbc+ljbc); |
| ... | ... | @@ -2646,13 +2770,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2646 | 2770 | } |
| 2647 | 2771 | map.put("jhlc", format.format(jhlc+jcclc)); |
| 2648 | 2772 | map.put("yygljh", format.format(jhlc)); |
| 2649 | - map.put("ssgl", format.format(remgl)); | |
| 2773 | + map.put("ssgl", format.format(remMileage)); | |
| 2650 | 2774 | map.put("ksgl", format.format(ksgl)); |
| 2651 | 2775 | map.put("yyglsj", format.format(yygl)); |
| 2652 | 2776 | map.put("jhbc", jhbc); |
| 2653 | 2777 | map.put("jcclc", jcclc); |
| 2654 | 2778 | |
| 2655 | - map.put("ljgl", format.format(addgl)); | |
| 2779 | + map.put("ljgl", format.format(addMileage)); | |
| 2656 | 2780 | map.put("ssbc", cjbc); |
| 2657 | 2781 | map.put("ysgl", format.format(yygl)); |
| 2658 | 2782 | map.put("sjbc", jhbc-cjbc+ljbc); |
| ... | ... | @@ -2913,4 +3037,214 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2913 | 3037 | return list; |
| 2914 | 3038 | } |
| 2915 | 3039 | |
| 3040 | + | |
| 3041 | + @Override | |
| 3042 | + public List<Map<String, Object>> scheduleDailyExport(Map<String, Object> map){ | |
| 3043 | + String line = map.get("line").toString(); | |
| 3044 | + String date = map.get("date").toString(); | |
| 3045 | + String xlName = map.get("xlName").toString(); | |
| 3046 | + String state = map.get("state").toString(); | |
| 3047 | + String type = map.get("type").toString(); | |
| 3048 | + | |
| 3049 | + List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>(); | |
| 3050 | + List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>(); | |
| 3051 | + List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null); | |
| 3052 | + List<ScheduleRealInfo> list2 = this.queryUserInfo(line, date, state); | |
| 3053 | + List<ScheduleRealInfo> list3 = this.realScheduleList(line, date); | |
| 3054 | + | |
| 3055 | + for(Map<String, Object> m : list1){ | |
| 3056 | +// m.put("ssgl", m.get("ssgl")); | |
| 3057 | +// m.put("ssbc", m.get("ssbc")); | |
| 3058 | +// m.put("ssgl_lz", m.get("ssgl_lz") + " / " + m.get("ssbc_lz")); | |
| 3059 | +// m.put("ssgl_dm", m.get("ssgl_dm") + " / " + m.get("ssbc_dm")); | |
| 3060 | +// m.put("ssgl_gz", m.get("ssgl_gz") + " / " + m.get("ssbc_gz")); | |
| 3061 | +// m.put("ssgl_jf", m.get("ssgl_jf") + " / " + m.get("ssbc_jf")); | |
| 3062 | +// m.put("ssgl_zs", m.get("ssgl_zs") + " / " + m.get("ssbc_zs")); | |
| 3063 | +// m.put("ssgl_qr", m.get("ssgl_qr") + " / " + m.get("ssbc_qr")); | |
| 3064 | +// m.put("ssgl_qc", m.get("ssgl_qc") + " / " + m.get("ssbc_qc")); | |
| 3065 | +// m.put("ssgl_kx", m.get("ssgl_kx") + " / " + m.get("ssbc_kx")); | |
| 3066 | +// m.put("ssgl_qh", m.get("ssgl_qh") + " / " + m.get("ssbc_qh")); | |
| 3067 | +// m.put("ssgl_yw", m.get("ssgl_yw") + " / " + m.get("ssbc_yw")); | |
| 3068 | +// m.put("ssgl_other", m.get("ssgl_other") + " / " + m.get("ssbc_other")); | |
| 3069 | + } | |
| 3070 | + | |
| 3071 | + int size = 0; | |
| 3072 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | |
| 3073 | + for(int i = 0; i < list2.size(); i++){ | |
| 3074 | + Object obj = (Object)list2.get(i); | |
| 3075 | + Object[] objs = (Object[])obj; | |
| 3076 | + if(size == 5){ | |
| 3077 | + size = 0; | |
| 3078 | + dataList2.add(tempMap); | |
| 3079 | + tempMap = new HashMap<String, Object>(); | |
| 3080 | + } | |
| 3081 | + tempMap.put("lp" + size, objs[3]); | |
| 3082 | + tempMap.put("ch" + size, objs[2]); | |
| 3083 | + tempMap.put("jz" + size, objs[1] + "/" + objs[4]); | |
| 3084 | + tempMap.put("sz" + size, ""); | |
| 3085 | + tempMap.put("jw" + size, ""); | |
| 3086 | + tempMap.put("sw" + size, ""); | |
| 3087 | + | |
| 3088 | + size++; | |
| 3089 | + } | |
| 3090 | + if(size < 5){ | |
| 3091 | + for(;size < 5; size++){ | |
| 3092 | + tempMap.put("lp" + size, ""); | |
| 3093 | + tempMap.put("ch" + size, ""); | |
| 3094 | + tempMap.put("jz" + size, ""); | |
| 3095 | + tempMap.put("sz" + size, ""); | |
| 3096 | + tempMap.put("jw" + size, ""); | |
| 3097 | + tempMap.put("sw" + size, ""); | |
| 3098 | + } | |
| 3099 | + } | |
| 3100 | + | |
| 3101 | + dataList2.add(tempMap); | |
| 3102 | + | |
| 3103 | + size = 0; | |
| 3104 | + tempMap = new HashMap<String, Object>(); | |
| 3105 | + for(ScheduleRealInfo schedule : list3){ | |
| 3106 | + if(size == 3){ | |
| 3107 | + size = 0; | |
| 3108 | + dataList3.add(tempMap); | |
| 3109 | + tempMap = new HashMap<String, Object>(); | |
| 3110 | + } | |
| 3111 | + tempMap.put("lpName" + size, schedule.getLpName()); | |
| 3112 | + tempMap.put("qdzName" + size, schedule.getQdzName()); | |
| 3113 | + tempMap.put("zdsj" + size, schedule.getZdsj()); | |
| 3114 | + tempMap.put("zdsjActual" + size, schedule.getZdsjActual()!=null?schedule.getZdsjActual():""); | |
| 3115 | + tempMap.put("zdsjk" + size, ""); | |
| 3116 | + tempMap.put("zdsjm" + size, ""); | |
| 3117 | + tempMap.put("fcsj" + size, schedule.getFcsj()); | |
| 3118 | + tempMap.put("fcsjActual" + size, schedule.getFcsjActual()!=null?schedule.getFcsjActual():""); | |
| 3119 | + tempMap.put("fcsjk" + size, ""); | |
| 3120 | + tempMap.put("fcsjm" + size, ""); | |
| 3121 | + tempMap.put("remarks" + size, schedule.getRemarks()!=null?schedule.getRemarks():""); | |
| 3122 | + | |
| 3123 | + size++; | |
| 3124 | + } | |
| 3125 | + if(size < 3){ | |
| 3126 | + for(; size < 3; size++){ | |
| 3127 | + tempMap.put("lpName" + size, ""); | |
| 3128 | + tempMap.put("qdzName" + size, ""); | |
| 3129 | + tempMap.put("zdsj" + size, ""); | |
| 3130 | + tempMap.put("zdsjActual" + size, ""); | |
| 3131 | + tempMap.put("zdsjk" + size, ""); | |
| 3132 | + tempMap.put("zdsjm" + size, ""); | |
| 3133 | + tempMap.put("fcsj" + size, ""); | |
| 3134 | + tempMap.put("fcsjActual" + size, ""); | |
| 3135 | + tempMap.put("fcsjk" + size, ""); | |
| 3136 | + tempMap.put("fcsjm" + size, ""); | |
| 3137 | + tempMap.put("remarks" + size, ""); | |
| 3138 | + } | |
| 3139 | + } | |
| 3140 | + | |
| 3141 | + dataList3.add(tempMap); | |
| 3142 | + | |
| 3143 | + if (type.equals("export")) { | |
| 3144 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 3145 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 3146 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 3147 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 3148 | + ReportUtils ee = new ReportUtils(); | |
| 3149 | + try { | |
| 3150 | + listI.add(list1.iterator()); | |
| 3151 | + listI.add(dataList2.iterator()); | |
| 3152 | + listI.add(dataList3.iterator()); | |
| 3153 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 3154 | + String sourcePath = path+"mould/scheduleDaily.xls"; | |
| 3155 | + if(date.length() == 7){ | |
| 3156 | + sdfMonth = new SimpleDateFormat("yyyy-MM"); | |
| 3157 | + sdfSimple = new SimpleDateFormat("yyyyMM"); | |
| 3158 | + sourcePath = path+"mould/scheduleDaily_m.xls"; | |
| 3159 | + } | |
| 3160 | + ee.excelReplace(listI, new Object[] { m }, sourcePath, | |
| 3161 | + path+"export/调度日报" + sdfSimple.format(sdfMonth.parse(date))+".xls"); | |
| 3162 | + } catch (Exception e) { | |
| 3163 | + // TODO: handle exception | |
| 3164 | + e.printStackTrace(); | |
| 3165 | + } | |
| 3166 | + } | |
| 3167 | + | |
| 3168 | + return new ArrayList<Map<String, Object>>(); | |
| 3169 | + } | |
| 3170 | + | |
| 3171 | + @Override | |
| 3172 | + public Map<String, Object> exportWaybillMore(Map<String, Object> map) { | |
| 3173 | + String date = map.get("date").toString(); | |
| 3174 | + String line = map.get("line").toString(); | |
| 3175 | + List<List> lists = JSON.parseArray(map.get("strs").toString(), List.class); | |
| 3176 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/export/"; | |
| 3177 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 3178 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 3179 | + int num = 0; | |
| 3180 | + File file = null; | |
| 3181 | + try { | |
| 3182 | + while (true) { | |
| 3183 | + String fileUrl = path+"行车路单"+sdfSimple.format(sdfMonth.parse(date)); | |
| 3184 | + file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/")); | |
| 3185 | + if(file.exists()){ | |
| 3186 | + num++; | |
| 3187 | + } else { | |
| 3188 | + break; | |
| 3189 | + } | |
| 3190 | + } | |
| 3191 | + file.mkdirs(); | |
| 3192 | + | |
| 3193 | + for(List<String> list : lists){ | |
| 3194 | + String jName = list.get(0); | |
| 3195 | + String clZbh = list.get(1); | |
| 3196 | + String lpName = list.get(2); | |
| 3197 | + this.exportWaybill(jName, clZbh, lpName, date, line); | |
| 3198 | + File temp = new File(path+date+"-"+jName+"-"+clZbh+"-"+lpName+"-行车路单.xls"); | |
| 3199 | + String fileName = file.getName(); | |
| 3200 | + temp.renameTo(new File(path + fileName + "/" + temp.getName())); | |
| 3201 | + | |
| 3202 | + File[] listFiles = file.listFiles(); | |
| 3203 | + ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path+file.getName()+".zip"))); | |
| 3204 | +// zos.setEncoding("gbk"); | |
| 3205 | +// zos.putNextEntry(new ZipEntry(fileName + "/")); | |
| 3206 | + for(int i = 0; i < listFiles.length; i++){ | |
| 3207 | + zos.putNextEntry(new ZipEntry(fileName+"/"+listFiles[i].getName())); | |
| 3208 | + BufferedInputStream bis = new BufferedInputStream(new FileInputStream(listFiles[i])); | |
| 3209 | + BufferedOutputStream bos = new BufferedOutputStream(zos); | |
| 3210 | + int bytesRead = 0; | |
| 3211 | + for(byte[] buffer = new byte[BUF_SIZE]; ((bytesRead = bis.read(buffer, 0, BUF_SIZE)) != -1);){ | |
| 3212 | +// zos.write(buffer, 0, bytesRead); | |
| 3213 | +// zos.flush(); | |
| 3214 | + bos.write(buffer, 0, bytesRead); | |
| 3215 | + bos.flush(); | |
| 3216 | + } | |
| 3217 | + } | |
| 3218 | + zos.close(); | |
| 3219 | + } | |
| 3220 | + | |
| 3221 | + } catch (Exception e) { | |
| 3222 | + // TODO: handle exception | |
| 3223 | + e.printStackTrace(); | |
| 3224 | + } | |
| 3225 | + | |
| 3226 | + map.put("fileName", file.getName()); | |
| 3227 | + return map; | |
| 3228 | + } | |
| 3229 | + | |
| 3230 | + @Autowired | |
| 3231 | + SchedulePlanInfoService schPlanService; | |
| 3232 | + @Override | |
| 3233 | + public List<SchedulePlanInfo> currentSchedulePlan(String lineCode) { | |
| 3234 | + List<SchedulePlanInfo> rs = dayOfSchedule.schedulePlanMap.get(lineCode); | |
| 3235 | + | |
| 3236 | + if(rs==null || rs.size()==0){ | |
| 3237 | + //尝试刷新内存 | |
| 3238 | + Map<String, Object> data = new HashMap<>(); | |
| 3239 | + data.put("scheduleDate_eq", dayOfSchedule.currSchDateMap.get(lineCode)); | |
| 3240 | + data.put("xlBm_eq", lineCode); | |
| 3241 | + List<SchedulePlanInfo> planItr = dayOfSchedule.cleanSchPlanItr(schPlanService.list(data).iterator()); | |
| 3242 | + | |
| 3243 | + if(planItr.size() > 0){ | |
| 3244 | + dayOfSchedule.schedulePlanMap.put(lineCode, planItr); | |
| 3245 | + return planItr; | |
| 3246 | + } | |
| 3247 | + } | |
| 3248 | + return rs; | |
| 3249 | + } | |
| 2916 | 3250 | } |
| 2917 | 3251 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/service/schedule/SchedulePlanInfoService.java
| ... | ... | @@ -4,6 +4,7 @@ import com.bsth.entity.schedule.SchedulePlanInfo; |
| 4 | 4 | import com.bsth.service.BaseService; |
| 5 | 5 | import org.joda.time.DateTime; |
| 6 | 6 | |
| 7 | +import java.util.ArrayList; | |
| 7 | 8 | import java.util.Date; |
| 8 | 9 | import java.util.List; |
| 9 | 10 | |
| ... | ... | @@ -117,6 +118,11 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 117 | 118 | /** 创建时间 */ |
| 118 | 119 | private Date createDate; |
| 119 | 120 | |
| 121 | + /** 出场班次1发车的顺序号 */ | |
| 122 | + private Integer fcno1; | |
| 123 | + /** 出场班次2发车的顺序号 */ | |
| 124 | + private Integer fcno2; | |
| 125 | + | |
| 120 | 126 | public GroupInfo() {} |
| 121 | 127 | |
| 122 | 128 | public GroupInfo(Object[] datas) { |
| ... | ... | @@ -132,19 +138,40 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 132 | 138 | this.clId = Integer.valueOf(String.valueOf(datas[4])); |
| 133 | 139 | // 车辆自编号 |
| 134 | 140 | this.clZbh = String.valueOf(datas[5]); |
| 135 | - // 出场时间,如果有多个,需要分开 | |
| 141 | + // 出场时间,出场班次,如果有多个,需要分开 | |
| 136 | 142 | Object ccsj = datas[6]; |
| 143 | + Object bctype = datas[7]; | |
| 144 | + Object fcno = datas[15]; | |
| 145 | + | |
| 137 | 146 | if (ccsj != null) { |
| 138 | 147 | String[] ccsj_array = ((String) ccsj).split(","); |
| 139 | - if (ccsj_array.length > 1) { | |
| 140 | - this.ccsj1 = String.valueOf(ccsj_array[0]); | |
| 141 | - this.ccsj2 = String.valueOf(ccsj_array[1]); | |
| 142 | - } else { | |
| 143 | - this.ccsj1 = String.valueOf(ccsj_array[0]); | |
| 148 | + String[] bctype_array = ((String) bctype).split(","); | |
| 149 | + String[] fcno_array = ((String) fcno).split(","); | |
| 150 | + List<Integer> bctype_index = new ArrayList<>(); | |
| 151 | + | |
| 152 | + for (int i = 0; i < bctype_array.length; i++) { | |
| 153 | + if (bctype_index.size() == 2) { // 只记录2个出场 | |
| 154 | + break; | |
| 155 | + } | |
| 156 | + if (bctype_array[i].equals("out")) { | |
| 157 | + bctype_index.add(i); | |
| 158 | + } | |
| 159 | + } | |
| 160 | + | |
| 161 | + if (bctype_index.size() == 1) { | |
| 162 | + this.ccsj1 = String.valueOf(ccsj_array[bctype_index.get(0)]); | |
| 163 | + this.fcno1 = Integer.valueOf(fcno_array[bctype_index.get(0)]); | |
| 164 | + } else if (bctype_index.size() == 2) { | |
| 165 | + this.ccsj1 = String.valueOf(ccsj_array[bctype_index.get(0)]); | |
| 166 | + this.ccsj2 = String.valueOf(ccsj_array[bctype_index.get(1)]); | |
| 167 | + | |
| 168 | + this.fcno1 = Integer.valueOf(fcno_array[bctype_index.get(0)]); | |
| 169 | + this.fcno2 = Integer.valueOf(fcno_array[bctype_index.get(1)]); | |
| 144 | 170 | } |
| 171 | + | |
| 145 | 172 | } |
| 146 | 173 | // 驾驶员id,如果有多个,需要分开 |
| 147 | - Object jsyId = datas[7]; | |
| 174 | + Object jsyId = datas[8]; | |
| 148 | 175 | if (jsyId != null) { |
| 149 | 176 | String[] jsyId_array = ((String) jsyId).split(","); |
| 150 | 177 | if (jsyId_array.length > 1) { |
| ... | ... | @@ -155,7 +182,7 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 155 | 182 | } |
| 156 | 183 | } |
| 157 | 184 | // 驾驶员工号,如果有多个,需要分开 |
| 158 | - Object jsyGh = datas[8]; | |
| 185 | + Object jsyGh = datas[9]; | |
| 159 | 186 | if (jsyGh != null) { |
| 160 | 187 | String[] jsyGh_array = ((String) jsyGh).split(","); |
| 161 | 188 | if (jsyGh_array.length > 1) { |
| ... | ... | @@ -166,7 +193,7 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 166 | 193 | } |
| 167 | 194 | } |
| 168 | 195 | // 驾驶员名字,如果有多个,需要分开 |
| 169 | - Object jsyName = datas[9]; | |
| 196 | + Object jsyName = datas[10]; | |
| 170 | 197 | if (jsyName != null) { |
| 171 | 198 | String[] jsyName_array = ((String) jsyName).split(","); |
| 172 | 199 | if (jsyName_array.length > 1) { |
| ... | ... | @@ -178,7 +205,7 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 178 | 205 | } |
| 179 | 206 | |
| 180 | 207 | // 售票员id,如果有多个,需要分开 |
| 181 | - Object spyId = datas[10]; | |
| 208 | + Object spyId = datas[11]; | |
| 182 | 209 | if (spyId != null) { |
| 183 | 210 | String[] spyId_array = ((String) spyId).split(","); |
| 184 | 211 | if (spyId_array.length > 1) { |
| ... | ... | @@ -190,7 +217,7 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 190 | 217 | } |
| 191 | 218 | |
| 192 | 219 | // 售票员工号,如果有多个,需要分开 |
| 193 | - Object spyGh = datas[11]; | |
| 220 | + Object spyGh = datas[12]; | |
| 194 | 221 | if (spyGh != null) { |
| 195 | 222 | String[] spyGh_array = ((String) spyGh).split(","); |
| 196 | 223 | if (spyGh_array.length > 1) { |
| ... | ... | @@ -201,7 +228,7 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 201 | 228 | } |
| 202 | 229 | } |
| 203 | 230 | // 售票员名字,如果有多个,需要分开 |
| 204 | - Object spyName = datas[12]; | |
| 231 | + Object spyName = datas[13]; | |
| 205 | 232 | if (spyName != null) { |
| 206 | 233 | String[] spyName_array = ((String) spyName).split(","); |
| 207 | 234 | if (spyName_array.length > 1) { |
| ... | ... | @@ -212,7 +239,7 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 212 | 239 | } |
| 213 | 240 | } |
| 214 | 241 | // 创建时间 |
| 215 | - this.createDate = new DateTime(datas[13]).toDate(); | |
| 242 | + this.createDate = new DateTime(datas[14]).toDate(); | |
| 216 | 243 | |
| 217 | 244 | // TODO:可能还有其他字段 |
| 218 | 245 | } |
| ... | ... | @@ -384,5 +411,21 @@ public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, L |
| 384 | 411 | public void setXlId(Integer xlId) { |
| 385 | 412 | this.xlId = xlId; |
| 386 | 413 | } |
| 414 | + | |
| 415 | + public Integer getFcno1() { | |
| 416 | + return fcno1; | |
| 417 | + } | |
| 418 | + | |
| 419 | + public void setFcno1(Integer fcno1) { | |
| 420 | + this.fcno1 = fcno1; | |
| 421 | + } | |
| 422 | + | |
| 423 | + public Integer getFcno2() { | |
| 424 | + return fcno2; | |
| 425 | + } | |
| 426 | + | |
| 427 | + public void setFcno2(Integer fcno2) { | |
| 428 | + this.fcno2 = fcno2; | |
| 429 | + } | |
| 387 | 430 | } |
| 388 | 431 | } | ... | ... |
src/main/java/com/bsth/service/schedule/SchedulePlanInfoServiceImpl.java
| ... | ... | @@ -55,7 +55,8 @@ public class SchedulePlanInfoServiceImpl extends BaseServiceImpl<SchedulePlanInf |
| 55 | 55 | groupInfoUpdate.getUpdate().getScheduleDate(), |
| 56 | 56 | groupInfoUpdate.getSrc().getLpName(), |
| 57 | 57 | groupInfoUpdate.getSrc().getCcsj1(), |
| 58 | - "out" | |
| 58 | + "out", | |
| 59 | + groupInfoUpdate.getSrc().getFcno1() | |
| 59 | 60 | ); |
| 60 | 61 | } |
| 61 | 62 | |
| ... | ... | @@ -94,7 +95,8 @@ public class SchedulePlanInfoServiceImpl extends BaseServiceImpl<SchedulePlanInf |
| 94 | 95 | groupInfoUpdate.getUpdate().getScheduleDate(), |
| 95 | 96 | groupInfoUpdate.getSrc().getLpName(), |
| 96 | 97 | groupInfoUpdate.getSrc().getCcsj2(), |
| 97 | - "out" | |
| 98 | + "out", | |
| 99 | + groupInfoUpdate.getSrc().getFcno2() | |
| 98 | 100 | ); |
| 99 | 101 | } |
| 100 | 102 | ... | ... |
src/main/java/com/bsth/service/schedule/SchedulePlanService.java
| 1 | 1 | package com.bsth.service.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.schedule.SchedulePlan; |
| 4 | -import com.bsth.service.BaseService; | |
| 4 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 5 | +import com.bsth.service.schedule.rules.ttinfo2.Result; | |
| 6 | + | |
| 7 | +import java.util.Date; | |
| 5 | 8 | |
| 6 | 9 | /** |
| 7 | 10 | * Created by xu on 16/6/16. |
| 8 | 11 | */ |
| 9 | -public interface SchedulePlanService extends BaseService<SchedulePlan, Long> { | |
| 12 | +public interface SchedulePlanService extends BService<SchedulePlan, Long> { | |
| 13 | + | |
| 14 | + SchedulePlan save(SchedulePlan schedulePlan, CompanyAuthority companyAuthority); | |
| 15 | + | |
| 10 | 16 | /** |
| 11 | 17 | * 获取有明日排班的计划。 |
| 12 | 18 | * @return |
| 13 | 19 | */ |
| 14 | 20 | SchedulePlan findSchedulePlanTommorw(); |
| 15 | -} | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 验证使用的时刻表。 | |
| 24 | + * @param xlid 线路id | |
| 25 | + * @param from 开始时间 | |
| 26 | + * @param to 结束时间 | |
| 27 | + * @return | |
| 28 | + */ | |
| 29 | + Result validateTTInfo(Integer xlid, Date from, Date to); | |
| 30 | +} | |
| 16 | 31 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/service/schedule/TTInfoDetailService.java
| ... | ... | @@ -6,6 +6,7 @@ import org.apache.commons.lang3.StringUtils; |
| 6 | 6 | |
| 7 | 7 | import java.util.ArrayList; |
| 8 | 8 | import java.util.List; |
| 9 | +import java.util.Map; | |
| 9 | 10 | |
| 10 | 11 | /** |
| 11 | 12 | * Created by xu on 16/7/2. |
| ... | ... | @@ -52,7 +53,7 @@ public interface TTInfoDetailService extends BService<TTInfoDetail, Long> { |
| 52 | 53 | this.xldir = xldir; |
| 53 | 54 | if ("N".equals(isfb)) |
| 54 | 55 | this.isfb = false; |
| 55 | - else if ("Y".equals(isfb)) | |
| 56 | + else if ("Y".equals(isfb) || "true".equals(isfb)) | |
| 56 | 57 | this.isfb = true; |
| 57 | 58 | else |
| 58 | 59 | this.isfb = false; |
| ... | ... | @@ -200,5 +201,5 @@ public interface TTInfoDetailService extends BService<TTInfoDetail, Long> { |
| 200 | 201 | // TODO:这个方法可以用通用方法解决,以后改 |
| 201 | 202 | List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId); |
| 202 | 203 | |
| 203 | - | |
| 204 | + Map<String, Object> skbDetailMxSave(Map<String, Object> map); | |
| 204 | 205 | } | ... | ... |
src/main/java/com/bsth/service/schedule/exception/ScheduleException.java
src/main/java/com/bsth/service/schedule/impl/BServiceImpl.java
| ... | ... | @@ -5,6 +5,12 @@ import com.bsth.repository.BaseRepository; |
| 5 | 5 | import com.bsth.service.schedule.BService; |
| 6 | 6 | import com.bsth.service.schedule.exception.ScheduleException; |
| 7 | 7 | import com.bsth.service.schedule.utils.DataToolsService; |
| 8 | +import jxl.Cell; | |
| 9 | +import jxl.Sheet; | |
| 10 | +import jxl.Workbook; | |
| 11 | +import jxl.write.Label; | |
| 12 | +import jxl.write.WritableSheet; | |
| 13 | +import jxl.write.WritableWorkbook; | |
| 8 | 14 | import org.slf4j.Logger; |
| 9 | 15 | import org.slf4j.LoggerFactory; |
| 10 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -118,7 +124,30 @@ public class BServiceImpl<T, ID extends Serializable> implements BService<T, ID> |
| 118 | 124 | |
| 119 | 125 | @Override |
| 120 | 126 | public File uploadFile(String filename, byte[] filedata) throws ScheduleException { |
| 121 | - return dataToolsService.uploadFile(filename, filedata); | |
| 127 | + try { | |
| 128 | + // 对上传的excel文件做处理,将第一个sheet名字设定为工作表1 | |
| 129 | + File file = dataToolsService.uploadFile(filename, filedata); | |
| 130 | + Workbook workbook = Workbook.getWorkbook(file); | |
| 131 | + Sheet sheet = workbook.getSheet(0); | |
| 132 | + | |
| 133 | + File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls"); | |
| 134 | + WritableWorkbook writableWorkbook = Workbook.createWorkbook(fileCal); | |
| 135 | + WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0); | |
| 136 | + for (int i = 0; i < sheet.getRows(); i++) { | |
| 137 | + Cell[] cells = sheet.getRow(i); | |
| 138 | + for (int j = 0; j < cells.length; j++) { | |
| 139 | + writableSheet.addCell(new Label(j, i, cells[j].getContents())); | |
| 140 | + } | |
| 141 | + } | |
| 142 | + writableWorkbook.write(); | |
| 143 | + writableWorkbook.close(); | |
| 144 | + | |
| 145 | + return fileCal; | |
| 146 | + | |
| 147 | + } catch (Exception exp) { | |
| 148 | + throw new ScheduleException(exp); | |
| 149 | + } | |
| 150 | + | |
| 122 | 151 | } |
| 123 | 152 | |
| 124 | 153 | @Override | ... | ... |
src/main/java/com/bsth/service/schedule/impl/GuideboardInfoServiceImpl.java
| ... | ... | @@ -3,13 +3,20 @@ package com.bsth.service.schedule.impl; |
| 3 | 3 | import com.bsth.entity.schedule.GuideboardInfo; |
| 4 | 4 | import com.bsth.entity.schedule.TTInfoDetail; |
| 5 | 5 | import com.bsth.service.schedule.GuideboardInfoService; |
| 6 | -import com.bsth.service.schedule.exception.ScheduleException; | |
| 7 | 6 | import com.bsth.service.schedule.TTInfoDetailService; |
| 7 | +import com.bsth.service.schedule.exception.ScheduleException; | |
| 8 | +import com.bsth.service.schedule.utils.DataToolsProperties; | |
| 9 | +import org.slf4j.Logger; | |
| 10 | +import org.slf4j.LoggerFactory; | |
| 8 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | +import org.springframework.boot.context.properties.EnableConfigurationProperties; | |
| 9 | 13 | import org.springframework.stereotype.Service; |
| 10 | 14 | import org.springframework.util.CollectionUtils; |
| 11 | 15 | |
| 12 | 16 | import javax.transaction.Transactional; |
| 17 | +import java.io.File; | |
| 18 | +import java.io.PrintWriter; | |
| 19 | +import java.io.StringWriter; | |
| 13 | 20 | import java.util.HashMap; |
| 14 | 21 | import java.util.List; |
| 15 | 22 | import java.util.Map; |
| ... | ... | @@ -17,8 +24,15 @@ import java.util.Map; |
| 17 | 24 | /** |
| 18 | 25 | * 路牌信息服务。 |
| 19 | 26 | */ |
| 27 | +@EnableConfigurationProperties(DataToolsProperties.class) | |
| 20 | 28 | @Service |
| 21 | 29 | public class GuideboardInfoServiceImpl extends BServiceImpl<GuideboardInfo, Long> implements GuideboardInfoService { |
| 30 | + /** 日志记录器 */ | |
| 31 | + private static final Logger LOGGER = LoggerFactory.getLogger(GuideboardInfoServiceImpl.class); | |
| 32 | + | |
| 33 | + @Autowired | |
| 34 | + private DataToolsProperties dataToolsProperties; | |
| 35 | + | |
| 22 | 36 | @Autowired |
| 23 | 37 | private TTInfoDetailService ttInfoDetailService; |
| 24 | 38 | |
| ... | ... | @@ -94,4 +108,62 @@ public class GuideboardInfoServiceImpl extends BServiceImpl<GuideboardInfo, Long |
| 94 | 108 | } |
| 95 | 109 | } |
| 96 | 110 | |
| 111 | + @Override | |
| 112 | + public void importData(File file, Map<String, Object> params) throws ScheduleException { | |
| 113 | + try { | |
| 114 | + LOGGER.info("//---------------- 导入路牌信息 start... ----------------//"); | |
| 115 | + // 创建ktr转换所需参数 | |
| 116 | + Map<String, Object> ktrParms = new HashMap<>(); | |
| 117 | + File ktrFile = new File(this.getClass().getResource( | |
| 118 | + dataToolsProperties.getGuideboardsDatainputktr()).toURI()); | |
| 119 | + | |
| 120 | + // 通用参数,转换文件路径,excel输入文件路径,错误输出文件路径 | |
| 121 | + ktrParms.put("transpath", ktrFile.getAbsolutePath()); | |
| 122 | + ktrParms.put("filepath", file.getAbsolutePath()); | |
| 123 | + ktrParms.put("erroroutputdir", dataToolsProperties.getTransErrordir()); | |
| 124 | + | |
| 125 | + super.importData(file, ktrParms); | |
| 126 | + | |
| 127 | + LOGGER.info("//---------------- 导入路牌信息 success... ----------------//"); | |
| 128 | + } catch (Exception exp) { | |
| 129 | + LOGGER.info("//---------------- 导入路牌信息 failed... ----------------//"); | |
| 130 | + | |
| 131 | + StringWriter sw = new StringWriter(); | |
| 132 | + exp.printStackTrace(new PrintWriter(sw)); | |
| 133 | + LOGGER.info(sw.toString()); | |
| 134 | + | |
| 135 | + throw new ScheduleException(exp.getMessage()); | |
| 136 | + } | |
| 137 | + } | |
| 138 | + | |
| 139 | + @Override | |
| 140 | + public File exportData(Map<String, Object> params) throws ScheduleException { | |
| 141 | + try { | |
| 142 | + LOGGER.info("//---------------- 导出路牌信息 start... ----------------//"); | |
| 143 | + // 创建ktr转换所需参数 | |
| 144 | + Map<String, Object> ktrParms = new HashMap<>(); | |
| 145 | + File ktrFile = new File(this.getClass().getResource( | |
| 146 | + dataToolsProperties.getGuideboardsDataoutputktr()).toURI()); | |
| 147 | + | |
| 148 | + // 通用参数,转换文件路径,excel输出文件名 | |
| 149 | + ktrParms.put("transpath", ktrFile.getAbsolutePath()); | |
| 150 | + ktrParms.put("filename", "路牌信息_download-"); | |
| 151 | + | |
| 152 | + File file = super.exportData(ktrParms); | |
| 153 | + | |
| 154 | + LOGGER.info("//---------------- 导出路牌信息 success... ----------------//"); | |
| 155 | + | |
| 156 | + return file; | |
| 157 | + | |
| 158 | + } catch (Exception exp) { | |
| 159 | + LOGGER.info("//---------------- 导出路牌信息 failed... ----------------//"); | |
| 160 | + | |
| 161 | + StringWriter sw = new StringWriter(); | |
| 162 | + exp.printStackTrace(new PrintWriter(sw)); | |
| 163 | + LOGGER.info(sw.toString()); | |
| 164 | + | |
| 165 | + throw new ScheduleException(exp.getMessage()); | |
| 166 | + } | |
| 167 | + } | |
| 168 | + | |
| 97 | 169 | } | ... | ... |
src/main/java/com/bsth/service/schedule/SchedulePlanServiceImpl.java renamed to src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| 1 | -package com.bsth.service.schedule; | |
| 1 | +package com.bsth.service.schedule.impl; | |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.Line; |
| 4 | 4 | import com.bsth.entity.schedule.*; |
| 5 | 5 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 6 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 6 | 7 | import com.bsth.repository.schedule.SchedulePlanInfoRepository; |
| 7 | 8 | import com.bsth.repository.schedule.SchedulePlanRepository; |
| 8 | -import com.bsth.service.impl.BaseServiceImpl; | |
| 9 | +import com.bsth.service.LineService; | |
| 10 | +import com.bsth.service.schedule.SchedulePlanService; | |
| 11 | +import com.bsth.service.schedule.TTInfoDetailService; | |
| 12 | +import com.bsth.service.schedule.TTInfoService; | |
| 9 | 13 | import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; |
| 10 | 14 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| 11 | 15 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; |
| 12 | 16 | import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; |
| 13 | 17 | import com.bsth.service.schedule.rules.strategy.IStrategy; |
| 18 | +import com.bsth.service.schedule.rules.ttinfo2.CalcuParam; | |
| 19 | +import com.bsth.service.schedule.rules.ttinfo2.Result; | |
| 14 | 20 | import com.google.common.collect.Multimap; |
| 15 | 21 | import org.apache.commons.lang3.StringUtils; |
| 16 | 22 | import org.joda.time.DateTime; |
| 17 | 23 | import org.kie.api.KieBase; |
| 18 | 24 | import org.kie.api.runtime.KieSession; |
| 25 | +import org.slf4j.Logger; | |
| 26 | +import org.slf4j.LoggerFactory; | |
| 19 | 27 | import org.springframework.beans.factory.annotation.Autowired; |
| 20 | 28 | import org.springframework.stereotype.Service; |
| 21 | 29 | import org.springframework.transaction.annotation.Isolation; |
| ... | ... | @@ -28,7 +36,7 @@ import java.util.*; |
| 28 | 36 | * Created by xu on 16/6/16. |
| 29 | 37 | */ |
| 30 | 38 | @Service |
| 31 | -public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> implements SchedulePlanService { | |
| 39 | +public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> implements SchedulePlanService { | |
| 32 | 40 | @Autowired |
| 33 | 41 | private KieBase kieBase; |
| 34 | 42 | @Autowired |
| ... | ... | @@ -37,10 +45,18 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> |
| 37 | 45 | private SchedulePlanRepository schedulePlanRepository; |
| 38 | 46 | @Autowired |
| 39 | 47 | private SchedulePlanInfoRepository schedulePlanInfoRepository; |
| 48 | + @Autowired | |
| 49 | + private LineService lineService; | |
| 50 | + @Autowired | |
| 51 | + private TTInfoService ttInfoService; | |
| 52 | + @Autowired | |
| 53 | + private TTInfoDetailService ttInfoDetailService; | |
| 54 | + | |
| 55 | + /** 日志记录器 */ | |
| 56 | + private Logger logger = LoggerFactory.getLogger(SchedulePlanServiceImpl.class); | |
| 40 | 57 | |
| 41 | 58 | @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) |
| 42 | - @Override | |
| 43 | - public Map<String, Object> save(SchedulePlan schedulePlan) { | |
| 59 | + public SchedulePlan save(SchedulePlan schedulePlan, CompanyAuthority companyAuthority) { | |
| 44 | 60 | // 1-1、查找线路具体信息 |
| 45 | 61 | Line xl = strategy.getLine(schedulePlan.getXl().getId()); |
| 46 | 62 | // 1-2、查出指定线路的所有规则 |
| ... | ... | @@ -106,18 +122,41 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> |
| 106 | 122 | employeeConfigInfoList.add(employeeConfigMaps.get(Long.valueOf(eid))); |
| 107 | 123 | } |
| 108 | 124 | // 排班明细(这个要迭代的) |
| 109 | - Collection<TTInfoDetail> ttInfoDetails = gbdTTinfoMaps.get(scheduleResult_output.getSd().toDate()).get( | |
| 125 | + Collection<TTInfoDetail> ttInfoDetails_ = gbdTTinfoMaps.get(scheduleResult_output.getSd().toDate()).get( | |
| 110 | 126 | Long.parseLong(scheduleResult_output.getGuideboardId())); |
| 127 | + List<TTInfoDetail> ttInfoDetails = new ArrayList<>(ttInfoDetails_); | |
| 128 | + | |
| 129 | + // 排序ttInfoDetails | |
| 130 | + Collections.sort(ttInfoDetails, new Comparator<TTInfoDetail>() { | |
| 131 | + @Override | |
| 132 | + public int compare(TTInfoDetail o1, TTInfoDetail o2) { | |
| 133 | + return o1.getFcno().compareTo(o2.getFcno()); | |
| 134 | + } | |
| 135 | + }); | |
| 136 | + | |
| 137 | + Boolean isFb = false; // 是否分班 | |
| 111 | 138 | for (TTInfoDetail ttInfoDetail : ttInfoDetails) { |
| 139 | + if (ttInfoDetail.getIsFB()) | |
| 140 | + isFb = ttInfoDetail.getIsFB(); | |
| 141 | + | |
| 112 | 142 | SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo( |
| 113 | 143 | xl, |
| 114 | 144 | scheduleResult_output, |
| 115 | 145 | ttInfoDetail, |
| 146 | + isFb, | |
| 116 | 147 | configInfo, |
| 117 | 148 | employeeConfigInfoList, |
| 118 | 149 | schedulePlan); |
| 150 | + | |
| 151 | + // 公司,分公司编码 | |
| 152 | + schedulePlanInfo.setGsBm(companyAuthority.getCompanyCode()); | |
| 153 | + schedulePlanInfo.setGsName(companyAuthority.getCompanyName()); | |
| 154 | + schedulePlanInfo.setFgsBm(companyAuthority.getSubCompanyCode()); | |
| 155 | + schedulePlanInfo.setFgsName(companyAuthority.getSubCompanyName()); | |
| 156 | + | |
| 119 | 157 | schedulePlanInfos.add(schedulePlanInfo); |
| 120 | 158 | ttInfoMap.put(ttInfoDetail.getTtinfo().getId(), ttInfoDetail.getTtinfo().getName()); |
| 159 | + | |
| 121 | 160 | } |
| 122 | 161 | } |
| 123 | 162 | |
| ... | ... | @@ -126,7 +165,9 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> |
| 126 | 165 | |
| 127 | 166 | // 3-2、保存生成的排班和明细 |
| 128 | 167 | schedulePlan.getSchedulePlanInfoList().addAll(schedulePlanInfos); // 关联的排班明细信息 |
| 129 | - return super.save(schedulePlan); | |
| 168 | + super.save(schedulePlan); | |
| 169 | + | |
| 170 | + return new SchedulePlan(); | |
| 130 | 171 | } |
| 131 | 172 | |
| 132 | 173 | @Override |
| ... | ... | @@ -142,4 +183,36 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> |
| 142 | 183 | } |
| 143 | 184 | return null; |
| 144 | 185 | } |
| 186 | + | |
| 187 | + @Override | |
| 188 | + public Result validateTTInfo(Integer xlid, Date from, Date to) { | |
| 189 | + // 构造drools session->载入数据->启动规则->计算->销毁session | |
| 190 | + // 创建session,内部配置的是stateful | |
| 191 | + KieSession session = kieBase.newKieSession(); | |
| 192 | + // 设置gloable对象,在drl中通过别名使用 | |
| 193 | + session.setGlobal("log", logger); | |
| 194 | + session.setGlobal("lineService", lineService); | |
| 195 | + session.setGlobal("ttInfoDetailService", ttInfoDetailService); | |
| 196 | + | |
| 197 | + Result rs = new Result(); // 输出gloable对象 | |
| 198 | + session.setGlobal("rs", rs); | |
| 199 | + | |
| 200 | + // 载入数据 | |
| 201 | + CalcuParam calcuParam = new CalcuParam( | |
| 202 | + new DateTime(from), new DateTime(to), xlid); | |
| 203 | + session.insert(calcuParam); | |
| 204 | + List<TTInfo> ttInfos = ttInfoService.findAll(); | |
| 205 | + for (TTInfo ttInfo: ttInfos) | |
| 206 | + session.insert(ttInfo); | |
| 207 | + | |
| 208 | + | |
| 209 | + // 执行rule | |
| 210 | + session.fireAllRules(); | |
| 211 | + | |
| 212 | + // 执行完毕销毁,有日志的也要关闭 | |
| 213 | + session.dispose(); | |
| 214 | + | |
| 215 | + | |
| 216 | + return rs; | |
| 217 | + } | |
| 145 | 218 | } | ... | ... |
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
| 1 | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSONArray; | |
| 4 | +import com.alibaba.fastjson.JSONObject; | |
| 5 | +import com.bsth.common.ResponseCode; | |
| 3 | 6 | import com.bsth.entity.CarPark; |
| 7 | +import com.bsth.entity.Line; | |
| 4 | 8 | import com.bsth.entity.LineInformation; |
| 5 | 9 | import com.bsth.entity.StationRoute; |
| 6 | 10 | import com.bsth.entity.schedule.GuideboardInfo; |
| 7 | 11 | import com.bsth.entity.schedule.TTInfoDetail; |
| 12 | +import com.bsth.repository.CarParkRepository; | |
| 13 | +import com.bsth.repository.LineRepository; | |
| 14 | +import com.bsth.repository.StationRepository; | |
| 15 | +import com.bsth.repository.schedule.GuideboardInfoRepository; | |
| 8 | 16 | import com.bsth.repository.schedule.TTInfoDetailRepository; |
| 17 | +import com.bsth.repository.schedule.TTInfoRepository; | |
| 9 | 18 | import com.bsth.service.CarParkService; |
| 10 | 19 | import com.bsth.service.LineInformationService; |
| 11 | 20 | import com.bsth.service.StationRouteService; |
| ... | ... | @@ -13,6 +22,7 @@ import com.bsth.service.schedule.GuideboardInfoService; |
| 13 | 22 | import com.bsth.service.schedule.TTInfoDetailService; |
| 14 | 23 | import com.bsth.service.schedule.exception.ScheduleException; |
| 15 | 24 | import com.bsth.service.schedule.utils.DataToolsProperties; |
| 25 | +import com.bsth.service.schedule.utils.DataToolsService; | |
| 16 | 26 | import jxl.Cell; |
| 17 | 27 | import jxl.Sheet; |
| 18 | 28 | import jxl.Workbook; |
| ... | ... | @@ -24,6 +34,7 @@ import org.joda.time.DateTime; |
| 24 | 34 | import org.slf4j.Logger; |
| 25 | 35 | import org.slf4j.LoggerFactory; |
| 26 | 36 | import org.springframework.beans.factory.annotation.Autowired; |
| 37 | +import org.springframework.beans.factory.annotation.Qualifier; | |
| 27 | 38 | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| 28 | 39 | import org.springframework.stereotype.Service; |
| 29 | 40 | import org.springframework.util.CollectionUtils; |
| ... | ... | @@ -56,6 +67,19 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 56 | 67 | private TTInfoDetailRepository ttInfoDetailRepository; |
| 57 | 68 | @Autowired |
| 58 | 69 | private DataToolsProperties dataToolsProperties; |
| 70 | + @Autowired | |
| 71 | + private LineRepository lineRepository; | |
| 72 | + @Autowired | |
| 73 | + private TTInfoRepository infoRepository; | |
| 74 | + @Autowired | |
| 75 | + private StationRepository staRepository; | |
| 76 | + @Autowired | |
| 77 | + private CarParkRepository carParkRepository; | |
| 78 | + @Autowired | |
| 79 | + private GuideboardInfoRepository guideboardInfoRepository; | |
| 80 | + @Autowired | |
| 81 | + @Qualifier(value = "dataToolsServiceImpl") | |
| 82 | + private DataToolsService dataToolsService; | |
| 59 | 83 | |
| 60 | 84 | @Override |
| 61 | 85 | public TTInfoDetail findById(Long aLong) { |
| ... | ... | @@ -63,6 +87,12 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 63 | 87 | } |
| 64 | 88 | |
| 65 | 89 | @Override |
| 90 | + public File uploadFile(String filename, byte[] filedata) throws ScheduleException { | |
| 91 | + | |
| 92 | + return dataToolsService.uploadFile(filename, filedata); | |
| 93 | + } | |
| 94 | + | |
| 95 | + @Override | |
| 66 | 96 | public void importData( |
| 67 | 97 | File file, |
| 68 | 98 | Map<String, Object> params) throws ScheduleException { |
| ... | ... | @@ -417,20 +447,23 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 417 | 447 | } |
| 418 | 448 | |
| 419 | 449 | // 班次时间验证,正则表达式,格式hh:mm或者hhmm |
| 420 | - String el = "^(([0-1]\\d)|(2[0-4])):[0-5]\\d$"; // hh:mm格式 | |
| 421 | - String el2 = "^(([0-1]\\d)|(2[0-4]))[0-5]\\d$"; // hhmm格式 | |
| 422 | - Pattern p = Pattern.compile(el); | |
| 423 | - Pattern p2 = Pattern.compile(el2); | |
| 450 | + String rex1 = "^([01]?[0-9]|2[0-3]):[0-5][0-9]$"; // hh:mm格式 | |
| 451 | + String rex2 = "^([01]?[0-9]|2[0-3]),[0-5][0-9]$"; // hh,mm格式 | |
| 452 | + String rex3 = "^([01]?[0-9]|2[0-3])[0-5][0-9]$"; // hhmm格式 | |
| 453 | + Pattern p1 = Pattern.compile(rex1); | |
| 454 | + Pattern p2 = Pattern.compile(rex2); | |
| 455 | + Pattern p3 = Pattern.compile(rex3); | |
| 424 | 456 | |
| 425 | 457 | for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据 |
| 426 | 458 | Cell[] bcells = sheet.getRow(i); |
| 427 | 459 | for (int j = 1; j < bcells.length; j++) { // 从第2列开始 |
| 428 | 460 | String bcell_con = bcells[j].getContents(); |
| 429 | 461 | if (StringUtils.isNotEmpty(bcell_con)) { |
| 430 | - Matcher m = p.matcher(bcell_con.trim()); | |
| 462 | + Matcher m1 = p1.matcher(bcell_con.trim()); | |
| 431 | 463 | Matcher m2 = p2.matcher(bcell_con.trim()); |
| 432 | - if ((!m.matches()) && (!m2.matches())) { | |
| 433 | - throw new Exception(String.format("第%d行,第%d列的发车时间格式不正确,格式应为hh:mm或hhmm", i + 1, j + 1)); | |
| 464 | + Matcher m3 = p3.matcher(bcell_con.trim()); | |
| 465 | + if ((!m1.matches()) && (!m2.matches()) && (!m3.matches())) { | |
| 466 | + throw new Exception(String.format("第%d行,第%d列的发车时间格式不正确,格式应为hh:mm或hh,mm或hhmm", i + 1, j + 1)); | |
| 434 | 467 | } |
| 435 | 468 | } |
| 436 | 469 | } |
| ... | ... | @@ -497,4 +530,84 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 497 | 530 | public List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId) { |
| 498 | 531 | return ttInfoDetailRepository.findBcdetails(xlId, ttinfoId, lpId); |
| 499 | 532 | } |
| 533 | + | |
| 534 | + @Override | |
| 535 | + public Map<String, Object> skbDetailMxSave(Map<String, Object> map) { | |
| 536 | + Map<String, Object> rs_m = new HashMap<String,Object>(); | |
| 537 | + try { | |
| 538 | + String d = map.get("d") == null ? null : map.get("d").toString(); | |
| 539 | + if(d!=null) | |
| 540 | + ttInfoDetailRepository.save(jsonArrayToListEntity(d)); | |
| 541 | + } catch (Exception e) { | |
| 542 | + e.printStackTrace(); | |
| 543 | + rs_m.put("status", ResponseCode.ERROR); | |
| 544 | + } | |
| 545 | + rs_m.put("status", ResponseCode.SUCCESS); | |
| 546 | + return rs_m; | |
| 547 | + } | |
| 548 | + | |
| 549 | + public List<TTInfoDetail> jsonArrayToListEntity(String jsonStr) throws Exception { | |
| 550 | + List<TTInfoDetail> listTd = new ArrayList<TTInfoDetail>(); | |
| 551 | + JSONArray jsonArray = JSONArray.parseArray(jsonStr); | |
| 552 | + for(int i =0; i<jsonArray.size();i++) { | |
| 553 | + JSONObject jsonObj = jsonArray.getJSONObject(i); | |
| 554 | + if(jsonObj.getString("bcType").equals("bd") || jsonObj.getString("bcType").equals("lc") || jsonObj.getString("bcType").equals("cf")) | |
| 555 | + continue; | |
| 556 | + listTd.add(objToEntity(jsonObj)); | |
| 557 | + } | |
| 558 | + return listTd; | |
| 559 | + } | |
| 560 | + | |
| 561 | + public TTInfoDetail objToEntity(JSONObject obj) throws Exception { | |
| 562 | + TTInfoDetail td = new TTInfoDetail(); | |
| 563 | + Line xl = lineRepository.findOne(Integer.parseInt(obj.getString("xl"))); | |
| 564 | + td.setXl(xl); | |
| 565 | + td.setTtinfo(obj.getString("ttinfo") == null ? null : infoRepository.findOne(Long.parseLong(obj.getString("ttinfo")))); | |
| 566 | + td.setLp(getLp(xl,obj.getString("lp"),Integer.parseInt(obj.getString("lp")),obj.getString("lpType"))); | |
| 567 | + td.setFcno(Integer.parseInt(obj.getString("fcno"))); | |
| 568 | + td.setXlDir(dirToCod(obj.get("xlDir").toString())); | |
| 569 | + td.setQdz( obj.getString("qdz") ==null? null : staRepository.findOne(Integer.parseInt(obj.getString("qdz")))); | |
| 570 | + td.setZdz(obj.getString("zdz") ==null ? null :staRepository.findOne(Integer.parseInt(obj.getString("zdz")))); | |
| 571 | + td.setTcc(carParkRepository.findOne(Integer.parseInt(obj.getString("tcc")))); | |
| 572 | + td.setFcsj(obj.getString("fcsj")); | |
| 573 | + td.setBcs(Integer.parseInt(obj.getString("bcs"))); | |
| 574 | + td.setJhlc(Double.parseDouble(obj.getString("jhlc"))); | |
| 575 | + td.setBcsj(Integer.parseInt(obj.getString("bcsj"))); | |
| 576 | + td.setBcType(obj.getString("bcType")); | |
| 577 | + td.setIsFB(false); | |
| 578 | + td.setIsSwitchXl(false); | |
| 579 | + td.setSwitchXl(null); | |
| 580 | + td.setSwitchXlDesc(null); | |
| 581 | + td.setRemark(null); | |
| 582 | + td.setCreateBy(null); | |
| 583 | + td.setUpdateBy(null); | |
| 584 | + return td; | |
| 585 | + } | |
| 586 | + | |
| 587 | + public GuideboardInfo getLp(Line xl,String name, int code, String lpType) throws Exception { | |
| 588 | + GuideboardInfo entity = new GuideboardInfo(); | |
| 589 | + List<GuideboardInfo> lgi = guideboardInfoRepository.validateLp(xl, name, code,lpType); | |
| 590 | + if(lgi.size()>0) { | |
| 591 | + entity = lgi.get(0); | |
| 592 | + }else{ | |
| 593 | + entity.setXl(xl); | |
| 594 | + entity.setLpNo(code); | |
| 595 | + entity.setLpName(name); | |
| 596 | + entity.setLpType(lpType); | |
| 597 | + entity.setIsCancel(false); | |
| 598 | + entity.setCreateBy(null); | |
| 599 | + entity.setUpdateBy(null); | |
| 600 | + guideboardInfoRepository.save(entity); | |
| 601 | + } | |
| 602 | + return entity; | |
| 603 | + } | |
| 604 | + | |
| 605 | + public String dirToCod(String str) throws Exception { | |
| 606 | + String c = ""; | |
| 607 | + if(str.equals("relationshipGraph-up")) | |
| 608 | + c = "0"; | |
| 609 | + else if(str.equals("relationshipGraph-down")) | |
| 610 | + c = "1"; | |
| 611 | + return c; | |
| 612 | + } | |
| 500 | 613 | } | ... | ... |
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
| ... | ... | @@ -52,6 +52,9 @@ public class MyDroolsConfiguration { |
| 52 | 52 | // 3.2、写入drl(写法超多,有点混乱) |
| 53 | 53 | // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入 |
| 54 | 54 | // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的 |
| 55 | + kfs.write("src/main/resources/functions.drl", kieServices.getResources() | |
| 56 | + .newInputStreamResource(this.getClass().getResourceAsStream( | |
| 57 | + "/rules/functions.drl"), "UTF-8")); | |
| 55 | 58 | kfs.write("src/main/resources/HelloWorld.drl", kieServices.getResources() |
| 56 | 59 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 57 | 60 | "/rules/HelloWorld.drl"), "UTF-8")); |
| ... | ... | @@ -61,6 +64,9 @@ public class MyDroolsConfiguration { |
| 61 | 64 | kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources() |
| 62 | 65 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 63 | 66 | "/rules/ttinfo.drl"), "UTF-8")); |
| 67 | + kfs.write("src/main/resources/ttinfo2.drl", kieServices.getResources() | |
| 68 | + .newInputStreamResource(this.getClass().getResourceAsStream( | |
| 69 | + "/rules/ttinfo2.drl"), "UTF-8")); | |
| 64 | 70 | // TODO:还有其他drl.... |
| 65 | 71 | |
| 66 | 72 | // 4、创建KieBuilder,使用KieFileSystem构建 | ... | ... |
src/main/java/com/bsth/service/schedule/rules/ttinfo2/CalcuParam.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.ttinfo2; | |
| 2 | + | |
| 3 | +import org.joda.time.DateTime; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 时刻表计算参数。 | |
| 7 | + */ | |
| 8 | +public class CalcuParam { | |
| 9 | + /** 开始计算时间 */ | |
| 10 | + private DateTime fromDate; | |
| 11 | + /** 结束计算时间 */ | |
| 12 | + private DateTime toDate; | |
| 13 | + /** 线路id */ | |
| 14 | + private Integer xlId; | |
| 15 | + | |
| 16 | + public CalcuParam() {} | |
| 17 | + public CalcuParam( | |
| 18 | + DateTime fromDate, | |
| 19 | + DateTime toDate, | |
| 20 | + Integer xlId) { | |
| 21 | + this.fromDate = fromDate; | |
| 22 | + this.toDate = toDate; | |
| 23 | + this.xlId = xlId; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public DateTime getFromDate() { | |
| 27 | + return fromDate; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public void setFromDate(DateTime fromDate) { | |
| 31 | + this.fromDate = fromDate; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public DateTime getToDate() { | |
| 35 | + return toDate; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public void setToDate(DateTime toDate) { | |
| 39 | + this.toDate = toDate; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public Integer getXlId() { | |
| 43 | + return xlId; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public void setXlId(Integer xlId) { | |
| 47 | + this.xlId = xlId; | |
| 48 | + } | |
| 49 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/rules/ttinfo2/ErrorBcCountFunction.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.ttinfo2; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.TTInfoDetail; | |
| 4 | +import org.kie.api.runtime.rule.AccumulateFunction; | |
| 5 | + | |
| 6 | +import java.io.*; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Created by xu on 17/2/28. | |
| 10 | + */ | |
| 11 | +public class ErrorBcCountFunction implements AccumulateFunction { | |
| 12 | + @Override | |
| 13 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 14 | + } | |
| 15 | + | |
| 16 | + @Override | |
| 17 | + public void writeExternal(ObjectOutput out) throws IOException { | |
| 18 | + } | |
| 19 | + | |
| 20 | + protected static class ErrorCountData implements Externalizable { | |
| 21 | + public long errorcount = 0; | |
| 22 | + public TTInfoDetail ttInfoDetail; | |
| 23 | + | |
| 24 | + public ErrorCountData() { | |
| 25 | + } | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 29 | + errorcount = in.readLong(); | |
| 30 | + ttInfoDetail = (TTInfoDetail) in.readObject(); | |
| 31 | + } | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public void writeExternal(ObjectOutput out) throws IOException { | |
| 35 | + out.writeLong(errorcount); | |
| 36 | + out.writeObject(ttInfoDetail); | |
| 37 | + } | |
| 38 | + } | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + public Serializable createContext() { | |
| 42 | + return new ErrorCountData(); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public void init(Serializable context) throws Exception { | |
| 47 | + ErrorCountData errorCountData = (ErrorCountData) context; | |
| 48 | + errorCountData.errorcount = 0; | |
| 49 | + } | |
| 50 | + | |
| 51 | + @Override | |
| 52 | + public void accumulate(Serializable context, Object value) { | |
| 53 | + ErrorCountData errorCountData = (ErrorCountData) context; | |
| 54 | + TTInfoDetail ttInfoDetail = (TTInfoDetail) value; | |
| 55 | + | |
| 56 | + if (ttInfoDetail.getTtinfo() == null) { | |
| 57 | + errorCountData.errorcount ++; | |
| 58 | + return; | |
| 59 | + } | |
| 60 | + | |
| 61 | + if ("in".equals(ttInfoDetail.getBcType())) { | |
| 62 | + if (ttInfoDetail.getQdz() == null || ttInfoDetail.getTcc() == null) { | |
| 63 | + errorCountData.errorcount ++; | |
| 64 | + } | |
| 65 | + } else if ("out".equals(ttInfoDetail.getBcType())) { | |
| 66 | + if (ttInfoDetail.getTcc() == null || ttInfoDetail.getZdz() == null) { | |
| 67 | + errorCountData.errorcount ++; | |
| 68 | + } | |
| 69 | + } else { | |
| 70 | + if (ttInfoDetail.getQdz() == null || ttInfoDetail.getZdz() == null) { | |
| 71 | + errorCountData.errorcount ++; | |
| 72 | + } | |
| 73 | + } | |
| 74 | + } | |
| 75 | + | |
| 76 | + @Override | |
| 77 | + public void reverse(Serializable context, Object value) throws Exception { | |
| 78 | + ErrorCountData errorCountData = (ErrorCountData) context; | |
| 79 | + TTInfoDetail ttInfoDetail = (TTInfoDetail) value; | |
| 80 | + | |
| 81 | + if (ttInfoDetail.getTtinfo() == null) { | |
| 82 | + errorCountData.errorcount --; | |
| 83 | + return; | |
| 84 | + } | |
| 85 | + | |
| 86 | + if ("in".equals(ttInfoDetail.getBcType())) { | |
| 87 | + if (ttInfoDetail.getQdz() == null || ttInfoDetail.getTcc() == null) { | |
| 88 | + errorCountData.errorcount --; | |
| 89 | + } | |
| 90 | + } else if ("out".equals(ttInfoDetail.getBcType())) { | |
| 91 | + if (ttInfoDetail.getTcc() == null || ttInfoDetail.getZdz() == null) { | |
| 92 | + errorCountData.errorcount --; | |
| 93 | + } | |
| 94 | + } else { | |
| 95 | + if (ttInfoDetail.getQdz() == null || ttInfoDetail.getZdz() == null) { | |
| 96 | + errorCountData.errorcount --; | |
| 97 | + } | |
| 98 | + } | |
| 99 | + | |
| 100 | + } | |
| 101 | + | |
| 102 | + @Override | |
| 103 | + public Object getResult(Serializable context) throws Exception { | |
| 104 | + ErrorCountData errorCountData = (ErrorCountData) context; | |
| 105 | + return errorCountData.errorcount; | |
| 106 | + } | |
| 107 | + | |
| 108 | + @Override | |
| 109 | + public boolean supportsReverse() { | |
| 110 | + return true; | |
| 111 | + } | |
| 112 | + | |
| 113 | + @Override | |
| 114 | + public Class<?> getResultType() { | |
| 115 | + return Number.class; | |
| 116 | + } | |
| 117 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/rules/ttinfo2/Result.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.ttinfo2; | |
| 2 | + | |
| 3 | +import java.util.ArrayList; | |
| 4 | +import java.util.List; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 输出结果值。 | |
| 8 | + */ | |
| 9 | +public class Result { | |
| 10 | + private List<StatInfo> infos = new ArrayList<>(); | |
| 11 | + | |
| 12 | + public List<StatInfo> getInfos() { | |
| 13 | + return infos; | |
| 14 | + } | |
| 15 | + | |
| 16 | + public void setInfos(List<StatInfo> infos) { | |
| 17 | + this.infos = infos; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public static class StatInfo { | |
| 21 | + /** 时刻表id */ | |
| 22 | + private Long ttid; | |
| 23 | + /** 时刻表名字 */ | |
| 24 | + private String ttname; | |
| 25 | + | |
| 26 | + /** 所有班次数 */ | |
| 27 | + private Long allbc; | |
| 28 | + /** 进场班次数 */ | |
| 29 | + private Long inbc; | |
| 30 | + /** 出场班次数 */ | |
| 31 | + private Long outbc; | |
| 32 | + /** 营运班次数 */ | |
| 33 | + private Long yybc; | |
| 34 | + | |
| 35 | + /** 错误班次数 */ | |
| 36 | + private Long errorbc; | |
| 37 | + | |
| 38 | + public Long getTtid() { | |
| 39 | + return ttid; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setTtid(Long ttid) { | |
| 43 | + this.ttid = ttid; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public String getTtname() { | |
| 47 | + return ttname; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setTtname(String ttname) { | |
| 51 | + this.ttname = ttname; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public Long getAllbc() { | |
| 55 | + return allbc; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setAllbc(Long allbc) { | |
| 59 | + this.allbc = allbc; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public Long getInbc() { | |
| 63 | + return inbc; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setInbc(Long inbc) { | |
| 67 | + this.inbc = inbc; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public Long getOutbc() { | |
| 71 | + return outbc; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setOutbc(Long outbc) { | |
| 75 | + this.outbc = outbc; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public Long getYybc() { | |
| 79 | + return yybc; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void setYybc(Long yybc) { | |
| 83 | + this.yybc = yybc; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public Long getErrorbc() { | |
| 87 | + return errorbc; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void setErrorbc(Long errorbc) { | |
| 91 | + this.errorbc = errorbc; | |
| 92 | + } | |
| 93 | + } | |
| 94 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/utils/DataImportExportServiceImpl.java
| ... | ... | @@ -170,4 +170,175 @@ public class DataImportExportServiceImpl implements DataImportExportService, Ini |
| 170 | 170 | |
| 171 | 171 | return new File(filepath); |
| 172 | 172 | } |
| 173 | + | |
| 174 | + | |
| 175 | + // TODO:以后改成下面的样子 | |
| 176 | +// import java.io.FileInputStream; | |
| 177 | +// import java.io.FileOutputStream; | |
| 178 | +// import java.io.IOException; | |
| 179 | +// import java.io.InputStream; | |
| 180 | +// import java.util.Iterator; | |
| 181 | +// | |
| 182 | +// import org.apache.poi.hssf.usermodel.HSSFCell; | |
| 183 | +// import org.apache.poi.hssf.usermodel.HSSFRow; | |
| 184 | +// import org.apache.poi.hssf.usermodel.HSSFSheet; | |
| 185 | +// import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |
| 186 | +// | |
| 187 | +// import org.apache.poi.xssf.usermodel.XSSFCell; | |
| 188 | +// import org.apache.poi.xssf.usermodel.XSSFRow; | |
| 189 | +// import org.apache.poi.xssf.usermodel.XSSFSheet; | |
| 190 | +// import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |
| 191 | +// | |
| 192 | +// public class ReadWriteExcelFile { | |
| 193 | +// | |
| 194 | +// public static void readXLSFile() throws IOException | |
| 195 | +// { | |
| 196 | +// InputStream ExcelFileToRead = new FileInputStream("C:/Test.xls"); | |
| 197 | +// HSSFWorkbook wb = new HSSFWorkbook(ExcelFileToRead); | |
| 198 | +// | |
| 199 | +// HSSFSheet sheet=wb.getSheetAt(0); | |
| 200 | +// HSSFRow row; | |
| 201 | +// HSSFCell cell; | |
| 202 | +// | |
| 203 | +// Iterator rows = sheet.rowIterator(); | |
| 204 | +// | |
| 205 | +// while (rows.hasNext()) | |
| 206 | +// { | |
| 207 | +// row=(HSSFRow) rows.next(); | |
| 208 | +// Iterator cells = row.cellIterator(); | |
| 209 | +// | |
| 210 | +// while (cells.hasNext()) | |
| 211 | +// { | |
| 212 | +// cell=(HSSFCell) cells.next(); | |
| 213 | +// | |
| 214 | +// if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING) | |
| 215 | +// { | |
| 216 | +// System.out.print(cell.getStringCellValue()+" "); | |
| 217 | +// } | |
| 218 | +// else if(cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) | |
| 219 | +// { | |
| 220 | +// System.out.print(cell.getNumericCellValue()+" "); | |
| 221 | +// } | |
| 222 | +// else | |
| 223 | +// { | |
| 224 | +// //U Can Handel Boolean, Formula, Errors | |
| 225 | +// } | |
| 226 | +// } | |
| 227 | +// System.out.println(); | |
| 228 | +// } | |
| 229 | +// | |
| 230 | +// } | |
| 231 | +// | |
| 232 | +// public static void writeXLSFile() throws IOException { | |
| 233 | +// | |
| 234 | +// String excelFileName = "C:/Test.xls";//name of excel file | |
| 235 | +// | |
| 236 | +// String sheetName = "Sheet1";//name of sheet | |
| 237 | +// | |
| 238 | +// HSSFWorkbook wb = new HSSFWorkbook(); | |
| 239 | +// HSSFSheet sheet = wb.createSheet(sheetName) ; | |
| 240 | +// | |
| 241 | +// //iterating r number of rows | |
| 242 | +// for (int r=0;r < 5; r++ ) | |
| 243 | +// { | |
| 244 | +// HSSFRow row = sheet.createRow(r); | |
| 245 | +// | |
| 246 | +// //iterating c number of columns | |
| 247 | +// for (int c=0;c < 5; c++ ) | |
| 248 | +// { | |
| 249 | +// HSSFCell cell = row.createCell(c); | |
| 250 | +// | |
| 251 | +// cell.setCellValue("Cell "+r+" "+c); | |
| 252 | +// } | |
| 253 | +// } | |
| 254 | +// | |
| 255 | +// FileOutputStream fileOut = new FileOutputStream(excelFileName); | |
| 256 | +// | |
| 257 | +// //write this workbook to an Outputstream. | |
| 258 | +// wb.write(fileOut); | |
| 259 | +// fileOut.flush(); | |
| 260 | +// fileOut.close(); | |
| 261 | +// } | |
| 262 | +// | |
| 263 | +// public static void readXLSXFile() throws IOException | |
| 264 | +// { | |
| 265 | +// InputStream ExcelFileToRead = new FileInputStream("C:/Test.xlsx"); | |
| 266 | +// XSSFWorkbook wb = new XSSFWorkbook(ExcelFileToRead); | |
| 267 | +// | |
| 268 | +// XSSFWorkbook test = new XSSFWorkbook(); | |
| 269 | +// | |
| 270 | +// XSSFSheet sheet = wb.getSheetAt(0); | |
| 271 | +// XSSFRow row; | |
| 272 | +// XSSFCell cell; | |
| 273 | +// | |
| 274 | +// Iterator rows = sheet.rowIterator(); | |
| 275 | +// | |
| 276 | +// while (rows.hasNext()) | |
| 277 | +// { | |
| 278 | +// row=(XSSFRow) rows.next(); | |
| 279 | +// Iterator cells = row.cellIterator(); | |
| 280 | +// while (cells.hasNext()) | |
| 281 | +// { | |
| 282 | +// cell=(XSSFCell) cells.next(); | |
| 283 | +// | |
| 284 | +// if (cell.getCellType() == XSSFCell.CELL_TYPE_STRING) | |
| 285 | +// { | |
| 286 | +// System.out.print(cell.getStringCellValue()+" "); | |
| 287 | +// } | |
| 288 | +// else if(cell.getCellType() == XSSFCell.CELL_TYPE_NUMERIC) | |
| 289 | +// { | |
| 290 | +// System.out.print(cell.getNumericCellValue()+" "); | |
| 291 | +// } | |
| 292 | +// else | |
| 293 | +// { | |
| 294 | +// //U Can Handel Boolean, Formula, Errors | |
| 295 | +// } | |
| 296 | +// } | |
| 297 | +// System.out.println(); | |
| 298 | +// } | |
| 299 | +// | |
| 300 | +// } | |
| 301 | +// | |
| 302 | +// public static void writeXLSXFile() throws IOException { | |
| 303 | +// | |
| 304 | +// String excelFileName = "C:/Test.xlsx";//name of excel file | |
| 305 | +// | |
| 306 | +// String sheetName = "Sheet1";//name of sheet | |
| 307 | +// | |
| 308 | +// XSSFWorkbook wb = new XSSFWorkbook(); | |
| 309 | +// XSSFSheet sheet = wb.createSheet(sheetName) ; | |
| 310 | +// | |
| 311 | +// //iterating r number of rows | |
| 312 | +// for (int r=0;r < 5; r++ ) | |
| 313 | +// { | |
| 314 | +// XSSFRow row = sheet.createRow(r); | |
| 315 | +// | |
| 316 | +// //iterating c number of columns | |
| 317 | +// for (int c=0;c < 5; c++ ) | |
| 318 | +// { | |
| 319 | +// XSSFCell cell = row.createCell(c); | |
| 320 | +// | |
| 321 | +// cell.setCellValue("Cell "+r+" "+c); | |
| 322 | +// } | |
| 323 | +// } | |
| 324 | +// | |
| 325 | +// FileOutputStream fileOut = new FileOutputStream(excelFileName); | |
| 326 | +// | |
| 327 | +// //write this workbook to an Outputstream. | |
| 328 | +// wb.write(fileOut); | |
| 329 | +// fileOut.flush(); | |
| 330 | +// fileOut.close(); | |
| 331 | +// } | |
| 332 | +// | |
| 333 | +// public static void main(String[] args) throws IOException { | |
| 334 | +// | |
| 335 | +// writeXLSFile(); | |
| 336 | +// readXLSFile(); | |
| 337 | +// | |
| 338 | +// writeXLSXFile(); | |
| 339 | +// readXLSXFile(); | |
| 340 | +// | |
| 341 | +// } | |
| 342 | +// | |
| 343 | +// } | |
| 173 | 344 | } | ... | ... |
src/main/java/com/bsth/service/schedule/utils/DataToolsProperties.java
| ... | ... | @@ -99,6 +99,9 @@ public class DataToolsProperties { |
| 99 | 99 | @NotNull |
| 100 | 100 | /** 人员配置信息导出ktr转换 */ |
| 101 | 101 | private String employeesconfigDataoutputktr; |
| 102 | + @NotNull | |
| 103 | + /** 路牌信息导出 */ | |
| 104 | + private String guideboardsDataoutputktr; | |
| 102 | 105 | |
| 103 | 106 | // TODO: |
| 104 | 107 | |
| ... | ... | @@ -309,4 +312,12 @@ public class DataToolsProperties { |
| 309 | 312 | public void setEmployeesconfigDataoutputktr(String employeesconfigDataoutputktr) { |
| 310 | 313 | this.employeesconfigDataoutputktr = employeesconfigDataoutputktr; |
| 311 | 314 | } |
| 315 | + | |
| 316 | + public String getGuideboardsDataoutputktr() { | |
| 317 | + return guideboardsDataoutputktr; | |
| 318 | + } | |
| 319 | + | |
| 320 | + public void setGuideboardsDataoutputktr(String guideboardsDataoutputktr) { | |
| 321 | + this.guideboardsDataoutputktr = guideboardsDataoutputktr; | |
| 322 | + } | |
| 312 | 323 | } | ... | ... |
src/main/java/com/bsth/service/sys/RealControAuthorityService.java
0 → 100644
| 1 | +package com.bsth.service.sys; | |
| 2 | + | |
| 3 | +import com.bsth.entity.sys.RealControAuthority; | |
| 4 | +import com.bsth.service.BaseService; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * Created by panzhao on 2017/2/14. | |
| 8 | + */ | |
| 9 | +public interface RealControAuthorityService extends BaseService<RealControAuthority, Integer> { | |
| 10 | + RealControAuthority findByUserId(Integer userId); | |
| 11 | +} | ... | ... |
src/main/java/com/bsth/service/sys/impl/RealControAuthorityServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.sys.impl; | |
| 2 | + | |
| 3 | +import com.bsth.entity.sys.RealControAuthority; | |
| 4 | +import com.bsth.repository.sys.RealControAuthorityRepository; | |
| 5 | +import com.bsth.service.impl.BaseServiceImpl; | |
| 6 | +import com.bsth.service.sys.RealControAuthorityService; | |
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 8 | +import org.springframework.stereotype.Service; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * Created by panzhao on 2017/2/14. | |
| 12 | + */ | |
| 13 | +@Service | |
| 14 | +public class RealControAuthorityServiceImpl extends BaseServiceImpl<RealControAuthority, Integer> implements RealControAuthorityService { | |
| 15 | + | |
| 16 | + @Autowired | |
| 17 | + RealControAuthorityRepository realControAuthorityRepository; | |
| 18 | + | |
| 19 | + @Override | |
| 20 | + public RealControAuthority findByUserId(Integer userId) { | |
| 21 | + return realControAuthorityRepository.findByUserId(userId); | |
| 22 | + } | |
| 23 | +} | ... | ... |
src/main/java/com/bsth/util/Geo/SHCJ2BDJW.java
| ... | ... | @@ -27,9 +27,11 @@ public class SHCJ2BDJW { |
| 27 | 27 | |
| 28 | 28 | /*String sqlSelect = "SELECT b.SHAPESTRING as SHAPE , b.id as ID FROM jjwgps_t_gjldb b where SHAPESTRING is not null order by b.ldbh asc ";*/ |
| 29 | 29 | /*String sqlSelect = "select s.id,s.descriptions from bsth_c_station s order by s.id asc ";*/ |
| 30 | - String sqlSelect = "SELECT s.id,s.descriptions FROM bsth_c_section s order by s.id asc "; | |
| 30 | + String sqlSelect = "select s.id,s.x,s.y from bsth_c_station s where id >=26882 order by s.id asc"; | |
| 31 | + /*String sqlSelect = "SELECT s.id,s.descriptions FROM bsth_c_section s order by s.id asc ";*/ | |
| 31 | 32 | |
| 32 | - String sqlUpdate = "UPDATE bsth_c_section SET csection_vector = ST_GeomFromText(?) , bsection_vector=ST_GeomFromText(?) , gsection_vector=ST_GeomFromText(?) where id = ?"; | |
| 33 | + /*String sqlUpdate = "UPDATE bsth_c_section SET csection_vector = ST_GeomFromText(?) , bsection_vector=ST_GeomFromText(?) , gsection_vector=ST_GeomFromText(?) where id = ?";*/ | |
| 34 | + String sqlUpdate = "UPDATE bsth_c_station SET b_jwpoints= ? , g_lonx=? , g_laty=? where id = ?"; | |
| 33 | 35 | |
| 34 | 36 | List<Map<String, Object>> list = new ArrayList<>(); |
| 35 | 37 | |
| ... | ... | @@ -44,8 +46,9 @@ public class SHCJ2BDJW { |
| 44 | 46 | |
| 45 | 47 | Map<String, Object> map = new HashMap<String, Object>(); |
| 46 | 48 | |
| 47 | - map.put("descriptions", rs.getString("descriptions")); | |
| 48 | - | |
| 49 | + /*map.put("descriptions", rs.getString("descriptions"));*/ | |
| 50 | + map.put("x", rs.getString("x")); | |
| 51 | + map.put("y", rs.getString("y")); | |
| 49 | 52 | map.put("id", rs.getInt("id")); |
| 50 | 53 | |
| 51 | 54 | list.add(map); |
| ... | ... | @@ -55,10 +58,21 @@ public class SHCJ2BDJW { |
| 55 | 58 | |
| 56 | 59 | Map<String, Object> temp = list.get(i); |
| 57 | 60 | // POINT (8229.30921617 -933.16425265) |
| 58 | - String lineString = temp.get("descriptions").toString(); | |
| 59 | - int id = Integer.parseInt(temp.get("id").toString()); | |
| 61 | + //String lineString = temp.get("descriptions").toString(); | |
| 62 | + | |
| 63 | + Double lng = Double.parseDouble(temp.get("x").toString()); | |
| 64 | + Double lat = Double.parseDouble(temp.get("y").toString()); | |
| 65 | + Map map_2 = JWDUtil.ConvertSHToJW(lng,lat); | |
| 60 | 66 | |
| 61 | - String arrayP[] = lineString.substring(lineString.indexOf("(")+1, lineString.length()-1).split(", "); | |
| 67 | + String b_jwpoints = ""; | |
| 68 | + Float g_lonx=0.0f,g_laty=0.0f; | |
| 69 | + int id = Integer.parseInt(temp.get("id").toString()); | |
| 70 | + g_lonx = Float.parseFloat(map_2.get("x").toString()); | |
| 71 | + g_laty = Float.parseFloat(map_2.get("y").toString()); | |
| 72 | + Location location = TransGPS.LocationMake(Float.parseFloat(map_2.get("x").toString()), Float.parseFloat(map_2.get("y").toString())); | |
| 73 | + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(location)); | |
| 74 | + b_jwpoints = (location.getLng()+0.000727) + " " + (location.getLat() - 0.0000624); | |
| 75 | + //String arrayP[] = lineString.substring(lineString.indexOf("(")+1, lineString.length()-1).split(", "); | |
| 62 | 76 | /*String arrayP[] = lineString.substring(lineString.indexOf("(")+1, lineString.length()-1).split(" "); |
| 63 | 77 | String b_jwpoints = ""; |
| 64 | 78 | Float g_lonx=0.0f,g_laty=0.0f,x=0.0f,y=0.0f;*/ |
| ... | ... | @@ -76,7 +90,7 @@ public class SHCJ2BDJW { |
| 76 | 90 | b_jwpoints = (location.getLng()+0.000727) + " " + (location.getLat() - 0.0000624);*/ |
| 77 | 91 | //b_jwpoints = (location.getLng()) + " " + (location.getLat()); |
| 78 | 92 | |
| 79 | - String csection_vector="",bsection_vector="",gsection_vector=""; | |
| 93 | + /* String csection_vector="",bsection_vector="",gsection_vector=""; | |
| 80 | 94 | |
| 81 | 95 | for(int k =0;k<arrayP.length;k++) { |
| 82 | 96 | |
| ... | ... | @@ -103,20 +117,20 @@ public class SHCJ2BDJW { |
| 103 | 117 | } |
| 104 | 118 | |
| 105 | 119 | |
| 106 | - } | |
| 120 | + }*/ | |
| 107 | 121 | |
| 108 | 122 | ps = null; |
| 109 | - bsection_vector = "LINESTRING(" + bsection_vector +")"; | |
| 110 | - csection_vector = "LINESTRING(" + csection_vector +")"; | |
| 111 | - gsection_vector = "LINESTRING(" + gsection_vector +")"; | |
| 123 | + //bsection_vector = "LINESTRING(" + bsection_vector +")"; | |
| 124 | + //csection_vector = "LINESTRING(" + csection_vector +")"; | |
| 125 | + //gsection_vector = "LINESTRING(" + gsection_vector +")"; | |
| 112 | 126 | |
| 113 | 127 | ps = conn.prepareStatement(sqlUpdate); |
| 114 | 128 | |
| 115 | 129 | // String sqlUpdate = "UPDATE bsth_c_section SET csection_vector = ? , bsection_vector=? , gsection_vector=? where id = ?"; |
| 116 | - ps.setString(1, csection_vector); | |
| 117 | - ps.setString(2, bsection_vector); | |
| 118 | - ps.setString(3, gsection_vector); | |
| 119 | - ps.setInt(4, id); | |
| 130 | + //ps.setString(1, csection_vector); | |
| 131 | + //ps.setString(2, bsection_vector); | |
| 132 | + //ps.setString(3, gsection_vector); | |
| 133 | + //ps.setInt(4, id); | |
| 120 | 134 | |
| 121 | 135 | //int stauts = ps.executeUpdate(); |
| 122 | 136 | // String sqlUpdate = "UPDATE bsth_c_station SET b_jwpoints = ?1 , g_lonx=?2 , g_laty=?3 , x = ?4 , y = ?5 where id = ?6"; |
| ... | ... | @@ -126,6 +140,11 @@ public class SHCJ2BDJW { |
| 126 | 140 | ps.setFloat(4, x); |
| 127 | 141 | ps.setFloat(5, y); |
| 128 | 142 | ps.setFloat(6, id);*/ |
| 143 | + | |
| 144 | + ps.setString(1, b_jwpoints); | |
| 145 | + ps.setFloat(2, g_lonx); | |
| 146 | + ps.setFloat(3, g_laty); | |
| 147 | + ps.setFloat(4, id); | |
| 129 | 148 | int stauts = ps.executeUpdate(); |
| 130 | 149 | System.out.println(stauts); |
| 131 | 150 | } | ... | ... |
src/main/java/com/bsth/websocket/handler/SendUtils.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.websocket.handler; |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.bsth.data.BasicData; |
| 5 | 5 | import com.bsth.data.LineConfigData; |
| 6 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 6 | 7 | import com.bsth.data.gpsdata.arrival.entity.SignalState; |
| 7 | 8 | import com.bsth.entity.directive.D80; |
| 8 | 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| ... | ... | @@ -170,4 +171,17 @@ public class SendUtils{ |
| 170 | 171 | list.add(sch); |
| 171 | 172 | refreshSch(list); |
| 172 | 173 | } |
| 174 | + | |
| 175 | + public void deviceOffline(GpsEntity gps){ | |
| 176 | + Map<String, Object> map = new HashMap<>(); | |
| 177 | + map.put("fn", "deviceOffline"); | |
| 178 | + map.put("gps", gps);; | |
| 179 | + ObjectMapper mapper = new ObjectMapper(); | |
| 180 | + | |
| 181 | + try { | |
| 182 | + socketHandler.sendMessageToLine(gps.getLineId().toString(), mapper.writeValueAsString(map)); | |
| 183 | + } catch (JsonProcessingException e) { | |
| 184 | + logger.error("", e); | |
| 185 | + } | |
| 186 | + } | |
| 173 | 187 | } | ... | ... |
src/main/resources/datatools/config-dev.properties
| ... | ... | @@ -65,6 +65,9 @@ datatools.carsconfig_dataoutputktr=/datatools/ktrs/carsConfigDataOutput.ktr |
| 65 | 65 | # 人员配置信息导出ktr转换 |
| 66 | 66 | datatools.employeesconfig_dataoutputktr=/datatools/ktrs/employeesConfigDataOutput.ktr |
| 67 | 67 | |
| 68 | +# 路牌信息导出 | |
| 69 | +datatools.guideboards_dataoutputktr=/datatools/ktrs/guideboardDataOutput.ktr | |
| 70 | + | |
| 68 | 71 | |
| 69 | 72 | # TODO: |
| 70 | 73 | ... | ... |
src/main/resources/datatools/config-prod.properties
| ... | ... | @@ -66,5 +66,8 @@ datatools.carsconfig_dataoutputktr=/datatools/ktrs/carsConfigDataOutput.ktr |
| 66 | 66 | # 人员配置信息导出ktr转换 |
| 67 | 67 | datatools.employeesconfig_dataoutputktr=/datatools/ktrs/employeesConfigDataOutput.ktr |
| 68 | 68 | |
| 69 | +# 路牌信息导出 | |
| 70 | +datatools.guideboards_dataoutputktr=/datatools/ktrs/guideboardDataOutput.ktr | |
| 71 | + | |
| 69 | 72 | |
| 70 | 73 | # TODO: |
| 71 | 74 | \ No newline at end of file | ... | ... |
src/main/resources/datatools/ktrs/carsConfigDataInput.ktr
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 | <transformation> |
| 3 | 3 | <info> |
| 4 | - <name>carsConfigDataInput</name> | |
| 4 | + <name>车辆配置信息导入</name> | |
| 5 | 5 | <description>车辆配置信息导入</description> |
| 6 | 6 | <extended_description>配车信息</extended_description> |
| 7 | 7 | <trans_version/> |
| ... | ... | @@ -469,40 +469,46 @@ |
| 469 | 469 | <condition>=</condition> |
| 470 | 470 | <name2/> |
| 471 | 471 | </key> |
| 472 | + <key> | |
| 473 | + <name>isCancel</name> | |
| 474 | + <field>is_cancel</field> | |
| 475 | + <condition>=</condition> | |
| 476 | + <name2/> | |
| 477 | + </key> | |
| 472 | 478 | <value> |
| 473 | 479 | <name>xl</name> |
| 474 | 480 | <rename>xlId</rename> |
| 475 | - <update>Y</update> | |
| 481 | + <update>N</update> | |
| 476 | 482 | </value> |
| 477 | 483 | <value> |
| 478 | 484 | <name>cl</name> |
| 479 | 485 | <rename>clId</rename> |
| 480 | - <update>Y</update> | |
| 486 | + <update>N</update> | |
| 481 | 487 | </value> |
| 482 | 488 | <value> |
| 483 | 489 | <name>is_switch</name> |
| 484 | 490 | <rename>isswitch</rename> |
| 485 | - <update>Y</update> | |
| 491 | + <update>N</update> | |
| 486 | 492 | </value> |
| 487 | 493 | <value> |
| 488 | 494 | <name>tcd</name> |
| 489 | 495 | <rename>停车点</rename> |
| 490 | - <update>Y</update> | |
| 496 | + <update>N</update> | |
| 491 | 497 | </value> |
| 492 | 498 | <value> |
| 493 | 499 | <name>zzrq</name> |
| 494 | 500 | <rename>终结日期</rename> |
| 495 | - <update>Y</update> | |
| 501 | + <update>N</update> | |
| 496 | 502 | </value> |
| 497 | 503 | <value> |
| 498 | 504 | <name>qyrq</name> |
| 499 | 505 | <rename>启用日期</rename> |
| 500 | - <update>Y</update> | |
| 506 | + <update>N</update> | |
| 501 | 507 | </value> |
| 502 | 508 | <value> |
| 503 | 509 | <name>is_cancel</name> |
| 504 | 510 | <rename>isCancel</rename> |
| 505 | - <update>Y</update> | |
| 511 | + <update>N</update> | |
| 506 | 512 | </value> |
| 507 | 513 | </lookup> |
| 508 | 514 | <cluster_schema/> | ... | ... |
src/main/resources/datatools/ktrs/carsConfigDataOutput.ktr
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 | <transformation> |
| 3 | 3 | <info> |
| 4 | - <name>carsConfigDataOutput</name> | |
| 4 | + <name>车辆配置信息导出</name> | |
| 5 | 5 | <description/> |
| 6 | 6 | <extended_description/> |
| 7 | 7 | <trans_version/> |
| ... | ... | @@ -271,8 +271,8 @@ |
| 271 | 271 | <hop> <from>字段选择</from><to>Excel输出</to><enabled>Y</enabled> </hop> |
| 272 | 272 | </order> |
| 273 | 273 | <step> |
| 274 | - <name>车辆配置(没有作废)</name> | |
| 275 | - <type>TableInput</type> | |
| 274 | + <name>Excel输出</name> | |
| 275 | + <type>ExcelOutput</type> | |
| 276 | 276 | <description/> |
| 277 | 277 | <distribute>Y</distribute> |
| 278 | 278 | <custom_distribution/> |
| ... | ... | @@ -281,24 +281,90 @@ |
| 281 | 281 | <method>none</method> |
| 282 | 282 | <schema_name/> |
| 283 | 283 | </partitioning> |
| 284 | - <connection>bus_control_variable</connection> | |
| 285 | - <sql>select * from bsth_c_s_ccinfo where is_cancel = 0</sql> | |
| 286 | - <limit>0</limit> | |
| 287 | - <lookup/> | |
| 288 | - <execute_each_row>N</execute_each_row> | |
| 289 | - <variables_active>N</variables_active> | |
| 290 | - <lazy_conversion_active>N</lazy_conversion_active> | |
| 284 | + <header>Y</header> | |
| 285 | + <footer>N</footer> | |
| 286 | + <encoding/> | |
| 287 | + <append>N</append> | |
| 288 | + <add_to_result_filenames>Y</add_to_result_filenames> | |
| 289 | + <file> | |
| 290 | + <name>${filepath}</name> | |
| 291 | + <extention/> | |
| 292 | + <do_not_open_newfile_init>N</do_not_open_newfile_init> | |
| 293 | + <create_parent_folder>N</create_parent_folder> | |
| 294 | + <split>N</split> | |
| 295 | + <add_date>N</add_date> | |
| 296 | + <add_time>N</add_time> | |
| 297 | + <SpecifyFormat>N</SpecifyFormat> | |
| 298 | + <date_time_format>yyyyMMddHHmmss</date_time_format> | |
| 299 | + <sheetname>工作表1</sheetname> | |
| 300 | + <autosizecolums>N</autosizecolums> | |
| 301 | + <nullisblank>N</nullisblank> | |
| 302 | + <protect_sheet>N</protect_sheet> | |
| 303 | + <password>Encrypted </password> | |
| 304 | + <splitevery>0</splitevery> | |
| 305 | + <usetempfiles>N</usetempfiles> | |
| 306 | + <tempdirectory/> | |
| 307 | + </file> | |
| 308 | + <template> | |
| 309 | + <enabled>N</enabled> | |
| 310 | + <append>N</append> | |
| 311 | + <filename>template.xls</filename> | |
| 312 | + </template> | |
| 313 | + <fields> | |
| 314 | + <field> | |
| 315 | + <name>线路</name> | |
| 316 | + <type>String</type> | |
| 317 | + <format/> | |
| 318 | + </field> | |
| 319 | + <field> | |
| 320 | + <name>内部编码</name> | |
| 321 | + <type>String</type> | |
| 322 | + <format/> | |
| 323 | + </field> | |
| 324 | + <field> | |
| 325 | + <name>启用日期</name> | |
| 326 | + <type>String</type> | |
| 327 | + <format/> | |
| 328 | + </field> | |
| 329 | + <field> | |
| 330 | + <name>终结日期</name> | |
| 331 | + <type>String</type> | |
| 332 | + <format/> | |
| 333 | + </field> | |
| 334 | + <field> | |
| 335 | + <name>停车点</name> | |
| 336 | + <type>String</type> | |
| 337 | + <format/> | |
| 338 | + </field> | |
| 339 | + </fields> | |
| 340 | + <custom> | |
| 341 | + <header_font_name>arial</header_font_name> | |
| 342 | + <header_font_size>10</header_font_size> | |
| 343 | + <header_font_bold>N</header_font_bold> | |
| 344 | + <header_font_italic>N</header_font_italic> | |
| 345 | + <header_font_underline>no</header_font_underline> | |
| 346 | + <header_font_orientation>horizontal</header_font_orientation> | |
| 347 | + <header_font_color>black</header_font_color> | |
| 348 | + <header_background_color>none</header_background_color> | |
| 349 | + <header_row_height>255</header_row_height> | |
| 350 | + <header_alignment>left</header_alignment> | |
| 351 | + <header_image/> | |
| 352 | + <row_font_name>arial</row_font_name> | |
| 353 | + <row_font_size>10</row_font_size> | |
| 354 | + <row_font_color>black</row_font_color> | |
| 355 | + <row_background_color>none</row_background_color> | |
| 356 | + </custom> | |
| 291 | 357 | <cluster_schema/> |
| 292 | 358 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 293 | - <xloc>106</xloc> | |
| 294 | - <yloc>68</yloc> | |
| 359 | + <xloc>596</xloc> | |
| 360 | + <yloc>265</yloc> | |
| 295 | 361 | <draw>Y</draw> |
| 296 | 362 | </GUI> |
| 297 | 363 | </step> |
| 298 | 364 | |
| 299 | 365 | <step> |
| 300 | - <name>线路查询</name> | |
| 301 | - <type>DBLookup</type> | |
| 366 | + <name>字段选择</name> | |
| 367 | + <type>SelectValues</type> | |
| 302 | 368 | <description/> |
| 303 | 369 | <distribute>Y</distribute> |
| 304 | 370 | <custom_distribution/> |
| ... | ... | @@ -307,40 +373,38 @@ |
| 307 | 373 | <method>none</method> |
| 308 | 374 | <schema_name/> |
| 309 | 375 | </partitioning> |
| 310 | - <connection>bus_control_variable</connection> | |
| 311 | - <cache>Y</cache> | |
| 312 | - <cache_load_all>Y</cache_load_all> | |
| 313 | - <cache_size>0</cache_size> | |
| 314 | - <lookup> | |
| 315 | - <schema/> | |
| 316 | - <table>bsth_c_line</table> | |
| 317 | - <orderby/> | |
| 318 | - <fail_on_multiple>N</fail_on_multiple> | |
| 319 | - <eat_row_on_failure>N</eat_row_on_failure> | |
| 320 | - <key> | |
| 321 | - <name>xl</name> | |
| 322 | - <field>id</field> | |
| 323 | - <condition>=</condition> | |
| 324 | - <name2/> | |
| 325 | - </key> | |
| 326 | - <value> | |
| 327 | - <name>name</name> | |
| 328 | - <rename>xlmc</rename> | |
| 329 | - <default/> | |
| 330 | - <type>String</type> | |
| 331 | - </value> | |
| 332 | - </lookup> | |
| 333 | - <cluster_schema/> | |
| 376 | + <fields> <field> <name>xlmc</name> | |
| 377 | + <rename>线路</rename> | |
| 378 | + <length>-2</length> | |
| 379 | + <precision>-2</precision> | |
| 380 | + </field> <field> <name>zbh</name> | |
| 381 | + <rename>内部编码</rename> | |
| 382 | + <length>-2</length> | |
| 383 | + <precision>-2</precision> | |
| 384 | + </field> <field> <name>qyrq</name> | |
| 385 | + <rename>启用日期</rename> | |
| 386 | + <length>-2</length> | |
| 387 | + <precision>-2</precision> | |
| 388 | + </field> <field> <name>zzrq</name> | |
| 389 | + <rename>终结日期</rename> | |
| 390 | + <length>-2</length> | |
| 391 | + <precision>-2</precision> | |
| 392 | + </field> <field> <name>tcd</name> | |
| 393 | + <rename>停车点</rename> | |
| 394 | + <length>-2</length> | |
| 395 | + <precision>-2</precision> | |
| 396 | + </field> <select_unspecified>N</select_unspecified> | |
| 397 | + </fields> <cluster_schema/> | |
| 334 | 398 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 335 | - <xloc>248</xloc> | |
| 336 | - <yloc>67</yloc> | |
| 399 | + <xloc>595</xloc> | |
| 400 | + <yloc>167</yloc> | |
| 337 | 401 | <draw>Y</draw> |
| 338 | 402 | </GUI> |
| 339 | 403 | </step> |
| 340 | 404 | |
| 341 | 405 | <step> |
| 342 | - <name>车辆查询</name> | |
| 343 | - <type>DBLookup</type> | |
| 406 | + <name>排序记录</name> | |
| 407 | + <type>SortRows</type> | |
| 344 | 408 | <description/> |
| 345 | 409 | <distribute>Y</distribute> |
| 346 | 410 | <custom_distribution/> |
| ... | ... | @@ -349,33 +413,37 @@ |
| 349 | 413 | <method>none</method> |
| 350 | 414 | <schema_name/> |
| 351 | 415 | </partitioning> |
| 352 | - <connection>bus_control_variable</connection> | |
| 353 | - <cache>N</cache> | |
| 354 | - <cache_load_all>N</cache_load_all> | |
| 355 | - <cache_size>0</cache_size> | |
| 356 | - <lookup> | |
| 357 | - <schema/> | |
| 358 | - <table>bsth_c_cars</table> | |
| 359 | - <orderby/> | |
| 360 | - <fail_on_multiple>N</fail_on_multiple> | |
| 361 | - <eat_row_on_failure>N</eat_row_on_failure> | |
| 362 | - <key> | |
| 363 | - <name>cl</name> | |
| 364 | - <field>id</field> | |
| 365 | - <condition>=</condition> | |
| 366 | - <name2/> | |
| 367 | - </key> | |
| 368 | - <value> | |
| 369 | - <name>inside_code</name> | |
| 370 | - <rename>zbh</rename> | |
| 371 | - <default/> | |
| 372 | - <type>String</type> | |
| 373 | - </value> | |
| 374 | - </lookup> | |
| 416 | + <directory>%%java.io.tmpdir%%</directory> | |
| 417 | + <prefix>out</prefix> | |
| 418 | + <sort_size>1000000</sort_size> | |
| 419 | + <free_memory/> | |
| 420 | + <compress>N</compress> | |
| 421 | + <compress_variable/> | |
| 422 | + <unique_rows>N</unique_rows> | |
| 423 | + <fields> | |
| 424 | + <field> | |
| 425 | + <name>xlmc</name> | |
| 426 | + <ascending>Y</ascending> | |
| 427 | + <case_sensitive>N</case_sensitive> | |
| 428 | + <presorted>N</presorted> | |
| 429 | + </field> | |
| 430 | + <field> | |
| 431 | + <name>zbh</name> | |
| 432 | + <ascending>Y</ascending> | |
| 433 | + <case_sensitive>N</case_sensitive> | |
| 434 | + <presorted>N</presorted> | |
| 435 | + </field> | |
| 436 | + <field> | |
| 437 | + <name>qyrq</name> | |
| 438 | + <ascending>Y</ascending> | |
| 439 | + <case_sensitive>N</case_sensitive> | |
| 440 | + <presorted>N</presorted> | |
| 441 | + </field> | |
| 442 | + </fields> | |
| 375 | 443 | <cluster_schema/> |
| 376 | 444 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 377 | - <xloc>361</xloc> | |
| 378 | - <yloc>67</yloc> | |
| 445 | + <xloc>592</xloc> | |
| 446 | + <yloc>66</yloc> | |
| 379 | 447 | <draw>Y</draw> |
| 380 | 448 | </GUI> |
| 381 | 449 | </step> |
| ... | ... | @@ -431,8 +499,8 @@ |
| 431 | 499 | </step> |
| 432 | 500 | |
| 433 | 501 | <step> |
| 434 | - <name>排序记录</name> | |
| 435 | - <type>SortRows</type> | |
| 502 | + <name>线路查询</name> | |
| 503 | + <type>DBLookup</type> | |
| 436 | 504 | <description/> |
| 437 | 505 | <distribute>Y</distribute> |
| 438 | 506 | <custom_distribution/> |
| ... | ... | @@ -441,44 +509,40 @@ |
| 441 | 509 | <method>none</method> |
| 442 | 510 | <schema_name/> |
| 443 | 511 | </partitioning> |
| 444 | - <directory>%%java.io.tmpdir%%</directory> | |
| 445 | - <prefix>out</prefix> | |
| 446 | - <sort_size>1000000</sort_size> | |
| 447 | - <free_memory/> | |
| 448 | - <compress>N</compress> | |
| 449 | - <compress_variable/> | |
| 450 | - <unique_rows>N</unique_rows> | |
| 451 | - <fields> | |
| 452 | - <field> | |
| 453 | - <name>xlmc</name> | |
| 454 | - <ascending>Y</ascending> | |
| 455 | - <case_sensitive>N</case_sensitive> | |
| 456 | - <presorted>N</presorted> | |
| 457 | - </field> | |
| 458 | - <field> | |
| 459 | - <name>zbh</name> | |
| 460 | - <ascending>Y</ascending> | |
| 461 | - <case_sensitive>N</case_sensitive> | |
| 462 | - <presorted>N</presorted> | |
| 463 | - </field> | |
| 464 | - <field> | |
| 465 | - <name>qyrq</name> | |
| 466 | - <ascending>Y</ascending> | |
| 467 | - <case_sensitive>N</case_sensitive> | |
| 468 | - <presorted>N</presorted> | |
| 469 | - </field> | |
| 470 | - </fields> | |
| 512 | + <connection>bus_control_variable</connection> | |
| 513 | + <cache>Y</cache> | |
| 514 | + <cache_load_all>Y</cache_load_all> | |
| 515 | + <cache_size>0</cache_size> | |
| 516 | + <lookup> | |
| 517 | + <schema/> | |
| 518 | + <table>bsth_c_line</table> | |
| 519 | + <orderby/> | |
| 520 | + <fail_on_multiple>N</fail_on_multiple> | |
| 521 | + <eat_row_on_failure>N</eat_row_on_failure> | |
| 522 | + <key> | |
| 523 | + <name>xl</name> | |
| 524 | + <field>id</field> | |
| 525 | + <condition>=</condition> | |
| 526 | + <name2/> | |
| 527 | + </key> | |
| 528 | + <value> | |
| 529 | + <name>name</name> | |
| 530 | + <rename>xlmc</rename> | |
| 531 | + <default/> | |
| 532 | + <type>String</type> | |
| 533 | + </value> | |
| 534 | + </lookup> | |
| 471 | 535 | <cluster_schema/> |
| 472 | 536 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 473 | - <xloc>592</xloc> | |
| 474 | - <yloc>66</yloc> | |
| 537 | + <xloc>248</xloc> | |
| 538 | + <yloc>67</yloc> | |
| 475 | 539 | <draw>Y</draw> |
| 476 | 540 | </GUI> |
| 477 | 541 | </step> |
| 478 | 542 | |
| 479 | 543 | <step> |
| 480 | - <name>字段选择</name> | |
| 481 | - <type>SelectValues</type> | |
| 544 | + <name>车辆查询</name> | |
| 545 | + <type>DBLookup</type> | |
| 482 | 546 | <description/> |
| 483 | 547 | <distribute>Y</distribute> |
| 484 | 548 | <custom_distribution/> |
| ... | ... | @@ -487,38 +551,40 @@ |
| 487 | 551 | <method>none</method> |
| 488 | 552 | <schema_name/> |
| 489 | 553 | </partitioning> |
| 490 | - <fields> <field> <name>xlmc</name> | |
| 491 | - <rename>线路</rename> | |
| 492 | - <length>-2</length> | |
| 493 | - <precision>-2</precision> | |
| 494 | - </field> <field> <name>zbh</name> | |
| 495 | - <rename>内部编码</rename> | |
| 496 | - <length>-2</length> | |
| 497 | - <precision>-2</precision> | |
| 498 | - </field> <field> <name>qyrq</name> | |
| 499 | - <rename>启用日期</rename> | |
| 500 | - <length>-2</length> | |
| 501 | - <precision>-2</precision> | |
| 502 | - </field> <field> <name>zzrq</name> | |
| 503 | - <rename>终结日期</rename> | |
| 504 | - <length>-2</length> | |
| 505 | - <precision>-2</precision> | |
| 506 | - </field> <field> <name>tcd</name> | |
| 507 | - <rename>停车点</rename> | |
| 508 | - <length>-2</length> | |
| 509 | - <precision>-2</precision> | |
| 510 | - </field> <select_unspecified>N</select_unspecified> | |
| 511 | - </fields> <cluster_schema/> | |
| 554 | + <connection>bus_control_variable</connection> | |
| 555 | + <cache>N</cache> | |
| 556 | + <cache_load_all>N</cache_load_all> | |
| 557 | + <cache_size>0</cache_size> | |
| 558 | + <lookup> | |
| 559 | + <schema/> | |
| 560 | + <table>bsth_c_cars</table> | |
| 561 | + <orderby/> | |
| 562 | + <fail_on_multiple>N</fail_on_multiple> | |
| 563 | + <eat_row_on_failure>N</eat_row_on_failure> | |
| 564 | + <key> | |
| 565 | + <name>cl</name> | |
| 566 | + <field>id</field> | |
| 567 | + <condition>=</condition> | |
| 568 | + <name2/> | |
| 569 | + </key> | |
| 570 | + <value> | |
| 571 | + <name>inside_code</name> | |
| 572 | + <rename>zbh</rename> | |
| 573 | + <default/> | |
| 574 | + <type>String</type> | |
| 575 | + </value> | |
| 576 | + </lookup> | |
| 577 | + <cluster_schema/> | |
| 512 | 578 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 513 | - <xloc>595</xloc> | |
| 514 | - <yloc>167</yloc> | |
| 579 | + <xloc>361</xloc> | |
| 580 | + <yloc>67</yloc> | |
| 515 | 581 | <draw>Y</draw> |
| 516 | 582 | </GUI> |
| 517 | 583 | </step> |
| 518 | 584 | |
| 519 | 585 | <step> |
| 520 | - <name>Excel输出</name> | |
| 521 | - <type>ExcelOutput</type> | |
| 586 | + <name>车辆配置(没有作废)</name> | |
| 587 | + <type>TableInput</type> | |
| 522 | 588 | <description/> |
| 523 | 589 | <distribute>Y</distribute> |
| 524 | 590 | <custom_distribution/> |
| ... | ... | @@ -527,83 +593,17 @@ |
| 527 | 593 | <method>none</method> |
| 528 | 594 | <schema_name/> |
| 529 | 595 | </partitioning> |
| 530 | - <header>Y</header> | |
| 531 | - <footer>N</footer> | |
| 532 | - <encoding/> | |
| 533 | - <append>N</append> | |
| 534 | - <add_to_result_filenames>Y</add_to_result_filenames> | |
| 535 | - <file> | |
| 536 | - <name>${filepath}</name> | |
| 537 | - <extention/> | |
| 538 | - <do_not_open_newfile_init>N</do_not_open_newfile_init> | |
| 539 | - <create_parent_folder>N</create_parent_folder> | |
| 540 | - <split>N</split> | |
| 541 | - <add_date>N</add_date> | |
| 542 | - <add_time>N</add_time> | |
| 543 | - <SpecifyFormat>N</SpecifyFormat> | |
| 544 | - <date_time_format>yyyyMMddHHmmss</date_time_format> | |
| 545 | - <sheetname>工作表1</sheetname> | |
| 546 | - <autosizecolums>N</autosizecolums> | |
| 547 | - <nullisblank>N</nullisblank> | |
| 548 | - <protect_sheet>N</protect_sheet> | |
| 549 | - <password>Encrypted </password> | |
| 550 | - <splitevery>0</splitevery> | |
| 551 | - <usetempfiles>N</usetempfiles> | |
| 552 | - <tempdirectory/> | |
| 553 | - </file> | |
| 554 | - <template> | |
| 555 | - <enabled>N</enabled> | |
| 556 | - <append>N</append> | |
| 557 | - <filename>template.xls</filename> | |
| 558 | - </template> | |
| 559 | - <fields> | |
| 560 | - <field> | |
| 561 | - <name>线路</name> | |
| 562 | - <type>String</type> | |
| 563 | - <format/> | |
| 564 | - </field> | |
| 565 | - <field> | |
| 566 | - <name>内部编码</name> | |
| 567 | - <type>String</type> | |
| 568 | - <format/> | |
| 569 | - </field> | |
| 570 | - <field> | |
| 571 | - <name>启用日期</name> | |
| 572 | - <type>String</type> | |
| 573 | - <format/> | |
| 574 | - </field> | |
| 575 | - <field> | |
| 576 | - <name>终结日期</name> | |
| 577 | - <type>String</type> | |
| 578 | - <format/> | |
| 579 | - </field> | |
| 580 | - <field> | |
| 581 | - <name>停车点</name> | |
| 582 | - <type>String</type> | |
| 583 | - <format/> | |
| 584 | - </field> | |
| 585 | - </fields> | |
| 586 | - <custom> | |
| 587 | - <header_font_name>arial</header_font_name> | |
| 588 | - <header_font_size>10</header_font_size> | |
| 589 | - <header_font_bold>N</header_font_bold> | |
| 590 | - <header_font_italic>N</header_font_italic> | |
| 591 | - <header_font_underline>no</header_font_underline> | |
| 592 | - <header_font_orientation>horizontal</header_font_orientation> | |
| 593 | - <header_font_color>black</header_font_color> | |
| 594 | - <header_background_color>none</header_background_color> | |
| 595 | - <header_row_height>255</header_row_height> | |
| 596 | - <header_alignment>left</header_alignment> | |
| 597 | - <header_image/> | |
| 598 | - <row_font_name>arial</row_font_name> | |
| 599 | - <row_font_size>10</row_font_size> | |
| 600 | - <row_font_color>black</row_font_color> | |
| 601 | - <row_background_color>none</row_background_color> | |
| 602 | - </custom> | |
| 596 | + <connection>bus_control_variable</connection> | |
| 597 | + <sql>select * from bsth_c_s_ccinfo where is_cancel = 0</sql> | |
| 598 | + <limit>0</limit> | |
| 599 | + <lookup/> | |
| 600 | + <execute_each_row>N</execute_each_row> | |
| 601 | + <variables_active>N</variables_active> | |
| 602 | + <lazy_conversion_active>N</lazy_conversion_active> | |
| 603 | 603 | <cluster_schema/> |
| 604 | 604 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 605 | - <xloc>596</xloc> | |
| 606 | - <yloc>265</yloc> | |
| 605 | + <xloc>106</xloc> | |
| 606 | + <yloc>68</yloc> | |
| 607 | 607 | <draw>Y</draw> |
| 608 | 608 | </GUI> |
| 609 | 609 | </step> | ... | ... |
src/main/resources/datatools/ktrs/carsDataInput.ktr
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 | <transformation> |
| 3 | 3 | <info> |
| 4 | - <name>carsDataInput</name> | |
| 4 | + <name>车辆信息导入</name> | |
| 5 | 5 | <description>车辆信息导入</description> |
| 6 | 6 | <extended_description>车辆基础信息</extended_description> |
| 7 | 7 | <trans_version/> |
| ... | ... | @@ -119,6 +119,7 @@ |
| 119 | 119 | <data_tablespace/> |
| 120 | 120 | <index_tablespace/> |
| 121 | 121 | <attributes> |
| 122 | + <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute> | |
| 122 | 123 | <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute> |
| 123 | 124 | <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute> |
| 124 | 125 | <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> |
| ... | ... | @@ -1016,6 +1017,12 @@ |
| 1016 | 1017 | <schema/> |
| 1017 | 1018 | <table>bsth_c_cars</table> |
| 1018 | 1019 | <key> |
| 1020 | + <name>businessCode</name> | |
| 1021 | + <field>business_code</field> | |
| 1022 | + <condition>=</condition> | |
| 1023 | + <name2/> | |
| 1024 | + </key> | |
| 1025 | + <key> | |
| 1019 | 1026 | <name>insideCode</name> |
| 1020 | 1027 | <field>inside_code</field> |
| 1021 | 1028 | <condition>=</condition> | ... | ... |
src/main/resources/datatools/ktrs/carsDataOutput.ktr
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 | <transformation> |
| 3 | 3 | <info> |
| 4 | - <name>carsDataOutput</name> | |
| 4 | + <name>车辆信息导出</name> | |
| 5 | 5 | <description>车辆信息导出</description> |
| 6 | 6 | <extended_description>车辆基础信息</extended_description> |
| 7 | 7 | <trans_version/> |
| ... | ... | @@ -93,6 +93,7 @@ |
| 93 | 93 | <data_tablespace/> |
| 94 | 94 | <index_tablespace/> |
| 95 | 95 | <attributes> |
| 96 | + <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute> | |
| 96 | 97 | <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute> |
| 97 | 98 | <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute> |
| 98 | 99 | <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | ... | ... |
src/main/resources/datatools/ktrs/employeesConfigDataInput.ktr
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 | <transformation> |
| 3 | 3 | <info> |
| 4 | - <name>employeesConfigDataInput</name> | |
| 4 | + <name>人员配置信息导入</name> | |
| 5 | 5 | <description>人员配置信息导入</description> |
| 6 | 6 | <extended_description>人员配置信息</extended_description> |
| 7 | 7 | <trans_version/> |
| ... | ... | @@ -514,30 +514,36 @@ |
| 514 | 514 | <condition>=</condition> |
| 515 | 515 | <name2/> |
| 516 | 516 | </key> |
| 517 | + <key> | |
| 518 | + <name>isCancel</name> | |
| 519 | + <field>is_cancel</field> | |
| 520 | + <condition>=</condition> | |
| 521 | + <name2/> | |
| 522 | + </key> | |
| 517 | 523 | <value> |
| 518 | 524 | <name>xl</name> |
| 519 | 525 | <rename>xlid</rename> |
| 520 | - <update>Y</update> | |
| 526 | + <update>N</update> | |
| 521 | 527 | </value> |
| 522 | 528 | <value> |
| 523 | 529 | <name>dbbm</name> |
| 524 | 530 | <rename>搭班编码</rename> |
| 525 | - <update>Y</update> | |
| 531 | + <update>N</update> | |
| 526 | 532 | </value> |
| 527 | 533 | <value> |
| 528 | 534 | <name>jsy</name> |
| 529 | 535 | <rename>jid</rename> |
| 530 | - <update>Y</update> | |
| 536 | + <update>N</update> | |
| 531 | 537 | </value> |
| 532 | 538 | <value> |
| 533 | 539 | <name>spy</name> |
| 534 | 540 | <rename>sid</rename> |
| 535 | - <update>Y</update> | |
| 541 | + <update>N</update> | |
| 536 | 542 | </value> |
| 537 | 543 | <value> |
| 538 | 544 | <name>is_cancel</name> |
| 539 | 545 | <rename>isCancel</rename> |
| 540 | - <update>Y</update> | |
| 546 | + <update>N</update> | |
| 541 | 547 | </value> |
| 542 | 548 | </lookup> |
| 543 | 549 | <cluster_schema/> | ... | ... |
src/main/resources/datatools/ktrs/employeesConfigDataOutput.ktr
src/main/resources/datatools/ktrs/employeesDataInput.ktr
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 | <transformation> |
| 3 | 3 | <info> |
| 4 | - <name>employeesDataInput</name> | |
| 4 | + <name>人员信息导入</name> | |
| 5 | 5 | <description>人员基础信息导入</description> |
| 6 | 6 | <extended_description>人员基础信息</extended_description> |
| 7 | 7 | <trans_version/> |
| ... | ... | @@ -119,6 +119,7 @@ |
| 119 | 119 | <data_tablespace/> |
| 120 | 120 | <index_tablespace/> |
| 121 | 121 | <attributes> |
| 122 | + <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute> | |
| 122 | 123 | <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute> |
| 123 | 124 | <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute> |
| 124 | 125 | <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> |
| ... | ... | @@ -679,14 +680,14 @@ |
| 679 | 680 | <schema/> |
| 680 | 681 | <table>bsth_c_personnel</table> |
| 681 | 682 | <key> |
| 682 | - <name>jobCode</name> | |
| 683 | - <field>job_code</field> | |
| 683 | + <name>companyCode</name> | |
| 684 | + <field>company_code</field> | |
| 684 | 685 | <condition>=</condition> |
| 685 | 686 | <name2/> |
| 686 | 687 | </key> |
| 687 | 688 | <key> |
| 688 | - <name>companyCode</name> | |
| 689 | - <field>company_code</field> | |
| 689 | + <name>jobCode</name> | |
| 690 | + <field>job_code</field> | |
| 690 | 691 | <condition>=</condition> |
| 691 | 692 | <name2/> |
| 692 | 693 | </key> | ... | ... |
src/main/resources/datatools/ktrs/employeesDataOutput.ktr
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 | <transformation> |
| 3 | 3 | <info> |
| 4 | - <name>employeesDataOutput</name> | |
| 4 | + <name>人员信息导出</name> | |
| 5 | 5 | <description/> |
| 6 | 6 | <extended_description/> |
| 7 | 7 | <trans_version/> |
| ... | ... | @@ -93,6 +93,7 @@ |
| 93 | 93 | <data_tablespace/> |
| 94 | 94 | <index_tablespace/> |
| 95 | 95 | <attributes> |
| 96 | + <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute> | |
| 96 | 97 | <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute> |
| 97 | 98 | <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute> |
| 98 | 99 | <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | ... | ... |