Commit 52b381050b1812abd2040209f88a91e305f1a153
Merge branch 'minhang' of http://192.168.168.201:8888/panzhaov5/bsth_control into minhang
Showing
52 changed files
with
2377 additions
and
574 deletions
Too many changes to show.
To preserve performance only 52 of 183 files are displayed.
src/main/java/com/bsth/Application.java
| @@ -2,10 +2,6 @@ package com.bsth; | @@ -2,10 +2,6 @@ package com.bsth; | ||
| 2 | 2 | ||
| 3 | import com.fasterxml.jackson.databind.ObjectMapper; | 3 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 4 | import com.fasterxml.jackson.databind.SerializationFeature; | 4 | import com.fasterxml.jackson.databind.SerializationFeature; |
| 5 | - | ||
| 6 | -import java.util.concurrent.Executors; | ||
| 7 | -import java.util.concurrent.ScheduledExecutorService; | ||
| 8 | - | ||
| 9 | import org.springframework.boot.SpringApplication; | 5 | import org.springframework.boot.SpringApplication; |
| 10 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 11 | import org.springframework.boot.builder.SpringApplicationBuilder; | 7 | import org.springframework.boot.builder.SpringApplicationBuilder; |
| @@ -13,10 +9,13 @@ import org.springframework.boot.context.web.SpringBootServletInitializer; | @@ -13,10 +9,13 @@ import org.springframework.boot.context.web.SpringBootServletInitializer; | ||
| 13 | import org.springframework.context.annotation.Bean; | 9 | import org.springframework.context.annotation.Bean; |
| 14 | import org.springframework.context.annotation.Primary; | 10 | import org.springframework.context.annotation.Primary; |
| 15 | 11 | ||
| 12 | +import java.util.concurrent.Executors; | ||
| 13 | +import java.util.concurrent.ScheduledExecutorService; | ||
| 14 | + | ||
| 16 | @SpringBootApplication | 15 | @SpringBootApplication |
| 17 | public class Application extends SpringBootServletInitializer { | 16 | public class Application extends SpringBootServletInitializer { |
| 18 | 17 | ||
| 19 | - public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(12); | 18 | + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(13); |
| 20 | 19 | ||
| 21 | @Override | 20 | @Override |
| 22 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | 21 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
src/main/java/com/bsth/controller/DownloadController.java
| @@ -100,4 +100,29 @@ public class DownloadController | @@ -100,4 +100,29 @@ public class DownloadController | ||
| 100 | os.close(); | 100 | os.close(); |
| 101 | file.delete(); | 101 | file.delete(); |
| 102 | } | 102 | } |
| 103 | + | ||
| 104 | + | ||
| 105 | + @RequestMapping("downloadModel") | ||
| 106 | + public void downloadModel(HttpServletResponse response,String fileName) | ||
| 107 | + throws IOException { | ||
| 108 | +// String fileNames=URLDecoder.decode(fileName,"UTF-8"); | ||
| 109 | + fileName =fileName + ".xls"; | ||
| 110 | + String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; | ||
| 111 | + File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 | ||
| 112 | +// String filename = file.getName();// 获取日志文件名称 | ||
| 113 | + InputStream fis = new BufferedInputStream(new FileInputStream(moudelPath)); | ||
| 114 | + byte[] buffer = new byte[fis.available()]; | ||
| 115 | + fis.read(buffer); | ||
| 116 | + fis.close(); | ||
| 117 | + response.reset(); | ||
| 118 | + response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"),"iso8859-1")); | ||
| 119 | + response.addHeader("Content-Length", "" + file.length()); | ||
| 120 | + OutputStream os = new BufferedOutputStream(response.getOutputStream()); | ||
| 121 | + response.setContentType("application/octet-stream"); | ||
| 122 | + os.write(buffer);// 输出文件 | ||
| 123 | + os.flush(); | ||
| 124 | + os.close(); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + | ||
| 103 | } | 128 | } |
src/main/java/com/bsth/controller/SectionRouteController.java
| @@ -72,4 +72,14 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | @@ -72,4 +72,14 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | ||
| 72 | public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) { | 72 | public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) { |
| 73 | return routeService.findUpSectionRouteCode(map); | 73 | return routeService.findUpSectionRouteCode(map); |
| 74 | } | 74 | } |
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * @Description :TODO(引用路段) | ||
| 78 | + * | ||
| 79 | + * @return List<Map<String, Object>> | ||
| 80 | + */ | ||
| 81 | + @RequestMapping(value = "/quoteSection" , method = RequestMethod.POST) | ||
| 82 | + public Map<String, Object> quoteSection(@RequestParam Map<String, Object> map) { | ||
| 83 | + return routeService.quoteSection(map); | ||
| 84 | + } | ||
| 75 | } | 85 | } |
src/main/java/com/bsth/controller/StationRouteController.java
| @@ -111,7 +111,6 @@ public class StationRouteController extends BaseController<StationRoute, Integer | @@ -111,7 +111,6 @@ public class StationRouteController extends BaseController<StationRoute, Integer | ||
| 111 | */ | 111 | */ |
| 112 | @RequestMapping(value = "/findStationRouteInfo",method = RequestMethod.GET) | 112 | @RequestMapping(value = "/findStationRouteInfo",method = RequestMethod.GET) |
| 113 | public List<Map<String, Object>> findStationRouteInfo(@RequestParam Map<String, Object> map) { | 113 | public List<Map<String, Object>> findStationRouteInfo(@RequestParam Map<String, Object> map) { |
| 114 | - | ||
| 115 | return service.findStationRouteInfo(map); | 114 | return service.findStationRouteInfo(map); |
| 116 | } | 115 | } |
| 117 | 116 | ||
| @@ -127,8 +126,26 @@ public class StationRouteController extends BaseController<StationRoute, Integer | @@ -127,8 +126,26 @@ public class StationRouteController extends BaseController<StationRoute, Integer | ||
| 127 | */ | 126 | */ |
| 128 | @RequestMapping(value = "/multiLine", method = RequestMethod.GET) | 127 | @RequestMapping(value = "/multiLine", method = RequestMethod.GET) |
| 129 | public Map<String, Object> findByMultiLine(@RequestParam String lineIds){ | 128 | public Map<String, Object> findByMultiLine(@RequestParam String lineIds){ |
| 130 | - | ||
| 131 | return service.findByMultiLine(lineIds); | 129 | return service.findByMultiLine(lineIds); |
| 132 | } | 130 | } |
| 133 | 131 | ||
| 132 | + /** | ||
| 133 | + * | ||
| 134 | + * @Title: updSwitchDir | ||
| 135 | + * @Description: TODO(上下行切换) | ||
| 136 | + */ | ||
| 137 | + @RequestMapping(value = "/updSwitchDir", method = RequestMethod.POST) | ||
| 138 | + public Map<String, Object> updSwitchDir(@RequestParam String lineIds){ | ||
| 139 | + return service.updSwitchDir(lineIds); | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + /** | ||
| 143 | + * | ||
| 144 | + * @Title: upddis | ||
| 145 | + * @Description: TODO(更新站距) | ||
| 146 | + */ | ||
| 147 | + @RequestMapping(value = "/upddis",method = RequestMethod.POST) | ||
| 148 | + public Map<String, Object> upddis(@RequestParam Map<String, Object> map) { | ||
| 149 | + return service.upddis(map); | ||
| 150 | + } | ||
| 134 | } | 151 | } |
src/main/java/com/bsth/controller/gps/GpsController.java
| @@ -96,4 +96,16 @@ public class GpsController { | @@ -96,4 +96,16 @@ public class GpsController { | ||
| 96 | public Map<String, Object> gpsCompletion(@RequestParam long schId) { | 96 | public Map<String, Object> gpsCompletion(@RequestParam long schId) { |
| 97 | return gpsService.gpsCompletion(schId); | 97 | return gpsService.gpsCompletion(schId); |
| 98 | } | 98 | } |
| 99 | + | ||
| 100 | + /** | ||
| 101 | + * 历史GPS查询 ,第二版轨迹回放用 | ||
| 102 | + * @param nbbm | ||
| 103 | + * @param st | ||
| 104 | + * @param et | ||
| 105 | + * @return | ||
| 106 | + */ | ||
| 107 | + @RequestMapping(value = "/history_v2/{nbbm}") | ||
| 108 | + public Map<String, Object> history_v2(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et){ | ||
| 109 | + return gpsService.history_v2(nbbm, st, et); | ||
| 110 | + } | ||
| 99 | } | 111 | } |
src/main/java/com/bsth/controller/oil/CwjyController.java
| @@ -2,6 +2,8 @@ package com.bsth.controller.oil; | @@ -2,6 +2,8 @@ package com.bsth.controller.oil; | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | import java.util.Date; | 4 | import java.util.Date; |
| 5 | +import java.util.HashMap; | ||
| 6 | +import java.util.List; | ||
| 5 | import java.util.Map; | 7 | import java.util.Map; |
| 6 | 8 | ||
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -31,9 +33,9 @@ public class CwjyController extends BaseController<Cwjy, Integer>{ | @@ -31,9 +33,9 @@ public class CwjyController extends BaseController<Cwjy, Integer>{ | ||
| 31 | return service.save(t); | 33 | return service.save(t); |
| 32 | } | 34 | } |
| 33 | 35 | ||
| 34 | - @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 35 | - public PageObject<Ylxxb> pagequery(@RequestParam Map<String, Object> map){ | ||
| 36 | - PageObject<Ylxxb> pagequery=null; | 36 | + @RequestMapping(value = "/queryList",method = RequestMethod.GET) |
| 37 | + public List<Ylxxb> queryList(@RequestParam Map<String, Object> map){ | ||
| 38 | + List<Ylxxb> pagequery=null; | ||
| 37 | map.put("curPage", map.get("page").toString()); | 39 | map.put("curPage", map.get("page").toString()); |
| 38 | map.put("pageData","10"); | 40 | map.put("pageData","10"); |
| 39 | pagequery=service.Pagequery(map); | 41 | pagequery=service.Pagequery(map); |
| @@ -56,9 +58,15 @@ public class CwjyController extends BaseController<Cwjy, Integer>{ | @@ -56,9 +58,15 @@ public class CwjyController extends BaseController<Cwjy, Integer>{ | ||
| 56 | * @throws | 58 | * @throws |
| 57 | */ | 59 | */ |
| 58 | @RequestMapping(value="/savejzl",method = RequestMethod.POST) | 60 | @RequestMapping(value="/savejzl",method = RequestMethod.POST) |
| 59 | - public Map<String, Object> savejzl(Ylxxb t){ | ||
| 60 | - Map<String, Object> map=service.savejzl(t); | ||
| 61 | - return map; | 61 | + public Map<String, Object> savejzl(@RequestParam Map<String, Object> map){ |
| 62 | + Map<String, Object> maps=new HashMap<>(); | ||
| 63 | + try { | ||
| 64 | + maps = service.savejzl(map); | ||
| 65 | + } catch (Exception e) { | ||
| 66 | + // TODO Auto-generated catch block | ||
| 67 | + e.printStackTrace(); | ||
| 68 | + } | ||
| 69 | + return maps; | ||
| 62 | } | 70 | } |
| 63 | 71 | ||
| 64 | } | 72 | } |
src/main/java/com/bsth/controller/oil/DlbController.java
| 1 | package com.bsth.controller.oil; | 1 | package com.bsth.controller.oil; |
| 2 | 2 | ||
| 3 | +import java.text.SimpleDateFormat; | ||
| 4 | +import java.util.ArrayList; | ||
| 5 | +import java.util.HashMap; | ||
| 6 | +import java.util.Iterator; | ||
| 3 | import java.util.List; | 7 | import java.util.List; |
| 4 | import java.util.Map; | 8 | import java.util.Map; |
| 5 | 9 | ||
| @@ -16,6 +20,7 @@ import com.bsth.controller.BaseController; | @@ -16,6 +20,7 @@ import com.bsth.controller.BaseController; | ||
| 16 | import com.bsth.entity.oil.Dlb; | 20 | import com.bsth.entity.oil.Dlb; |
| 17 | import com.bsth.entity.oil.Ylb; | 21 | import com.bsth.entity.oil.Ylb; |
| 18 | import com.bsth.service.oil.DlbService; | 22 | import com.bsth.service.oil.DlbService; |
| 23 | +import com.bsth.util.ReportUtils; | ||
| 19 | import com.google.common.base.Splitter; | 24 | import com.google.common.base.Splitter; |
| 20 | 25 | ||
| 21 | @RestController | 26 | @RestController |
| @@ -70,11 +75,17 @@ public class DlbController extends BaseController<Dlb, Integer>{ | @@ -70,11 +75,17 @@ public class DlbController extends BaseController<Dlb, Integer>{ | ||
| 70 | List<String> list = Splitter.on(",").trimResults().splitToList(order); | 75 | List<String> list = Splitter.on(",").trimResults().splitToList(order); |
| 71 | return baseService.list(map, new PageRequest(page, size, new Sort(d, list))); | 76 | return baseService.list(map, new PageRequest(page, size, new Sort(d, list))); |
| 72 | } | 77 | } |
| 78 | + @RequestMapping(value = "/dlbList",method = RequestMethod.GET) | ||
| 79 | + public List<Dlb> dlbList(@RequestParam Map<String, Object> map){ | ||
| 80 | + List<Dlb> list=service.listDlb(map); | ||
| 81 | + return list; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + | ||
| 73 | 85 | ||
| 74 | @RequestMapping(value = "/obtain",method = RequestMethod.GET) | 86 | @RequestMapping(value = "/obtain",method = RequestMethod.GET) |
| 75 | public Map<String, Object> obtain(@RequestParam Map<String, Object> map){ | 87 | public Map<String, Object> obtain(@RequestParam Map<String, Object> map){ |
| 76 | Map<String, Object> list=service.obtain(map); | 88 | Map<String, Object> list=service.obtain(map); |
| 77 | - System.out.println(); | ||
| 78 | return list; | 89 | return list; |
| 79 | } | 90 | } |
| 80 | 91 | ||
| @@ -99,4 +110,75 @@ public class DlbController extends BaseController<Dlb, Integer>{ | @@ -99,4 +110,75 @@ public class DlbController extends BaseController<Dlb, Integer>{ | ||
| 99 | Map<String, Object> list=service.checkDl(map); | 110 | Map<String, Object> list=service.checkDl(map); |
| 100 | return list; | 111 | return list; |
| 101 | } | 112 | } |
| 113 | + | ||
| 114 | + @RequestMapping(value = "/sumYlb",method = RequestMethod.GET) | ||
| 115 | + public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){ | ||
| 116 | + Map<String, Object> list=service.sumYlb(map); | ||
| 117 | + return list; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + @RequestMapping(value = "/saveDlbList",method = RequestMethod.POST) | ||
| 121 | + public Map<String, Object> saveDlbList(@RequestParam Map<String, Object> map){ | ||
| 122 | + Map<String, Object> list=new HashMap<String, Object>(); | ||
| 123 | + try { | ||
| 124 | + list = service.saveDlbList(map); | ||
| 125 | + } catch (Exception e) { | ||
| 126 | + // TODO Auto-generated catch block | ||
| 127 | + e.printStackTrace(); | ||
| 128 | + } | ||
| 129 | + return list; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + | ||
| 133 | + @RequestMapping(value = "/listExport",method = RequestMethod.POST) | ||
| 134 | + public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){ | ||
| 135 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | ||
| 136 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | ||
| 137 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 138 | + ReportUtils ee = new ReportUtils(); | ||
| 139 | + List<Dlb> dlb= service.listDlb(map); | ||
| 140 | +// (new CustomerSpecs<Ylb>(map)).iterator(); | ||
| 141 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 142 | + for (Dlb y : dlb) { | ||
| 143 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 144 | + m.put("rq", y.getRq()); | ||
| 145 | + m.put("gsname",y.getGsname() ); | ||
| 146 | + m.put("xlname", y.getXlname()); | ||
| 147 | + m.put("nbbm", y.getNbbm()); | ||
| 148 | + m.put("jsy", y.getJsy()); | ||
| 149 | + m.put("cdl", y.getCdl()); | ||
| 150 | + m.put("czcd", y.getCzcd()+"%"); | ||
| 151 | + m.put("jzcd", y.getJzcd()+"%"); | ||
| 152 | + m.put("hd", y.getHd()); | ||
| 153 | + String shyy ="无"; | ||
| 154 | + if(y.getShyy()!=null){ | ||
| 155 | + if(shyy.equals("1")){shyy="票务用油";} | ||
| 156 | + else if(shyy.equals("2")){shyy="保养用油";} | ||
| 157 | + else if(shyy.equals("3")){shyy="报废车用油";} | ||
| 158 | + else if(shyy.equals("4")){shyy="其它用油";} | ||
| 159 | + else if(shyy.equals("5")){shyy="人保部";} | ||
| 160 | + else if(shyy.equals("6")){shyy="车队";} | ||
| 161 | + else if(shyy.equals("7")){shyy="车间(高保)";} | ||
| 162 | + else if(shyy.equals("8")){shyy="车间(小修)";} | ||
| 163 | + else{shyy ="无";} | ||
| 164 | + } | ||
| 165 | + m.put("shyy", shyy); | ||
| 166 | + m.put("sh", y.getSh()); | ||
| 167 | + m.put("zlc", y.getZlc()); | ||
| 168 | + m.put("bglyh", y.getBglyh()); | ||
| 169 | + resList.add(m); | ||
| 170 | + } | ||
| 171 | + try { | ||
| 172 | + listI.add(resList.iterator()); | ||
| 173 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | ||
| 174 | + ee.excelReplace(listI, new Object[] { map }, path+"mould/listDl.xls", | ||
| 175 | + path+"export/"+map.get("rq").toString()+ "进出场存电量.xls"); | ||
| 176 | + } catch (Exception e) { | ||
| 177 | + e.printStackTrace(); | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + return resList; | ||
| 181 | + | ||
| 182 | + } | ||
| 183 | + | ||
| 102 | } | 184 | } |
src/main/java/com/bsth/controller/oil/YlxxbController.java
| 1 | package com.bsth.controller.oil; | 1 | package com.bsth.controller.oil; |
| 2 | 2 | ||
| 3 | +import java.util.HashMap; | ||
| 3 | import java.util.Map; | 4 | import java.util.Map; |
| 4 | 5 | ||
| 5 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -33,9 +34,15 @@ public class YlxxbController extends BaseController<Ylxxb, Integer>{ | @@ -33,9 +34,15 @@ public class YlxxbController extends BaseController<Ylxxb, Integer>{ | ||
| 33 | * @param map | 34 | * @param map |
| 34 | * @return | 35 | * @return |
| 35 | */ | 36 | */ |
| 36 | - @RequestMapping(value = "/check",method = RequestMethod.GET) | 37 | + @RequestMapping(value = "/check",method = RequestMethod.POST) |
| 37 | public Map<String, Object> check(@RequestParam Map<String, Object> map){ | 38 | public Map<String, Object> check(@RequestParam Map<String, Object> map){ |
| 38 | - Map<String, Object> list=service.checkJsy(map); | 39 | + Map<String, Object> list=new HashMap<>(); |
| 40 | + try { | ||
| 41 | + list = service.checkJsy(map); | ||
| 42 | + } catch (Exception e) { | ||
| 43 | + // TODO Auto-generated catch block | ||
| 44 | + e.printStackTrace(); | ||
| 45 | + } | ||
| 39 | return list; | 46 | return list; |
| 40 | } | 47 | } |
| 41 | } | 48 | } |
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
| @@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON; | @@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON; | ||
| 4 | import com.alibaba.fastjson.serializer.PropertyFilter; | 4 | import com.alibaba.fastjson.serializer.PropertyFilter; |
| 5 | import com.bsth.common.ResponseCode; | 5 | import com.bsth.common.ResponseCode; |
| 6 | import com.bsth.data.BasicData; | 6 | import com.bsth.data.BasicData; |
| 7 | +import com.bsth.entity.Line; | ||
| 8 | +import com.google.common.collect.ArrayListMultimap; | ||
| 7 | import org.slf4j.Logger; | 9 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 10 | import org.slf4j.LoggerFactory; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -11,9 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -11,9 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
| 11 | import org.springframework.web.bind.annotation.RequestMethod; | 13 | import org.springframework.web.bind.annotation.RequestMethod; |
| 12 | import org.springframework.web.bind.annotation.RestController; | 14 | import org.springframework.web.bind.annotation.RestController; |
| 13 | 15 | ||
| 14 | -import java.util.HashMap; | ||
| 15 | -import java.util.List; | ||
| 16 | -import java.util.Map; | 16 | +import java.util.*; |
| 17 | 17 | ||
| 18 | @RestController | 18 | @RestController |
| 19 | @RequestMapping("/basic") | 19 | @RequestMapping("/basic") |
| @@ -126,4 +126,23 @@ public class BasicDataController { | @@ -126,4 +126,23 @@ public class BasicDataController { | ||
| 126 | public Map<String, String> nbbm2PlateNo(){ | 126 | public Map<String, String> nbbm2PlateNo(){ |
| 127 | return basicData.getNbbm2PlateNo(); | 127 | return basicData.getNbbm2PlateNo(); |
| 128 | } | 128 | } |
| 129 | + | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * 获取线路配车信息 | ||
| 133 | + * @return | ||
| 134 | + */ | ||
| 135 | + @RequestMapping("/ccInfo") | ||
| 136 | + public Map<String, Collection<String>> ccInfo(){ | ||
| 137 | + | ||
| 138 | + ArrayListMultimap<String, String> listMultimap = ArrayListMultimap.create(); | ||
| 139 | + Set<String> ks = BasicData.nbbm2LineMap.keySet(); | ||
| 140 | + | ||
| 141 | + Line line; | ||
| 142 | + for(String nbbm : ks){ | ||
| 143 | + line = BasicData.nbbm2LineMap.get(nbbm); | ||
| 144 | + listMultimap.put(line.getLineCode(), nbbm); | ||
| 145 | + } | ||
| 146 | + return listMultimap.asMap(); | ||
| 147 | + } | ||
| 129 | } | 148 | } |
src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
| @@ -14,39 +14,91 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ | @@ -14,39 +14,91 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ | ||
| 14 | 14 | ||
| 15 | @Autowired | 15 | @Autowired |
| 16 | LineConfigService lineConfigService; | 16 | LineConfigService lineConfigService; |
| 17 | - | 17 | + |
| 18 | + /** | ||
| 19 | + * 检查是否有线路配置信息 | ||
| 20 | + * @param codeArray | ||
| 21 | + * @return | ||
| 22 | + */ | ||
| 18 | @RequestMapping("/check") | 23 | @RequestMapping("/check") |
| 19 | public Map<String, Object> check(@RequestParam String[] codeArray){ | 24 | public Map<String, Object> check(@RequestParam String[] codeArray){ |
| 20 | return lineConfigService.check(codeArray); | 25 | return lineConfigService.check(codeArray); |
| 21 | } | 26 | } |
| 22 | - | 27 | + |
| 28 | + /** | ||
| 29 | + * 初始化线路配置 | ||
| 30 | + * @param lineCode | ||
| 31 | + * @return | ||
| 32 | + * @throws Exception | ||
| 33 | + */ | ||
| 23 | @RequestMapping("/init/{lineCode}") | 34 | @RequestMapping("/init/{lineCode}") |
| 24 | public Integer init(@PathVariable("lineCode") String lineCode) throws Exception{ | 35 | public Integer init(@PathVariable("lineCode") String lineCode) throws Exception{ |
| 25 | return lineConfigService.init(lineCode); | 36 | return lineConfigService.init(lineCode); |
| 26 | } | 37 | } |
| 27 | - | 38 | + |
| 39 | + /** | ||
| 40 | + * 修改班次刷新时间 | ||
| 41 | + * @param time | ||
| 42 | + * @param lineCode | ||
| 43 | + * @return | ||
| 44 | + */ | ||
| 28 | @RequestMapping(value = "/editTime", method = RequestMethod.POST) | 45 | @RequestMapping(value = "/editTime", method = RequestMethod.POST) |
| 29 | public Map<String, Object> editStartOptTime(@RequestParam String time,@RequestParam String lineCode){ | 46 | public Map<String, Object> editStartOptTime(@RequestParam String time,@RequestParam String lineCode){ |
| 30 | return lineConfigService.editStartOptTime(time, lineCode); | 47 | return lineConfigService.editStartOptTime(time, lineCode); |
| 31 | } | 48 | } |
| 32 | - | 49 | + |
| 50 | + /** | ||
| 51 | + * 修改出场时间类型 | ||
| 52 | + * @param lineCode | ||
| 53 | + * @param type | ||
| 54 | + * @return | ||
| 55 | + */ | ||
| 33 | @RequestMapping(value = "/editOutTimeType", method = RequestMethod.POST) | 56 | @RequestMapping(value = "/editOutTimeType", method = RequestMethod.POST) |
| 34 | - public Map<String, Object> editOutTimeType(@RequestParam String lineCode, @RequestParam int type){ | ||
| 35 | - return lineConfigService.editOutTimeType(lineCode, type); | 57 | + public Map<String, Object> editOutTimeType(@RequestParam String lineCode, @RequestParam int type,@RequestParam String parkCode,@RequestParam String stationCode){ |
| 58 | + return lineConfigService.editOutTimeType(lineCode, type, parkCode, stationCode); | ||
| 36 | } | 59 | } |
| 37 | 60 | ||
| 61 | + /** | ||
| 62 | + * 启用原线路回场 | ||
| 63 | + * @param lineCode | ||
| 64 | + * @param enable | ||
| 65 | + * @return | ||
| 66 | + */ | ||
| 38 | @RequestMapping(value = "/enableInParkForSource", method = RequestMethod.POST) | 67 | @RequestMapping(value = "/enableInParkForSource", method = RequestMethod.POST) |
| 39 | public Map<String, Object> enableInParkForSource(@RequestParam String lineCode, @RequestParam int enable){ | 68 | public Map<String, Object> enableInParkForSource(@RequestParam String lineCode, @RequestParam int enable){ |
| 40 | return lineConfigService.enableInParkForSource(lineCode, enable); | 69 | return lineConfigService.enableInParkForSource(lineCode, enable); |
| 41 | } | 70 | } |
| 42 | 71 | ||
| 72 | + /** | ||
| 73 | + * 根据线路编码获取配置信息 | ||
| 74 | + * @param lineCode | ||
| 75 | + * @return | ||
| 76 | + */ | ||
| 43 | @RequestMapping(value = "/getByLineCode") | 77 | @RequestMapping(value = "/getByLineCode") |
| 44 | public LineConfig getByLineCode(@RequestParam String lineCode){ | 78 | public LineConfig getByLineCode(@RequestParam String lineCode){ |
| 45 | return lineConfigService.getByLineCode(lineCode); | 79 | return lineConfigService.getByLineCode(lineCode); |
| 46 | } | 80 | } |
| 47 | 81 | ||
| 82 | + /** | ||
| 83 | + * 到站缓冲区设置 | ||
| 84 | + * @param lineCode | ||
| 85 | + * @param field | ||
| 86 | + * @param value | ||
| 87 | + * @return | ||
| 88 | + */ | ||
| 48 | @RequestMapping(value = "/bufferTimeDiff", method = RequestMethod.POST) | 89 | @RequestMapping(value = "/bufferTimeDiff", method = RequestMethod.POST) |
| 49 | public Map<String, Object> bufferTimeDiff(@RequestParam String lineCode, @RequestParam String field,@RequestParam String value){ | 90 | public Map<String, Object> bufferTimeDiff(@RequestParam String lineCode, @RequestParam String field,@RequestParam String value){ |
| 50 | return lineConfigService.bufferTimeDiff(lineCode, field, value); | 91 | return lineConfigService.bufferTimeDiff(lineCode, field, value); |
| 51 | } | 92 | } |
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * 应急停靠设置 | ||
| 96 | + * @param map | ||
| 97 | + * @return | ||
| 98 | + */ | ||
| 99 | + @RequestMapping(value = "/yjtkSet", method = RequestMethod.POST) | ||
| 100 | + public Map<String, Object> yjtkSet(@RequestParam Map<String, String> map){ | ||
| 101 | + //System.out.println(map); | ||
| 102 | + return lineConfigService.yjtkSet(map); | ||
| 103 | + } | ||
| 52 | } | 104 | } |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| 1 | package com.bsth.controller.realcontrol; | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONArray; | 3 | import com.alibaba.fastjson.JSONArray; |
| 4 | +import com.bsth.common.ResponseCode; | ||
| 4 | import com.bsth.controller.BaseController; | 5 | import com.bsth.controller.BaseController; |
| 5 | import com.bsth.controller.realcontrol.dto.ChangePersonCar; | 6 | import com.bsth.controller.realcontrol.dto.ChangePersonCar; |
| 6 | import com.bsth.controller.realcontrol.dto.DfsjChange; | 7 | import com.bsth.controller.realcontrol.dto.DfsjChange; |
| @@ -368,9 +369,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -368,9 +369,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 368 | } | 369 | } |
| 369 | 370 | ||
| 370 | @RequestMapping(value="/statisticsDailyTj") | 371 | @RequestMapping(value="/statisticsDailyTj") |
| 371 | - public List<Map<String,Object>> statisticsDailyTj(@RequestParam String line, @RequestParam String date, | 372 | + public List<Map<String,Object>> statisticsDailyTj(@RequestParam String gsdm,@RequestParam String fgsdm, @RequestParam String line, @RequestParam String date, |
| 372 | @RequestParam String date2,@RequestParam String xlName, @RequestParam String type){ | 373 | @RequestParam String date2,@RequestParam String xlName, @RequestParam String type){ |
| 373 | - return scheduleRealInfoService.statisticsDailyTj(line, date,date2, xlName, type); | 374 | + return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type); |
| 374 | } | 375 | } |
| 375 | 376 | ||
| 376 | @RequestMapping(value="/MapById",method = RequestMethod.GET) | 377 | @RequestMapping(value="/MapById",method = RequestMethod.GET) |
| @@ -486,4 +487,33 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -486,4 +487,33 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 486 | public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){ | 487 | public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){ |
| 487 | return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type); | 488 | return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type); |
| 488 | } | 489 | } |
| 490 | + | ||
| 491 | + /** | ||
| 492 | + * 删除当日实际排班 | ||
| 493 | + * @return | ||
| 494 | + */ | ||
| 495 | + @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST) | ||
| 496 | + public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){ | ||
| 497 | + return dayOfSchedule.deleteRealSchedule(lineCode); | ||
| 498 | + } | ||
| 499 | + | ||
| 500 | + /** | ||
| 501 | + * 从计划表重新加载当日排班 | ||
| 502 | + * @param lineCode | ||
| 503 | + * @return | ||
| 504 | + */ | ||
| 505 | + @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST) | ||
| 506 | + public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){ | ||
| 507 | + Map<String, Object> rs = new HashMap<>(); | ||
| 508 | + List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode); | ||
| 509 | + if(list != null && list.size() > 0){ | ||
| 510 | + rs.put("status", ResponseCode.ERROR); | ||
| 511 | + rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。"); | ||
| 512 | + return rs; | ||
| 513 | + } | ||
| 514 | + | ||
| 515 | + int code = dayOfSchedule.reloadSch(lineCode); | ||
| 516 | + rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR); | ||
| 517 | + return rs; | ||
| 518 | + } | ||
| 489 | } | 519 | } |
src/main/java/com/bsth/controller/report/ReportController.java
| @@ -21,17 +21,17 @@ public class ReportController { | @@ -21,17 +21,17 @@ public class ReportController { | ||
| 21 | @Autowired | 21 | @Autowired |
| 22 | ReportService service; | 22 | ReportService service; |
| 23 | 23 | ||
| 24 | - @RequestMapping(value="/queryListBczx" ,method = RequestMethod.POST) | 24 | + @RequestMapping(value="/queryListBczx" ,method = RequestMethod.GET) |
| 25 | public List<ScheduleRealInfo> queryListBczx(@RequestParam String clzbh,@RequestParam String line,@RequestParam String date){ | 25 | public List<ScheduleRealInfo> queryListBczx(@RequestParam String clzbh,@RequestParam String line,@RequestParam String date){ |
| 26 | return service.queryListBczx(line,date,clzbh); | 26 | return service.queryListBczx(line,date,clzbh); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | - @RequestMapping(value="/queryListZdxx" ,method = RequestMethod.POST) | 29 | + @RequestMapping(value="/queryListZdxx" ,method = RequestMethod.GET) |
| 30 | public List<ArrivalInfo> queryListZdxx(@RequestParam String clzbh,@RequestParam String line, | 30 | public List<ArrivalInfo> queryListZdxx(@RequestParam String clzbh,@RequestParam String line, |
| 31 | @RequestParam String date,@RequestParam String fcsj,@RequestParam String ddsj){ | 31 | @RequestParam String date,@RequestParam String fcsj,@RequestParam String ddsj){ |
| 32 | return service.queryListZdxx(line,date,clzbh,fcsj,ddsj); | 32 | return service.queryListZdxx(line,date,clzbh,fcsj,ddsj); |
| 33 | } | 33 | } |
| 34 | - @RequestMapping(value="/queryListClzd" ,method = RequestMethod.POST) | 34 | + @RequestMapping(value="/queryListClzd" ,method = RequestMethod.GET) |
| 35 | public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line, | 35 | public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line, |
| 36 | @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){ | 36 | @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){ |
| 37 | return service.queryListClzd(line,zd,zdlx,fcsj,ddsj); | 37 | return service.queryListClzd(line,zd,zdlx,fcsj,ddsj); |
| @@ -108,4 +108,9 @@ public class ReportController { | @@ -108,4 +108,9 @@ public class ReportController { | ||
| 108 | return service.carList(map); | 108 | return service.carList(map); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | + @RequestMapping(value="/userList",method = RequestMethod.GET) | ||
| 112 | + public List<Map<String,String>> userList(@RequestParam Map<String, Object> map){ | ||
| 113 | + return service.userList(map); | ||
| 114 | + } | ||
| 115 | + | ||
| 111 | } | 116 | } |
src/main/java/com/bsth/data/BasicData.java
| @@ -68,6 +68,8 @@ public class BasicData implements CommandLineRunner { | @@ -68,6 +68,8 @@ public class BasicData implements CommandLineRunner { | ||
| 68 | public static Map<String, Personnel> jsyMap; | 68 | public static Map<String, Personnel> jsyMap; |
| 69 | //售票员工号 和 personnel 对象映射 | 69 | //售票员工号 和 personnel 对象映射 |
| 70 | public static Map<String, Personnel> spyMap; | 70 | public static Map<String, Personnel> spyMap; |
| 71 | + //所以员工和personnerl 对象映射 | ||
| 72 | + public static Map<String, Personnel> perMap; | ||
| 71 | //全量员工 工号和姓名对照 | 73 | //全量员工 工号和姓名对照 |
| 72 | public static Map<String, String> allPerson; | 74 | public static Map<String, String> allPerson; |
| 73 | 75 | ||
| @@ -310,7 +312,7 @@ public class BasicData implements CommandLineRunner { | @@ -310,7 +312,7 @@ public class BasicData implements CommandLineRunner { | ||
| 310 | public void loadPersonnelInfo() { | 312 | public void loadPersonnelInfo() { |
| 311 | Iterator<Personnel> iterator = personnelRepository.findAll().iterator(); | 313 | Iterator<Personnel> iterator = personnelRepository.findAll().iterator(); |
| 312 | 314 | ||
| 313 | - Map<String, Personnel> jsyTempMap = new HashMap<>(), spyTempMap = new HashMap<>(); | 315 | + Map<String, Personnel> jsyTempMap = new HashMap<>(), spyTempMap = new HashMap<>(),perTempMap=new HashMap<>(); |
| 314 | Map<String, String> allPersonMap = new HashMap<>(); | 316 | Map<String, String> allPersonMap = new HashMap<>(); |
| 315 | 317 | ||
| 316 | Personnel p; | 318 | Personnel p; |
| @@ -328,13 +330,15 @@ public class BasicData implements CommandLineRunner { | @@ -328,13 +330,15 @@ public class BasicData implements CommandLineRunner { | ||
| 328 | else if (p.getPosts().equals("2")) | 330 | else if (p.getPosts().equals("2")) |
| 329 | spyTempMap.put(jobCode, p); | 331 | spyTempMap.put(jobCode, p); |
| 330 | } | 332 | } |
| 331 | - | 333 | + |
| 334 | + perTempMap.put(jobCode, p); | ||
| 332 | allPersonMap.put(jobCode, p.getPersonnelName()); | 335 | allPersonMap.put(jobCode, p.getPersonnelName()); |
| 333 | } | 336 | } |
| 334 | 337 | ||
| 335 | jsyMap = jsyTempMap; | 338 | jsyMap = jsyTempMap; |
| 336 | spyMap = spyTempMap; | 339 | spyMap = spyTempMap; |
| 337 | allPerson = allPersonMap; | 340 | allPerson = allPersonMap; |
| 341 | + perMap = perTempMap; | ||
| 338 | } | 342 | } |
| 339 | } | 343 | } |
| 340 | } | 344 | } |
src/main/java/com/bsth/data/LineConfigData.java
| 1 | package com.bsth.data; | 1 | package com.bsth.data; |
| 2 | 2 | ||
| 3 | +import com.bsth.Application; | ||
| 3 | import com.bsth.entity.Line; | 4 | import com.bsth.entity.Line; |
| 4 | import com.bsth.entity.realcontrol.D80ReplyTemp; | 5 | import com.bsth.entity.realcontrol.D80ReplyTemp; |
| 5 | import com.bsth.entity.realcontrol.LineConfig; | 6 | import com.bsth.entity.realcontrol.LineConfig; |
| 6 | -import com.bsth.oplog.normal.OpLogger; | 7 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 7 | import com.bsth.service.LineService; | 8 | import com.bsth.service.LineService; |
| 8 | import com.bsth.service.realcontrol.LineConfigService; | 9 | import com.bsth.service.realcontrol.LineConfigService; |
| 9 | import org.slf4j.Logger; | 10 | import org.slf4j.Logger; |
| @@ -14,101 +15,151 @@ import org.springframework.core.annotation.Order; | @@ -14,101 +15,151 @@ import org.springframework.core.annotation.Order; | ||
| 14 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
| 15 | 16 | ||
| 16 | import java.util.*; | 17 | import java.util.*; |
| 18 | +import java.util.concurrent.TimeUnit; | ||
| 17 | 19 | ||
| 18 | /** | 20 | /** |
| 19 | - * | 21 | + * @author PanZhao |
| 20 | * @ClassName: LineConfigData | 22 | * @ClassName: LineConfigData |
| 21 | * @Description: TODO(线路配置数据管理) | 23 | * @Description: TODO(线路配置数据管理) |
| 22 | - * @author PanZhao | ||
| 23 | * @date 2016年8月15日 下午2:50:19 | 24 | * @date 2016年8月15日 下午2:50:19 |
| 24 | - * | ||
| 25 | */ | 25 | */ |
| 26 | @Component | 26 | @Component |
| 27 | @Order(value = 2) | 27 | @Order(value = 2) |
| 28 | public class LineConfigData implements CommandLineRunner { | 28 | public class LineConfigData implements CommandLineRunner { |
| 29 | - | ||
| 30 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 31 | - | ||
| 32 | - // 线路编码和配置 | ||
| 33 | - private Map<String, LineConfig> lineConfMap; | ||
| 34 | - | ||
| 35 | - @Autowired | ||
| 36 | - LineConfigService lineConfigService; | ||
| 37 | - | ||
| 38 | - @Autowired | ||
| 39 | - LineService lineService; | ||
| 40 | - | ||
| 41 | - @Autowired | ||
| 42 | - OpLogger opLog; | ||
| 43 | - | ||
| 44 | - @Override | ||
| 45 | - public void run(String... arg0) throws Exception { | ||
| 46 | - lineConfMap = new HashMap<>(); | ||
| 47 | - | ||
| 48 | - Iterator<LineConfig> itr = lineConfigService.findAll().iterator(); | ||
| 49 | - while (itr.hasNext()) | ||
| 50 | - setBuffer(itr.next()); | ||
| 51 | - | ||
| 52 | - opLog.info("Line_config_data"); | ||
| 53 | - } | ||
| 54 | - | ||
| 55 | - public LineConfig get(String lineCode){ | ||
| 56 | - return lineConfMap.get(lineCode); | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - public Collection<LineConfig> getAll(){ | ||
| 60 | - return lineConfMap.values(); | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - public void set(LineConfig conf){ | ||
| 64 | - lineConfigService.save(conf); | ||
| 65 | - setBuffer(conf); | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - public void setBuffer(LineConfig conf){ | ||
| 69 | - lineConfMap.put(conf.getLine().getLineCode(), conf); | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - /** | ||
| 73 | - * | ||
| 74 | - * @Title: init | ||
| 75 | - * @Description: TODO(初始化配置信息) | ||
| 76 | - */ | ||
| 77 | - public void init(String lineCode) throws Exception{ | ||
| 78 | - LineConfig conf = new LineConfig(); | ||
| 79 | - //线路 | ||
| 80 | - Line line = lineService.findByLineCode(lineCode); | ||
| 81 | - if(null == line) | ||
| 82 | - throw new NullPointerException("异常的lineCode"); | ||
| 83 | - | ||
| 84 | - conf.setLine(line); | ||
| 85 | - //开始运营时间 | ||
| 86 | - conf.setStartOpt("02:00"); | ||
| 87 | - //托管状态 | ||
| 88 | - conf.setTrust(true); | ||
| 89 | - //出场时间类型 | ||
| 90 | - conf.setOutConfig(0); | ||
| 91 | - //进场时间类型 | ||
| 92 | - //conf.setInConfig(1); | ||
| 93 | - //短语模板 | ||
| 94 | - conf.setPhraseTemps(""); | ||
| 95 | - //调度指令模板 | ||
| 96 | - conf.setSchDirectiveTemp(""); | ||
| 97 | - | ||
| 98 | - //80指令回复 | ||
| 99 | - D80ReplyTemp t50 = new D80ReplyTemp(conf, (short)0x50, "同意,回电详谈", "不同意,请回电") | ||
| 100 | - ,t60 = new D80ReplyTemp(conf, (short)0x60, "同意,回电详谈", "不同意,请回电") | ||
| 101 | - ,tA2 = new D80ReplyTemp(conf, (short)0xA2, "同意,回电详谈", "不同意,请回电") | ||
| 102 | - ,t70 = new D80ReplyTemp(conf, (short)0x70, "同意,回电详谈", "不同意,请回电") | ||
| 103 | - ,t11 = new D80ReplyTemp(conf, (short)0x11, "同意,回电详谈", "不同意,请回电"); | ||
| 104 | - | ||
| 105 | - Set<D80ReplyTemp> temps = conf.getD80Temps(); | ||
| 106 | - temps.add(t50); | ||
| 107 | - temps.add(t60); | ||
| 108 | - temps.add(tA2); | ||
| 109 | - temps.add(t70); | ||
| 110 | - temps.add(t11); | ||
| 111 | - | ||
| 112 | - set(conf); | ||
| 113 | - } | 29 | + |
| 30 | + static Logger logger = LoggerFactory.getLogger(LineConfigData.class); | ||
| 31 | + | ||
| 32 | + // 线路编码和配置 | ||
| 33 | + private Map<String, LineConfig> lineConfMap; | ||
| 34 | + | ||
| 35 | + @Autowired | ||
| 36 | + LineConfigService lineConfigService; | ||
| 37 | + | ||
| 38 | + @Autowired | ||
| 39 | + LineService lineService; | ||
| 40 | + | ||
| 41 | + //入库缓冲 | ||
| 42 | + static LinkedList<LineConfig> saveBuffers = new LinkedList<>(); | ||
| 43 | + | ||
| 44 | + @Autowired | ||
| 45 | + LineConfigPersistThread configPersistThread; | ||
| 46 | + | ||
| 47 | + @Override | ||
| 48 | + public void run(String... arg0) throws Exception { | ||
| 49 | + lineConfMap = new HashMap<>(); | ||
| 50 | + | ||
| 51 | + Iterator<LineConfig> itr = lineConfigService.findAll().iterator(); | ||
| 52 | + while (itr.hasNext()) | ||
| 53 | + setBuffer(itr.next()); | ||
| 54 | + | ||
| 55 | + //异步入库 | ||
| 56 | + Application.mainServices.scheduleWithFixedDelay(configPersistThread, 60, 60, TimeUnit.SECONDS); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * 起点发出,应用缓冲区设置参数 | ||
| 61 | + * @param sch | ||
| 62 | + * @param timestamp | ||
| 63 | + * @return | ||
| 64 | + */ | ||
| 65 | + public long applyOut(ScheduleRealInfo sch, Long timestamp) { | ||
| 66 | + LineConfig config = lineConfMap.get(sch.getXlBm()); | ||
| 67 | + int diff = sch.getXlDir()=="0"?config.getUpOutDiff():config.getDownOutDiff(); | ||
| 68 | + return timestamp - (diff * 1000); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * 终点到达,应用缓冲区设置参数 | ||
| 73 | + * @param sch | ||
| 74 | + * @param timestamp | ||
| 75 | + * @return | ||
| 76 | + */ | ||
| 77 | + public long applyIn(ScheduleRealInfo sch, Long timestamp){ | ||
| 78 | + LineConfig config = lineConfMap.get(sch.getXlBm()); | ||
| 79 | + int diff = sch.getXlDir()=="0"?config.getUpInDiff():config.getDownInDiff(); | ||
| 80 | + return timestamp - (diff * 1000); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + @Component | ||
| 84 | + private static class LineConfigPersistThread extends Thread { | ||
| 85 | + | ||
| 86 | + @Autowired | ||
| 87 | + LineConfigService lineConfigService; | ||
| 88 | + | ||
| 89 | + @Override | ||
| 90 | + public void run() { | ||
| 91 | + LineConfig config; | ||
| 92 | + for (int i = 0; i < 800; i++) { | ||
| 93 | + config = saveBuffers.poll(); | ||
| 94 | + if (config == null) | ||
| 95 | + break; | ||
| 96 | + | ||
| 97 | + try { | ||
| 98 | + lineConfigService.save(config); | ||
| 99 | + }catch (Exception e){ | ||
| 100 | + logger.error("", e); | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + public LineConfig get(String lineCode) { | ||
| 107 | + return lineConfMap.get(lineCode); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + public Collection<LineConfig> getAll() { | ||
| 111 | + return lineConfMap.values(); | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + public void set(LineConfig conf) { | ||
| 115 | + //lineConfigService.save(conf); | ||
| 116 | + saveBuffers.add(conf); | ||
| 117 | + setBuffer(conf); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public void setBuffer(LineConfig conf) { | ||
| 121 | + lineConfMap.put(conf.getLine().getLineCode(), conf); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * @Title: init | ||
| 126 | + * @Description: TODO(初始化配置信息) | ||
| 127 | + */ | ||
| 128 | + public void init(String lineCode) throws Exception { | ||
| 129 | + LineConfig conf = new LineConfig(); | ||
| 130 | + //线路 | ||
| 131 | + Line line = lineService.findByLineCode(lineCode); | ||
| 132 | + if (null == line) | ||
| 133 | + throw new NullPointerException("异常的lineCode"); | ||
| 134 | + | ||
| 135 | + conf.setLine(line); | ||
| 136 | + //开始运营时间 | ||
| 137 | + conf.setStartOpt("02:00"); | ||
| 138 | + //托管状态 | ||
| 139 | + conf.setTrust(true); | ||
| 140 | + //出场时间类型 | ||
| 141 | + conf.setOutConfig(0); | ||
| 142 | + //进场时间类型 | ||
| 143 | + //conf.setInConfig(1); | ||
| 144 | + //短语模板 | ||
| 145 | + conf.setPhraseTemps(""); | ||
| 146 | + //调度指令模板 | ||
| 147 | + conf.setSchDirectiveTemp(""); | ||
| 148 | + | ||
| 149 | + //80指令回复 闵行用 | ||
| 150 | + D80ReplyTemp t50 = new D80ReplyTemp(conf, (short) 0x50, "同意,回电详谈", "不同意,请回电"), t60 = new D80ReplyTemp(conf, (short) 0x60, "同意,回电详谈", "不同意,请回电"), tA2 = new D80ReplyTemp(conf, (short) 0xA2, "同意,回电详谈", "不同意,请回电"), t70 = new D80ReplyTemp(conf, (short) 0x70, "同意,回电详谈", "不同意,请回电"), t11 = new D80ReplyTemp(conf, (short) 0x11, "同意,回电详谈", "不同意,请回电"); | ||
| 151 | + | ||
| 152 | + //应急停靠默认值 | ||
| 153 | + conf.setYjtkStart("00:00"); | ||
| 154 | + conf.setYjtkEnd("23:59"); | ||
| 155 | + | ||
| 156 | + Set<D80ReplyTemp> temps = conf.getD80Temps(); | ||
| 157 | + temps.add(t50); | ||
| 158 | + temps.add(t60); | ||
| 159 | + temps.add(tA2); | ||
| 160 | + temps.add(t70); | ||
| 161 | + temps.add(t11); | ||
| 162 | + | ||
| 163 | + set(conf); | ||
| 164 | + } | ||
| 114 | } | 165 | } |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/CorrectSignalHandle.java
| @@ -6,6 +6,9 @@ import com.bsth.data.gpsdata.arrival.utils.CircleQueue; | @@ -6,6 +6,9 @@ import com.bsth.data.gpsdata.arrival.utils.CircleQueue; | ||
| 6 | import com.bsth.data.schedule.DayOfSchedule; | 6 | import com.bsth.data.schedule.DayOfSchedule; |
| 7 | import com.bsth.entity.realcontrol.ChildTaskPlan; | 7 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 8 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 8 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 9 | +import com.bsth.service.directive.DirectiveService; | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | import org.springframework.stereotype.Component; | 13 | import org.springframework.stereotype.Component; |
| 11 | 14 | ||
| @@ -18,6 +21,10 @@ public class CorrectSignalHandle extends SignalHandle { | @@ -18,6 +21,10 @@ public class CorrectSignalHandle extends SignalHandle { | ||
| 18 | 21 | ||
| 19 | @Autowired | 22 | @Autowired |
| 20 | DayOfSchedule dayOfSchedule; | 23 | DayOfSchedule dayOfSchedule; |
| 24 | + @Autowired | ||
| 25 | + DirectiveService directiveService; | ||
| 26 | + | ||
| 27 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 21 | 28 | ||
| 22 | @Override | 29 | @Override |
| 23 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { | 30 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { |
| @@ -41,6 +48,11 @@ public class CorrectSignalHandle extends SignalHandle { | @@ -41,6 +48,11 @@ public class CorrectSignalHandle extends SignalHandle { | ||
| 41 | gps.setState(0); | 48 | gps.setState(0); |
| 42 | } | 49 | } |
| 43 | 50 | ||
| 51 | + /*if(gps.getState() != 0){ | ||
| 52 | + logger.info(gps.getNbbm() + " 纠正状态到营运"); | ||
| 53 | + //切换到营运状态 | ||
| 54 | + directiveService.send60Operation(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "纠正@系统"); | ||
| 55 | + }*/ | ||
| 44 | 56 | ||
| 45 | return true; | 57 | return true; |
| 46 | } | 58 | } |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
| @@ -135,8 +135,11 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -135,8 +135,11 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 135 | if(StringUtils.isNotEmpty(sch.getFcsjActual())) | 135 | if(StringUtils.isNotEmpty(sch.getFcsjActual())) |
| 136 | return; | 136 | return; |
| 137 | 137 | ||
| 138 | + //应用到离站缓冲区设置参数 | ||
| 139 | + long rsT = lineConfigData.applyOut(sch, gps.getTimestamp()); | ||
| 140 | + | ||
| 138 | //实发时间 | 141 | //实发时间 |
| 139 | - sch.setFcsjActualAll(gps.getTimestamp()); | 142 | + sch.setFcsjActualAll(rsT); |
| 140 | //通知客户端 | 143 | //通知客户端 |
| 141 | sendUtils.sendFcsj(sch); | 144 | sendUtils.sendFcsj(sch); |
| 142 | //持久化 | 145 | //持久化 |
| @@ -215,7 +218,10 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -215,7 +218,10 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 215 | if(StringUtils.isNotEmpty(sch.getZdsjActual())) | 218 | if(StringUtils.isNotEmpty(sch.getZdsjActual())) |
| 216 | return; | 219 | return; |
| 217 | 220 | ||
| 218 | - sch.setZdsjActualAll(gps.getTimestamp()); | 221 | + //应用到离站缓冲区设置参数 |
| 222 | + long rsT = lineConfigData.applyIn(sch, gps.getTimestamp()); | ||
| 223 | + | ||
| 224 | + sch.setZdsjActualAll(rsT); | ||
| 219 | //已完成班次数 | 225 | //已完成班次数 |
| 220 | int doneSum = dayOfSchedule.doneSum(sch.getClZbh()); | 226 | int doneSum = dayOfSchedule.doneSum(sch.getClZbh()); |
| 221 | ScheduleRealInfo next = dayOfSchedule.next(sch); | 227 | ScheduleRealInfo next = dayOfSchedule.next(sch); |
src/main/java/com/bsth/data/safe_driv/SafeDriv.java
0 → 100644
| 1 | +package com.bsth.data.safe_driv; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 安全驾驶 | ||
| 5 | + * Created by panzhao on 2017/4/6. | ||
| 6 | + */ | ||
| 7 | +public class SafeDriv { | ||
| 8 | + | ||
| 9 | + /** | ||
| 10 | + * 时间 | ||
| 11 | + * 2017-04-06 08:00:00.0 | ||
| 12 | + */ | ||
| 13 | + private String Startime; | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * 时间戳 | ||
| 17 | + */ | ||
| 18 | + private Long ts; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 设备编号 | ||
| 22 | + */ | ||
| 23 | + private String sbbh; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 线路名称 | ||
| 27 | + */ | ||
| 28 | + private String xlmc; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 车辆自编号 | ||
| 32 | + */ | ||
| 33 | + private String clzbh; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 车牌号 | ||
| 37 | + */ | ||
| 38 | + private String cph; | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 检查属性 | ||
| 42 | + * 双脱手 0 单脱手 1 其他为0都是异常 | ||
| 43 | + */ | ||
| 44 | + private String jctype; | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 异常种类 | ||
| 48 | + * 手部检测: 1 | ||
| 49 | + * 脸部检测: 5 | ||
| 50 | + * 摄像头检测: 2 | ||
| 51 | + * 安全带检测: 3 | ||
| 52 | + * 袖章检测: 4 | ||
| 53 | + */ | ||
| 54 | + private String yczltype; | ||
| 55 | + | ||
| 56 | + @Override | ||
| 57 | + public int hashCode() { | ||
| 58 | + return ("safe_" + (this.getClzbh() + this.getStartime())).hashCode(); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @Override | ||
| 62 | + public boolean equals(Object obj) { | ||
| 63 | + SafeDriv s2 = (SafeDriv)obj; | ||
| 64 | + return (this.getClzbh() + this.getStartime()).equals(s2.getClzbh() + s2.getStartime()); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public String getStartime() { | ||
| 68 | + return Startime; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public void setStartime(String startime) { | ||
| 72 | + Startime = startime; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public String getSbbh() { | ||
| 76 | + return sbbh; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public void setSbbh(String sbbh) { | ||
| 80 | + this.sbbh = sbbh; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public String getXlmc() { | ||
| 84 | + return xlmc; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + public void setXlmc(String xlmc) { | ||
| 88 | + this.xlmc = xlmc; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public String getClzbh() { | ||
| 92 | + return clzbh; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + public void setClzbh(String clzbh) { | ||
| 96 | + this.clzbh = clzbh; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public String getCph() { | ||
| 100 | + return cph; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + public void setCph(String cph) { | ||
| 104 | + this.cph = cph; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public String getJctype() { | ||
| 108 | + return jctype; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + public void setJctype(String jctype) { | ||
| 112 | + this.jctype = jctype; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + public String getYczltype() { | ||
| 116 | + return yczltype; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + public void setYczltype(String yczltype) { | ||
| 120 | + this.yczltype = yczltype; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public Long getTs() { | ||
| 124 | + return ts; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public void setTs(Long ts) { | ||
| 128 | + this.ts = ts; | ||
| 129 | + } | ||
| 130 | +} |
src/main/java/com/bsth/data/safe_driv/SafeDrivCenter.java
0 → 100644
| 1 | +package com.bsth.data.safe_driv; | ||
| 2 | + | ||
| 3 | +import com.bsth.Application; | ||
| 4 | +import com.bsth.websocket.handler.SendUtils; | ||
| 5 | +import org.joda.time.format.DateTimeFormat; | ||
| 6 | +import org.joda.time.format.DateTimeFormatter; | ||
| 7 | +import org.springframework.beans.BeansException; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.boot.CommandLineRunner; | ||
| 10 | +import org.springframework.context.ApplicationContext; | ||
| 11 | +import org.springframework.context.ApplicationContextAware; | ||
| 12 | +import org.springframework.stereotype.Component; | ||
| 13 | + | ||
| 14 | +import java.util.HashMap; | ||
| 15 | +import java.util.HashSet; | ||
| 16 | +import java.util.Map; | ||
| 17 | +import java.util.Set; | ||
| 18 | +import java.util.concurrent.TimeUnit; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * 安全驾驶 | ||
| 22 | + * Created by panzhao on 2017/4/6. | ||
| 23 | + */ | ||
| 24 | +@Component | ||
| 25 | +public class SafeDrivCenter implements CommandLineRunner,ApplicationContextAware { | ||
| 26 | + | ||
| 27 | + private static Set<SafeDriv> data; | ||
| 28 | + | ||
| 29 | + @Autowired | ||
| 30 | + SafeDrivDataLoadThread safeDrivDataLoadThread; | ||
| 31 | + | ||
| 32 | + static SendUtils sendUtils; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 车辆自编号 和 最新一条数据对照 | ||
| 36 | + */ | ||
| 37 | + private static Map<String, SafeDriv> safeMap; | ||
| 38 | + | ||
| 39 | + static { | ||
| 40 | + data = new HashSet<>(); | ||
| 41 | + safeMap = new HashMap<>(); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + private static DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS"); | ||
| 45 | + public static void put(SafeDriv sd){ | ||
| 46 | + sd.setTs(fmt.parseMillis(sd.getStartime())); | ||
| 47 | + data.add(sd); | ||
| 48 | + | ||
| 49 | + if(sd.getYczltype().indexOf("A") == -1) | ||
| 50 | + sd.setYczltype("A" + sd.getYczltype()); | ||
| 51 | + | ||
| 52 | + SafeDriv old = safeMap.get(sd.getClzbh()); | ||
| 53 | + if(old == null || sd.getTs() > old.getTs()){ | ||
| 54 | + //通知客户端 | ||
| 55 | + sendUtils.sendSafeDriv(sd); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + safeMap.put(sd.getClzbh(), sd); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @Override | ||
| 62 | + public void run(String... strings) throws Exception { | ||
| 63 | + //定时加载安全驾驶数据 | ||
| 64 | + Application.mainServices.scheduleWithFixedDelay(safeDrivDataLoadThread, 60, 5, TimeUnit.SECONDS); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | ||
| 69 | + sendUtils = applicationContext.getBean(SendUtils.class); | ||
| 70 | + } | ||
| 71 | +} |
src/main/java/com/bsth/data/safe_driv/SafeDrivDataLoadThread.java
0 → 100644
| 1 | +package com.bsth.data.safe_driv; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import org.apache.http.HttpEntity; | ||
| 5 | +import org.apache.http.client.methods.CloseableHttpResponse; | ||
| 6 | +import org.apache.http.client.methods.HttpGet; | ||
| 7 | +import org.apache.http.impl.client.CloseableHttpClient; | ||
| 8 | +import org.apache.http.impl.client.HttpClients; | ||
| 9 | +import org.slf4j.Logger; | ||
| 10 | +import org.slf4j.LoggerFactory; | ||
| 11 | +import org.springframework.stereotype.Component; | ||
| 12 | + | ||
| 13 | +import java.io.BufferedReader; | ||
| 14 | +import java.io.InputStreamReader; | ||
| 15 | +import java.util.List; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * 安全驾驶数据加载线程 | ||
| 19 | + * Created by panzhao on 2017/4/6. | ||
| 20 | + */ | ||
| 21 | +@Component | ||
| 22 | +public class SafeDrivDataLoadThread extends Thread{ | ||
| 23 | + | ||
| 24 | + private final static String url = "http://180.166.5.82:9988//bsth-safedriving/Crlcxb/realtimeInterface.do"; | ||
| 25 | + | ||
| 26 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 27 | + | ||
| 28 | + @Override | ||
| 29 | + public void run() { | ||
| 30 | + List<SafeDriv> list = null; | ||
| 31 | + CloseableHttpClient httpClient = null; | ||
| 32 | + CloseableHttpResponse response = null; | ||
| 33 | + try { | ||
| 34 | + httpClient = HttpClients.createDefault(); | ||
| 35 | + HttpGet get = new HttpGet(url); | ||
| 36 | + | ||
| 37 | + response = httpClient.execute(get); | ||
| 38 | + | ||
| 39 | + HttpEntity entity = response.getEntity(); | ||
| 40 | + if (null != entity) { | ||
| 41 | + BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); | ||
| 42 | + StringBuffer stringBuffer = new StringBuffer(); | ||
| 43 | + String str = ""; | ||
| 44 | + while ((str = br.readLine()) != null) | ||
| 45 | + stringBuffer.append(str); | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + list = JSON.parseArray(stringBuffer.toString(), SafeDriv.class); | ||
| 49 | + /** | ||
| 50 | + * 模拟数据 | ||
| 51 | + | ||
| 52 | + SafeDriv sd1 = new SafeDriv(); | ||
| 53 | + sd1.setYczltype("1"); | ||
| 54 | + sd1.setClzbh("W2B-001"); | ||
| 55 | + sd1.setStartime("2017-04-07 08:00:00.0"); | ||
| 56 | + | ||
| 57 | + SafeDriv sd2 = new SafeDriv(); | ||
| 58 | + sd2.setYczltype("2"); | ||
| 59 | + sd2.setClzbh("W2B-002"); | ||
| 60 | + sd2.setStartime("2017-04-07 08:02:00.0"); | ||
| 61 | + | ||
| 62 | + SafeDriv sd3 = new SafeDriv(); | ||
| 63 | + sd3.setYczltype("3"); | ||
| 64 | + sd3.setClzbh("W2B-003"); | ||
| 65 | + sd3.setStartime("2017-04-07 08:03:00.0"); | ||
| 66 | + | ||
| 67 | + SafeDriv sd4 = new SafeDriv(); | ||
| 68 | + sd4.setYczltype("4"); | ||
| 69 | + sd4.setClzbh("W2B-004"); | ||
| 70 | + sd4.setStartime("2017-04-07 08:04:00.0"); | ||
| 71 | + | ||
| 72 | + SafeDriv sd5 = new SafeDriv(); | ||
| 73 | + sd5.setYczltype("5"); | ||
| 74 | + sd5.setClzbh("W2B-005"); | ||
| 75 | + sd5.setStartime("2017-04-07 08:05:00.0"); | ||
| 76 | + | ||
| 77 | + list.add(sd1); | ||
| 78 | + list.add(sd2); | ||
| 79 | + list.add(sd3); | ||
| 80 | + list.add(sd4); | ||
| 81 | + list.add(sd5); | ||
| 82 | + */ | ||
| 83 | + for(SafeDriv sd : list){ | ||
| 84 | + SafeDrivCenter.put(sd); | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + httpClient.close(); | ||
| 89 | + response.close(); | ||
| 90 | + } catch (Exception e) { | ||
| 91 | + logger.error("", e); | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | +} |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -3,6 +3,7 @@ package com.bsth.data.schedule; | @@ -3,6 +3,7 @@ package com.bsth.data.schedule; | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.alibaba.fastjson.JSONArray; | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | import com.bsth.Application; | 5 | import com.bsth.Application; |
| 6 | +import com.bsth.common.ResponseCode; | ||
| 6 | import com.bsth.data.BasicData; | 7 | import com.bsth.data.BasicData; |
| 7 | import com.bsth.data.LineConfigData; | 8 | import com.bsth.data.LineConfigData; |
| 8 | import com.bsth.data.directive.DirectivesPstThread; | 9 | import com.bsth.data.directive.DirectivesPstThread; |
| @@ -18,7 +19,6 @@ import com.bsth.util.BatchSaveUtils; | @@ -18,7 +19,6 @@ import com.bsth.util.BatchSaveUtils; | ||
| 18 | import com.bsth.util.DateUtils; | 19 | import com.bsth.util.DateUtils; |
| 19 | import com.bsth.websocket.handler.SendUtils; | 20 | import com.bsth.websocket.handler.SendUtils; |
| 20 | import com.google.common.collect.ArrayListMultimap; | 21 | import com.google.common.collect.ArrayListMultimap; |
| 21 | -import com.google.common.collect.TreeMultimap; | ||
| 22 | import org.apache.commons.lang3.StringUtils; | 22 | import org.apache.commons.lang3.StringUtils; |
| 23 | import org.joda.time.format.DateTimeFormat; | 23 | import org.joda.time.format.DateTimeFormat; |
| 24 | import org.joda.time.format.DateTimeFormatter; | 24 | import org.joda.time.format.DateTimeFormatter; |
| @@ -56,7 +56,7 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -56,7 +56,7 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 56 | private static Map<Long, ScheduleRealInfo> id2SchedulMap; | 56 | private static Map<Long, ScheduleRealInfo> id2SchedulMap; |
| 57 | 57 | ||
| 58 | // 车辆和排班起终点站对照(包括进出的停车场,区间起终点) | 58 | // 车辆和排班起终点站对照(包括进出的停车场,区间起终点) |
| 59 | - private static TreeMultimap<String, String> nbbm2SEStationMap; | 59 | + //private static TreeMultimap<String, String> nbbm2SEStationMap; |
| 60 | 60 | ||
| 61 | //车辆 ——> 当前执行班次 | 61 | //车辆 ——> 当前执行班次 |
| 62 | private static Map<String, ScheduleRealInfo> carExecutePlanMap; | 62 | private static Map<String, ScheduleRealInfo> carExecutePlanMap; |
| @@ -99,7 +99,7 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -99,7 +99,7 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 99 | pstBuffer = new LinkedList<>(); | 99 | pstBuffer = new LinkedList<>(); |
| 100 | schFCSJComparator = new ScheduleComparator.FCSJ(); | 100 | schFCSJComparator = new ScheduleComparator.FCSJ(); |
| 101 | currSchDateMap = new HashMap<>(); | 101 | currSchDateMap = new HashMap<>(); |
| 102 | - nbbm2SEStationMap = TreeMultimap.create(); | 102 | + //nbbm2SEStationMap = TreeMultimap.create(); |
| 103 | carExecutePlanMap = new HashMap<>(); | 103 | carExecutePlanMap = new HashMap<>(); |
| 104 | 104 | ||
| 105 | schedulePlanMap = new HashMap<>(); | 105 | schedulePlanMap = new HashMap<>(); |
| @@ -244,6 +244,10 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -244,6 +244,10 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 244 | return 0; | 244 | return 0; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | + public int reloadSch(String lineCode){ | ||
| 248 | + return reloadSch(lineCode, calcSchDate(lineCode), true); | ||
| 249 | + } | ||
| 250 | + | ||
| 247 | /** | 251 | /** |
| 248 | * @Title: searchAllCars | 252 | * @Title: searchAllCars |
| 249 | * @Description: TODO(搜索班次集合中的车辆) | 253 | * @Description: TODO(搜索班次集合中的车辆) |
| @@ -480,9 +484,9 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -480,9 +484,9 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 480 | return id2SchedulMap.get(id); | 484 | return id2SchedulMap.get(id); |
| 481 | } | 485 | } |
| 482 | 486 | ||
| 483 | - public Set<String> getSEStationList(String nbbm) { | 487 | + /* public Set<String> getSEStationList(String nbbm) { |
| 484 | return nbbm2SEStationMap.get(nbbm); | 488 | return nbbm2SEStationMap.get(nbbm); |
| 485 | - } | 489 | + }*/ |
| 486 | 490 | ||
| 487 | /** | 491 | /** |
| 488 | * @Title: next | 492 | * @Title: next |
| @@ -610,8 +614,8 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -610,8 +614,8 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 610 | 614 | ||
| 611 | String nbbm = sch.getClZbh(); | 615 | String nbbm = sch.getClZbh(); |
| 612 | nbbmScheduleMap.put(nbbm, sch); | 616 | nbbmScheduleMap.put(nbbm, sch); |
| 613 | - nbbm2SEStationMap.put(nbbm, sch.getQdzCode()); | ||
| 614 | - nbbm2SEStationMap.put(nbbm, sch.getZdzCode()); | 617 | + //nbbm2SEStationMap.put(nbbm, sch.getQdzCode()); |
| 618 | + //nbbm2SEStationMap.put(nbbm, sch.getZdzCode()); | ||
| 615 | 619 | ||
| 616 | //主键索引 | 620 | //主键索引 |
| 617 | id2SchedulMap.put(sch.getId(), sch); | 621 | id2SchedulMap.put(sch.getId(), sch); |
| @@ -630,9 +634,6 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -630,9 +634,6 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 630 | //return sch; | 634 | //return sch; |
| 631 | } | 635 | } |
| 632 | 636 | ||
| 633 | -// public void calcQdzTimePlan(String nbbm){ | ||
| 634 | -// schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm)); | ||
| 635 | -// } | ||
| 636 | 637 | ||
| 637 | public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm) { | 638 | public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm) { |
| 638 | Collections.sort(nbbmScheduleMap.get(nbbm), schFCSJComparator); | 639 | Collections.sort(nbbmScheduleMap.get(nbbm), schFCSJComparator); |
| @@ -640,27 +641,6 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -640,27 +641,6 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 640 | } | 641 | } |
| 641 | 642 | ||
| 642 | /** | 643 | /** |
| 643 | - * | ||
| 644 | - * @Title: nextAll | ||
| 645 | - * @Description: TODO(之后的所有班次) | ||
| 646 | - */ | ||
| 647 | -/* public List<ScheduleRealInfo> nextAll(ScheduleRealInfo sch) { | ||
| 648 | - List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); | ||
| 649 | - // 排序 | ||
| 650 | - Collections.sort(list, schFCSJComparator); | ||
| 651 | - | ||
| 652 | - List<ScheduleRealInfo> rs = new ArrayList<>(); | ||
| 653 | - ScheduleRealInfo temp; | ||
| 654 | - for (int i = 0; i < list.size() - 1; i++) { | ||
| 655 | - temp = list.get(i); | ||
| 656 | - if(temp.getFcsjT() > sch.getFcsjT()) | ||
| 657 | - rs.add(temp); | ||
| 658 | - | ||
| 659 | - } | ||
| 660 | - return rs; | ||
| 661 | - }*/ | ||
| 662 | - | ||
| 663 | - /** | ||
| 664 | * @Title: doneSum | 644 | * @Title: doneSum |
| 665 | * @Description: TODO(已完成班次总数) | 645 | * @Description: TODO(已完成班次总数) |
| 666 | */ | 646 | */ |
| @@ -828,8 +808,8 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -828,8 +808,8 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 828 | 808 | ||
| 829 | sch.setClZbh(newClZbh); | 809 | sch.setClZbh(newClZbh); |
| 830 | nbbmScheduleMap.put(newClZbh, sch); | 810 | nbbmScheduleMap.put(newClZbh, sch); |
| 831 | - nbbm2SEStationMap.put(newClZbh, sch.getQdzCode()); | ||
| 832 | - nbbm2SEStationMap.put(newClZbh, sch.getZdzCode()); | 811 | + //nbbm2SEStationMap.put(newClZbh, sch.getQdzCode()); |
| 812 | + //nbbm2SEStationMap.put(newClZbh, sch.getZdzCode()); | ||
| 833 | 813 | ||
| 834 | //重新计算班次应到时间 | 814 | //重新计算班次应到时间 |
| 835 | ups.addAll(updateQdzTimePlan(oldClzbh)); | 815 | ups.addAll(updateQdzTimePlan(oldClzbh)); |
| @@ -876,43 +856,50 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -876,43 +856,50 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 876 | } | 856 | } |
| 877 | 857 | ||
| 878 | /** | 858 | /** |
| 879 | - * 获取班次的计划停站时间 | ||
| 880 | - * @param sch | 859 | + * 删除实际排班 |
| 860 | + * @param lineCode | ||
| 881 | * @return | 861 | * @return |
| 862 | + */ | ||
| 863 | + public Map<String, Object> deleteRealSchedule(String lineCode) { | ||
| 864 | + Map<String, Object> rs = new HashMap<>(); | ||
| 882 | 865 | ||
| 883 | - public int stopTimePlan(Object task) { | 866 | + try { |
| 867 | + String rq = currSchDateMap.get(lineCode); | ||
| 868 | + if(StringUtils.isNotEmpty(rq)){ | ||
| 869 | + //解除gps 和班次之间的关联 | ||
| 870 | + List<ScheduleRealInfo> unions = calcUnion(findByLineCode(lineCode), carExecutePlanMap.values()); | ||
| 871 | + for(ScheduleRealInfo sch : unions){ | ||
| 872 | + removeExecPlan(sch.getClZbh()); | ||
| 873 | + } | ||
| 884 | 874 | ||
| 885 | - ScheduleRealInfo sch = prev((ScheduleRealInfo) task); | 875 | + //删除班次数据 |
| 876 | + removeRealSch(lineCode, rq); | ||
| 877 | + //删除相关班次修正记录 | ||
| 878 | + } | ||
| 879 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 880 | + }catch (Exception e){ | ||
| 881 | + logger.error("", e); | ||
| 882 | + rs.put("status", ResponseCode.ERROR); | ||
| 883 | + } | ||
| 886 | 884 | ||
| 887 | - sch.getzdsj | ||
| 888 | - return -1; | ||
| 889 | - }*/ | 885 | + return rs; |
| 886 | + } | ||
| 890 | 887 | ||
| 891 | /** | 888 | /** |
| 889 | + * 计算并集 | ||
| 892 | * | 890 | * |
| 893 | - * @Title: linkToSchPlan | ||
| 894 | - * @Description: TODO(车辆关联到班次) | 891 | + * @param all |
| 892 | + * @param sub | ||
| 893 | + * @return | ||
| 895 | */ | 894 | */ |
| 896 | -/* public void linkToSchPlan(String nbbm) { | ||
| 897 | - //当前GPS状态 | ||
| 898 | - GpsEntity gps = gpsRealData.get(BasicData.deviceId2NbbmMap.inverse().get(nbbm)); | ||
| 899 | - if(null == gps) | ||
| 900 | - return; | ||
| 901 | - | ||
| 902 | - //班次集合 | ||
| 903 | - List<ScheduleRealInfo> schArr = nbbmScheduleMap.get(nbbm); | ||
| 904 | - | ||
| 905 | - for(ScheduleRealInfo sch : schArr){ | ||
| 906 | - if(sch.getStatus() == 2) | ||
| 907 | - continue; | ||
| 908 | - if(sch.isDestroy()) | ||
| 909 | - continue; | ||
| 910 | - if(!sch.getXlBm().equals(gps.getLineId()) | ||
| 911 | - || Integer.parseInt(sch.getXlDir()) != gps.getUpDown().intValue()) | ||
| 912 | - continue; | ||
| 913 | - | ||
| 914 | - addExecPlan(sch); | ||
| 915 | - break; | ||
| 916 | - } | ||
| 917 | - }*/ | 895 | + public List<ScheduleRealInfo> calcUnion(Collection<ScheduleRealInfo> c1, Collection<ScheduleRealInfo> c2) { |
| 896 | + List<ScheduleRealInfo> rs = new ArrayList<>(); | ||
| 897 | + | ||
| 898 | + for (ScheduleRealInfo sch : c1) { | ||
| 899 | + if(c2.contains(sch)){ | ||
| 900 | + rs.add(sch); | ||
| 901 | + } | ||
| 902 | + } | ||
| 903 | + return rs; | ||
| 904 | + } | ||
| 918 | } | 905 | } |
| 919 | \ No newline at end of file | 906 | \ No newline at end of file |
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
| @@ -2,7 +2,6 @@ package com.bsth.data.schedule.thread; | @@ -2,7 +2,6 @@ package com.bsth.data.schedule.thread; | ||
| 2 | 2 | ||
| 3 | import com.bsth.data.BasicData; | 3 | import com.bsth.data.BasicData; |
| 4 | import com.bsth.data.LineConfigData; | 4 | import com.bsth.data.LineConfigData; |
| 5 | -import com.bsth.data.arrival.ArrivalData_GPS; | ||
| 6 | import com.bsth.data.directive.DayOfDirectives; | 5 | import com.bsth.data.directive.DayOfDirectives; |
| 7 | import com.bsth.data.pilot80.PilotReport; | 6 | import com.bsth.data.pilot80.PilotReport; |
| 8 | import com.bsth.data.schedule.DayOfSchedule; | 7 | import com.bsth.data.schedule.DayOfSchedule; |
| @@ -29,8 +28,8 @@ public class ScheduleRefreshThread extends Thread{ | @@ -29,8 +28,8 @@ public class ScheduleRefreshThread extends Thread{ | ||
| 29 | @Autowired | 28 | @Autowired |
| 30 | DayOfSchedule dayOfSchedule; | 29 | DayOfSchedule dayOfSchedule; |
| 31 | 30 | ||
| 32 | - @Autowired | ||
| 33 | - ArrivalData_GPS arrivalData; | 31 | + /*@Autowired |
| 32 | + ArrivalData_GPS arrivalData;*/ | ||
| 34 | 33 | ||
| 35 | @Autowired | 34 | @Autowired |
| 36 | LineConfigData lineConfs; | 35 | LineConfigData lineConfs; |
| @@ -59,7 +58,7 @@ public class ScheduleRefreshThread extends Thread{ | @@ -59,7 +58,7 @@ public class ScheduleRefreshThread extends Thread{ | ||
| 59 | 58 | ||
| 60 | logger.info(lineCode + "开始翻班, " + currSchDate); | 59 | logger.info(lineCode + "开始翻班, " + currSchDate); |
| 61 | //清除进出站数据 | 60 | //清除进出站数据 |
| 62 | - arrivalData.clearRAMData(lineCode); | 61 | + //arrivalData.clearRAMData(lineCode); |
| 63 | //清除指令数据 | 62 | //清除指令数据 |
| 64 | Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode); | 63 | Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode); |
| 65 | for(String car : cars) | 64 | for(String car : cars) |
src/main/java/com/bsth/entity/oil/Dlb.java
| @@ -55,7 +55,7 @@ public class Dlb { | @@ -55,7 +55,7 @@ public class Dlb { | ||
| 55 | private Date edittime; | 55 | private Date edittime; |
| 56 | private Date createtime; | 56 | private Date createtime; |
| 57 | private int nylx; | 57 | private int nylx; |
| 58 | - //进场顺序(根据最先出场和最后进场来关联车辆的存油量) | 58 | + //进场顺序(根据最先出场和最后进场来关联车辆的存电量) |
| 59 | private int jcsx; | 59 | private int jcsx; |
| 60 | 60 | ||
| 61 | @Transient | 61 | @Transient |
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
| @@ -50,6 +50,9 @@ public class LineConfig { | @@ -50,6 +50,9 @@ public class LineConfig { | ||
| 50 | /** 出站既出场 对应的停车场 */ | 50 | /** 出站既出场 对应的停车场 */ |
| 51 | private String twinsPark; | 51 | private String twinsPark; |
| 52 | 52 | ||
| 53 | + /** 出站既出场 对应的起点站 */ | ||
| 54 | + private String twinsStation; | ||
| 55 | + | ||
| 53 | /** 短语模板 , 号分隔多个 */ | 56 | /** 短语模板 , 号分隔多个 */ |
| 54 | private String phraseTemps; | 57 | private String phraseTemps; |
| 55 | 58 | ||
| @@ -75,6 +78,15 @@ public class LineConfig { | @@ -75,6 +78,15 @@ public class LineConfig { | ||
| 75 | //下行出站 | 78 | //下行出站 |
| 76 | private int downOutDiff; | 79 | private int downOutDiff; |
| 77 | 80 | ||
| 81 | + /** | ||
| 82 | + * 应急停靠 | ||
| 83 | + */ | ||
| 84 | + private boolean enableYjtk; | ||
| 85 | + private String yjtkStart; | ||
| 86 | + private String yjtkEnd; | ||
| 87 | + private int upStopMinute; | ||
| 88 | + private int downStopMinute; | ||
| 89 | + | ||
| 78 | 90 | ||
| 79 | @OneToMany(cascade = CascadeType.ALL) | 91 | @OneToMany(cascade = CascadeType.ALL) |
| 80 | private Set<D80ReplyTemp> d80Temps = new HashSet<>(); | 92 | private Set<D80ReplyTemp> d80Temps = new HashSet<>(); |
| @@ -219,4 +231,52 @@ public class LineConfig { | @@ -219,4 +231,52 @@ public class LineConfig { | ||
| 219 | public void setTwinsPark(String twinsPark) { | 231 | public void setTwinsPark(String twinsPark) { |
| 220 | this.twinsPark = twinsPark; | 232 | this.twinsPark = twinsPark; |
| 221 | } | 233 | } |
| 234 | + | ||
| 235 | + public String getYjtkStart() { | ||
| 236 | + return yjtkStart; | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + public void setYjtkStart(String yjtkStart) { | ||
| 240 | + this.yjtkStart = yjtkStart; | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + public String getYjtkEnd() { | ||
| 244 | + return yjtkEnd; | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + public void setYjtkEnd(String yjtkEnd) { | ||
| 248 | + this.yjtkEnd = yjtkEnd; | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + public int getUpStopMinute() { | ||
| 252 | + return upStopMinute; | ||
| 253 | + } | ||
| 254 | + | ||
| 255 | + public void setUpStopMinute(int upStopMinute) { | ||
| 256 | + this.upStopMinute = upStopMinute; | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + public int getDownStopMinute() { | ||
| 260 | + return downStopMinute; | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + public void setDownStopMinute(int downStopMinute) { | ||
| 264 | + this.downStopMinute = downStopMinute; | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + public boolean isEnableYjtk() { | ||
| 268 | + return enableYjtk; | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + public void setEnableYjtk(boolean enableYjtk) { | ||
| 272 | + this.enableYjtk = enableYjtk; | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + public String getTwinsStation() { | ||
| 276 | + return twinsStation; | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | + public void setTwinsStation(String twinsStation) { | ||
| 280 | + this.twinsStation = twinsStation; | ||
| 281 | + } | ||
| 222 | } | 282 | } |
src/main/java/com/bsth/entity/schedule/SchedulePlan.java
| @@ -41,6 +41,13 @@ public class SchedulePlan extends BEntity { | @@ -41,6 +41,13 @@ public class SchedulePlan extends BEntity { | ||
| 41 | /** 使用的时刻表id列表(用逗号连接) */ | 41 | /** 使用的时刻表id列表(用逗号连接) */ |
| 42 | private String ttInfoIds; | 42 | private String ttInfoIds; |
| 43 | 43 | ||
| 44 | + /** 是否 排班计划优先 */ | ||
| 45 | + private Boolean isHistoryPlanFirst; | ||
| 46 | + | ||
| 47 | + /** 每次排班的结果数据(错误,正确提示都在这里) */ | ||
| 48 | + @Column(length = 2000) | ||
| 49 | + private String planResult; | ||
| 50 | + | ||
| 44 | @JsonIgnore | 51 | @JsonIgnore |
| 45 | /** 使用中间表的一对多关联 明细信息 */ | 52 | /** 使用中间表的一对多关联 明细信息 */ |
| 46 | @OneToMany(mappedBy = "schedulePlan", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | 53 | @OneToMany(mappedBy = "schedulePlan", cascade = CascadeType.ALL, fetch = FetchType.LAZY) |
| @@ -101,4 +108,20 @@ public class SchedulePlan extends BEntity { | @@ -101,4 +108,20 @@ public class SchedulePlan extends BEntity { | ||
| 101 | public void setTtInfoIds(String ttInfoIds) { | 108 | public void setTtInfoIds(String ttInfoIds) { |
| 102 | this.ttInfoIds = ttInfoIds; | 109 | this.ttInfoIds = ttInfoIds; |
| 103 | } | 110 | } |
| 111 | + | ||
| 112 | + public Boolean getIsHistoryPlanFirst() { | ||
| 113 | + return isHistoryPlanFirst; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public void setIsHistoryPlanFirst(Boolean isHistoryPlanFirst) { | ||
| 117 | + this.isHistoryPlanFirst = isHistoryPlanFirst; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public String getPlanResult() { | ||
| 121 | + return planResult; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public void setPlanResult(String planResult) { | ||
| 125 | + this.planResult = planResult; | ||
| 126 | + } | ||
| 104 | } | 127 | } |
src/main/java/com/bsth/entity/schedule/temp/SchedulePlanRuleResult.java
| 1 | -package com.bsth.entity.schedule.temp; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.schedule.SchedulePlan; | ||
| 4 | - | ||
| 5 | -import javax.persistence.Entity; | ||
| 6 | -import javax.persistence.GeneratedValue; | ||
| 7 | -import javax.persistence.Id; | ||
| 8 | -import javax.persistence.Table; | ||
| 9 | -import java.util.Date; | ||
| 10 | - | ||
| 11 | -/** | ||
| 12 | - * 排班的中间结果数据,记录每次排班后规则的变化。 | ||
| 13 | - */ | ||
| 14 | -@Entity | ||
| 15 | -@Table(name = "bsth_c_s_sp_rule_rst") | ||
| 16 | -public class SchedulePlanRuleResult { | ||
| 17 | - /** 主键Id */ | ||
| 18 | - @Id | ||
| 19 | - @GeneratedValue | ||
| 20 | - private Long id; | ||
| 21 | - | ||
| 22 | - /** 线路id */ | ||
| 23 | - private String xlId; | ||
| 24 | - /** 线路名字 */ | ||
| 25 | - private String xlName; | ||
| 26 | - | ||
| 27 | - /** 排班规则id */ | ||
| 28 | - private String ruleId; | ||
| 29 | - /** 车辆配置id */ | ||
| 30 | - private String ccId; | ||
| 31 | - /** 车辆自编号 */ | ||
| 32 | - private String ccZbh; | ||
| 33 | - | ||
| 34 | - /** 路牌id列表字符串 */ | ||
| 35 | - private String gids; | ||
| 36 | - /** 路牌名字列表字符串 */ | ||
| 37 | - private String gnames; | ||
| 38 | - /** 翻到哪个路牌索引 */ | ||
| 39 | - private String gidindex; | ||
| 40 | - /** 人员配置id列表字符串 */ | ||
| 41 | - private String ecids; | ||
| 42 | - /** 人员配置搭班编码列表字符串 */ | ||
| 43 | - private String ecdbbms; | ||
| 44 | - /** 翻到哪个人员配置索引 */ | ||
| 45 | - private String ecindex; | ||
| 46 | - | ||
| 47 | - /** 时刻表id */ | ||
| 48 | - private String ttinfoId; | ||
| 49 | - /** 时刻表名字 */ | ||
| 50 | - private String ttinfoName; | ||
| 51 | - | ||
| 52 | - /** 排班日期 */ | ||
| 53 | - private Date scheduleDate; | ||
| 54 | - | ||
| 55 | - /** 操作人员id */ | ||
| 56 | - private String sysuserId; | ||
| 57 | - /** 操作人员姓名 */ | ||
| 58 | - private String sysuserName; | ||
| 59 | - /** 操作时间 */ | ||
| 60 | - private Date createDate; | ||
| 61 | - | ||
| 62 | - public SchedulePlanRuleResult() { | ||
| 63 | - | ||
| 64 | - } | ||
| 65 | - public SchedulePlanRuleResult(SchedulePlan schedulePlan) { | ||
| 66 | - this.sysuserId = schedulePlan.getCreateBy().getId().toString(); | ||
| 67 | - this.sysuserName = schedulePlan.getCreateBy().getName(); | ||
| 68 | -// this.createDate = schedulePlan.getCreateDate(); | ||
| 69 | - this.createDate = new Date(); | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - public Long getId() { | ||
| 73 | - return id; | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - public void setId(Long id) { | ||
| 77 | - this.id = id; | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - public String getRuleId() { | ||
| 81 | - return ruleId; | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - public void setRuleId(String ruleId) { | ||
| 85 | - this.ruleId = ruleId; | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - public String getCcId() { | ||
| 89 | - return ccId; | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - public void setCcId(String ccId) { | ||
| 93 | - this.ccId = ccId; | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | - public String getCcZbh() { | ||
| 97 | - return ccZbh; | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - public void setCcZbh(String ccZbh) { | ||
| 101 | - this.ccZbh = ccZbh; | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - public String getGids() { | ||
| 105 | - return gids; | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - public void setGids(String gids) { | ||
| 109 | - this.gids = gids; | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - public String getGnames() { | ||
| 113 | - return gnames; | ||
| 114 | - } | ||
| 115 | - | ||
| 116 | - public void setGnames(String gnames) { | ||
| 117 | - this.gnames = gnames; | ||
| 118 | - } | ||
| 119 | - | ||
| 120 | - public String getGidindex() { | ||
| 121 | - return gidindex; | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - public void setGidindex(String gidindex) { | ||
| 125 | - this.gidindex = gidindex; | ||
| 126 | - } | ||
| 127 | - | ||
| 128 | - public String getEcids() { | ||
| 129 | - return ecids; | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - public void setEcids(String ecids) { | ||
| 133 | - this.ecids = ecids; | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | - public String getEcdbbms() { | ||
| 137 | - return ecdbbms; | ||
| 138 | - } | ||
| 139 | - | ||
| 140 | - public void setEcdbbms(String ecdbbms) { | ||
| 141 | - this.ecdbbms = ecdbbms; | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - public String getEcindex() { | ||
| 145 | - return ecindex; | ||
| 146 | - } | ||
| 147 | - | ||
| 148 | - public void setEcindex(String ecindex) { | ||
| 149 | - this.ecindex = ecindex; | ||
| 150 | - } | ||
| 151 | - | ||
| 152 | - public Date getScheduleDate() { | ||
| 153 | - return scheduleDate; | ||
| 154 | - } | ||
| 155 | - | ||
| 156 | - public void setScheduleDate(Date scheduleDate) { | ||
| 157 | - this.scheduleDate = scheduleDate; | ||
| 158 | - } | ||
| 159 | - | ||
| 160 | - public String getSysuserId() { | ||
| 161 | - return sysuserId; | ||
| 162 | - } | ||
| 163 | - | ||
| 164 | - public void setSysuserId(String sysuserId) { | ||
| 165 | - this.sysuserId = sysuserId; | ||
| 166 | - } | ||
| 167 | - | ||
| 168 | - public String getSysuserName() { | ||
| 169 | - return sysuserName; | ||
| 170 | - } | ||
| 171 | - | ||
| 172 | - public void setSysuserName(String sysuserName) { | ||
| 173 | - this.sysuserName = sysuserName; | ||
| 174 | - } | ||
| 175 | - | ||
| 176 | - public Date getCreateDate() { | ||
| 177 | - return createDate; | ||
| 178 | - } | ||
| 179 | - | ||
| 180 | - public void setCreateDate(Date createDate) { | ||
| 181 | - this.createDate = createDate; | ||
| 182 | - } | ||
| 183 | - | ||
| 184 | - public String getXlId() { | ||
| 185 | - return xlId; | ||
| 186 | - } | ||
| 187 | - | ||
| 188 | - public void setXlId(String xlId) { | ||
| 189 | - this.xlId = xlId; | ||
| 190 | - } | ||
| 191 | - | ||
| 192 | - public String getXlName() { | ||
| 193 | - return xlName; | ||
| 194 | - } | ||
| 195 | - | ||
| 196 | - public void setXlName(String xlName) { | ||
| 197 | - this.xlName = xlName; | ||
| 198 | - } | ||
| 199 | - | ||
| 200 | - public String getTtinfoId() { | ||
| 201 | - return ttinfoId; | ||
| 202 | - } | ||
| 203 | - | ||
| 204 | - public void setTtinfoId(String ttinfoId) { | ||
| 205 | - this.ttinfoId = ttinfoId; | ||
| 206 | - } | ||
| 207 | - | ||
| 208 | - public String getTtinfoName() { | ||
| 209 | - return ttinfoName; | ||
| 210 | - } | ||
| 211 | - | ||
| 212 | - public void setTtinfoName(String ttinfoName) { | ||
| 213 | - this.ttinfoName = ttinfoName; | ||
| 214 | - } | ||
| 215 | -} | 1 | +package com.bsth.entity.schedule.temp; |
| 2 | + | ||
| 3 | +import com.bsth.entity.schedule.SchedulePlan; | ||
| 4 | + | ||
| 5 | +import javax.persistence.Entity; | ||
| 6 | +import javax.persistence.GeneratedValue; | ||
| 7 | +import javax.persistence.Id; | ||
| 8 | +import javax.persistence.Table; | ||
| 9 | +import java.util.Date; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 排班的中间结果数据,记录每次排班后规则的变化。 | ||
| 13 | + */ | ||
| 14 | +@Entity | ||
| 15 | +@Table(name = "bsth_c_s_sp_rule_rst") | ||
| 16 | +public class SchedulePlanRuleResult { | ||
| 17 | + /** 主键Id */ | ||
| 18 | + @Id | ||
| 19 | + @GeneratedValue | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + /** 线路id */ | ||
| 23 | + private String xlId; | ||
| 24 | + /** 线路名字 */ | ||
| 25 | + private String xlName; | ||
| 26 | + | ||
| 27 | + /** 排班规则id */ | ||
| 28 | + private String ruleId; | ||
| 29 | + /** 车辆配置id */ | ||
| 30 | + private String ccId; | ||
| 31 | + /** 车辆自编号 */ | ||
| 32 | + private String ccZbh; | ||
| 33 | + | ||
| 34 | + /** 路牌id列表字符串 */ | ||
| 35 | + private String gids; | ||
| 36 | + /** 路牌名字列表字符串 */ | ||
| 37 | + private String gnames; | ||
| 38 | + /** 翻到哪个路牌索引 */ | ||
| 39 | + private String gidindex; | ||
| 40 | + /** 人员配置id列表字符串 */ | ||
| 41 | + private String ecids; | ||
| 42 | + /** 人员配置搭班编码列表字符串 */ | ||
| 43 | + private String ecdbbms; | ||
| 44 | + /** 翻到哪个人员配置索引 */ | ||
| 45 | + private String ecindex; | ||
| 46 | + | ||
| 47 | + /** 时刻表id */ | ||
| 48 | + private String ttinfoId; | ||
| 49 | + /** 时刻表名字 */ | ||
| 50 | + private String ttinfoName; | ||
| 51 | + | ||
| 52 | + /** 排班日期 */ | ||
| 53 | + private Date scheduleDate; | ||
| 54 | + | ||
| 55 | + /** 操作人员id */ | ||
| 56 | + private String sysuserId; | ||
| 57 | + /** 操作人员姓名 */ | ||
| 58 | + private String sysuserName; | ||
| 59 | + /** 操作时间 */ | ||
| 60 | + private Date createDate; | ||
| 61 | + | ||
| 62 | + public SchedulePlanRuleResult() { | ||
| 63 | + | ||
| 64 | + } | ||
| 65 | + public SchedulePlanRuleResult(SchedulePlan schedulePlan) { | ||
| 66 | + this.sysuserId = schedulePlan.getCreateBy().getId().toString(); | ||
| 67 | + this.sysuserName = schedulePlan.getCreateBy().getName(); | ||
| 68 | +// this.createDate = schedulePlan.getCreateDate(); | ||
| 69 | + this.createDate = new Date(); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public Long getId() { | ||
| 73 | + return id; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public void setId(Long id) { | ||
| 77 | + this.id = id; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public String getRuleId() { | ||
| 81 | + return ruleId; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public void setRuleId(String ruleId) { | ||
| 85 | + this.ruleId = ruleId; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public String getCcId() { | ||
| 89 | + return ccId; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public void setCcId(String ccId) { | ||
| 93 | + this.ccId = ccId; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public String getCcZbh() { | ||
| 97 | + return ccZbh; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public void setCcZbh(String ccZbh) { | ||
| 101 | + this.ccZbh = ccZbh; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public String getGids() { | ||
| 105 | + return gids; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public void setGids(String gids) { | ||
| 109 | + this.gids = gids; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public String getGnames() { | ||
| 113 | + return gnames; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public void setGnames(String gnames) { | ||
| 117 | + this.gnames = gnames; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public String getGidindex() { | ||
| 121 | + return gidindex; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public void setGidindex(String gidindex) { | ||
| 125 | + this.gidindex = gidindex; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + public String getEcids() { | ||
| 129 | + return ecids; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + public void setEcids(String ecids) { | ||
| 133 | + this.ecids = ecids; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + public String getEcdbbms() { | ||
| 137 | + return ecdbbms; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + public void setEcdbbms(String ecdbbms) { | ||
| 141 | + this.ecdbbms = ecdbbms; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + public String getEcindex() { | ||
| 145 | + return ecindex; | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + public void setEcindex(String ecindex) { | ||
| 149 | + this.ecindex = ecindex; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + public Date getScheduleDate() { | ||
| 153 | + return scheduleDate; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + public void setScheduleDate(Date scheduleDate) { | ||
| 157 | + this.scheduleDate = scheduleDate; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + public String getSysuserId() { | ||
| 161 | + return sysuserId; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + public void setSysuserId(String sysuserId) { | ||
| 165 | + this.sysuserId = sysuserId; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + public String getSysuserName() { | ||
| 169 | + return sysuserName; | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + public void setSysuserName(String sysuserName) { | ||
| 173 | + this.sysuserName = sysuserName; | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + public Date getCreateDate() { | ||
| 177 | + return createDate; | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + public void setCreateDate(Date createDate) { | ||
| 181 | + this.createDate = createDate; | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + public String getXlId() { | ||
| 185 | + return xlId; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + public void setXlId(String xlId) { | ||
| 189 | + this.xlId = xlId; | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + public String getXlName() { | ||
| 193 | + return xlName; | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + public void setXlName(String xlName) { | ||
| 197 | + this.xlName = xlName; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + public String getTtinfoId() { | ||
| 201 | + return ttinfoId; | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + public void setTtinfoId(String ttinfoId) { | ||
| 205 | + this.ttinfoId = ttinfoId; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + public String getTtinfoName() { | ||
| 209 | + return ttinfoName; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + public void setTtinfoName(String ttinfoName) { | ||
| 213 | + this.ttinfoName = ttinfoName; | ||
| 214 | + } | ||
| 215 | +} |
src/main/java/com/bsth/repository/SectionRepository.java
| @@ -113,5 +113,4 @@ public interface SectionRepository extends BaseRepository<Section, Integer> { | @@ -113,5 +113,4 @@ public interface SectionRepository extends BaseRepository<Section, Integer> { | ||
| 113 | Double speedLimit,String descriptions,Integer version,Integer createBy,String createDate, | 113 | Double speedLimit,String descriptions,Integer version,Integer createBy,String createDate, |
| 114 | 114 | ||
| 115 | Integer updateBy,String updateDate); | 115 | Integer updateBy,String updateDate); |
| 116 | - | ||
| 117 | } | 116 | } |
src/main/java/com/bsth/repository/SectionRouteRepository.java
| @@ -28,6 +28,14 @@ import com.bsth.entity.SectionRoute; | @@ -28,6 +28,14 @@ import com.bsth.entity.SectionRoute; | ||
| 28 | @Repository | 28 | @Repository |
| 29 | public interface SectionRouteRepository extends BaseRepository<SectionRoute, Integer> { | 29 | public interface SectionRouteRepository extends BaseRepository<SectionRoute, Integer> { |
| 30 | 30 | ||
| 31 | + // 查询最大ID | ||
| 32 | + @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_sectionroute) k" , nativeQuery=true) | ||
| 33 | + public long sectionRouteMaxId(); | ||
| 34 | + | ||
| 35 | + // 查询最大ID | ||
| 36 | + @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(sectionroute_code) as num FROM bsth_c_sectionroute where line_code = 601010 and directions = 1 and destroy = 0) k" , nativeQuery=true) | ||
| 37 | + public int sectionRouteCodeMaxId(); | ||
| 38 | + | ||
| 31 | /** | 39 | /** |
| 32 | * @Description :TODO(查询路段信息) | 40 | * @Description :TODO(查询路段信息) |
| 33 | * | 41 | * |
| @@ -162,4 +170,8 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | @@ -162,4 +170,8 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | ||
| 162 | @Modifying | 170 | @Modifying |
| 163 | @Query(value="UPDATE bsth_c_sectionroute set is_roade_speed = ?1 where line= ?2 and directions=?3 ",nativeQuery = true) | 171 | @Query(value="UPDATE bsth_c_sectionroute set is_roade_speed = ?1 where line= ?2 and directions=?3 ",nativeQuery = true) |
| 164 | void isRoadSpeedUpd(Integer isR,Integer line,Integer directions); | 172 | void isRoadSpeedUpd(Integer isR,Integer line,Integer directions); |
| 173 | + | ||
| 174 | + @Modifying | ||
| 175 | + @Query(value="update bsth_c_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true) | ||
| 176 | + public void sectionRouteDir(Integer line); | ||
| 165 | } | 177 | } |
src/main/java/com/bsth/repository/StationRouteRepository.java
| @@ -268,4 +268,12 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -268,4 +268,12 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 268 | "ORDER BY " + | 268 | "ORDER BY " + |
| 269 | "lineCode,directions,stationRouteCode") | 269 | "lineCode,directions,stationRouteCode") |
| 270 | List<Object[]> findAllLineWithYgc(); | 270 | List<Object[]> findAllLineWithYgc(); |
| 271 | + | ||
| 272 | + @Modifying | ||
| 273 | + @Query(value="update bsth_c_stationroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true) | ||
| 274 | + public void stationRouteDir(Integer line); | ||
| 275 | + | ||
| 276 | + @Modifying | ||
| 277 | + @Query(value="update bsth_c_stationroute set distances =?2 where id = ?1 ", nativeQuery=true) | ||
| 278 | + public void upddis(Integer id,Double dis); | ||
| 271 | } | 279 | } |
src/main/java/com/bsth/repository/oil/DlbRepository.java
| @@ -22,8 +22,9 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{ | @@ -22,8 +22,9 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{ | ||
| 22 | @Modifying | 22 | @Modifying |
| 23 | @Query(value="SELECT a.* FROM bsth_c_dlb a where to_days(?1)-to_days(a.rq)=1" | 23 | @Query(value="SELECT a.* FROM bsth_c_dlb a where to_days(?1)-to_days(a.rq)=1" |
| 24 | + " and jcsx=(select max(b.jcsx) from bsth_c_dlb b where a.nbbm=b.nbbm and " | 24 | + " and jcsx=(select max(b.jcsx) from bsth_c_dlb b where a.nbbm=b.nbbm and " |
| 25 | - + " to_days(?1)-to_days(b.rq)=1 )",nativeQuery=true) | ||
| 26 | - List<Dlb> obtainYlbefore(String rq); | 25 | + + " to_days(?1)-to_days(b.rq)=1 ) and ssgsdm like %?2% and fgsdm like %?3% and " |
| 26 | + + " xlbm like %?4% and nbbm like %?5%",nativeQuery=true) | ||
| 27 | + List<Dlb> obtainYlbefore(String rq,String gsdm,String fgsdm,String xlbm,String nbbm); | ||
| 27 | /** | 28 | /** |
| 28 | * 当天DLB信息 | 29 | * 当天DLB信息 |
| 29 | * @param rq | 30 | * @param rq |
| @@ -31,7 +32,77 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{ | @@ -31,7 +32,77 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{ | ||
| 31 | */ | 32 | */ |
| 32 | @Transactional | 33 | @Transactional |
| 33 | @Modifying | 34 | @Modifying |
| 34 | - @Query(value="SELECT * FROM bsth_c_dlb where to_days(?)=to_days(rq)",nativeQuery=true) | ||
| 35 | - List<Dlb> obtainDl(String rq); | 35 | + @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and ssgsdm like %?2% " |
| 36 | + + " and fgsdm like %?3%" | ||
| 37 | + + " and xlbm like %?4% and nbbm like %?5% order by ?6 asc",nativeQuery=true) | ||
| 38 | + List<Dlb> obtainDl(String rq,String gsbm,String fgsdm,String xlbm,String nbbm,String px); | ||
| 39 | + | ||
| 40 | + @Query(value="select s from Dlb s " | ||
| 41 | + + " where to_days(?1)=to_days(s.rq) " | ||
| 42 | + + " and s.ssgsdm like %?2% " | ||
| 43 | + + " and s.fgsdm like %?3%" | ||
| 44 | + + " and s.xlbm like %?4% " | ||
| 45 | + + " and s.nbbm in ?5 order by nbbm,jcsx") | ||
| 46 | + List<Dlb> listDlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm); | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * | ||
| 51 | + * @param nbbm | ||
| 52 | + * @param rq | ||
| 53 | + * @param xlbm | ||
| 54 | + * @return | ||
| 55 | + */ | ||
| 56 | + @Transactional | ||
| 57 | + @Modifying | ||
| 58 | + @Query(value="select nbbm,count(nbbm) from bsth_c_dlb where to_days(?1)=to_days(rq) and " | ||
| 59 | + + " ssgsdm like %?2% " | ||
| 60 | + + " and fgsdm like %?3%" | ||
| 61 | + + " and xlbm like %?4% and nbbm like %?5% " | ||
| 62 | + + " group by nbbm,rq,ssgsdm,fgsdm,xlbm",nativeQuery=true) | ||
| 63 | + List<Object[]> checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm); | ||
| 64 | + | ||
| 65 | + @Transactional | ||
| 66 | + @Modifying | ||
| 67 | + @Query(value="select nbbm,sum(cdl*100) as cdl ,sum(zlc*100) as zlc from bsth_c_dlb where to_days(?1)=to_days(rq) and " | ||
| 68 | + + " ssgsdm like %?2% " | ||
| 69 | + + " and fgsdm like %?3%" | ||
| 70 | + + " and xlbm like %?4% and nbbm like %?5% " | ||
| 71 | + + " group by nbbm,rq,ssgsdm,fgsdm,xlbm",nativeQuery=true) | ||
| 72 | + List<Object[]> checkNbmmDl(String rq, String gsbm,String fgsbm,String xlbm,String nbbm); | ||
| 73 | + | ||
| 74 | + | ||
| 75 | + | ||
| 76 | + @Query(value="select cdl,hd,sh from Dlb s " | ||
| 77 | + + " where to_days(?1)=to_days(s.rq) " | ||
| 78 | + + " and s.ssgsdm like %?2% " | ||
| 79 | + + " and s.fgsdm like %?3%" | ||
| 80 | + + " and s.xlbm like %?4% " | ||
| 81 | + + " and s.nbbm in ?5 ") | ||
| 82 | + List<Object[]> sumDlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm); | ||
| 83 | + | ||
| 84 | + @Transactional | ||
| 85 | + @Modifying | ||
| 86 | + @Query(value="select ifnull(cdl,0),ifnull(hd,0),ifnull(sh,0) from bsth_c_dlb " | ||
| 87 | + + " where to_days(?1)=to_days(rq) " | ||
| 88 | + + " and ssgsdm like %?2% " | ||
| 89 | + + " and fgsdm like %?3%" | ||
| 90 | + + " and xlbm like %?4% " | ||
| 91 | + + " and nbbm like %?5%",nativeQuery=true) | ||
| 92 | + List<Object[]> sumDlb2(String rq, String gsbm,String fgsbm,String xlbm,String nbbm); | ||
| 93 | + | ||
| 94 | + | ||
| 95 | + @Transactional | ||
| 96 | + @Modifying | ||
| 97 | + @Query(value="UPDATE bsth_c_dlb SET " + | ||
| 98 | + " czcd= ?2,"+ | ||
| 99 | + " jzcd = ?3, " + | ||
| 100 | + " hd = ?4,"+ | ||
| 101 | + " sh = ?5," + | ||
| 102 | + " shyy = ?6," + | ||
| 103 | + " yhlx = ?7"+ | ||
| 104 | + " WHERE id = ?1", nativeQuery=true) | ||
| 105 | + public void dlbUpdate(Integer id,double czcd,double jzcd,double hd, double sh,String shyy,int yhlx); | ||
| 106 | + | ||
| 36 | 107 | ||
| 37 | } | 108 | } |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| @@ -137,7 +137,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -137,7 +137,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 137 | List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date); | 137 | List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date); |
| 138 | 138 | ||
| 139 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | 139 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 140 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by (s.lpName+1), s.realExecDate,s.fcsj") | 140 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by (s.lpName+1), s.realExecDate,s.fcsj") |
| 141 | List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date); | 141 | List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date); |
| 142 | 142 | ||
| 143 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | 143 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| @@ -151,8 +151,8 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -151,8 +151,8 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 151 | 151 | ||
| 152 | //按照时间段统计 | 152 | //按照时间段统计 |
| 153 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | 153 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 154 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 and s.bcType not in ('in','out') order by s.xlBm") | ||
| 155 | - List<ScheduleRealInfo> scheduleByDateAndLineTj(String line,String date,String date2); | 154 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 and s.bcType not in ('in','out') and gsBm like %?4% and fgsBm like %?5% order by s.xlBm") |
| 155 | + List<ScheduleRealInfo> scheduleByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm); | ||
| 156 | 156 | ||
| 157 | //按照时间段统计 | 157 | //按照时间段统计 |
| 158 | @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 and s.bcType not in ('in','out') order by s.xlBm") | 158 | @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 and s.bcType not in ('in','out') order by s.xlBm") |
src/main/java/com/bsth/repository/schedule/SchedulePlanRuleResultRepository.java
| 1 | -package com.bsth.repository.schedule; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; | ||
| 4 | -import com.bsth.repository.BaseRepository; | ||
| 5 | -import org.springframework.data.jpa.repository.Modifying; | ||
| 6 | -import org.springframework.data.jpa.repository.Query; | ||
| 7 | -import org.springframework.stereotype.Repository; | ||
| 8 | - | ||
| 9 | -import java.util.Date; | ||
| 10 | -import java.util.List; | ||
| 11 | - | ||
| 12 | -/** | ||
| 13 | - * Created by xu on 17/3/29. | ||
| 14 | - */ | ||
| 15 | -@Repository | ||
| 16 | -public interface SchedulePlanRuleResultRepository extends BaseRepository<SchedulePlanRuleResult, Long> { | ||
| 17 | - | ||
| 18 | - @Query("select t from SchedulePlanRuleResult t " + | ||
| 19 | - "where not exists (select 1 from SchedulePlanRuleResult " + | ||
| 20 | - "where createDate > t.createDate and scheduleDate < ?2 ) " + | ||
| 21 | - "and t.xlId = ?1 and t.scheduleDate < ?2") | ||
| 22 | - List<SchedulePlanRuleResult> findLastByXl(String xlid, Date from); | ||
| 23 | - | ||
| 24 | -// @Modifying | ||
| 25 | -// @Query("delete from SchedulePlanRuleResult t " + | ||
| 26 | -// "where t.xlId = ?1 and t.scheduleDate >= ?2 and t.scheduleDate <= ?3") | ||
| 27 | -// void deleteByXlAndDate(String xlid, Date from, Date to); | ||
| 28 | -} | 1 | +package com.bsth.repository.schedule; |
| 2 | + | ||
| 3 | +import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; | ||
| 4 | +import com.bsth.repository.BaseRepository; | ||
| 5 | +import org.springframework.data.jpa.repository.Modifying; | ||
| 6 | +import org.springframework.data.jpa.repository.Query; | ||
| 7 | +import org.springframework.stereotype.Repository; | ||
| 8 | + | ||
| 9 | +import java.util.Date; | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * Created by xu on 17/3/29. | ||
| 14 | + */ | ||
| 15 | +@Repository | ||
| 16 | +public interface SchedulePlanRuleResultRepository extends BaseRepository<SchedulePlanRuleResult, Long> { | ||
| 17 | + | ||
| 18 | + @Query("select t from SchedulePlanRuleResult t " + | ||
| 19 | + "where not exists (select 1 from SchedulePlanRuleResult " + | ||
| 20 | + "where createDate > t.createDate and scheduleDate < ?2 ) " + | ||
| 21 | + "and t.xlId = ?1 and t.scheduleDate < ?2") | ||
| 22 | + List<SchedulePlanRuleResult> findLastByXl(String xlid, Date from); | ||
| 23 | + | ||
| 24 | +// @Modifying | ||
| 25 | +// @Query("delete from SchedulePlanRuleResult t " + | ||
| 26 | +// "where t.xlId = ?1 and t.scheduleDate >= ?2 and t.scheduleDate <= ?3") | ||
| 27 | +// void deleteByXlAndDate(String xlid, Date from, Date to); | ||
| 28 | +} |
src/main/java/com/bsth/repository/schedule/TTInfoDetailRepository.java
| @@ -51,5 +51,7 @@ public interface TTInfoDetailRepository extends BaseRepository<TTInfoDetail, Lon | @@ -51,5 +51,7 @@ public interface TTInfoDetailRepository extends BaseRepository<TTInfoDetail, Lon | ||
| 51 | @Query(value = "delete from TTInfoDetail t where t.ttinfo.id = ?1") | 51 | @Query(value = "delete from TTInfoDetail t where t.ttinfo.id = ?1") |
| 52 | void deleteByTtinfoIdWithModify(Long ttinfoid); | 52 | void deleteByTtinfoIdWithModify(Long ttinfoid); |
| 53 | 53 | ||
| 54 | - | 54 | + @Modifying |
| 55 | + @Query(value = "delete from TTInfoDetail t where t.xl.id=?1 and t.ttinfo.id = ?2") | ||
| 56 | + void deltidc(int xl , Long ttinfoid ); | ||
| 55 | } | 57 | } |
src/main/java/com/bsth/repository/sys/DutyEmployeeRepository.java
| @@ -13,7 +13,7 @@ import java.util.List; | @@ -13,7 +13,7 @@ import java.util.List; | ||
| 13 | @Repository | 13 | @Repository |
| 14 | public interface DutyEmployeeRepository extends BaseRepository<DutyEmployee, Long>{ | 14 | public interface DutyEmployeeRepository extends BaseRepository<DutyEmployee, Long>{ |
| 15 | 15 | ||
| 16 | - //@Query("select t from DutyEmployee t where t.codeIdx like %?1% and t.ts > ?2 and t.ts < ?3") | ||
| 17 | - @Query("select t from DutyEmployee t where t.codeIdx like %?1% and t.ts < ?2") | ||
| 18 | - List<DutyEmployee> findByLineAndTime(String lineCode, long et); | 16 | + @Query("select t from DutyEmployee t where t.codeIdx like %?1% and t.ts > ?2 and t.ts < ?3") |
| 17 | + //@Query("select t from DutyEmployee t where t.codeIdx like %?1% and t.ts < ?2") | ||
| 18 | + List<DutyEmployee> findByLineAndTime(String lineCode, long st, long et); | ||
| 19 | } | 19 | } |
src/main/java/com/bsth/service/SectionRouteService.java
| @@ -41,4 +41,6 @@ public interface SectionRouteService extends BaseService<SectionRoute, Integer> | @@ -41,4 +41,6 @@ public interface SectionRouteService extends BaseService<SectionRoute, Integer> | ||
| 41 | * @return List<Map<String, Object>> | 41 | * @return List<Map<String, Object>> |
| 42 | */ | 42 | */ |
| 43 | List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map); | 43 | List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map); |
| 44 | + | ||
| 45 | + Map<String, Object> quoteSection(Map<String, Object> map); | ||
| 44 | } | 46 | } |
src/main/java/com/bsth/service/StationRouteService.java
| @@ -79,5 +79,9 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | @@ -79,5 +79,9 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | ||
| 79 | */ | 79 | */ |
| 80 | List<Map<String, Object>> findStationRouteInfo(Map<String, Object> map); | 80 | List<Map<String, Object>> findStationRouteInfo(Map<String, Object> map); |
| 81 | 81 | ||
| 82 | - Map<String, Object> findByMultiLine(String lineIds); | 82 | + Map<String, Object> findByMultiLine(String lineIds); |
| 83 | + | ||
| 84 | + Map<String, Object> updSwitchDir(String lineIds); | ||
| 85 | + | ||
| 86 | + Map<String, Object> upddis(Map<String, Object> map); | ||
| 83 | } | 87 | } |
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
| @@ -731,22 +731,33 @@ public class FormsServiceImpl implements FormsService { | @@ -731,22 +731,33 @@ public class FormsServiceImpl implements FormsService { | ||
| 731 | 731 | ||
| 732 | @Override | 732 | @Override |
| 733 | public List<Daily> daily(Map<String, Object> map) { | 733 | public List<Daily> daily(Map<String, Object> map) { |
| 734 | + | ||
| 735 | + String gsbm=""; | ||
| 736 | + if(map.get("gsdmDaily")!=null){ | ||
| 737 | + gsbm=map.get("gsdmDaily").toString(); | ||
| 738 | + } | ||
| 739 | + | ||
| 740 | + String fgsbm=""; | ||
| 741 | + if(map.get("fgsdmDaily").toString()!=null){ | ||
| 742 | + fgsbm=map.get("fgsdmDaily").toString(); | ||
| 743 | + } | ||
| 744 | + | ||
| 734 | String sql="select t.schedule_date_str," | 745 | String sql="select t.schedule_date_str," |
| 735 | + " t.cl_zbh,t.j_gh,t.j_name,x.yh from (select r.schedule_date_str,r.xl_bm,r.xl_name," | 746 | + " t.cl_zbh,t.j_gh,t.j_name,x.yh from (select r.schedule_date_str,r.xl_bm,r.xl_name," |
| 736 | + " r.cl_zbh,r.j_gh,r.j_name from bsth_c_s_sp_info_real r WHERE " | 747 | + " r.cl_zbh,r.j_gh,r.j_name from bsth_c_s_sp_info_real r WHERE " |
| 737 | - + " r.xl_bm='" + map.get("line").toString() + "' and to_days(r.schedule_date)=to_days('"+map.get("date").toString()+"') " | ||
| 738 | - + " and r.gs_bm like '%"+map.get("gsdmDaily").toString()+"%' " | ||
| 739 | - + " and r.fgs_bm like '%"+map.get("fgsdmDaily").toString()+"%' " | 748 | + + " r.xl_bm='" + map.get("line").toString() + "' " |
| 749 | + + " and to_days(r.schedule_date)=to_days('"+map.get("date").toString()+"') " | ||
| 750 | + + " and r.gs_bm like '%"+gsbm+"%' " | ||
| 751 | + + " and r.fgs_bm like '%"+fgsbm+"%' " | ||
| 740 | + " GROUP BY r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name) t" | 752 | + " GROUP BY r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name) t" |
| 741 | + " left join (select * from bsth_c_ylb y where " | 753 | + " left join (select * from bsth_c_ylb y where " |
| 742 | + " to_days(y.rq)=to_days('"+map.get("date").toString()+"') " | 754 | + " to_days(y.rq)=to_days('"+map.get("date").toString()+"') " |
| 743 | + " and y.xlbm= '" + map.get("line").toString() + "'" | 755 | + " and y.xlbm= '" + map.get("line").toString() + "'" |
| 744 | - + " and y.ssgsdm like '%"+map.get("gsdmDaily").toString()+"%' " | ||
| 745 | - + " and y.fgsdm like '%"+map.get("fgsdmDaily").toString()+"%'" | 756 | + + " and y.ssgsdm like '%"+gsbm+"%' " |
| 757 | + + " and y.fgsdm like '%"+fgsbm+"%'" | ||
| 746 | + " ) x" | 758 | + " ) x" |
| 747 | + " on t.cl_zbh = x.nbbm "; | 759 | + " on t.cl_zbh = x.nbbm "; |
| 748 | 760 | ||
| 749 | - System.out.println(new Date()); | ||
| 750 | List<Daily> list = jdbcTemplate.query(sql, new RowMapper<Daily>() { | 761 | List<Daily> list = jdbcTemplate.query(sql, new RowMapper<Daily>() { |
| 751 | @Override | 762 | @Override |
| 752 | public Daily mapRow(ResultSet arg0, int arg1) throws SQLException { | 763 | public Daily mapRow(ResultSet arg0, int arg1) throws SQLException { |
src/main/java/com/bsth/service/gps/GpsService.java
| @@ -18,4 +18,6 @@ public interface GpsService { | @@ -18,4 +18,6 @@ public interface GpsService { | ||
| 18 | Map<String,Object> findRoadSpeed(String lineCode); | 18 | Map<String,Object> findRoadSpeed(String lineCode); |
| 19 | 19 | ||
| 20 | Map<String,Object> gpsCompletion(long schId); | 20 | Map<String,Object> gpsCompletion(long schId); |
| 21 | + | ||
| 22 | + Map<String,Object> history_v2(String nbbm, long st, long et); | ||
| 21 | } | 23 | } |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| @@ -5,11 +5,14 @@ import com.bsth.data.BasicData; | @@ -5,11 +5,14 @@ import com.bsth.data.BasicData; | ||
| 5 | import com.bsth.data.arrival.ArrivalEntity; | 5 | import com.bsth.data.arrival.ArrivalEntity; |
| 6 | import com.bsth.data.gpsdata.GpsEntity; | 6 | import com.bsth.data.gpsdata.GpsEntity; |
| 7 | import com.bsth.data.gpsdata.GpsRealData; | 7 | import com.bsth.data.gpsdata.GpsRealData; |
| 8 | +import com.bsth.data.gpsdata.arrival.utils.GeoUtils; | ||
| 8 | import com.bsth.data.schedule.DayOfSchedule; | 9 | import com.bsth.data.schedule.DayOfSchedule; |
| 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 10 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 10 | import com.bsth.repository.CarParkRepository; | 11 | import com.bsth.repository.CarParkRepository; |
| 11 | import com.bsth.repository.StationRepository; | 12 | import com.bsth.repository.StationRepository; |
| 12 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | 13 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 14 | +import com.bsth.service.gps.entity.HistoryGps_DTO; | ||
| 15 | +import com.bsth.service.gps.entity.Road_DTO; | ||
| 13 | import com.bsth.util.DateUtils; | 16 | import com.bsth.util.DateUtils; |
| 14 | import com.bsth.util.TransGPS; | 17 | import com.bsth.util.TransGPS; |
| 15 | import com.bsth.util.TransGPS.Location; | 18 | import com.bsth.util.TransGPS.Location; |
| @@ -235,6 +238,9 @@ public class GpsServiceImpl implements GpsService { | @@ -235,6 +238,9 @@ public class GpsServiceImpl implements GpsService { | ||
| 235 | bdLoc = TransGPS.bd_encrypt(gdLoc); | 238 | bdLoc = TransGPS.bd_encrypt(gdLoc); |
| 236 | map.put("bd_lon", bdLoc.getLng()); | 239 | map.put("bd_lon", bdLoc.getLng()); |
| 237 | map.put("bd_lat", bdLoc.getLat()); | 240 | map.put("bd_lat", bdLoc.getLat()); |
| 241 | + //原始坐标 | ||
| 242 | + map.put("lon", lon); | ||
| 243 | + map.put("lat", lat); | ||
| 238 | 244 | ||
| 239 | map.put("deviceId", rs.getString("DEVICE_ID")); | 245 | map.put("deviceId", rs.getString("DEVICE_ID")); |
| 240 | map.put("ts", rs.getLong("TS")); | 246 | map.put("ts", rs.getLong("TS")); |
| @@ -510,6 +516,49 @@ public class GpsServiceImpl implements GpsService { | @@ -510,6 +516,49 @@ public class GpsServiceImpl implements GpsService { | ||
| 510 | return rs; | 516 | return rs; |
| 511 | } | 517 | } |
| 512 | 518 | ||
| 519 | + @Override | ||
| 520 | + public Map<String, Object> history_v2(String nbbm, long st, long et) { | ||
| 521 | + Map<String, Object> rs = new HashMap<>(); | ||
| 522 | + | ||
| 523 | + try { | ||
| 524 | + //获取历史gps 数据 | ||
| 525 | + List<HistoryGps_DTO> list = HistoryGps_DTO.craete(history(new String[]{nbbm}, st, et)); | ||
| 526 | + if(list!=null && list.size() > 0){ | ||
| 527 | + //获取路段信息 | ||
| 528 | + String sql = "select ID, ST_AsText(GROAD_VECTOR) as GROAD_VECTOR,ROAD_CODE,ROAD_NAME,SPEED from bsth_c_road where road_code in(select section_code from bsth_c_sectionroute where line_code=? and destroy=0)"; | ||
| 529 | + List<Road_DTO> roads = Road_DTO.craete(jdbcTemplate.queryForList(sql, list.get(0).getLineId())); | ||
| 530 | + | ||
| 531 | + //为GPS数据关联路段信息 | ||
| 532 | + for(HistoryGps_DTO gps : list){ | ||
| 533 | + matchRoadToGps(gps, roads); | ||
| 534 | + } | ||
| 535 | + } | ||
| 536 | + | ||
| 537 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 538 | + rs.put("list", list); | ||
| 539 | + }catch (Exception e){ | ||
| 540 | + logger.error("", e); | ||
| 541 | + rs.put("status", ResponseCode.ERROR); | ||
| 542 | + } | ||
| 543 | + return rs; | ||
| 544 | + } | ||
| 545 | + | ||
| 546 | + private void matchRoadToGps(HistoryGps_DTO gps, List<Road_DTO> roads){ | ||
| 547 | + double min = -1,distance; | ||
| 548 | + Road_DTO nearRoad = null; | ||
| 549 | + for(Road_DTO road : roads){ | ||
| 550 | + distance = GeoUtils.getDistanceFromLine(road.getLineStr(), gps.getPoint()); | ||
| 551 | + | ||
| 552 | + if (min > distance || min == -1) { | ||
| 553 | + min = distance; | ||
| 554 | + nearRoad = road; | ||
| 555 | + } | ||
| 556 | + } | ||
| 557 | + | ||
| 558 | + gps.setRoad(nearRoad); | ||
| 559 | + gps.setRoadMinDistance(min); | ||
| 560 | + } | ||
| 561 | + | ||
| 513 | private void sortGpsList(final Field f, List<GpsEntity> rs) { | 562 | private void sortGpsList(final Field f, List<GpsEntity> rs) { |
| 514 | Collections.sort(rs, new Comparator<GpsEntity>() { | 563 | Collections.sort(rs, new Comparator<GpsEntity>() { |
| 515 | 564 |
src/main/java/com/bsth/service/gps/entity/HistoryGps_DTO.java
0 → 100644
| 1 | +package com.bsth.service.gps.entity; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.alibaba.fastjson.JSONObject; | ||
| 5 | +import com.bsth.data.arrival.ArrivalEntity; | ||
| 6 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 7 | +import com.vividsolutions.jts.geom.Coordinate; | ||
| 8 | +import com.vividsolutions.jts.geom.GeometryFactory; | ||
| 9 | +import com.vividsolutions.jts.geom.Point; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | +import java.util.Map; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 历史GPS DTO | ||
| 16 | + * Created by panzhao on 2017/4/5. | ||
| 17 | + */ | ||
| 18 | +public class HistoryGps_DTO { | ||
| 19 | + | ||
| 20 | + public static List<HistoryGps_DTO> craete(List<Map<String, Object>> mapList){ | ||
| 21 | + List<HistoryGps_DTO> list = JSONObject.parseArray(JSON.toJSONString(mapList), HistoryGps_DTO.class); | ||
| 22 | + | ||
| 23 | + GeometryFactory geometryFactory = new GeometryFactory(); | ||
| 24 | + Point point; | ||
| 25 | + for(HistoryGps_DTO gps : list){ | ||
| 26 | + point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon())); | ||
| 27 | + gps.setPoint(point); | ||
| 28 | + } | ||
| 29 | + return list; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + private double gcj_lon; | ||
| 33 | + private double gcj_lat; | ||
| 34 | + | ||
| 35 | + private double bd_lon; | ||
| 36 | + private double bd_lat; | ||
| 37 | + | ||
| 38 | + private double lon; | ||
| 39 | + private double lat; | ||
| 40 | + | ||
| 41 | + private String deviceId; | ||
| 42 | + private long ts; | ||
| 43 | + private long timestamp; | ||
| 44 | + private String stopNo; | ||
| 45 | + private float direction; | ||
| 46 | + | ||
| 47 | + private String lineId; | ||
| 48 | + private float speed; | ||
| 49 | + private ArrivalEntity inout_stop_info; | ||
| 50 | + private int inout_stop; | ||
| 51 | + | ||
| 52 | + private String nbbm; | ||
| 53 | + private int state; | ||
| 54 | + private int upDown; | ||
| 55 | + | ||
| 56 | + @JsonIgnore | ||
| 57 | + private Point point; | ||
| 58 | + | ||
| 59 | + /** 路段 */ | ||
| 60 | + private Road_DTO road; | ||
| 61 | + /** 和路段的最短距离 */ | ||
| 62 | + private double roadMinDistance; | ||
| 63 | + | ||
| 64 | + public double getGcj_lon() { | ||
| 65 | + return gcj_lon; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public void setGcj_lon(double gcj_lon) { | ||
| 69 | + this.gcj_lon = gcj_lon; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public double getGcj_lat() { | ||
| 73 | + return gcj_lat; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public void setGcj_lat(double gcj_lat) { | ||
| 77 | + this.gcj_lat = gcj_lat; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public double getBd_lon() { | ||
| 81 | + return bd_lon; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public void setBd_lon(double bd_lon) { | ||
| 85 | + this.bd_lon = bd_lon; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public double getBd_lat() { | ||
| 89 | + return bd_lat; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public void setBd_lat(double bd_lat) { | ||
| 93 | + this.bd_lat = bd_lat; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public String getDeviceId() { | ||
| 97 | + return deviceId; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public void setDeviceId(String deviceId) { | ||
| 101 | + this.deviceId = deviceId; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public long getTs() { | ||
| 105 | + return ts; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public void setTs(long ts) { | ||
| 109 | + this.ts = ts; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public long getTimestamp() { | ||
| 113 | + return timestamp; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public void setTimestamp(long timestamp) { | ||
| 117 | + this.timestamp = timestamp; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public String getStopNo() { | ||
| 121 | + return stopNo; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public void setStopNo(String stopNo) { | ||
| 125 | + this.stopNo = stopNo; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + public float getDirection() { | ||
| 129 | + return direction; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + public void setDirection(float direction) { | ||
| 133 | + this.direction = direction; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + public String getLineId() { | ||
| 137 | + return lineId; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + public void setLineId(String lineId) { | ||
| 141 | + this.lineId = lineId; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + public float getSpeed() { | ||
| 145 | + return speed; | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + public void setSpeed(float speed) { | ||
| 149 | + this.speed = speed; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + public ArrivalEntity getInout_stop_info() { | ||
| 153 | + return inout_stop_info; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + public void setInout_stop_info(ArrivalEntity inout_stop_info) { | ||
| 157 | + this.inout_stop_info = inout_stop_info; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + public int getInout_stop() { | ||
| 161 | + return inout_stop; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + public void setInout_stop(int inout_stop) { | ||
| 165 | + this.inout_stop = inout_stop; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + public String getNbbm() { | ||
| 169 | + return nbbm; | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + public void setNbbm(String nbbm) { | ||
| 173 | + this.nbbm = nbbm; | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + public int getState() { | ||
| 177 | + return state; | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + public void setState(int state) { | ||
| 181 | + this.state = state; | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + public int getUpDown() { | ||
| 185 | + return upDown; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + public void setUpDown(int upDown) { | ||
| 189 | + this.upDown = upDown; | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + public Road_DTO getRoad() { | ||
| 193 | + return road; | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + public void setRoad(Road_DTO road) { | ||
| 197 | + this.road = road; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + public double getRoadMinDistance() { | ||
| 201 | + return roadMinDistance; | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + public void setRoadMinDistance(double roadMinDistance) { | ||
| 205 | + this.roadMinDistance = roadMinDistance; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + public double getLon() { | ||
| 209 | + return lon; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + public void setLon(double lon) { | ||
| 213 | + this.lon = lon; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + public double getLat() { | ||
| 217 | + return lat; | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + public void setLat(double lat) { | ||
| 221 | + this.lat = lat; | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + public Point getPoint() { | ||
| 225 | + return point; | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + public void setPoint(Point point) { | ||
| 229 | + this.point = point; | ||
| 230 | + } | ||
| 231 | +} |
src/main/java/com/bsth/service/gps/entity/Road_DTO.java
0 → 100644
| 1 | +package com.bsth.service.gps.entity; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.alibaba.fastjson.JSONObject; | ||
| 5 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 6 | +import com.vividsolutions.jts.geom.Coordinate; | ||
| 7 | +import com.vividsolutions.jts.geom.GeometryFactory; | ||
| 8 | +import com.vividsolutions.jts.geom.LineString; | ||
| 9 | + | ||
| 10 | +import java.util.ArrayList; | ||
| 11 | +import java.util.List; | ||
| 12 | +import java.util.Map; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 路段信息DTO | ||
| 16 | + * Created by panzhao on 2017/4/5. | ||
| 17 | + */ | ||
| 18 | +public class Road_DTO { | ||
| 19 | + | ||
| 20 | + public static List<Road_DTO> craete(List<Map<String, Object>> mapList){ | ||
| 21 | + List<Road_DTO> list = JSONObject.parseArray(JSON.toJSONString(mapList), Road_DTO.class); | ||
| 22 | + //处理路段坐标 | ||
| 23 | + String polygonStr; | ||
| 24 | + String[] coords; | ||
| 25 | + int i, len; | ||
| 26 | + String[] temps;//1, temps2; | ||
| 27 | + List<Coordinate> cds; | ||
| 28 | + | ||
| 29 | + GeometryFactory geometryFactory = new GeometryFactory(); | ||
| 30 | + for(Road_DTO road : list){ | ||
| 31 | + polygonStr = road.getGROAD_VECTOR(); | ||
| 32 | + coords = polygonStr.substring(11, polygonStr.length() - 1).split(","); | ||
| 33 | + len = coords.length; | ||
| 34 | + | ||
| 35 | + cds = new ArrayList<>(); | ||
| 36 | + //每2个点连一条线 | ||
| 37 | + for(i = 0; i < len; i ++){ | ||
| 38 | + temps = coords[i].split(" "); | ||
| 39 | + cds.add(new Coordinate(Float.parseFloat(temps[1]), Float.parseFloat(temps[0]))); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + Coordinate[] cdsArray = new Coordinate[cds.size()]; | ||
| 43 | + road.setLineStr(geometryFactory.createLineString(cds.toArray(cdsArray))); | ||
| 44 | + } | ||
| 45 | + return list; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + private long ID; | ||
| 49 | + | ||
| 50 | + @JsonIgnore | ||
| 51 | + private String GROAD_VECTOR; | ||
| 52 | + | ||
| 53 | + private String ROAD_CODE; | ||
| 54 | + | ||
| 55 | + private String ROAD_NAME; | ||
| 56 | + | ||
| 57 | + private double SPEED; | ||
| 58 | + | ||
| 59 | + @JsonIgnore | ||
| 60 | + private LineString lineStr; | ||
| 61 | + | ||
| 62 | + public long getID() { | ||
| 63 | + return ID; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public void setID(long ID) { | ||
| 67 | + this.ID = ID; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + public String getGROAD_VECTOR() { | ||
| 71 | + return GROAD_VECTOR; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + public void setGROAD_VECTOR(String GROAD_VECTOR) { | ||
| 75 | + this.GROAD_VECTOR = GROAD_VECTOR; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + public String getROAD_CODE() { | ||
| 79 | + return ROAD_CODE; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + public void setROAD_CODE(String ROAD_CODE) { | ||
| 83 | + this.ROAD_CODE = ROAD_CODE; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + public String getROAD_NAME() { | ||
| 87 | + return ROAD_NAME; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + public void setROAD_NAME(String ROAD_NAME) { | ||
| 91 | + this.ROAD_NAME = ROAD_NAME; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + public double getSPEED() { | ||
| 95 | + return SPEED; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + public void setSPEED(double SPEED) { | ||
| 99 | + this.SPEED = SPEED; | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + public LineString getLineStr() { | ||
| 103 | + return lineStr; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + public void setLineStr(LineString lineStr) { | ||
| 107 | + this.lineStr = lineStr; | ||
| 108 | + } | ||
| 109 | +} |
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
| @@ -8,7 +8,12 @@ import java.util.Map; | @@ -8,7 +8,12 @@ import java.util.Map; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
| 10 | 10 | ||
| 11 | +import com.bsth.common.ResponseCode; | ||
| 12 | +import com.bsth.entity.Line; | ||
| 13 | +import com.bsth.entity.Section; | ||
| 11 | import com.bsth.entity.SectionRoute; | 14 | import com.bsth.entity.SectionRoute; |
| 15 | +import com.bsth.repository.LineRepository; | ||
| 16 | +import com.bsth.repository.SectionRepository; | ||
| 12 | import com.bsth.repository.SectionRouteRepository; | 17 | import com.bsth.repository.SectionRouteRepository; |
| 13 | import com.bsth.service.SectionRouteService; | 18 | import com.bsth.service.SectionRouteService; |
| 14 | 19 | ||
| @@ -34,6 +39,12 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | @@ -34,6 +39,12 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | ||
| 34 | @Autowired | 39 | @Autowired |
| 35 | SectionRouteRepository repository; | 40 | SectionRouteRepository repository; |
| 36 | 41 | ||
| 42 | + @Autowired | ||
| 43 | + SectionRepository repository2; | ||
| 44 | + | ||
| 45 | + @Autowired | ||
| 46 | + LineRepository lineRepository; | ||
| 47 | + | ||
| 37 | /** | 48 | /** |
| 38 | * @Description :TODO(查询路段信息) | 49 | * @Description :TODO(查询路段信息) |
| 39 | * | 50 | * |
| @@ -43,21 +54,13 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | @@ -43,21 +54,13 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | ||
| 43 | */ | 54 | */ |
| 44 | @Override | 55 | @Override |
| 45 | public List<Map<String, Object>> getSectionRoute(Map<String, Object> map) { | 56 | public List<Map<String, Object>> getSectionRoute(Map<String, Object> map) { |
| 46 | - | ||
| 47 | int lineId = map.get("line.id_eq").equals("") ? 0 : Integer.parseInt(map.get("line.id_eq").toString()); | 57 | int lineId = map.get("line.id_eq").equals("") ? 0 : Integer.parseInt(map.get("line.id_eq").toString()); |
| 48 | - | ||
| 49 | int directions = map.get("directions_eq").equals("") ? 0 : Integer.parseInt(map.get("directions_eq").toString()); | 58 | int directions = map.get("directions_eq").equals("") ? 0 : Integer.parseInt(map.get("directions_eq").toString()); |
| 50 | - | ||
| 51 | List<Object[]> listObjArray = repository.getSectionRoute(lineId, directions); | 59 | List<Object[]> listObjArray = repository.getSectionRoute(lineId, directions); |
| 52 | - | ||
| 53 | List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); | 60 | List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); |
| 54 | - | ||
| 55 | if(listObjArray.size()>0) { | 61 | if(listObjArray.size()>0) { |
| 56 | - | ||
| 57 | for(int i = 0 ; i<listObjArray.size() ; i++){ | 62 | for(int i = 0 ; i<listObjArray.size() ; i++){ |
| 58 | - | ||
| 59 | Map<String, Object> tempM = new HashMap<String, Object>(); | 63 | Map<String, Object> tempM = new HashMap<String, Object>(); |
| 60 | - | ||
| 61 | tempM.put("sectionrouteId",listObjArray.get(i)[0]); | 64 | tempM.put("sectionrouteId",listObjArray.get(i)[0]); |
| 62 | tempM.put("sectionrouteLine",listObjArray.get(i)[1]); | 65 | tempM.put("sectionrouteLine",listObjArray.get(i)[1]); |
| 63 | tempM.put("sectionrouteLineCode",listObjArray.get(i)[2]); | 66 | tempM.put("sectionrouteLineCode",listObjArray.get(i)[2]); |
| @@ -81,12 +84,12 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | @@ -81,12 +84,12 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | ||
| 81 | tempM.put("sectionTime",listObjArray.get(i)[20]); | 84 | tempM.put("sectionTime",listObjArray.get(i)[20]); |
| 82 | tempM.put("sectiondbType",listObjArray.get(i)[21]); | 85 | tempM.put("sectiondbType",listObjArray.get(i)[21]); |
| 83 | tempM.put("sectionSpeedLimet",listObjArray.get(i)[22]); | 86 | tempM.put("sectionSpeedLimet",listObjArray.get(i)[22]); |
| 87 | + tempM.put("destroy",listObjArray.get(i)[23]); | ||
| 88 | + tempM.put("versions",listObjArray.get(i)[24]); | ||
| 89 | + tempM.put("descriptions",listObjArray.get(i)[25]); | ||
| 84 | resultList.add(tempM); | 90 | resultList.add(tempM); |
| 85 | - | ||
| 86 | } | 91 | } |
| 87 | - | ||
| 88 | } | 92 | } |
| 89 | - | ||
| 90 | return resultList; | 93 | return resultList; |
| 91 | } | 94 | } |
| 92 | 95 | ||
| @@ -228,5 +231,68 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | @@ -228,5 +231,68 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | ||
| 228 | 231 | ||
| 229 | return list; | 232 | return list; |
| 230 | } | 233 | } |
| 234 | + | ||
| 235 | + @Override | ||
| 236 | + public Map<String, Object> quoteSection(Map<String, Object> map) { | ||
| 237 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 238 | + try { | ||
| 239 | + Integer line = map.get("lineId") ==null ? null : Integer.parseInt(map.get("lineId").toString()); | ||
| 240 | + Integer dir = map.get("dir")==null ? null : Integer.parseInt(map.get("dir").toString()); | ||
| 241 | + Integer toDir = map.get("toDir")==null ? null : Integer.parseInt(map.get("toDir").toString()); | ||
| 242 | + if(line!=null && dir!=null) { | ||
| 243 | + List<Object[]> list = repository.getSectionRoute(line, dir); | ||
| 244 | + int src = repository.sectionRouteCodeMaxId(); | ||
| 245 | + for(int i = 0 ; i<list.size() ; i++) { | ||
| 246 | + int sectionId = Integer.parseInt(String.valueOf(repository2.sectionMaxId())) + 1 ; | ||
| 247 | + String sectionCode = String.valueOf(sectionId); | ||
| 248 | + String sectionName = list.get(i)[9] == null ? null : list.get(i)[9].toString(); | ||
| 249 | + String crosesRoad = list.get(i)[10] == null ? null : list.get(i)[10].toString(); | ||
| 250 | + String endNode = list.get(i)[11] == null ? null : list.get(i)[11].toString(); | ||
| 251 | + String startNode = list.get(i)[12] == null ? null : list.get(i)[12].toString(); | ||
| 252 | + String middleNode = list.get(i)[13] == null ? null : list.get(i)[13].toString(); | ||
| 253 | + String sectionType = list.get(i)[14] == null ? null : list.get(i)[14].toString(); | ||
| 254 | + String csectionVector = list.get(i)[15] == null ? null : list.get(i)[15].toString(); | ||
| 255 | + String bsectionVector = list.get(i)[16] == null ? null : list.get(i)[16].toString(); | ||
| 256 | + String gsectionVector = list.get(i)[17] == null ? null : list.get(i)[17].toString(); | ||
| 257 | + String roadCoding = list.get(i)[18] == null ? null : list.get(i)[18].toString(); | ||
| 258 | + Double sectionDistance = list.get(i)[19] == null ? null : Double.parseDouble(list.get(i)[19].toString()); | ||
| 259 | + Double sectionTime = list.get(i)[20] == null ? null : Double.parseDouble(list.get(i)[20].toString()); | ||
| 260 | + String dbType = list.get(i)[21] == null ? null : list.get(i)[21].toString(); | ||
| 261 | + Double speedLimit = list.get(i)[22] == null ? null : Double.parseDouble(list.get(i)[22].toString()); | ||
| 262 | + Integer destroy = list.get(i)[23] == null ? null : Integer.parseInt(list.get(i)[23].toString()); | ||
| 263 | + Integer versions = list.get(i)[24] == null ? null : Integer.parseInt(list.get(i)[24].toString()); | ||
| 264 | + String descriptions = list.get(i)[25] == null ? null : list.get(i)[25].toString(); | ||
| 265 | + repository2.systemSave(sectionCode, | ||
| 266 | + sectionName, crosesRoad, endNode, startNode, middleNode, | ||
| 267 | + gsectionVector, bsectionVector, | ||
| 268 | + sectionType, csectionVector, roadCoding, | ||
| 269 | + sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, sectionId); | ||
| 270 | + int sectionRouteId = Integer.parseInt(String.valueOf(repository.sectionRouteMaxId())) + 1 ; | ||
| 271 | + SectionRoute sr = new SectionRoute(); | ||
| 272 | + Line lineObject = lineRepository.findOne(line); | ||
| 273 | + Section section = repository2.findOne(sectionId); | ||
| 274 | + Integer xh = (src == 0 ? (toDir ==1? (list.size()-i)*10 : (list.size()+i)*10) : toDir==1? (src + (list.size()-i)*10) : (src + (list.size()+i)*10)) ; | ||
| 275 | + sr.setId(sectionRouteId); | ||
| 276 | + sr.setSectionrouteCode(xh); | ||
| 277 | + sr.setLineCode(lineObject.getLineCode()); | ||
| 278 | + sr.setSectionCode(sectionCode); | ||
| 279 | + sr.setDirections(toDir); | ||
| 280 | + sr.setVersions(versions); | ||
| 281 | + sr.setDestroy(destroy); | ||
| 282 | + sr.setLine(lineObject); | ||
| 283 | + sr.setSection(section); | ||
| 284 | + sr.setSectionCode(section.getSectionCode()); | ||
| 285 | + sr.setDescriptions(descriptions); | ||
| 286 | + sr.setIsRoadeSpeed(1); | ||
| 287 | + repository.save(sr); | ||
| 288 | + } | ||
| 289 | + } | ||
| 290 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 291 | + } catch (Exception e) { | ||
| 292 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 293 | + logger.error("save erro.", e); | ||
| 294 | + } | ||
| 295 | + return resultMap; | ||
| 296 | + } | ||
| 231 | 297 | ||
| 232 | } | 298 | } |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| @@ -17,6 +17,7 @@ import com.bsth.util.db.DBUtils_MS; | @@ -17,6 +17,7 @@ import com.bsth.util.db.DBUtils_MS; | ||
| 17 | import com.google.common.base.Splitter; | 17 | import com.google.common.base.Splitter; |
| 18 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 19 | import org.springframework.stereotype.Service; | 19 | import org.springframework.stereotype.Service; |
| 20 | +import org.springframework.transaction.annotation.Transactional; | ||
| 20 | 21 | ||
| 21 | import java.io.ByteArrayInputStream; | 22 | import java.io.ByteArrayInputStream; |
| 22 | import java.io.File; | 23 | import java.io.File; |
| @@ -1080,4 +1081,43 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -1080,4 +1081,43 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 1080 | 1081 | ||
| 1081 | return rs; | 1082 | return rs; |
| 1082 | } | 1083 | } |
| 1084 | + | ||
| 1085 | + @Override | ||
| 1086 | + @Transactional | ||
| 1087 | + public Map<String, Object> updSwitchDir(String lineIds) { | ||
| 1088 | + Map<String, Object> rs = new HashMap<>(); | ||
| 1089 | + try{ | ||
| 1090 | + if(lineIds!=null && lineIds !="") { | ||
| 1091 | + Integer lineId = Integer.parseInt(lineIds); | ||
| 1092 | + // 上行站点切换到下行. | ||
| 1093 | + repository.stationRouteDir(lineId); | ||
| 1094 | + routeRepository.sectionRouteDir(lineId); | ||
| 1095 | + } | ||
| 1096 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 1097 | + }catch(Exception e){ | ||
| 1098 | + logger.error("", e); | ||
| 1099 | + rs.put("status", ResponseCode.ERROR); | ||
| 1100 | + } | ||
| 1101 | + return rs; | ||
| 1102 | + } | ||
| 1103 | + | ||
| 1104 | + @Override | ||
| 1105 | + @Transactional | ||
| 1106 | + public Map<String, Object> upddis(Map<String, Object> map) { | ||
| 1107 | + Map<String, Object> rs = new HashMap<>(); | ||
| 1108 | + try{ | ||
| 1109 | + Iterator it = map.entrySet().iterator(); | ||
| 1110 | + while(it.hasNext()){ | ||
| 1111 | + java.util.Map.Entry entry = (java.util.Map.Entry)it.next(); | ||
| 1112 | + Integer id = Integer.parseInt(entry.getKey().toString().split("_")[1]); //返回对应的键 | ||
| 1113 | + Double dis = Double.parseDouble(entry.getValue().toString()) / 1000; //返回对应的值 | ||
| 1114 | + repository.upddis(id, dis); | ||
| 1115 | + } | ||
| 1116 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 1117 | + }catch(Exception e){ | ||
| 1118 | + logger.error("", e); | ||
| 1119 | + rs.put("status", ResponseCode.ERROR); | ||
| 1120 | + } | ||
| 1121 | + return rs; | ||
| 1122 | + } | ||
| 1083 | } | 1123 | } |
src/main/java/com/bsth/service/oil/CwjyService.java
| 1 | package com.bsth.service.oil; | 1 | package com.bsth.service.oil; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import java.util.List; | ||
| 4 | import java.util.Map; | 5 | import java.util.Map; |
| 5 | 6 | ||
| 6 | import com.bsth.entity.oil.Cwjy; | 7 | import com.bsth.entity.oil.Cwjy; |
| @@ -9,8 +10,8 @@ import com.bsth.service.BaseService; | @@ -9,8 +10,8 @@ import com.bsth.service.BaseService; | ||
| 9 | import com.bsth.util.PageObject; | 10 | import com.bsth.util.PageObject; |
| 10 | 11 | ||
| 11 | public interface CwjyService extends BaseService<Cwjy, Integer>{ | 12 | public interface CwjyService extends BaseService<Cwjy, Integer>{ |
| 12 | - PageObject<Ylxxb> Pagequery(Map<String, Object> map) ; | 13 | + List<Ylxxb> Pagequery(Map<String, Object> map) ; |
| 13 | Ylxxb bynbbm(Map<String, Object> map); | 14 | Ylxxb bynbbm(Map<String, Object> map); |
| 14 | 15 | ||
| 15 | - Map<String, Object> savejzl(Ylxxb t); | 16 | + Map<String, Object> savejzl(Map<String, Object> map) throws Exception ; |
| 16 | } | 17 | } |
src/main/java/com/bsth/service/oil/DlbService.java
| 1 | package com.bsth.service.oil; | 1 | package com.bsth.service.oil; |
| 2 | 2 | ||
| 3 | +import java.util.List; | ||
| 3 | import java.util.Map; | 4 | import java.util.Map; |
| 4 | 5 | ||
| 5 | import com.bsth.entity.oil.Dlb; | 6 | import com.bsth.entity.oil.Dlb; |
| @@ -11,4 +12,10 @@ public interface DlbService extends BaseService<Dlb, Integer>{ | @@ -11,4 +12,10 @@ public interface DlbService extends BaseService<Dlb, Integer>{ | ||
| 11 | Map<String, Object> sort(Map<String, Object> map); | 12 | Map<String, Object> sort(Map<String, Object> map); |
| 12 | 13 | ||
| 13 | Map<String, Object> checkDl(Map<String, Object> map); | 14 | Map<String, Object> checkDl(Map<String, Object> map); |
| 15 | + | ||
| 16 | + List<Dlb> listDlb(Map<String, Object> map); | ||
| 17 | + | ||
| 18 | + Map<String, Object> sumYlb(Map<String, Object> map); | ||
| 19 | + | ||
| 20 | + Map<String, Object> saveDlbList(Map<String, Object> map) throws Exception; | ||
| 14 | } | 21 | } |
src/main/java/com/bsth/service/oil/YlxxbService.java
| @@ -9,6 +9,6 @@ import com.bsth.util.PageObject; | @@ -9,6 +9,6 @@ import com.bsth.util.PageObject; | ||
| 9 | public interface YlxxbService extends BaseService<Ylxxb, Integer>{ | 9 | public interface YlxxbService extends BaseService<Ylxxb, Integer>{ |
| 10 | PageObject<Ylxxb> Pagequery(Map<String, Object> map) ; | 10 | PageObject<Ylxxb> Pagequery(Map<String, Object> map) ; |
| 11 | 11 | ||
| 12 | - Map<String, Object> checkJsy(Map<String, Object> map); | 12 | + Map<String, Object> checkJsy(Map<String, Object> map) throws Exception; |
| 13 | 13 | ||
| 14 | } | 14 | } |
src/main/java/com/bsth/service/oil/impl/CwjyServiceImpl.java
| @@ -6,17 +6,26 @@ import java.text.ParseException; | @@ -6,17 +6,26 @@ import java.text.ParseException; | ||
| 6 | import java.text.SimpleDateFormat; | 6 | import java.text.SimpleDateFormat; |
| 7 | import java.util.ArrayList; | 7 | import java.util.ArrayList; |
| 8 | import java.util.Arrays; | 8 | import java.util.Arrays; |
| 9 | +import java.util.Date; | ||
| 9 | import java.util.HashMap; | 10 | import java.util.HashMap; |
| 10 | import java.util.List; | 11 | import java.util.List; |
| 11 | import java.util.Map; | 12 | import java.util.Map; |
| 12 | 13 | ||
| 14 | +import javax.transaction.Transactional; | ||
| 15 | + | ||
| 16 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 17 | +import org.slf4j.Logger; | ||
| 18 | +import org.slf4j.LoggerFactory; | ||
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | import org.springframework.jdbc.core.JdbcTemplate; | 20 | import org.springframework.jdbc.core.JdbcTemplate; |
| 15 | import org.springframework.jdbc.core.RowMapper; | 21 | import org.springframework.jdbc.core.RowMapper; |
| 16 | import org.springframework.stereotype.Service; | 22 | import org.springframework.stereotype.Service; |
| 17 | 23 | ||
| 24 | +import com.alibaba.fastjson.JSONArray; | ||
| 25 | +import com.alibaba.fastjson.JSONObject; | ||
| 18 | import com.bsth.common.ResponseCode; | 26 | import com.bsth.common.ResponseCode; |
| 19 | import com.bsth.entity.oil.Cwjy; | 27 | import com.bsth.entity.oil.Cwjy; |
| 28 | +import com.bsth.entity.oil.Cyl; | ||
| 20 | import com.bsth.entity.oil.Ylxxb; | 29 | import com.bsth.entity.oil.Ylxxb; |
| 21 | import com.bsth.repository.oil.CwjyRepository; | 30 | import com.bsth.repository.oil.CwjyRepository; |
| 22 | import com.bsth.repository.oil.YlxxbRepository; | 31 | import com.bsth.repository.oil.YlxxbRepository; |
| @@ -35,8 +44,8 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw | @@ -35,8 +44,8 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw | ||
| 35 | 44 | ||
| 36 | @Autowired | 45 | @Autowired |
| 37 | JdbcTemplate jdbcTemplate; | 46 | JdbcTemplate jdbcTemplate; |
| 38 | - | ||
| 39 | - @SuppressWarnings("unchecked") | 47 | + Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 48 | + /*@SuppressWarnings("unchecked") | ||
| 40 | public PageObject<Ylxxb> Pagequery(Map<String, Object> map) { | 49 | public PageObject<Ylxxb> Pagequery(Map<String, Object> map) { |
| 41 | int page=Integer.parseInt(map.get("page").toString()); | 50 | int page=Integer.parseInt(map.get("page").toString()); |
| 42 | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | 51 | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); |
| @@ -129,7 +138,7 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw | @@ -129,7 +138,7 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw | ||
| 129 | return t; | 138 | return t; |
| 130 | } | 139 | } |
| 131 | }); | 140 | }); |
| 132 | - /*List<Object[]> list=repository.obtainCwjycl(rq,nbbm); | 141 | + List<Object[]> list=repository.obtainCwjycl(rq,nbbm); |
| 133 | for (int i = 0; i < list.size(); i++) { | 142 | for (int i = 0; i < list.size(); i++) { |
| 134 | Ylxxb y=new Ylxxb(); | 143 | Ylxxb y=new Ylxxb(); |
| 135 | y.setGsdm(list.get(i)[0]==null?"":list.get(i)[0].toString()); | 144 | y.setGsdm(list.get(i)[0]==null?"":list.get(i)[0].toString()); |
| @@ -148,13 +157,13 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw | @@ -148,13 +157,13 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw | ||
| 148 | e.printStackTrace(); | 157 | e.printStackTrace(); |
| 149 | } | 158 | } |
| 150 | yList.add(y); | 159 | yList.add(y); |
| 151 | - }*/ | 160 | + } |
| 152 | PageHelper pageHelper = new PageHelper(listsize, map); | 161 | PageHelper pageHelper = new PageHelper(listsize, map); |
| 153 | pageHelper.getMap(); | 162 | pageHelper.getMap(); |
| 154 | PageObject<Ylxxb> pageObject=pageHelper.getPageObject(); | 163 | PageObject<Ylxxb> pageObject=pageHelper.getPageObject(); |
| 155 | pageObject.setDataList(yList); | 164 | pageObject.setDataList(yList); |
| 156 | return pageObject; | 165 | return pageObject; |
| 157 | - } | 166 | + }*/ |
| 158 | 167 | ||
| 159 | @Override | 168 | @Override |
| 160 | public Ylxxb bynbbm(Map<String, Object> map) { | 169 | public Ylxxb bynbbm(Map<String, Object> map) { |
| @@ -188,28 +197,119 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw | @@ -188,28 +197,119 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw | ||
| 188 | return y; | 197 | return y; |
| 189 | } | 198 | } |
| 190 | 199 | ||
| 200 | + @Transactional | ||
| 191 | @Override | 201 | @Override |
| 192 | - public Map<String, Object> savejzl(Ylxxb t) { | 202 | + public Map<String, Object> savejzl(Map<String, Object> maps) throws Exception { |
| 193 | // TODO Auto-generated method stub | 203 | // TODO Auto-generated method stub |
| 194 | Map<String, Object> map=new HashMap<String,Object>(); | 204 | Map<String, Object> map=new HashMap<String,Object>(); |
| 195 | try { | 205 | try { |
| 196 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 206 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 197 | - String rq = sdf.format(t.getYyrq()); | ||
| 198 | - String nbbm=t.getNbbm(); | ||
| 199 | - List<Ylxxb> yList=ylxxbRepository.obtainYlxx2(rq,nbbm); | ||
| 200 | - if(yList.size()>0){ | ||
| 201 | - t.setId(yList.get(0).getId()); | ||
| 202 | - ylxxbRepository.save(t); | ||
| 203 | - }else{ | ||
| 204 | - ylxxbRepository.save(t); | 207 | +// String rq = sdf.format(t.getYyrq()); |
| 208 | +// String nbbm=t.getNbbm(); | ||
| 209 | +// List<Ylxxb> yList=ylxxbRepository.obtainYlxx2(rq,nbbm); | ||
| 210 | +// if(yList.size()>0){ | ||
| 211 | +// t.setId(yList.get(0).getId()); | ||
| 212 | +// ylxxbRepository.save(t); | ||
| 213 | +// }else{ | ||
| 214 | +// ylxxbRepository.save(t); | ||
| 215 | +// } | ||
| 216 | + String gsbm=maps.get("gsbm").toString(); | ||
| 217 | + String fgsbm=maps.get("fgsbm").toString(); | ||
| 218 | + String rq=maps.get("rq").toString(); | ||
| 219 | + Date date=sdf.parse(rq); | ||
| 220 | + String json =StringEscapeUtils.unescapeHtml4(maps.get("ylbList").toString()); | ||
| 221 | + JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 222 | + JSONObject jsonObject; | ||
| 223 | + // 获取车辆存油信息 | ||
| 224 | + for (int i = 0; i < jsonArray.size(); i++) { | ||
| 225 | + jsonObject=jsonArray.getJSONObject(i); | ||
| 226 | + Integer id =jsonObject.getInteger("id"); | ||
| 227 | + String jsy=jsonObject.getString("jsy"); | ||
| 228 | + double jzl=jsonObject.getDoubleValue("jzl"); | ||
| 229 | + String stationid=jsonObject.getString("stationid"); | ||
| 230 | + String nbbm=jsonObject.getString("nbbm"); | ||
| 231 | + int nylx=jsonObject.getIntValue("nylx"); | ||
| 232 | + String jyggh=jsonObject.getString("jyggh"); | ||
| 233 | + String bz=jsonObject.getString("bz"); | ||
| 234 | + Ylxxb y; | ||
| 235 | + if(id>0){ | ||
| 236 | + y=ylxxbRepository.findOne(id); | ||
| 237 | + y.setJsy(jsy); | ||
| 238 | + y.setJzl(jzl); | ||
| 239 | + y.setStationid(stationid); | ||
| 240 | + y.setJyggh(jyggh); | ||
| 241 | + y.setBz(bz); | ||
| 242 | + y.setCreatetime(new Date()); | ||
| 243 | + y.setYyrq(date); | ||
| 244 | + ylxxbRepository.save(y); | ||
| 245 | + }else{ | ||
| 246 | + if(jsy!="" && jzl>0){ | ||
| 247 | + y=new Ylxxb(); | ||
| 248 | + y.setGsdm(gsbm); | ||
| 249 | + y.setJsy(jsy); | ||
| 250 | + y.setNbbm(nbbm); | ||
| 251 | + y.setJzl(jzl); | ||
| 252 | + y.setStationid(stationid); | ||
| 253 | + y.setJyggh(jyggh); | ||
| 254 | + y.setBz(bz); | ||
| 255 | + y.setCreatetime(new Date()); | ||
| 256 | + y.setYyrq(date); | ||
| 257 | + y.setJylx(1); | ||
| 258 | + y.setNylx(0); | ||
| 259 | + ylxxbRepository.save(y); | ||
| 260 | + } | ||
| 261 | + } | ||
| 205 | } | 262 | } |
| 206 | map.put("status", ResponseCode.SUCCESS); | 263 | map.put("status", ResponseCode.SUCCESS); |
| 264 | + | ||
| 207 | } catch (Exception e) { | 265 | } catch (Exception e) { |
| 208 | map.put("status", ResponseCode.ERROR); | 266 | map.put("status", ResponseCode.ERROR); |
| 209 | - e.printStackTrace(); | 267 | + logger.error("save erro.", e); |
| 268 | + throw e; | ||
| 210 | // TODO: handle exception | 269 | // TODO: handle exception |
| 211 | } | 270 | } |
| 212 | return map; | 271 | return map; |
| 213 | } | 272 | } |
| 214 | 273 | ||
| 274 | + @Override | ||
| 275 | + public List<Ylxxb> Pagequery(Map<String, Object> map) { | ||
| 276 | + // TODO Auto-generated method stub | ||
| 277 | + String rq=map.get("rq").toString(); | ||
| 278 | + String nbbm=map.get("nbbh").toString(); | ||
| 279 | + String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm," | ||
| 280 | + + "b.jyggh as jyggh,b.jzl as jzl ,b.stationid as stationid,b.jsy as jsy," | ||
| 281 | + + "b.nylx as nylx,b.yj as yj,b.bz as bz,b.id as id ,c.jsy as ldgh FROM bsth_c_cwjy a "+ | ||
| 282 | + " left join (" | ||
| 283 | + + " select * from bsth_c_ylxxb b " | ||
| 284 | + + "where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1) b " + | ||
| 285 | + " on a.nbbm=b.nbbm " | ||
| 286 | + + "left join (select nbbm,group_concat(jsy) as jsy " | ||
| 287 | + + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) group by nbbm "+ | ||
| 288 | + " ) c on a.nbbm=c.nbbm " | ||
| 289 | + + "where a.nbbm like '%"+nbbm+"%'"; | ||
| 290 | + | ||
| 291 | + List<Ylxxb> yList= jdbcTemplate.query(sql, | ||
| 292 | + new RowMapper<Ylxxb>(){ | ||
| 293 | + @Override | ||
| 294 | + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 295 | + Ylxxb t=new Ylxxb(); | ||
| 296 | + t.setId(rs.getInt("id")); | ||
| 297 | + t.setGsdm(rs.getString("gsdm")); | ||
| 298 | + t.setFgsdm(rs.getString("fgsdm")); | ||
| 299 | + t.setNbbm(rs.getString("nbbm")); | ||
| 300 | + t.setJyggh(rs.getString("jyggh")); | ||
| 301 | + t.setJsy(rs.getString("jsy")); | ||
| 302 | + t.setJzl(rs.getDouble("jzl")); | ||
| 303 | + t.setStationid(rs.getString("stationid")); | ||
| 304 | + t.setNylx(rs.getInt("nylx")); | ||
| 305 | + t.setYj(rs.getDouble("yj")); | ||
| 306 | + t.setBz(rs.getString("bz")); | ||
| 307 | + t.setLdgh(rs.getString("ldgh")); | ||
| 308 | + return t; | ||
| 309 | + } | ||
| 310 | + }); | ||
| 311 | + | ||
| 312 | + return yList; | ||
| 313 | + } | ||
| 314 | + | ||
| 215 | } | 315 | } |
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
| @@ -14,6 +14,7 @@ import java.util.Map; | @@ -14,6 +14,7 @@ import java.util.Map; | ||
| 14 | 14 | ||
| 15 | import javax.transaction.Transactional; | 15 | import javax.transaction.Transactional; |
| 16 | 16 | ||
| 17 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 17 | import org.slf4j.Logger; | 18 | import org.slf4j.Logger; |
| 18 | import org.slf4j.LoggerFactory; | 19 | import org.slf4j.LoggerFactory; |
| 19 | import org.springframework.beans.factory.annotation.Autowired; | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -22,8 +23,12 @@ import org.springframework.data.domain.Sort.Direction; | @@ -22,8 +23,12 @@ import org.springframework.data.domain.Sort.Direction; | ||
| 22 | import org.springframework.jdbc.core.JdbcTemplate; | 23 | import org.springframework.jdbc.core.JdbcTemplate; |
| 23 | import org.springframework.stereotype.Service; | 24 | import org.springframework.stereotype.Service; |
| 24 | 25 | ||
| 26 | +import com.alibaba.fastjson.JSONArray; | ||
| 27 | +import com.alibaba.fastjson.JSONObject; | ||
| 25 | import com.bsth.common.ResponseCode; | 28 | import com.bsth.common.ResponseCode; |
| 29 | +import com.bsth.data.BasicData; | ||
| 26 | import com.bsth.entity.Cars; | 30 | import com.bsth.entity.Cars; |
| 31 | +import com.bsth.entity.Line; | ||
| 27 | import com.bsth.entity.oil.Cdl; | 32 | import com.bsth.entity.oil.Cdl; |
| 28 | import com.bsth.entity.oil.Cyl; | 33 | import com.bsth.entity.oil.Cyl; |
| 29 | import com.bsth.entity.oil.Dlb; | 34 | import com.bsth.entity.oil.Dlb; |
| @@ -41,6 +46,7 @@ import com.bsth.repository.oil.YlxxbRepository; | @@ -41,6 +46,7 @@ import com.bsth.repository.oil.YlxxbRepository; | ||
| 41 | import com.bsth.service.impl.BaseServiceImpl; | 46 | import com.bsth.service.impl.BaseServiceImpl; |
| 42 | import com.bsth.service.oil.DlbService; | 47 | import com.bsth.service.oil.DlbService; |
| 43 | import com.bsth.service.realcontrol.ScheduleRealInfoService; | 48 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 49 | +import com.bsth.util.Arith; | ||
| 44 | 50 | ||
| 45 | @Service | 51 | @Service |
| 46 | public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbService{ | 52 | public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbService{ |
| @@ -93,13 +99,13 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -93,13 +99,13 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 93 | // TODO Auto-generated method stub | 99 | // TODO Auto-generated method stub |
| 94 | Map<String, Object> newMap=new HashMap<String,Object>(); | 100 | Map<String, Object> newMap=new HashMap<String,Object>(); |
| 95 | //当天DLB信息 | 101 | //当天DLB信息 |
| 96 | - List<Dlb> dlList=repository.obtainDl(rq); | 102 | + List<Dlb> dlList=repository.obtainDl(rq, gsbm, "", line, "", "nbbm"); |
| 97 | //当天YLXXB信息 | 103 | //当天YLXXB信息 |
| 98 | List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,gsbm); | 104 | List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,gsbm); |
| 99 | //当天加电信息表 | 105 | //当天加电信息表 |
| 100 | List<Jdl> jdlList=jdlRepository.JdlList(rq); | 106 | List<Jdl> jdlList=jdlRepository.JdlList(rq); |
| 101 | //前一天所有车辆最后进场班次信息 | 107 | //前一天所有车辆最后进场班次信息 |
| 102 | - List<Dlb> dlListBe=repository.obtainYlbefore(rq); | 108 | + List<Dlb> dlListBe=repository.obtainYlbefore(rq, "", "", "", ""); |
| 103 | List<Cdl> cdyList=cdlRepository.obtainCdl(); | 109 | List<Cdl> cdyList=cdlRepository.obtainCdl(); |
| 104 | //从排班表中计算出行驶的总里程 | 110 | //从排班表中计算出行驶的总里程 |
| 105 | List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","",""); | 111 | List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","",""); |
| @@ -129,6 +135,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -129,6 +135,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 129 | } | 135 | } |
| 130 | try { | 136 | try { |
| 131 | //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | 137 | //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 |
| 138 | + Double jzl=0.0; | ||
| 132 | if(map.get("seqNumber").toString().equals("1")){ | 139 | if(map.get("seqNumber").toString().equals("1")){ |
| 133 | boolean fage=true; | 140 | boolean fage=true; |
| 134 | for (int i = 0; i < dlListBe.size(); i++) { | 141 | for (int i = 0; i < dlListBe.size(); i++) { |
| @@ -143,7 +150,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -143,7 +150,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 143 | for (int y = 0; y < cdyList.size(); y++) { | 150 | for (int y = 0; y < cdyList.size(); y++) { |
| 144 | Cdl cdl=cdyList.get(y); | 151 | Cdl cdl=cdyList.get(y); |
| 145 | if(map.get("clZbh").toString().equals(cdl.getNbbm())){ | 152 | if(map.get("clZbh").toString().equals(cdl.getNbbm())){ |
| 146 | - t.setCzcd(cdl.getClcd()); | 153 | + t.setCzcd(cdl.getClcd()==null?0:cdl.getClcd()); |
| 147 | fage=false; | 154 | fage=false; |
| 148 | break; | 155 | break; |
| 149 | } | 156 | } |
| @@ -152,9 +159,17 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -152,9 +159,17 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 152 | if(fage){ | 159 | if(fage){ |
| 153 | t.setCzcd(0.0); | 160 | t.setCzcd(0.0); |
| 154 | } | 161 | } |
| 162 | + | ||
| 163 | + //手动导入没有驾驶员工号 | ||
| 164 | + for (int i = 0; i < jdlList.size(); i++) { | ||
| 165 | + Jdl jdl=jdlList.get(i); | ||
| 166 | + if(map.get("clZbh").toString().equals(jdl.getNbbm()) ){ | ||
| 167 | + jzl+=jdl.getJdl(); | ||
| 168 | + } | ||
| 169 | + } | ||
| 155 | } | 170 | } |
| 156 | 171 | ||
| 157 | - Double jzl=0.0; | 172 | + |
| 158 | //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | 173 | //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) |
| 159 | for(int j=0;j<ylxxList.size();j++){ | 174 | for(int j=0;j<ylxxList.size();j++){ |
| 160 | Ylxxb ylxxb= ylxxList.get(j); | 175 | Ylxxb ylxxb= ylxxList.get(j); |
| @@ -163,24 +178,22 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -163,24 +178,22 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 163 | } | 178 | } |
| 164 | } | 179 | } |
| 165 | 180 | ||
| 166 | - //手动导入没有驾驶员工号 | ||
| 167 | - for (int i = 0; i < jdlList.size(); i++) { | ||
| 168 | - Jdl jdl=jdlList.get(i); | ||
| 169 | - if(map.get("clZbh").toString().equals(jdl.getNbbm()) ){ | ||
| 170 | - jzl+=jdl.getJdl(); | ||
| 171 | - } | ||
| 172 | - } | ||
| 173 | t.setCdl(jzl); | 181 | t.setCdl(jzl); |
| 174 | - t.setJzcd(t.getCzcd()); | 182 | + if(type.equals("add")){ |
| 183 | + t.setHd(jzl); | ||
| 184 | + t.setJzcd(t.getCzcd()); | ||
| 185 | + } | ||
| 186 | + | ||
| 175 | t.setNbbm(map.get("clZbh").toString()); | 187 | t.setNbbm(map.get("clZbh").toString()); |
| 176 | t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); | 188 | t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); |
| 177 | t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); | 189 | t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); |
| 178 | t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); | 190 | t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); |
| 179 | - t.setHd(jzl); | ||
| 180 | t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | 191 | t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); |
| 181 | t.setSsgsdm(map.get("company")==null?"":map.get("company").toString()); | 192 | t.setSsgsdm(map.get("company")==null?"":map.get("company").toString()); |
| 182 | t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString()); | 193 | t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString()); |
| 194 | + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | ||
| 183 | t.setRq(sdf.parse(rq)); | 195 | t.setRq(sdf.parse(rq)); |
| 196 | + t.setCreatetime(new Date()); | ||
| 184 | /*if(type.equals("add")){ | 197 | /*if(type.equals("add")){ |
| 185 | addList.add(t); | 198 | addList.add(t); |
| 186 | }else{ | 199 | }else{ |
| @@ -247,25 +260,48 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -247,25 +260,48 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 247 | @Override | 260 | @Override |
| 248 | public Map<String, Object> checkDl(Map<String, Object> map) { | 261 | public Map<String, Object> checkDl(Map<String, Object> map) { |
| 249 | Map<String, Object> newMap=new HashMap<String,Object>(); | 262 | Map<String, Object> newMap=new HashMap<String,Object>(); |
| 250 | - String xlbm=map.get("xlbm_eq").toString(); | ||
| 251 | - String gsbm=""; | ||
| 252 | - if(map.get("ssgsdm_like")!=null){ | ||
| 253 | - gsbm=map.get("ssgsdm_like").toString(); | ||
| 254 | - } | 263 | +// String xlbm=""; |
| 264 | +// if(map.get("xlbm_like")!=null){ | ||
| 265 | +// xlbm=map.get("xlbm_like").toString(); | ||
| 266 | +// } | ||
| 255 | // TODO Auto-generated method stub | 267 | // TODO Auto-generated method stub |
| 268 | + | ||
| 269 | + List<Cars> carsList = carsRepository.findCars(); | ||
| 270 | + Map<String, String> carsMap = new HashMap<String, String>(); | ||
| 271 | + for (int i = 0; i < carsList.size(); i++) { | ||
| 272 | + Cars c = carsList.get(i); | ||
| 273 | + carsMap.put(c.getInsideCode(), c.getBrancheCompanyCode()==null?"":c.getBrancheCompanyCode()); | ||
| 274 | + } | ||
| 275 | + | ||
| 256 | try{ | 276 | try{ |
| 257 | //获取车辆存油信息 | 277 | //获取车辆存油信息 |
| 258 | -// List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); | 278 | + |
| 259 | String rq=map.get("rq").toString(); | 279 | String rq=map.get("rq").toString(); |
| 260 | - List<Dlb> dlbList=repository.obtainDl(rq); | ||
| 261 | - List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,1,gsbm); | ||
| 262 | - //当天加电信息表 | ||
| 263 | - List<Jdl> jdlList=jdlRepository.JdlList(rq); | 280 | + String xlbm=""; |
| 281 | + if(map.get("xlbm_like")!=null){ | ||
| 282 | + xlbm= map.get("xlbm_like").toString().trim(); | ||
| 283 | + } | ||
| 284 | + String gsbm=""; | ||
| 285 | + if(map.get("ssgsdm_like")!=null){ | ||
| 286 | + gsbm=map.get("ssgsdm_like").toString(); | ||
| 287 | + } | ||
| 288 | + String fgsbm=""; | ||
| 289 | + if(map.get("fgsdm_like")!=null){ | ||
| 290 | + fgsbm=map.get("fgsdm_like").toString(); | ||
| 291 | + } | ||
| 292 | + String nbbm=""; | ||
| 293 | + if(map.get("nbbm_eq")!=null){ | ||
| 294 | + nbbm=map.get("nbbm_eq").toString(); | ||
| 295 | + } | ||
| 296 | + List<Dlb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm); | ||
| 297 | +// List<Cdl> cylList=cdlRepository.obtainCdl(nbbm, gsbm); | ||
| 298 | + List<Dlb> ylbList=repository.obtainDl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); | ||
| 299 | + List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); | ||
| 264 | for (int i = 0; i < ylxxbList.size(); i++) { | 300 | for (int i = 0; i < ylxxbList.size(); i++) { |
| 265 | Boolean fage=true; | 301 | Boolean fage=true; |
| 266 | Ylxxb y1=ylxxbList.get(i); | 302 | Ylxxb y1=ylxxbList.get(i); |
| 267 | - for(int y=0;y<dlbList.size();y++){ | ||
| 268 | - Dlb y2=dlbList.get(y); | 303 | + for(int y=0;y<ylbList.size();y++){ |
| 304 | + Dlb y2=ylbList.get(y); | ||
| 269 | if(y1.getNbbm().equals(y2.getNbbm())){ | 305 | if(y1.getNbbm().equals(y2.getNbbm())){ |
| 270 | fage=false; | 306 | fage=false; |
| 271 | break; | 307 | break; |
| @@ -279,39 +315,276 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -279,39 +315,276 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 279 | t.setJsy(y1.getJsy()); | 315 | t.setJsy(y1.getJsy()); |
| 280 | t.setCdl(y1.getJzl()); | 316 | t.setCdl(y1.getJzl()); |
| 281 | t.setSsgsdm(y1.getGsdm()); | 317 | t.setSsgsdm(y1.getGsdm()); |
| 282 | - t.setXlbm(xlbm); | ||
| 283 | - repository.save(t); | 318 | + String fgsdm=""; |
| 319 | + if(null!=carsMap.get(y1.getNbbm())){ | ||
| 320 | + fgsdm=carsMap.get(y1.getNbbm()); | ||
| 321 | + } | ||
| 322 | + t.setFgsdm(fgsdm); | ||
| 323 | + t.setJcsx(1); | ||
| 324 | + Line line= BasicData.nbbm2LineMap.get(y1.getNbbm()); | ||
| 325 | + if(null !=line){ | ||
| 326 | + t.setXlbm(line.getLineCode()); | ||
| 327 | + }else{ | ||
| 328 | + t.setXlbm(""); | ||
| 329 | + } | ||
| 330 | + boolean status=true; | ||
| 331 | + for (int j = 0; j < ylListBe.size(); j++) { | ||
| 332 | + Dlb b=ylListBe.get(j); | ||
| 333 | + if(b.getNbbm().equals(y1.getNbbm())){ | ||
| 334 | + t.setCzcd(b.getJzcd()); | ||
| 335 | + status=false; | ||
| 336 | + break; | ||
| 337 | + } | ||
| 338 | + } | ||
| 339 | + /*if(status){ | ||
| 340 | + for (int j = 0; j < cylList.size(); j++) { | ||
| 341 | + Cyl c=cylList.get(j); | ||
| 342 | + if(c.getNbbm().equals(y1.getNbbm())){ | ||
| 343 | + t.setCzyl(c.getCyl()); | ||
| 344 | + cyl=c; | ||
| 345 | + status=false; | ||
| 346 | + break; | ||
| 347 | + } | ||
| 348 | + } | ||
| 349 | + }*/ | ||
| 350 | + if(status){ | ||
| 351 | + t.setCzcd(0.0); | ||
| 352 | + } | ||
| 353 | +// double jzyl=Arith.add(t.getJzl(), t.getCzyl()); | ||
| 354 | + t.setJzcd(100.0); | ||
| 355 | + t.setHd(0.0); | ||
| 356 | + if(fgsdm.equals(fgsbm)){ | ||
| 357 | + repository.save(t); | ||
| 358 | + } | ||
| 284 | } | 359 | } |
| 285 | } | 360 | } |
| 286 | - | ||
| 287 | - for (int i = 0; i < jdlList.size(); i++) { | ||
| 288 | - Boolean fage=true; | ||
| 289 | - Jdl y1=jdlList.get(i); | ||
| 290 | - for(int y=0;y<dlbList.size();y++){ | ||
| 291 | - Dlb y2=dlbList.get(y); | ||
| 292 | - if(y1.getNbbm().equals(y2.getNbbm())){ | ||
| 293 | - fage=false; | ||
| 294 | - break; | 361 | + newMap.put("status", ResponseCode.SUCCESS); |
| 362 | + }catch(Exception e){ | ||
| 363 | + newMap.put("status", ResponseCode.ERROR); | ||
| 364 | + logger.error("save erro.", e); | ||
| 365 | + throw e; | ||
| 366 | + } | ||
| 367 | + | ||
| 368 | + return newMap; | ||
| 369 | + } | ||
| 370 | + | ||
| 371 | + @Override | ||
| 372 | + public List<Dlb> listDlb(Map<String, Object> map) { | ||
| 373 | + // TODO Auto-generated method stub | ||
| 374 | + List<Dlb> listDlb=new ArrayList<Dlb>(); | ||
| 375 | + List<String> stringList=new ArrayList<String>(); | ||
| 376 | + String rq=map.get("rq").toString(); | ||
| 377 | + String gsbm=map.get("ssgsdm_like").toString(); | ||
| 378 | + String fgsbm=map.get("fgsdm_like").toString(); | ||
| 379 | + String xlbm=map.get("xlbm_like").toString().trim(); | ||
| 380 | + String nbbm=map.get("nbbm_eq").toString(); | ||
| 381 | + String sxtj=map.get("sxtj").toString(); | ||
| 382 | + | ||
| 383 | + if(nbbm.trim()!=""){ | ||
| 384 | + stringList.add(nbbm); | ||
| 385 | + listDlb=repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 386 | + }else{ | ||
| 387 | + //全部 | ||
| 388 | + if(sxtj.equals("0")){ | ||
| 389 | + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); | ||
| 390 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 391 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 392 | + stringList.add(clbm); | ||
| 393 | + } | ||
| 394 | + if(stringList.size()>0){ | ||
| 395 | + listDlb=repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 396 | + } | ||
| 397 | + }else{ | ||
| 398 | + List<Object[]> objectLists; | ||
| 399 | + if(sxtj.equals("3")){ | ||
| 400 | + //有加油没里程 | ||
| 401 | + objectLists=repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 402 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 403 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 404 | + double jzl=Double.parseDouble(objectLists.get(i)[1].toString()); | ||
| 405 | + double zlc=Double.parseDouble(objectLists.get(i)[2].toString()); | ||
| 406 | + if(jzl>0 && zlc<=0){ | ||
| 407 | + stringList.add(clbm); | ||
| 408 | + } | ||
| 409 | + | ||
| 410 | + } | ||
| 411 | + | ||
| 412 | + }else if(sxtj.equals("4")){ | ||
| 413 | + //有里程没加油 | ||
| 414 | + objectLists=repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 415 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 416 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 417 | + double jzl=Double.parseDouble(objectLists.get(i)[1].toString()); | ||
| 418 | + double zlc=Double.parseDouble(objectLists.get(i)[2].toString()); | ||
| 419 | + if(zlc>0 && jzl<=0){ | ||
| 420 | + stringList.add(clbm); | ||
| 421 | + } | ||
| 422 | + | ||
| 423 | + } | ||
| 424 | + }else{ | ||
| 425 | + objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); | ||
| 426 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 427 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 428 | + int cs=Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 429 | + //一车一单 | ||
| 430 | + if(sxtj.equals("1")){ | ||
| 431 | + if(cs==1){ | ||
| 432 | + stringList.add(clbm); | ||
| 433 | + } | ||
| 434 | + } | ||
| 435 | + //一车多单 | ||
| 436 | + if(sxtj.equals("2")){ | ||
| 437 | + if(cs>1){ | ||
| 438 | + stringList.add(clbm); | ||
| 439 | + } | ||
| 440 | + } | ||
| 295 | } | 441 | } |
| 296 | } | 442 | } |
| 297 | 443 | ||
| 298 | - if(fage){ | ||
| 299 | - Dlb t=new Dlb(); | ||
| 300 | - t.setNbbm(y1.getNbbm()); | ||
| 301 | - t.setRq(y1.getRq()); | ||
| 302 | -// t.setJsy(y1.getJsy()); | ||
| 303 | - t.setCdl(y1.getJdl()); | ||
| 304 | - t.setSsgsdm(y1.getGsBm()); | ||
| 305 | - t.setXlbm(xlbm); | ||
| 306 | - repository.save(t); | 444 | + if(stringList.size()>0){ |
| 445 | + listDlb=repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 307 | } | 446 | } |
| 308 | } | 447 | } |
| 309 | - newMap.put("status", ResponseCode.SUCCESS); | 448 | + } |
| 449 | + | ||
| 450 | + return listDlb; | ||
| 451 | + } | ||
| 452 | + | ||
| 453 | + @Override | ||
| 454 | + public Map<String, Object> sumYlb(Map<String, Object> map) { | ||
| 455 | + // TODO Auto-generated method stub | ||
| 456 | + List<String> stringList = new ArrayList<String>(); | ||
| 457 | + String rq = map.get("rq").toString(); | ||
| 458 | + String gsbm = map.get("ssgsdm_like").toString(); | ||
| 459 | + String fgsbm = map.get("fgsdm_like").toString(); | ||
| 460 | + String xlbm = map.get("xlbm_like").toString().trim(); | ||
| 461 | + String nbbm = map.get("nbbm_eq").toString(); | ||
| 462 | + String sxtj = map.get("sxtj").toString(); | ||
| 463 | + if (nbbm.trim() != "") { | ||
| 464 | + stringList.add(nbbm); | ||
| 465 | + } else { | ||
| 466 | + if (!sxtj.equals("0")) { | ||
| 467 | + List<Object[]> objectLists; | ||
| 468 | + if (sxtj.equals("3")) { | ||
| 469 | + // 有加油没里程 | ||
| 470 | + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 471 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 472 | + String clbm = objectLists.get(i)[0].toString(); | ||
| 473 | + double jzl = Double.parseDouble(objectLists.get(i)[1].toString()); | ||
| 474 | + double zlc = Double.parseDouble(objectLists.get(i)[2].toString()); | ||
| 475 | + if (jzl > 0 && zlc <= 0) { | ||
| 476 | + stringList.add(clbm); | ||
| 477 | + } | ||
| 478 | + | ||
| 479 | + } | ||
| 480 | + | ||
| 481 | + } else if (sxtj.equals("4")) { | ||
| 482 | + // 有里程没加油 | ||
| 483 | + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 484 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 485 | + String clbm = objectLists.get(i)[0].toString(); | ||
| 486 | + double jzl = Double.parseDouble(objectLists.get(i)[1].toString()); | ||
| 487 | + double zlc = Double.parseDouble(objectLists.get(i)[2].toString()); | ||
| 488 | + if (zlc > 0 && jzl <= 0) { | ||
| 489 | + stringList.add(clbm); | ||
| 490 | + } | ||
| 491 | + | ||
| 492 | + } | ||
| 493 | + } else { | ||
| 494 | + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 495 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 496 | + String clbm = objectLists.get(i)[0].toString(); | ||
| 497 | + int cs = Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 498 | + // 一车一单 | ||
| 499 | + | ||
| 500 | + if (sxtj.equals("1")) { | ||
| 501 | + if (cs == 1) { | ||
| 502 | + stringList.add(clbm); | ||
| 503 | + } | ||
| 504 | + } | ||
| 505 | + // 一车多单 | ||
| 506 | + if (sxtj.equals("2")) { | ||
| 507 | + if (cs > 1) { | ||
| 508 | + stringList.add(clbm); | ||
| 509 | + } | ||
| 510 | + } | ||
| 511 | + } | ||
| 512 | + } | ||
| 513 | + } | ||
| 514 | + } | ||
| 515 | + List<Object[]> sumYlbList = new ArrayList<Object[]>(); | ||
| 516 | + if (sxtj.equals("0")) { | ||
| 517 | + sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 518 | + } else { | ||
| 519 | + if (stringList.size() > 0) { | ||
| 520 | + | ||
| 521 | + // String strings[]=new String[stringList.size()]; | ||
| 522 | + // for(int i=0;i<stringList.size();i++){ | ||
| 523 | + // strings[i]=stringList.get(i); | ||
| 524 | + // } | ||
| 525 | + sumYlbList = repository.sumDlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 526 | + } | ||
| 527 | +// else { | ||
| 528 | +// sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 529 | +// } | ||
| 530 | + } | ||
| 531 | + Double jzl = 0.0, yh = 0.0, sh = 0.0; | ||
| 532 | + for (int i = 0; i < sumYlbList.size(); i++) { | ||
| 533 | + jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString())); | ||
| 534 | + yh = Arith.add(yh, Double.valueOf(sumYlbList.get(i)[1].toString())); | ||
| 535 | + sh = Arith.add(sh, Double.valueOf(sumYlbList.get(i)[2].toString())); | ||
| 536 | + } | ||
| 537 | + | ||
| 538 | + Map<String, Object> sumMap = new HashMap<String, Object>(); | ||
| 539 | + sumMap.put("jzl", jzl); | ||
| 540 | + sumMap.put("yh", yh); | ||
| 541 | + sumMap.put("sh", sh); | ||
| 542 | + return sumMap; | ||
| 543 | + } | ||
| 544 | + | ||
| 545 | + | ||
| 546 | + @Transactional | ||
| 547 | + @Override | ||
| 548 | + public Map<String, Object> saveDlbList(Map<String, Object> map) throws Exception { | ||
| 549 | + // TODO Auto-generated method stub | ||
| 550 | + Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 551 | + try{ | ||
| 552 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 553 | + String json =StringEscapeUtils.unescapeHtml4(map.get("dlbList").toString()); | ||
| 554 | + JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 555 | + JSONObject jsonObject; | ||
| 556 | + // 获取车辆存油信息 | ||
| 557 | +// List<Cyl> cylList = cylRepository.obtainCyl("",""); | ||
| 558 | + for (int i = 0; i < jsonArray.size(); i++) { | ||
| 559 | +// Ylb t=new Ylb(); | ||
| 560 | + jsonObject=jsonArray.getJSONObject(i); | ||
| 561 | + double czcd = jsonObject.getDoubleValue("czcd"); | ||
| 562 | + double cdl =jsonObject.getDoubleValue("cdl"); | ||
| 563 | + double jzcd =jsonObject.getDoubleValue("jzcd"); | ||
| 564 | + double sh =jsonObject.getDoubleValue("sh"); | ||
| 565 | + String shyy =jsonObject.getString("shyy"); | ||
| 566 | + double hd = jsonObject.getDoubleValue("hd"); | ||
| 567 | + int yhlx =jsonObject.getIntValue("yhlx"); | ||
| 568 | + Integer id =jsonObject.getInteger("id"); | ||
| 569 | +// String nbbm =jsonObject.getString("nbbm"); | ||
| 570 | +// String rq=jsonObject.getString("rq"); | ||
| 571 | + repository.dlbUpdate(id, czcd, jzcd, hd, sh, shyy, yhlx); | ||
| 572 | + /*for (int z = 0; z < cylList.size(); z++) { | ||
| 573 | + Cyl cyl = cylList.get(z); | ||
| 574 | + if (nbbm.equals(cyl.getNbbm())) { | ||
| 575 | + cyl.setCyl(jzyl); | ||
| 576 | + cyl.setUpdatetime(sdf.parse(rq)); | ||
| 577 | + break; | ||
| 578 | + } | ||
| 579 | + cylRepository.save(cyl); | ||
| 580 | + }*/ | ||
| 581 | + } | ||
| 582 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 310 | }catch(Exception e){ | 583 | }catch(Exception e){ |
| 311 | newMap.put("status", ResponseCode.ERROR); | 584 | newMap.put("status", ResponseCode.ERROR); |
| 312 | logger.error("save erro.", e); | 585 | logger.error("save erro.", e); |
| 586 | + throw e; | ||
| 313 | } | 587 | } |
| 314 | - | ||
| 315 | return newMap; | 588 | return newMap; |
| 316 | } | 589 | } |
| 317 | } | 590 | } |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| @@ -135,11 +135,9 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -135,11 +135,9 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 135 | Ylb ylb=ylListBe.get(i); | 135 | Ylb ylb=ylListBe.get(i); |
| 136 | if(map.get("clZbh").toString().equals(ylb.getNbbm())){ | 136 | if(map.get("clZbh").toString().equals(ylb.getNbbm())){ |
| 137 | if(ylb.getJzyl()!=null){ | 137 | if(ylb.getJzyl()!=null){ |
| 138 | - if(ylb.getJzyl()>0){ | ||
| 139 | - t.setCzyl(ylb.getJzyl()); | ||
| 140 | - fage=false; | ||
| 141 | - break; | ||
| 142 | - } | 138 | + t.setCzyl(ylb.getJzyl()); |
| 139 | + fage=false; | ||
| 140 | + break; | ||
| 143 | } | 141 | } |
| 144 | 142 | ||
| 145 | } | 143 | } |
| @@ -272,7 +270,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -272,7 +270,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 272 | for (int i = 0; i < ylListBe.size(); i++) { | 270 | for (int i = 0; i < ylListBe.size(); i++) { |
| 273 | Ylb ylb = ylListBe.get(i); | 271 | Ylb ylb = ylListBe.get(i); |
| 274 | if (map.get("clZbh").toString().equals(ylb.getNbbm())) { | 272 | if (map.get("clZbh").toString().equals(ylb.getNbbm())) { |
| 275 | - if(ylb.getJzyl()>0){ | 273 | + if(ylb.getJzyl()>=0){ |
| 276 | t.setCzyl(ylb.getJzyl()); | 274 | t.setCzyl(ylb.getJzyl()); |
| 277 | fage = false; | 275 | fage = false; |
| 278 | break; | 276 | break; |
| @@ -284,7 +282,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -284,7 +282,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 284 | for (int y = 0; y < clyList.size(); y++) { | 282 | for (int y = 0; y < clyList.size(); y++) { |
| 285 | Cyl cyl = clyList.get(y); | 283 | Cyl cyl = clyList.get(y); |
| 286 | if (map.get("clZbh").toString().equals(cyl.getNbbm())) { | 284 | if (map.get("clZbh").toString().equals(cyl.getNbbm())) { |
| 287 | - if(cyl.getCyl()>0){ | 285 | + if(cyl.getCyl()>=0){ |
| 288 | t.setCzyl(cyl.getCyl()); | 286 | t.setCzyl(cyl.getCyl()); |
| 289 | fage = false; | 287 | fage = false; |
| 290 | break; | 288 | break; |
| @@ -680,7 +678,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -680,7 +678,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 680 | if(map.get("nbbm_eq")!=null){ | 678 | if(map.get("nbbm_eq")!=null){ |
| 681 | nbbm=map.get("nbbm_eq").toString(); | 679 | nbbm=map.get("nbbm_eq").toString(); |
| 682 | } | 680 | } |
| 683 | - List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, fgsbm, xlbm, nbbm); | 681 | + List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm); |
| 684 | List<Cyl> cylList=cylRepository.obtainCyl(nbbm, gsbm); | 682 | List<Cyl> cylList=cylRepository.obtainCyl(nbbm, gsbm); |
| 685 | List<Ylb> ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); | 683 | List<Ylb> ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); |
| 686 | List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); | 684 | List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); |
| @@ -703,10 +701,18 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -703,10 +701,18 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 703 | t.setJsy(y1.getJsy()); | 701 | t.setJsy(y1.getJsy()); |
| 704 | t.setJzl(y1.getJzl()); | 702 | t.setJzl(y1.getJzl()); |
| 705 | t.setSsgsdm(y1.getGsdm()); | 703 | t.setSsgsdm(y1.getGsdm()); |
| 706 | - t.setFgsdm(carsMap.get(y1.getNbbm())); | 704 | + String fgsdm=""; |
| 705 | + if(null !=carsMap.get(y1.getNbbm())){ | ||
| 706 | + fgsdm=carsMap.get(y1.getNbbm()); | ||
| 707 | + } | ||
| 708 | + t.setFgsdm(fgsdm); | ||
| 709 | + t.setJcsx(1); | ||
| 707 | Line line= BasicData.nbbm2LineMap.get(y1.getNbbm()); | 710 | Line line= BasicData.nbbm2LineMap.get(y1.getNbbm()); |
| 708 | - if(null !=line) | ||
| 709 | - t.setXlbm(line.getLineCode()); | 711 | + if(null !=line){ |
| 712 | + t.setXlbm(line.getLineCode()); | ||
| 713 | + }else{ | ||
| 714 | + t.setXlbm(""); | ||
| 715 | + } | ||
| 710 | t.setJcsx(1); | 716 | t.setJcsx(1); |
| 711 | boolean status=true; | 717 | boolean status=true; |
| 712 | for (int j = 0; j < ylListBe.size(); j++) { | 718 | for (int j = 0; j < ylListBe.size(); j++) { |
| @@ -734,10 +740,12 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -734,10 +740,12 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 734 | // double jzyl=Arith.add(t.getJzl(), t.getCzyl()); | 740 | // double jzyl=Arith.add(t.getJzl(), t.getCzyl()); |
| 735 | t.setJzyl(Arith.add(t.getJzl(), t.getCzyl())); | 741 | t.setJzyl(Arith.add(t.getJzl(), t.getCzyl())); |
| 736 | t.setYh(0.0); | 742 | t.setYh(0.0); |
| 737 | - repository.save(t); | ||
| 738 | - if(null!=cyl){ | ||
| 739 | - cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl())); | ||
| 740 | - cylRepository.save(cyl); | 743 | + if(fgsdm.equals(fgsbm)){ |
| 744 | + repository.save(t); | ||
| 745 | + if(null!=cyl){ | ||
| 746 | + cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl())); | ||
| 747 | + cylRepository.save(cyl); | ||
| 748 | + } | ||
| 741 | } | 749 | } |
| 742 | } | 750 | } |
| 743 | } | 751 | } |
| @@ -826,22 +834,50 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -826,22 +834,50 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 826 | stringList.add(nbbm); | 834 | stringList.add(nbbm); |
| 827 | }else{ | 835 | }else{ |
| 828 | if(!sxtj.equals("0")){ | 836 | if(!sxtj.equals("0")){ |
| 829 | - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); | ||
| 830 | - for (int i = 0; i < objectLists.size(); i++) { | ||
| 831 | - String clbm=objectLists.get(i)[0].toString(); | ||
| 832 | - int cs=Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 833 | - //一车一单 | ||
| 834 | - | ||
| 835 | - if(sxtj.equals("1")){ | ||
| 836 | - if(cs==1){ | 837 | + List<Object[]> objectLists; |
| 838 | + if(sxtj.equals("3")){ | ||
| 839 | + //有加油没里程 | ||
| 840 | + objectLists=repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 841 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 842 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 843 | + double jzl=Double.parseDouble(objectLists.get(i)[1].toString()); | ||
| 844 | + double zlc=Double.parseDouble(objectLists.get(i)[2].toString()); | ||
| 845 | + if(jzl>0 && zlc<=0){ | ||
| 837 | stringList.add(clbm); | 846 | stringList.add(clbm); |
| 838 | } | 847 | } |
| 848 | + | ||
| 839 | } | 849 | } |
| 840 | - //一车多单 | ||
| 841 | - if(sxtj.equals("2")){ | ||
| 842 | - if(cs>1){ | 850 | + |
| 851 | + }else if(sxtj.equals("4")){ | ||
| 852 | + //有里程没加油 | ||
| 853 | + objectLists=repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 854 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 855 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 856 | + double jzl=Double.parseDouble(objectLists.get(i)[1].toString()); | ||
| 857 | + double zlc=Double.parseDouble(objectLists.get(i)[2].toString()); | ||
| 858 | + if(zlc>0 && jzl<=0){ | ||
| 843 | stringList.add(clbm); | 859 | stringList.add(clbm); |
| 844 | } | 860 | } |
| 861 | + | ||
| 862 | + } | ||
| 863 | + }else{ | ||
| 864 | + objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); | ||
| 865 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 866 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 867 | + int cs=Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 868 | + //一车一单 | ||
| 869 | + | ||
| 870 | + if(sxtj.equals("1")){ | ||
| 871 | + if(cs==1){ | ||
| 872 | + stringList.add(clbm); | ||
| 873 | + } | ||
| 874 | + } | ||
| 875 | + //一车多单 | ||
| 876 | + if(sxtj.equals("2")){ | ||
| 877 | + if(cs>1){ | ||
| 878 | + stringList.add(clbm); | ||
| 879 | + } | ||
| 880 | + } | ||
| 845 | } | 881 | } |
| 846 | } | 882 | } |
| 847 | } | 883 | } |
| @@ -857,9 +893,10 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -857,9 +893,10 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 857 | // strings[i]=stringList.get(i); | 893 | // strings[i]=stringList.get(i); |
| 858 | // } | 894 | // } |
| 859 | sumYlbList=repository.sumYlb(rq, gsbm, fgsbm, xlbm, stringList); | 895 | sumYlbList=repository.sumYlb(rq, gsbm, fgsbm, xlbm, stringList); |
| 860 | - }else{ | ||
| 861 | - sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 862 | } | 896 | } |
| 897 | +// else{ | ||
| 898 | +// sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 899 | +// } | ||
| 863 | 900 | ||
| 864 | } | 901 | } |
| 865 | 902 |
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
| @@ -9,6 +9,9 @@ import java.util.HashMap; | @@ -9,6 +9,9 @@ import java.util.HashMap; | ||
| 9 | import java.util.List; | 9 | import java.util.List; |
| 10 | import java.util.Map; | 10 | import java.util.Map; |
| 11 | 11 | ||
| 12 | +import javax.transaction.Transactional; | ||
| 13 | + | ||
| 14 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 12 | import org.slf4j.Logger; | 15 | import org.slf4j.Logger; |
| 13 | import org.slf4j.LoggerFactory; | 16 | import org.slf4j.LoggerFactory; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -16,6 +19,8 @@ import org.springframework.jdbc.core.JdbcTemplate; | @@ -16,6 +19,8 @@ import org.springframework.jdbc.core.JdbcTemplate; | ||
| 16 | import org.springframework.jdbc.core.RowMapper; | 19 | import org.springframework.jdbc.core.RowMapper; |
| 17 | import org.springframework.stereotype.Service; | 20 | import org.springframework.stereotype.Service; |
| 18 | 21 | ||
| 22 | +import com.alibaba.fastjson.JSONArray; | ||
| 23 | +import com.alibaba.fastjson.JSONObject; | ||
| 19 | import com.bsth.common.ResponseCode; | 24 | import com.bsth.common.ResponseCode; |
| 20 | import com.bsth.entity.excep.Offline; | 25 | import com.bsth.entity.excep.Offline; |
| 21 | import com.bsth.entity.oil.Ylb; | 26 | import com.bsth.entity.oil.Ylb; |
| @@ -44,12 +49,27 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements | @@ -44,12 +49,27 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements | ||
| 44 | String rq=map.get("yyrq").toString(); | 49 | String rq=map.get("yyrq").toString(); |
| 45 | String gsdm=map.get("gsdm_like").toString(); | 50 | String gsdm=map.get("gsdm_like").toString(); |
| 46 | String fgsdm=map.get("fgsdm_like").toString(); | 51 | String fgsdm=map.get("fgsdm_like").toString(); |
| 47 | - | 52 | + /* |
| 48 | String sql=" select x.*,y.jsy as ldgh,y.fgsdm as fgsdm from bsth_c_ylxxb x " | 53 | String sql=" select x.*,y.jsy as ldgh,y.fgsdm as fgsdm from bsth_c_ylxxb x " |
| 49 | + " left join bsth_c_ylb y on x.nbbm = y.nbbm and x.jsy !=y.jsy " | 54 | + " left join bsth_c_ylb y on x.nbbm = y.nbbm and x.jsy !=y.jsy " |
| 50 | + " where DATE_FORMAT(y.rq,'%Y-%m-%d')='"+rq+"' and y.ssgsdm='"+gsdm+"' " | 55 | + " where DATE_FORMAT(y.rq,'%Y-%m-%d')='"+rq+"' and y.ssgsdm='"+gsdm+"' " |
| 51 | + " and y.fgsdm='"+fgsdm+"' and DATE_FORMAT(x.yyrq,'%Y-%m-%d')='"+rq+"' " | 56 | + " and y.fgsdm='"+fgsdm+"' and DATE_FORMAT(x.yyrq,'%Y-%m-%d')='"+rq+"' " |
| 52 | - + " and x.gsdm='"+gsdm+"'"; | 57 | + + " and x.gsdm='"+gsdm+"'";*/ |
| 58 | + | ||
| 59 | + String sql= "select v.*,u.jsy as ldgh from " | ||
| 60 | + + " ( select * from bsth_c_ylxxb x where " | ||
| 61 | + + " DATE_FORMAT(x.yyrq,'%Y-%m-%d')='"+rq+"' and x.gsdm='"+gsdm+"'" | ||
| 62 | + + " and x.jsy not in (" | ||
| 63 | + + " select jsy from bsth_c_ylb " | ||
| 64 | + + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"' " | ||
| 65 | + + " and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"')" | ||
| 66 | + + " and x.nbbm in (select nbbm from bsth_c_ylb " | ||
| 67 | + + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"' " | ||
| 68 | + + " and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"' )) v " | ||
| 69 | + + " left join (select * from bsth_c_ylb " | ||
| 70 | + + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'" | ||
| 71 | + + " and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"' ) u " | ||
| 72 | + + " on v.nbbm=u.nbbm "; | ||
| 53 | 73 | ||
| 54 | //根具条件查询指定日期Ylxxb的数据 | 74 | //根具条件查询指定日期Ylxxb的数据 |
| 55 | // List<Ylxxb> iterator=repository.checkYlxx(rq,gsdm); | 75 | // List<Ylxxb> iterator=repository.checkYlxx(rq,gsdm); |
| @@ -114,21 +134,33 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements | @@ -114,21 +134,33 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements | ||
| 114 | pageObject.setDataList(list); | 134 | pageObject.setDataList(list); |
| 115 | return pageObject; | 135 | return pageObject; |
| 116 | } | 136 | } |
| 117 | - | 137 | + @Transactional |
| 118 | @Override | 138 | @Override |
| 119 | - public Map<String, Object> checkJsy(Map<String, Object> map) { | 139 | + public Map<String, Object> checkJsy(Map<String, Object> map) throws Exception{ |
| 120 | Map<String, Object> newMap=new HashMap<String,Object>(); | 140 | Map<String, Object> newMap=new HashMap<String,Object>(); |
| 121 | // TODO Auto-generated method stub | 141 | // TODO Auto-generated method stub |
| 122 | try { | 142 | try { |
| 123 | - int id=Integer.parseInt(map.get("id").toString()); | ||
| 124 | - String jsy=map.get("jsy").toString(); | ||
| 125 | - Ylxxb ylxxb=repository.findOne(id); | ||
| 126 | - ylxxb.setJsy(jsy); | ||
| 127 | - repository.save(ylxxb); | 143 | +// int id=Integer.parseInt(map.get("id").toString()); |
| 144 | +// String jsy=map.get("jsy").toString(); | ||
| 145 | +// Ylxxb ylxxb=repository.findOne(id); | ||
| 146 | +// ylxxb.setJsy(jsy); | ||
| 147 | +// repository.save(ylxxb); | ||
| 148 | + String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString()); | ||
| 149 | + JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 150 | + JSONObject jsonObject; | ||
| 151 | + for (int x = 0; x < jsonArray.size(); x++) { | ||
| 152 | + jsonObject=jsonArray.getJSONObject(x); | ||
| 153 | + Integer id =jsonObject.getInteger("id"); | ||
| 154 | + String jsy =jsonObject.getString("jsy"); | ||
| 155 | + Ylxxb ylxxb=repository.findOne(id); | ||
| 156 | + ylxxb.setJsy(jsy); | ||
| 157 | + repository.save(ylxxb); | ||
| 158 | + } | ||
| 128 | newMap.put("status", ResponseCode.SUCCESS); | 159 | newMap.put("status", ResponseCode.SUCCESS); |
| 129 | }catch(Exception e){ | 160 | }catch(Exception e){ |
| 130 | newMap.put("status", ResponseCode.ERROR); | 161 | newMap.put("status", ResponseCode.ERROR); |
| 131 | logger.error("save erro.", e); | 162 | logger.error("save erro.", e); |
| 163 | + throw e; | ||
| 132 | } | 164 | } |
| 133 | return newMap; | 165 | return newMap; |
| 134 | } | 166 | } |
src/main/java/com/bsth/service/realcontrol/LineConfigService.java
| @@ -13,11 +13,13 @@ public interface LineConfigService extends BaseService<LineConfig, Integer>{ | @@ -13,11 +13,13 @@ public interface LineConfigService extends BaseService<LineConfig, Integer>{ | ||
| 13 | 13 | ||
| 14 | Map<String, Object> editStartOptTime(String time, String lineCode); | 14 | Map<String, Object> editStartOptTime(String time, String lineCode); |
| 15 | 15 | ||
| 16 | - Map<String, Object> editOutTimeType(String lineCode, int type); | 16 | + Map<String, Object> editOutTimeType(String lineCode, int type, String parkCode, String stationCode); |
| 17 | 17 | ||
| 18 | LineConfig getByLineCode(String lineCode); | 18 | LineConfig getByLineCode(String lineCode); |
| 19 | 19 | ||
| 20 | Map<String,Object> enableInParkForSource(String lineCode, int enable); | 20 | Map<String,Object> enableInParkForSource(String lineCode, int enable); |
| 21 | 21 | ||
| 22 | Map<String,Object> bufferTimeDiff(String lineCode, String field, String value); | 22 | Map<String,Object> bufferTimeDiff(String lineCode, String field, String value); |
| 23 | + | ||
| 24 | + Map<String,Object> yjtkSet(Map<String, String> map); | ||
| 23 | } | 25 | } |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| @@ -112,7 +112,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -112,7 +112,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 112 | 112 | ||
| 113 | List<Map<String,Object>> statisticsDaily(String line, String date, String xlName, String type); | 113 | List<Map<String,Object>> statisticsDaily(String line, String date, String xlName, String type); |
| 114 | 114 | ||
| 115 | - List<Map<String,Object>> statisticsDailyTj(String line, String date,String date2, String xlName, String type); | 115 | + List<Map<String,Object>> statisticsDailyTj(String gsdm,String fgsdm,String line, String date,String date2, String xlName, String type); |
| 116 | 116 | ||
| 117 | //List<Object> scheduleDaily(String line,String date); | 117 | //List<Object> scheduleDaily(String line,String date); |
| 118 | 118 |
src/main/java/com/bsth/service/realcontrol/impl/LineConfigServiceImpl.java
| @@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory; | @@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 13 | 13 | ||
| 14 | +import java.lang.reflect.Field; | ||
| 14 | import java.util.ArrayList; | 15 | import java.util.ArrayList; |
| 15 | import java.util.HashMap; | 16 | import java.util.HashMap; |
| 16 | import java.util.List; | 17 | import java.util.List; |
| @@ -74,17 +75,20 @@ public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> | @@ -74,17 +75,20 @@ public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> | ||
| 74 | } | 75 | } |
| 75 | 76 | ||
| 76 | @Override | 77 | @Override |
| 77 | - public Map<String, Object> editOutTimeType(String lineCode, int type) { | 78 | + public Map<String, Object> editOutTimeType(String lineCode, int type, String parkCode, String stationCode) { |
| 78 | Map<String, Object> rs = new HashMap<>(); | 79 | Map<String, Object> rs = new HashMap<>(); |
| 79 | try { | 80 | try { |
| 80 | LineConfig conf = lineConfigData.get(lineCode); | 81 | LineConfig conf = lineConfigData.get(lineCode); |
| 81 | 82 | ||
| 82 | conf.setOutConfig(type); | 83 | conf.setOutConfig(type); |
| 83 | - //conf.setInConfig(type); | 84 | + if(type == 2){ |
| 85 | + conf.setTwinsPark(parkCode); | ||
| 86 | + conf.setTwinsStation(stationCode); | ||
| 87 | + } | ||
| 84 | lineConfigData.set(conf); | 88 | lineConfigData.set(conf); |
| 85 | 89 | ||
| 86 | rs.put("status", ResponseCode.SUCCESS); | 90 | rs.put("status", ResponseCode.SUCCESS); |
| 87 | - rs.put("type", type); | 91 | + rs.put("conf", conf); |
| 88 | } catch (Exception e) { | 92 | } catch (Exception e) { |
| 89 | rs.put("status", ResponseCode.ERROR); | 93 | rs.put("status", ResponseCode.ERROR); |
| 90 | rs.put("msg", e.getMessage()); | 94 | rs.put("msg", e.getMessage()); |
| @@ -104,7 +108,7 @@ public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> | @@ -104,7 +108,7 @@ public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> | ||
| 104 | try { | 108 | try { |
| 105 | LineConfig conf = lineConfigData.get(lineCode); | 109 | LineConfig conf = lineConfigData.get(lineCode); |
| 106 | 110 | ||
| 107 | - conf.setInParkForSource(enable==1); | 111 | + conf.setInParkForSource(enable == 1); |
| 108 | lineConfigData.set(conf); | 112 | lineConfigData.set(conf); |
| 109 | 113 | ||
| 110 | rs.put("status", ResponseCode.SUCCESS); | 114 | rs.put("status", ResponseCode.SUCCESS); |
| @@ -123,8 +127,10 @@ public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> | @@ -123,8 +127,10 @@ public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> | ||
| 123 | Map<String, Object> rs = new HashMap<>(); | 127 | Map<String, Object> rs = new HashMap<>(); |
| 124 | try { | 128 | try { |
| 125 | LineConfig conf = lineConfigData.get(lineCode); | 129 | LineConfig conf = lineConfigData.get(lineCode); |
| 130 | + Field f = conf.getClass().getDeclaredField(field); | ||
| 131 | + f.setAccessible(true); | ||
| 132 | + f.setInt(conf, Integer.parseInt(value)); | ||
| 126 | 133 | ||
| 127 | - conf.getClass().getField(field).set(conf, value); | ||
| 128 | lineConfigData.set(conf); | 134 | lineConfigData.set(conf); |
| 129 | 135 | ||
| 130 | rs.put("status", ResponseCode.SUCCESS); | 136 | rs.put("status", ResponseCode.SUCCESS); |
| @@ -137,4 +143,40 @@ public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> | @@ -137,4 +143,40 @@ public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> | ||
| 137 | } | 143 | } |
| 138 | return rs; | 144 | return rs; |
| 139 | } | 145 | } |
| 146 | + | ||
| 147 | + @Override | ||
| 148 | + public Map<String, Object> yjtkSet(Map<String, String> map) { | ||
| 149 | + String lineCode = map.get("lineCode").toString(); | ||
| 150 | + int enableYjtk = Integer.parseInt(map.get("enableYjtk").toString()); | ||
| 151 | + | ||
| 152 | + Map<String, Object> rs = new HashMap<>(); | ||
| 153 | + try { | ||
| 154 | + LineConfig conf = lineConfigData.get(lineCode); | ||
| 155 | + | ||
| 156 | + if(enableYjtk == 1){ | ||
| 157 | + String yjtkStart = map.containsKey("yjtkStart") ? map.get("yjtkStart").toString() : "00:00"; | ||
| 158 | + String yjtkEnd = map.containsKey("yjtkEnd") ? map.get("yjtkEnd").toString() : "23:59"; | ||
| 159 | + int upStopMinute = Integer.parseInt(map.get("upStopMinute").toString()); | ||
| 160 | + int downStopMinute = Integer.parseInt(map.get("downStopMinute").toString()); | ||
| 161 | + | ||
| 162 | + conf.setEnableYjtk(true); | ||
| 163 | + conf.setYjtkStart(yjtkStart); | ||
| 164 | + conf.setYjtkEnd(yjtkEnd); | ||
| 165 | + conf.setUpStopMinute(upStopMinute); | ||
| 166 | + conf.setDownStopMinute(downStopMinute); | ||
| 167 | + } | ||
| 168 | + else | ||
| 169 | + conf.setEnableYjtk(false); | ||
| 170 | + | ||
| 171 | + lineConfigData.set(conf); | ||
| 172 | + | ||
| 173 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 174 | + rs.put("conf", conf); | ||
| 175 | + } catch (Exception e) { | ||
| 176 | + rs.put("status", ResponseCode.ERROR); | ||
| 177 | + rs.put("msg", e.getMessage()); | ||
| 178 | + logger.error("", e); | ||
| 179 | + } | ||
| 180 | + return rs; | ||
| 181 | + } | ||
| 140 | } | 182 | } |