登陆授权修改,数据配置用常量替代,增加获取距离工具类等

This commit is contained in:
hupeng
2020-03-25 12:26:27 +08:00
parent 3f8163de14
commit e1b0b98cbc
21 changed files with 163 additions and 28 deletions

View File

@ -49,7 +49,7 @@ public interface ShopConstants {
/**
* 商城默认注册图片
*/
String YSHOP_DEFAULT_AVATAR = "https://image.dayouqiantu.cn/5dc2c7f3a104c.png";
String YSHOP_DEFAULT_AVATAR = "https://image.dayouqiantu.cn/5e79f6cfd33b6.png";
/**
* 腾讯地图地址解析
@ -61,6 +61,39 @@ public interface ShopConstants {
*/
String YSHOP_REDIS_INDEX_KEY = "yshop:index_data";
/**
* 充值方案
*/
String YSHOP_RECHARGE_PRICE_WAYS = "yshop_recharge_price_ways";
/**
* 首页banner
*/
String YSHOP_HOME_BANNER = "yshop_home_banner";
/**
* 首页菜单
*/
String YSHOP_HOME_MENUS = "yshop_home_menus";
/**
* 首页滚动新闻
*/
String YSHOP_HOME_ROLL_NEWS = "yshop_home_roll_news";
/**
* 热门搜索
*/
String YSHOP_HOT_SEARCH = "yshop_hot_search";
/**
* 个人中心菜单
*/
String YSHOP_MY_MENUES = "yshop_my_menus";
/**
* 秒杀时间段
*/
String YSHOP_SECKILL_TIME = "yshop_seckill_time";
/**
* 签到天数
*/
String YSHOP_SIGN_DAY_NUM = "yshop_sign_day_num";

View File

@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author hupeng
* 应用来源相关枚举
*/
@Getter

View File

@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author hupeng
* 账单明细相关枚举
*/
@Getter

View File

@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author hupeng
* 账单相关枚举
*/
@Getter

View File

@ -0,0 +1,25 @@
package co.yixiang.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author hupeng
* 通用枚举
*/
@Getter
@AllArgsConstructor
public enum CommonEnum {
DEL_STATUS_0(0,"未删除"),
DEL_STATUS_1(1,"已删除"),
SHOW_STATUS_0(0,"未显示"),
SHOW_STATUS_1(1,"显示");
private Integer value;
private String desc;
}

View File

@ -6,6 +6,7 @@ import lombok.Getter;
import javax.persistence.criteria.CriteriaBuilder;
/**
* @author hupeng
* 订单相关枚举
*/
@Getter

View File

@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author hupeng
* 支付相关枚举
*/
@Getter

View File

@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author hupeng
* 产品相关枚举
*/
@Getter

View File

@ -0,0 +1,37 @@
package co.yixiang.utils;
/**
* @ClassName LocationUtils
* @Author hupeng <610796224@qq.com>
* @Date 2020/3/24
**/
public class LocationUtils {
private static double EARTH_RADIUS = 6378.137;
private static double rad(double d) {
return d * Math.PI / 180.0;
}
/**
* 通过经纬度获取距离(单位:米)
* @param lat1
* @param lng1
* @param lat2
* @param lng2
* @return
*/
public static double getDistance(double lat1, double lng1, double lat2,
double lng2) {
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 * 10000d) / 10000d;
s = s*1000;
return s;
}
}