Commit e834adca5c00ba60b6048f11285068afb46ef435

Authored by 潘钊
1 parent 1cbb83a7

update...

src/main/java/com/bsth/common/Constants.java
1 package com.bsth.common; 1 package com.bsth.common;
2 2
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.bsth.util.ConfigUtil;
  5 +
3 /** 6 /**
4 * 7 *
5 * @ClassName: Constants 8 * @ClassName: Constants
@@ -28,4 +31,21 @@ public class Constants { @@ -28,4 +31,21 @@ public class Constants {
28 * 对外的上行输入接口 31 * 对外的上行输入接口
29 */ 32 */
30 public static final String UPSTREAM_URL = "/bus_park_dispatch/**"; 33 public static final String UPSTREAM_URL = "/bus_park_dispatch/**";
  34 +
  35 + //公司权限
  36 + public static String authJsonStr;
  37 + public static String tccName;
  38 + public static String tccCode;
  39 +
  40 + static{
  41 + JSONObject json = JSONObject.parseObject(ConfigUtil.get("data.company.json"));
  42 + JSONObject authJson = new JSONObject();
  43 + String[] codes = ConfigUtil.get("tcc.company.id").split(",");
  44 + for(int i = 0; i < codes.length; i ++){
  45 + authJson.put(codes[i], json.get(codes[i]));
  46 + }
  47 + authJsonStr = authJson.toJSONString();
  48 + tccName = ConfigUtil.get("tcc.name");
  49 + tccCode = ConfigUtil.get("tcc.code");
  50 + }
31 } 51 }
src/main/java/com/bsth/controller/basic/CompanyController.java
1 package com.bsth.controller.basic; 1 package com.bsth.controller.basic;
2 2
3 -import com.alibaba.fastjson.JSONObject;  
4 -import com.bsth.util.ConfigUtil; 3 +import com.bsth.common.Constants;
5 import org.springframework.web.bind.annotation.RequestMapping; 4 import org.springframework.web.bind.annotation.RequestMapping;
6 import org.springframework.web.bind.annotation.RestController; 5 import org.springframework.web.bind.annotation.RestController;
7 6
@@ -15,32 +14,17 @@ import java.util.Map; @@ -15,32 +14,17 @@ import java.util.Map;
15 @RequestMapping("company_json") 14 @RequestMapping("company_json")
16 public class CompanyController { 15 public class CompanyController {
17 16
18 - static String jsonStr;  
19 - static String tccName;  
20 - static String tccCode;  
21 -  
22 - static{  
23 - JSONObject json = JSONObject.parseObject(ConfigUtil.get("data.company.json"));  
24 - JSONObject authJson = new JSONObject();  
25 - String[] codes = ConfigUtil.get("tcc.company.id").split(",");  
26 - for(int i = 0; i < codes.length; i ++){  
27 - authJson.put(codes[i], json.get(codes[i]));  
28 - }  
29 - jsonStr = authJson.toJSONString();  
30 - tccName = ConfigUtil.get("tcc.name");  
31 - tccCode = ConfigUtil.get("tcc.code");  
32 - }  
33 17
34 @RequestMapping 18 @RequestMapping
35 public String get(){ 19 public String get(){
36 - return jsonStr; 20 + return Constants.authJsonStr;
37 } 21 }
38 22
39 @RequestMapping(value = "curr_tcc_info") 23 @RequestMapping(value = "curr_tcc_info")
40 public Map<String, String> getTccName(){ 24 public Map<String, String> getTccName(){
41 Map<String, String> map = new HashMap<>(); 25 Map<String, String> map = new HashMap<>();
42 - map.put("name", tccName);  
43 - map.put("code", tccCode); 26 + map.put("name", Constants.tccName);
  27 + map.put("code", Constants.tccCode);
44 return map; 28 return map;
45 } 29 }
46 } 30 }
src/main/java/com/bsth/controller/schedule/InOutScheduleController.java
@@ -51,4 +51,9 @@ public class InOutScheduleController { @@ -51,4 +51,9 @@ public class InOutScheduleController {
51 public Map<String, Object> dftz(@RequestParam Map<String, Object> map){ 51 public Map<String, Object> dftz(@RequestParam Map<String, Object> map){
52 return inOutScheduleService.dftz(map); 52 return inOutScheduleService.dftz(map);
53 } 53 }
  54 +
  55 + @RequestMapping(value = "tzrc", method = RequestMethod.POST)
  56 + public Map<String, Object> tzrc(@RequestParam String cpcsJson){
  57 + return inOutScheduleService.tzrc(cpcsJson);
  58 + }
54 } 59 }
src/main/java/com/bsth/data/abnormal/MainAbnormalClient.java
1 package com.bsth.data.abnormal; 1 package com.bsth.data.abnormal;
2 2
3 -import com.alibaba.fastjson.JSON;  
4 import com.bsth.data.abnormal.entity.AbnormalEntity; 3 import com.bsth.data.abnormal.entity.AbnormalEntity;
  4 +import com.bsth.data.abnormal.handler.AttendanceHandler;
  5 +import com.bsth.data.abnormal.handler.InOutHandler;
5 import com.bsth.websocket.handler.SendUtils; 6 import com.bsth.websocket.handler.SendUtils;
6 import com.google.common.collect.ArrayListMultimap; 7 import com.google.common.collect.ArrayListMultimap;
7 import org.slf4j.Logger; 8 import org.slf4j.Logger;
@@ -10,22 +11,24 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -10,22 +11,24 @@ import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Component; 11 import org.springframework.stereotype.Component;
11 12
12 import java.util.List; 13 import java.util.List;
13 -import java.util.concurrent.ConcurrentHashMap;  
14 -import java.util.concurrent.ConcurrentMap;  
15 14
16 /** 15 /**
17 - * 异常监管主处理程序 16 + * 异常监管
18 * Created by panzhao on 2018/3/1. 17 * Created by panzhao on 2018/3/1.
19 */ 18 */
20 @Component 19 @Component
21 public class MainAbnormalClient { 20 public class MainAbnormalClient {
22 21
23 private static ArrayListMultimap<String, AbnormalEntity> lineMultimap; 22 private static ArrayListMultimap<String, AbnormalEntity> lineMultimap;
24 - private static ConcurrentMap<Long, AbnormalEntity> schIdMap; 23 +
  24 + @Autowired
  25 + AttendanceHandler attendanceHandler;
  26 +
  27 + @Autowired
  28 + InOutHandler inOutHandler;
25 29
26 static { 30 static {
27 lineMultimap = ArrayListMultimap.create(); 31 lineMultimap = ArrayListMultimap.create();
28 - schIdMap = new ConcurrentHashMap<>();  
29 } 32 }
30 33
31 @Autowired 34 @Autowired
@@ -35,12 +38,19 @@ public class MainAbnormalClient { @@ -35,12 +38,19 @@ public class MainAbnormalClient {
35 38
36 public void put(AbnormalEntity ae){ 39 public void put(AbnormalEntity ae){
37 lineMultimap.put(ae.getLineCode(), ae); 40 lineMultimap.put(ae.getLineCode(), ae);
38 - schIdMap.put(ae.getSchId(), ae); 41 +
  42 + if(ae.getType() == -1)
  43 + attendanceHandler.put(ae);
  44 + else if(ae.getType() == -2)
  45 + inOutHandler.put(ae);
39 46
40 //web socket 47 //web socket
41 sendUtils.abnormal_ydwd(ae); 48 sendUtils.abnormal_ydwd(ae);
  49 + }
42 50
43 - logger.info("应到未到: " + JSON.toJSONString(ae)); 51 + public void dftz(Long id, String source){
  52 + inOutHandler.dftzJd(id, source);
  53 + attendanceHandler.dftzJd(id, source);
44 } 54 }
45 55
46 public List<AbnormalEntity> findByLine(String lineCode){ 56 public List<AbnormalEntity> findByLine(String lineCode){
src/main/java/com/bsth/data/abnormal/entity/AbnormalEntity.java
@@ -44,6 +44,22 @@ public class AbnormalEntity { @@ -44,6 +44,22 @@ public class AbnormalEntity {
44 44
45 private String lpName; 45 private String lpName;
46 46
  47 + //---------------
  48 + /**
  49 + * 处理人
  50 + */
  51 + private String handlerUser;
  52 +
  53 + /**
  54 + * 处理时间
  55 + */
  56 + private Long handlerTime;
  57 +
  58 + /**
  59 + * 说明
  60 + */
  61 + private String handlerDes;
  62 +
47 public int getType() { 63 public int getType() {
48 return type; 64 return type;
49 } 65 }
@@ -107,4 +123,28 @@ public class AbnormalEntity { @@ -107,4 +123,28 @@ public class AbnormalEntity {
107 public void setLpName(String lpName) { 123 public void setLpName(String lpName) {
108 this.lpName = lpName; 124 this.lpName = lpName;
109 } 125 }
  126 +
  127 + public String getHandlerUser() {
  128 + return handlerUser;
  129 + }
  130 +
  131 + public void setHandlerUser(String handlerUser) {
  132 + this.handlerUser = handlerUser;
  133 + }
  134 +
  135 + public Long getHandlerTime() {
  136 + return handlerTime;
  137 + }
  138 +
  139 + public void setHandlerTime(Long handlerTime) {
  140 + this.handlerTime = handlerTime;
  141 + }
  142 +
  143 + public String getHandlerDes() {
  144 + return handlerDes;
  145 + }
  146 +
  147 + public void setHandlerDes(String handlerDes) {
  148 + this.handlerDes = handlerDes;
  149 + }
110 } 150 }
src/main/java/com/bsth/data/abnormal/handler/AttendanceHandler.java
1 package com.bsth.data.abnormal.handler; 1 package com.bsth.data.abnormal.handler;
2 2
  3 +import com.bsth.data.abnormal.entity.AbnormalEntity;
  4 +import com.bsth.data.schedule.dto.ScheduleInOut;
  5 +import com.bsth.data.schedule.real.ScheduleDataBuffer;
  6 +import org.springframework.stereotype.Component;
  7 +
  8 +import java.util.concurrent.ConcurrentHashMap;
  9 +import java.util.concurrent.ConcurrentMap;
  10 +
3 /** 11 /**
4 * 考勤异常处理 12 * 考勤异常处理
5 * Created by panzhao on 2018/3/1. 13 * Created by panzhao on 2018/3/1.
6 */ 14 */
  15 +@Component
7 public class AttendanceHandler { 16 public class AttendanceHandler {
  17 +
  18 + /**
  19 + * 未处理异常
  20 + */
  21 + private static ConcurrentMap<Long, AbnormalEntity> schIdMap;
  22 +
  23 + static {
  24 + schIdMap = new ConcurrentHashMap<>();
  25 + }
  26 +
  27 + public void put(AbnormalEntity ae){
  28 + schIdMap.put(ae.getSchId(), ae);
  29 + }
  30 +
  31 + /**
  32 + * 异常处理(待发调整)
  33 + * @param id
  34 + */
  35 + public void dftzJd(Long id, String source){
  36 + Long t = System.currentTimeMillis();
  37 +
  38 + AbnormalEntity ae = schIdMap.get(id);
  39 + if(null == ae)
  40 + return;
  41 +
  42 + ScheduleInOut sio = ScheduleDataBuffer.findById(id);
  43 +
  44 + if(sio.getAttJhTime() - t > 1000 * 60){
  45 + ae.setHandlerTime(t);
  46 + ae.setHandlerUser("system");
  47 + ae.setHandlerDes(source);
  48 +
  49 + sio.setAbnormalStatus(0);
  50 +
  51 + schIdMap.remove(ae.getSchId());
  52 + }
  53 + }
  54 +
  55 + public void handler(Long id){
  56 +
  57 + }
8 } 58 }
src/main/java/com/bsth/data/abnormal/handler/InOutHandler.java
1 package com.bsth.data.abnormal.handler; 1 package com.bsth.data.abnormal.handler;
2 2
  3 +import com.bsth.data.abnormal.entity.AbnormalEntity;
  4 +import com.bsth.data.schedule.dto.ScheduleInOut;
  5 +import com.bsth.data.schedule.real.ScheduleDataBuffer;
  6 +import org.springframework.stereotype.Component;
  7 +
  8 +import java.util.concurrent.ConcurrentHashMap;
  9 +import java.util.concurrent.ConcurrentMap;
  10 +
3 /** 11 /**
4 * 进出场异常处理 12 * 进出场异常处理
5 * Created by panzhao on 2018/3/1. 13 * Created by panzhao on 2018/3/1.
6 */ 14 */
  15 +@Component
7 public class InOutHandler { 16 public class InOutHandler {
  17 +
  18 + private static ConcurrentMap<Long, AbnormalEntity> schIdMap;
  19 +
  20 + static {
  21 + schIdMap = new ConcurrentHashMap<>();
  22 + }
  23 +
  24 + public void put(AbnormalEntity ae){
  25 + schIdMap.put(ae.getSchId(), ae);
  26 + }
  27 +
  28 + /**
  29 + * 异常处理(待发调整)
  30 + * @param id
  31 + */
  32 + public void dftzJd(Long id, String source){
  33 + Long t = System.currentTimeMillis();
  34 +
  35 + AbnormalEntity ae = schIdMap.get(id);
  36 + if(null == ae)
  37 + return;
  38 +
  39 + ScheduleInOut sio = ScheduleDataBuffer.findById(id);
  40 +
  41 + if(sio.getDfsjT() - t > 1000 * 60){
  42 + ae.setHandlerTime(t);
  43 + ae.setHandlerUser("system");
  44 + ae.setHandlerDes(source);
  45 +
  46 + sio.setAbnormalStatus(-1);
  47 +
  48 + schIdMap.remove(ae.getSchId());
  49 + }
  50 + }
  51 +
  52 + public void handler(Long id){
  53 +
  54 + }
8 } 55 }
src/main/java/com/bsth/data/abnormal/scanner/InOutAbnormalScanner.java
1 package com.bsth.data.abnormal.scanner; 1 package com.bsth.data.abnormal.scanner;
2 2
  3 +import com.bsth.data.abnormal.MainAbnormalClient;
  4 +import com.bsth.data.abnormal.entity.AbnormalEntity;
  5 +import com.bsth.data.schedule.dto.ScheduleInOut;
  6 +import com.bsth.data.schedule.real.ScheduleDataBuffer;
  7 +import org.joda.time.format.DateTimeFormat;
  8 +import org.joda.time.format.DateTimeFormatter;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Component;
  11 +
  12 +import java.util.List;
  13 +
3 /** 14 /**
4 * 进出场异常检测 15 * 进出场异常检测
5 * Created by panzhao on 2018/3/1. 16 * Created by panzhao on 2018/3/1.
6 */ 17 */
  18 +@Component
7 public class InOutAbnormalScanner { 19 public class InOutAbnormalScanner {
  20 +
  21 + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");
  22 +
  23 + @Autowired
  24 + MainAbnormalClient mainAbnormalClient;
  25 +
  26 + public void scan(){
  27 + List<ScheduleInOut> list = ScheduleDataBuffer.all_out();
  28 +
  29 + AbnormalEntity ae;
  30 + Long t = System.currentTimeMillis();
  31 + for(ScheduleInOut sio : list){
  32 +
  33 + if(sio.getStatus() == -1)
  34 + continue;//烂班
  35 +
  36 + if(sio.getDfsjT() >= t)
  37 + continue;//出场时间未到
  38 +
  39 + if(sio.getOutTimeRfid() != null)
  40 + continue;//RFID已出场
  41 +
  42 + if(sio.getAbnormalStatus() < -1)
  43 + continue;//已报异常
  44 +
  45 + ae = new AbnormalEntity();
  46 + ae.setType(1);
  47 + ae.setSchId(sio.getId());
  48 + ae.setLineCode(sio.getLineCode());
  49 + ae.setNbbm(sio.getNbbm());
  50 + ae.setPlanTimeStr(fmtHHmm.print(sio.getDfsjT()));
  51 + ae.setPlanTime(sio.getDfsjT());
  52 + ae.setLpName(sio.getLpName());
  53 +
  54 + mainAbnormalClient.put(ae);
  55 +
  56 + sio.setAbnormalStatus(-2);
  57 + }
  58 + }
8 } 59 }
src/main/java/com/bsth/data/abnormal/thread/AbnormalFixedScannerThread.java
1 package com.bsth.data.abnormal.thread; 1 package com.bsth.data.abnormal.thread;
2 2
3 import com.bsth.data.abnormal.scanner.AttendanceAbnormalScanner; 3 import com.bsth.data.abnormal.scanner.AttendanceAbnormalScanner;
  4 +import com.bsth.data.abnormal.scanner.InOutAbnormalScanner;
4 import org.slf4j.Logger; 5 import org.slf4j.Logger;
5 import org.slf4j.LoggerFactory; 6 import org.slf4j.LoggerFactory;
6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,11 +19,15 @@ public class AbnormalFixedScannerThread extends Thread { @@ -18,11 +19,15 @@ public class AbnormalFixedScannerThread extends Thread {
18 @Autowired 19 @Autowired
19 AttendanceAbnormalScanner attendanceAbnormalScanner; 20 AttendanceAbnormalScanner attendanceAbnormalScanner;
20 21
  22 + @Autowired
  23 + InOutAbnormalScanner inOutAbnormalScanner;
  24 +
21 @Override 25 @Override
22 public void run() { 26 public void run() {
23 27
24 try { 28 try {
25 attendanceAbnormalScanner.scan(); 29 attendanceAbnormalScanner.scan();
  30 + inOutAbnormalScanner.scan();
26 } catch (Exception e) { 31 } catch (Exception e) {
27 logger.error("", e); 32 logger.error("", e);
28 } 33 }
src/main/java/com/bsth/data/schedule/real/ScheduleDataBuffer.java
@@ -111,12 +111,38 @@ public class ScheduleDataBuffer implements CommandLineRunner { @@ -111,12 +111,38 @@ public class ScheduleDataBuffer implements CommandLineRunner {
111 } 111 }
112 112
113 public static void put(ScheduleInOut sio) { 113 public static void put(ScheduleInOut sio) {
  114 + try {
  115 + if(null == sio.getUt())
  116 + sio.setUt(System.currentTimeMillis());
  117 + //公司编码
  118 + Line line = LineDataBuffer.get(sio.getLineCode());
  119 + sio.setGsbm(line.getCompany());
  120 + sio.setFgsbm(line.getBrancheCompany());
  121 +
  122 + //分离驾驶员工号
  123 + String[] jsyArray = sio.getJsy().split("/");
  124 + sio.setjGh(jsyArray[0]);
  125 +
  126 + //为驾驶员名称做拼音映射
  127 + sio.setjNameFullChars(PinyinHelper.convertToPinyinString(jsyArray[1], "" , PinyinFormat.WITHOUT_TONE).toUpperCase());
  128 + sio.setjNameCamelChars(PinyinHelper.getShortPinyin(jsyArray[1]).toUpperCase());
  129 + } catch (Exception e) {
  130 + logger.info("计划异常 ID (jsy error...)" + sio.getId());
  131 + }
  132 +
  133 + //计划报到时间
  134 + sio.setAttJhTime(sio.getDfsjT() - 1000 * 60 * 15);
  135 +
114 if (allMaps.containsKey(sio.getId())) 136 if (allMaps.containsKey(sio.getId()))
115 update(allMaps.get(sio.getId()), sio); 137 update(allMaps.get(sio.getId()), sio);
116 else 138 else
117 allMaps.put(sio.getId(), sio); 139 allMaps.put(sio.getId(), sio);
118 } 140 }
119 141
  142 + public static ScheduleInOut findById(Long id){
  143 + return allMaps.get(id);
  144 + }
  145 +
120 /** 146 /**
121 * 分离进出场计划 147 * 分离进出场计划
122 */ 148 */
@@ -167,7 +193,7 @@ public class ScheduleDataBuffer implements CommandLineRunner { @@ -167,7 +193,7 @@ public class ScheduleDataBuffer implements CommandLineRunner {
167 /** 193 /**
168 * 人员,车辆分组的计划 194 * 人员,车辆分组的计划
169 */ 195 */
170 - private static void p_c_mapps() { 196 + public static void p_c_mapps() {
171 //人员和车辆映射 197 //人员和车辆映射
172 ArrayListMultimap pMultimapCopy = ArrayListMultimap.create(), 198 ArrayListMultimap pMultimapCopy = ArrayListMultimap.create(),
173 cMultimapCopy = ArrayListMultimap.create(); 199 cMultimapCopy = ArrayListMultimap.create();
@@ -303,25 +329,6 @@ public class ScheduleDataBuffer implements CommandLineRunner { @@ -303,25 +329,6 @@ public class ScheduleDataBuffer implements CommandLineRunner {
303 sio.setBcType(TYPE_IN); 329 sio.setBcType(TYPE_IN);
304 else 330 else
305 sio.setBcType(""); 331 sio.setBcType("");
306 -  
307 - //公司编码  
308 - line = LineDataBuffer.get(sio.getLineCode());  
309 - sio.setGsbm(line.getCompany());  
310 - sio.setFgsbm(line.getBrancheCompany());  
311 - try {  
312 - //分离驾驶员工号  
313 - String[] jsyArray = sio.getJsy().split("/");  
314 - sio.setjGh(jsyArray[0]);  
315 -  
316 - //为驾驶员名称做拼音映射  
317 - sio.setjNameFullChars(PinyinHelper.convertToPinyinString(jsyArray[1], "" , PinyinFormat.WITHOUT_TONE).toUpperCase());  
318 - sio.setjNameCamelChars(PinyinHelper.getShortPinyin(jsyArray[1]).toUpperCase());  
319 - } catch (Exception e) {  
320 - logger.info("计划异常 ID (jsy error...)" + sio.getId());  
321 - }  
322 -  
323 - //计划报到时间  
324 - sio.setAttJhTime(sio.getDfsjT() - 1000 * 60 * 15);  
325 } 332 }
326 333
327 logger.info("同步进出场班数量 " + listCopy.size()); 334 logger.info("同步进出场班数量 " + listCopy.size());
src/main/java/com/bsth/service/schedule/ScheduleService.java
@@ -32,6 +32,8 @@ public interface ScheduleService { @@ -32,6 +32,8 @@ public interface ScheduleService {
32 32
33 Map<String,Object> dftz(Map<String, Object> map); 33 Map<String,Object> dftz(Map<String, Object> map);
34 34
  35 + Map<String,Object> tzrc(String cpcsJson);
  36 +
35 //void inOut(CarInOutEntity obj); 37 //void inOut(CarInOutEntity obj);
36 38
37 //void busInOut(CarInOutEntity obj); 39 //void busInOut(CarInOutEntity obj);
src/main/java/com/bsth/service/schedule/impl/ScheduleServiceImpl.java
1 package com.bsth.service.schedule.impl; 1 package com.bsth.service.schedule.impl;
2 2
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONArray;
  5 +import com.alibaba.fastjson.JSONObject;
  6 +import com.bsth.common.Constants;
4 import com.bsth.common.ResponseCode; 7 import com.bsth.common.ResponseCode;
5 import com.bsth.data.abnormal.MainAbnormalClient; 8 import com.bsth.data.abnormal.MainAbnormalClient;
6 import com.bsth.data.abnormal.entity.AbnormalEntity; 9 import com.bsth.data.abnormal.entity.AbnormalEntity;
@@ -14,6 +17,7 @@ import com.bsth.security.util.SecurityUtils; @@ -14,6 +17,7 @@ import com.bsth.security.util.SecurityUtils;
14 import com.bsth.service.schedule.ScheduleService; 17 import com.bsth.service.schedule.ScheduleService;
15 import com.bsth.util.ConfigUtil; 18 import com.bsth.util.ConfigUtil;
16 import com.google.common.base.Splitter; 19 import com.google.common.base.Splitter;
  20 +import org.apache.commons.lang3.StringEscapeUtils;
17 import org.slf4j.Logger; 21 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory; 22 import org.slf4j.LoggerFactory;
19 import org.springframework.beans.factory.annotation.Autowired; 23 import org.springframework.beans.factory.annotation.Autowired;
@@ -146,6 +150,9 @@ public class ScheduleServiceImpl implements ScheduleService { @@ -146,6 +150,9 @@ public class ScheduleServiceImpl implements ScheduleService {
146 if("SUCCESS".equals(rs.get("status"))){ 150 if("SUCCESS".equals(rs.get("status"))){
147 ScheduleInOut sio = JSON.toJavaObject(JSON.parseObject(rs.get("t").toString()), ScheduleInOut.class); 151 ScheduleInOut sio = JSON.toJavaObject(JSON.parseObject(rs.get("t").toString()), ScheduleInOut.class);
148 ScheduleDataBuffer.put(sio); 152 ScheduleDataBuffer.put(sio);
  153 +
  154 + //处理相关异常
  155 + mainAbnormalClient.dftz(sio.getId(), "调档");
149 } 156 }
150 }catch (Exception e){ 157 }catch (Exception e){
151 logger.error("", e); 158 logger.error("", e);
@@ -154,4 +161,36 @@ public class ScheduleServiceImpl implements ScheduleService { @@ -154,4 +161,36 @@ public class ScheduleServiceImpl implements ScheduleService {
154 } 161 }
155 return rs; 162 return rs;
156 } 163 }
  164 +
  165 + @Override
  166 + public Map<String, Object> tzrc(String cpcsJson) {
  167 + JSONObject rs = new JSONObject();
  168 + try{
  169 + cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson);
  170 + Map<String, Object> params = new HashMap<>();
  171 +
  172 + params.put("userId", SecurityUtils.getCurrentUser().getUserName());
  173 + params.put("cpcs", JSON.parseArray(cpcsJson));
  174 + params.put("tccCode", Constants.tccCode);
  175 + StringBuilder sb = HttpClientUtils.post(dataUrl + "/tcc_tzrc" + RsRequestUtils.getParams(), JSON.toJSONString(params));
  176 +
  177 + rs = JSON.parseObject(sb.toString());
  178 +
  179 + if("SUCCESS".equals(rs.get("status"))){
  180 + JSONArray array = rs.getJSONArray("list");
  181 + int size = array.size();
  182 + for(int i=0; i < size;i ++){
  183 + ScheduleDataBuffer.put(JSON.toJavaObject(array.getJSONObject(i), ScheduleInOut.class));
  184 + }
  185 + }
  186 +
  187 + //重新按人车分组数据
  188 + ScheduleDataBuffer.p_c_mapps();
  189 + }catch (Exception e){
  190 + logger.error("", e);
  191 + rs.put("status", ResponseCode.ERROR);
  192 + rs.put("msg", "服务器出现异常!");
  193 + }
  194 + return rs;
  195 + }
157 } 196 }
src/main/resources/static/pages/abnormal/fragments/m_tzrc.html
@@ -40,9 +40,9 @@ @@ -40,9 +40,9 @@
40 <label class="uk-form-label">车辆</label> 40 <label class="uk-form-label">车辆</label>
41 <div class="uk-form-controls"> 41 <div class="uk-form-controls">
42 <div class="ct_auto_wrap" id="nbbmAutoCompleter"> 42 <div class="ct_auto_wrap" id="nbbmAutoCompleter">
43 - <input class="uk-input" name="nbbm" type="text" placeholder="车辆自编号" disabled autocomplete="off"> 43 + <input class="uk-input" name="nbbm" type="text" placeholder="车辆自编号" autocomplete="off">
44 </div> 44 </div>
45 - <input class="uk-checkbox switch_c_box" type="checkbox" > 45 + <input class="uk-checkbox switch_c_box" type="checkbox" checked>
46 </div> 46 </div>
47 </div> 47 </div>
48 <div class="uk-width-1-2@s"> 48 <div class="uk-width-1-2@s">
@@ -97,6 +97,9 @@ @@ -97,6 +97,9 @@
97 ct_autocompleter.initBus($('#nbbmAutoCompleter', wrap)); 97 ct_autocompleter.initBus($('#nbbmAutoCompleter', wrap));
98 98
99 data && data.caller && data.caller(); 99 data && data.caller && data.caller();
  100 +
  101 + //提交
  102 + $(modalId).on('click', '.submit-btn', _submit);
100 }); 103 });
101 104
102 var reset = function () { 105 var reset = function () {
@@ -162,6 +165,9 @@ @@ -162,6 +165,9 @@
162 opts += '<option>'+lp+'</option>'; 165 opts += '<option>'+lp+'</option>';
163 } 166 }
164 $('form [name=lpName]', wrap).html(opts); 167 $('form [name=lpName]', wrap).html(opts);
  168 +
  169 + if(!_initFlag)
  170 + $('form [name=lpName]', wrap).trigger('change');
165 }; 171 };
166 172
167 //线路切换 173 //线路切换
@@ -227,6 +233,57 @@ @@ -227,6 +233,57 @@
227 else 233 else
228 input.attr('disabled', 'disabled'); 234 input.attr('disabled', 'disabled');
229 }); 235 });
  236 +
  237 + /**
  238 + * 提交
  239 + */
  240 + function _submit() {
  241 + var f = $('form', modalId);
  242 + var fData = f.serializeJSON();
  243 +
  244 + if(!fData['nbbm'] && !$('[name=nbbm]', f).attr('disabled')){
  245 + _shake_elem($('[name=nbbm]', f));
  246 + return UIkit.notification('车辆不能为空!', 'danger');
  247 + }
  248 +
  249 + if(!fData['jsy'] && !$('[name=jsy]', f).attr('disabled')){
  250 + _shake_elem($('[name=nbbm]', f));
  251 + return UIkit.notification('驾驶员不能为空!', 'danger');
  252 + }
  253 +
  254 + var checkeds = $('.sch_list_table>tr.active', modalId);
  255 + if (checkeds.length == 0)
  256 + return UIkit.notification('请选中要调整的班次!', 'danger');
  257 +
  258 +
  259 + console.log('fDatafData', fData);
  260 + var data = [];
  261 + var schId;
  262 + $.each(checkeds, function () {
  263 + schId = $(this).data('id');
  264 + data.push({
  265 + schId: schId,
  266 + jsy: fData.jsy,
  267 + spy: fData.spy,
  268 + clZbh: fData.nbbm
  269 + });
  270 + });
  271 +
  272 + console.log('data', data);
  273 + gb_common.$post('/in_out/tzrc', {cpcsJson: JSON.stringify(data)}, function (rs) {
  274 + console.log('rsrsrs', rs);
  275 +
  276 + UIkit.notification('操作成功!', 'success');
  277 + gb_os_card.update(rs.list);
  278 + UIkit.modal(modalId).hide();
  279 + });
  280 + }
  281 +
  282 + function _shake_elem($e) {
  283 + $e.addClass('uk-animation-shake').one('animationend', function () {
  284 + $(this).removeClass('uk-animation-shake');
  285 + });
  286 + }
230 })(); 287 })();
231 </script> 288 </script>
232 </div> 289 </div>
233 \ No newline at end of file 290 \ No newline at end of file