Commit 7cfd95c8 authored by duandi's avatar duandi

智能步道功能添加,项目打包配置修改

parent f84952e9
...@@ -372,6 +372,8 @@ ...@@ -372,6 +372,8 @@
<groupId>com.qiyuesuo.sdk</groupId> <groupId>com.qiyuesuo.sdk</groupId>
<artifactId>sdk-java</artifactId> <artifactId>sdk-java</artifactId>
<version>3.3.2</version> <version>3.3.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/sdk-java-3.3.2.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.neusoft.shg3.service</groupId> <groupId>com.neusoft.shg3.service</groupId>
...@@ -409,10 +411,18 @@ ...@@ -409,10 +411,18 @@
<build> <build>
<finalName>gksite</finalName> <finalName>gksite</finalName>
<resources> <resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
<resource> <resource>
<directory>src/main/java</directory> <directory>src/main/java</directory>
<includes> <includes>
<include>**/*.xml</include> <include>**/*.xml</include>
<include>**/*.properties</include>
<include>**/*.yml</include>
</includes> </includes>
</resource> </resource>
<resource> <resource>
...@@ -420,6 +430,13 @@ ...@@ -420,6 +430,13 @@
<!--注意此次必须要放在此目录下才能被访问到 --> <!--注意此次必须要放在此目录下才能被访问到 -->
<targetPath>META-INF/resources</targetPath> <targetPath>META-INF/resources</targetPath>
</resource> </resource>
<resource>
<directory>src/main/webapp/WEB-INF/lib</directory>
<targetPath>/BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</resources> </resources>
<plugins> <plugins>
<plugin> <plugin>
...@@ -441,4 +458,4 @@ ...@@ -441,4 +458,4 @@
</plugins> </plugins>
</build> </build>
</project> </project>
\ No newline at end of file
package com.dlbridge.jadp.plugins.cmpt.bean;
import lombok.Data;
import java.util.Date;
@Data
public class CmptCheckPointDis {
private Integer id;
private Integer cmptId;
private Integer roadId;
private String disPoint;
private String disPointName;
private Integer distance;
private String isDelete;
private Date createTime;
private Date updateTime;
}
package com.dlbridge.jadp.plugins.cmpt.dao.mapper;
import com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis;
import java.util.List;
public interface CmptCheckPointDisMapper {
List<CmptCheckPointDis> queryList(CmptCheckPointDis cmptCheckPointDis);
void save(CmptCheckPointDis cmptCheckPointDis);
void update(CmptCheckPointDis cmptCheckPointDis);
void deleteByRoadId(Integer roadId);
int isExistByRoadAndPoint(CmptCheckPointDis cmptCheckPointDis);
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.CmptCheckPointDisMapper">
<resultMap id="baseMap" type="com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis">
<id column="id" property="id" />
<result column="cmptId" property="cmptId" />
<result column="roadId" property="roadId" />
<result column="dis_point" property="disPoint" />
<result column="dis_point_name" property="disPointName" />
<result column="distance" property="distance" />
<result column="is_delete" property="isDelete" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<select id="queryList" parameterType="com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis" resultMap="baseMap">
select d.id ,
d.cmptId,
d.roadId,
d.dis_point,
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
from gk_cmpt_checkpoint_dis d
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="cmptId != null">
and cmptId = #{cmptId}
</if>
<if test="roadId != null">
and roadId = #{roadId}
</if>
<if test="disPoint != null and disPoint != ''">
and dis_point = #{disPoint}
</if>
<if test="distance != null">
and distance = #{distance}
</if>
<if test="isDelete != null and isDelete != ''">
and is_delete = #{isDelete}
</if>
</where>
</select>
<update id="update" parameterType="com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis">
update gk_cmpt_checkpoint_dis set distance = #{distance}, update_time = now()
where roadId = #{roadId}
and dis_point = #{disPoint}
and is_delete = '0'
</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)
</update>
<delete id="deleteByRoadId" parameterType="int">
update gk_cmpt_checkpoint_dis set is_delete = '1'
where roadId = #{roadId}
</delete>
<select id="isExistByRoadAndPoint" parameterType="com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis" resultType="int">
select count(1) from gk_cmpt_checkpoint_dis where is_delete= '0' and roadId = #{roadId} and dis_point = #{disPoint}
</select>
</mapper>
package com.dlbridge.jadp.plugins.cmpt.service;
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.List;
/**
* 智能步道接口
*/
@Service
@Log4j2
public class CmptCheckPointDisService {
@Resource
private CmptCheckPointDisMapper cmptCheckPointDisMapper;
public List<CmptCheckPointDis> queryList(CmptCheckPointDis cmptCheckPointDis) {
cmptCheckPointDis.setIsDelete("0");
return cmptCheckPointDisMapper.queryList(cmptCheckPointDis);
}
public void saveOrUpdate(List<CmptCheckPointDis> list) {
if(list != null && list.size()>0) {
for (CmptCheckPointDis item: list) {
if(cmptCheckPointDisMapper.isExistByRoadAndPoint(item)>0) { // 存在
cmptCheckPointDisMapper.update(item);
} else {
cmptCheckPointDisMapper.save(item);
}
}
}
}
public void deleteByRoad(Integer roadId) {
cmptCheckPointDisMapper.deleteByRoadId(roadId);
}
}
...@@ -5,9 +5,11 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,9 +5,11 @@ import com.alibaba.fastjson.JSONObject;
import com.dlbridge.feign.GeexekScoreService; import com.dlbridge.feign.GeexekScoreService;
import com.dlbridge.feign.bean.CmptScoreCheckpoint; import com.dlbridge.feign.bean.CmptScoreCheckpoint;
import com.dlbridge.jadp.common.interceptor.PageView; import com.dlbridge.jadp.common.interceptor.PageView;
import com.dlbridge.jadp.plugins.cmpt.bean.CmptCheckPointDis;
import com.dlbridge.jadp.plugins.cmpt.bean.Road; import com.dlbridge.jadp.plugins.cmpt.bean.Road;
import com.dlbridge.jadp.plugins.cmpt.bean.RoadGpsPoint; import com.dlbridge.jadp.plugins.cmpt.bean.RoadGpsPoint;
import com.dlbridge.jadp.plugins.cmpt.dao.model.Cmpt; import com.dlbridge.jadp.plugins.cmpt.dao.model.Cmpt;
import com.dlbridge.jadp.plugins.cmpt.service.CmptCheckPointDisService;
import com.dlbridge.jadp.plugins.cmpt.service.CmptService; import com.dlbridge.jadp.plugins.cmpt.service.CmptService;
import com.dlbridge.jadp.plugins.cmpt.service.RoadService; import com.dlbridge.jadp.plugins.cmpt.service.RoadService;
import com.neusoft.www.utils.web.Result; import com.neusoft.www.utils.web.Result;
...@@ -39,6 +41,9 @@ public class RoadController { ...@@ -39,6 +41,9 @@ public class RoadController {
@Resource @Resource
GeexekScoreService geexekScoreService; GeexekScoreService geexekScoreService;
@Resource
private CmptCheckPointDisService cmptCheckPointDisService;
@RequestMapping("index/{cmptId}") @RequestMapping("index/{cmptId}")
@PageView @PageView
public ModelAndView index(@PathVariable("cmptId") Integer cmptId, ModelAndView mv) { public ModelAndView index(@PathVariable("cmptId") Integer cmptId, ModelAndView mv) {
...@@ -100,6 +105,8 @@ public class RoadController { ...@@ -100,6 +105,8 @@ public class RoadController {
} }
geexekScoreService.batchInsert(list); geexekScoreService.batchInsert(list);
int count = roadService.saveOrUpdate(road); int count = roadService.saveOrUpdate(road);
// 删除智能步道数据
cmptCheckPointDisService.deleteByRoad(road.getRoadId());
return Result.success().setContent(road); return Result.success().setContent(road);
} }
...@@ -131,4 +138,18 @@ public class RoadController { ...@@ -131,4 +138,18 @@ public class RoadController {
return Result.success().setContent(gps); return Result.success().setContent(gps);
} }
@RequestMapping("getCpDis/{roadId}")
@ResponseBody
public Result getCpDis(@PathVariable("roadId") Integer roadId) {
CmptCheckPointDis cmptCheckPointDis = new CmptCheckPointDis();
cmptCheckPointDis.setRoadId(roadId);
return Result.success().setContent(cmptCheckPointDisService.queryList(cmptCheckPointDis));
}
@RequestMapping("saveCpDis")
@ResponseBody
public Result saveCpDis(@RequestBody ArrayList<CmptCheckPointDis> cpDisList) {
cmptCheckPointDisService.saveOrUpdate(cpDisList);
return Result.success();
}
} }
package com.dlbridge.jadp.plugins.geetest;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.Socket;
import java.net.URL;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.log4j.Logger;
public class GeetestLib {
private static Logger logger = Logger.getLogger(GeetestLib.class);
protected final String verName = "3.2.0";
protected final String sdkLang = "java";
protected final String apiUrl = "http://api.geetest.com";
protected final String baseUrl = "api.geetest.com";
protected final String registerUrl = "/register.php";
protected final String validateUrl = "/validate.php";
public static final String fn_geetest_challenge = "geetest_challenge";
public static final String fn_geetest_validate = "geetest_validate";
public static final String fn_geetest_seccode = "geetest_seccode";
private String captchaId = "";
private String privateKey = "";
private String userId = "";
private String responseStr = "";
public boolean debugCode = true;
public String gtServerStatusSessionKey = "gt_server_status";
public GeetestLib(String captchaId, String privateKey) {
this.captchaId = captchaId;
this.privateKey = privateKey;
}
public String getResponseStr() {
return this.responseStr;
}
public String getVersionInfo() {
return "3.2.0";
}
private String getFailPreProcessRes() {
Long rnd1 = Math.round(Math.random() * 100.0D);
Long rnd2 = Math.round(Math.random() * 100.0D);
String md5Str1 = this.md5Encode(rnd1 + "");
String md5Str2 = this.md5Encode(rnd2 + "");
String challenge = md5Str1 + md5Str2.substring(0, 2);
return String.format("{\"success\":%s,\"gt\":\"%s\",\"challenge\":\"%s\"}", 0, this.captchaId, challenge);
}
private String getSuccessPreProcessRes(String challenge) {
this.gtlog("challenge:" + challenge);
return String.format("{\"success\":%s,\"gt\":\"%s\",\"challenge\":\"%s\"}", 1, this.captchaId, challenge);
}
public int preProcess() {
if (this.registerChallenge() != 1) {
this.responseStr = this.getFailPreProcessRes();
return 0;
} else {
return 1;
}
}
public int preProcess(String userid) {
this.userId = userid;
return this.preProcess();
}
private int registerChallenge() {
try {
String GET_URL = "http://api.geetest.com/register.php?gt=" + this.captchaId;
if (this.userId != "") {
GET_URL = GET_URL + "&user_id=" + this.userId;
this.userId = "";
}
this.gtlog("GET_URL:" + GET_URL);
String result_str = this.readContentFromGet(GET_URL);
this.gtlog("register_result:" + result_str);
if (32 == result_str.length()) {
this.responseStr = this.getSuccessPreProcessRes(this.md5Encode(result_str + this.privateKey));
return 1;
} else {
this.gtlog("gtServer register challenge failed");
return 0;
}
} catch (Exception var3) {
this.gtlog("exception:register api");
return 0;
}
}
private String readContentFromGet(String getURL) throws IOException {
URL getUrl = new URL(getURL);
HttpURLConnection connection = (HttpURLConnection)getUrl.openConnection();
connection.setConnectTimeout(2000);
connection.setReadTimeout(2000);
connection.connect();
StringBuffer sBuffer = new StringBuffer();
InputStream inStream = null;
byte[] buf = new byte[1024];
inStream = connection.getInputStream();
int n;
while((n = inStream.read(buf)) != -1) {
sBuffer.append(new String(buf, 0, n, "UTF-8"));
}
inStream.close();
connection.disconnect();
return sBuffer.toString();
}
protected boolean objIsEmpty(Object gtObj) {
if (gtObj == null) {
return true;
} else {
return gtObj.toString().trim().length() == 0;
}
}
private boolean resquestIsLegal(String challenge, String validate, String seccode) {
if (this.objIsEmpty(challenge)) {
return false;
} else if (this.objIsEmpty(validate)) {
return false;
} else {
return !this.objIsEmpty(seccode);
}
}
public int enhencedValidateRequest(String challenge, String validate, String seccode) {
if (!this.resquestIsLegal(challenge, validate, seccode)) {
return 0;
} else {
this.gtlog("request legitimate");
String host = "api.geetest.com";
String path = "/validate.php";
int port = 80;
Object[] var10001 = new Object[]{seccode, null};
StringBuilder var10004 = new StringBuilder();
this.getClass();
var10004 = var10004.append("java").append("_");
this.getClass();
var10001[1] = var10004.append("3.2.0").toString();
String query = String.format("seccode=%s&sdk=%s", var10001);
String response = "";
if (this.userId != "") {
query = query + "&user_id=" + this.userId;
this.userId = "";
}
this.gtlog(query);
try {
if (validate.length() <= 0) {
return 0;
}
if (!this.checkResultByPrivate(challenge, validate)) {
return 0;
}
this.gtlog("checkResultByPrivate");
response = this.postValidate(host, path, query, port);
this.gtlog("response: " + response);
} catch (Exception var10) {
logger.error(var10.getMessage(), var10);
}
this.gtlog("md5: " + this.md5Encode(seccode));
return response.equals(this.md5Encode(seccode)) ? 1 : 0;
}
}
public int enhencedValidateRequest(String challenge, String validate, String seccode, String userid) {
this.userId = userid;
return this.enhencedValidateRequest(challenge, validate, seccode);
}
public int failbackValidateRequest(String challenge, String validate, String seccode) {
this.gtlog("in failback validate");
if (!this.resquestIsLegal(challenge, validate, seccode)) {
return 0;
} else {
this.gtlog("request legitimate");
String[] validateStr = validate.split("_");
String encodeAns = validateStr[0];
String encodeFullBgImgIndex = validateStr[1];
String encodeImgGrpIndex = validateStr[2];
this.gtlog(String.format("encode----challenge:%s--ans:%s,bg_idx:%s,grp_idx:%s", challenge, encodeAns, encodeFullBgImgIndex, encodeImgGrpIndex));
int decodeAns = this.decodeResponse(challenge, encodeAns);
int decodeFullBgImgIndex = this.decodeResponse(challenge, encodeFullBgImgIndex);
int decodeImgGrpIndex = this.decodeResponse(challenge, encodeImgGrpIndex);
this.gtlog(String.format("decode----ans:%s,bg_idx:%s,grp_idx:%s", decodeAns, decodeFullBgImgIndex, decodeImgGrpIndex));
int validateResult = this.validateFailImage(decodeAns, decodeFullBgImgIndex, decodeImgGrpIndex);
return validateResult;
}
}
private int validateFailImage(int ans, int full_bg_index, int img_grp_index) {
String full_bg_name = this.md5Encode(full_bg_index + "").substring(0, 9);
String bg_name = this.md5Encode(img_grp_index + "").substring(10, 19);
String answer_decode = "";
for(int i = 0; i < 9; ++i) {
if (i % 2 == 0) {
answer_decode = answer_decode + full_bg_name.charAt(i);
} else if (i % 2 == 1) {
answer_decode = answer_decode + bg_name.charAt(i);
} else {
this.gtlog("exception");
}
}
String x_decode = answer_decode.substring(4, answer_decode.length());
int x_int = Integer.valueOf(x_decode, 16);
int result = x_int % 200;
if (result < 40) {
result = 40;
}
if (Math.abs(ans - result) <= 3) {
return 1;
} else {
return 0;
}
}
private int decodeResponse(String challenge, String string) {
if (string.length() > 100) {
return 0;
} else {
int[] shuzi = new int[]{1, 2, 5, 10, 50};
String chongfu = "";
HashMap<String, Integer> key = new HashMap();
int count = 0;
int res;
for(res = 0; res < challenge.length(); ++res) {
String item = challenge.charAt(res) + "";
if (!chongfu.contains(item)) {
int value = shuzi[count % 5];
chongfu = chongfu + item;
++count;
key.put(item, value);
}
}
res = 0;
for(int j = 0; j < string.length(); ++j) {
res += (Integer)key.get(string.charAt(j) + "");
}
res -= this.decodeRandBase(challenge);
return res;
}
}
private int decodeRandBase(String challenge) {
String base = challenge.substring(32, 34);
ArrayList<Integer> tempArray = new ArrayList();
int decodeRes;
for(decodeRes = 0; decodeRes < base.length(); ++decodeRes) {
char tempChar = base.charAt(decodeRes);
Integer tempAscii = Integer.valueOf(tempChar);
Integer result = tempAscii > 57 ? tempAscii - 87 : tempAscii - 48;
tempArray.add(result);
}
decodeRes = (Integer)tempArray.get(0) * 36 + (Integer)tempArray.get(1);
return decodeRes;
}
public void gtlog(String message) {
if (this.debugCode) {
System.out.println("gtlog: " + message);
}
}
protected boolean checkResultByPrivate(String challenge, String validate) {
String encodeStr = this.md5Encode(this.privateKey + "geetest" + challenge);
return validate.equals(encodeStr);
}
protected String postValidate(String host, String path, String data, int port) throws Exception {
String response = "error";
InetAddress addr = InetAddress.getByName(host);
Socket socket = new Socket(addr, port);
BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "UTF8"));
wr.write("POST " + path + " HTTP/1.0\r\n");
wr.write("Host: " + host + "\r\n");
wr.write("Content-Type: application/x-www-form-urlencoded\r\n");
wr.write("Content-Length: " + data.length() + "\r\n");
wr.write("\r\n");
wr.write(data);
wr.flush();
BufferedReader rd;
String line;
for(rd = new BufferedReader(new InputStreamReader(socket.getInputStream(), "UTF-8")); (line = rd.readLine()) != null; response = line) {
}
wr.close();
rd.close();
socket.close();
return response;
}
private String md5Encode(String plainText) {
String re_md5 = new String();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plainText.getBytes());
byte[] b = md.digest();
StringBuffer buf = new StringBuffer("");
for(int offset = 0; offset < b.length; ++offset) {
int i = b[offset];
if (i < 0) {
i += 256;
}
if (i < 16) {
buf.append("0");
}
buf.append(Integer.toHexString(i));
}
re_md5 = buf.toString();
} catch (NoSuchAlgorithmException var8) {
logger.error(var8.getMessage(), var8);
}
return re_md5;
}
}
...@@ -48,7 +48,7 @@ spring.data.web.pageable.max-page-size=100 ...@@ -48,7 +48,7 @@ spring.data.web.pageable.max-page-size=100
weixin.micro.appid=wx96ce27826f39cdb3 weixin.micro.appid=wx96ce27826f39cdb3
weixin.micro.secret=11bfc4902e7c992b57a2cdcfeded623f weixin.micro.secret=11bfc4902e7c992b57a2cdcfeded623f
geexek.user.url=https://test.geexek.com.cn/ geexek.user.url=https://test.geexek.com.cn/
geexek.cmpt.url=https://testtimerbackend.geexek.cn/ geexek.cmpt.url=http://testtimerbackend.geexek.cn/
geexek.shamus.url=http://shamus.geexek.com.cn/ geexek.shamus.url=http://shamus.geexek.com.cn/
timer.url=http://testtimer.geexek.cn/ timer.url=http://testtimer.geexek.cn/
...@@ -98,7 +98,7 @@ spring.cloud.sentinel.skip-keys=cmptId ...@@ -98,7 +98,7 @@ spring.cloud.sentinel.skip-keys=cmptId
spring.cloud.sentinel.exclude-urls=/static/**,**.css,**.js spring.cloud.sentinel.exclude-urls=/static/**,**.css,**.js
## nacos 地址 ## nacos 地址
spring.cloud.sentinel.datasource.ds.nacos.server-addr=192.168.0.100:8848 spring.cloud.sentinel.datasource.ds.nacos.server-addr=192.168.31.133:8848
spring.cloud.sentinel.datasource.ds.nacos.dataId=micro-gksite-sentinel 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.data-type=json
spring.cloud.sentinel.datasource.ds.nacos.groupId=dev spring.cloud.sentinel.datasource.ds.nacos.groupId=dev
...@@ -116,4 +116,4 @@ lock.accessSecret=W6PysadsbPppDfts18ukZBUJ2GPkQZ ...@@ -116,4 +116,4 @@ lock.accessSecret=W6PysadsbPppDfts18ukZBUJ2GPkQZ
lock.categoryId=2816977402314363323 lock.categoryId=2816977402314363323
lock.companyReceiver=18201908070 lock.companyReceiver=18201908070
upload.rmi=rmi://172.16.214.236:9125/RMIUpload upload.rmi=rmi://172.16.214.236:9125/RMIUpload
\ No newline at end of file
...@@ -4,11 +4,11 @@ spring: ...@@ -4,11 +4,11 @@ spring:
cloud: cloud:
nacos: nacos:
config: config:
server-addr: http://192.168.0.100:8848 server-addr: http://192.168.31.133:8848
file-extension: properties file-extension: properties
group: dev group: dev
namespace: 187c2f4d-80c2-4a67-b4e5-319d5c9151d1 namespace: 187c2f4d-80c2-4a67-b4e5-319d5c9151d1
server-addr: http://192.168.0.100:8848 server-addr: http://192.168.31.133:8848
discovery: discovery:
group: dev group: dev
namespace: 187c2f4d-80c2-4a67-b4e5-319d5c9151d1 namespace: 187c2f4d-80c2-4a67-b4e5-319d5c9151d1
...@@ -18,11 +18,11 @@ spring: ...@@ -18,11 +18,11 @@ spring:
cloud: cloud:
nacos: nacos:
config: config:
server-addr: http://192.168.0.100:8848 server-addr: http://192.168.31.133:8848
file-extension: properties file-extension: properties
group: dev group: dev
namespace: 187c2f4d-80c2-4a67-b4e5-319d5c9151d1 namespace: 187c2f4d-80c2-4a67-b4e5-319d5c9151d1
server-addr: http://192.168.0.100:8848 server-addr: http://192.168.31.133:8848
discovery: discovery:
group: dev group: dev
namespace: 187c2f4d-80c2-4a67-b4e5-319d5c9151d1 namespace: 187c2f4d-80c2-4a67-b4e5-319d5c9151d1
...@@ -53,4 +53,4 @@ spring: ...@@ -53,4 +53,4 @@ spring:
server-addr: http://172.16.214.237:9848,http://172.16.214.241:9848,http://172.16.214.242:9848 server-addr: http://172.16.214.237:9848,http://172.16.214.241:9848,http://172.16.214.242:9848
discovery: discovery:
group: production group: production
namespace: 1bc7c9a2-3cd3-4223-bf3d-17c10a8a501b namespace: 1bc7c9a2-3cd3-4223-bf3d-17c10a8a501b
\ No newline at end of file
...@@ -32,7 +32,18 @@ ...@@ -32,7 +32,18 @@
<script type="text/javascript" src="${ctxStatic}/leaflet/label.js"></script> <script type="text/javascript" src="${ctxStatic}/leaflet/label.js"></script>
<script type="text/javascript" charset="utf-8" src="${ctxStatic}/layer/layer.js"></script> <script type="text/javascript" charset="utf-8" src="${ctxStatic}/layer/layer.js"></script>
<link rel="stylesheet" href="${ctxStatic}/layer/skin/layer.css"> <link rel="stylesheet" href="${ctxStatic}/layer/skin/layer.css">
<script src="${ctxStatic}/newdermon/vendor/bootstrap/js/bootstrap.js"></script>
</head> </head>
<style type="text/css">
.editCpDis-box {
display: flex;
justify-content: space-around;
margin: 8px;
}
.dis-name {
line-height: 2rem;
}
</style>
<body> <body>
<jsp:include page="../common/header.jsp"></jsp:include> <jsp:include page="../common/header.jsp"></jsp:include>
<div class="page-content d-flex align-items-stretch main-body"> <div class="page-content d-flex align-items-stretch main-body">
...@@ -92,12 +103,15 @@ ...@@ -92,12 +103,15 @@
</div> </div>
<div class="map-title"> <div class="map-title">
<div class="flex flex-column"> <div class="flex flex-column">
<input type="hidden" id="roadId">
<span id="roadName"></span> <span id="roadName"></span>
<span id="gpsName"></span> <span id="gpsName"></span>
</div> </div>
<span class="btn right upload">载入路线</span> <div class="right">
<button type="button" class="btn upload">载入路线</button>
<input type="file" id="route-file" style="display: none;" onchange="uploadFile(this)"> <input type="file" id="route-file" style="display: none;" onchange="uploadFile(this)">
<button type="button" id="editCpDisBtn" class="btn" data-toggle="modal" data-target="#editCpDis" style="display: none;">点位距离设置</button>
</div>
</div> </div>
<div id="map" class="map"></div> <div id="map" class="map"></div>
...@@ -128,7 +142,48 @@ ...@@ -128,7 +142,48 @@
</div> </div>
</div> </div>
<div class="modal fade" id="editCpDis" tabindex="-1" role="dialog" aria-labelledby="editCpDisLabel" style="z-index: 9999999;">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header" style="display: block;">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="editCpDisLabel">间距设置(单位:KM)</h4>
</div>
<div class="modal-body">
<div id="editCpDis-list">
<%-- <div class="editCpDis-box">--%>
<%-- <div class="dis-name">--%>
<%-- 计时点1-计时点2--%>
<%-- </div>--%>
<%-- <div class="dis-input">--%>
<%-- <input type="number" name="" placeholder="单位:M" step="1" class="form-control"/>--%>
<%-- </div>--%>
<%-- </div>--%>
<%-- <div class="editCpDis-box">--%>
<%-- <div class="dis-name">--%>
<%-- 计时点1-计时--%>
<%-- </div>--%>
<%-- <div class="dis-input">--%>
<%-- <input type="number" name="" placeholder="单位:M" step="1" class="form-control"/>--%>
<%-- </div>--%>
<%-- </div>--%>
<%-- <div class="editCpDis-box">--%>
<%-- <div class="dis-name">--%>
<%-- 计时点1-计时点2121121--%>
<%-- </div>--%>
<%-- <div class="dis-input">--%>
<%-- <input type="number" name="" placeholder="单位:M" step="1" class="form-control"/>--%>
<%-- </div>--%>
<%-- </div>--%>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" onclick="saveCpDis()">保存</button>
</div>
</div>
</div>
</div>
</body> </body>
<script type="text/javascript" src="${ctxStatic}/js/road-new.js"></script> <script type="text/javascript" src="${ctxStatic}/js/road-new.js"></script>
</html> </html>
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
<option value="1" selected>提交成绩</option> <option value="1" selected>提交成绩</option>
<option value="2">扫码打卡</option> <option value="2">扫码打卡</option>
<option value="3">自动打卡</option> <option value="3">自动打卡</option>
<option value="6">智能步道</option>
</select> </select>
<span class="down-arrow"></span> <span class="down-arrow"></span>
</div> </div>
......
...@@ -268,7 +268,8 @@ ...@@ -268,7 +268,8 @@
/* cursor: pointer;*/ /* cursor: pointer;*/
/*}*/ /*}*/
.cp-div { .cp-div {
width: 48px; width: max-content;
min-width: 48px;
height: 26px; height: 26px;
background-color: #e54b3b; background-color: #e54b3b;
border-radius: 5px; border-radius: 5px;
...@@ -277,4 +278,4 @@ ...@@ -277,4 +278,4 @@
text-align: center; text-align: center;
line-height: 26px; line-height: 26px;
overflow: hidden; overflow: hidden;
} }
\ No newline at end of file
...@@ -66,6 +66,7 @@ $(document).ready(function () { ...@@ -66,6 +66,7 @@ $(document).ready(function () {
success: function (data) { success: function (data) {
if(data.code == 200){ if(data.code == 200){
layer.msg('保存成功', {icon: 1, time: 1500}); layer.msg('保存成功', {icon: 1, time: 1500});
getPath($("#roadId").val());
} }
}, error: function () { }, error: function () {
layer.msg('操作失败', {icon: 5, time: 1500}); layer.msg('操作失败', {icon: 5, time: 1500});
...@@ -102,6 +103,7 @@ $(document).ready(function () { ...@@ -102,6 +103,7 @@ $(document).ready(function () {
} }
$('.map-container').css('transform', 'none'); $('.map-container').css('transform', 'none');
$('.map-container').attr('data-id', id); $('.map-container').attr('data-id', id);
$('#roadId').val(id);
$('.force').hide(); $('.force').hide();
/*$.ajax({ /*$.ajax({
url: '/gk/road/save', url: '/gk/road/save',
...@@ -153,7 +155,7 @@ $(document).ready(function () { ...@@ -153,7 +155,7 @@ $(document).ready(function () {
function uploadFile(obj) { function uploadFile(obj) {
var reads = new FileReader(); var reads = new FileReader();
logoFile = obj.files[0]; logoFile = obj.files[0];
var dataId = $(obj).parent().parent().attr('data-id'); var dataId = $(obj).parent().parent().parent().attr('data-id');
reads.readAsDataURL(logoFile); reads.readAsDataURL(logoFile);
reads.onload = function (e) { reads.onload = function (e) {
//将处理完的图片文件上传到阿里云服务器 //将处理完的图片文件上传到阿里云服务器
...@@ -317,6 +319,10 @@ function getPlaceMakers(roadId) { ...@@ -317,6 +319,10 @@ function getPlaceMakers(roadId) {
if(data.code == 200){ if(data.code == 200){
$('.markers .marker').remove(); $('.markers .marker').remove();
$('.markers-edit .marker').remove(); $('.markers-edit .marker').remove();
// 智能步道
$("#editCpDisBtn").css("display","none");
var editCpDisHtml = "";
if(data.content.length == 0){ if(data.content.length == 0){
layer.msg("没有标记点,请导入有标记点的路线,以免影响您的后续使用!"); layer.msg("没有标记点,请导入有标记点的路线,以免影响您的后续使用!");
return return
...@@ -337,7 +343,85 @@ function getPlaceMakers(roadId) { ...@@ -337,7 +343,85 @@ function getPlaceMakers(roadId) {
'<input data-before="'+e.name+'" type="text" value="'+e.name+'">' + '<input data-before="'+e.name+'" type="text" value="'+e.name+'">' +
'<input type="number" value="'+((e.distance === '' || e.distance == null)? "0":Number(e.distance/1000).toFixed(3))+'" placeholder="单位:KM">'+ '<input type="number" value="'+((e.distance === '' || e.distance == null)? "0":Number(e.distance/1000).toFixed(3))+'" placeholder="单位:KM">'+
'<input type="checkbox" '+(e.isTime ? "checked=checked":"")+'></div>'); '<input type="checkbox" '+(e.isTime ? "checked=checked":"")+'></div>');
for (let j = 0; j < data.content.length; j++) {
if(j>i) {
editCpDisHtml += '<div class="editCpDis-box" road-id="'+roadId+'">' +
' <div class="dis-name">' +
e.name+'-'+data.content[j].name +
' </div>' +
' <div class="dis-input">' +
' <input type="number" name="'+e.checkpointId+'-'+data.content[j].checkpointId+'" placeholder="单位:KM" step="0.1" class="form-control"/>' +
' </div>' +
' </div>';
}
}
}); });
// 初始化智能步道数据
initCpDis(editCpDisHtml, roadId);
}
}
})
}
// 查询智能步道数据
function initCpDis(initHtml, roadId) {
$.ajax({
url : '/gk/road/getCpDis/'+roadId,
success:function (data) {
if(data.code == 200){
if(data.content.length<=0) { // 无数据,初始化
$("#editCpDisBtn").css("display","inline-block");
$("#editCpDis-list").html(initHtml);
} else {
var editCpDisHtml = "";
$.each(data.content, function (i, e) {
editCpDisHtml += '<div class="editCpDis-box" road-id="'+roadId+'">' +
' <div class="dis-name">' +
e.disPointName +
' </div>' +
' <div class="dis-input">' +
' <input type="number" name="'+e.disPoint+'" placeholder="单位:KM" step="0.1" class="form-control" value="'+((e.distance === '' || e.distance == null)? "0":Number(e.distance/1000).toFixed(3))+'"/>' +
' </div>' +
' </div>';
});
$("#editCpDisBtn").css("display","inline-block");
$("#editCpDis-list").html(editCpDisHtml);
}
}
}
})
}
// 保存智能步道数据
function saveCpDis() {
// 封装数据
var arr = [];
var cmptId = getCmptId();
$.each($(".editCpDis-box"), function (index ,item) {
var roadId = $(item).attr("road-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};
arr.push(obj);
})
if(arr.length<=0) {
layer.msg("没有标记点,请导入有标记点的路线,以免影响您的后续使用!");
return
}
$.ajax({
url : '/gk/road/saveCpDis',
contentType: 'application/json;charset=UTF-8',
method: 'post',
data: JSON.stringify(arr),
traditional: true,
success:function (data) {
if(data.code == 200){
layer.msg("保存成功");
$("#editCpDis").modal("hide");
} else {
layer.msg("保存失败,请稍候重试");
} }
} }
}) })
......
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