|
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQu
|
|
|
import com.gree.mall.miniapp.bean.user.CurrentCompanyWechat;
|
|
|
import com.gree.mall.miniapp.bean.user.UserAddressBean;
|
|
|
import com.gree.mall.miniapp.exception.RemoteServiceException;
|
|
|
+import com.gree.mall.miniapp.logic.LbsAmapLogic;
|
|
|
import com.gree.mall.miniapp.logic.common.CommonLogic;
|
|
|
import com.gree.mall.miniapp.plus.entity.Coupon;
|
|
|
import com.gree.mall.miniapp.plus.entity.FreightTemplateDetail;
|
|
@@ -37,6 +38,9 @@ public class AddressLogic {
|
|
|
@Autowired
|
|
|
private CommonLogic commonLogic;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private LbsAmapLogic lbsAmapLogic;
|
|
|
+
|
|
|
public UserAddress saveAddress(HttpServletRequest request, UserAddressBean userAddressBean) {
|
|
|
CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat(request);
|
|
|
|
|
@@ -55,6 +59,11 @@ public class AddressLogic {
|
|
|
.set(UserAddress::getDefaultAddr, false)
|
|
|
.update();
|
|
|
}
|
|
|
+ String locationByAddress = lbsAmapLogic.getLocationByAddress(userAddressBean.getProvince() + userAddressBean.getCity() + userAddressBean.getArea() + userAddressBean.getStreet() + userAddressBean.getAddress());
|
|
|
+
|
|
|
+ userAddress.setLng(locationByAddress.split(",")[0]);
|
|
|
+ userAddress.setLat(locationByAddress.split(",")[1]);
|
|
|
+
|
|
|
userAddress.setCompanyWechatId(currentCompanyWechat.getCurrentCompanyWechatId());
|
|
|
userAddress.setCompanyName(currentCompanyWechat.getCurrentCompanyName());
|
|
|
userAddressService.save(userAddress);
|
|
@@ -76,6 +85,8 @@ public class AddressLogic {
|
|
|
.set(UserAddress::getDefaultAddr, false)
|
|
|
.update();
|
|
|
}
|
|
|
+
|
|
|
+ String locationByAddress = lbsAmapLogic.getLocationByAddress(userAddressBean.getProvince() + userAddressBean.getCity() + userAddressBean.getArea() + userAddressBean.getStreet() + userAddressBean.getAddress());
|
|
|
userAddressService.lambdaUpdate().eq(UserAddress::getUserAddressId, userAddressBean.getUserAddressId())
|
|
|
.set(StringUtils.isNotBlank(userAddressBean.getAddress()), UserAddress::getAddress, userAddressBean.getAddress())
|
|
|
.set(StringUtils.isNotBlank(userAddressBean.getProvince()), UserAddress::getProvince, userAddressBean.getProvince())
|
|
@@ -85,6 +96,8 @@ public class AddressLogic {
|
|
|
.set(StringUtils.isNotBlank(userAddressBean.getName()), UserAddress::getName, userAddressBean.getName())
|
|
|
.set(StringUtils.isNotBlank(userAddressBean.getPhone()), UserAddress::getPhone, userAddressBean.getPhone())
|
|
|
.set(UserAddress::getStatus, status)
|
|
|
+ .set(UserAddress::getLat, locationByAddress.split(",")[1])
|
|
|
+ .set(UserAddress::getLng, locationByAddress.split(",")[0])
|
|
|
.set(StringUtils.isNotEmpty(userAddressBean.getStreet()), UserAddress::getStreet, userAddressBean.getStreet())
|
|
|
.set(!Objects.isNull(userAddressBean.getDefaultAddr()), UserAddress::getDefaultAddr, userAddressBean.getDefaultAddr())
|
|
|
.update();
|