Commit 24f953a3 authored by Shen's avatar Shen

1.用户地址 添加”查询个人及家人收货地址“接口

parent a5a3d57f
......@@ -92,7 +92,7 @@ public class PensionConsigneeController {
public Result delete(@RequestBody Long[] ids){
//校验数据
AssertUtils.isArrayEmpty(ids, "id");
//查询是否默认地址,如果删除的地址是默认地址,应将某个地址设为默认地址
pensionConsigneeService.delete(ids);
return new Result();
......@@ -113,6 +113,14 @@ public class PensionConsigneeController {
return new Result<List<PensionConsigneeDTO>>().ok(pensionConsigneeDTOList);
}
@Login
@GetMapping("findMyFamilyAddress")
@ApiOperation("查询个人及家人收货地址")
public Result<List<PensionConsigneeDTO>> findMyFamilyAddress(@ApiIgnore @LoginUser UserEntity user){
List<PensionConsigneeDTO> pensionConsigneeDTOList = pensionConsigneeService.findMyFamilyAddress(user.getId());
return new Result<List<PensionConsigneeDTO>>().ok(pensionConsigneeDTOList);
}
@Login
@PostMapping("addMyAddress")
@ApiOperation("添加我的收货地址")
......
......@@ -17,6 +17,8 @@ public interface PensionConsigneeService extends CrudService<PensionConsigneeEnt
List<PensionConsigneeDTO> findByUserId(Long userId);
List<PensionConsigneeDTO> findMyFamilyAddress(Long userId);
void addUserAddress(Map<String, Object> params);
}
\ No newline at end of file
......@@ -6,8 +6,10 @@ import io.hmit.common.utils.ConvertUtils;
import io.hmit.modules.serviceOrder.dao.PensionConsigneeDao;
import io.hmit.modules.serviceOrder.dto.PensionConsigneeAddDTO;
import io.hmit.modules.serviceOrder.dto.PensionConsigneeDTO;
import io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO;
import io.hmit.modules.serviceOrder.entity.PensionConsigneeEntity;
import io.hmit.modules.serviceOrder.service.PensionConsigneeService;
import io.hmit.modules.serviceOrder.service.PensionOldFamilyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -39,6 +41,9 @@ public class PensionConsigneeServiceImpl extends CrudServiceImpl<PensionConsigne
@Autowired
private PensionConsigneeDao pensionConsigneeDao;
@Autowired
private PensionOldFamilyService pensionOldFamilyService;
@Override
public List<PensionConsigneeDTO> findByUserId(Long userId) {
QueryWrapper<PensionConsigneeEntity> queryWrapper = new QueryWrapper<>();
......@@ -47,6 +52,20 @@ public class PensionConsigneeServiceImpl extends CrudServiceImpl<PensionConsigne
return ConvertUtils.sourceToTarget(platformPayInfoEntityList, PensionConsigneeDTO.class);
}
@Override
public List<PensionConsigneeDTO> findMyFamilyAddress(Long userId) {
//查询个人及家庭的userId
List<PensionOldFamilyDTO> familyDTOS = pensionOldFamilyService.findByOldId(userId);
List<PensionConsigneeDTO> userAddressList = findByUserId(userId);
for (PensionOldFamilyDTO pensionOldFamilyDTO : familyDTOS) {
List<PensionConsigneeDTO> address = findByUserId(pensionOldFamilyDTO.getFamilyMemberId());
if (address.size() >= 1) {
userAddressList.addAll(address);
}
}
return userAddressList;
}
@Override
public void addUserAddress(Map<String, Object> params) {
Integer ifDefault = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment