|
|
@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.jeecg.common.exception.JeecgBootException; |
|
|
|
import org.jeecg.common.system.util.AppletUserUtil; |
|
|
|
import org.jeecg.common.system.vo.AppletUser; |
|
|
|
import org.jeecg.modules.applet.service.AppletApiAddressService; |
|
|
|
import org.jeecg.modules.demo.appletShippingAddress.entity.AppletShippingAddress; |
|
|
|
import org.jeecg.modules.demo.appletShippingAddress.service.IAppletShippingAddressService; |
|
|
@ -31,6 +33,7 @@ public class AppletApiAddressServiceImpl implements AppletApiAddressService { |
|
|
|
|
|
|
|
String userId = AppletUserUtil.getCurrentAppletUserId(); |
|
|
|
|
|
|
|
|
|
|
|
Page<AppletShippingAddress> page1 = appletShippingAddressService |
|
|
|
.lambdaQuery() |
|
|
|
.eq(AppletShippingAddress::getUserId, userId) |
|
|
@ -50,16 +53,16 @@ public class AppletApiAddressServiceImpl implements AppletApiAddressService { |
|
|
|
@Override |
|
|
|
public void save(AppletShippingAddress appletShippingAddress) { |
|
|
|
if (appletShippingAddress == null) { |
|
|
|
throw new IllegalArgumentException("地址信息不能为空"); |
|
|
|
throw new JeecgBootException("地址信息不能为空"); |
|
|
|
} |
|
|
|
if (StrUtil.isBlank(appletShippingAddress.getName())) { |
|
|
|
throw new IllegalArgumentException("收货人不能为空"); |
|
|
|
throw new JeecgBootException("收货人不能为空"); |
|
|
|
} |
|
|
|
if (StrUtil.isBlank(appletShippingAddress.getPhone())) { |
|
|
|
throw new IllegalArgumentException("联系电话不能为空"); |
|
|
|
throw new JeecgBootException("联系电话不能为空"); |
|
|
|
} |
|
|
|
if (StrUtil.isBlank(appletShippingAddress.getDetail())) { |
|
|
|
throw new IllegalArgumentException("详细地址不能为空"); |
|
|
|
throw new JeecgBootException("详细地址不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
String userId = AppletUserUtil.getCurrentAppletUserId(); |
|
|
@ -90,16 +93,16 @@ public class AppletApiAddressServiceImpl implements AppletApiAddressService { |
|
|
|
@Override |
|
|
|
public void updateById(AppletShippingAddress appletShippingAddress) { |
|
|
|
if (appletShippingAddress == null || StrUtil.isBlank(appletShippingAddress.getId())) { |
|
|
|
throw new IllegalArgumentException("地址信息或ID不能为空"); |
|
|
|
throw new JeecgBootException("地址信息或ID不能为空"); |
|
|
|
} |
|
|
|
if (StrUtil.isBlank(appletShippingAddress.getName())) { |
|
|
|
throw new IllegalArgumentException("收货人不能为空"); |
|
|
|
throw new JeecgBootException("收货人不能为空"); |
|
|
|
} |
|
|
|
if (StrUtil.isBlank(appletShippingAddress.getPhone())) { |
|
|
|
throw new IllegalArgumentException("联系电话不能为空"); |
|
|
|
throw new JeecgBootException("联系电话不能为空"); |
|
|
|
} |
|
|
|
if (StrUtil.isBlank(appletShippingAddress.getDetail())) { |
|
|
|
throw new IllegalArgumentException("详细地址不能为空"); |
|
|
|
throw new JeecgBootException("详细地址不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
appletShippingAddressService.updateById(appletShippingAddress); |
|
|
@ -113,7 +116,7 @@ public class AppletApiAddressServiceImpl implements AppletApiAddressService { |
|
|
|
@Override |
|
|
|
public void setDefaultAddress(String addressId) { |
|
|
|
if (StrUtil.isBlank(addressId)) { |
|
|
|
throw new IllegalArgumentException("地址ID不能为空"); |
|
|
|
throw new JeecgBootException("地址ID不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
String userId = AppletUserUtil.getCurrentAppletUserId(); |
|
|
|