Commit f2a941c6 authored by yangshuxing's avatar yangshuxing

自动提交代码

parent d43a505e
......@@ -18,7 +18,7 @@ public class RoadsGpsCheckpointMap {
@ApiModelProperty(value = "项目id", notes = "项目id")
private int roadId;
@ApiModelProperty(value = "打卡点id", notes = "打卡点id")
private int checkpointId;
private int checkpointId;
@ApiModelProperty(value = "计时打卡点名字", notes = "计时打卡点名字")
private String checkpointName;
@ApiModelProperty(value = "GPS轨迹上标注的打卡点名字", notes = "GPS轨迹上标注的打卡点名字")
......@@ -27,5 +27,5 @@ public class RoadsGpsCheckpointMap {
private String checkpointLatitude;
@ApiModelProperty(value = "打卡点的经度", notes = "打卡点的经度")
private String checkpointLongitude;
private int isDelete;
private int isDelete;
}
......@@ -13,7 +13,7 @@ select id as Id,cmpt_id as cmptId, road_id as roadId,checkpoint_id as checkpoint
<if test="checkpointName != null">
checkpoint_name = #{checkpointName},
</if>
<if test="checkpointGpsName!=null">
<if test="checkpointGpsName !=null">
checkpoint_gps_name = #{checkpointGpsName},
</if>
<if test="checkpointLatitude !=0">
......@@ -23,11 +23,11 @@ select id as Id,cmpt_id as cmptId, road_id as roadId,checkpoint_id as checkpoint
checkpoint_longitude = #{checkpointLongitude}
</if>
</set>
where road_id = #{roadId}
where id = #{id}
</update>
<insert id="save" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
insert into gk_roads_gps_checkpoint_map(cmpt_id,road_id ,checkpoint_name,checkpoint_gps_name ,checkpoint_latitude,checkpoint_longitude,is_delete)
values (#{cmptId},#{roadId},#{checkpointName},#{checkpointGpsName},#{checkpointLatitude},#{checkpointLongitude},0)
insert into gk_roads_gps_checkpoint_map(cmpt_id,road_id ,checkpoint_id,checkpoint_name,checkpoint_gps_name ,checkpoint_latitude,checkpoint_longitude,is_delete)
values (#{cmptId},#{roadId},#{checkpointId},#{checkpointName},#{checkpointGpsName},#{checkpointLatitude},#{checkpointLongitude},0)
</insert>
</mapper>
\ No newline at end of file
......@@ -13,6 +13,7 @@ import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
......@@ -96,9 +97,14 @@ public class RoadsGpsCheckpointController {
*/
@RequestMapping("save")
@ResponseBody
public Result save(List<RoadsGpsCheckpointMap> roadsGpsCheckpointMapList) {
public Result save(@RequestBody List<RoadsGpsCheckpointMap> roadsGpsCheckpointMapList) {
int count = roadsGpsCheckpointService.batchSaveOrUpdate(roadsGpsCheckpointMapList);
return Result.success().setContent(count);
if(count > 0){
return Result.success().setContent(count);
}else{
return Result.fail().setContent(count);
}
}
/**
......
......@@ -38,6 +38,7 @@
width: 100%;
margin: 20px 0px;
background: #FFFFFF;
position: relative;
}
.road-name{
font-size: 20px;
......@@ -48,6 +49,9 @@
height: 65px;
border-radius: 0px 4px 0px 0px;
border: 1px solid rgba(229,229,229,1);
position: relative;
min-width: 170px;
text-align: center;
}
.road-name.active{
color: #ce3939;
......@@ -65,9 +69,11 @@
color: #f3f3f3;
}
table tbody tr{
background:rgba(250,250,250,1);
border-radius:4px;
height:70px;
background: rgba(250,250,250,1);
border-radius: 4px;
height: 70px;
border-bottom: 5px solid white;
border-radius: 5px;
}
table tbody tr td{
padding-left: 26px;
......@@ -78,11 +84,11 @@
}
.select-group{
position: relative;
width: 120px;
width: 200px;
}
.select{
text-transform: none;
width: 120px;
width: 200px;
height: 40px;
padding: 0px 5px;
border-radius: 4px;
......@@ -94,6 +100,43 @@
-webkit-appearance:none;
cursor: pointer;
}
.load{
display: none;
width: 146px;
height: 40px;
background: rgba(206,57,57,1);
border-radius: 4px;
color: white;
display: inline-block;
line-height: 40px;
position: absolute;
right: 35px;
top: 72px;
text-align: center;
font-size: 18px;
cursor: pointer;
}
.no-route-icon{
width: 16px;
height: 16px;
background: url("/static/images/warning.png");
background-size: contain;
background-position: center;
background-repeat: no-repeat;
}
.load{
display: none;
}
.noroute{
display: none;
position: absolute;
width: 140px;
font-size: 16px;
bottom: -32px;
height: 65px;
left: 50%;
margin-left: -69px;
}
</style>
</head>
<body>
......@@ -118,15 +161,19 @@
<div class="data">
<div class="road">
<c:forEach var="item" items="${roads}">
<div class="road-name">
<c:forEach var="item" items="${roads}" varStatus="idx">
<div class="road-name ${idx.index==0?'active':''}" road-id="${item.roadId}">
<input type="hidden" id="roadId" name="roadId" value="${item.roadId}">
<span>${item.name}</span>
</div>
</c:forEach>
</div>
<table cellpadding="2px" cellspacing="2px">
<span class="load">导入路线</span>
<div class="noroute">
<span class="no-route-icon"></span>
<span class="no-route">未检索到标记点</span>
</div>
<table>
<colgroup>
<col width="33%">
<col width="33%">
......@@ -156,13 +203,15 @@
</table>
</div>
</div>
<div class="btn save-btn">保存</div>
<div style="display: flex;justify-content: center; margin: 60px;">事
<span class=" save-btn">保存</span>
</div>
</div>
<script src="${ctxStatic}/newdermon/vendor/popper.js/umd/popper.min.js"></script>
<script src="${ctxStatic}/js/qikoo.js"></script>
<script src="${ctxStatic}/js/autoscore.js?<%=System.currentTimeMillis()%>%"></script>
<script src="${ctxStatic}/js/autoscore.js"></script>
</body>
......
......@@ -2,21 +2,59 @@ $(document).ready(function () {
//切换项目,获取不同计时的打卡点
getTimeCp(21177);
//获取gpx路线上的打卡点
getGpsCp(21177);
//初始化已经配置好的GPS计时点配置列表
//getCpGpsList(21177);
});
$('body').on('change','table select',function () {
var option = $(this).find('option:selected')
var lat = Number(option.attr('data-lat')).toFixed(6);
var lng = Number(option.attr('data-lng')).toFixed(6);
$(this).parents('td').next().text(lat+","+lng);
});
$('body').on('click','.road-name',function () {
$('.road-name').removeClass('active');
$(this).addClass("active");
var roadId=$(this).attr('road-id');
//获取计时系统的计时点列表
getTimeCp(roadId);
});
$('.save-btn').click(function () {
var params = [];
var roadId = $('.road-name.active').attr('road-id');
$.each($('tbody tr'),function (i,e) {
var param = {};
var id = $(e).attr('data-cpmap-id');
var checkpointId = $(e).find('td:eq(0)').attr('data-cp-id');
var cmptId = getCmptId();
var checkpointName = $(e).find('td:eq(0)').text();
var checkpointGpsName = $(e).find('select').val()
var checkpointLatitude = $(e).find('td:eq(2)').text().split(',')[0];
var checkpointLongitude = $(e).find('td:eq(2)').text().split(',')[1];
param.id = id;
param.roadId = roadId;
param.checkpointId = checkpointId;
param.cmptId = cmptId;
param.checkpointName = checkpointName;
param.checkpointGpsName = checkpointGpsName;
param.checkpointLatitude = checkpointLatitude;
param.checkpointLongitude = checkpointLongitude;
params.push(param)
});
saveCpMap(params)
});
//点击事件,切换不同项目,获取不同项目的GPS计时点配置信息
$(".road-name").click(function(event){
var roadId=$(this).children("input").val();
//获取计时系统的计时点列表
getTimeCp(roadId);
//切换不同个项目,获取不同项目下的打卡点配置
getCpGpsList(roadId);
$('.load').click(function () {
$('li.road a').get()[0].click();
});
});
//路线标注下来点击事情,获取下拉值,并更新选中的值
$(".selectgpscheckpoint").change(function(){
......@@ -28,28 +66,17 @@ $(".selectgpscheckpoint").change(function(){
* @param roadId
*/
function getCpGpsList(roadId) {
//清空所有值
$('tbody').empty();
$.ajax({
url : '/gk/roadGpsCheckpoint/getRoadsGpsCheckpoint/'+getCId()+"/"+roadId,
success:function (data) {
if(data.status){
$.each(data.content,function (i,e) {
$('tbody').append(' \n' +
' <tr>\n' +
' <td>'+e.checkpointName+'</td>\n' +
' <td>\n' +
' <div class="select-group">\n' +
' <select class="selectgpscheckpoint">\n' +
' <option value="'+e.checkpointGpsName+'">'+e.checkpointGpsName+'</option>\n' +
' </select>\n' +
' <span class="down-arrow"></span>\n' +
' </div>\n' +
' </td>\n' +
' <td>'+Number(e.checkpointLatitude).toFixed(6)+','+Number(e.checkpointLongitude).toFixed(6)+'</td>\n' +
' </tr>');
})
var tr = $('td[data-cp-id='+e.checkpointId+']').parent();
tr.find('select').val(e.checkpointGpsName);
tr.find('select').trigger('change');
tr.attr('data-cpmap-id',e.id);
});
}
}
})
......@@ -61,6 +88,7 @@ function getCpGpsList(roadId) {
* @param roadId
*/
function getTimeCp(roadId) {
$('tbody').empty()
$.ajax({
url : '/gk/roadGpsCheckpoint/getTimeCheckpointByRoadId/'+getCId()+"/"+roadId,
success:function (data) {
......@@ -68,10 +96,10 @@ function getTimeCp(roadId) {
$.each(data.content,function (i,e) {
$('tbody').append(' \n' +
' <tr>\n' +
' <td>'+e.checkpointName+'</td>\n' +
' <td data-cp-id="'+e.checkpointId+'">'+e.checkpointName+'</td>\n' +
' <td>\n' +
' <div class="select-group">\n' +
' <select class="selectgpscheckpoint">\n' +
' <select class="select gpscheckpoint">\n' +
' </select>\n' +
' <span class="down-arrow"></span>\n' +
' </div>\n' +
......@@ -79,6 +107,7 @@ function getTimeCp(roadId) {
' <td>'+Number(e.checkpointLatitude).toFixed(6)+','+Number(e.checkpointLongitude).toFixed(6)+'</td>\n' +
' </tr>');
})
getGpsCp(roadId);
}
}
})
......@@ -90,23 +119,53 @@ function getTimeCp(roadId) {
* 获取路线上的打卡点
* @param roadId
*/
function getGpsCp(roadId) {
function getGpsCp(roadId) {
$.ajax({
url : '/gk/roadGpsCheckpoint/getGpsCheckPointByRoadId/'+getCId()+"/"+roadId,
success:function (data) {
if(data.status){
var optionstring="";
$('.load').hide();
$('.noroute').hide();
var optionstring="<option value='' data-lat='' data-lng='' >- -</option>";
//将之前的下拉框的值清空
$(".selectgpscheckpoint").empty();
$(".gpscheckpoint").empty();
$.each(data.content,function (i,e) {
//获取项目路线上的打卡点并初始化到下拉框
optionstring+='<option value="'+e.checkpointGpsName+'">'+e.checkpointGpsName+'</option>';
optionstring+='<option data-lat="'+e.checkpointLatitude+'" data-lng="'+e.checkpointLongitude+'" value="'+e.checkpointGpsName+'">'+e.checkpointGpsName+'</option>';
});
console.log(optionstring);
$.each($(".selectgpscheckpoint"),function (i,e) {
$.each($(".gpscheckpoint"),function (i,e) {
$(e).append(optionstring);
})
});
getCpGpsList(roadId);
}else{
$('.road-name[road-id="'+roadId+'"]').append($('.noroute'));
$('.noroute').show();
$('.load').attr('road-id',roadId)
$('.load').show();
$(".gpscheckpoint").append("<option value='' data-lat='' data-lng=''>- -</option>");
}
}
})
}
/**
*
* 保存对应关系
*
*/
function saveCpMap(param){
$.ajax({
url : '/gk/roadGpsCheckpoint/save',
type:'post',
contentType:'application/json',
data:JSON.stringify(param),
success:function (data) {
if(data.status){
layer.msg('保存成功!')
}else{
layer.msg('操作失败!')
}
}
})
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment