Pārlūkot izejas kodu

考勤是否在范围内

shiqian 4 gadi atpakaļ
vecāks
revīzija
22973d113b

+ 6 - 4
boman-modules/boman-system/src/main/java/com/boman/system/controller/AttendanceSetController.java

@@ -91,11 +91,13 @@ public class AttendanceSetController extends BaseController
     /**
      * 功能描述: 根据传入的经纬度计算是否在设置的范围之内
      *
-     * @param globalCoordinates 经纬度对象
+     * @param mLatitude  mLatitude
+     * @param mLongitude mLongitude
      * @return com.boman.common.core.web.domain.AjaxResult
      */
-    @PostMapping("/distanceMeter")
-    public AjaxResult getDistanceMeter(@RequestBody GlobalCoordinates globalCoordinates) {
-        return AjaxResult.success(attendanceSetService.getDistanceMeter(globalCoordinates));
+    @GetMapping("/distanceMeter")
+    public AjaxResult getDistanceMeter(double mLatitude, double mLongitude) {
+        GlobalCoordinates globalCoordinates = new GlobalCoordinates(mLatitude, mLongitude);
+        return attendanceSetService.getDistanceMeter(globalCoordinates);
     }
 }

+ 3 - 2
boman-modules/boman-system/src/main/java/com/boman/system/service/impl/AttendanceSetServiceImpl.java

@@ -118,11 +118,12 @@ public class AttendanceSetServiceImpl implements IAttendanceSetService
 
         GlobalCoordinates target = new GlobalCoordinates(Double.parseDouble(lat),Double.parseDouble(lgt));
         double distanceMeter = LatLgtUtil.getDistanceMeter(globalCoordinates, target, Ellipsoid.Sphere);
-        double range = Double.parseDouble(attendanceSet1.getRange());
+        double range = Double.parseDouble(attendanceSet1.getLimitRange());
         if (range > distanceMeter){
             //在范围内
             return AjaxResult.success();
         }
-        return AjaxResult.error();
+
+        return AjaxResult.error("不在范围内");
     }
 }

+ 6 - 6
boman-modules/boman-system/src/main/resources/mapper/system/AttendanceSetMapper.xml

@@ -9,7 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="attendanceAdd"    column="attendance_add"    />
         <result property="lgt"    column="lgt"    />
         <result property="lat"    column="lat"    />
-        <result property="range"    column="range"    />
+        <result property="limitRange"    column="limit_range"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
@@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectAttendanceSetVo">
-        select id, attendance_add, lgt, lat, range, create_by, create_time, update_by, update_time, is_del from attendance_set
+        select id, attendance_add, lgt, lat, limit_range, create_by, create_time, update_by, update_time, is_del from attendance_set
     </sql>
 
     <select id="selectAttendanceSetList" parameterType="AttendanceSet" resultMap="AttendanceSetResult">
@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="attendanceAdd != null  and attendanceAdd != ''"> and attendance_add = #{attendanceAdd}</if>
             <if test="lgt != null  and lgt != ''"> and lgt = #{lgt}</if>
             <if test="lat != null  and lat != ''"> and lat = #{lat}</if>
-            <if test="range != null  and range != ''"> and range = #{range}</if>
+            <if test="limitRange != null  and limitRange != ''"> and limit_range = #{limitRange}</if>
         </where>
     </select>
     
@@ -44,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="attendanceAdd != null">attendance_add,</if>
             <if test="lgt != null">lgt,</if>
             <if test="lat != null">lat,</if>
-            <if test="range != null">range,</if>
+            <if test="limitRange != null">limit_range,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
@@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="attendanceAdd != null">#{attendanceAdd},</if>
             <if test="lgt != null">#{lgt},</if>
             <if test="lat != null">#{lat},</if>
-            <if test="range != null">#{range},</if>
+            <if test="limitRange != null">#{limit_range},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
@@ -71,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="attendanceAdd != null">attendance_add = #{attendanceAdd},</if>
             <if test="lgt != null">lgt = #{lgt},</if>
             <if test="lat != null">lat = #{lat},</if>
-            <if test="range != null">range = #{range},</if>
+            <if test="limitRange != null">limit_range = #{limitRange},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>