diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ActUserClockLogFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ActUserClockLogFormDTO.java new file mode 100644 index 0000000000..fa7e943ebf --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ActUserClockLogFormDTO.java @@ -0,0 +1,81 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form.resi; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; + +/** + * 用户活动打卡参数 + * + * @author zhangyong + * @since v1.0.0 2020-07-14 + */ +@Data +public class ActUserClockLogFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + private String userId; + /** + * 活动ID + */ + @NotBlank(message = "活动ID不能为空") + private String actId; + /** + * 打卡类型(0-打卡,1-更新打卡) + */ + @NotBlank(message = "打卡类型不能为空") + private String clockType; + /** + * 打卡位置经度 + */ + @NotBlank(message = "打卡位置经度不能为空") + private BigDecimal clockLongitude; + /** + * 打卡位置纬度 + */ + @NotBlank(message = "打卡位置纬度不能为空") + private BigDecimal clockLatitude; + /** + * 打卡地址 + */ + @NotBlank(message = "打卡地址不能为空") + private String clockAddress; + /** + * 打卡描述 + */ + @NotBlank(message = "打卡描述不能为空") + private String clockDesc; + /** + * 打卡是否有效(0-否,1-是) + */ + @NotBlank(message = "打卡是否有效不能为空") + private String effectiveFlag; + /** + * 打卡图片 + */ + private ArrayList images; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActCaculateDistanceFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActCaculateDistanceFormDTO.java new file mode 100644 index 0000000000..b48ff6bb08 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActCaculateDistanceFormDTO.java @@ -0,0 +1,45 @@ +package com.epmet.dto.form.resi; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 重新定位 入参 + * + * @author zhangyong + * @since v1.0.0 2020-07-20 + */ +@Data +public class ResiActCaculateDistanceFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 经度 + */ + @NotBlank(message = "经度不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) + private Double longitude; + + /** + * 纬度 + */ + @NotBlank(message = "纬度不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) + private Double latitude; + + /** + * 用户id + */ + @NotBlank(message = "活动ID不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) + private String actId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java new file mode 100644 index 0000000000..cb3cc26361 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java @@ -0,0 +1,48 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result.resi; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 打卡列表 + * + * @author zhangyong + * @since v1.0.0 2020-07-14 + */ +@Data +public class ActClockListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 活动打卡人次 + */ + private Integer clockNum; + + /** + * 打卡列表 + */ + private List clocks; + + + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/CaculateDistance.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/CaculateDistance.java new file mode 100644 index 0000000000..5a772706da --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/CaculateDistance.java @@ -0,0 +1,40 @@ +package com.epmet.utils; + + +/** + * 计算两个经纬度之间相差的距离(米) + * + * @Auther: zhangyong + * @Date: 2020-07-17 14:54 + */ +public class CaculateDistance { + + private static final double EARTH_RADIUS = 6378137; + private static double rad(double d) { + return d * Math.PI / 180.0; + } + + /** + * 根据两点间经纬度坐标(double值),计算两点间距离,单位为米 + * + * @param lng1 经度1 + * @param lat1 纬度1 + * @param lng2 经度2 + * @param lat2 纬度2 + * @return double + * @Author zhangyong + * @Date 14:56 2020-07-17 + **/ + public static double getDistance(double lng1, double lat1, double lng2, double lat2) { + double radLat1 = rad(lat1); + double radLat2 = rad(lat2); + double a = radLat1 - radLat2; + double b = rad(lng1) - rad(lng2); + double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) + + Math.cos(radLat1)*Math.cos(radLat2)*Math.pow(Math.sin(b/2),2))); + s = s * EARTH_RADIUS; + s = Math.round(s * 10000) / 10000; + return s; + } + +}