|
|
|
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.dto.InvestDemandDto; |
|
|
|
import com.iformall.domain.dto.InvestTaskDto; |
|
|
|
import com.iformall.domain.po.*; |
|
|
|
@@ -772,6 +773,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
public boolean saveCustomerAndDemand(InvestDemandDto demandDto) { |
|
|
|
InvestHelper.notNull(demandDto, demandDto.getCustomer(), demandDto.getDemand()); |
|
|
|
InvestCustomerEntity customerEntity = demandDto.getCustomer(); |
|
|
|
checkCustomer(customerEntity); |
|
|
|
customerService.save(customerEntity); |
|
|
|
InvestDemandEntity demandEntity = demandDto.getDemand(); |
|
|
|
demandEntity.setCustomerId(customerEntity.getId()); |
|
|
|
@@ -780,16 +782,29 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
private void checkCustomer(InvestCustomerEntity customerEntity) { |
|
|
|
if (Objects.equals(customerEntity.getType(), EnumCustomerType.COOPERATIVE)) { |
|
|
|
InvestHelper.notNull(customerEntity.getContractNo(), "合同编号"); |
|
|
|
WxRentContract contract = new WxRentContract(); |
|
|
|
contract.setTenantId(InvestUserContext.getUser().getTenantId()); |
|
|
|
contract.setContractNumber(customerEntity.getContractNo()); |
|
|
|
ResultData resultData = rentContractService.hasContractNumber(contract); |
|
|
|
InvestHelper.isTrue(Objects.equals(resultData.data, true),ErrorCode.INVEST_RESULT_NOT_FOUND,"合同编号"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public boolean updateCustomerAndDemand(InvestDemandDto demandDto) { |
|
|
|
InvestHelper.notNull(demandDto, demandDto.getCustomer(), demandDto.getDemand()); |
|
|
|
Long customerId = demandDto.getCustomer().getId(); |
|
|
|
InvestCustomerEntity customerEntity = demandDto.getCustomer(); |
|
|
|
if (Objects.isNull(customerId)) { |
|
|
|
customerId = demandDto.getDemand().getCustomerId(); |
|
|
|
demandDto.getCustomer().setId(customerId); |
|
|
|
customerEntity.setId(customerId); |
|
|
|
} |
|
|
|
customerService.updateById(demandDto.getCustomer()); |
|
|
|
checkCustomer(customerEntity); |
|
|
|
customerService.updateById(customerEntity); |
|
|
|
InvestDemandEntity demandEntity = demandDto.getDemand(); |
|
|
|
if (Objects.isNull(demandEntity.getCustomerId())) { |
|
|
|
demandEntity.setCustomerId(customerId); |
|
|
|
@@ -800,7 +815,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
} else { |
|
|
|
demandService.updateById(demandEntity); |
|
|
|
} |
|
|
|
saveMessage(demandEntity, demandDto.getCustomer()); |
|
|
|
saveMessage(demandEntity, customerEntity); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
|