From f60cf23a76972c0e0c7a437b17f37e1237e7d8d9 Mon Sep 17 00:00:00 2001
From: shicf <shi_chongfu@163.com>
Date: 星期一, 04 八月 2025 16:17:10 +0800
Subject: [PATCH] GPS坐标转换成百度坐标

---
 src/main/java/com/product/mobile/core/service/SignInService.java |   45 ++++++++++++++++++++++++++++++++++++---------
 1 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/product/mobile/core/service/SignInService.java b/src/main/java/com/product/mobile/core/service/SignInService.java
index a0f8ecb..b1dd0f3 100644
--- a/src/main/java/com/product/mobile/core/service/SignInService.java
+++ b/src/main/java/com/product/mobile/core/service/SignInService.java
@@ -17,7 +17,8 @@
 import com.product.mobile.core.config.MobileCoreCode;
 import com.product.mobile.core.config.MobileCoreConst;
 import com.product.module.sys.entity.SystemUser;
-import com.product.util.BaseUtil;
+import com.product.util.baidu.map.CoordinateTransformUtil;
+import com.product.util.baidu.map.CoordinateTransformUtil.Coordinate;
 
 import cn.hutool.core.date.DateUtil;
 
@@ -79,7 +80,7 @@
 					t=4;
 					rule=config.getString("afternoon_work_off");
 				}else {//涓婄彮
-					if(check(record,"1")) {
+					if(check(record,1)!=null) {
 						throw new BaseException(MobileCoreCode.SIGN_IN_REPEAT_FAIL);
 					}
 					fse.setValue("punch_type","1");
@@ -101,14 +102,14 @@
 				}else {//涓婄彮
 					//涓婄彮鍗★紝姣斾笂鍗堜笅鐝棭锛岃涓婂崍涓婄彮鍗�
 					if(dataCompareTo(fse.getDate("punch_time"),config.getDate("morning_work_off")) ) {
-						if(check(record,"1")) {
+						if(check(record,1)!=null) {
 							throw new BaseException(MobileCoreCode.SIGN_IN_REPEAT_FAIL);
 						}
 						fse.setValue("punch_type","1");
 						t=1;
 						rule=config.getString("morning_work");
 					}else {//璁颁笅鍗堜笂鐝崱
-						if(check(record,"3")) {
+						if(check(record,3)!=null) {
 							throw new BaseException(MobileCoreCode.SIGN_IN_REPEAT_FAIL);
 						}
 						fse.setValue("punch_type","3");
@@ -124,6 +125,14 @@
 			rule=rule.substring(10);
 			rule=DateUtil.formatDate(new Date())+rule;
 		}
+		if(t%2==0) {
+			///濡備笅鏄笅鐝崱锛屽苟涓斿綋澶╁凡缁忔墦杩囦簡锛屽彧鏄幓淇敼鏈�鍚庢墦鍗℃椂闂达紝涓嶆槸鏂板涓�鏉℃墦鍗¤褰�
+			String uuid=check(record,t);
+			if(uuid!=null) {
+				fse.setValue("uuid", uuid);
+			}
+		}
+		
 		long resutl=signinResult(DateUtil.parse(rule),fse.getDate("punch_time"),t);
 		if(resutl>0) {
 			fse.setValue("sign_in_result", 0);//杩熷埌
@@ -158,13 +167,13 @@
 	}
 	
 	//涓婄彮鏃堕棿涓嶈兘閲嶅鎵撳崱
-	private boolean check(DataTableEntity record,String type) {
+	private String check(DataTableEntity record,int type) {
 		for(int i=0;i<record.getRows();i++) {
-			if(type.equals( record.getFieldSetEntity(i).getString("punch_type"))) {
-				return true;
+			if(type==record.getFieldSetEntity(i).getInteger("punch_type").intValue()) {
+				return record.getFieldSetEntity(i).getString("uuid");
 			}
 		}
-		return false;
+		return null;
 	}
 
 	/**
@@ -207,5 +216,23 @@
     	sql.append(" a left join product_oa_punch_time b on b.punch_site_uuid=a.uuid where a.org_level_uuid=?");
     	return baseDao.listTable(sql.toString(), new String[] {org_level_uuid});
     }
-
+    /**
+     *鍧愭爣杞崲
+     * @param type杞崲绫诲瀷
+     * @param lng 缁忓害
+     * @param lat 绾害
+     * @return
+     */
+    public FieldSetEntity coordinateTransform(int type,double lng,double lat) {
+    	
+    	FieldSetEntity newCoord=new FieldSetEntity();
+    	newCoord.setTableName("product_oa_punch_time");
+    	Coordinate nc=CoordinateTransformUtil.toConvert(type, lng, lat);
+    	if(nc!=null) {
+    		newCoord.setValue("longitude", nc.longitude);
+    		newCoord.setValue("latitude", nc.latitude);
+    	}
+    	
+    	return newCoord;
+    }
 }

--
Gitblit v1.9.2