Commit 9c5c2e3854aa875c4375672c05514b36d2c70519

Authored by 潘钊
1 parent 2d06de47

update...

src/main/java/com/bsth/controller/schedule/InOutScheduleController.java
1 1 package com.bsth.controller.schedule;
2 2  
  3 +import com.bsth.data.abnormal.rate_chart.RateNCalculator;
3 4 import com.bsth.data.schedule.dto.ScheduleInOut;
4 5 import com.bsth.service.schedule.ScheduleService;
5 6 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -9,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam;
9 10 import org.springframework.web.bind.annotation.RestController;
10 11  
11 12 import java.util.Collection;
  13 +import java.util.HashMap;
12 14 import java.util.List;
13 15 import java.util.Map;
14 16  
... ... @@ -81,4 +83,12 @@ public class InOutScheduleController {
81 83 public Map<String, Object> cycc(@RequestParam Map<String, Object> map){
82 84 return inOutScheduleService.cycc(map);
83 85 }
  86 +
  87 + @RequestMapping("rates")
  88 + public Map<String, Object> allRates(){
  89 + Map<String, Object> rs = new HashMap();
  90 + rs.put("cczd", RateNCalculator.cczdRateNo);
  91 + rs.put("bdzd", RateNCalculator.bdzdRateNo);
  92 + return rs;
  93 + }
84 94 }
... ...
src/main/java/com/bsth/data/abnormal/handler/AttendanceHandler.java
... ... @@ -116,8 +116,11 @@ public class AttendanceHandler {
116 116 if(null == ae)
117 117 return null;
118 118  
119   - if(!sio.getJsy().equals(ae.getJsy()))
  119 + if(!sio.getJsy().equals(ae.getJsy())){
120 120 ae.setJsy(sio.getJsy());
  121 + return ae;
  122 + }
  123 +
121 124  
122 125 if(null != sio.getAttSjTime()){
123 126 ae.setHandlerTime(sio.getAttSjTime());
... ... @@ -126,7 +129,9 @@ public class AttendanceHandler {
126 129  
127 130 sio.reCalcAnStatus();
128 131 schIdMap.remove(ae.getSchId());
  132 +
  133 + return ae;
129 134 }
130   - return ae;
  135 + return null;
131 136 }
132 137 }
... ...
src/main/java/com/bsth/data/abnormal/handler/InOutHandler.java
... ... @@ -102,8 +102,11 @@ public class InOutHandler {
102 102 if(null == ae)
103 103 return null;
104 104  
105   - if(!sio.getNbbm().equals(ae.getNbbm()))
  105 + if(!sio.getNbbm().equals(ae.getNbbm())){
106 106 ae.setNbbm(sio.getNbbm());
  107 + return ae;
  108 + }
  109 +
107 110  
108 111 if(null != sio.getOutTimeRfid()){
109 112 ae.setHandlerTime(sio.getOutTimeRfid());
... ... @@ -112,7 +115,9 @@ public class InOutHandler {
112 115  
113 116 sio.reCalcAnStatus();
114 117 schIdMap.remove(ae.getSchId());
  118 +
  119 + return ae;
115 120 }
116   - return ae;
  121 + return null;
117 122 }
118 123 }
... ...
src/main/java/com/bsth/data/abnormal/rate_chart/RateNCalculator.java 0 → 100644
  1 +package com.bsth.data.abnormal.rate_chart;
  2 +
  3 +import com.bsth.data.schedule.dto.ScheduleInOut;
  4 +import com.bsth.data.schedule.real.ScheduleComparator;
  5 +import com.bsth.data.schedule.real.ScheduleDataBuffer;
  6 +import com.bsth.util.Arith;
  7 +import org.joda.time.format.DateTimeFormat;
  8 +import org.joda.time.format.DateTimeFormatter;
  9 +import org.springframework.stereotype.Component;
  10 +
  11 +import java.text.DecimalFormat;
  12 +import java.util.Collections;
  13 +import java.util.List;
  14 +
  15 +/**
  16 + * 统计率值计算
  17 + * Created by panzhao on 2018/4/10.
  18 + */
  19 +@Component
  20 +public class RateNCalculator {
  21 +
  22 + //出场准点率
  23 + public static float cczdRateNo;
  24 +
  25 + //报到准点率
  26 + public static float bdzdRateNo;
  27 +
  28 + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  29 +
  30 + /**
  31 + * 计算 出场准点率(分钟级)
  32 + */
  33 + public static boolean calcCczdRateNo() {
  34 + long t = System.currentTimeMillis();
  35 + float sum = 0, v = 0, rs;
  36 +
  37 + List<ScheduleInOut> list = ScheduleDataBuffer.all_out();
  38 + if (null == list)
  39 + return false;
  40 +
  41 + Collections.sort(list, new ScheduleComparator());
  42 + for (ScheduleInOut s : list) {
  43 +
  44 + if (s.getDfsjT() < t)
  45 + sum++;
  46 + else
  47 + break;
  48 +
  49 + if (s.getOutTimeRfid() == null)
  50 + continue;
  51 +
  52 + if (eraseSecond(s.getOutTimeRfid()) <= s.getDfsjT()) {
  53 + v++;
  54 + }
  55 + }
  56 +
  57 + if (v > 0) {
  58 + rs = Float.parseFloat(new DecimalFormat("#.00").format(Arith.div(v, sum))) * 100;
  59 +
  60 + if (rs != cczdRateNo) {
  61 + cczdRateNo = rs;
  62 + return true;
  63 + }
  64 + } else
  65 + cczdRateNo = 0;
  66 +
  67 + return false;
  68 + }
  69 +
  70 +
  71 + /**
  72 + * 计算 报到准点率(分钟级)
  73 + */
  74 + public static boolean calcBdzdRateNo() {
  75 + long t = System.currentTimeMillis();
  76 + float sum = 0, v = 0, rs;
  77 +
  78 + List<ScheduleInOut> list = ScheduleDataBuffer.all_out();
  79 + if (null == list)
  80 + return false;
  81 +
  82 + Collections.sort(list, new ScheduleComparator());
  83 + for (ScheduleInOut s : list) {
  84 +
  85 + if (s.getAttJhTime() < t)
  86 + sum++;
  87 + else
  88 + break;
  89 +
  90 + if (s.getAttSjTime() == null)
  91 + continue;
  92 +
  93 + if (eraseSecond(s.getAttSjTime()) <= s.getAttJhTime()) {
  94 + v++;
  95 + }
  96 + }
  97 +
  98 + if (v > 0) {
  99 + rs = Float.parseFloat(new DecimalFormat("#.00").format(Arith.div(v, sum))) * 100;
  100 +
  101 + if (rs != bdzdRateNo) {
  102 + bdzdRateNo = rs;
  103 + return true;
  104 + }
  105 + } else
  106 + bdzdRateNo = 0;
  107 + return false;
  108 + }
  109 +
  110 + /**
  111 + * 抹掉时间戳上的秒
  112 + *
  113 + * @param t
  114 + * @return
  115 + */
  116 + private static long eraseSecond(long t) {
  117 + return fmtyyyyMMddHHmm.parseDateTime(fmtyyyyMMddHHmm.print(t)).toDate().getTime();
  118 + }
  119 +}
... ...
src/main/java/com/bsth/data/abnormal/rate_chart/thread/FixedCalcRateThread.java 0 → 100644
  1 +package com.bsth.data.abnormal.rate_chart.thread;
  2 +
  3 +import com.bsth.data.abnormal.rate_chart.RateNCalculator;
  4 +import com.bsth.websocket.handler.SendUtils;
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +/**
  11 + *
  12 + * Created by panzhao on 2018/4/10.
  13 + */
  14 +@Component
  15 +public class FixedCalcRateThread extends Thread{
  16 +
  17 + Logger logger = LoggerFactory.getLogger(this.getClass());
  18 +
  19 + @Autowired
  20 + SendUtils sendUtils;
  21 +
  22 + @Override
  23 + public void run() {
  24 + try{
  25 + int count=0;
  26 +
  27 + count += (RateNCalculator.calcCczdRateNo() ? 1 : 0);//出场准点率
  28 + count += (RateNCalculator.calcBdzdRateNo() ? 1 : 0);//报到准点率
  29 +
  30 + if(count > 0)
  31 + sendUtils.sendAllRates();
  32 + }catch (Exception e){
  33 + logger.error("", e);
  34 + }
  35 + }
  36 +}
... ...
src/main/java/com/bsth/data/attendance/RealAttendaceHandler.java
... ... @@ -2,6 +2,7 @@ package com.bsth.data.attendance;
2 2  
3 3 import com.bsth.data.abnormal.MainAbnormalClient;
4 4 import com.bsth.data.abnormal.entity.AbnormalEntity;
  5 +import com.bsth.data.abnormal.rate_chart.RateNCalculator;
5 6 import com.bsth.data.attendance.entity.JsyAttendance;
6 7 import com.bsth.data.schedule.dto.ScheduleInOut;
7 8 import com.bsth.data.schedule.real.ScheduleComparator;
... ... @@ -55,6 +56,10 @@ public class RealAttendaceHandler {
55 56  
56 57 //通知页面
57 58 sendUtils.scheduleAttendace(sio, ae);
  59 +
  60 + //重新计算签到准点率
  61 + if(RateNCalculator.calcBdzdRateNo())
  62 + sendUtils.sendAllRates();
58 63 }
59 64  
60 65 /**
... ...
src/main/java/com/bsth/data/in_out/RealInoutHandler.java
... ... @@ -2,6 +2,7 @@ package com.bsth.data.in_out;
2 2  
3 3 import com.bsth.data.abnormal.MainAbnormalClient;
4 4 import com.bsth.data.abnormal.entity.AbnormalEntity;
  5 +import com.bsth.data.abnormal.rate_chart.RateNCalculator;
5 6 import com.bsth.data.in_out.carpark.RealBerthManager;
6 7 import com.bsth.data.schedule.dto.ScheduleInOut;
7 8 import com.bsth.data.schedule.real.ScheduleComparator;
... ... @@ -88,6 +89,8 @@ public class RealInoutHandler {
88 89 * @param cio
89 90 */
90 91 public void attachRfidTime(ScheduleInOut sio, CarInOutEntity cio) {
  92 + if(null == sio)
  93 + return;
91 94 if (sio.getBcType().equals("out")) {//出场班次
92 95 if (sio.getOutTimeRfid() == null ||
93 96 (null != sio.getOutTimeRfid() && outSignalMatch(sio, cio))) {
... ... @@ -99,6 +102,10 @@ public class RealInoutHandler {
99 102  
100 103 //通知页面
101 104 sendUtils.scheduleOut(sio, ae);
  105 +
  106 + //重新计算出场准点率
  107 + if(RateNCalculator.calcCczdRateNo())
  108 + sendUtils.sendAllRates();
102 109 }
103 110 }
104 111 }
... ... @@ -156,8 +163,8 @@ public class RealInoutHandler {
156 163 */
157 164 public void reCalcOutSignal(String name1, String nbbm2) {
158 165 //获取车辆的出场计划
159   - List<ScheduleInOut> arrayA = ScheduleDataBuffer.getByNbbm(name1)
160   - , arrayB = ScheduleDataBuffer.getByNbbm(nbbm2);
  166 + List<ScheduleInOut> arrayA = ScheduleDataBuffer.getByNbbm(name1, "out")
  167 + , arrayB = ScheduleDataBuffer.getByNbbm(nbbm2, "out");
161 168  
162 169 reCalcOutSignal(arrayA);
163 170 reCalcOutSignal(arrayB);
... ...
src/main/java/com/bsth/data/schedule/real/ScheduleDataBuffer.java
... ... @@ -106,6 +106,17 @@ public class ScheduleDataBuffer implements CommandLineRunner {
106 106 return cMultimap.get(nbbm);
107 107 }
108 108  
  109 + public static List<ScheduleInOut> getByNbbm(String nbbm, String bcType){
  110 + List<ScheduleInOut> all = cMultimap.get(nbbm)
  111 + ,rs = new ArrayList<>();
  112 +
  113 + for(ScheduleInOut s : all){
  114 + if(s.getBcType().equals(bcType))
  115 + rs.add(s);
  116 + }
  117 + return rs;
  118 + }
  119 +
109 120 private void putAll(List<ScheduleInOut> list) {
110 121 Long t = System.currentTimeMillis();
111 122 for (ScheduleInOut sio : list) {
... ... @@ -218,6 +229,20 @@ public class ScheduleDataBuffer implements CommandLineRunner {
218 229 pMultimap = pMultimapCopy;
219 230 cMultimap = cMultimapCopy;
220 231 }
  232 + public static void p_mapps(){
  233 + ArrayListMultimap pMultimapCopy = ArrayListMultimap.create();
  234 + Collection<ScheduleInOut> vs = allMaps.values();
  235 + for (ScheduleInOut sio : vs)
  236 + pMultimapCopy.put(sio.getGsbm() + "-" + sio.getjGh(), sio);
  237 + pMultimap = pMultimapCopy;
  238 + }
  239 + public static void c_mapps(){
  240 + ArrayListMultimap cMultimapCopy = ArrayListMultimap.create();
  241 + Collection<ScheduleInOut> vs = allMaps.values();
  242 + for (ScheduleInOut sio : vs)
  243 + cMultimapCopy.put(sio.getNbbm(), sio);
  244 + cMultimap = cMultimapCopy;
  245 + }
221 246  
222 247 private void update(ScheduleInOut old, ScheduleInOut now) {
223 248 old.setDfsjT(now.getDfsjT());
... ... @@ -233,6 +258,8 @@ public class ScheduleDataBuffer implements CommandLineRunner {
233 258 String oldJgh = old.getjGh();
234 259 old.setJsy(now.getJsy());
235 260 old.setjGh(now.getjGh());
  261 +
  262 + p_mapps();
236 263 //重新匹配人员计划和实际报到
237 264 realAttendaceHandler.reCalcOutSignal(old.getGsbm(), oldJgh, now.getjGh());
238 265 }
... ... @@ -240,6 +267,8 @@ public class ScheduleDataBuffer implements CommandLineRunner {
240 267 if (isCCar) {
241 268 String oldNbbm = old.getNbbm();
242 269 old.setNbbm(now.getNbbm());
  270 +
  271 + c_mapps();
243 272 //重新匹配车辆计划和实际出场
244 273 realInoutHandler.reCalcOutSignal(oldNbbm, now.getNbbm());
245 274 }
... ...
src/main/java/com/bsth/service/schedule/impl/ScheduleServiceImpl.java
... ... @@ -7,6 +7,7 @@ import com.bsth.common.Constants;
7 7 import com.bsth.common.ResponseCode;
8 8 import com.bsth.data.abnormal.MainAbnormalClient;
9 9 import com.bsth.data.abnormal.entity.AbnormalEntity;
  10 +import com.bsth.data.abnormal.rate_chart.RateNCalculator;
10 11 import com.bsth.data.basic.bus.BusDataBuffer;
11 12 import com.bsth.data.basic.line.LineDataBuffer;
12 13 import com.bsth.data.basic.person.PersonDataBuffer;
... ... @@ -21,6 +22,7 @@ import com.bsth.entity.Person;
21 22 import com.bsth.security.util.SecurityUtils;
22 23 import com.bsth.service.schedule.ScheduleService;
23 24 import com.bsth.util.ConfigUtil;
  25 +import com.bsth.websocket.handler.SendUtils;
24 26 import com.google.common.base.Splitter;
25 27 import org.apache.commons.lang3.StringEscapeUtils;
26 28 import org.apache.commons.lang3.StringUtils;
... ... @@ -49,6 +51,9 @@ public class ScheduleServiceImpl implements ScheduleService {
49 51 @Autowired
50 52 ScheduleDataBuffer scheduleDataBuffer;
51 53  
  54 + @Autowired
  55 + SendUtils sendUtils;
  56 +
52 57 static {
53 58 dataUrl = ConfigUtil.get("data.schedule.inout.url");
54 59 }
... ... @@ -195,12 +200,15 @@ public class ScheduleServiceImpl implements ScheduleService {
195 200  
196 201 rs = JSON.parseObject(sb.toString());
197 202  
198   -
199 203 if ("SUCCESS".equals(rs.get("status"))) {
200   - List<ScheduleInOut> list = JSONArray.parseArray(rs.getString("list"), ScheduleInOut.class);//有更新的出场班次
  204 + List<ScheduleInOut> remList = JSONArray.parseArray(rs.getString("list"), ScheduleInOut.class);//有更新的出场班次
  205 + List<ScheduleInOut> list = new ArrayList<>(remList.size());
  206 +
201 207 List<AbnormalEntity> aes = new ArrayList<>();//有更新的异常信息
202   - for (ScheduleInOut sio : list) {
  208 + for (ScheduleInOut sio : remList) {
203 209 scheduleDataBuffer.put(sio);
  210 +
  211 + list.add(scheduleDataBuffer.findById(sio.getId()));
204 212 aes.addAll(mainAbnormalClient.updateTzrc(sio));
205 213 }
206 214  
... ... @@ -246,6 +254,10 @@ public class ScheduleServiceImpl implements ScheduleService {
246 254 //处理掉异常
247 255 AbnormalEntity ae = mainAbnormalClient.rybd(id, timeStr, reason, remarks);
248 256  
  257 + //重新计算签到准点率
  258 + if(RateNCalculator.calcBdzdRateNo())
  259 + sendUtils.sendAllRates();
  260 +
249 261 rs.put("status", ResponseCode.SUCCESS);
250 262 rs.put("t", sio);
251 263 rs.put("ae", ae);
... ... @@ -283,6 +295,9 @@ public class ScheduleServiceImpl implements ScheduleService {
283 295  
284 296 //处理掉异常
285 297 AbnormalEntity ae = mainAbnormalClient.cycc(id, timeStr, reason, remarks);
  298 + //重新计算出场准点率
  299 + if(RateNCalculator.calcCczdRateNo())
  300 + sendUtils.sendAllRates();
286 301  
287 302 rs.put("status", ResponseCode.SUCCESS);
288 303 rs.put("t", sio);
... ...
src/main/java/com/bsth/websocket/handler/SendUtils.java
1 1 package com.bsth.websocket.handler;
2 2  
3 3 import com.bsth.data.abnormal.entity.AbnormalEntity;
  4 +import com.bsth.data.abnormal.rate_chart.RateNCalculator;
4 5 import com.bsth.data.schedule.dto.ScheduleInOut;
5 6 import com.fasterxml.jackson.databind.ObjectMapper;
6 7 import org.slf4j.Logger;
... ... @@ -110,4 +111,23 @@ public class SendUtils{
110 111 logger.error("", e);
111 112 }
112 113 }
  114 +
  115 + /**
  116 + * 全量推统计率值
  117 + */
  118 + public void sendAllRates(){
  119 + Map<String, Object> map = new HashMap<>();
  120 + map.put("fn", "all_rate_val");
  121 + map.put("cczd", RateNCalculator.cczdRateNo);
  122 + map.put("bdzd", RateNCalculator.bdzdRateNo);
  123 +
  124 +
  125 + ObjectMapper mapper = new ObjectMapper();
  126 +
  127 + try {
  128 + socketHandler.sendMessage(mapper.writeValueAsString(map));
  129 + } catch (Exception e) {
  130 + logger.error("", e);
  131 + }
  132 + }
113 133 }
... ...
src/main/resources/static/assets/css/abnormal_monitor.css
1 1 #abnormal_monitor_wrap{
2 2 height: 100%;
  3 + position: relative;
  4 + overflow: hidden;
3 5 }
4 6 #abnormal_monitor_wrap>div{
5 7 font-size: 14px;
... ... @@ -710,6 +712,11 @@ table tr&gt;td.empty{
710 712 fill: rgb(76, 131, 79) !important;
711 713 }
712 714  
  715 +
  716 +.data_charts .vz-skin-fire .vz-radial_progress-label{
  717 + fill: rgb(241, 56, 112) !important;
  718 +}
  719 +
713 720 .data_charts .vz-radial_progress-label{
714 721 font-size: 16px !important;
715 722 transform: translate(3px, -10px);
... ... @@ -723,6 +730,10 @@ table tr&gt;td.empty{
723 730 font-weight: 300;
724 731 }
725 732  
  733 +.vz-skin-fire ._chart_title text{
  734 + stroke: rgb(241, 56, 112);
  735 +}
  736 +
726 737 .data_charts>div>.chart_wrap{
727 738 height: 100%;
728 739 padding-top: 5px;
... ... @@ -736,4 +747,21 @@ table tr&gt;td.empty{
736 747  
737 748 .data_charts>div{
738 749 text-align: center;
739   -}
740 750 \ No newline at end of file
  751 +}
  752 +
  753 +#abnormal_monitor_wrap .empty-line-div {
  754 + position: absolute;
  755 + z-index: 2;
  756 + background: #f6f6f6;
  757 + width: 100%;
  758 + height: 100%;
  759 + text-align: center;
  760 + display: none;
  761 +}
  762 +
  763 +
  764 +#abnormal_monitor_wrap .empty-line-div p{
  765 + font-size: 16px;
  766 + font-family: 微软雅黑;
  767 +}
  768 +
... ...
src/main/resources/static/assets/css/system_manager.css
... ... @@ -97,24 +97,24 @@
97 97  
98 98 .fun_s_list .module span.item.active{
99 99 color: #ffffff;
100   - background: #ff8a65;
  100 + background: #9c9c9c;
101 101 }
102 102  
103 103 .fun_s_list .module span.item.active .uk-checkbox:checked,
104 104 .fun_s_list .module span.item.active .uk-checkbox:indeterminate,
105 105 .fun_s_list .module span.item.active .uk-radio:checked{
106   - background-color: #ff8a65;
  106 + background-color: #9c9c9c;
107 107 }
108 108  
109 109 .fun_s_list .module span.root.item.active{
110 110 color: #ffffff;
111   - background: #FF5722;
  111 + background: #9c9c9c;
112 112 }
113 113  
114 114 .fun_s_list .module span.root.item.active .uk-checkbox:checked,
115 115 .fun_s_list .module span.root.item.active .uk-checkbox:indeterminate,
116 116 .fun_s_list .module span.root.item.active .uk-radio:checked{
117   - background-color: #FF5722;
  117 + background-color: #9c9c9c;
118 118 }
119 119  
120 120 .footer_wrap{
... ...
src/main/resources/static/js/_websocket.js
... ... @@ -56,6 +56,9 @@ var gb_websocket = (function () {
56 56 },
57 57 abnormal_att: function (msg) {
58 58 gb_o_s_ws_handler.attendace(msg);
  59 + },
  60 + all_rate_val: function (msg) {
  61 + gb_o_s_charts.changeVal(msg);
59 62 }
60 63 };
61 64  
... ...
src/main/resources/static/pages/abnormal/fragments/m_tzrc.html
... ... @@ -283,6 +283,7 @@
283 283  
284 284 UIkit.notification('操作成功!', 'success');
285 285 gb_os_card.update(rs.list);
  286 + gb_o_s_abnormal.update(rs.aes);
286 287 UIkit.modal(modalId).hide();
287 288 });
288 289 }
... ...
src/main/resources/static/pages/abnormal/fragments/type_0/h_cont_hrcc.html
... ... @@ -126,7 +126,7 @@
126 126 }
127 127 else{
128 128 //提交
129   - $(modalId).on('click', '.submit-btn', _submit);
  129 + $(wrap).on('click', '.submit-btn', _submit);
130 130 }
131 131 });
132 132  
... ... @@ -218,7 +218,7 @@
218 218 * 提交
219 219 */
220 220 function _submit() {
221   - var f = $('form', modalId);
  221 + var f = $('form', wrap);
222 222 var fData = f.serializeJSON();
223 223  
224 224 if(!fData['nbbm'] && !$('[name=nbbm]', f).attr('disabled')){
... ... @@ -248,7 +248,7 @@
248 248 });
249 249 });
250 250  
251   - $('.submit-btn', modalId).attr('disabled', 'disabled');
  251 + $('.submit-btn', wrap).attr('disabled', 'disabled');
252 252 //先校验一下操作有效性
253 253 fData.line = ae.lineCode;
254 254 gb_common.$post('/in_out/tzrc_check', fData, function (rs) {
... ... @@ -258,10 +258,10 @@
258 258 }
259 259 else {
260 260 gb_common.$post('/in_out/tzrc', {cpcsJson: JSON.stringify(data)}, function (rs) {
261   - console.log('rsrsrs', rs);
262 261  
263 262 UIkit.notification('操作成功!', 'success');
264 263 gb_os_card.update(rs.list);
  264 + gb_o_s_abnormal.update(rs.aes);
265 265 UIkit.modal(modalId).hide();
266 266 });
267 267 }
... ...
src/main/resources/static/pages/abnormal/fragments/type_1/h_cont_hccc.html
... ... @@ -125,7 +125,7 @@
125 125 }
126 126 else{
127 127 //提交
128   - $(modalId).on('click', '.submit-btn', _submit);
  128 + $(wrap).on('click', '.submit-btn', _submit);
129 129 }
130 130 });
131 131  
... ... @@ -217,7 +217,7 @@
217 217 * 提交
218 218 */
219 219 function _submit() {
220   - var f = $('form', modalId);
  220 + var f = $('form', wrap);
221 221 var fData = f.serializeJSON();
222 222  
223 223 if(!fData['nbbm'] && !$('[name=nbbm]', f).attr('disabled')){
... ... @@ -247,7 +247,7 @@
247 247 });
248 248 });
249 249  
250   - $('.submit-btn', modalId).attr('disabled', 'disabled');
  250 + $('.submit-btn', wrap).attr('disabled', 'disabled');
251 251 //先校验一下操作有效性
252 252 fData.line = ae.lineCode;
253 253 gb_common.$post('/in_out/tzrc_check', fData, function (rs) {
... ... @@ -257,10 +257,10 @@
257 257 }
258 258 else {
259 259 gb_common.$post('/in_out/tzrc', {cpcsJson: JSON.stringify(data)}, function (rs) {
260   - console.log('rsrsrs', rs);
261 260  
262 261 UIkit.notification('操作成功!', 'success');
263 262 gb_os_card.update(rs.list);
  263 + gb_o_s_abnormal.update(rs.aes);
264 264 UIkit.modal(modalId).hide();
265 265 });
266 266 }
... ...
src/main/resources/static/pages/abnormal/js/o_s_abnormal.js
... ... @@ -91,11 +91,25 @@ var gb_o_s_abnormal = (function () {
91 91 }
92 92 };
93 93  
  94 + var update = function (array) {
  95 + if (!isArray(array))
  96 + array = [array];
  97 +
  98 + var htmlStr, id;
  99 + $.each(array, function () {
  100 + id = this.schId + '_' + this.type;
  101 + htmlStr = template('abnormal_card_list-temp', {list: [this]});
  102 +
  103 + $('div[data-id='+id+']', wrap).replaceWith(htmlStr);
  104 + });
  105 + };
  106 +
94 107  
95 108 return {
96 109 init: init,
97 110 get: getByKey,
98 111 handle: handle,
99   - renderErrorLinePanel: renderErrorLinePanel
  112 + renderErrorLinePanel: renderErrorLinePanel,
  113 + update: update
100 114 }
101 115 })();
102 116 \ No newline at end of file
... ...
src/main/resources/static/pages/abnormal/js/o_s_charts.js
... ... @@ -4,8 +4,12 @@
4 4 var gb_o_s_charts = (function () {
5 5  
6 6 var init = function () {
7   - renderCcCharts();
8   - renderQdCharts();
  7 + $.get('/in_out/rates', function (rs) {
  8 +
  9 + lastData = rs;
  10 + renderCcCharts(rs['cczd']);
  11 + renderQdCharts(rs['bdzd']);
  12 + });
9 13 };
10 14  
11 15 //出场准点率 viz
... ... @@ -13,36 +17,48 @@ var gb_o_s_charts = (function () {
13 17 //签到准点率 viz
14 18 var qdRateChartViz;
15 19  
  20 + var lastData;
16 21  
17 22 /**
18 23 * 出场准点率
19 24 */
20   - var renderCcCharts = function () {
  25 + var renderCcCharts = function (v) {
21 26 var wrap = '#abnormal_monitor_wrap';
22 27 var v_cont = d3.selectAll(wrap + ' #ccRateChart>.chart_wrap');
23 28  
24   - var viz = vizuly.viz.radial_progress($('#ccRateChart>.chart_wrap', wrap)[0])
25   - ,theme = vizuly.theme.radial_progress(viz).skin(vizuly.skin.RADIAL_PROGRESS_ALERT);
  29 + var viz = vizuly.viz.radial_progress($('#ccRateChart>.chart_wrap', wrap)[0]);
  30 + var theme = vizuly.theme.radial_progress(viz).skin(getTheme(v));
  31 + viz._themeObj = theme;
26 32  
27   - drawArc(viz, v_cont, 80, '出场准点');
  33 + drawArc(viz, v_cont, v, '出场准点');
28 34 ccRateChartViz = viz;
29 35 };
30 36  
31 37 /**
32 38 * 签到准点率
33 39 */
34   - var renderQdCharts = function () {
  40 + var renderQdCharts = function (v) {
35 41 var wrap = '#abnormal_monitor_wrap';
36 42 var v_cont = d3.selectAll(wrap + ' #bdRateChart>.chart_wrap');
37 43  
38   - var viz = vizuly.viz.radial_progress($('#bdRateChart>.chart_wrap', wrap)[0])
39   - ,theme = vizuly.theme.radial_progress(viz).skin(vizuly.skin.RADIAL_PROGRESS_ALERT);
  44 + var viz = vizuly.viz.radial_progress($('#bdRateChart>.chart_wrap', wrap)[0]);
  45 + vizuly.theme.radial_progress(viz).skin(getTheme(v));
40 46  
41   - drawArc(viz, v_cont, 80, '报到准点');
  47 + drawArc(viz, v_cont, v, '报到准点');
42 48 qdRateChartViz = viz;
43 49 };
44 50  
45 51  
  52 + var getTheme = function (v) {
  53 + var themeStr = vizuly.skin.RADIAL_PROGRESS_ALERT;
  54 + if(v < 50)
  55 + themeStr = vizuly.skin.RADIAL_PROGRESS_FIRE;
  56 + else if(v > 50 && v < 80)
  57 + themeStr = vizuly.skin.RADIAL_PROGRESS_NEON;
  58 +
  59 + return themeStr;
  60 + };
  61 +
46 62 function changeSize(viz, val) {
47 63 var s = String(val).split(",");
48 64 var divWidth = s[0] * 0.80 / 3;
... ... @@ -54,7 +70,7 @@ var gb_o_s_charts = (function () {
54 70 .height(200)
55 71 .min(0)
56 72 .max(100)
57   - .on("tween",onTween)
  73 + //.on("tween",onTween)
58 74  
59 75 .startAngle(180)
60 76 .endAngle(180)
... ... @@ -81,12 +97,33 @@ var gb_o_s_charts = (function () {
81 97 .text(viz.label()(viz.data() * i));
82 98 }
83 99  
  100 + var changeVal = function (msg) {
  101 + console.log('changeValchangeVal', msg, lastData);
  102 + //出场准点率
  103 + if(msg.cczd!=lastData.cczd){
  104 + ccRateChartViz.data(Number(msg.cczd)).update();//更新数字
  105 + changeTheme(ccRateChartViz, msg.cczd);//更新颜色
  106 + lastData.cczd = msg.cczd;
  107 + }
  108 +
  109 + //报到准点率
  110 + if(msg.bdzd!=lastData.bdzd){
  111 + qdRateChartViz.data(Number(msg.bdzd)).update();//更新数字
  112 + changeTheme(qdRateChartViz, msg.bdzd);//更新颜色
  113 + lastData.bdzd = msg.bdzd;
  114 + }
  115 + };
  116 +
  117 + var changeTheme = function (viz, val) {
  118 + var themeObj = viz._themeObj;
  119 + var v = getTheme(val);
84 120  
85   - /* function changeData(val) {
86   - viz.data(Number(val)).update();
87   - }*/
  121 + themeObj.skin(val);
  122 + themeObj.viz().update();
  123 + };
88 124  
89 125 return {
90   - init: init
  126 + init: init,
  127 + changeVal: changeVal
91 128 }
92 129 })();
93 130 \ No newline at end of file
... ...
src/main/resources/static/pages/abnormal/main.html
1 1 <div id="abnormal_monitor_wrap" class="">
  2 + <div class="empty-line-div">
  3 + <div class="uk-alert-danger" uk-alert>
  4 + <p>当前账号没有可监管的线路,请至 “系统管理”——>“用户和账号” 分配线路监管权限。</p>
  5 + </div>
  6 + </div>
2 7  
3 8 <div class="left_panel">
4 9 <div class="red_line_bts"></div>
... ... @@ -359,6 +364,12 @@
359 364 var wrap = '#abnormal_monitor_wrap';
360 365 var lineIdx = '10146';
361 366 window.localStorage.setItem("abnormal_line_idx", lineIdx);
  367 +
  368 + if(!lineIdx){
  369 + $('.empty-line-div',wrap).show();
  370 + return;
  371 + }
  372 +
362 373 var initFlag;
363 374  
364 375 var start = function (cb) {
... ...
src/main/resources/static/pages/system_manager/user/user_list.html
... ... @@ -85,7 +85,8 @@
85 85 <td>{{user.lastLoginTimeStr}}</td>
86 86 <td>{{user.enabled?'启用':'禁用'}}</td>
87 87 <td>
88   - <a class="edit_icon" data-code="{{user.id}}" uk-icon="icon: file-edit"></a>
  88 + <a class="edit_icon" data-code="{{user.id}}" uk-icon="icon: file-edit"></a>&nbsp;
  89 + <button class="uk-button uk-button-small" style="font-size: 12px;">线路分配</button>
89 90 </td>
90 91 </tr>
91 92 {{/each}}
... ...