Commit 2de24e68e76b10c5f1873a987edce6163f3048bc
1 parent
4c7586df
update...
Showing
15 changed files
with
140 additions
and
14 deletions
src/main/java/com/bsth/controller/schedule/InOutScheduleController.java
| ... | ... | @@ -56,4 +56,14 @@ public class InOutScheduleController { |
| 56 | 56 | public Map<String, Object> tzrc(@RequestParam String cpcsJson){ |
| 57 | 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 | 49 | sendUtils.abnormal_ydwd(ae); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | + /** | |
| 53 | + * 待发调整 | |
| 54 | + * @param id | |
| 55 | + * @param source | |
| 56 | + * @return | |
| 57 | + */ | |
| 52 | 58 | public List<AbnormalEntity> dftz(Long id, String source){ |
| 53 | 59 | List<AbnormalEntity> aes = new ArrayList<>(); |
| 54 | 60 | |
| ... | ... | @@ -68,4 +74,13 @@ public class MainAbnormalClient { |
| 68 | 74 | public List<AbnormalEntity> findByLine(String lineCode){ |
| 69 | 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 | 60 | */ |
| 61 | 61 | private String handlerDes; |
| 62 | 62 | |
| 63 | + private String reason; | |
| 64 | + | |
| 63 | 65 | public int getType() { |
| 64 | 66 | return type; |
| 65 | 67 | } |
| ... | ... | @@ -147,4 +149,12 @@ public class AbnormalEntity { |
| 147 | 149 | public void setHandlerDes(String handlerDes) { |
| 148 | 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 | 3 | import com.bsth.data.abnormal.entity.AbnormalEntity; |
| 4 | 4 | import com.bsth.data.schedule.dto.ScheduleInOut; |
| 5 | 5 | import com.bsth.data.schedule.real.ScheduleDataBuffer; |
| 6 | +import com.bsth.security.util.SecurityUtils; | |
| 6 | 7 | import org.springframework.stereotype.Component; |
| 7 | 8 | |
| 8 | 9 | import java.util.concurrent.ConcurrentHashMap; |
| ... | ... | @@ -33,12 +34,11 @@ public class AttendanceHandler { |
| 33 | 34 | * @param id |
| 34 | 35 | */ |
| 35 | 36 | public AbnormalEntity dftzJd(Long id, String source){ |
| 36 | - Long t = System.currentTimeMillis(); | |
| 37 | - | |
| 38 | 37 | AbnormalEntity ae = schIdMap.get(id); |
| 39 | 38 | if(null == ae) |
| 40 | 39 | return null; |
| 41 | 40 | |
| 41 | + Long t = System.currentTimeMillis(); | |
| 42 | 42 | ScheduleInOut sio = ScheduleDataBuffer.findById(id); |
| 43 | 43 | |
| 44 | 44 | if(sio.getAttJhTime() - t > 1000 * 60){ |
| ... | ... | @@ -58,4 +58,30 @@ public class AttendanceHandler { |
| 58 | 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 | 30 | * @param id |
| 31 | 31 | */ |
| 32 | 32 | public AbnormalEntity dftzJd(Long id, String source){ |
| 33 | - Long t = System.currentTimeMillis(); | |
| 34 | - | |
| 35 | 33 | AbnormalEntity ae = schIdMap.get(id); |
| 36 | 34 | if(null == ae) |
| 37 | 35 | return null; |
| 38 | 36 | |
| 37 | + Long t = System.currentTimeMillis(); | |
| 39 | 38 | ScheduleInOut sio = ScheduleDataBuffer.findById(id); |
| 40 | 39 | |
| 41 | 40 | if(sio.getDfsjT() - t > 1000 * 60){ | ... | ... |
src/main/java/com/bsth/service/schedule/ScheduleService.java
src/main/java/com/bsth/service/schedule/impl/ScheduleServiceImpl.java
| ... | ... | @@ -18,6 +18,8 @@ import com.bsth.service.schedule.ScheduleService; |
| 18 | 18 | import com.bsth.util.ConfigUtil; |
| 19 | 19 | import com.google.common.base.Splitter; |
| 20 | 20 | import org.apache.commons.lang3.StringEscapeUtils; |
| 21 | +import org.joda.time.format.DateTimeFormat; | |
| 22 | +import org.joda.time.format.DateTimeFormatter; | |
| 21 | 23 | import org.slf4j.Logger; |
| 22 | 24 | import org.slf4j.LoggerFactory; |
| 23 | 25 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -44,6 +46,8 @@ public class ScheduleServiceImpl implements ScheduleService { |
| 44 | 46 | |
| 45 | 47 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 46 | 48 | |
| 49 | + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | |
| 50 | + | |
| 47 | 51 | @Override |
| 48 | 52 | public List<ScheduleInOut> findByCurrentTime() { |
| 49 | 53 | return null; |
| ... | ... | @@ -202,4 +206,35 @@ public class ScheduleServiceImpl implements ScheduleService { |
| 202 | 206 | } |
| 203 | 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
src/main/resources/static/pages/abnormal/fragments/expand_card_modal.html
| ... | ... | @@ -51,7 +51,10 @@ |
| 51 | 51 | <td><a>{{sch.lpName}}</a></td> |
| 52 | 52 | <td>{{sch.jsy}}</td> |
| 53 | 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 | 58 | <td> |
| 56 | 59 | {{sch.dfsjStr}}/ |
| 57 | 60 | {{if sch.outTimeRfid!=null}} | ... | ... |
src/main/resources/static/pages/abnormal/fragments/type_0/abnormal_handler.html
| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | //加载片段1 |
| 25 | 25 | $.get(folder + 'h_cont_rybd.html', function (dom) { |
| 26 | 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 | 30 | //加载片段2 | ... | ... |
src/main/resources/static/pages/abnormal/fragments/type_0/h_cont_rybd.html
| ... | ... | @@ -26,10 +26,12 @@ |
| 26 | 26 | </table> |
| 27 | 27 | |
| 28 | 28 | <form class="uk-form-horizontal"> |
| 29 | + <input type="hidden" value="{{ae.schId}}" name="schId"> | |
| 29 | 30 | <div class="uk-margin"> |
| 30 | 31 | <label class="uk-form-label" for="form-horizontal-text">签到时间</label> |
| 31 | 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 | 35 | </div> |
| 34 | 36 | </div> |
| 35 | 37 | |
| ... | ... | @@ -61,7 +63,7 @@ |
| 61 | 63 | <script> |
| 62 | 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 | 69 | $(wrap).on('init', function (e, data) { |
| ... | ... | @@ -69,6 +71,7 @@ |
| 69 | 71 | if($(this).attr('data-init')==1) |
| 70 | 72 | return; |
| 71 | 73 | |
| 74 | + modalId = data.modalId; | |
| 72 | 75 | ae = data.ae; |
| 73 | 76 | |
| 74 | 77 | var htmlStr = template('o_s_abnormal_handler_rybd-temp', {ae: ae, current_tcc_name: current_tcc_name}); |
| ... | ... | @@ -76,6 +79,8 @@ |
| 76 | 79 | |
| 77 | 80 | //submit |
| 78 | 81 | var f = $('form', wrap).formValidation(gb_form_validation_opts); |
| 82 | + //日期默认值 | |
| 83 | + $('[name=rq]', f).val(moment().format('YYYY-MM-DD')); | |
| 79 | 84 | $('.submit-btn', wrap).on('click', function () { |
| 80 | 85 | f.submit(); |
| 81 | 86 | }); |
| ... | ... | @@ -85,6 +90,12 @@ |
| 85 | 90 | var data = $(this).serializeJSON(); |
| 86 | 91 | |
| 87 | 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 | 29 | <div class="uk-margin"> |
| 30 | 30 | <label class="uk-form-label" for="form-horizontal-text">出场时间</label> |
| 31 | 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 | 34 | </div> |
| 34 | 35 | </div> |
| 35 | 36 | |
| ... | ... | @@ -76,6 +77,7 @@ |
| 76 | 77 | |
| 77 | 78 | //submit |
| 78 | 79 | var f = $('form', wrap).formValidation(gb_form_validation_opts); |
| 80 | + $('[name=rq]', f).val(moment().format('YYYY-MM-DD')); | |
| 79 | 81 | $('.submit-btn', wrap).on('click', function () { |
| 80 | 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 | 48 | }; |
| 49 | 49 | |
| 50 | 50 | var handle = function (array) { |
| 51 | + if (!isArray(array)) | |
| 52 | + array = [array]; | |
| 53 | + | |
| 51 | 54 | if(!array || array.length==0) |
| 52 | 55 | return; |
| 53 | 56 | |
| 54 | - var elem; | |
| 57 | + var elem, key; | |
| 55 | 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 | 61 | elem.addClass('uk-animation-slide-left-medium uk-animation-reverse') |
| 58 | 62 | .one('animationend', function () { |
| 59 | 63 | $(this).remove(); | ... | ... |
src/main/resources/static/pages/abnormal/js/o_s_card.js
| ... | ... | @@ -19,7 +19,6 @@ var gb_os_card = (function () { |
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - | |
| 23 | 22 | for(var lineCode in _data){ |
| 24 | 23 | renderByLine(lineCode); |
| 25 | 24 | } |
| ... | ... | @@ -39,6 +38,11 @@ var gb_os_card = (function () { |
| 39 | 38 | for (var i = 0, sch; sch = list[i++];) { |
| 40 | 39 | sch.attJhTimeStr = moment(sch.attJhTime).format('HH:mm'); |
| 41 | 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 | 46 | if(sch.fcsjActualTime){//集调出场时间 |
| 43 | 47 | sch.fcsjActual = moment(sch.fcsjActualTime).format('HH:mm'); |
| 44 | 48 | } | ... | ... |
src/main/resources/static/pages/abnormal/main.html
| ... | ... | @@ -53,7 +53,7 @@ |
| 53 | 53 | |
| 54 | 54 | <script id="abnormal_card_list-temp" type="text/html"> |
| 55 | 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 | 57 | {{if obj.type==0}} |
| 58 | 58 | <div class="_title"> |
| 59 | 59 | <span uk-icon="user"></span> |
| ... | ... | @@ -131,7 +131,7 @@ |
| 131 | 131 | <dd>{{sch.nbbm}}</dd> |
| 132 | 132 | <dd class="parallel_dl"> |
| 133 | 133 | <span>{{sch.attJhTimeStr}}</span> |
| 134 | - <span class="green"></span> | |
| 134 | + <span style="color: {{sch.attLate>0?'red':'blue'}};">{{sch.attSjTimeStr}}</span> | |
| 135 | 135 | </dd> |
| 136 | 136 | <dd class="parallel_dl"> |
| 137 | 137 | <span>{{sch.dfsjStr}}</span> | ... | ... |