Browse Source

补充提交

master
zhangyongzhangyong 5 years ago
parent
commit
7a7278c7a7
  1. 81
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ActUserClockLogFormDTO.java
  2. 45
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActCaculateDistanceFormDTO.java
  3. 48
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java
  4. 40
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/CaculateDistance.java

81
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<String> images;
}

45
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;
}

48
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<Object> clocks;
}

40
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;
}
}
Loading…
Cancel
Save