Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hooloo
ms
soss
Commits
0db6895d
Commit
0db6895d
authored
Jul 05, 2022
by
weijiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、小程序查询店铺返回真实距离字段
2、小程序我的消息按创建时间倒序
parent
a0410832
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
8 deletions
+26
-8
soss-framework/src/main/java/com/soss/framework/web/service/WeixinServiceImpl.java
+2
-0
soss-system/src/main/java/com/soss/system/domain/Shop.java
+10
-0
soss-system/src/main/java/com/soss/system/service/impl/AppServiceImpl.java
+13
-8
soss-system/src/main/resources/mapper/system/WechatMessageMapper.xml
+1
-0
No files found.
soss-framework/src/main/java/com/soss/framework/web/service/WeixinServiceImpl.java
View file @
0db6895d
...
@@ -569,6 +569,8 @@ public class WeixinServiceImpl {
...
@@ -569,6 +569,8 @@ public class WeixinServiceImpl {
if
(
StringUtils
.
isNotEmpty
(
lng
)&&
StringUtils
.
isNotEmpty
(
lat
)){
if
(
StringUtils
.
isNotEmpty
(
lng
)&&
StringUtils
.
isNotEmpty
(
lat
)){
String
aa
=
AppServiceImpl
.
GetDistance
(
Double
.
parseDouble
(
lng
),
Double
.
parseDouble
(
lat
),
Double
.
parseDouble
(
shop1
.
getLng
()),
Double
.
parseDouble
(
shop1
.
getLat
()));
String
aa
=
AppServiceImpl
.
GetDistance
(
Double
.
parseDouble
(
lng
),
Double
.
parseDouble
(
lat
),
Double
.
parseDouble
(
shop1
.
getLng
()),
Double
.
parseDouble
(
shop1
.
getLat
()));
shop1
.
setDistance
(
aa
);
shop1
.
setDistance
(
aa
);
double
realDistance
=
AppServiceImpl
.
GetRealDistance
(
Double
.
parseDouble
(
lng
),
Double
.
parseDouble
(
lat
),
Double
.
parseDouble
(
shop1
.
getLng
()),
Double
.
parseDouble
(
shop1
.
getLat
()));
shop1
.
setRealDistance
(
realDistance
);
}
else
{
}
else
{
shop1
.
setDistance
(
"-1"
);
shop1
.
setDistance
(
"-1"
);
}
}
...
...
soss-system/src/main/java/com/soss/system/domain/Shop.java
View file @
0db6895d
...
@@ -87,6 +87,8 @@ public class Shop extends BaseEntity
...
@@ -87,6 +87,8 @@ public class Shop extends BaseEntity
private
String
distance
;
private
String
distance
;
private
double
realDistance
;
private
String
machieStatus
;
private
String
machieStatus
;
/** 创建时间 */
/** 创建时间 */
...
@@ -293,6 +295,14 @@ public class Shop extends BaseEntity
...
@@ -293,6 +295,14 @@ public class Shop extends BaseEntity
return
isDefault
;
return
isDefault
;
}
}
public
double
getRealDistance
()
{
return
realDistance
;
}
public
void
setRealDistance
(
double
realDistance
)
{
this
.
realDistance
=
realDistance
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
...
...
soss-system/src/main/java/com/soss/system/service/impl/AppServiceImpl.java
View file @
0db6895d
...
@@ -45,14 +45,7 @@ public class AppServiceImpl {
...
@@ -45,14 +45,7 @@ public class AppServiceImpl {
*/
*/
public
static
String
GetDistance
(
double
lng1
,
double
lat1
,
double
lng2
,
double
lat2
)
public
static
String
GetDistance
(
double
lng1
,
double
lat1
,
double
lng2
,
double
lat2
)
{
{
double
radLat1
=
rad
(
lat1
);
double
s
=
GetRealDistance
(
lng1
,
lat1
,
lng2
,
lat2
);
double
radLat2
=
rad
(
lat2
);
double
a
=
radLat1
-
radLat2
;
double
b
=
rad
(
lng1
)
-
rad
(
lng2
);
double
s
=
2
*
Math
.
asin
(
Math
.
sqrt
(
Math
.
pow
(
Math
.
sin
(
a
/
2
),
2
)
+
Math
.
cos
(
radLat1
)*
Math
.
cos
(
radLat2
)*
Math
.
pow
(
Math
.
sin
(
b
/
2
),
2
)));
s
=
s
*
EARTH_RADIUS
;
s
=
Math
.
round
(
s
*
10000
)
/
10000
;
String
distance
=
null
;
String
distance
=
null
;
if
(
s
>
1000
&&
s
<
10000
){
if
(
s
>
1000
&&
s
<
10000
){
DecimalFormat
df
=
new
DecimalFormat
(
"######0.0"
);
DecimalFormat
df
=
new
DecimalFormat
(
"######0.0"
);
...
@@ -69,6 +62,18 @@ public class AppServiceImpl {
...
@@ -69,6 +62,18 @@ public class AppServiceImpl {
return
aDouble
.
intValue
()+
"m"
;
return
aDouble
.
intValue
()+
"m"
;
}
}
}
}
public
static
double
GetRealDistance
(
double
lng1
,
double
lat1
,
double
lng2
,
double
lat2
)
{
double
radLat1
=
rad
(
lat1
);
double
radLat2
=
rad
(
lat2
);
double
a
=
radLat1
-
radLat2
;
double
b
=
rad
(
lng1
)
-
rad
(
lng2
);
double
s
=
2
*
Math
.
asin
(
Math
.
sqrt
(
Math
.
pow
(
Math
.
sin
(
a
/
2
),
2
)
+
Math
.
cos
(
radLat1
)*
Math
.
cos
(
radLat2
)*
Math
.
pow
(
Math
.
sin
(
b
/
2
),
2
)));
s
=
s
*
EARTH_RADIUS
;
s
=
Math
.
round
(
s
*
10000
)
/
10000
;
return
s
;
}
private
static
double
rad
(
double
d
)
private
static
double
rad
(
double
d
)
{
{
...
...
soss-system/src/main/resources/mapper/system/WechatMessageMapper.xml
View file @
0db6895d
...
@@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"isDeleted != null and isDeleted != ''"
>
and is_deleted = #{isDeleted}
</if>
<if
test=
"isDeleted != null and isDeleted != ''"
>
and is_deleted = #{isDeleted}
</if>
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
order by createdAt desc
</where>
</where>
</select>
</select>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment