|
|
|
@@ -9,11 +9,10 @@ import com.iformall.domain.dto.InvestTaskDto; |
|
|
|
import com.iformall.domain.po.*; |
|
|
|
import com.iformall.domain.po.invest.*; |
|
|
|
import com.iformall.domain.vo.invest.*; |
|
|
|
import com.iformall.enums.EnumFollowType; |
|
|
|
import com.iformall.enums.EnumInvestUserType; |
|
|
|
import com.iformall.enums.EnumNegotiationType; |
|
|
|
import com.iformall.enums.*; |
|
|
|
import com.iformall.service.MallUserInfoService; |
|
|
|
import com.iformall.service.WxBrandService; |
|
|
|
import com.iformall.service.WxRentContractService; |
|
|
|
import com.iformall.service.WxShopService; |
|
|
|
import com.iformall.service.invest.*; |
|
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
|
@@ -53,6 +52,8 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
private WxBrandService brandService; |
|
|
|
@Autowired |
|
|
|
private MallUserInfoService userInfoService; |
|
|
|
@Autowired |
|
|
|
private WxRentContractService rentContractService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public InvestPageResult<InvestDemandVo> queryPageDemand(InvestDemandQuery params) { |
|
|
|
@@ -140,9 +141,24 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
Collection<InvestTaskEntity> taskList = taskPage.getRecords(); |
|
|
|
//2、目标信息 |
|
|
|
Collection<WxShop> shops = shopService.getByIds(getIds(taskList, InvestTaskEntity::getTargetId)); |
|
|
|
//3、商品合同信息 |
|
|
|
Map<Long, WxRentContract> shopContractMap = new HashMap<>(); |
|
|
|
if (CollectionUtils.isNotEmpty(shops)) { |
|
|
|
Collection<Long> shopPointIds = buildShopContractQuery(shops, EnumRentShopType.POINT); |
|
|
|
Collection<Long> shopIds = buildShopContractQuery(shops, EnumRentShopType.SHOP); |
|
|
|
shopContractMap = rentContractService.selectRentContractByShopIds(shopPointIds, StringUtils.join(shopIds, "|")); |
|
|
|
} |
|
|
|
for (WxShop shop : shops) { |
|
|
|
WxRentContract contract = shopContractMap.get(shop.getId()); |
|
|
|
if (Objects.nonNull(contract)) { |
|
|
|
shop.setStartdate(contract.getRentalStartDate()); |
|
|
|
shop.setEnddate(contract.getEndDate()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Map<Long, WxShop> shopsMap = getMap(shops, WxShop::getId); |
|
|
|
//3、用户信息 |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId); |
|
|
|
//4、用户信息 |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(null), MallUserInfo::getId); |
|
|
|
List<InvestTaskVo> resultList = new ArrayList<>(); |
|
|
|
for (InvestTaskEntity item : taskList) { |
|
|
|
WxShop shop = shopsMap.get(item.getTargetId()); |
|
|
|
@@ -153,6 +169,17 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
return investPage; |
|
|
|
} |
|
|
|
|
|
|
|
private Collection<Long> buildShopContractQuery(Collection<WxShop> shops, EnumRentShopType shopType) { |
|
|
|
Collection<Long> shopIds = new ArrayList<>(); |
|
|
|
if (CollectionUtils.isNotEmpty(shops)) { |
|
|
|
shopIds = InvestHelper.getIds(shops, wxShop -> Objects.equals(wxShop.getType(), shopType.getCode()), WxShop::getId); |
|
|
|
} |
|
|
|
if (CollectionUtils.isEmpty(shopIds)) { |
|
|
|
shopIds.add(00L); |
|
|
|
} |
|
|
|
return shopIds; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private InvestTaskDto doConvertTask(InvestTaskQuery params) { |
|
|
|
InvestTaskEntity task = new InvestTaskEntity(); |
|
|
|
@@ -195,7 +222,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
Collection<InvestFollowRecordEntity> recordList = recordPage.getRecords(); |
|
|
|
|
|
|
|
//2、用户信息 |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(null), MallUserInfo::getId); |
|
|
|
|
|
|
|
//3、客户 |
|
|
|
Collection<InvestCustomerEntity> customers = customerService.listByIds(getIds(recordList, InvestFollowRecordEntity::getCustomerId)); |
|
|
|
@@ -292,8 +319,14 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<MallUserInfo> queryUserList() { |
|
|
|
return queryUserList(EnumInvestUserType.USER); |
|
|
|
} |
|
|
|
|
|
|
|
public List<MallUserInfo> queryUserList(EnumInvestUserType userType) { |
|
|
|
LambdaQueryWrapper<MallUserInfo> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(MallUserInfo::getInvestRule, EnumInvestUserType.USER.getCode()); |
|
|
|
if (Objects.nonNull(userType)) { |
|
|
|
queryWrapper.eq(MallUserInfo::getInvestRule, userType.getCode()); |
|
|
|
} |
|
|
|
return userInfoService.selectList(queryWrapper); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -329,7 +362,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
InvestDemandEntity demandEntity = demandService.getByCustomerId(customerEntity.getId()); |
|
|
|
WxBrand brand = brandService.getById(customerEntity.getBrandId()); |
|
|
|
WxShop shop = shopService.getById(demandEntity.getTargetId()); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(null), MallUserInfo::getId); |
|
|
|
return buildDemindItem(demandEntity, customerEntity, brand, shop, usersMap); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -337,7 +370,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
public InvestTaskVo findTaskById(Long id) { |
|
|
|
InvestTaskEntity taskEntity = taskService.getByIdNotNull(id); |
|
|
|
WxShop shop = shopService.getById(taskEntity.getTargetId()); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(null), MallUserInfo::getId); |
|
|
|
return buildTaskItem(taskEntity, shop, usersMap); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -422,7 +455,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
@Override |
|
|
|
public InvestFollowRecordVo findFollowRecordById(Long id) { |
|
|
|
InvestFollowRecordEntity followRecordEntity = followRecordService.getByIdNotNull(id); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(null), MallUserInfo::getId); |
|
|
|
InvestCustomerEntity customerEntity = customerService.getByIdNotNull(followRecordEntity.getCustomerId()); |
|
|
|
WxBrand brand = brandService.getById(customerEntity.getBrandId()); |
|
|
|
return buildFollowRecordItem(usersMap, followRecordEntity, customerEntity, brand); |
|
|
|
|