Selaa lähdekoodia

app端:1.新增/编辑保养记录、查看保养记录详情,新增电梯接口
2.修改保养记录列表,增加计划id,电梯经纬度,电梯编号等返回参数

别傲 5 vuotta sitten
vanhempi
commit
4ed1101e2e

+ 22 - 10
lift-business-service/src/main/java/cn/com/ty/lift/business/library/service/LiftService.java

@@ -154,6 +154,27 @@ public class LiftService extends ServiceImpl<LiftMapper,Lift> {
         return Optional.ofNullable(getOne(lambdaQueryWrapper));
     }
 
+    /**
+     * @param id 电梯id
+     * @param mtCompanyId 公司id
+     * @return RestResponse 是否成功
+     * @description 保存公司电梯关联数据、平台电梯关联数据
+     * @date 2020/1/11 4:18 下午
+     */
+    public RestResponse saveCompanyLiftInfo(Long id, Long mtCompanyId) {
+        //新增企业电梯关联表
+        PlatformCompanyLiftRelevance ret = platformService.save(id, mtCompanyId);
+        if (ObjectUtil.isEmpty(ret)) {
+            return RestResponse.fail(MessageUtils.get("msg.add.fail"));
+        }
+        //新增平台电梯关联表
+        PlatformCompanyLiftRelevance liftRelevance = platformService.save(id, ApiConstants.PLATFORM_COMPANY_ID);
+        if (ObjectUtil.isEmpty(liftRelevance)) {
+            return RestResponse.fail(MessageUtils.get("msg.add.fail"));
+        }
+        return RestResponse.success(null, MessageUtils.get("msg.add.success"));
+    }
+
     /**
      * @param request 新增电梯数据项
      * @return RestResponse 状态码和返回消息
@@ -194,16 +215,7 @@ public class LiftService extends ServiceImpl<LiftMapper,Lift> {
         switch (source) {
             //电梯管理入口
             case "0":
-                //新增企业电梯关联表
-                PlatformCompanyLiftRelevance ret = platformService.save(id, mtCompanyId);
-                if (ret == null) {
-                    return RestResponse.fail(MessageUtils.get("msg.add.fail"));
-                }
-                //新增平台电梯关联表
-                PlatformCompanyLiftRelevance liftRelevance = platformService.save(id, ApiConstants.PLATFORM_COMPANY_ID);
-                if (liftRelevance == null) {
-                    return RestResponse.fail(MessageUtils.get("msg.add.fail"));
-                }
+                saveCompanyLiftInfo(id, mtCompanyId);
                 break;
             //项目管理入口
             case "1":

+ 8 - 4
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/MaintenanceRecord.java

@@ -1,9 +1,12 @@
 package cn.com.ty.lift.business.maintenance.dao.entity;
 
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
 import java.util.Date;
 
 import cn.com.ty.lift.business.common.BaseEntity;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -19,6 +22,7 @@ public class MaintenanceRecord extends BaseEntity {
 	/**
 	 * 保养记录ID
 	 */
+	@TableId(value = "id",type = IdType.ID_WORKER)
 	private Long id;
 
 	/**
@@ -64,22 +68,22 @@ public class MaintenanceRecord extends BaseEntity {
 	/**
 	 * 计划保养时间
 	 */
-	private Date planDate;
+	private LocalDateTime planDate;
 
 	/**
 	 * 实际保养时间
 	 */
-	private Date workDate;
+	private LocalDateTime workDate;
 
 	/**
 	 * 停梯时间
 	 */
-	private Date stopDate;
+	private LocalDateTime stopDate;
 
 	/**
 	 * 恢复时间
 	 */
-	private Date recoveryDate;
+	private LocalDateTime recoveryDate;
 
 	/**
 	 * 保养建议

+ 18 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/model/request/MaintenanceAddRecordRequest.java

@@ -0,0 +1,18 @@
+package cn.com.ty.lift.business.maintenance.dao.entity.model.request;
+
+import cn.com.ty.lift.business.maintenance.dao.entity.MaintenanceRecord;
+import lombok.Data;
+
+/**
+ * @author bieao
+ * @date 2020/1/13
+ * @description 新增保养信息
+ */
+@Data
+public class MaintenanceAddRecordRequest {
+    //维保工经纬度
+    private String coordinate;
+
+    //保养信息
+    private MaintenanceRecord record;
+}

+ 19 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/model/request/MaintenanceRecordDetailRequest.java

@@ -0,0 +1,19 @@
+package cn.com.ty.lift.business.maintenance.dao.entity.model.request;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author bieao
+ * @date 2020/1/13
+ * @description 查看保养记录详情
+ */
+@Data
+public class MaintenanceRecordDetailRequest {
+    /**
+     * 保养记录id
+     */
+    @NotNull(message = "notEmpty")
+    private Long id;
+}

+ 32 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/model/response/MaintenanceAppResponse.java

@@ -15,6 +15,34 @@ public class MaintenanceAppResponse {
      * 项目名称
      */
     private String projectName;
+    /**
+     * 项目id
+     */
+    private String projectId;
+    /**
+     * 维保计划id
+     */
+    private String mtPlanId;
+    /**
+     * 保养记录id
+     */
+    private String recordId;
+    /**
+     * 电梯id
+     */
+    private String liftId;
+    /**
+     * 维保工id
+     */
+    private String workerId;
+    /**
+     * 电梯经纬度
+     */
+    private String coordinate;
+    /**
+     * 电梯编号
+     */
+    private String liftCode;
     /**
      * 电梯注册代码
      */
@@ -39,4 +67,8 @@ public class MaintenanceAppResponse {
      * 保养类型
      */
     private String maintenanceType;
+    /**
+     * 保养状态
+     */
+    private String status;
 }

+ 101 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenanceRecordService.java

@@ -0,0 +1,101 @@
+package cn.com.ty.lift.business.maintenance.service;
+
+import cn.com.ty.lift.business.framework.util.MessageUtils;
+import cn.com.ty.lift.business.library.dao.entity.Lift;
+import cn.com.ty.lift.business.library.service.LiftService;
+import cn.com.ty.lift.business.maintenance.dao.entity.MaintenanceRecord;
+import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceAddRecordRequest;
+import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceRecordRequest;
+import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceRecordResponse;
+import cn.com.ty.lift.business.maintenance.dao.mapper.MaintenanceRecordMapper;
+import cn.com.ty.lift.common.utils.MapHelper;
+import cn.com.xwy.boot.web.dto.RestResponse;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Optional;
+
+/**
+ * @author bieao
+ * @date 2019/12/12
+ * @description 保养记录业务层
+ */
+@Service
+public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMapper, MaintenanceRecord> {
+
+    @Resource
+    private LiftService liftService;
+
+    /**
+     * @param request 公司id和电梯id
+     * @return RestResponse 保养信息
+     * @description 根据公司id和电梯id查询上次保养信息
+     * @date 2020/1/6 5:37 下午
+     */
+    public MaintenanceRecordResponse recordInfo(MaintenanceRecordRequest request) {
+        return baseMapper.findRecordByCompanyId(request);
+    }
+
+    /**
+     * @param id 电梯id
+     * @return 电梯经纬度
+     * @description 根据电梯id获取经纬度
+     * @date 2020/1/13 11:37 上午
+     */
+    public String getCoordinate(Long id){
+        Lift lift = liftService.getById(id);
+        return Optional.ofNullable(lift).map(Lift::getCoordinate).orElse(null);
+    }
+
+
+    /**
+     * @param coordinate 维保工经纬度
+     * @return 是否在范围内
+     * @description 计算维保工开始保养时,是否在电梯200米范围内
+     * @date 2020/1/13 11:30 上午
+     */
+    public boolean calc(Long id, String coordinate) {
+        String liftCoordinate = getCoordinate(id);
+        double expected = 200;
+        double result = MapHelper.GetPointDistance(liftCoordinate, coordinate);
+        return (result * 1000) > expected;
+    }
+
+    /**
+     * @param request 保养单信息
+     * @return 是否成功
+     * @description 保存保养记录
+     * @date 2020/1/13 1:47 下午
+     */
+    public RestResponse saveRecord(MaintenanceAddRecordRequest request) {
+        MaintenanceRecord record = request.getRecord();
+        boolean result = calc(record.getLiftId(), request.getCoordinate());
+        if (result) return RestResponse.fail(MessageUtils.get("msg.error.person.scope"));
+        boolean ret = save(record);
+        if (!ret) {
+            return RestResponse.fail(MessageUtils.get("msg.add.fail"));
+        }
+        return RestResponse.success(null, MessageUtils.get("msg.add.success"));
+    }
+
+    /**
+     * @param record 保养信息
+     * @return 是否成功
+     * @description 编辑保养信息
+     * @date 2020/1/13 2:31 下午
+     */
+    public boolean modify(MaintenanceRecord record){
+        return updateById(record);
+    }
+
+    /**
+     * @param id 保养记录id
+     * @return 保养信息详情
+     * @description 查看保养信息详情
+     * @date 2020/1/13 2:39 下午
+     */
+    public MaintenanceRecord detail(Long id) {
+        return getById(id);
+    }
+}

+ 62 - 1
lift-business-service/src/main/java/cn/com/ty/lift/business/project/controller/ProjectAppController.java

@@ -1,10 +1,15 @@
 package cn.com.ty.lift.business.project.controller;
 
 import cn.com.ty.lift.business.framework.util.MessageUtils;
+import cn.com.ty.lift.business.library.dao.entity.model.request.LiftExtensionRequest;
+import cn.com.ty.lift.business.maintenance.dao.entity.MaintenanceRecord;
+import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceAddRecordRequest;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceAppRequest;
+import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceRecordDetailRequest;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceRecordRequest;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenancePlanResponse;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceRecordResponse;
+import cn.com.ty.lift.business.maintenance.service.MaintenanceRecordService;
 import cn.com.ty.lift.business.project.dao.entity.model.request.CompanyRequest;
 import cn.com.ty.lift.business.project.dao.entity.model.request.ProjectDetailRequest;
 import cn.com.ty.lift.business.project.dao.entity.model.response.ProjectCompanyResponse;
@@ -35,6 +40,9 @@ public class ProjectAppController {
     @Resource
     private ProjectAppService projectAppService;
 
+    @Resource
+    private MaintenanceRecordService maintenanceRecordService;
+
     /**
      * @param request 公司id
      * @return RestResponse 项目列表
@@ -50,6 +58,59 @@ public class ProjectAppController {
         return RestResponse.success(page, MessageUtils.get("msg.query.success"));
     }
 
+    /**
+     * @param request app端新增电梯
+     * @return 1.成功, 0.失败, 消息描述
+     * @description 新增电梯
+     * @date 2020/1/11 4:21 下午
+     */
+    @PostMapping("lift/add")
+    public RestResponse add(@RequestBody LiftExtensionRequest request) {
+        return projectAppService.add(request);
+    }
+
+    /**
+     * @param request app端保养信息
+     * @return 1.成功, 0.失败, 消息描述
+     * @description 新增保养记录
+     * @date 2020/1/13 2:12 下午
+     */
+    @PostMapping("record/add")
+    public RestResponse add(@RequestBody MaintenanceAddRecordRequest request) {
+        return maintenanceRecordService.saveRecord(request);
+    }
+
+    /**
+     * @param record app端保养信息
+     * @return 1.成功, 0.失败, 消息描述
+     * @description 编辑保养记录
+     * @date 2020/1/13 2:33 下午
+     */
+    @PostMapping("record/modify")
+    public RestResponse modify(@RequestBody MaintenanceRecord record){
+        boolean result = maintenanceRecordService.modify(record);
+        if (result) {
+            return RestResponse.success(null, MessageUtils.get("msg.modify.success"));
+        } else {
+            return RestResponse.fail(MessageUtils.get("msg.modify.fail"));
+        }
+    }
+
+    /**
+     * @param request 保养id
+     * @return RestResponse 保养记录
+     * @description 查看保养记录
+     * @date 2020/1/13 2:33 下午
+     */
+    @PostMapping("record/detail")
+    public RestResponse detail(@RequestBody MaintenanceRecordDetailRequest request){
+        MaintenanceRecord record = maintenanceRecordService.detail(request.getId());
+        if (ObjectUtil.isEmpty(record)) {
+            return RestResponse.success();
+        }
+        return RestResponse.success(record, MessageUtils.get("msg.query.detail.success"));
+    }
+
     /**
      * @param request 项目id
      * @return RestResponse 电梯列表
@@ -103,7 +164,7 @@ public class ProjectAppController {
      */
     @PostMapping("maintenance/record/info")
     public RestResponse recordInfo(@Valid @RequestBody MaintenanceRecordRequest request) {
-        MaintenanceRecordResponse response = projectAppService.recordInfo(request);
+        MaintenanceRecordResponse response = maintenanceRecordService.recordInfo(request);
         if (ObjectUtil.isEmpty(response)) {
             return RestResponse.success();
         }

+ 3 - 3
lift-business-service/src/main/java/cn/com/ty/lift/business/project/controller/ProjectController.java

@@ -35,7 +35,7 @@ public class ProjectController {
     private ProjectService projectService;
 
     @Resource
-    private PlatformCompanyLiftRelevanceService platformCompanyLiftRelevanceService;
+    private PlatformCompanyLiftRelevanceService platformService;
 
     @Resource
     private ProjectLiftRelevanceService projectLiftRelevanceService;
@@ -151,7 +151,7 @@ public class ProjectController {
      */
     @PostMapping("service/operate")
     public RestResponse serviceOperate(@Valid @RequestBody ProjectOperateServiceRequest request) {
-        return platformCompanyLiftRelevanceService.serviceOperate(request);
+        return platformService.serviceOperate(request);
     }
 
     /**
@@ -162,7 +162,7 @@ public class ProjectController {
      */
     @PostMapping("confirm")
     public RestResponse confirm(@Valid @RequestBody ProjectConfirmRequest request){
-        return platformCompanyLiftRelevanceService.confirm(request.getMtCompanyId(),request.getProjectId());
+        return platformService.confirm(request.getMtCompanyId(),request.getProjectId());
     }
 
     /**

+ 25 - 16
lift-business-service/src/main/java/cn/com/ty/lift/business/project/service/ProjectAppService.java

@@ -1,11 +1,12 @@
 package cn.com.ty.lift.business.project.service;
 
+import cn.com.ty.lift.business.framework.util.MessageUtils;
+import cn.com.ty.lift.business.library.dao.entity.Lift;
+import cn.com.ty.lift.business.library.dao.entity.model.request.LiftExtensionRequest;
+import cn.com.ty.lift.business.library.service.LiftService;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceAppRequest;
-import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceRecordRequest;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenancePlanResponse;
-import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceRecordResponse;
 import cn.com.ty.lift.business.maintenance.dao.mapper.MaintenancePlanMapper;
-import cn.com.ty.lift.business.maintenance.dao.mapper.MaintenanceRecordMapper;
 import cn.com.ty.lift.business.project.dao.entity.Project;
 import cn.com.ty.lift.business.project.dao.entity.model.ProjectAppUser;
 import cn.com.ty.lift.business.project.dao.entity.model.request.CompanyRequest;
@@ -15,11 +16,13 @@ import cn.com.ty.lift.business.project.dao.entity.model.response.ProjectDetailRe
 import cn.com.ty.lift.business.project.dao.entity.model.response.ProjectLiftResponse;
 import cn.com.ty.lift.business.project.dao.mapper.ProjectMapper;
 import cn.com.ty.lift.business.project.dao.mapper.ProjectUserMapper;
+import cn.com.xwy.boot.web.dto.RestResponse;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.List;
@@ -37,13 +40,13 @@ public class ProjectAppService extends ServiceImpl<ProjectMapper,Project> {
     private ProjectMapper projectMapper;
 
     @Resource
-    private ProjectUserMapper projectUserMapper;
+    private LiftService liftService;
 
     @Resource
-    private MaintenancePlanMapper maintenancePlanMapper;
+    private ProjectUserMapper projectUserMapper;
 
     @Resource
-    private MaintenanceRecordMapper maintenanceRecordMapper;
+    private MaintenancePlanMapper maintenancePlanMapper;
 
     /**
      * @param request 公司id
@@ -67,6 +70,22 @@ public class ProjectAppService extends ServiceImpl<ProjectMapper,Project> {
         return projectMapper.findListByProjectId(page, request);
     }
 
+     /**
+      * @param request 新增电梯数据项
+      * @return RestResponse 状态码和返回消息
+      * @description 新增电梯
+      * @date 2020/1/11 4:22 下午
+      */
+    @Transactional(rollbackFor = Exception.class)
+    public RestResponse add(LiftExtensionRequest request){
+        Lift lift = request.getLift();
+        boolean result = liftService.save(lift);
+        if (!result) {
+            return RestResponse.fail(MessageUtils.get("msg.add.fail"));
+        }
+        return liftService.saveCompanyLiftInfo(lift.getId(), request.getMtCompanyId());
+    }
+
     /**
      * @param request 项目id
      * @return RestResponse 项目详情
@@ -91,14 +110,4 @@ public class ProjectAppService extends ServiceImpl<ProjectMapper,Project> {
         return maintenancePlanMapper.findListByWorkerId(page, request);
     }
 
-    /**
-     * @param request 公司id和电梯id
-     * @return RestResponse 保养信息
-     * @description 根据公司id和电梯id查询上次保养信息
-     * @date 2020/1/6 5:37 下午
-     */
-    public MaintenanceRecordResponse recordInfo(MaintenanceRecordRequest request) {
-        return maintenanceRecordMapper.findRecordByCompanyId(request);
-    }
-
 }

+ 1 - 0
lift-business-service/src/main/resources/locale/response.properties

@@ -22,6 +22,7 @@ msg.project.status.update=\u9879\u76EE\u9501\u5B9A\u72B6\u6001\u66F4\u65B0\u6210
 msg.company.lift.empty=\u8BE5\u516C\u53F8\u4E0B\u6682\u65F6\u6CA1\u6709\u7535\u68AF
 msg.error.time=\u9996\u4FDD\u65F6\u95F4\u5E94\u5728\u9879\u76EE\u5F00\u59CB\u65F6\u95F4\u548C\u7ED3\u675F\u65F6\u95F4\u8303\u56F4\u5185
 msg.error.lift.status=\u8BE5\u7535\u68AF\u5DF2\u5F03\u7528
+msg.error.person.scope=\u4EBA\u5458\u4E0D\u5728\u7535\u68AF\u9644\u8FD1\uFF0C\u65E0\u6CD5\u5F00\u59CB\u4FDD\u517B
 msg.project.operate.success=\u670D\u52A1\u64CD\u4F5C\u6210\u529F
 msg.project.lift.maintenance.status.error=\u9879\u76EE\u4E0B\u8FD8\u6709\u7EF4\u4FDD\u4E2D\u7684\u4EFB\u52A1
 msg.project.lift.emergency.status.error=\u9879\u76EE\u4E0B\u8FD8\u6709\u6025\u4FEE\u4E2D\u7684\u4EFB\u52A1

+ 10 - 1
lift-business-service/src/main/resources/mapper/maintenance/MaintenancePlanMapper.xml

@@ -77,13 +77,22 @@
 	<select id="findListByWorkerId" resultType="cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceAppResponse"
 			parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceAppRequest">
 		SELECT p.project_name      AS projectName,
+		       p.id                AS projectId,
+			   mp.id               AS mtPlanId,
+			   mr.id               AS recordId,
+			   l.id                AS liftId,
+			   l.coordinate        AS coordinate,
 			   l.registration_code AS registrationCode,
 			   l.use_company_code  AS useCompanyCode,
 			   l.lift_type         AS liftType,
+		       l.lift_code         AS liftCode,
 			   ui.name             AS workerName,
+		       mp.worker_id        AS workerId,
 			   mp.plan_date        AS planDate,
-			   mp.type             AS maintenanceType
+			   mp.type             AS maintenanceType,
+		       mr.status           AS status
 		FROM maintenance_plan mp
+		         LEFT JOIN maintenance_record mr ON mp.id = mr.mt_plan_id
 				 LEFT JOIN project p ON mp.project_id = p.id
 				 LEFT JOIN lift l ON mp.lift_id = l.id
 				 LEFT JOIN user_info ui ON mp.worker_id = ui.user_id

+ 67 - 0
lift-common/src/main/java/cn.com.ty.lift.common/utils/MapHelper.java

@@ -0,0 +1,67 @@
+package cn.com.ty.lift.common.utils;
+
+/**
+ * 通过地图上的两个坐标计算距离(Java版本)
+ * Add by 成长的小猪(Jason.Song) on 2017/11/01
+ * http://blog.csdn.net/jasonsong2008
+ */
+public class MapHelper {
+
+    /**
+     * 经纬度转化成弧度
+     * Add by 成长的小猪(Jason.Song) on 2017/11/01
+     * http://blog.csdn.net/jasonsong2008
+     *
+     * @param d 经度/纬度
+     * @return
+     */
+    private static double rad(double d) {
+        return d * Math.PI / 180.0;
+    }
+
+    /**
+     * 计算两个坐标点之间的距离
+     * Add by 成长的小猪(Jason.Song) on 2017/11/01
+     * http://blog.csdn.net/jasonsong2008
+     *
+     * @param firstLatitude   第一个坐标的纬度
+     * @param firstLongitude  第一个坐标的经度
+     * @param secondLatitude  第二个坐标的纬度
+     * @param secondLongitude 第二个坐标的经度
+     * @return 返回两点之间的距离,单位:公里/千米
+     */
+    public static double getDistance(double firstLatitude, double firstLongitude,
+                                     double secondLatitude, double secondLongitude) {
+        double firstRadLat = rad(firstLatitude);
+        double firstRadLng = rad(firstLongitude);
+        double secondRadLat = rad(secondLatitude);
+        double secondRadLng = rad(secondLongitude);
+
+        double a = firstRadLat - secondRadLat;
+        double b = firstRadLng - secondRadLng;
+        //地球半径
+        double earthRadius = 6378.137;
+        double cal = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(firstRadLat)
+                * Math.cos(secondRadLat) * Math.pow(Math.sin(b / 2), 2))) * earthRadius;
+        return Math.round(cal * 10000d) / 10000d;
+    }
+
+    /**
+     * 计算两个坐标点之间的距离
+     * Add by 成长的小猪(Jason.Song) on 2017/11/01
+     * http://blog.csdn.net/jasonsong2008
+     *
+     * @param firstPoint  第一个坐标点的(纬度,经度) 例如:"31.2553210000,121.4620020000"
+     * @param secondPoint 第二个坐标点的(纬度,经度) 例如:"31.2005470000,121.3269970000"
+     * @return 返回两点之间的距离,单位:公里/千米
+     */
+    public static double GetPointDistance(String firstPoint, String secondPoint) {
+        String[] firstArray = firstPoint.split(",");
+        String[] secondArray = secondPoint.split(",");
+        double firstLatitude = Double.parseDouble(firstArray[0].trim());
+        double firstLongitude = Double.parseDouble(firstArray[1].trim());
+        double secondLatitude = Double.parseDouble(secondArray[0].trim());
+        double secondLongitude = Double.parseDouble(secondArray[1].trim());
+        return getDistance(firstLatitude, firstLongitude, secondLatitude, secondLongitude);
+    }
+}