| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | |
| | | |
| | | @Override |
| | | public Integer create(AddrDTO addrDTO,Integer memberId) { |
| | | |
| | | if(Objects.isNull(addrDTO) |
| | | || StringUtils.isBlank(addrDTO.getAddr()) |
| | | || StringUtils.isBlank(addrDTO.getName()) |
| | | || StringUtils.isBlank(addrDTO.getPhone()) |
| | | || Objects.isNull(addrDTO.getAreaId()) |
| | | || Objects.isNull(addrDTO.getIsDefault()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | Addr addr = new Addr(); |
| | | addr.setMemberId(memberId); |
| | | addr.setIsDefault(addrDTO.getIsDefault()); |
| | |
| | | |
| | | @Override |
| | | public void update(AddrDTO addrDTO) { |
| | | if(Objects.isNull(addrDTO) |
| | | || StringUtils.isBlank(addrDTO.getAddr()) |
| | | || StringUtils.isBlank(addrDTO.getName()) |
| | | || StringUtils.isBlank(addrDTO.getPhone()) |
| | | || Objects.isNull(addrDTO.getAreaId()) |
| | | || Objects.isNull(addrDTO.getIsDefault()) |
| | | || Objects.isNull(addrDTO.getId()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | //存在设置 |
| | | if (Objects.nonNull(addrDTO.getIsDefault()) |
| | | && Constants.equalsInteger(addrDTO.getIsDefault(),Constants.ONE)){ |