|
|
|
@ -9,6 +9,7 @@ import com.hfkj.entity.GoodsUserAddress; |
|
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
|
import com.hfkj.model.UserSessionObject; |
|
|
|
|
import com.hfkj.service.goods.GoodsUserAddressService; |
|
|
|
|
import com.hfkj.service.goods.impl.GoodsUserAddressServiceImpl; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
@ -29,6 +30,7 @@ public class DeliveryAddressController { |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private UserCenter userCenter; |
|
|
|
|
private GoodsUserAddressServiceImpl goodsUserAddressService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getDeliveryAddressList", method = RequestMethod.GET) |
|
|
|
@ -197,4 +199,32 @@ public class DeliveryAddressController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getUserAddress", method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "获取默认地址") |
|
|
|
|
public ResponseData getUserAddress() { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
// 用户session
|
|
|
|
|
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class); |
|
|
|
|
|
|
|
|
|
Map<String , Object> map = new HashMap<>(); |
|
|
|
|
map.put("userId" , userSession.getUser().getId()); |
|
|
|
|
map.put("whetherDefault" , true); |
|
|
|
|
|
|
|
|
|
GoodsUserAddress userAddress = goodsUserAddressService.queryDetailByMap(map); |
|
|
|
|
|
|
|
|
|
if (userAddress == null) { |
|
|
|
|
log.error("GoodsDetailController -> findGoodsDetailById() error!"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相信息"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(userAddress); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("GoodsDetailController --> findGoodsDetailById() error!", e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|