Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
android
/
dayu
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1daa5481
authored
Nov 11, 2020
by
mReturn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小绿人工单添加一公里内才能开始服务的限制
parent
4b1eae55
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
157 additions
and
44 deletions
baseSDK/src/main/java/com/dayu/common/Constants.java
baseSDK/src/main/java/com/dayu/utils/GpsUtil.java
liveModule/src/test/java/com/dayu/livemodule/ExampleUnitTest.java
locationComponent/src/main/java/com/dayu/location/base/LocationUtils.java
orderCenter/src/main/java/com/dayu/order/api/protocol/Order.java
orderCenter/src/main/java/com/dayu/order/ui/adapter/OrderAdapter.java
baseSDK/src/main/java/com/dayu/common/Constants.java
View file @
1daa5481
...
...
@@ -60,19 +60,19 @@ public class Constants {
/**
* uat测试环境配置.
*/
//
public static String ENVIROMENT = "uat";
//
public static int LOG_LEVEL = LogUtils.LEVEL_ALL;
//
public static String BASE_URL = "http://47.95.223.6:3112";
//
public static String WEB_SOP = "http://47.95.223.6:9004/#/sop";
//
public static String WEB_SOP_DETAIL = "http://47.95.223.6:9004/#/sopdetail";
//
public static String WEB_ZHI_SHI = "http://47.95.223.6:9004/#/detail";
//
public static String CHECK_MULTI_WEB_SOP = "http://47.95.223.6:9004/#/manyServiceResult";
//
public static String MULTI_WEB_SOP = "http://47.95.223.6:9004/#/manySop";
//
public static final String UP_PHOTO = "/file/uploadMore?targetPath=test/sp/mobile/android/business/checkApply";
//
public static final String UP_VIDEO = "/file/uploadVideoOne?targetPath=test/video";
//
public static final boolean IS_DEBUG = false;
//
public static String VIDEO_SHARE_URL = "http://uat.kf.ai:9099/#/shareVideo?type=_type&id="; //uat 学习视频分享链接 type(课程: course 直播: live)
//
public static int XLR_PID = 14; //小绿人商家id
public
static
String
ENVIROMENT
=
"uat"
;
public
static
int
LOG_LEVEL
=
LogUtils
.
LEVEL_ALL
;
public
static
String
BASE_URL
=
"http://47.95.223.6:3112"
;
public
static
String
WEB_SOP
=
"http://47.95.223.6:9004/#/sop"
;
public
static
String
WEB_SOP_DETAIL
=
"http://47.95.223.6:9004/#/sopdetail"
;
public
static
String
WEB_ZHI_SHI
=
"http://47.95.223.6:9004/#/detail"
;
public
static
String
CHECK_MULTI_WEB_SOP
=
"http://47.95.223.6:9004/#/manyServiceResult"
;
public
static
String
MULTI_WEB_SOP
=
"http://47.95.223.6:9004/#/manySop"
;
public
static
final
String
UP_PHOTO
=
"/file/uploadMore?targetPath=test/sp/mobile/android/business/checkApply"
;
public
static
final
String
UP_VIDEO
=
"/file/uploadVideoOne?targetPath=test/video"
;
public
static
final
boolean
IS_DEBUG
=
false
;
public
static
String
VIDEO_SHARE_URL
=
"http://uat.kf.ai:9099/#/shareVideo?type=_type&id="
;
//uat 学习视频分享链接 type(课程: course 直播: live)
public
static
int
XLR_PID
=
14
;
//小绿人商家id
...
...
@@ -80,19 +80,19 @@ public class Constants {
/**
* 正式环境.
*/
public
static
String
ENVIROMENT
=
"release"
;
public
static
int
LOG_LEVEL
=
LogUtils
.
LEVEL_OFF
;
public
static
String
BASE_URL
=
"https://mobile.kf.ai"
;
public
static
String
WEB_SOP
=
"https://sop.kf.ai/#/sop"
;
public
static
String
WEB_SOP_DETAIL
=
"https://sop.kf.ai/#/sopdetail"
;
public
static
String
WEB_ZHI_SHI
=
"https://sop.kf.ai/#/detail"
;
public
static
String
CHECK_MULTI_WEB_SOP
=
"https://sop.kf.ai/#/manyServiceResult"
;
public
static
String
MULTI_WEB_SOP
=
"https://sop.kf.ai/#/manySop"
;
public
static
final
String
UP_PHOTO
=
"/file/uploadMore?targetPath=online/sp/mobile/android/business/checkApply"
;
public
static
final
String
UP_VIDEO
=
"/file/uploadVideoOne?targetPath=online/video"
;
public
static
final
boolean
IS_DEBUG
=
false
;
public
static
String
VIDEO_SHARE_URL
=
"http://app.dl.kf.ai/ext/#/shareVideo?type=_type&id="
;
//学习视频分享链接 type(课程: course 直播: live)
public
static
int
XLR_PID
=
1936
;
//小绿人商家id
//
public static String ENVIROMENT = "release";
//
public static int LOG_LEVEL = LogUtils.LEVEL_OFF;
//
public static String BASE_URL = "https://mobile.kf.ai";
//
public static String WEB_SOP = "https://sop.kf.ai/#/sop";
//
public static String WEB_SOP_DETAIL = "https://sop.kf.ai/#/sopdetail";
//
public static String WEB_ZHI_SHI = "https://sop.kf.ai/#/detail";
//
public static String CHECK_MULTI_WEB_SOP = "https://sop.kf.ai/#/manyServiceResult";
//
public static String MULTI_WEB_SOP = "https://sop.kf.ai/#/manySop";
//
public static final String UP_PHOTO = "/file/uploadMore?targetPath=online/sp/mobile/android/business/checkApply";
//
public static final String UP_VIDEO = "/file/uploadVideoOne?targetPath=online/video";
//
public static final boolean IS_DEBUG = false;
//
public static String VIDEO_SHARE_URL = "http://app.dl.kf.ai/ext/#/shareVideo?type=_type&id="; //学习视频分享链接 type(课程: course 直播: live)
//
public static int XLR_PID = 1936; //小绿人商家id
...
...
baseSDK/src/main/java/com/dayu/utils/GpsUtil.java
0 → 100644
View file @
1daa5481
package
com
.
dayu
.
utils
;
import
android.app.PendingIntent
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.location.LocationManager
;
import
android.net.Uri
;
public
class
GpsUtil
{
/**
* 判断GPS是否开启,GPS或者AGPS开启一个就认为是开启的
* @param context
* @return true 表示开启
*/
public
static
final
boolean
isOPen
(
final
Context
context
)
{
LocationManager
locationManager
=
(
LocationManager
)
context
.
getSystemService
(
Context
.
LOCATION_SERVICE
);
// 通过GPS卫星定位,定位级别可以精确到街(通过24颗卫星定位,在室外和空旷的地方定位准确、速度快)
boolean
gps
=
locationManager
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
);
// 通过WLAN或移动网络(3G/2G)确定的位置(也称作AGPS,辅助GPS定位。主要用于在室内或遮盖物(建筑群或茂密的深林等)密集的地方定位)
boolean
network
=
locationManager
.
isProviderEnabled
(
LocationManager
.
NETWORK_PROVIDER
);
if
(
gps
||
network
)
{
return
true
;
}
return
false
;
}
/**
* 强制帮用户打开GPS
* @param context
*/
public
static
final
void
openGPS
(
Context
context
)
{
Intent
GPSIntent
=
new
Intent
();
GPSIntent
.
setClassName
(
"com.android.settings"
,
"com.android.settings.widget.SettingsAppWidgetProvider"
);
GPSIntent
.
addCategory
(
"android.intent.category.ALTERNATIVE"
);
GPSIntent
.
setData
(
Uri
.
parse
(
"custom:3"
));
try
{
PendingIntent
.
getBroadcast
(
context
,
0
,
GPSIntent
,
0
).
send
();
}
catch
(
PendingIntent
.
CanceledException
e
)
{
e
.
printStackTrace
();
}
}
}
\ No newline at end of file
liveModule/src/test/java/com/dayu/livemodule/ExampleUnitTest.java
deleted
100644 → 0
View file @
4b1eae55
package
com
.
dayu
.
livemodule
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public
class
ExampleUnitTest
{
@Test
public
void
addition_isCorrect
()
{
assertEquals
(
4
,
2
+
2
);
}
}
\ No newline at end of file
locationComponent/src/main/java/com/dayu/location/base/LocationUtils.java
View file @
1daa5481
...
...
@@ -11,6 +11,8 @@ import com.amap.api.location.AMapLocation;
import
com.amap.api.location.AMapLocationClient
;
import
com.amap.api.location.AMapLocationClientOption
;
import
com.amap.api.location.AMapLocationListener
;
import
com.amap.api.location.CoordinateConverter
;
import
com.amap.api.location.DPoint
;
import
java.io.File
;
...
...
@@ -165,4 +167,38 @@ public class LocationUtils {
public
interface
OpenMarketListener
{
void
openMarket
();
}
private
static
final
double
EARTH_RADIUS
=
6378137.0
;
/**
* 根据经纬度计算两地距离
* @param longitude
* @param latitue
* @param longitude2
* @param latitue2
* @return
*/
public
static
double
getDistance
(
double
latitue
,
double
longitude
,
double
latitue2
,
double
longitude2
){
DPoint
point1
=
new
DPoint
(
latitue
,
longitude
);
DPoint
point2
=
new
DPoint
(
latitue2
,
longitude2
);
return
CoordinateConverter
.
calculateLineDistance
(
point1
,
point2
);
// // 纬度
// double lat1 = Math.toRadians(latitue);
// double lat2 = Math.toRadians(latitue2);
// // 经度
// double lng1 = Math.toRadians(longitude);
// double lng2 = Math.toRadians(longitude2);
// // 纬度之差
// double a = lat1 - lat2;
// // 经度之差
// double b = lng1 - lng2;
// // 计算两点距离的公式
// double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
// Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(b / 2), 2)));
// // 弧长乘地球半径, 返回单位: 米
// s = s * EARTH_RADIUS;
// return s;
}
}
orderCenter/src/main/java/com/dayu/order/api/protocol/Order.java
View file @
1daa5481
...
...
@@ -63,6 +63,24 @@ public class Order implements Serializable{
private
int
version
;
private
String
greenManStatus
;
private
int
createProviderId
;
private
double
latitude
;
private
double
longitude
;
public
double
getLatitude
()
{
return
latitude
;
}
public
void
setLatitude
(
double
latitude
)
{
this
.
latitude
=
latitude
;
}
public
double
getLongitude
()
{
return
longitude
;
}
public
void
setLongitude
(
double
longitude
)
{
this
.
longitude
=
longitude
;
}
public
int
getCreateProviderId
()
{
return
createProviderId
;
...
...
orderCenter/src/main/java/com/dayu/order/ui/adapter/OrderAdapter.java
View file @
1daa5481
...
...
@@ -30,6 +30,7 @@ import com.dayu.provider.event.RefreshServe;
import
com.dayu.provider.event.RefreshTab
;
import
com.dayu.provider.router.RouterPath
;
import
com.dayu.utils.CommonUtils
;
import
com.dayu.utils.GpsUtil
;
import
com.dayu.utils.ProgressUtil
;
import
com.dayu.utils.SPUtils
;
import
com.dayu.utils.ToastUtils
;
...
...
@@ -365,6 +366,7 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi
private
void
processClick
(
Order
it
,
FragmentOrderdoingItemBinding
h
,
int
posiiton
)
{
mItem
=
it
;
mBind
=
h
;
//createdsource为2,3,4并且status为4,进行中时跳转到任务列表.
if
((
mItem
.
getCreatedSource
()
==
2
||
mItem
.
getCreatedSource
()
==
3
||
mItem
.
getCreatedSource
()
==
4
)
&&
mItem
.
getStatus
()
==
4
)
{
dumpServerActivity
(
mItem
);
...
...
@@ -382,6 +384,13 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi
if
(
mItem
.
getStatus
()
==
4
)
{
return
;
}
//小绿人工单师傅开始服务前必须开启定位开关
if
(
mItem
.
getCreateProviderId
()
==
Constants
.
XLR_PID
&&
!
GpsUtil
.
isOPen
(
mContext
)
&&
mItem
.
getLatitude
()
!=
0
&&
mItem
.
getLongitude
()
!=
0
)
{
ToastUtils
.
showShortToast
(
"请打开GPS定位开关"
);
return
;
}
if
(
mItem
.
getStatus
()
==
3
)
{
ProgressUtil
.
setCanDismiss
(
false
);
ProgressUtil
.
startLoad
(
mContext
);
...
...
@@ -394,6 +403,21 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi
latitude
=
location
.
getLatitude
();
longitude
=
location
.
getLongitude
();
}
//小绿人工单师傅在目的地一公里内才能开始服务
if
(
mItem
.
getCreateProviderId
()
==
Constants
.
XLR_PID
&&
latitude
!=
0
&&
longitude
!=
0
&&
mItem
.
getLatitude
()
!=
0
&&
mItem
.
getLongitude
()
!=
0
)
{
double
distance
=
LocationUtils
.
getDistance
(
latitude
,
longitude
,
mItem
.
getLatitude
(),
mItem
.
getLongitude
());
if
(
distance
>
1000
)
{
ToastUtils
.
showShortToast
(
"未到达目的地,无法开始服务"
);
ProgressUtil
.
stopLoad
();
return
;
}
startFirstServe
(
latitude
,
longitude
);
}
else
{
startFirstServe
(
latitude
,
longitude
);
}
// if (mItem.getSubStatus() == 1) {
// mPresenter.startOrder(mItem.getId(), latitude, longitude)
// .observeOn(AndroidSchedulers.mainThread())
...
...
@@ -410,6 +434,13 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi
// }));
// MobclickAgent.onEvent(mContext, "start_off");
// } else
}
private
void
startFirstServe
(
double
latitude
,
double
longitude
)
{
// ProgressUtil.stopLoad();
// ToastUtils.showShortToast(latitude + " " + longitude + " " );
if
(
mItem
.
getSubStatus
()
==
1
||
mItem
.
getSubStatus
()
==
2
)
{
mPresenter
.
startServer
(
mItem
.
getId
(),
latitude
,
longitude
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
...
...
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