|
|
|
@@ -340,15 +340,10 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
@Override |
|
|
|
public boolean saveCustomerAndDemand(InvestDemandDto demandDto) { |
|
|
|
InvestHelper.notNull(demandDto, demandDto.getCustomer(), demandDto.getDemand()); |
|
|
|
InvestCustomerEntity customerEntityDB = customerService.getByIdNotNull(demandDto.getCustomer().getId()); |
|
|
|
if (Objects.isNull(customerEntityDB)) { |
|
|
|
customerEntityDB = demandDto.getCustomer(); |
|
|
|
customerService.save(customerEntityDB); |
|
|
|
} else { |
|
|
|
customerService.updateById(demandDto.getCustomer()); |
|
|
|
} |
|
|
|
InvestCustomerEntity customerEntity = demandDto.getCustomer() ; |
|
|
|
customerService.save(customerEntity); |
|
|
|
InvestDemandEntity demandEntity = demandDto.getDemand(); |
|
|
|
demandEntity.setCustomerId(customerEntityDB.getId()); |
|
|
|
demandEntity.setCustomerId(customerEntity.getId()); |
|
|
|
return demandService.save(demandEntity); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -356,9 +351,16 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
@Override |
|
|
|
public boolean updateCustomerAndDemand(InvestDemandDto demandDto) { |
|
|
|
InvestHelper.notNull(demandDto, demandDto.getCustomer(), demandDto.getDemand()); |
|
|
|
Long customerId = demandDto.getCustomer().getId(); |
|
|
|
if (Objects.isNull(customerId)) { |
|
|
|
customerId = demandDto.getDemand().getCustomerId(); |
|
|
|
demandDto.getCustomer().setId(customerId); |
|
|
|
} |
|
|
|
customerService.updateById(demandDto.getCustomer()); |
|
|
|
InvestDemandEntity demandEntity = demandDto.getDemand(); |
|
|
|
demandEntity.setCustomerId(demandDto.getCustomer().getId()); |
|
|
|
if (Objects.isNull(demandEntity.getCustomerId())) { |
|
|
|
demandEntity.setCustomerId(customerId); |
|
|
|
} |
|
|
|
return demandService.updateById(demandEntity); |
|
|
|
} |
|
|
|
|
|
|
|
|