Ver Fonte

提交类型 处理bug
提交内容 处理打卡地址微调的时候没有保存到地址的bug

Bitliker há 7 anos atrás
pai
commit
9c37ae9a14

+ 1 - 5
WeiChat/build.gradle

@@ -145,11 +145,7 @@ android {
         }
     }*/
 }
-repositories {
-    flatDir {
-        dirs 'libs', project(':faceplatform-ui').file('libs')
-    }
-}
+
 dependencies {
     compile fileTree(include: ['*.jar'], dir: 'libs')
     testCompile deps.junit

+ 4 - 1
app_core/common/src/main/java/com/core/net/location/BdLocationHelper.java

@@ -9,7 +9,6 @@ import com.baidu.location.BDLocationListener;
 import com.baidu.location.LocationClient;
 import com.baidu.location.LocationClientOption;
 import com.baidu.mapapi.model.LatLng;
-import com.common.LogUtil;
 import com.common.config.BaseConfig;
 import com.common.data.StringUtil;
 import com.common.preferences.PreferenceUtils;
@@ -183,6 +182,10 @@ public class BdLocationHelper {
 		return latLng == null ? 1 : latLng.latitude;
 	}
 
+	public LatLng getLatLng() {
+		return latLng;
+	}
+
 	// 获取地址详情
 	public String getAddress() {
 		return StringUtil.isEmpty(address) ? PreferenceUtils.getString("bdaddress") : address;

+ 37 - 7
app_modular/apputils/src/main/java/com/modular/apputils/utils/SignUtils.java

@@ -8,6 +8,8 @@ import android.text.TextUtils;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baidu.mapapi.model.LatLng;
+import com.baidu.mapapi.search.core.PoiInfo;
 import com.common.data.DateFormatUtil;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
@@ -58,6 +60,8 @@ public class SignUtils implements OnHttpResultListener {
 
 
     private SignListener mSignListener;
+    public PoiInfo localPoi;
+
 
     private long lastTime = 0;//最后一次打卡时间
 
@@ -70,8 +74,14 @@ public class SignUtils implements OnHttpResultListener {
         void sign(boolean signOk, String message);
     }
 
+    public void changeLocalPoi(PoiInfo localPoi) {
+        if (localPoi != null && localPoi.location != null && localPoi.location.latitude > 0 && localPoi.location.longitude > 0) {
+            this.localPoi = localPoi;
+        }
+    }
+
     //人脸打卡 1.先判断班次  2.判断距离
-    public  int judgeFrontFace() {
+    public int judgeFrontFace() {
         if (!MyApplication.getInstance().isNetworkActive()) {
             return R.string.networks_out;
         } else {
@@ -112,18 +122,29 @@ public class SignUtils implements OnHttpResultListener {
         if (!MyApplication.getInstance().isNetworkActive()) {
             callBack(false, StringUtil.getMessage(R.string.networks_out));
         } else {
-            //判断位置
+
             MyApplication.getInstance().getBdLocationHelper().requestLocation();
             List<WorkLocationModel> beanList = WorkLocationDao.getInstance().queryByEnCode();
             if (ListUtils.isEmpty(beanList)) {
                 callBack(false, R.string.not_addr_message);
                 //没有打卡地址,TODO 获取班次接口
             } else {
-                BdLocationHelper helper = MyApplication.getInstance().getBdLocationHelper();
+                LatLng latLng = null;
+                //判断位置
+                if (this.localPoi == null) {
+                    BdLocationHelper helper = MyApplication.getInstance().getBdLocationHelper();
+                    latLng = helper.getLatLng();
+                } else {
+                    latLng = this.localPoi.location;
+                }
+                if (latLng == null) {
+                    callBack(false, R.string.not_addr_message);
+                    return;
+                }
                 float minDis = -1;
                 for (WorkLocationModel bean : beanList) {
                     String chche = BaiduMapUtil.getInstence().getDistance(bean.getLongitude(),
-                            bean.getLatitude(), helper.getLatitude(), helper.getLongitude());
+                            bean.getLatitude(), latLng.latitude, latLng.longitude);
                     Float dis = Float.valueOf(chche);
                     if (dis < bean.getValidrange() && (minDis < 0 || dis < minDis)) {
                         minDis = dis;
@@ -160,6 +181,7 @@ public class SignUtils implements OnHttpResultListener {
         }
     }
 
+
     /*判断mac地址是否符合*/
     private void validatorMac(boolean isB2b, float minDis, WorkModel model) {
         Map<String, Object> param = new HashMap<>();
@@ -268,13 +290,21 @@ public class SignUtils implements OnHttpResultListener {
     private boolean isHasLocation(Map<String, Object> form) {
         try {
             //判断是否符合打卡
-            BdLocationHelper helper = MyApplication.getInstance().getBdLocationHelper();
-            String address = helper.getAddress();
+            String address = null;
+            String name = null;
+            if (this.localPoi == null) {
+                BdLocationHelper helper = MyApplication.getInstance().getBdLocationHelper();
+                address = helper.getAddress();
+                name = helper.getName();
+            } else {
+                name = this.localPoi.name;
+                address = this.localPoi.address;
+            }
             if (StringUtil.isEmpty(address)) {
                 address = PreferenceUtils.getString("bdaddress");
             }
             form.put("cl_address", address);
-            form.put("cl_location", helper.getName());
+            form.put("cl_location", name);
             return true;
 
         } catch (NullPointerException e) {

+ 16 - 3
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/presenter/WorkPresenter.java

@@ -225,7 +225,7 @@ public class WorkPresenter implements OnHttpResultListener {
     }
 
     //设置位置信息
-    private void setBaiduLocation() throws Exception {
+    private void setBaiduLocation() {
         boolean isLocation = MyApplication.getInstance().getBdLocationHelper().locationOk();
         if (!isLocation) {
             if (iWorkView != null) {
@@ -237,6 +237,16 @@ public class WorkPresenter implements OnHttpResultListener {
         latitude = MyApplication.getInstance().getBdLocationHelper().getLatitude();
         loaction = MyApplication.getInstance().getBdLocationHelper().getName();
         address = MyApplication.getInstance().getBdLocationHelper().getAddress();
+
+        if (mSignUtils != null) {
+            PoiInfo localPoi = new PoiInfo();
+            localPoi.name = loaction;
+            localPoi.address = address;
+            localPoi.location = new LatLng(latitude, longitude);
+            mSignUtils.changeLocalPoi(localPoi);
+        }
+
+
         if (iWorkView == null) return;
         distance = -1;
         iWorkView.showDistance(getDistance());
@@ -518,8 +528,8 @@ public class WorkPresenter implements OnHttpResultListener {
 //            } else {
 //                submitWork(models, macAddress);
 //            }
-            iWorkView.showLoading();
-            mSignUtils.sign(isB2b, null);
+        iWorkView.showLoading();
+        mSignUtils.sign(isB2b, null);
 
     }
 
@@ -589,6 +599,9 @@ public class WorkPresenter implements OnHttpResultListener {
      * @param poi 位置信息
      */
     public void changPoi(PoiInfo poi) {
+        if (mSignUtils!=null){
+            mSignUtils.changeLocalPoi(poi);
+        }
         loaction = StringUtil.isEmpty(poi.name) ? "" : poi.name;//位置名称
         address = StringUtil.isEmpty(poi.address) ? "" : poi.address;
         latitude = poi.location.latitude;

+ 2 - 2
settings.gradle

@@ -19,7 +19,7 @@ include ':apptasks'
 include ':apputils'
 include  ':appmusic'
 include  ':faceplatform-ui'
-//include  ':faceplatform-release'
+include  ':faceplatform-release'
 //第三库模块
 
 include ':lib-zxing'
@@ -53,7 +53,7 @@ project(':apptasks').projectDir = new File('app_modular/apptasks')
 project(':apputils').projectDir = new File('app_modular/apputils')
 project(':appmusic').projectDir = new File('app_modular/appmusic')
 project(':faceplatform-ui').projectDir = new File('app_modular/faceplatform-ui')
-//project(':faceplatform-release').projectDir = new File('app_modular/faceplatform-release')
+project(':faceplatform-release').projectDir = new File('app_modular/faceplatform-release')
 //第三库模块
 
 project(':lib-zxing').projectDir = new File('app_third/lib-zxing')