Commit 2de24e68e76b10c5f1873a987edce6163f3048bc

Authored by 潘钊
1 parent 4c7586df

update...

src/main/java/com/bsth/controller/schedule/InOutScheduleController.java
@@ -56,4 +56,14 @@ public class InOutScheduleController { @@ -56,4 +56,14 @@ public class InOutScheduleController {
56 public Map<String, Object> tzrc(@RequestParam String cpcsJson){ 56 public Map<String, Object> tzrc(@RequestParam String cpcsJson){
57 return inOutScheduleService.tzrc(cpcsJson); 57 return inOutScheduleService.tzrc(cpcsJson);
58 } 58 }
  59 +
  60 + /**
  61 + * 人已报到
  62 + * @param map
  63 + * @return
  64 + */
  65 + @RequestMapping(value = "rybd", method = RequestMethod.POST)
  66 + public Map<String, Object> rybd(@RequestParam Map<String, Object> map){
  67 + return inOutScheduleService.rybd(map);
  68 + }
59 } 69 }
src/main/java/com/bsth/data/abnormal/MainAbnormalClient.java
@@ -49,6 +49,12 @@ public class MainAbnormalClient { @@ -49,6 +49,12 @@ public class MainAbnormalClient {
49 sendUtils.abnormal_ydwd(ae); 49 sendUtils.abnormal_ydwd(ae);
50 } 50 }
51 51
  52 + /**
  53 + * 待发调整
  54 + * @param id
  55 + * @param source
  56 + * @return
  57 + */
52 public List<AbnormalEntity> dftz(Long id, String source){ 58 public List<AbnormalEntity> dftz(Long id, String source){
53 List<AbnormalEntity> aes = new ArrayList<>(); 59 List<AbnormalEntity> aes = new ArrayList<>();
54 60
@@ -68,4 +74,13 @@ public class MainAbnormalClient { @@ -68,4 +74,13 @@ public class MainAbnormalClient {
68 public List<AbnormalEntity> findByLine(String lineCode){ 74 public List<AbnormalEntity> findByLine(String lineCode){
69 return lineMultimap.get(lineCode); 75 return lineMultimap.get(lineCode);
70 } 76 }
  77 +
  78 + /**
  79 + * 人已报到
  80 + * @param id
  81 + * @return
  82 + */
  83 + public AbnormalEntity rybd(Long id,String timeStr, String reason, String remark) {
  84 + return attendanceHandler.rybd(id, timeStr, reason, remark);
  85 + }
71 } 86 }
src/main/java/com/bsth/data/abnormal/entity/AbnormalEntity.java
@@ -60,6 +60,8 @@ public class AbnormalEntity { @@ -60,6 +60,8 @@ public class AbnormalEntity {
60 */ 60 */
61 private String handlerDes; 61 private String handlerDes;
62 62
  63 + private String reason;
  64 +
63 public int getType() { 65 public int getType() {
64 return type; 66 return type;
65 } 67 }
@@ -147,4 +149,12 @@ public class AbnormalEntity { @@ -147,4 +149,12 @@ public class AbnormalEntity {
147 public void setHandlerDes(String handlerDes) { 149 public void setHandlerDes(String handlerDes) {
148 this.handlerDes = handlerDes; 150 this.handlerDes = handlerDes;
149 } 151 }
  152 +
  153 + public String getReason() {
  154 + return reason;
  155 + }
  156 +
  157 + public void setReason(String reason) {
  158 + this.reason = reason;
  159 + }
150 } 160 }
src/main/java/com/bsth/data/abnormal/handler/AttendanceHandler.java
@@ -3,6 +3,7 @@ package com.bsth.data.abnormal.handler; @@ -3,6 +3,7 @@ package com.bsth.data.abnormal.handler;
3 import com.bsth.data.abnormal.entity.AbnormalEntity; 3 import com.bsth.data.abnormal.entity.AbnormalEntity;
4 import com.bsth.data.schedule.dto.ScheduleInOut; 4 import com.bsth.data.schedule.dto.ScheduleInOut;
5 import com.bsth.data.schedule.real.ScheduleDataBuffer; 5 import com.bsth.data.schedule.real.ScheduleDataBuffer;
  6 +import com.bsth.security.util.SecurityUtils;
6 import org.springframework.stereotype.Component; 7 import org.springframework.stereotype.Component;
7 8
8 import java.util.concurrent.ConcurrentHashMap; 9 import java.util.concurrent.ConcurrentHashMap;
@@ -33,12 +34,11 @@ public class AttendanceHandler { @@ -33,12 +34,11 @@ public class AttendanceHandler {
33 * @param id 34 * @param id
34 */ 35 */
35 public AbnormalEntity dftzJd(Long id, String source){ 36 public AbnormalEntity dftzJd(Long id, String source){
36 - Long t = System.currentTimeMillis();  
37 -  
38 AbnormalEntity ae = schIdMap.get(id); 37 AbnormalEntity ae = schIdMap.get(id);
39 if(null == ae) 38 if(null == ae)
40 return null; 39 return null;
41 40
  41 + Long t = System.currentTimeMillis();
42 ScheduleInOut sio = ScheduleDataBuffer.findById(id); 42 ScheduleInOut sio = ScheduleDataBuffer.findById(id);
43 43
44 if(sio.getAttJhTime() - t > 1000 * 60){ 44 if(sio.getAttJhTime() - t > 1000 * 60){
@@ -58,4 +58,30 @@ public class AttendanceHandler { @@ -58,4 +58,30 @@ public class AttendanceHandler {
58 public void handler(Long id){ 58 public void handler(Long id){
59 59
60 } 60 }
  61 +
  62 + /**
  63 + * 人已报到
  64 + * @param id
  65 + * @return
  66 + */
  67 + public AbnormalEntity rybd(Long id, String timeStr, String reason, String remark) {
  68 + AbnormalEntity ae = schIdMap.get(id);
  69 + if(null == ae)
  70 + return null;
  71 +
  72 + Long t = System.currentTimeMillis();
  73 +
  74 +
  75 + ae.setHandlerTime(t);
  76 + ae.setHandlerUser(SecurityUtils.getCurrentUser().getUserName());
  77 + ae.setHandlerDes(timeStr + "已报到,备注:" + remark);
  78 + ae.setReason(reason);
  79 +
  80 + ScheduleInOut sio = ScheduleDataBuffer.findById(id);
  81 + if(null != sio && sio.getAbnormalStatus()==-1)
  82 + sio.setAbnormalStatus(0);
  83 +
  84 + schIdMap.remove(ae.getSchId());
  85 + return ae;
  86 + }
61 } 87 }
src/main/java/com/bsth/data/abnormal/handler/InOutHandler.java
@@ -30,12 +30,11 @@ public class InOutHandler { @@ -30,12 +30,11 @@ public class InOutHandler {
30 * @param id 30 * @param id
31 */ 31 */
32 public AbnormalEntity dftzJd(Long id, String source){ 32 public AbnormalEntity dftzJd(Long id, String source){
33 - Long t = System.currentTimeMillis();  
34 -  
35 AbnormalEntity ae = schIdMap.get(id); 33 AbnormalEntity ae = schIdMap.get(id);
36 if(null == ae) 34 if(null == ae)
37 return null; 35 return null;
38 36
  37 + Long t = System.currentTimeMillis();
39 ScheduleInOut sio = ScheduleDataBuffer.findById(id); 38 ScheduleInOut sio = ScheduleDataBuffer.findById(id);
40 39
41 if(sio.getDfsjT() - t > 1000 * 60){ 40 if(sio.getDfsjT() - t > 1000 * 60){
src/main/java/com/bsth/service/schedule/ScheduleService.java
@@ -34,6 +34,8 @@ public interface ScheduleService { @@ -34,6 +34,8 @@ public interface ScheduleService {
34 34
35 Map<String,Object> tzrc(String cpcsJson); 35 Map<String,Object> tzrc(String cpcsJson);
36 36
  37 + Map<String,Object> rybd(Map<String, Object> map);
  38 +
37 //void inOut(CarInOutEntity obj); 39 //void inOut(CarInOutEntity obj);
38 40
39 //void busInOut(CarInOutEntity obj); 41 //void busInOut(CarInOutEntity obj);
src/main/java/com/bsth/service/schedule/impl/ScheduleServiceImpl.java
@@ -18,6 +18,8 @@ import com.bsth.service.schedule.ScheduleService; @@ -18,6 +18,8 @@ import com.bsth.service.schedule.ScheduleService;
18 import com.bsth.util.ConfigUtil; 18 import com.bsth.util.ConfigUtil;
19 import com.google.common.base.Splitter; 19 import com.google.common.base.Splitter;
20 import org.apache.commons.lang3.StringEscapeUtils; 20 import org.apache.commons.lang3.StringEscapeUtils;
  21 +import org.joda.time.format.DateTimeFormat;
  22 +import org.joda.time.format.DateTimeFormatter;
21 import org.slf4j.Logger; 23 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory; 24 import org.slf4j.LoggerFactory;
23 import org.springframework.beans.factory.annotation.Autowired; 25 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,6 +46,8 @@ public class ScheduleServiceImpl implements ScheduleService { @@ -44,6 +46,8 @@ public class ScheduleServiceImpl implements ScheduleService {
44 46
45 Logger logger = LoggerFactory.getLogger(this.getClass()); 47 Logger logger = LoggerFactory.getLogger(this.getClass());
46 48
  49 + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  50 +
47 @Override 51 @Override
48 public List<ScheduleInOut> findByCurrentTime() { 52 public List<ScheduleInOut> findByCurrentTime() {
49 return null; 53 return null;
@@ -202,4 +206,35 @@ public class ScheduleServiceImpl implements ScheduleService { @@ -202,4 +206,35 @@ public class ScheduleServiceImpl implements ScheduleService {
202 } 206 }
203 return rs; 207 return rs;
204 } 208 }
  209 +
  210 + @Override
  211 + public Map<String, Object> rybd(Map<String, Object> map) {
  212 + Map<String, Object> rs = new HashMap<>();
  213 +
  214 + try{
  215 + String rq = map.get("rq").toString();
  216 + String timeStr = map.get("attSjTimeStr").toString();
  217 + String reason = map.get("reason").toString();
  218 + String remarks = map.get("remarks").toString();
  219 + Long id = Long.parseLong(map.get("schId").toString());
  220 +
  221 +
  222 + long time = fmtyyyyMMddHHmm.parseMillis(rq+timeStr);
  223 +
  224 + //班次设置签到时间
  225 + ScheduleInOut sio = ScheduleDataBuffer.findById(id);
  226 + sio.setAttSjTime(time);
  227 +
  228 + //处理掉异常
  229 + AbnormalEntity ae = mainAbnormalClient.rybd(id,timeStr,reason,remarks);
  230 +
  231 + rs.put("status", ResponseCode.SUCCESS);
  232 + rs.put("t", sio);
  233 + rs.put("ae", ae);
  234 + }catch (Exception e){
  235 + logger.error("", e);
  236 + rs.put("status", ResponseCode.ERROR);
  237 + }
  238 + return rs;
  239 + }
205 } 240 }
src/main/resources/static/assets/css/main.css
@@ -4,6 +4,11 @@ html, body, .ct-container { @@ -4,6 +4,11 @@ html, body, .ct-container {
4 font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif; 4 font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;
5 } 5 }
6 6
  7 +/*----------用来移除date向下箭头----------*/
  8 +input[type="date"]::-webkit-calendar-picker-indicator {
  9 + display: none;
  10 +}
  11 +
7 .ct-container { 12 .ct-container {
8 13
9 } 14 }
src/main/resources/static/pages/abnormal/fragments/expand_card_modal.html
@@ -51,7 +51,10 @@ @@ -51,7 +51,10 @@
51 <td><a>{{sch.lpName}}</a></td> 51 <td><a>{{sch.lpName}}</a></td>
52 <td>{{sch.jsy}}</td> 52 <td>{{sch.jsy}}</td>
53 <td>{{sch.nbbm}}</td> 53 <td>{{sch.nbbm}}</td>
54 - <td>{{sch.attJhTimeStr}}/</td> 54 + <td>
  55 + {{sch.attJhTimeStr}}/
  56 + <span style="color: {{sch.attLate>0?'red':'blue'}};">{{sch.attSjTimeStr}}</span>
  57 + </td>
55 <td> 58 <td>
56 {{sch.dfsjStr}}/ 59 {{sch.dfsjStr}}/
57 {{if sch.outTimeRfid!=null}} 60 {{if sch.outTimeRfid!=null}}
src/main/resources/static/pages/abnormal/fragments/type_0/abnormal_handler.html
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 //加载片段1 24 //加载片段1
25 $.get(folder + 'h_cont_rybd.html', function (dom) { 25 $.get(folder + 'h_cont_rybd.html', function (dom) {
26 $('._content_one',wrap).html(dom); 26 $('._content_one',wrap).html(dom);
27 - $('.handler_cont_rybd_wrap', wrap).trigger('init', {ae: ae}); 27 + $('.handler_cont_rybd_wrap', wrap).trigger('init', {ae: ae, modalId: modalId});
28 }); 28 });
29 29
30 //加载片段2 30 //加载片段2
src/main/resources/static/pages/abnormal/fragments/type_0/h_cont_rybd.html
@@ -26,10 +26,12 @@ @@ -26,10 +26,12 @@
26 </table> 26 </table>
27 27
28 <form class="uk-form-horizontal"> 28 <form class="uk-form-horizontal">
  29 + <input type="hidden" value="{{ae.schId}}" name="schId">
29 <div class="uk-margin"> 30 <div class="uk-margin">
30 <label class="uk-form-label" for="form-horizontal-text">签到时间</label> 31 <label class="uk-form-label" for="form-horizontal-text">签到时间</label>
31 <div class="uk-form-controls"> 32 <div class="uk-form-controls">
32 - <input class="uk-input" name="attSjTimeStr" id="form-horizontal-text" type="time" required> 33 + <input class="uk-input" name="rq" type="date" style="width: 160px;" required>
  34 + <input class="uk-input" name="attSjTimeStr" id="form-horizontal-text" type="time" style="width: calc(100% - 170px)" required>
33 </div> 35 </div>
34 </div> 36 </div>
35 37
@@ -61,7 +63,7 @@ @@ -61,7 +63,7 @@
61 <script> 63 <script>
62 (function () { 64 (function () {
63 65
64 - var wrap = '.handler_cont_rybd_wrap', ae, $cont; 66 + var wrap = '.handler_cont_rybd_wrap', ae, $cont, modalId;
65 67
66 68
67 $(wrap).on('init', function (e, data) { 69 $(wrap).on('init', function (e, data) {
@@ -69,6 +71,7 @@ @@ -69,6 +71,7 @@
69 if($(this).attr('data-init')==1) 71 if($(this).attr('data-init')==1)
70 return; 72 return;
71 73
  74 + modalId = data.modalId;
72 ae = data.ae; 75 ae = data.ae;
73 76
74 var htmlStr = template('o_s_abnormal_handler_rybd-temp', {ae: ae, current_tcc_name: current_tcc_name}); 77 var htmlStr = template('o_s_abnormal_handler_rybd-temp', {ae: ae, current_tcc_name: current_tcc_name});
@@ -76,6 +79,8 @@ @@ -76,6 +79,8 @@
76 79
77 //submit 80 //submit
78 var f = $('form', wrap).formValidation(gb_form_validation_opts); 81 var f = $('form', wrap).formValidation(gb_form_validation_opts);
  82 + //日期默认值
  83 + $('[name=rq]', f).val(moment().format('YYYY-MM-DD'));
79 $('.submit-btn', wrap).on('click', function () { 84 $('.submit-btn', wrap).on('click', function () {
80 f.submit(); 85 f.submit();
81 }); 86 });
@@ -85,6 +90,12 @@ @@ -85,6 +90,12 @@
85 var data = $(this).serializeJSON(); 90 var data = $(this).serializeJSON();
86 91
87 console.log('data', data); 92 console.log('data', data);
  93 + gb_common.$post('/in_out/rybd', data, function (rs) {
  94 + UIkit.notification('操作成功!', 'success');
  95 + gb_os_card.update(rs.t);
  96 + gb_o_s_abnormal.handle(rs.ae);
  97 + UIkit.modal(modalId).hide();
  98 + });
88 }); 99 });
89 100
90 //选择原因 101 //选择原因
src/main/resources/static/pages/abnormal/fragments/type_1/h_cont_cycc.html
@@ -29,7 +29,8 @@ @@ -29,7 +29,8 @@
29 <div class="uk-margin"> 29 <div class="uk-margin">
30 <label class="uk-form-label" for="form-horizontal-text">出场时间</label> 30 <label class="uk-form-label" for="form-horizontal-text">出场时间</label>
31 <div class="uk-form-controls"> 31 <div class="uk-form-controls">
32 - <input class="uk-input" name="attSjTimeStr" id="form-horizontal-text" type="time" required> 32 + <input class="uk-input" name="rq" type="date" style="width: 160px;" required>
  33 + <input class="uk-input" name="attSjTimeStr" id="form-horizontal-text" type="time" style="width: calc(100% - 170px)" required>
33 </div> 34 </div>
34 </div> 35 </div>
35 36
@@ -76,6 +77,7 @@ @@ -76,6 +77,7 @@
76 77
77 //submit 78 //submit
78 var f = $('form', wrap).formValidation(gb_form_validation_opts); 79 var f = $('form', wrap).formValidation(gb_form_validation_opts);
  80 + $('[name=rq]', f).val(moment().format('YYYY-MM-DD'));
79 $('.submit-btn', wrap).on('click', function () { 81 $('.submit-btn', wrap).on('click', function () {
80 f.submit(); 82 f.submit();
81 }); 83 });
src/main/resources/static/pages/abnormal/js/o_s_abnormal.js
@@ -48,12 +48,16 @@ var gb_o_s_abnormal = (function () { @@ -48,12 +48,16 @@ var gb_o_s_abnormal = (function () {
48 }; 48 };
49 49
50 var handle = function (array) { 50 var handle = function (array) {
  51 + if (!isArray(array))
  52 + array = [array];
  53 +
51 if(!array || array.length==0) 54 if(!array || array.length==0)
52 return; 55 return;
53 56
54 - var elem; 57 + var elem, key;
55 for(var i=0,ae;ae=array[i++];){ 58 for(var i=0,ae;ae=array[i++];){
56 - elem = $('.uk-card-body[data-id='+ae.schId+']', wrap); 59 + key = ae.schId + '_' + ae.type;
  60 + elem = $('.uk-card-body[data-id='+key+']', wrap);
57 elem.addClass('uk-animation-slide-left-medium uk-animation-reverse') 61 elem.addClass('uk-animation-slide-left-medium uk-animation-reverse')
58 .one('animationend', function () { 62 .one('animationend', function () {
59 $(this).remove(); 63 $(this).remove();
src/main/resources/static/pages/abnormal/js/o_s_card.js
@@ -19,7 +19,6 @@ var gb_os_card = (function () { @@ -19,7 +19,6 @@ var gb_os_card = (function () {
19 } 19 }
20 } 20 }
21 21
22 -  
23 for(var lineCode in _data){ 22 for(var lineCode in _data){
24 renderByLine(lineCode); 23 renderByLine(lineCode);
25 } 24 }
@@ -39,6 +38,11 @@ var gb_os_card = (function () { @@ -39,6 +38,11 @@ var gb_os_card = (function () {
39 for (var i = 0, sch; sch = list[i++];) { 38 for (var i = 0, sch; sch = list[i++];) {
40 sch.attJhTimeStr = moment(sch.attJhTime).format('HH:mm'); 39 sch.attJhTimeStr = moment(sch.attJhTime).format('HH:mm');
41 sch.dfsjStr = moment(sch.dfsjT).format('HH:mm'); 40 sch.dfsjStr = moment(sch.dfsjT).format('HH:mm');
  41 +
  42 + if(sch.attSjTime){
  43 + sch.attSjTimeStr = moment(sch.attSjTime).format('HH:mm');
  44 + sch.attLate = sch.attSjTime - sch.attJhTime;
  45 + }
42 if(sch.fcsjActualTime){//集调出场时间 46 if(sch.fcsjActualTime){//集调出场时间
43 sch.fcsjActual = moment(sch.fcsjActualTime).format('HH:mm'); 47 sch.fcsjActual = moment(sch.fcsjActualTime).format('HH:mm');
44 } 48 }
src/main/resources/static/pages/abnormal/main.html
@@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
53 53
54 <script id="abnormal_card_list-temp" type="text/html"> 54 <script id="abnormal_card_list-temp" type="text/html">
55 {{each list as obj i}} 55 {{each list as obj i}}
56 - <div class="uk-card uk-card-default uk-card-body" data-id="{{obj.schId}}"> 56 + <div class="uk-card uk-card-default uk-card-body" data-id="{{obj.schId}}_{{obj.type}}">
57 {{if obj.type==0}} 57 {{if obj.type==0}}
58 <div class="_title"> 58 <div class="_title">
59 <span uk-icon="user"></span> 59 <span uk-icon="user"></span>
@@ -131,7 +131,7 @@ @@ -131,7 +131,7 @@
131 <dd>{{sch.nbbm}}</dd> 131 <dd>{{sch.nbbm}}</dd>
132 <dd class="parallel_dl"> 132 <dd class="parallel_dl">
133 <span>{{sch.attJhTimeStr}}</span> 133 <span>{{sch.attJhTimeStr}}</span>
134 - <span class="green"></span> 134 + <span style="color: {{sch.attLate>0?'red':'blue'}};">{{sch.attSjTimeStr}}</span>
135 </dd> 135 </dd>
136 <dd class="parallel_dl"> 136 <dd class="parallel_dl">
137 <span>{{sch.dfsjStr}}</span> 137 <span>{{sch.dfsjStr}}</span>