Commit c6b441b6 authored by chenlin's avatar chenlin

多路线改造第一弹

parent 85e5443f
package com.dlbridge.feign;
import com.dlbridge.feign.bean.CmptScoreCheckpoint;
import com.dlbridge.jadp.fallback.GeexekScoreFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
//import com.sun.tools.javac.sym.Profiles;
/**
* 废弃单独处理成绩工程
*/
// 本地启动直接指定服务名
//@FeignClient(name = "geexekscore", url = "https://zs.geexek.com/", fallbackFactory = GeexekScoreFallbackFactory.class)
@FeignClient(name = "geexekscore", fallbackFactory = GeexekScoreFallbackFactory.class)
@RequestMapping("geexekscore/api/v1/cmpt-score-checkpoint")
public interface GeexekScoreService {
@GetMapping(value = "/getCheckPointByRoadId")
List<CmptScoreCheckpoint> getCheckPointByRoadId(@RequestParam("roadId") int roadId);
List<CmptScoreCheckpoint> getCheckPointByRoadId(@RequestParam("roadId") int roadId, @RequestParam("pathId") int pathId);
@RequestMapping(value = "batchInsert",method = RequestMethod.POST)
List<CmptScoreCheckpoint> batchInsert(List<CmptScoreCheckpoint> cmptScoreCheckpoints);
@DeleteMapping(value = "deleteAllByRoadId/{roadId}")
List<CmptScoreCheckpoint> deleteAllByRoadId(@PathVariable("roadId") int roadId);
@DeleteMapping(value = "deleteAllByRoadId/{roadId}/{pathId}")
List<CmptScoreCheckpoint> deleteAllByRoadId(@PathVariable("roadId") int roadId, @PathVariable("pathId") int pathId);
@PostMapping("saveCheckPoint")
void saveOrUpdateCheckPoint(@RequestBody List<CmptScoreCheckpoint> list);
......
......@@ -31,6 +31,9 @@ public class CmptScoreCheckpoint{
@ApiModelProperty(value = "项目Id(现在是计时项目id,后期修改为报名项目id)")
private Integer roadId;
@ApiModelProperty(value = "路线ID")
private Integer pathId;
@ApiModelProperty(value = "打卡点的名字")
private String name;
......
......@@ -13,6 +13,8 @@ public class CmptCheckPointDis {
private Integer roadId;
private Integer pathId=-1;
private String disPoint;
private String disPointName;
......
......@@ -35,6 +35,12 @@ public class Road {
@ApiModelProperty(value = "组别类型名", notes = "组别类型名")
private String roadTypeName;
@ApiModelProperty(value = "路线ID", notes = "路线ID")
private int pathId=-1;
@ApiModelProperty(value = "路线名称", notes = "路线名称")
private String pathName;
private String createTime;
@Override
......
......@@ -17,8 +17,12 @@ public class RoadGpsPoint {
@ApiModelProperty(value = "项目id", notes = "项目id")
private Integer roadId;
@ApiModelProperty(value = "路线id", notes = "路线id")
private Integer pathId;
@ApiModelProperty(value = "赛事id", notes = "赛事id")
private Integer cmptId;
@ApiModelProperty(value = "路线名字", notes = "路线名字")
private String pathName;
@ApiModelProperty(value = "坐标点串", notes = "坐标点串", example = "{\n" +
"\t\"name\": \"JD50byTyrone\",\n" +
"\t\"placeMark\": [{\n" +
......@@ -43,4 +47,10 @@ public class RoadGpsPoint {
private String placeMark;
private String fileName;
private String fileUrl;
private double fileSize;
}
......@@ -12,7 +12,7 @@ public interface CmptCheckPointDisMapper {
void update(CmptCheckPointDis cmptCheckPointDis);
void deleteByRoadId(Integer roadId);
void deleteByRoadId(Integer roadId, Integer pathId);
int isExistByRoadAndPoint(CmptCheckPointDis cmptCheckPointDis);
......
......@@ -21,29 +21,33 @@
d.distance,
d.is_delete,
d.create_time,
d.update_time,
(select GROUP_CONCAT(t.name order by t.checkpoint_id SEPARATOR '-') from gk_cmpt_score_checkpoint t where t.checkpoint_id in (CAST(SUBSTRING_INDEX(d.dis_point,'-',1) AS SIGNED),CAST(SUBSTRING_INDEX(d.dis_point,'-',-1) AS SIGNED)) ) as dis_point_name
d.update_time
from gk_cmpt_checkpoint_dis d
LEFT JOIN gk_cmpt_score_checkpoint e ON e.cmpt_id = d.cmptId AND CAST(SUBSTRING_INDEX(d.dis_point,'-',-1) AS SIGNED)=e.checkpoint_id
<where>
<if test="id != null">
and id = #{id}
and d.id = #{id}
</if>
<if test="cmptId != null">
and cmptId = #{cmptId}
and d.cmptId = #{cmptId}
</if>
<if test="roadId != null">
and roadId = #{roadId}
and d.roadId = #{roadId}
</if>
<if test="disPoint != null and disPoint != ''">
and dis_point = #{disPoint}
and d.dis_point = #{disPoint}
</if>
<if test="distance != null">
and distance = #{distance}
and d.distance = #{distance}
</if>
<if test="isDelete != null and isDelete != ''">
and is_delete = #{isDelete}
and d.is_delete = #{isDelete}
</if>
<if test="pathId > 0">
and d.path_id = #{pathId}
</if>
</where>
ORDER BY CAST(SUBSTRING_INDEX(d.dis_point,'-',1) AS SIGNED) ,e.distance
</select>
<update id="update" parameterType="com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis">
......@@ -54,12 +58,15 @@
</update>
<update id="save" parameterType="com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis">
insert into gk_cmpt_checkpoint_dis values (null, #{cmptId}, #{roadId}, #{disPoint} , #{distance}, '0', now(), null)
insert into gk_cmpt_checkpoint_dis values (null, #{cmptId}, #{roadId},#{pathId}, #{disPoint} , #{distance}, '0', now(), null)
</update>
<delete id="deleteByRoadId" parameterType="int">
update gk_cmpt_checkpoint_dis set is_delete = '1'
where roadId = #{roadId}
<if test="pathId > 0">
and path_id = #{pathId}
</if>
</delete>
<select id="isExistByRoadAndPoint" parameterType="com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis" resultType="int">
......
......@@ -19,9 +19,13 @@ public interface RoadMapper {
int saveGps(RoadGpsPoint point);
RoadGpsPoint getGps(Integer roadId);
RoadGpsPoint getGps(@Param("roadId")Integer roadId, @Param("pathId")Integer pathId);
void deleteGps(Integer roadId);
List<RoadGpsPoint> getRoadGpsList(@Param("roadId")Integer roadId);
int updateRoadGps(RoadGpsPoint point);
void deleteGps(Integer roadId, Integer pathId);
void countDownload(Integer roadId);
}
......@@ -6,14 +6,17 @@
select a.road_id roadId
, a.cmpt_id cmptId
, a.road_name name
, a.file_name fileName
, a.file_url fileUrl
, c.file_name fileName
, c.file_url fileUrl
, a.times
, a.file_size fileSize
, c.file_size fileSize
, b.item_type roadType
, case when b.item_type = 2 then '团队赛' when b.item_type = 1 then '个人赛' else '其他' end roadTypeName
, c.id pathId
, c.path_name pathName
from gk_road a
LEFT JOIN geerunner.cmpt_item b ON a.cmpt_id = b.cmpt_id AND a.road_id = b.item_id
LEFT JOIN gk_roads_gps c ON c.cmpt_id = a.cmpt_id AND a.road_id=c.road_id
WHERE a.cmpt_id = #{cmptId}
AND a.is_delete = 0
</select>
......@@ -25,16 +28,16 @@
<update id="update">
update gk_road
<set>
<if test="road.name != null">
<if test="road.name != null and road.name != '' ">
road_name = #{road.name},
</if>
<if test="road.fileSize > 0">
file_size = #{road.fileSize},
</if>
<if test="road.fileName != null">
<if test="road.fileName != null and road.fileName != '' ">
file_name = #{road.fileName},
</if>
<if test="road.fileUrl != null">
<if test="road.fileUrl != null and road.fileUrl !='' ">
file_url = #{road.fileUrl}
</if>
</set>
......@@ -47,20 +50,39 @@
</insert>
<insert id="saveGps" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
insert into gk_roads_gps(cmpt_id ,road_id,points,create_time)
values (#{cmptId},#{roadId},#{points},now())
insert into gk_roads_gps(cmpt_id ,road_id,points,path_name,file_name,file_url,file_size,create_time)
values (#{cmptId},#{roadId},#{points},#{pathName},#{fileName},#{fileUrl},#{fileSize},now())
</insert>
<update id="updateRoadGps" parameterType="com.dlbridge.jadp.plugins.cmpt.bean.RoadGpsPoint">
update gk_roads_gps
set points=#{points}
, path_name=#{pathName}
, file_name=#{fileName}
, file_url=#{fileUrl}
, file_size=#{fileSize}
, create_time=now()
where id = #{pathId}
</update>
<select id="getGps" resultType="com.dlbridge.jadp.plugins.cmpt.bean.RoadGpsPoint">
select id,cmpt_id cmptId,road_id roadId,points
select id,cmpt_id cmptId,road_id roadId,points,path_name pathName,file_name fileName,file_url fileUrl,file_size fileSize
from gk_roads_gps
where road_id = #{roadId} limit 1
where road_id = #{roadId}
and id = #{pathId}
limit 1
</select>
<select id="getRoadGpsList" resultType="com.dlbridge.jadp.plugins.cmpt.bean.RoadGpsPoint">
select id,cmpt_id cmptId,road_id roadId,points,path_name pathName,file_name fileName,file_url fileUrl,file_size fileSize
from gk_roads_gps
where road_id = #{roadId}
</select>
<delete id="deleteGps">
delete from gk_roads_gps
where road_id = #{roadId}
and id = #{pathId}
</delete>
<update id="countDownload">
......
package com.dlbridge.jadp.plugins.cmpt.service;
import com.dlbridge.feign.GeexekScoreService;
import com.dlbridge.feign.bean.CmptScoreCheckpoint;
import com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis;
import com.dlbridge.jadp.plugins.cmpt.dao.mapper.CmptCheckPointDisMapper;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 智能步道接口
......@@ -18,9 +22,24 @@ public class CmptCheckPointDisService {
@Resource
private CmptCheckPointDisMapper cmptCheckPointDisMapper;
@Resource
GeexekScoreService geexekScoreService;
public List<CmptCheckPointDis> queryList(CmptCheckPointDis cmptCheckPointDis) {
cmptCheckPointDis.setIsDelete("0");
return cmptCheckPointDisMapper.queryList(cmptCheckPointDis);
List<CmptCheckPointDis> disList = cmptCheckPointDisMapper.queryList(cmptCheckPointDis);
List<CmptScoreCheckpoint> checkPointList = geexekScoreService.getCheckPointByRoadId(cmptCheckPointDis.getRoadId(), cmptCheckPointDis.getPathId());
Map<String,String> cpMap = new HashMap<String, String>();
for(CmptScoreCheckpoint cp : checkPointList){
cpMap.put(cp.getCheckpointId()+"", cp.getName());
}
for(CmptCheckPointDis dis : disList){
String checkPoint1 = dis.getDisPoint().split("-")[0];
String checkPoint2 = dis.getDisPoint().split("-")[1];
String disPointName = cpMap.get(checkPoint1)+"-"+cpMap.get(checkPoint2);
dis.setDisPointName(disPointName);
}
return disList;
}
public void saveOrUpdate(List<CmptCheckPointDis> list) {
......@@ -35,7 +54,7 @@ public class CmptCheckPointDisService {
}
}
public void deleteByRoad(Integer roadId) {
cmptCheckPointDisMapper.deleteByRoadId(roadId);
public void deleteByRoad(Integer roadId, Integer pathId) {
cmptCheckPointDisMapper.deleteByRoadId(roadId, pathId);
}
}
......@@ -95,7 +95,6 @@ public class RoadService {
} else {
json = KmlParserUtil.parseKml(inputStream);
}
System.out.println(json);
return json;
} catch (IOException e) {
log.info(e.getMessage(), e);
......@@ -104,12 +103,23 @@ public class RoadService {
}
public int saveGps(RoadGpsPoint point) {
roadMapper.deleteGps(point.getRoadId());
// 存在pathId的时候先把原来的路线删除再保存
// if(point.getPathId() > 0){
// roadMapper.deleteGps(point.getRoadId(), point.getPathId());
// }
return roadMapper.saveGps(point);
}
public RoadGpsPoint getGps(Integer roadId) {
return roadMapper.getGps(roadId);
public int updateRoadGps(RoadGpsPoint point){
return roadMapper.updateRoadGps(point);
}
public RoadGpsPoint getGps(Integer roadId, Integer pathId) {
return roadMapper.getGps(roadId, pathId);
}
public List<RoadGpsPoint> getRoadGpsList(Integer roadId) {
return roadMapper.getRoadGpsList(roadId);
}
public void countDownload(Integer roadId) {
......
......@@ -43,7 +43,7 @@ import java.util.*;
@Log4j2
@RestController
@RequestMapping("api")
@Api(value = "赛客助手api", tags = "赛客助手api")
@Api(value = "赛客助手小程序api", tags = "赛客助手小程序api")
@ApiSort(1)
public class MicroApiController {
private static final String SIGNING_CODE = "1";
......@@ -518,8 +518,9 @@ public class MicroApiController {
@ApiResponse(code = -1, message = "失败", response = ObjectUtils.Null.class),
@ApiResponse(code = 200, message = "成功", response = Result.class)})
@ApiOperation(value = "获取路线坐标点", notes = "获取路线坐标点", tags = "路线导入")
public Result<RoadGpsPoint> route_gps(@PathVariable("roadId") Integer roadId) {
RoadGpsPoint gps = roadService.getGps(roadId);
public Result<RoadGpsPoint> route_gps(@PathVariable("roadId") Integer roadId,
@RequestParam(name = "pathId", required = false, defaultValue = "-1") int pathId) {
RoadGpsPoint gps = roadService.getGps(roadId, pathId);
return Result.success().setContent(gps);
}
......
......@@ -63,8 +63,9 @@ public class RoadController {
@GetMapping("getCheckPoints/{roadId}")
@ResponseBody
public Result getCheckPoints(@PathVariable("roadId") int roadId) {
List<CmptScoreCheckpoint> checkPointByRoadId = geexekScoreService.getCheckPointByRoadId(roadId);
public Result getCheckPoints(@PathVariable("roadId") int roadId,
@RequestParam(name = "pathId", required = false, defaultValue = "-1") int pathId) {
List<CmptScoreCheckpoint> checkPointByRoadId = geexekScoreService.getCheckPointByRoadId(roadId, pathId);
return Result.success().setContent(checkPointByRoadId);
}
......@@ -78,35 +79,63 @@ public class RoadController {
@RequestMapping("save")
@ResponseBody
public Result save(Road road) {
geexekScoreService.deleteAllByRoadId(road.getRoadId());
String json = roadService.loadGpsFromNet(road.getFileUrl());
JSONObject jsonObject = JSONObject.parseObject(json);
JSONArray placeMark = jsonObject.getJSONArray("placeMark");
RoadGpsPoint roadGpsPoint = new RoadGpsPoint().
setPoints(json).setRoadId(road.getRoadId())
.setCmptId(road.getCmptId());
roadService.saveGps(roadGpsPoint);
Iterator<Object> iterator = placeMark.iterator();
List<CmptScoreCheckpoint> list = new ArrayList<>();
while (iterator.hasNext()){
JSONObject next = (JSONObject)iterator.next();
CmptScoreCheckpoint cp = new CmptScoreCheckpoint();
cp.setCmptId(road.getCmptId());
cp.setIsTime(false);
cp.setRoadId(road.getRoadId());
cp.setIsDelete(false);
cp.setInsertTime(LocalDateTime.now());
cp.setName(next.getString("name"));
cp.setLatitude(next.getDouble("latitude"));
cp.setLongitude(next.getDouble("longitude"));
list.add(cp);
try {
log.info("=====gk/road/save,载入路线,参数:{}",JSONObject.toJSONString(road));
// 取出路线的文件转成json
String json = roadService.loadGpsFromNet(road.getFileUrl());
JSONObject jsonObject = JSONObject.parseObject(json);
JSONArray placeMark = jsonObject.getJSONArray("placeMark");
// 查询项目下的路线
RoadGpsPoint roadGps = roadService.getGps(road.getRoadId(), road.getPathId());
int newPahtId = road.getPathId();
if(roadGps == null){
// 新保存[gk_roads_gps]
RoadGpsPoint roadGpsPoint = new RoadGpsPoint().
setPoints(json).setRoadId(road.getRoadId())
.setCmptId(road.getCmptId()).setPathName(road.getPathName())
.setFileName(road.getFileName()).setFileUrl(road.getFileUrl())
.setFileSize(road.getFileSize()).setPathId(road.getPathId());
roadService.saveGps(roadGpsPoint);
newPahtId = roadGpsPoint.getId();
log.info("=====生成新的路线ID:{}",newPahtId);
}else{
// 删除路线的打卡点表[gk_cmpt_score_checkpoint]数据
geexekScoreService.deleteAllByRoadId(road.getRoadId(), road.getPathId());
// 更新路线内容
RoadGpsPoint roadGpsPoint = new RoadGpsPoint().
setPoints(json).setRoadId(road.getRoadId())
.setCmptId(road.getCmptId()).setPathName(road.getPathName())
.setFileName(road.getFileName()).setFileUrl(road.getFileUrl())
.setFileSize(road.getFileSize()).setPathId(road.getPathId());
roadService.updateRoadGps(roadGpsPoint);
}
Iterator<Object> iterator = placeMark.iterator();
List<CmptScoreCheckpoint> list = new ArrayList<>();
while (iterator.hasNext()){
JSONObject next = (JSONObject)iterator.next();
CmptScoreCheckpoint cp = new CmptScoreCheckpoint();
cp.setCmptId(road.getCmptId());
cp.setIsTime(false);
cp.setRoadId(road.getRoadId());
cp.setPathId(newPahtId);
cp.setIsDelete(false);
cp.setInsertTime(LocalDateTime.now());
cp.setName(next.getString("name"));
cp.setLatitude(next.getDouble("latitude"));
cp.setLongitude(next.getDouble("longitude"));
list.add(cp);
}
// 批量保存路线打卡点表[gk_cmpt_score_checkpoint]
geexekScoreService.batchInsert(list);
// 更新组别表[gk_road]
int count = roadService.saveOrUpdate(road);
// 删除智能步道CP点间距离数据
cmptCheckPointDisService.deleteByRoad(road.getRoadId(), road.getPathId());
} catch (Exception e) {
log.info("=====载入路线异常:"+e.getMessage());
}
geexekScoreService.batchInsert(list);
int count = roadService.saveOrUpdate(road);
// 删除智能步道数据
cmptCheckPointDisService.deleteByRoad(road.getRoadId());
return Result.success().setContent(road);
}
......@@ -126,23 +155,24 @@ public class RoadController {
*/
@RequestMapping("gps")
@ResponseBody
public Result gps(String url, Integer roadId, Integer cmptId) {
RoadGpsPoint gps = roadService.getGps(roadId);
public Result gps(String url, Integer roadId, Integer cmptId, Integer pathId) {
RoadGpsPoint gps = roadService.getGps(roadId, pathId);
return Result.success().setContent(gps);
}
@RequestMapping("gps/{roadId}")
@RequestMapping("gps/{roadId}/{pathId}")
@ResponseBody
public Result getGps(@PathVariable("roadId") Integer roadId) {
RoadGpsPoint gps = roadService.getGps(roadId);
public Result getGps(@PathVariable("roadId") Integer roadId,@PathVariable("pathId") Integer pathId) {
RoadGpsPoint gps = roadService.getGps(roadId, pathId);
return Result.success().setContent(gps);
}
@RequestMapping("getCpDis/{roadId}")
@RequestMapping("getCpDis/{roadId}/{pathId}")
@ResponseBody
public Result getCpDis(@PathVariable("roadId") Integer roadId) {
public Result getCpDis(@PathVariable("roadId") Integer roadId, @PathVariable("pathId") Integer pathId) {
CmptCheckPointDis cmptCheckPointDis = new CmptCheckPointDis();
cmptCheckPointDis.setRoadId(roadId);
cmptCheckPointDis.setPathId(pathId);
return Result.success().setContent(cmptCheckPointDisService.queryList(cmptCheckPointDis));
}
......
......@@ -12,10 +12,7 @@ import com.neusoft.www.utils.web.Result;
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 org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
......@@ -71,9 +68,11 @@ public class RoadsGpsCheckpointController {
*/
@RequestMapping("getGpsCheckPointByRoadId/{cmptId}/{roadId}")
@ResponseBody
public Result getGpsCheckPointByRoadId(@PathVariable("cmptId") Integer cmptId,@PathVariable("roadId") Integer roadId) {
RoadGpsPoint roadGpsPoint = roadService.getGps(roadId);
if(roadGpsPoint == null) return Result.fail().setMsg("未设置轨迹");
public Result getGpsCheckPointByRoadId(@PathVariable("cmptId") Integer cmptId,
@PathVariable("roadId") Integer roadId,
@RequestParam(name = "pathId", required = false, defaultValue = "-1") int pathId) {
RoadGpsPoint roadGpsPoint = roadService.getGps(roadId, pathId);
if(roadGpsPoint == null) {return Result.fail().setMsg("未设置轨迹");}
String points = roadGpsPoint.getPoints();
List<RoadsGpsCheckpointMap> roadsGpsCheckpointMapList = new ArrayList<>();
JSONObject object = JSONObject.parseObject(points);
......
......@@ -11,10 +11,7 @@ import com.dlbridge.jadp.plugins.cmpt.utils.QRCodeUtil;
import com.neusoft.www.utils.web.Result;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import springfox.documentation.annotations.ApiIgnore;
......@@ -66,6 +63,7 @@ public class ScanController {
mv.addObject("roads", roads);
//int count = geexekScoreService.hasCheckPoint(cmptId);
// TODO Linc 多路线情况
List<Map> map = geexekScoreService.getRoadCheckPointMap(cmptId);
mv.addObject("hasCps", map.size() > 0);
......@@ -95,6 +93,7 @@ public class ScanController {
@GetMapping("downLoadAllQRByRoadId/{cmptId}/{roadId}")
public void downLoadAllQRByRoadId(@PathVariable("cmptId") int cmptId,
@PathVariable("roadId") int roadId,
@RequestParam(name = "pathId", required = false, defaultValue = "-1") int pathId,
HttpServletResponse httpServletResponse) {
//获取项目的名字
HashMap<String, Object> roadinfo = remoteService.getRoadinfoByroadId(cmptId, roadId);
......@@ -123,9 +122,9 @@ public class ScanController {
OutputStream outputStream = httpServletResponse.getOutputStream();
ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream);
//获取这个项目有多少打卡点,生成相应的二维码
List<CmptScoreCheckpoint> checkPoints = geexekScoreService.getCheckPointByRoadId(roadId);
List<CmptScoreCheckpoint> checkPoints = geexekScoreService.getCheckPointByRoadId(roadId, pathId);
for (int i = 0; i < checkPoints.size(); i++) {
if(!checkPoints.get(i).getIsTime()) continue;
if(!checkPoints.get(i).getIsTime()) {continue;}
int checkpointId = checkPoints.get(i).getCheckpointId();
String checkpointName = checkPoints.get(i).getName();
BufferedImage buffImg = QRCodeUtil.getBufferedImage(logoimg, String.valueOf(checkpointId));
......
......@@ -52,12 +52,12 @@ spring.data.web.pageable.default-page-size=10
spring.data.web.pageable.max-page-size=100
weixin.micro.appid=wx96ce27826f39cdb3
weixin.micro.secret=11bfc4902e7c992b57a2cdcfeded623f
geexek.user.url=https://test.geexek.com.cn/
geexek.cmpt.url=http://testtimerbackend.geexek.cn/
geexek.user.url=https://www.geexek.com/
geexek.cmpt.url=https://timerbackend.geexek.com/
geexek.shamus.url=http://shamus.geexek.com.cn/
timer.url=http://testtimer.geexek.cn/
server.url=http://testzs.geexek.com.cn/
geexek.shamus.url=http://shamus.geexek.com/
timer.url=http://timer.geexek.com/
server.url=http://zs.geexek.com/
server.url.https=http://localhost:9090/
###redis
spring.redis.port=6379
......@@ -103,10 +103,10 @@ spring.cloud.sentinel.skip-keys=cmptId
spring.cloud.sentinel.exclude-urls=/static/**,**.css,**.js
## nacos 地址
spring.cloud.sentinel.datasource.ds.nacos.server-addr=127.0.0.1:8848
spring.cloud.sentinel.datasource.ds.nacos.server-addr=https://nacos.geexek.com
spring.cloud.sentinel.datasource.ds.nacos.dataId=micro-gksite-sentinel
spring.cloud.sentinel.datasource.ds.nacos.data-type=json
spring.cloud.sentinel.datasource.ds.nacos.groupId=dev
spring.cloud.sentinel.datasource.ds.nacos.groupId=production
#spring.cloud.sentinel.datasource.ds1.nacos.namespace=fad8a39-a3e7-49a1-ae96-0f7aaf39136b
#
## 规则类型
......
......@@ -18,11 +18,11 @@ spring:
cloud:
nacos:
config:
server-addr: http://127.0.0.1:8848
server-addr: https://nacos.geexek.com
file-extension: properties
group: dev
namespace: 187c2f4d-80c2-4a67-b4e5-319d5c9151d1
server-addr: http://127.0.0.1:8848
server-addr: https://nacos.geexek.com
discovery:
group: dev
namespace: 187c2f4d-80c2-4a67-b4e5-319d5c9151d1
......
......@@ -65,10 +65,13 @@
<c:forEach var="item" items="${list}">
<div class="equip-item-new equip-item" data-id="${item.roadId}" data-name="${item.name}"
data-file-name="${item.fileName}" data-file-url="${item.fileUrl}"
data-file-size="${item.fileSize}">
data-file-size="${item.fileSize}" data-path-id="${item.pathId}" data-path-name="${item.pathName}">
<div class="divhorizontal divhorizontal-item1">
<span class="name-color">${item.name}</span>
</div>
<div class="divhorizontal divhorizontal-item4">
<span class="name-color">${item.pathName}</span>
</div>
<div class="divhorizontal divhorizontal-item2">
<p class="">状态</p>
<c:if test="${item.fileUrl != null && item.fileUrl != ''}">
......@@ -81,6 +84,10 @@
<div class="divhorizontal divhorizontal-item3 edit-new">
<span class="edit-road"></span>
<span class="edit-text " name="name">路线编辑</span>
</div>
<div class="divhorizontal divhorizontal-item3 add-new">
<span class="edit-road"></span>
<span class="edit-text " name="name">新增路线</span>
</div>
<%-- <span class="btn right del">删除</span>--%>
</div>
......@@ -104,8 +111,10 @@
<div class="map-title">
<div class="flex flex-column">
<input type="hidden" id="roadId">
<input type="hidden" id="pathId">
<span id="roadName"></span>
<span id="gpsName"></span>
<input type="text" id="pathName" class="ipt-middle" placeholder="请输入路线名">
</div>
<div class="right">
<button type="button" class="btn upload">载入路线</button>
......
......@@ -24,7 +24,7 @@
}
.divhorizontal-item1 {
width: 504px;
width: 280px;
}
.divhorizontal-item1 .name-color {
......@@ -36,8 +36,8 @@
margin-top: 16px;
text-align: left;
padding-left: 0px !important;
margin-right: 130px;
width: 100px;
margin-right: 20px;
width: 120px;
}
.divhorizontal-item2 .status-color {
......@@ -54,7 +54,13 @@
padding-right: 0px !important;
background-color: #F7F7F7 !important;
}
.divhorizontal-item4 {
margin-top: 16px;
text-align: left;
padding-left: 0px !important;
margin-right: 20px;
width: 260px;
}
.ipt {
width: 300px;
height: 50px;
......@@ -165,6 +171,10 @@ nav.side-navbar .sidebar-header
.edit-new {
cursor: pointer;
}
.add-new {
cursor: pointer;
margin-left: 5px;
}
.back {
width: 15px;
......@@ -195,4 +205,13 @@ nav.side-navbar .sidebar-header
font-weight: 500;
color: rgba(80, 187, 253, 1);
line-height: 20px;
}
.ipt-middle {
width: 300px;
height: 35px;
background: rgba(247, 247, 247, 1);
border-radius: 4px;
border: 1px solid rgba(238, 238, 238, 1);
margin: 10px 0px 10px 0px
}
\ No newline at end of file
......@@ -66,7 +66,7 @@ $(document).ready(function () {
success: function (data) {
if(data.code == 200){
layer.msg('保存成功', {icon: 1, time: 1500});
getPath($("#roadId").val());
getPath($("#roadId").val(), $("#pahtId").val());
}
}, error: function () {
layer.msg('操作失败', {icon: 5, time: 1500});
......@@ -86,23 +86,27 @@ $(document).ready(function () {
// layer.msg('click触发了',{icon:3,time:1500});
var parent = $(this).parent();
var id = parent.attr('data-id');
var pathId = parent.attr('data-path-id');
var pathName = parent.attr('data-path-name');
var fileName = parent.attr('data-file-name');
var fileSize = parent.attr('data-file-size') ? Number(parent.attr('data-file-size')).toFixed(2) : 0;
var fileUrl = parent.attr('data-file-url');
var name = parent.attr('data-name');
// var name = $(this).children().val(); //获取roadname字段
// layer.msg(name,{icon:3,time:1500});
// layer.msg(pathId,{icon:3,time:1500});
$('#roadName').text(name);
$('#gpsName').text(fileName);
$('#pathName').val(pathName);
if (!name) {
layer.msg('请填写项目名称再进行编辑', {icon: 3, time: 1500});
return;
}
if (id) {
getPath(id);
getPath(id, pathId);
}
$('.map-container').css('transform', 'none');
$('.map-container').attr('data-id', id);
$('.map-container').attr('data-path-id', pathId);
$('#roadId').val(id);
$('.force').hide();
/*$.ajax({
......@@ -127,6 +131,27 @@ $(document).ready(function () {
})*/
});
// 新增路线
$('body').on('click', '.add-new', function () {
var parent = $(this).parent();
var id = parent.attr('data-id');
var pathId = -1;
var name = parent.attr('data-name');
$('#roadName').text(name);
if (!name) {
layer.msg('请填写项目名称再进行编辑', {icon: 3, time: 1500});
return;
}
if (id) {
getPath(id, pathId);
}
$('.map-container').css('transform', 'none');
$('.map-container').attr('data-id', id);
$('.map-container').attr('data-path-id', pathId);
$('#roadId').val(id);
$('.force').hide();
});
$('body').on('click','.map-data .edit',function () {
$(this).hide();
$('.save').fadeIn();
......@@ -156,6 +181,17 @@ function uploadFile(obj) {
var reads = new FileReader();
logoFile = obj.files[0];
var dataId = $(obj).parent().parent().parent().attr('data-id');
var pathId = $(obj).parent().parent().parent().attr('data-path-id');
var pathName = $('#pathName').val();
if(pathName == ''){
layer.msg('请输入路线名称!');
return false;
}
var suffix = logoFile.name.substr(logoFile.name.lastIndexOf(".")+1);
if("gpx" != suffix && "kml" !=suffix){
layer.msg('文件格式不正确!');
return false;
}
reads.readAsDataURL(logoFile);
reads.onload = function (e) {
//将处理完的图片文件上传到阿里云服务器
......@@ -176,7 +212,7 @@ function uploadFile(obj) {
$('.equip-item[data-id=' + dataId + ']').attr('data-file-url', res.result);
$('.equip-item[data-id=' + dataId + ']').attr('data-file-size', logoFile.size / 1024);
$('#gpsName').text(logoFile.name);
saveRoad(dataId, logoFile.name, res.result, logoFile.size / 1024);
saveRoad(dataId, pathId, pathName, logoFile.name, res.result, logoFile.size / 1024);
clearLayers()
loadGps(res.result);
// $('.equip-item[data-id='+dataId+']').find('.edit-new').trigger('click');
......@@ -199,12 +235,14 @@ function loadGps(fileurl) {
})
};
function saveRoad(id, fileName, fileUrl, fileSize) {
function saveRoad(id, pathId, pathName, fileName, fileUrl, fileSize) {
// layer.msg('更新路线数据库',{icon:3,time:1500});
$.ajax({
url: '/gk/road/save',
data: {
'roadId': id,
'pathId': pathId,
'pathName': pathName,
'fileName': fileName,
'fileUrl': fileUrl,
'name': name,
......@@ -218,7 +256,7 @@ function saveRoad(id, fileName, fileUrl, fileSize) {
$('.map-container').css('transform', 'none');
$('.map-container').attr('data-id', data.content.roadId);
$('.force').hide();
getPlaceMakers(id);
getPlaceMakers(id, pathId);
}
}
})
......@@ -297,24 +335,24 @@ function clearLayers() {
});
layers = [];
}
function getPath(roadId) {
function getPath(roadId, pathId) {
$.ajax({
url: '/gk/road/gps/' + roadId,
url: '/gk/road/gps/' + roadId + '/' + pathId,
success: function (data) {
// map.instance.remove();
map.initMap();
if (data.status && data.content) {
createPath(data.content);
getPlaceMakers(roadId);
getPlaceMakers(roadId, pathId);
}
}
})
}
function getPlaceMakers(roadId) {
function getPlaceMakers(roadId, pathId) {
$.ajax({
url : '/gk/road//getCheckPoints/'+roadId,
url : '/gk/road//getCheckPoints/'+roadId + '?pathId=' + pathId,
success:function (data) {
if(data.code == 200){
$('.markers .marker').remove();
......@@ -348,7 +386,7 @@ function getPlaceMakers(roadId) {
if(j==i){
continue;
}else{
editCpDisHtml += '<div class="editCpDis-box" road-id="'+roadId+'">' +
editCpDisHtml += '<div class="editCpDis-box" road-id="'+roadId+'" path-id="'+pathId+'">' +
' <div class="dis-name">' +
e.name+'-'+data.content[j].name +
' </div>' +
......@@ -361,17 +399,18 @@ function getPlaceMakers(roadId) {
});
// 初始化智能步道数据
initCpDis(editCpDisHtml, roadId);
initCpDis(editCpDisHtml, roadId, pathId);
}
}
})
}
// 查询智能步道数据
function initCpDis(initHtml, roadId) {
function initCpDis(initHtml, roadId, pathId) {
$.ajax({
url : '/gk/road/getCpDis/'+roadId,
url : '/gk/road/getCpDis/'+roadId + '/' +pathId,
success:function (data) {
debugger;
if(data.code == 200){
if(data.content.length<=0) { // 无数据,初始化
$("#editCpDisBtn").css("display","inline-block");
......@@ -379,7 +418,7 @@ function initCpDis(initHtml, roadId) {
} else {
var editCpDisHtml = "";
$.each(data.content, function (i, e) {
editCpDisHtml += '<div class="editCpDis-box" road-id="'+roadId+'">' +
editCpDisHtml += '<div class="editCpDis-box" road-id="'+roadId+'" path-id="'+pathId+'">' +
' <div class="dis-name">' +
e.disPointName +
' </div>' +
......@@ -403,9 +442,10 @@ function saveCpDis() {
var cmptId = getCmptId();
$.each($(".editCpDis-box"), function (index ,item) {
var roadId = $(item).attr("road-id");
var pathId = $(item).attr("path-id");
var disPoint = $(item).find("input").attr('name');
var distance = $(item).find("input").val()?$(item).find("input").val():0;
var obj = {cmptId: cmptId, roadId: roadId, disPoint: disPoint, distance: distance * 1000};
var obj = {cmptId: cmptId, roadId: roadId, pathId: pathId, disPoint: disPoint, distance: distance * 1000};
arr.push(obj);
})
if(arr.length<=0) {
......
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