Commit a5ef19428982c8fcddf950305a68e68904301e3d
1 parent
848bdb4c
update...
Showing
11 changed files
with
239 additions
and
20 deletions
src/main/java/com/bsth/controller/realcontrol/FrequentPhrasesController.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol; | ||
| 2 | + | ||
| 3 | +import com.bsth.controller.BaseController; | ||
| 4 | +import com.bsth.entity.realcontrol.FrequentPhrases; | ||
| 5 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 6 | +import org.springframework.web.bind.annotation.RestController; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * Created by panzhao on 2017/9/17. | ||
| 10 | + */ | ||
| 11 | +@RestController | ||
| 12 | +@RequestMapping("frequent_phrases") | ||
| 13 | +public class FrequentPhrasesController extends BaseController<FrequentPhrases, Integer>{ | ||
| 14 | + | ||
| 15 | +} |
src/main/java/com/bsth/entity/realcontrol/FrequentPhrases.java
0 → 100644
| 1 | +package com.bsth.entity.realcontrol; | ||
| 2 | + | ||
| 3 | +import javax.persistence.Entity; | ||
| 4 | +import javax.persistence.GeneratedValue; | ||
| 5 | +import javax.persistence.Id; | ||
| 6 | +import javax.persistence.Table; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 常用短语 | ||
| 10 | + * Created by panzhao on 2017/9/17. | ||
| 11 | + */ | ||
| 12 | +@Entity | ||
| 13 | +@Table(name = "bsth_c_s_frequent_phrases") | ||
| 14 | +public class FrequentPhrases { | ||
| 15 | + | ||
| 16 | + @Id | ||
| 17 | + @GeneratedValue | ||
| 18 | + private Integer id; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 用户名 | ||
| 22 | + */ | ||
| 23 | + private String userName; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 短语 | ||
| 27 | + */ | ||
| 28 | + private String text; | ||
| 29 | + | ||
| 30 | + public Integer getId() { | ||
| 31 | + return id; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public void setId(Integer id) { | ||
| 35 | + this.id = id; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public String getUserName() { | ||
| 39 | + return userName; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public void setUserName(String userName) { | ||
| 43 | + this.userName = userName; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public String getText() { | ||
| 47 | + return text; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + public void setText(String text) { | ||
| 51 | + this.text = text; | ||
| 52 | + } | ||
| 53 | +} |
src/main/java/com/bsth/repository/realcontrol/FrequentPhrasesRepository.java
0 → 100644
| 1 | +package com.bsth.repository.realcontrol; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.realcontrol.FrequentPhrases; | ||
| 4 | +import com.bsth.repository.BaseRepository; | ||
| 5 | +import org.springframework.stereotype.Repository; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * Created by panzhao on 2017/9/17. | ||
| 9 | + */ | ||
| 10 | +@Repository | ||
| 11 | +public interface FrequentPhrasesRepository extends BaseRepository<FrequentPhrases, Integer> { | ||
| 12 | +} |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| @@ -994,7 +994,7 @@ public class GpsServiceImpl implements GpsService { | @@ -994,7 +994,7 @@ public class GpsServiceImpl implements GpsService { | ||
| 994 | fv = f.get(obj).toString(); | 994 | fv = f.get(obj).toString(); |
| 995 | v = map.get(f.getName()).toString(); | 995 | v = map.get(f.getName()).toString(); |
| 996 | 996 | ||
| 997 | - if(!fv.startsWith(v) && !fv.endsWith(v)) | 997 | + if(!fv.startsWith(v)/* && !fv.endsWith(v)*/) |
| 998 | return false; | 998 | return false; |
| 999 | } | 999 | } |
| 1000 | } catch (Exception e) { | 1000 | } catch (Exception e) { |
src/main/java/com/bsth/service/realcontrol/FrequentPhrasesService.java
0 → 100644
src/main/java/com/bsth/service/realcontrol/impl/FrequentPhrasesServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.realcontrol.impl; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.realcontrol.FrequentPhrases; | ||
| 4 | +import com.bsth.security.util.SecurityUtils; | ||
| 5 | +import com.bsth.service.impl.BaseServiceImpl; | ||
| 6 | +import com.bsth.service.realcontrol.FrequentPhrasesService; | ||
| 7 | +import org.springframework.stereotype.Service; | ||
| 8 | + | ||
| 9 | +import java.util.Map; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * Created by panzhao on 2017/9/17. | ||
| 13 | + */ | ||
| 14 | +@Service | ||
| 15 | +public class FrequentPhrasesServiceImpl extends BaseServiceImpl<FrequentPhrases, Integer> implements FrequentPhrasesService { | ||
| 16 | + | ||
| 17 | + @Override | ||
| 18 | + public Map<String, Object> save(FrequentPhrases fp) { | ||
| 19 | + fp.setUserName(SecurityUtils.getCurrentUser().getUserName()); | ||
| 20 | + return super.save(fp); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + @Override | ||
| 24 | + public Iterable<FrequentPhrases> list(Map<String, Object> map) { | ||
| 25 | + map.put("userName_eq", SecurityUtils.getCurrentUser().getUserName()); | ||
| 26 | + return super.list(map); | ||
| 27 | + } | ||
| 28 | +} |
src/main/resources/static/real_control_v2/alone_page/home/alone_data_basic.js
| @@ -43,17 +43,19 @@ var gb_data_basic = (function () { | @@ -43,17 +43,19 @@ var gb_data_basic = (function () { | ||
| 43 | }); | 43 | }); |
| 44 | 44 | ||
| 45 | //线路标准信息 | 45 | //线路标准信息 |
| 46 | - gb_common.$get('/lineInformation/line/multi', {lineCodes: line_idx}, function (rs) { | 46 | + /*gb_common.$get('/lineInformation/line/multi', {lineCodes: line_idx}, function (rs) { |
| 47 | var informations = {}; | 47 | var informations = {}; |
| 48 | $.each(rs, function () { | 48 | $.each(rs, function () { |
| 49 | informations[this.line.lineCode] = this; | 49 | informations[this.line.lineCode] = this; |
| 50 | delete this['line']; | 50 | delete this['line']; |
| 51 | }); | 51 | }); |
| 52 | ep.emit('lineInformations', informations); | 52 | ep.emit('lineInformations', informations); |
| 53 | - }); | 53 | + });*/ |
| 54 | + ep.emit('lineInformations', {}); | ||
| 54 | 55 | ||
| 55 | //人员信息 | 56 | //人员信息 |
| 56 | - loadAllPersonnel(function (data) { | 57 | + ep.emit('all_personnel', {}); |
| 58 | + /*loadAllPersonnel(function (data) { | ||
| 57 | ep.emit('all_personnel', data); | 59 | ep.emit('all_personnel', data); |
| 58 | }); | 60 | }); |
| 59 | function loadAllPersonnel(cb) { | 61 | function loadAllPersonnel(cb) { |
| @@ -70,24 +72,24 @@ var gb_data_basic = (function () { | @@ -70,24 +72,24 @@ var gb_data_basic = (function () { | ||
| 70 | } | 72 | } |
| 71 | cb && cb(data); | 73 | cb && cb(data); |
| 72 | }); | 74 | }); |
| 73 | - } | 75 | + }*/ |
| 74 | 76 | ||
| 75 | var carparks = {}; | 77 | var carparks = {}; |
| 76 | //停车场数据 | 78 | //停车场数据 |
| 77 | - gb_common.$get('/realMap/carParkSpatialData', {}, function (rs) { | 79 | +/* gb_common.$get('/realMap/carParkSpatialData', {}, function (rs) { |
| 78 | rs.list.sort(function (a, b) { | 80 | rs.list.sort(function (a, b) { |
| 79 | return a.parkName.localeCompare(b.parkName); | 81 | return a.parkName.localeCompare(b.parkName); |
| 80 | }); | 82 | }); |
| 81 | $.each(rs.list, function () { | 83 | $.each(rs.list, function () { |
| 82 | carparks[this.parkCode] = this; | 84 | carparks[this.parkCode] = this; |
| 83 | }); | 85 | }); |
| 84 | - }); | 86 | + });*/ |
| 85 | 87 | ||
| 86 | //车辆数据 | 88 | //车辆数据 |
| 87 | var carsArray; | 89 | var carsArray; |
| 88 | - $.get('/basic/cars?t=' + Math.random(), function (rs) { | 90 | + /*$.get('/basic/cars?t=' + Math.random(), function (rs) { |
| 89 | carsArray = rs; | 91 | carsArray = rs; |
| 90 | - }); | 92 | + });*/ |
| 91 | 93 | ||
| 92 | var getCarparkByCode = function (code) { | 94 | var getCarparkByCode = function (code) { |
| 93 | return carparks[code]; | 95 | return carparks[code]; |
| @@ -121,12 +123,12 @@ var gb_data_basic = (function () { | @@ -121,12 +123,12 @@ var gb_data_basic = (function () { | ||
| 121 | 123 | ||
| 122 | //站点和停车场历时、公里对照数据 | 124 | //站点和停车场历时、公里对照数据 |
| 123 | var stat_park_data; | 125 | var stat_park_data; |
| 124 | - var load_stat_park_data = function () { | 126 | + /*var load_stat_park_data = function () { |
| 125 | $.get('/basic/station2ParkData?t='+Math.random(), {idx: line_idx}, function (rs) { | 127 | $.get('/basic/station2ParkData?t='+Math.random(), {idx: line_idx}, function (rs) { |
| 126 | stat_park_data = rs; | 128 | stat_park_data = rs; |
| 127 | }); | 129 | }); |
| 128 | } | 130 | } |
| 129 | - load_stat_park_data(); | 131 | + load_stat_park_data();*/ |
| 130 | 132 | ||
| 131 | function findLineByCodes(codeArr) { | 133 | function findLineByCodes(codeArr) { |
| 132 | var rs = []; | 134 | var rs = []; |
src/main/resources/static/real_control_v2/css/home.css
| @@ -313,4 +313,16 @@ span.signal-state-speed-limit{ | @@ -313,4 +313,16 @@ span.signal-state-speed-limit{ | ||
| 313 | 313 | ||
| 314 | .home_alone_page{ | 314 | .home_alone_page{ |
| 315 | cursor: pointer; | 315 | cursor: pointer; |
| 316 | +} | ||
| 317 | + | ||
| 318 | +#send-phrase-modal .tools, | ||
| 319 | +#send-phrase-multi-modal .tools{ | ||
| 320 | + display: inline-block; | ||
| 321 | + margin-left: 5px; | ||
| 322 | +} | ||
| 323 | + | ||
| 324 | +#send-phrase-modal .tools>span, | ||
| 325 | +#send-phrase-multi-modal .tools>span{ | ||
| 326 | + cursor: pointer; | ||
| 327 | + margin-left: 12px; | ||
| 316 | } | 328 | } |
| 317 | \ No newline at end of file | 329 | \ No newline at end of file |
src/main/resources/static/real_control_v2/fragments/home/context_menu.html
| @@ -11,11 +11,15 @@ | @@ -11,11 +11,15 @@ | ||
| 11 | <input type="hidden" value="{{nbbm}}" name="nbbm" /> | 11 | <input type="hidden" value="{{nbbm}}" name="nbbm" /> |
| 12 | <div class="uk-form-row"> | 12 | <div class="uk-form-row"> |
| 13 | <select style="width: 170px;" class="common_phrase_sel"> | 13 | <select style="width: 170px;" class="common_phrase_sel"> |
| 14 | - <option value="">------ 常用短语 -------</option> | ||
| 15 | - <option value="天气异常,请小心驾驶">天气异常,请小心驾驶</option> | ||
| 16 | - <option value="请适当减速慢行,保持最佳行车间距">请适当减速慢行,保持最佳行车间距</option> | ||
| 17 | - <option value="请准点执行班次任务">请准点执行班次任务</option> | ||
| 18 | </select> | 14 | </select> |
| 15 | + <div class="tools" > | ||
| 16 | + <span data-uk-tooltip title="添加到常用短语" class="add_frequent_phrases"> | ||
| 17 | + <i class="uk-icon-plus"></i> | ||
| 18 | + </span> | ||
| 19 | + <span data-uk-tooltip title="删除这条常用短语" class="minus_frequent_phrases"> | ||
| 20 | + <i class="uk-icon-minus"></i> | ||
| 21 | + </span> | ||
| 22 | + </div> | ||
| 19 | </div> | 23 | </div> |
| 20 | <div class="uk-form-row"> | 24 | <div class="uk-form-row"> |
| 21 | <textarea cols="30" rows="5" name="text" data-fv-notempty data-fv-stringlength="true" data-fv-stringlength-max="50" placeholder="输入短语,不要超过50 个字符" style="margin: 0px; width: 100%; height: 110px;"></textarea> | 25 | <textarea cols="30" rows="5" name="text" data-fv-notempty data-fv-stringlength="true" data-fv-stringlength-max="50" placeholder="输入短语,不要超过50 个字符" style="margin: 0px; width: 100%; height: 110px;"></textarea> |
| @@ -43,9 +47,16 @@ | @@ -43,9 +47,16 @@ | ||
| 43 | <div class="uk-width-4-6" style="border-left: 1px solid #dddddd;"> | 47 | <div class="uk-width-4-6" style="border-left: 1px solid #dddddd;"> |
| 44 | <form class="uk-form fixed-tool"> | 48 | <form class="uk-form fixed-tool"> |
| 45 | <div class="uk-form-row"> | 49 | <div class="uk-form-row"> |
| 46 | - <select> | ||
| 47 | - <option value="">------ 常用短语 -------</option> | ||
| 48 | - </select> | 50 | + <select style="width: 170px;" class="common_phrase_sel"> |
| 51 | + </select> | ||
| 52 | + <div class="tools" > | ||
| 53 | + <span data-uk-tooltip title="添加到常用短语" class="add_frequent_phrases"> | ||
| 54 | + <i class="uk-icon-plus"></i> | ||
| 55 | + </span> | ||
| 56 | + <span data-uk-tooltip title="删除这条常用短语" class="minus_frequent_phrases"> | ||
| 57 | + <i class="uk-icon-minus"></i> | ||
| 58 | + </span> | ||
| 59 | + </div> | ||
| 49 | </div> | 60 | </div> |
| 50 | <br /> | 61 | <br /> |
| 51 | <div class="uk-form-row"> | 62 | <div class="uk-form-row"> |
src/main/resources/static/real_control_v2/js/home/context_menu.js
| @@ -53,6 +53,62 @@ var gb_home_context_menu = (function() { | @@ -53,6 +53,62 @@ var gb_home_context_menu = (function() { | ||
| 53 | }); | 53 | }); |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | + /** | ||
| 57 | + * 常用短语 | ||
| 58 | + * @type {{add, minus}} | ||
| 59 | + */ | ||
| 60 | + var frequent_phrases = function () { | ||
| 61 | + | ||
| 62 | + var init = function (wrap) { | ||
| 63 | + add(wrap); | ||
| 64 | + minus(wrap); | ||
| 65 | + //查询常用短语 | ||
| 66 | + $.get('/frequent_phrases/all', function (list) { | ||
| 67 | + var t = $('textarea[name=text]', wrap).val(); | ||
| 68 | + var opts = '<option value="">------ 常用短语 -------</option>'; | ||
| 69 | + for(var i=0,obj;obj=list[i++];){ | ||
| 70 | + opts += '<option value="'+obj.text+'" data-id="'+obj.id+'" '+(obj.text==t?"selected":"")+'>'+obj.text+'</option>'; | ||
| 71 | + } | ||
| 72 | + $('.common_phrase_sel', wrap).html(opts); | ||
| 73 | + }); | ||
| 74 | + }; | ||
| 75 | + | ||
| 76 | + var add = function (wrap) { | ||
| 77 | + $('.add_frequent_phrases', wrap).unbind('click').on('click', function () { | ||
| 78 | + var text = $('textarea[name=text]', wrap).val(); | ||
| 79 | + if(!$.trim(text)) | ||
| 80 | + return notify_err('请在下列文本框内输入文字'); | ||
| 81 | + | ||
| 82 | + gb_common.$post('/frequent_phrases', {text: text}, function () { | ||
| 83 | + notify_succ('添加成功!'); | ||
| 84 | + init(wrap); | ||
| 85 | + }); | ||
| 86 | + }); | ||
| 87 | + }; | ||
| 88 | + | ||
| 89 | + var minus = function (wrap) { | ||
| 90 | + $('.minus_frequent_phrases', wrap).unbind('click').on('click', function () { | ||
| 91 | + var text = $('.common_phrase_sel', wrap).val(); | ||
| 92 | + if(!$.trim(text)) | ||
| 93 | + return notify_err('请选中常用短语后再删除'); | ||
| 94 | + | ||
| 95 | + var id = $('.common_phrase_sel', wrap).find("option:selected").data('id'); | ||
| 96 | + if(!id) | ||
| 97 | + return notify_err('无法获取到索引'); | ||
| 98 | + | ||
| 99 | + gb_common.$del('/frequent_phrases/' + id, function () { | ||
| 100 | + notify_succ('删除成功!'); | ||
| 101 | + $('textarea[name=text]', wrap).val(''); | ||
| 102 | + init(wrap); | ||
| 103 | + }); | ||
| 104 | + }); | ||
| 105 | + }; | ||
| 106 | + | ||
| 107 | + return { | ||
| 108 | + init: init | ||
| 109 | + } | ||
| 110 | + }(); | ||
| 111 | + | ||
| 56 | // send phrase | 112 | // send phrase |
| 57 | var sendPhrase = function() { | 113 | var sendPhrase = function() { |
| 58 | var dom = temps['home-send-phrase-temp']({ | 114 | var dom = temps['home-send-phrase-temp']({ |
| @@ -62,10 +118,11 @@ var gb_home_context_menu = (function() { | @@ -62,10 +118,11 @@ var gb_home_context_menu = (function() { | ||
| 62 | // show modal | 118 | // show modal |
| 63 | var elem = show_modal(modal, dom); | 119 | var elem = show_modal(modal, dom); |
| 64 | 120 | ||
| 121 | + frequent_phrases.init(modal); | ||
| 65 | //form submit | 122 | //form submit |
| 66 | var f = $('form', modal).formValidation(gb_form_validation_opts); | 123 | var f = $('form', modal).formValidation(gb_form_validation_opts); |
| 67 | $('.common_phrase_sel', f).on('change', function () { | 124 | $('.common_phrase_sel', f).on('change', function () { |
| 68 | - $('[name=text]', f).text($(this).val()); | 125 | + $('[name=text]', f).val($(this).val()); |
| 69 | }); | 126 | }); |
| 70 | f.on('success.form.fv', function(e) { | 127 | f.on('success.form.fv', function(e) { |
| 71 | e.preventDefault(); | 128 | e.preventDefault(); |
| @@ -92,8 +149,13 @@ var gb_home_context_menu = (function() { | @@ -92,8 +149,13 @@ var gb_home_context_menu = (function() { | ||
| 92 | }, | 149 | }, |
| 93 | 'plugins': ['checkbox'] | 150 | 'plugins': ['checkbox'] |
| 94 | }); | 151 | }); |
| 152 | + | ||
| 153 | + frequent_phrases.init(modal); | ||
| 95 | //form submit | 154 | //form submit |
| 96 | var f = $('form', modal).formValidation(gb_form_validation_opts); | 155 | var f = $('form', modal).formValidation(gb_form_validation_opts); |
| 156 | + $('.common_phrase_sel', f).on('change', function () { | ||
| 157 | + $('[name=text]', f).val($(this).val()); | ||
| 158 | + }); | ||
| 97 | f.on('success.form.fv', function(e) { | 159 | f.on('success.form.fv', function(e) { |
| 98 | e.preventDefault(); | 160 | e.preventDefault(); |
| 99 | //tree checked node | 161 | //tree checked node |
src/main/resources/static/real_control_v2/mapmonitor/fragments/map_infowindow.html
| @@ -12,7 +12,21 @@ | @@ -12,7 +12,21 @@ | ||
| 12 | 未知站点 | 12 | 未知站点 |
| 13 | {{/if}} | 13 | {{/if}} |
| 14 | </h5> | 14 | </h5> |
| 15 | - <p>设备状态:正常</p> | 15 | + <p>设备状态: |
| 16 | + {{if valid==1}} | ||
| 17 | + invalid(-1 | ||
| 18 | + {{else if abnormalStatus=='outBounds'}} | ||
| 19 | + 越界 | ||
| 20 | + {{else if abnormalStatus=='overspeed'}} | ||
| 21 | + 超速 | ||
| 22 | + {{else if abnormalStatus=='gps-offline'}} | ||
| 23 | + GPS掉线 | ||
| 24 | + {{else if abnormalStatus=='offline'}} | ||
| 25 | + 离线 | ||
| 26 | + {{else}} | ||
| 27 | + . | ||
| 28 | + {{/if}} | ||
| 29 | + </p> | ||
| 16 | <p>设备号:{{deviceId}}</p> | 30 | <p>设备号:{{deviceId}}</p> |
| 17 | <p>速度:{{speed}}</p> | 31 | <p>速度:{{speed}}</p> |
| 18 | <p>角度:{{direction}}</p> | 32 | <p>角度:{{direction}}</p> |