| | |
| | | public int addOrEditCustomer(CustomerDto customerDto) { |
| | | Customer customer = new Customer(); |
| | | BeanUtils.copyProperties(customerDto, customer); |
| | | if (customerDto.getBids().size() != 3) { |
| | | throw new RuntimeException("请选择经营地址省市区"); |
| | | } |
| | | |
| | | if (customerDto.getCids().size() != 3) { |
| | | throw new RuntimeException("请选择联系地址省市区"); |
| | | } |
| | | |
| | | if (customerDto.getBids() != null && customerDto.getBids().size() == 3) { |
| | | customer.setBusinessProvinceId(customerDto.getBids().get(0)); |
| | | customer.setBusinessCityId(customerDto.getBids().get(1)); |
| | | customer.setBusinessDistrictId(customerDto.getBids().get(2)); |
| | | } |
| | | |
| | | if (customerDto.getCids() != null && customerDto.getCids().size() == 3) { |
| | | customer.setProvinceId(customerDto.getCids().get(0)); |
| | | customer.setCityId(customerDto.getCids().get(1)); |
| | | customer.setDistrictId(customerDto.getCids().get(2)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | if (Objects.isNull(customerDto.getId())) { |
| | | return customerMapper.insert(customer); |