| | |
| | | @TableField("express_pay_method") |
| | | private Integer expressPayMethod; |
| | | |
| | | @ApiModelProperty(value = "配送方式(1=自提,2=快递)") |
| | | @TableField("distribution_mode") |
| | | private Integer distributionMode; |
| | | |
| | | @ApiModelProperty(value = "第三方快递信息") |
| | | @TableField("express_json") |
| | | private String expressJson; |
| | |
| | | package com.ruoyi.other.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | |
| | | private Long parentId; |
| | | |
| | | private String english; |
| | | |
| | | @TableField(exist = false) |
| | | private List<Region> childs; |
| | | } |
| | |
| | | import com.ruoyi.account.api.model.*; |
| | | import com.ruoyi.account.mapper.AppUserMapper; |
| | | import com.ruoyi.account.service.*; |
| | | import com.ruoyi.account.util.GeodesyUtil; |
| | | import com.ruoyi.account.util.SMSUtil; |
| | | import com.ruoyi.account.util.payment.PaymentUtil; |
| | | import com.ruoyi.account.util.payment.model.CloseOrderResult; |
| | |
| | | nearbyReferrerVo.setVip("合伙人"); |
| | | break; |
| | | } |
| | | |
| | | String latitude = nearbyReferrerVo.getLatitude(); |
| | | String longitude = nearbyReferrerVo.getLongitude(); |
| | | Double wgs84 = GeodesyUtil.getDistance(longitude + "," + latitude, nearbyReferrer.getLongitude() + "," + nearbyReferrer.getLatitude()).get("WGS84"); |
| | | nearbyReferrerVo.setDistance(wgs84); |
| | | } |
| | | list.sort(new Comparator<NearbyReferrerVo>() { |
| | | @Override |
| | | public int compare(NearbyReferrerVo o1, NearbyReferrerVo o2) { |
| | | return o1.getDistance().compareTo(o2.getDistance()); |
| | | } |
| | | }); |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | return null; |
| | |
| | | couponInfoVo.setDiscountAmount(couponInfo.getDiscountAmount()); |
| | | couponInfoVo.setMoneyAmount(couponInfo.getMoneyAmount()); |
| | | couponInfoVo.setDiscount(couponInfo.getDiscount()); |
| | | couponInfoVo.setPeriodStartTime(couponInfo.getPeriodStartTime().format(formatter)); |
| | | couponInfoVo.setPeriodEndTime(couponInfo.getPeriodEndTime().format(formatter)); |
| | | if(null != couponInfo.getPeriodStartTime()){ |
| | | couponInfoVo.setPeriodStartTime(couponInfo.getPeriodStartTime().atTime(0, 0, 0).format(formatter)); |
| | | couponInfoVo.setPeriodEndTime(couponInfo.getPeriodEndTime().atTime(23, 59, 59).format(formatter)); |
| | | } |
| | | String forGoodIds = couponInfo.getForGoodIds(); |
| | | String[] split = forGoodIds.split(","); |
| | | if("-1".equals(forGoodIds)){ |
New file |
| | |
| | | package com.ruoyi.account.util; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import org.gavaghan.geodesy.Ellipsoid; |
| | | import org.gavaghan.geodesy.GeodeticCalculator; |
| | | import org.gavaghan.geodesy.GeodeticCurve; |
| | | import org.gavaghan.geodesy.GlobalCoordinates; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 计算两个金纬度坐标之间的直线距离 |
| | | */ |
| | | public class GeodesyUtil { |
| | | |
| | | |
| | | /** |
| | | * 获取直线距离 |
| | | * @param fromLonLat |
| | | * @param toLonLat |
| | | * @return |
| | | */ |
| | | public static Map<String, Double> getDistance(String fromLonLat, String toLonLat){ |
| | | Map<String, Double> map = null; |
| | | if(StringUtils.isNotEmpty(fromLonLat) && StringUtils.isNotEmpty(toLonLat)){ |
| | | map = new HashMap<>(); |
| | | String[] from = fromLonLat.split(","); |
| | | String[] to = toLonLat.split(","); |
| | | GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(from[1]), Double.valueOf(from[0])); |
| | | GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(to[1]), Double.valueOf(to[0])); |
| | | double Sphere = getDistanceMeter(source, target, Ellipsoid.Sphere); |
| | | double WGS84 = getDistanceMeter(source, target, Ellipsoid.WGS84); |
| | | double GRS80 = getDistanceMeter(source, target, Ellipsoid.GRS80); |
| | | double GRS67 = getDistanceMeter(source, target, Ellipsoid.GRS67); |
| | | double ANS = getDistanceMeter(source, target, Ellipsoid.ANS); |
| | | double WGS72 = getDistanceMeter(source, target, Ellipsoid.WGS72); |
| | | double Clarke1858 = getDistanceMeter(source, target, Ellipsoid.Clarke1858); |
| | | double Clarke1880 = getDistanceMeter(source, target, Ellipsoid.Clarke1880); |
| | | // System.out.println("Sphere坐标系计算结果:"+Sphere + "米"); |
| | | // System.out.println("WGS84坐标系计算结果:"+WGS84 + "米"); |
| | | // System.out.println("GRS80坐标系计算结果:"+GRS80 + "米"); |
| | | // System.out.println("GRS67坐标系计算结果:"+GRS67 + "米"); |
| | | // System.out.println("ANS坐标系计算结果:"+ANS + "米"); |
| | | // System.out.println("WGS72坐标系计算结果:"+WGS72 + "米"); |
| | | // System.out.println("Clarke1858坐标系计算结果:"+Clarke1858 + "米"); |
| | | // System.out.println("Clarke1880坐标系计算结果:"+Clarke1880 + "米"); |
| | | map.put("Sphere", Sphere); |
| | | map.put("WGS84", WGS84); |
| | | map.put("GRS80", GRS80); |
| | | map.put("GRS67", GRS67); |
| | | map.put("ANS", ANS); |
| | | map.put("WGS72", WGS72); |
| | | map.put("Clarke1858", Clarke1858); |
| | | map.put("Clarke1880", Clarke1880); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | private static double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid){ |
| | | //创建GeodeticCalculator,调用计算方法,传入坐标系、经纬度用于计算距离 |
| | | GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, gpsFrom, gpsTo); |
| | | return geoCurve.getEllipsoidalDistance(); |
| | | } |
| | | |
| | | |
| | | |
| | | public static void main(String[] ages){ |
| | | GeodesyUtil geodesyUtil = new GeodesyUtil(); |
| | | getDistance("115.481028,39.989643", "114.465302,40.004717"); |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty("会员类型名称") |
| | | private String vip; |
| | | @ApiModelProperty("距离(m)") |
| | | private BigDecimal distance; |
| | | private Double distance; |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | private String longitude; |
| | | private String latitude; |
| | | } |
| | |
| | | |
| | | |
| | | <select id="getNearbyReferrer" resultType="com.ruoyi.account.vo.NearbyReferrerVo"> |
| | | select * from ( |
| | | select |
| | | id, |
| | | avatar, |
| | | `name`, |
| | | vip_id as vip, |
| | | ST_Distance_Sphere( |
| | | point(#{nearbyReferrer.longitude},#{nearbyReferrer.latitude}), |
| | | point(longitude, latitude) |
| | | ) as distance, |
| | | phone |
| | | from t_app_user where city_code = #{cityCode} and del_flag = 0 and status = 1 and vip_id >= 4 |
| | | <if test="null != nearbyReferrer.name and '' != nearbyReferrer.name"> |
| | | and `name` like CONCAT('%', #{nearbyReferrer.name}, '%') |
| | | </if> |
| | | ) as aa order by aa.distance |
| | | select |
| | | id, |
| | | avatar, |
| | | `name`, |
| | | vip_id as vip, |
| | | longitude, |
| | | latitude, |
| | | phone |
| | | from t_app_user where city_code = #{cityCode} and del_flag = 0 and status = 1 and vip_id >= 4 |
| | | <if test="null != nearbyReferrer.name and '' != nearbyReferrer.name"> |
| | | and `name` like CONCAT('%', #{nearbyReferrer.name}, '%') |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getAppuserPage" resultType="com.ruoyi.account.api.model.AppUser"> |
| | |
| | | // 收货地址 |
| | | String addressJson = order.getAddressJson(); |
| | | UserAddress userAddress = new UserAddress(); |
| | | if (StringUtils.isNotEmpty(addressJson)){ |
| | | if (2 == order.getDistributionMode()){ |
| | | userAddress = JSONObject.parseObject(addressJson, UserAddress.class); |
| | | |
| | | } |
| | | // 优惠券 |
| | | String couponJson = order.getCouponJson(); |
| | |
| | | orderInfo.setExpressAmount(order.getExpressAmount()); |
| | | orderInfo.setPaymentAmount(order.getPaymentAmount()); |
| | | orderInfo.setGetPoint(order.getGetPoint()); |
| | | if(StringUtils.isNotEmpty(order.getAddressJson())){ |
| | | if(2 == order.getDistributionMode()){ |
| | | UserAddress userAddress = JSON.parseObject(order.getAddressJson(), UserAddress.class); |
| | | orderInfo.setRecipient(userAddress.getRecieveName() + "-" + userAddress.getRecievePhone()); |
| | | userAddress.setRecieveAddress(userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getRecieveAddress()); |
| | | orderInfo.setAddress(userAddress.getRecieveAddress()); |
| | | } |
| | | if(StringUtils.isNotEmpty(order.getExpressJson()) && !"NULL".equals(order.getExpressJson())){ |
| | | JSONObject jsonObject = JSON.parseObject(order.getExpressJson()); |
| | | String com = jsonObject.getString("com"); |
| | | String num = jsonObject.getString("num"); |
| | | QueryKD100Vo queryKD100Vo = ExpressDeliveryUtil.kd100QueryTrack(com, num); |
| | | orderInfo.setExpress(queryKD100Vo); |
| | | MapTrackKD100Vo mapTrackKD100Vo = JSON.parseObject(order.getExpressResult(), MapTrackKD100Vo.class); |
| | | orderInfo.setExpress(mapTrackKD100Vo); |
| | | } |
| | | List<OrderGood> orderGoods = orderGoodMapper.selectList(new LambdaQueryWrapper<OrderGood>().eq(OrderGood::getOrderId, orderId).eq(OrderGood::getDelFlag, 0)); |
| | | int sum = orderGoods.stream().mapToInt(OrderGood::getNum).sum(); |
| | |
| | | order.setDelFlag(0); |
| | | order.setCreateTime(LocalDateTime.now()); |
| | | order.setExpressPayMethod(shoppingCartPayment.getFreightPaymentType()); |
| | | order.setDistributionMode(shoppingCartPayment.getDistributionMode()); |
| | | |
| | | if(2 == shoppingCartPayment.getPaymentType()){ |
| | | BigDecimal balance = appUser.getBalance(); |
| | |
| | | package com.ruoyi.order.vo; |
| | | |
| | | import com.ruoyi.order.util.vo.MapTrackKD100Vo; |
| | | import com.ruoyi.order.util.vo.QueryKD100Vo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | @ApiModelProperty("收件地址") |
| | | private String address; |
| | | @ApiModelProperty("物流信息") |
| | | private QueryKD100Vo express; |
| | | private MapTrackKD100Vo express; |
| | | @ApiModelProperty("商品数量") |
| | | private Integer goodsNum; |
| | | @ApiModelProperty("商品信息") |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | @RequestMapping("/region") |
| | |
| | | * 省市区级联 |
| | | */ |
| | | @GetMapping("/getProvinceList") |
| | | @ApiOperation("省市区级联") |
| | | @ApiOperation(value = "省市区级联", tags = "管理后台") |
| | | public R<List<Region>> getProvinceList(@ApiParam("父级id") @RequestParam Long parentId) { |
| | | return R.ok(regionService.list(new LambdaQueryWrapper<Region>() |
| | | .eq(Region::getParentId, parentId))); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 省市区级联 |
| | | */ |
| | | @GetMapping("/getProvinceList1") |
| | | @ApiOperation(value = "省市区级联",tags = {"小程序"}) |
| | | public R<List<Region>> getProvinceList1() { |
| | | List<Region> list = regionService.list(); |
| | | List<Region> collect = list.stream().filter(s -> s.getParentId() == 0).collect(Collectors.toList()); |
| | | for (Region region : collect) { |
| | | List<Region> collect1 = list.stream().filter(s -> s.getParentId() == region.getId()).collect(Collectors.toList()); |
| | | for (Region region1 : collect1) { |
| | | List<Region> collect2 = list.stream().filter(s -> s.getParentId() == region1.getId()).collect(Collectors.toList()); |
| | | region1.setChilds(collect2); |
| | | } |
| | | region.setChilds(collect1); |
| | | } |
| | | return R.ok(collect); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |