|
|
|
@@ -76,7 +76,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
queryWrapperCustomer.in(ObjectUtils.allNotNull(params.getDemandOwner()), |
|
|
|
InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId)); |
|
|
|
} else { |
|
|
|
if(CollectionUtils.isEmpty(demandList)) { |
|
|
|
if (CollectionUtils.isEmpty(demandList)) { |
|
|
|
return investPage; |
|
|
|
} else { |
|
|
|
queryWrapperCustomer.in(InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId)); |
|
|
|
@@ -399,7 +399,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
@Override |
|
|
|
public boolean saveCustomerAndDemand(InvestDemandDto demandDto) { |
|
|
|
InvestHelper.notNull(demandDto, demandDto.getCustomer(), demandDto.getDemand()); |
|
|
|
InvestCustomerEntity customerEntity = demandDto.getCustomer() ; |
|
|
|
InvestCustomerEntity customerEntity = demandDto.getCustomer(); |
|
|
|
customerService.save(customerEntity); |
|
|
|
InvestDemandEntity demandEntity = demandDto.getDemand(); |
|
|
|
demandEntity.setCustomerId(customerEntity.getId()); |
|
|
|
@@ -485,8 +485,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
} |
|
|
|
|
|
|
|
//3、商品合同信息 |
|
|
|
Map<Long, WxRentContract> shopContractMap = rentContractService.selectRentContractByShopIds(Arrays.asList(shop.getId()), StringUtils.join(shop.getId(), "|"), |
|
|
|
InvestUserContext.getUser().getTenantId()); |
|
|
|
Map<Long, WxRentContract> shopContractMap = getWxRentContractMap(shop); |
|
|
|
WxRentContract contract = shopContractMap.get(shop.getId()); |
|
|
|
if (Objects.nonNull(contract)) { |
|
|
|
shopVo.setStartdate(contract.getRentalStartDate()); |
|
|
|
@@ -498,6 +497,12 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
return buildTaskItem(taskEntity, shopVo, usersMap); |
|
|
|
} |
|
|
|
|
|
|
|
private Map<Long, WxRentContract> getWxRentContractMap(WxShop shop) { |
|
|
|
InvestHelper.notNull(shop, "商铺不存在"); |
|
|
|
return rentContractService.selectRentContractByShopIds(Arrays.asList(shop.getId()), StringUtils.join(shop.getId(), "|"), |
|
|
|
InvestUserContext.getUser().getTenantId()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public InvestRemindVo findRemindById(Long id) { |
|
|
|
InvestRemindEntity remindEntity = remindService.getByIdNotNull(id); |
|
|
|
@@ -574,16 +579,26 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
} |
|
|
|
|
|
|
|
private void syncTargetStatus(InvestTaskEntity investTaskEntity) { |
|
|
|
WxRentContract contractQuery = new WxRentContract(); |
|
|
|
contractQuery.setTenantId(InvestUserContext.getUser().getTenantId()); |
|
|
|
contractQuery.setShopId(investTaskEntity.getTargetId()); |
|
|
|
contractQuery.setStatus(EnumRentContractStatus.INTENTION.getCode()); |
|
|
|
int count = rentContractService.selectContractCountByShopId(contractQuery); |
|
|
|
if (count > 0) { |
|
|
|
investTaskEntity.setStatus(EnumTaskStatus.INTENTION); |
|
|
|
if (!Objects.equals(investTaskEntity.getTargetType(), EnumInvestType.RENT)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
WxShop shop = shopService.getById(investTaskEntity.getTargetId()); |
|
|
|
Map<Long, WxRentContract> shopContractMap = getWxRentContractMap(shop); |
|
|
|
WxRentContract contract = shopContractMap.get(shop.getId()); |
|
|
|
if (Objects.nonNull(contract)) { |
|
|
|
InvestHelper.addContractId(investTaskEntity.getContent(), contract.getId()); |
|
|
|
} else { |
|
|
|
if (StringUtils.isNotBlank(investTaskEntity.getOwner())) { |
|
|
|
investTaskEntity.setStatus(EnumTaskStatus.NEGOTIATING); |
|
|
|
WxRentContract contractQuery = new WxRentContract(); |
|
|
|
contractQuery.setTenantId(InvestUserContext.getUser().getTenantId()); |
|
|
|
contractQuery.setShopId(investTaskEntity.getTargetId()); |
|
|
|
contractQuery.setStatus(EnumRentContractStatus.INTENTION.getCode()); |
|
|
|
int count = rentContractService.selectContractCountByShopId(contractQuery); |
|
|
|
if (count > 0) { |
|
|
|
investTaskEntity.setStatus(EnumTaskStatus.INTENTION); |
|
|
|
} else { |
|
|
|
if (StringUtils.isNotBlank(investTaskEntity.getOwner())) { |
|
|
|
investTaskEntity.setStatus(EnumTaskStatus.NEGOTIATING); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -723,7 +738,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
//4、品牌 |
|
|
|
Map<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId); |
|
|
|
//5、用户 |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.getByIds(getIds(demandList,InvestDemandEntity::getOwner)), MallUserInfo::getId); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.getByIds(getIds(demandList, InvestDemandEntity::getOwner)), MallUserInfo::getId); |
|
|
|
|
|
|
|
List<InvestDemandVo> resultList = new ArrayList<>(); |
|
|
|
for (InvestCustomerEntity costomerItem : customers) { |
|
|
|
@@ -753,8 +768,8 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
} |
|
|
|
|
|
|
|
private <T, R> Map<R, T> getMap(Collection<T> dataList, Function<T, R> keyMapper) { |
|
|
|
if(CollectionUtils.isEmpty(dataList)) { |
|
|
|
return new HashMap<>() ; |
|
|
|
if (CollectionUtils.isEmpty(dataList)) { |
|
|
|
return new HashMap<>(); |
|
|
|
} |
|
|
|
return InvestHelper.getMap(dataList, keyMapper); |
|
|
|
} |
|
|
|
|