Commit 0ad6ab8685e4c086d88d66d864119da39be4ddeb

Authored by 徐烜
2 parents 4591be1b dea79286

Merge branch 'minhang' of http://222.66.0.204:8090//panzhaov5/bsth_control into minhang

src/main/java/com/bsth/controller/directive/DirectiveController.java
1 1 package com.bsth.controller.directive;
2 2  
3   -import java.util.List;
4   -import java.util.Map;
5   -
6   -import org.apache.commons.lang3.StringEscapeUtils;
7   -import org.springframework.beans.factory.annotation.Autowired;
8   -import org.springframework.web.bind.annotation.RequestMapping;
9   -import org.springframework.web.bind.annotation.RequestMethod;
10   -import org.springframework.web.bind.annotation.RequestParam;
11   -import org.springframework.web.bind.annotation.RestController;
12   -
13 3 import com.alibaba.fastjson.JSON;
14 4 import com.alibaba.fastjson.JSONObject;
15 5 import com.bsth.entity.directive.D80;
... ... @@ -17,6 +7,15 @@ import com.bsth.entity.directive.DC0_A3;
17 7 import com.bsth.entity.sys.SysUser;
18 8 import com.bsth.security.util.SecurityUtils;
19 9 import com.bsth.service.directive.DirectiveService;
  10 +import org.apache.commons.lang3.StringEscapeUtils;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.web.bind.annotation.RequestMapping;
  13 +import org.springframework.web.bind.annotation.RequestMethod;
  14 +import org.springframework.web.bind.annotation.RequestParam;
  15 +import org.springframework.web.bind.annotation.RestController;
  16 +
  17 +import java.util.List;
  18 +import java.util.Map;
20 19  
21 20 /**
22 21 *
... ... @@ -109,6 +108,20 @@ public class DirectiveController {
109 108 SysUser user = SecurityUtils.getCurrentUser();
110 109 return directiveService.upDownChange(nbbm, upDown, user.getUserName());
111 110 }
  111 +
  112 + /**
  113 + *
  114 + * @Title: upDownChange
  115 + * @Description: TODO(状态切换,营运状态 和 上下行)
  116 + * @param @param nbbm 车辆内部编码
  117 + * @param @param upDon
  118 + * @throws
  119 + */
  120 + @RequestMapping(value = "/stateChange", method = RequestMethod.POST)
  121 + public int stateChange(@RequestParam String nbbm, @RequestParam Integer upDown, @RequestParam Integer state){
  122 + SysUser user = SecurityUtils.getCurrentUser();
  123 + return directiveService.stateChange(nbbm, upDown, state, user.getUserName());
  124 + }
112 125  
113 126 /**
114 127 *
... ...
src/main/java/com/bsth/controller/oil/YlbController.java
... ... @@ -62,6 +62,18 @@ public class YlbController extends BaseController<Ylb, Integer>{
62 62 return list;
63 63 }
64 64  
  65 +
  66 + @RequestMapping(value = "/saveYlbList",method = RequestMethod.GET)
  67 + public Map<String, Object> saveYlbList(@RequestParam Map<String, Object> map){
  68 + Map<String, Object> list=new HashMap<String, Object>();
  69 + try {
  70 + list = yblService.saveYlbList(map);
  71 + } catch (Exception e) {
  72 + // TODO Auto-generated catch block
  73 + e.printStackTrace();
  74 + }
  75 + return list;
  76 + }
65 77 /**
66 78 * 拆分油量
67 79 * @param map
... ... @@ -69,7 +81,12 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
69 81 */
70 82 @RequestMapping(value = "/sort",method = RequestMethod.GET)
71 83 public Map<String, Object> sort(@RequestParam Map<String, Object> map){
72   - Map<String, Object> list=yblService.sort(map);
  84 + Map<String, Object> list=new HashMap<String, Object>();
  85 + try {
  86 + list=yblService.sort(map);
  87 + } catch (Exception e) {
  88 + // TODO: handle exception
  89 + }
73 90 return list;
74 91 }
75 92  
... ... @@ -97,7 +114,12 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
97 114 */
98 115 @RequestMapping(value = "/checkYl",method = RequestMethod.GET)
99 116 public Map<String, Object> checkYl(@RequestParam Map<String, Object> map){
100   - Map<String, Object> list=yblService.checkYl(map);
  117 + Map<String, Object> list=new HashMap<String, Object>();
  118 + try {
  119 + list=yblService.checkYl(map);
  120 + } catch (Exception e) {
  121 + // TODO: handle exception
  122 + }
101 123 return list;
102 124 }
103 125  
... ... @@ -157,6 +179,23 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
157 179 }
158 180  
159 181  
  182 +
  183 +
  184 + /**
  185 + *
  186 + * @Title: list
  187 + * @Description: TODO(多条件分页查询)
  188 + * @param @param map 查询条件
  189 + * @param @param page 页码
  190 + * @param @param size 每页显示数量
  191 + * @throws
  192 + */
  193 + @RequestMapping(value = "/ylbList",method = RequestMethod.GET)
  194 + public List<Ylb> ylbList(@RequestParam Map<String, Object> map){
  195 + List<Ylb> ylbList=yblService.listYlb(map);
  196 + return ylbList;
  197 + }
  198 +
160 199 @RequestMapping(value="/oilListMonth")
161 200 public List<Ylb> oilListMonth(@RequestParam String line,@RequestParam String date){
162 201 return yblService.oilListMonth(line, date);
... ...
src/main/java/com/bsth/data/gpsdata/arrival/SignalHandle.java
... ... @@ -5,6 +5,10 @@ import com.bsth.data.gpsdata.arrival.entity.StationRoute;
5 5 import com.bsth.data.gpsdata.arrival.utils.CircleQueue;
6 6 import com.bsth.data.gpsdata.arrival.utils.GeoUtils;
7 7 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  8 +import org.joda.time.format.DateTimeFormat;
  9 +import org.joda.time.format.DateTimeFormatter;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
8 12  
9 13 import java.util.List;
10 14  
... ... @@ -68,6 +72,8 @@ public abstract class SignalHandle {
68 72 * }
69 73 */
70 74  
  75 + Logger logger = LoggerFactory.getLogger(this.getClass());
  76 + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");
71 77 protected void transformUpdown(GpsEntity gps, ScheduleRealInfo sch) {
72 78 int updown = Integer.parseInt(sch.getXlDir());
73 79 //gps 切换走向
... ... @@ -78,6 +84,8 @@ public abstract class SignalHandle {
78 84 if (station != null) {
79 85 gps.setStopNo(station.getCode());
80 86 }
  87 +
  88 + logger.info(fmtHHmm.print(gps.getTimestamp()) + " 车辆 :" + gps.getNbbm() + " 切换到走向 : " + updown);
81 89 }
82 90  
83 91 /**
... ...
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
... ... @@ -7,6 +7,7 @@ import com.bsth.data.gpsdata.arrival.utils.CircleQueue;
7 7 import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState;
8 8 import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher;
9 9 import com.bsth.data.schedule.DayOfSchedule;
  10 +import com.bsth.data.schedule.ScheduleComparator;
10 11 import com.bsth.entity.realcontrol.LineConfig;
11 12 import com.bsth.entity.realcontrol.ScheduleRealInfo;
12 13 import com.bsth.service.directive.DirectiveService;
... ... @@ -17,6 +18,9 @@ import org.slf4j.LoggerFactory;
17 18 import org.springframework.beans.factory.annotation.Autowired;
18 19 import org.springframework.stereotype.Component;
19 20  
  21 +import java.util.Collections;
  22 +import java.util.List;
  23 +
20 24 /**
21 25 * 进出站动作处理
22 26 * Created by panzhao on 2016/12/27.
... ... @@ -138,6 +142,10 @@ public class InOutStationSignalHandle extends SignalHandle{
138 142 //持久化
139 143 dayOfSchedule.save(sch);
140 144  
  145 + if(sch.getBcType().equals("out")){
  146 + //出场时,切换成营运状态
  147 + directiveService.send60Operation(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "出场@系统");
  148 + }
141 149 //出站既出场
142 150 outStationAndOutPark(sch);
143 151 logger.info("班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual());
... ... @@ -164,6 +172,11 @@ public class InOutStationSignalHandle extends SignalHandle{
164 172  
165 173 sendUtils.refreshSch(schPrev);
166 174 dayOfSchedule.save(schPrev);
  175 +
  176 + if(schPrev.getBcType().equals("out")){
  177 + //出场时,切换成营运状态
  178 + directiveService.send60Operation(schPrev.getClZbh(), 0, Integer.parseInt(schPrev.getXlDir()), null, "出场@系统");
  179 + }
167 180 }
168 181 }
169 182 }
... ... @@ -204,8 +217,14 @@ public class InOutStationSignalHandle extends SignalHandle{
204 217 sendUtils.sendZdsj(sch, next, doneSum);
205 218 //持久化
206 219 dayOfSchedule.save(sch);
207   - //下发调度指令
208   - directiveService.send60Dispatch(next, doneSum, "到站@系统");
  220 + if(next != null){
  221 + //下发调度指令
  222 + directiveService.send60Dispatch(next, doneSum, "到站@系统");
  223 + }
  224 + else if(sch.getBcType().equals("in")){
  225 + //终班进场,切换成非营运状态
  226 + directiveService.send60Operation(sch.getClZbh(), 1, Integer.parseInt(sch.getXlDir()), null, "进场@系统");
  227 + }
209 228  
210 229 //准备执行下一个班次
211 230 if (next != null) {
... ... @@ -217,10 +236,59 @@ public class InOutStationSignalHandle extends SignalHandle{
217 236 transformUpdown(gps, next);
218 237 }
219 238 }
220   - else if(sch.getFcsjActual() == null){
221   - //有进站,但班次没有实发,向前追溯一下信号
222   - scheduleSignalState.signalRetrospect(gps, sch);
  239 + else {
  240 + if(sch.getFcsjActual() == null){
  241 + //有进站,但班次没有实发,向前追溯一下信号
  242 + scheduleSignalState.signalRetrospect(gps, sch);
  243 + }
  244 +
  245 + //如果当前班次是出场,并且进的是下一个班次的终点
  246 + if(sch.getBcType().equals("out")){
  247 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  248 + if(next.getZdzCode().equals(gps.getStopNo())){
  249 + List<ScheduleRealInfo> halfList = dayOfSchedule.findByNbbm(sch.getClZbh());
  250 + //和当前进站信号最匹配的一个班次
  251 + ScheduleRealInfo nearSch = nearScheduleByGpsIn(gps, halfList);
  252 +
  253 + if(nearSch != null){
  254 + //直接跳到这个班次
  255 + dayOfSchedule.addExecPlan(nearSch);
  256 + //重新进站
  257 + inStation(gps, prev);
  258 + }
  259 + }
  260 + }
  261 + }
  262 + }
  263 +
  264 + /**
  265 + * 和当前进站信号最匹配的一个班次
  266 + * @param gps
  267 + * @param halfList
  268 + * @return
  269 + */
  270 + private ScheduleRealInfo nearScheduleByGpsIn(GpsEntity gps, List<ScheduleRealInfo> halfList){
  271 + if(halfList == null || halfList.size() == 0)
  272 + return null;
  273 +
  274 + //排序
  275 + Collections.sort(halfList, new ScheduleComparator.FCSJ());
  276 + ScheduleRealInfo near = null;// = halfList.get(0);
  277 + ScheduleRealInfo sch;
  278 +
  279 + String stopId = gps.getStopNo();
  280 + for(int i = 0; i < halfList.size(); i ++){
  281 + sch = halfList.get(i);
  282 + if(!sch.getZdzCode().equals(stopId))
  283 + continue;
  284 +
  285 + if(sch.getZdsjT() < gps.getTimestamp())
  286 + near = sch;
  287 + else
  288 + break;
  289 +
223 290 }
  291 + return near;
224 292 }
225 293  
226 294 /**
... ...
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
... ... @@ -60,7 +60,7 @@ public class GpsDataRecovery implements ApplicationContextAware {
60 60 for (String nbbm : keys) {
61 61 Collections.sort(listMap.get(nbbm), comp);
62 62 threadPool.execute(new RecoveryThread(listMap.get(nbbm), count));
63   - /*if(nbbm.equals("W9H-003"))
  63 + /*if(nbbm.equals("SXC-YD012"))
64 64 new RecoveryThread(listMap.get(nbbm), count).run();*/
65 65 }
66 66  
... ... @@ -163,9 +163,8 @@ public class GpsDataRecovery implements ApplicationContextAware {
163 163 reverseSignalHandle.handle(gps, prevs);
164 164 //进出站动作处理
165 165 inOutStationSignalHandle.handle(gps, prevs);
166   - GeoCacheData.putGps(gps);
167 166  
168   - //Thread.sleep(50);
  167 + GeoCacheData.putGps(gps);
169 168 }
170 169 } catch (Exception e) {
171 170 logger.error("", e);
... ...
src/main/java/com/bsth/entity/oil/Ylb.java
... ... @@ -38,7 +38,7 @@ public class Ylb {
38 38 private String shyy;
39 39 private Double zlc=0.0;
40 40 private int yhlx;
41   - private String rylx;
  41 + private String rylx="0";
42 42 private Double ns=0.0;
43 43 private Double fyylc=0.0;
44 44 private Double jhzlc=0.0;
... ...
src/main/java/com/bsth/repository/oil/YlbRepository.java
... ... @@ -88,4 +88,26 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
88 88 + " and xlbm like %?4% "
89 89 + " and nbbm like %?5%",nativeQuery=true)
90 90 List<Object[]> sumYlb2(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
  91 +
  92 +
  93 +
  94 + @Query(value="select s from Ylb s "
  95 + + " where to_days(?1)=to_days(s.rq) "
  96 + + " and s.ssgsdm like %?2% "
  97 + + " and s.fgsdm like %?3%"
  98 + + " and s.xlbm like %?4% "
  99 + + " and s.nbbm in ?5 ")
  100 + List<Ylb> listYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  101 +
  102 +
  103 + @Transactional
  104 + @Modifying
  105 + @Query(value="UPDATE bsth_c_ylb SET " +
  106 + " jzyl = ?2, " +
  107 + " sh = ?3," +
  108 + " shyy = ?4," +
  109 + " ns = ?5," +
  110 + " rylx = ?6" +
  111 + " WHERE id = ?1", nativeQuery=true)
  112 + public void ylbUpdate(Integer id,double jzyl,double sh,String shyy,double ns,String rylx);
91 113 }
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -125,7 +125,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
125 125 @Query(value="select 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")
126 126 List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date);
127 127  
128   - @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType not in ('in','out') order by s.xlBm")
  128 + @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType not in ('in','out') order by s.xlBm")
129 129 List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date);
130 130  
131 131 //按月统计
... ... @@ -136,7 +136,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
136 136 @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 and s.bcType not in ('in','out') order by s.xlBm")
137 137 List<ScheduleRealInfo> scheduleByDateAndLineTj(String line,String date,String date2);
138 138  
139   - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY xlBm,clZbh")
  139 + //按照时间段统计
  140 + @Query(value="select 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")
  141 + List<ScheduleRealInfo> scheduleByDateAndLineTj2(String line,String date,String date2);
  142 +
  143 + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,min(s.fcsj) as fcsj ) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY clZbh,fcsj")
140 144 List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm);
141 145  
142 146 @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir")
... ...
src/main/java/com/bsth/service/directive/DirectiveService.java
1 1 package com.bsth.service.directive;
2 2  
3 3  
4   -import java.util.List;
5   -import java.util.Map;
6   -
7 4 import com.bsth.entity.directive.D60;
8 5 import com.bsth.entity.directive.D64;
9 6 import com.bsth.entity.directive.D80;
... ... @@ -11,6 +8,9 @@ import com.bsth.entity.directive.DC0_A3;
11 8 import com.bsth.entity.realcontrol.ScheduleRealInfo;
12 9 import com.bsth.service.BaseService;
13 10  
  11 +import java.util.List;
  12 +import java.util.Map;
  13 +
14 14 public interface DirectiveService extends BaseService<D60, Integer>{
15 15  
16 16 /**
... ... @@ -93,4 +93,6 @@ public interface DirectiveService extends BaseService&lt;D60, Integer&gt;{
93 93 int sendC0A5(String json);
94 94  
95 95 int refreshLineFile(String deviceId);
  96 +
  97 + int stateChange(String nbbm, Integer upDown, Integer state, String userName);
96 98 }
... ...
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
... ... @@ -504,4 +504,9 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
504 504  
505 505 return GatewayHttpUtils.postJson(new DirectiveCreator().createDeviceRefreshData(deviceId, gps.getLineId()));
506 506 }
  507 +
  508 + @Override
  509 + public int stateChange(String nbbm, Integer upDown, Integer state, String userName) {
  510 + return send60Operation(nbbm, state, upDown, null, userName);
  511 + }
507 512 }
... ...
src/main/java/com/bsth/service/oil/YlbService.java
... ... @@ -8,16 +8,17 @@ import com.bsth.service.BaseService;
8 8  
9 9 public interface YlbService extends BaseService<Ylb, Integer>{
10 10 Map<String, Object> obtain(Map<String, Object> map) throws Exception;
  11 + Map<String, Object> saveYlbList(Map<String, Object> map) throws Exception;
11 12 String obtainDsq() throws Exception;
12   - Map<String, Object> sort(Map<String, Object> map);
  13 + Map<String, Object> sort(Map<String, Object> map) throws Exception;
13 14  
14 15 Map<String, Object> outAndIn(Map<String, Object> map) throws Exception;
15 16  
16   - Map<String, Object> checkYl(Map<String, Object> map);
  17 + Map<String, Object> checkYl(Map<String, Object> map) throws Exception;
17 18  
18 19 Map<String, Object> sumYlb(Map<String, Object> map);
19 20  
20 21 List<Ylb> oilListMonth(String line,String date);
21   -
  22 + List<Ylb> listYlb(Map<String, Object> map);
22 23 StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx);
23 24 }
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -15,6 +15,7 @@ import java.util.Map;
15 15  
16 16 import javax.transaction.Transactional;
17 17  
  18 +import org.apache.commons.lang3.StringEscapeUtils;
18 19 import org.slf4j.Logger;
19 20 import org.slf4j.LoggerFactory;
20 21 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -24,6 +25,8 @@ import org.springframework.jdbc.core.JdbcTemplate;
24 25 import org.springframework.jdbc.core.RowMapper;
25 26 import org.springframework.stereotype.Service;
26 27  
  28 +import com.alibaba.fastjson.JSONArray;
  29 +import com.alibaba.fastjson.JSONObject;
27 30 import com.bsth.common.ResponseCode;
28 31 import com.bsth.data.BasicData;
29 32 import com.bsth.entity.Cars;
... ... @@ -173,6 +176,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
173 176 t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
174 177 t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());
175 178 t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());
  179 + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
176 180 t.setRq(sdf.parse(rq));
177 181 repository.save(t);
178 182  
... ... @@ -323,8 +327,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
323 327 t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
324 328 t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
325 329 t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
  330 + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
326 331 t.setRq(sdf.parse(rq));
327   -
328 332 if(type.equals("add")){
329 333 addList.add(t);
330 334 }else{
... ... @@ -381,6 +385,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
381 385 nbbm=map.get("nbbm_eq").toString();
382 386 }
383 387  
  388 + List<Cyl> cylListAdd=new ArrayList<Cyl>();
  389 + Map<String, Object> cylMapAdd=new HashMap<String,Object>();
384 390 Map<String, Object> newMap=new HashMap<String,Object>();
385 391 Map<String, Object> map2=new HashMap<String,Object>();
386 392 try {
... ... @@ -391,7 +397,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
391 397 // 获取车辆存油信息
392 398 List<Cyl> cylList = cylRepository.obtainCyl(nbbm,gsbm);
393 399 // 指定日期YLB信息
394   - List<Ylb> ylbList =repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm");
  400 + List<Ylb> ylbList =repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm,jcsx");
395 401 List<Ylb> iterator2=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"jcsx");
396 402 for (int i=0;i<ylbList.size();i++) {
397 403 Ylb ylb = ylbList.get(i);
... ... @@ -427,31 +433,40 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
427 433 // Iterator<Ylb> iterator2 = repository
428 434 // .findAll(new CustomerSpecs<Ylb>(map), new Sort(Direction.ASC, "jcsx")).iterator();
429 435 for (int j = 0; j < iterator2.size(); j++) {
430   -
431 436 Ylb t = iterator2.get(j);
432 437 if(t.getNbbm().equals(ylb.getNbbm())){
433 438 if (t.getJcsx() == 1) {
434 439 // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量
435 440 Double yl = t.getCzyl();
436 441 Double jcyl = t.getCzyl();
437   -// zyl = jcyl + jzl - yl;
438 442 zyl =Arith.sub( Arith.add(jcyl, jzl),yl);
439   - Double yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
440   - t.setYh(yh);
441   -// nextJzyl = t.getJzl() + t.getCzyl() - yh;
  443 + Double yh=0.0;
  444 + if(zlc>0){
  445 + yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
  446 + }
442 447 nextJzyl =Arith.sub( Arith.add(t.getJzl(), t.getCzyl()),yh);
443   -// t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
444   - t.setJzyl(nextJzyl);
  448 + //把进场油量的小数和整数分别取出
  449 +// int ylxs=(int) nextJzyl; 10.6--11 10.3--10
  450 + long l=Math.round(nextJzyl);
  451 + double ylxs=l*100/100;
  452 +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
  453 + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
  454 + t.setYh(yh);
  455 + t.setJzyl(ylxs);
  456 + nextJzyl=ylxs;
445 457 } else {
446   -// t.setCzyl(Double.parseDouble(df.format(nextJzyl)));
447 458 t.setCzyl(nextJzyl);
448 459 Double yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
449   - t.setYh(yh);
450   -// nextJzyl = t.getJzl() + nextJzyl - yh;
451 460 nextJzyl =Arith.sub( Arith.add(t.getJzl(),nextJzyl),yh);
452   -// t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
453   - t.setJzyl(nextJzyl);
  461 + long l=Math.round(nextJzyl);
  462 + double ylxs=l*100/100;
  463 +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
  464 + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
  465 + t.setYh(yh);
  466 + t.setJzyl(ylxs);
  467 + nextJzyl= ylxs;
454 468 }
  469 +
455 470 repository.save(t);
456 471 }
457 472  
... ... @@ -470,17 +485,36 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
470 485 if (fage) {
471 486 cylRepository.save(cyl);
472 487 } else {
473   - cyl = new Cyl();
474   - cyl.setNbbm(t.getNbbm());
475   - cyl.setCyl(t.getJzyl());
476   - cyl.setGsdm(t.getSsgsdm());
477   - cyl.setUpdatetime(t.getRq());
478   - cylRepository.save(cyl);
  488 + if(cylMapAdd.get(t.getNbbm())!=null){
  489 + for (int l = 0; l < cylListAdd.size(); l++) {
  490 + cyl=cylListAdd.get(l);
  491 + if(cyl.getNbbm().equals(t.getNbbm())){
  492 + cyl.setNbbm(t.getNbbm());
  493 + cyl.setCyl(t.getJzyl());
  494 + cyl.setGsdm(t.getSsgsdm());
  495 + cyl.setFgsdm(t.getFgsdm());
  496 + cyl.setUpdatetime(t.getRq());
  497 + }
  498 + }
  499 + }else{
  500 + cyl = new Cyl();
  501 + cyl.setNbbm(t.getNbbm());
  502 + cyl.setCyl(t.getJzyl());
  503 + cyl.setGsdm(t.getSsgsdm());
  504 + cyl.setFgsdm(t.getFgsdm());
  505 + cyl.setUpdatetime(t.getRq());
  506 + cylListAdd.add(cyl);
  507 + }
  508 +
  509 +
479 510 }
480 511 map2.put("status", ResponseCode.SUCCESS);
481 512 }
482 513 }
483 514 }
  515 + for (int i = 0; i < cylListAdd.size(); i++) {
  516 + cylRepository.save(cylListAdd.get(i));
  517 + }
484 518 } catch (Exception e) {
485 519 map2.put("status", ResponseCode.ERROR);
486 520 logger.error("save erro.", e);
... ... @@ -494,7 +528,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
494 528 */
495 529 @Transactional
496 530 @Override
497   - public Map<String, Object> sort(Map<String, Object> map) {
  531 + public Map<String, Object> sort(Map<String, Object> map) throws Exception{
498 532 // TODO Auto-generated method stub
499 533 Map<String, Object> newMap = new HashMap<String, Object>();
500 534 SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
... ... @@ -507,7 +541,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
507 541 Double sh= Double.parseDouble(map.get("sh").toString());
508 542 String shyy=map.get("shyy").toString();
509 543 Ylb ylb = repository.findOne(id);
510   -
  544 + List<Cyl> cylListAdd=new ArrayList<Cyl>();
  545 + Map<String, Object> cylMapAdd=new HashMap<String,Object>();
511 546 String nbbm_eq = ylb.getNbbm();
512 547 Date rq_eq = ylb.getRq();
513 548 // 得到一天总的加油和里程(根据车,时间)
... ... @@ -527,12 +562,9 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
527 562  
528 563 //新的 损耗不等于 旧的损耗 总损耗从新算
529 564 if(Arith.sub(ylb.getSh(),sh )!=0){
530   -// zsh =zsh-ylb.getSh()+sh;
531 565 zsh =Arith.add(Arith.sub(zsh, ylb.getSh()), sh);
532   -// jzl =jzl-zsh;
533 566 jzl =Arith.sub(jzl, zsh);
534 567 }else{
535   -// jzl=jzl-zsh;
536 568 jzl =Arith.sub(jzl, zsh);
537 569 }
538 570 map.put("nbbm_eq", nbbm_eq);
... ... @@ -555,33 +587,37 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
555 587 t.setShyy(shyy);
556 588 }
557 589 Double jcyl = t.getCzyl();
558   -// zyl = jcyl + jzl - yl;
559 590 zyl = Arith.sub(Arith.add(jcyl, jzl), yl);
560 591 Double yh = 0.0;
561 592 if (zlc > 0 && t.getZlc() > 0) {
562 593 yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
563 594 }
564   - t.setYh(yh);
565   -// nextJzyl = t.getJzl() + t.getCzyl() - yh-t.getSh();
566 595 nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), Arith.add(yh, t.getSh()));
567   -// t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
568   - t.setJzyl(nextJzyl);
  596 + long l=Math.round(nextJzyl);
  597 + double ylxs=l*100/100;
  598 +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
  599 + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
  600 + t.setJzyl(ylxs);
  601 + t.setYh(yh);
  602 + nextJzyl=ylxs;
569 603 } else {
570 604 if(t.getId()==id){
571 605 t.setSh(sh);
572 606 t.setShyy(shyy);
573 607 }
574   - if (t.getZlc() != 0) {
575   -// t.setCzyl(Double.parseDouble(df.format(nextJzyl)));
576 608 t.setCzyl(nextJzyl);
577   - Double yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
578   - t.setYh(yh);
579   -// nextJzyl = t.getJzl() + nextJzyl - yh-t.getSh();
  609 + Double yh =0.0;
  610 + if (t.getZlc() != 0) {
  611 + yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
  612 + }
580 613 nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh()));
581   -// t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
582   - t.setJzyl(nextJzyl);
583   - }
584   -
  614 + long l=Math.round(nextJzyl);
  615 + double ylxs=l*100/100;
  616 +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
  617 + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
  618 + t.setJzyl(ylxs);
  619 + t.setYh(yh);
  620 + nextJzyl=ylxs;
585 621 }
586 622 repository.save(t);
587 623  
... ... @@ -600,19 +636,37 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
600 636 if (fage) {
601 637 cylRepository.save(cyl);
602 638 } else {
603   - cyl = new Cyl();
604   - cyl.setNbbm(t.getNbbm());
605   - cyl.setCyl(t.getJzyl());
606   - cyl.setGsdm(t.getSsgsdm());
607   - cyl.setUpdatetime(t.getRq());
608   - cylRepository.save(cyl);
  639 + if(cylMapAdd.get(t.getNbbm())!=null){
  640 + for (int l = 0; l < cylListAdd.size(); l++) {
  641 + cyl=cylListAdd.get(l);
  642 + if(cyl.getNbbm().equals(t.getNbbm())){
  643 + cyl.setNbbm(t.getNbbm());
  644 + cyl.setCyl(t.getJzyl());
  645 + cyl.setGsdm(t.getSsgsdm());
  646 + cyl.setFgsdm(t.getFgsdm());
  647 + cyl.setUpdatetime(t.getRq());
  648 + }
  649 + }
  650 + }else{
  651 + cyl = new Cyl();
  652 + cyl.setNbbm(t.getNbbm());
  653 + cyl.setCyl(t.getJzyl());
  654 + cyl.setGsdm(t.getSsgsdm());
  655 + cyl.setFgsdm(t.getFgsdm());
  656 + cyl.setUpdatetime(t.getRq());
  657 + cylListAdd.add(cyl);
  658 + }
609 659 }
610 660  
611 661 newMap.put("status", ResponseCode.SUCCESS);
612 662 }
  663 + for (int i = 0; i < cylListAdd.size(); i++) {
  664 + cylRepository.save(cylListAdd.get(i));
  665 + }
613 666 } catch (Exception e) {
614 667 newMap.put("status", ResponseCode.ERROR);
615 668 logger.error("save erro.", e);
  669 + throw e;
616 670 }
617 671 return newMap;
618 672 }
... ... @@ -624,7 +678,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
624 678 */
625 679 @Transactional
626 680 @Override
627   - public Map<String, Object> checkYl(Map<String, Object> map) {
  681 + public Map<String, Object> checkYl(Map<String, Object> map) throws Exception{
628 682 Map<String, Object> newMap=new HashMap<String,Object>();
629 683 // String xlbm="";
630 684 // if(map.get("xlbm_like")!=null){
... ... @@ -845,6 +899,97 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
845 899 // }
846 900 return sumMap;
847 901 }
  902 +
  903 + @Override
  904 + public List<Ylb> listYlb(Map<String, Object> map) {
  905 + // TODO Auto-generated method stub
  906 + List<Ylb> listYlb=new ArrayList<Ylb>();
  907 + List<String> stringList=new ArrayList<String>();
  908 + String rq=map.get("rq").toString();
  909 + String gsbm=map.get("ssgsdm_like").toString();
  910 + String fgsbm=map.get("fgsdm_like").toString();
  911 + String xlbm=map.get("xlbm_like").toString().trim();
  912 + String nbbm=map.get("nbbm_eq").toString();
  913 + String sxtj=map.get("sxtj").toString();
  914 + if(nbbm.trim()!=""){
  915 + stringList.add(nbbm);
  916 + listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  917 + }else{
  918 + //全部
  919 + if(sxtj.equals("0")){
  920 + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
  921 + for (int i = 0; i < objectLists.size(); i++) {
  922 + String clbm=objectLists.get(i)[0].toString();
  923 + stringList.add(clbm);
  924 + }
  925 + if(stringList.size()>0){
  926 + listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  927 + }
  928 + }else{
  929 + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
  930 + for (int i = 0; i < objectLists.size(); i++) {
  931 + String clbm=objectLists.get(i)[0].toString();
  932 + int cs=Integer.parseInt(objectLists.get(i)[1].toString());
  933 + //一车一单
  934 + if(sxtj.equals("1")){
  935 + if(cs==1){
  936 + stringList.add(clbm);
  937 + }
  938 + }
  939 + //一车多单
  940 + if(sxtj.equals("2")){
  941 + if(cs>1){
  942 + stringList.add(clbm);
  943 + }
  944 + }
  945 + }
  946 + if(stringList.size()>0){
  947 + listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  948 + }
  949 + }
  950 + }
  951 +
  952 + return listYlb;
  953 + }
  954 +
  955 + @Transactional
  956 + @Override
  957 + public Map<String, Object> saveYlbList(Map<String, Object> map) throws Exception {
  958 + // TODO Auto-generated method stub
  959 + Map<String, Object> newMap=new HashMap<String,Object>();
  960 + try{
  961 + String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString());
  962 + JSONArray jsonArray=JSONArray.parseArray(json);
  963 + JSONObject jsonObject;
  964 +
  965 + for (int i = 0; i < jsonArray.size(); i++) {
  966 +// Ylb t=new Ylb();
  967 + jsonObject=jsonArray.getJSONObject(i);
  968 +
  969 + Double jzyl =jsonObject.getDoubleValue("jzyl");
  970 + Double sh =jsonObject.getDoubleValue("sh");
  971 + String shyy =jsonObject.getString("shyy");
  972 + Double ns = jsonObject.getDoubleValue("ns");
  973 + String rylx =jsonObject.getString("rylx");
  974 + Integer id =jsonObject.getInteger("id");
  975 + /*t.setJzyl(jzyl);
  976 + t.setSh(sh);
  977 + t.setShyy(shyy);
  978 + t.setNs(ns);
  979 + t.setRylx(rylx);
  980 + t.setId(jsonObject.getInteger("id"));*/
  981 + repository.ylbUpdate(id, jzyl, sh, shyy, ns, rylx);
  982 + }
  983 +// List<Map<String, Object>> list=(List<Map<String, Object>>) map.get("ylbList");
  984 +
  985 + newMap.put("status", ResponseCode.SUCCESS);
  986 + }catch(Exception e){
  987 + newMap.put("status", ResponseCode.ERROR);
  988 + logger.error("save erro.", e);
  989 + throw e;
  990 + }
  991 + return newMap;
  992 + }
848 993  
849 994  
850 995 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -1300,7 +1300,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1300 1300 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
1301 1301 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
1302 1302 int jhbc = 0, cjbc = 0, ljbc = 0;
1303   - double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
  1303 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0,jhlcOrig=0, jcclc = 0;
1304 1304 float addMileage = 0l, remMileage = 0l,addMileageYy = 0l,addMileageJc =0l;
1305 1305 Map<String, Object> map = new HashMap<String, Object>();
1306 1306 for (ScheduleRealInfo scheduleRealInfo : list) {
... ... @@ -1310,6 +1310,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1310 1310 //临加里程(主任务临加),
1311 1311 //计划班次,烂班班次,增加班次
1312 1312 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1313 + jhlcOrig = scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig();
  1314 +
1313 1315 if (scheduleRealInfo.isSflj()) {
1314 1316 addMileage += tempJhlc;
1315 1317 if (scheduleRealInfo.getBcType().equals("in")
... ... @@ -1324,9 +1326,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1324 1326 if (!(scheduleRealInfo.getBcType().equals("in")
1325 1327 || scheduleRealInfo.getBcType().equals("out"))) {
1326 1328 jhbc++;
1327   - jhlc += tempJhlc;
  1329 + jhlc += jhlcOrig;
1328 1330 if (scheduleRealInfo.getStatus() == -1) {
1329   - remMileage += tempJhlc;
  1331 + remMileage += jhlcOrig;
1330 1332 cjbc++;
1331 1333 }
1332 1334 }
... ... @@ -1373,12 +1375,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1373 1375 }
1374 1376 }
1375 1377 }
  1378 +
  1379 + //yygl 包含了临加的营运公里 jcclc包含了临加的进出场里程
1376 1380 map.put("jhlc", format.format(jhlc));
1377 1381 map.put("remMileage", format.format(remMileage));
1378 1382 map.put("addMileage", format.format(addMileage));
1379   - map.put("yygl", format.format(yygl+addMileageYy));
  1383 + map.put("yygl", format.format(yygl));
1380 1384 map.put("ksgl", format.format(ksgl));
1381   - map.put("realMileage", format.format(yygl + ksgl + jcclc+addMileageYy));
  1385 + map.put("realMileage", format.format(yygl + ksgl + jcclc));
1382 1386 // map.put("realMileage", format.format(yygl + ksgl + jcclc+addMileage));
1383 1387 map.put("jhbc", jhbc);
1384 1388 map.put("cjbc", cjbc);
... ... @@ -2130,7 +2134,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2130 2134 public List<Map<String, Object>> statisticsDailyTj(String line, String date,String date2,
2131 2135 String xlName, String type) {
2132 2136 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
2133   - list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date,date2);
  2137 + if(line!=null){
  2138 + list = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date,date2);
  2139 + }else{
  2140 + list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date,date2);
  2141 + }
  2142 +
2134 2143  
2135 2144 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
2136 2145 DecimalFormat format = new DecimalFormat("0.00");
... ... @@ -2897,12 +2906,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2897 2906 //前一天日期
2898 2907 // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
2899 2908 // String date = "2016-09-20";
2900   - System.out.println("shijian1:"+new Date());
  2909 +// System.out.println("shijian1:"+new Date());
2901 2910 List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date,gsbm,fgsbm);
2902   - System.out.println("shijian2:"+new Date());
  2911 +// System.out.println("shijian2:"+new Date());
2903 2912 // List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
2904 2913 List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date,gsbm,fgsbm);
2905   - System.out.println("shijian3:"+new Date());
  2914 +// System.out.println("shijian3:"+new Date());
2906 2915 for (int x = 0; x < yesterdayDataList.size(); x++) {
2907 2916 String jName = yesterdayDataList.get(x).get("jGh").toString();
2908 2917 String clZbh = yesterdayDataList.get(x).get("clZbh").toString();
... ... @@ -2929,18 +2938,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2929 2938 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
2930 2939 if (scheduleRealInfo.isSflj()) {
2931 2940 if(scheduleRealInfo.getStatus() == -1){
2932   -// addMileage += tempJhlc;
2933 2941 addMileage =Arith.add(addMileage, tempJhlc);
2934 2942 }
2935 2943 } else {
2936 2944 if (!(scheduleRealInfo.getBcType().equals("in")
2937 2945 || scheduleRealInfo.getBcType().equals("out"))) {
2938   -// jhlc += tempJhlc;
2939 2946 jhlc =Arith.add(jhlc,tempJhlc);
2940 2947 }
2941 2948  
2942 2949 if (scheduleRealInfo.getStatus() == -1) {
2943   -// remMileage += tempJhlc;
2944 2950 remMileage =Arith.add(remMileage,tempJhlc);
2945 2951 }
2946 2952 }
... ... @@ -2950,7 +2956,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2950 2956 if (scheduleRealInfo.getBcType().equals("in") ||
2951 2957 scheduleRealInfo.getBcType().equals("out")) {
2952 2958 if (scheduleRealInfo.getStatus() != -1) {
2953   -// jcclc += tempJhlc;
2954 2959 jcclc=Arith.add(jcclc,tempJhlc);
2955 2960 }
2956 2961 }
... ... @@ -2960,7 +2965,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2960 2965 // }
2961 2966 else {
2962 2967 if (scheduleRealInfo.getStatus() != -1) {
2963   -// yygl += tempJhlc;
2964 2968 yygl=Arith.add(yygl,tempJhlc);
2965 2969 }
2966 2970 }
... ... @@ -2970,19 +2974,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2970 2974 ChildTaskPlan childTaskPlan = it.next();
2971 2975 if (childTaskPlan.getMileageType().equals("empty")) {
2972 2976 if (childTaskPlan.isDestroy()) {
2973   -// remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
2974 2977 remMileage=Arith.add(remMileage,childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage());
2975 2978 } else {
2976   -// ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
2977 2979 ksgl += Arith.add(ksgl,childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage());
2978 2980 }
2979 2981 } else {
2980 2982 if (childTaskPlan.isDestroy()) {
2981   -// remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
2982 2983 remMileage=Arith.add(remMileage,childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage());
2983 2984  
2984 2985 } else {
2985   -// yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
2986 2986 yygl=Arith.add(yygl,childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage());
2987 2987  
2988 2988 }
... ...
src/main/resources/static/pages/oil/list_ph.html
... ... @@ -23,7 +23,10 @@
23 23 <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加</a>
24 24 <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button>
25 25 <button type="button" class="btn btn-circle blue" id="sortButton"><i class="fa fa-minus-square"></i>
26   - 拆分/保存
  26 + 拆分
  27 + </button>
  28 + <button type="button" class="btn btn-circle blue" id="saveButton"><i class="fa fa-check-circle"></i>
  29 + 保存
27 30 </button>
28 31 <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> -->
29 32 <div class="btn-group">
... ... @@ -187,7 +190,7 @@
187 190 {{each list as obj i}}
188 191 <tr>
189 192 <td style="vertical-align: middle;">
190   - <input type="radio" name="id" class="group-checkable icheck" data-id="{{obj.id}}">
  193 + <input type="checkbox" name="id" class="group-checkable icheck" data-id="{{obj.id}}">
191 194 </td>
192 195  
193 196 <td>
... ... @@ -212,18 +215,23 @@
212 215 {{obj.czyl}}
213 216 </td>
214 217 <td>
215   - <a data-id="{{obj.id}}" href="javascript:;" class="in_carpark_jzyl">
216   - {{obj.jzyl}}
217   - </a>
  218 + <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_jzyl"
  219 +type="text" value=" {{obj.jzyl}}" style=" width:40px" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'')"
  220 +onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'')">
218 221 </td>
219 222 <td>
220 223 {{obj.yh}}
221 224 </td>
222 225 <td>
223   - {{obj.rylx}}
  226 + <select data-id="{{obj.id}}" class="in_carpark_rylx">
  227 + <option value='0' {{if obj.rylx==0}} selected = 'selected' {{/if}}>0号柴油</option>
  228 + <option value='1' {{if obj.rylx==1}} selected = 'selected' {{/if}}>负10号柴油</option>
  229 + </select>
224 230 </td>
225 231 <td>
226   - {{obj.ns}}
  232 + <input data-id="{{obj.id}}" href="javascript:;"
  233 +class="in_carpark_ns" type="text" value=" {{obj.ns}}" style=" width:40px" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'')"
  234 +onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'')">
227 235 </td>
228 236 <td>
229 237 <select data-id="{{obj.id}}" class="in_carpark_shyy">
... ... @@ -239,9 +247,9 @@
239 247 </select>
240 248 </td>
241 249 <td>
242   - <a data-id="{{obj.id}}" href="javascript:;" class="in_carpark_shyl">
243   - {{obj.sh}}
244   - </a>
  250 + <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_shyl" type="text"
  251 +value=" {{obj.sh}}" style=" width:40px" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'')"
  252 +onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'')" >
245 253 </td>
246 254 <td>
247 255 {{obj.zlc}}
... ... @@ -294,7 +302,49 @@
294 302 layer.msg('请选择日期.');
295 303 }
296 304 });
297   -
  305 +
  306 +
  307 + //保存
  308 + $("#saveButton").on('click',function(){
  309 + var ylArray = [];
  310 + /* $('input.icheck:checked').each(function(){
  311 + var map = {};
  312 + var id=$(this).data('id');
  313 + var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').html();
  314 + var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').html();
  315 + var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val();
  316 + map['id']=id;
  317 + map['jzyl']=jzyl;
  318 + map['sh']=sh;
  319 + map['shyy']=shyy;
  320 + ylArray.push(map);
  321 + }) */
  322 +
  323 + $('input.icheck').each(function(){
  324 + var map = {};
  325 + var id=$(this).data('id');
  326 + var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').val();
  327 + var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').val();
  328 + var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val();
  329 + var ns = $('.in_carpark_ns[data-id='+id+']', '#ll_oil_list').val();
  330 + var rylx= $('.in_carpark_rylx[data-id='+id+']', '#ll_oil_list').val();
  331 + map['id']=id;
  332 + map['jzyl']=jzyl;
  333 + map['sh']=sh;
  334 + map['shyy']=shyy;
  335 + map['ns']=ns;
  336 + map['rylx']=rylx;
  337 + ylArray.push(map);
  338 + })
  339 + var params = {};
  340 + params['ylbList']=JSON.stringify(ylArray);
  341 + var i = layer.load(2);
  342 + $get('/ylb/saveYlbList', params, function () {
  343 + layer.close(i);
  344 + var params1 =getParamsList();
  345 + jsDoQuery(params1, true);
  346 + });
  347 + })
298 348 //拆分
299 349 $("#sortButton").on('click', function () {
300 350 if ($("#rq").val() != "") {
... ... @@ -348,7 +398,7 @@
348 398  
349 399 var page = 0, initPagination;
350 400 var icheckOptions = {
351   - radioClass: 'iradio_square-blue icheck',
  401 + radioClass: 'icheckbox_flat-blue',
352 402 increaseArea: '20%'
353 403 }
354 404  
... ... @@ -473,31 +523,29 @@
473 523 } */
474 524  
475 525 var l = layer.load(2);
476   - $get('/ylb', params, function (data) {
  526 + $get('/ylb/ylbList', params, function (data) {
477 527  
478   - $.each(data.content, function (i, obj) {
  528 + $.each(data, function (i, obj) {
479 529 obj.rq = moment(obj.rq).format("YYYY-MM-DD");
480 530 });
481   - var bodyHtm = template('ylb_list_temp', {list: data.content});
482   -
483   - $('#datatable_ylb tbody').html(bodyHtm)
  531 + var bodyHtm = template('ylb_list_temp', {list:data});
  532 + $('#datatable_ylb tbody').html(bodyHtm);
  533 + /* $('#datatable_ylb tbody').html(bodyHtm)
484 534 .find('.icheck').iCheck(icheckOptions)
485 535 .on('ifChanged', iCheckChange);
486 536 if (pagination && data.content.length > 0) {
487 537 //重新分页
488 538 initPagination = true;
489 539 showPagination(data);
490   - }
  540 + } */
491 541 layer.close(l);
492 542 $get('/ylb/sumYlb',params,function(returns){
493   - console.log(returns);
494   - console.log(returns.jzl);
495 543 $("#sumJzl").html(returns.jzl);
496 544 $("#sumYh").html(returns.yh);
497 545 $("#sumSh").html(returns.sh);
498 546 });
499   - startOptJzylLink($('#ll_oil_list .in_carpark_jzyl'));
500   - startOptShylLink($('#ll_oil_list .in_carpark_shyl'));
  547 +// startOptJzylLink($('#ll_oil_list .in_carpark_jzyl'));
  548 +// startOptShylLink($('#ll_oil_list .in_carpark_shyl'));
501 549 });
502 550 }
503 551  
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/directive_history.html
... ... @@ -65,9 +65,9 @@
65 65 {{if obj.reply46 != 0}}
66 66 <div class="uk-badge uk-badge-danger"> 设备未响应</div>
67 67 {{else if obj.reply47 != 0}}
68   - <div class="uk-badge uk-badge-warning"> 驾驶员未确认</div>
  68 + <div class="uk-badge uk-badge-warning"> 设备已响应</div>
69 69 {{else if obj.reply46 == 0 && obj.reply47 == 0}}
70   - <div class="uk-badge"> 成功</div>
  70 + <div class="uk-badge"> 驾驶员已确认</div>
71 71 {{/if}}
72 72 {{/if}}
73 73 </td>
... ...
src/main/resources/static/real_control_v2/js/home/context_menu.js
... ... @@ -39,6 +39,20 @@ var gb_home_context_menu = (function() {
39 39 });
40 40 };
41 41  
  42 + //营运状态和上下行切换
  43 + var stateChange = function (nbbm, updown, state) {
  44 + $.post('/directive/stateChange', {
  45 + nbbm: nbbm,
  46 + upDown: updown,
  47 + state: state
  48 + }, function(rs) {
  49 + if (rs == 0)
  50 + notify_succ('指令已发出');
  51 + else
  52 + notify_err('发送失败,原因参考【指令下发记录】');
  53 + });
  54 + };
  55 +
42 56 // send phrase
43 57 var sendPhrase = function() {
44 58 var dom = temps['home-send-phrase-temp']({
... ... @@ -139,11 +153,19 @@ var gb_home_context_menu = (function() {
139 153 };
140 154  
141 155 var state_up_0 = function() {
142   - changeUpDown(active_car, 0);
  156 + stateChange(active_car, 0, 0);
143 157 };
144 158  
145 159 var state_down_0 = function() {
146   - changeUpDown(active_car, 1);
  160 + stateChange(active_car, 1, 0);
  161 + };
  162 +
  163 + var state_up_1 = function () {
  164 + stateChange(active_car, 0, 1);
  165 + };
  166 +
  167 + var state_down_1 = function () {
  168 + stateChange(active_car, 1, 1);
147 169 };
148 170  
149 171 var line_change = function() {
... ... @@ -179,7 +201,6 @@ var gb_home_context_menu = (function() {
179 201 });
180 202 };
181 203  
182   -
183 204 var C0_A3 = function(){
184 205 open_modal('/real_control_v2/fragments/home/c0_a3.html', {}, {center: false, bgclose: false});
185 206 };
... ... @@ -190,7 +211,9 @@ var gb_home_context_menu = (function() {
190 211 state_up_0: state_up_0,
191 212 state_down_0: state_down_0,
192 213 line_change: line_change,
193   - C0_A3: C0_A3
  214 + C0_A3: C0_A3,
  215 + state_up_1: state_up_1,
  216 + state_down_1: state_down_1
194 217 };
195 218  
196 219 $.contextMenu({
... ... @@ -210,6 +233,13 @@ var gb_home_context_menu = (function() {
210 233 'fold_state': {
211 234 name: '状态切换',
212 235 items: {
  236 + 'state_up_1': {
  237 + 'name': '上行非营运'
  238 + },
  239 + 'state_down_1': {
  240 + 'name': '下行非营运'
  241 + },
  242 + 'sep3_2': '---------',
213 243 'state_up_0': {
214 244 'name': '上行营运'
215 245 },
... ...