package com.ruoyi.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.domain.*;
|
import com.ruoyi.mapper.ZfShareMapper;
|
import com.ruoyi.service.*;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.util.*;
|
import java.util.stream.Collectors;
|
|
@Service
|
public class ShareACollectionServiceImpl extends ServiceImpl<ZfShareMapper, ZfShare> implements ShareACollectionService {
|
|
@Resource
|
private ZfEventService zfEventService;
|
|
@Resource
|
private IZfPropertyService iZfPropertyService;
|
|
@Resource
|
private ZfEquipmentService zfEquipmentService;
|
|
@Resource
|
private ZfCollectionService zfCollectionService;
|
|
@Resource
|
private ZfDoctorService zfDoctorService;
|
|
@Resource
|
private ZfCleanService zfCleanService;
|
|
@Resource
|
private ZfContactService zfContactService;
|
|
@Resource
|
private ZfPetService zfPetService;
|
|
@Resource
|
private ZfEconomyService zfEconomyService;
|
|
@Resource
|
private ZSelfNoteService zSelfNoteService;
|
|
@Resource
|
private ZPropertyService zPropertyService;
|
|
@Resource
|
private ZIdeaService zIdeaService;
|
|
@Resource
|
private TravelCountService travelCountService;
|
|
@Resource
|
private TravelDetailService travelDetailService;
|
|
@Resource
|
private ZHonorService zHonorService;
|
|
@Resource
|
private ZSecretService zSecretService;
|
|
@Resource
|
private ZfDoctorDownloadService zfDoctorDownloadService;
|
|
@Override
|
public AjaxResult allMyDownload(Long userId) {
|
List<ZfDownload> byUserId = zfDoctorDownloadService.getByUserId(userId);
|
Map<Long,List<Long>> menuAconId =byUserId.stream().collect(Collectors.groupingBy(ZfDownload::getSysMenuId,Collectors.mapping(ZfDownload::getDownloadContent,Collectors.toList())));
|
return AjaxResult.success(all(menuAconId));
|
}
|
|
|
public List<ZfShare> getByUserId(Long userId) {
|
LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
|
lqw.eq(ZfShare::getUserId, userId);
|
|
return list(lqw);
|
}
|
public Map<Long, Object> all(Map<Long,List<Long>> menuAconId){
|
Set<Long> key = menuAconId.keySet();
|
Map<Long, Object> an = new HashMap<>();
|
if (key.contains(2013L))
|
an.put(2013L,zfEventService.selectByIds(menuAconId.get(2013L).toArray(Long[]::new)));
|
if (key.contains(2002L))
|
an.put(2002L,iZfPropertyService.selectByIds(menuAconId.get(2002L).toArray(Long[]::new)));
|
if (key.contains(2017L))
|
an.put(2017L,zfEquipmentService.selectByIds(menuAconId.get(2017L).toArray(Long[]::new)));
|
if (key.contains(2018L))
|
an.put(2018L,zfCollectionService.selectByIds(menuAconId.get(2018L).toArray(Long[]::new)));
|
if (key.contains(2019L))
|
an.put(2019L,zfDoctorService.selectByIds(menuAconId.get(2019L).toArray(Long[]::new)));
|
if (key.contains(2020L))
|
an.put(2020L,zfCleanService.selectByIds(menuAconId.get(2020L).toArray(Long[]::new)));
|
if (key.contains(2021L))
|
an.put(2021L,zfContactService.selectByIds(menuAconId.get(2021L).toArray(Long[]::new)));
|
if (key.contains(2022L))
|
an.put(2022L,zfPetService.selectByIds(menuAconId.get(2022L).toArray(Long[]::new)));
|
if (key.contains(2023L))
|
an.put(2023L,zfEconomyService.selectByIds(menuAconId.get(2023L).toArray(Long[]::new)));
|
if (key.contains(2010L))
|
an.put(2010L,zSelfNoteService.selectByIds(menuAconId.get(2010L).toArray(Long[]::new)));
|
if (key.contains(2026L))
|
an.put(2026L,zPropertyService.selectByIds(menuAconId.get(2026L).toArray(Long[]::new)));
|
if (key.contains(2027L))
|
an.put(2027L,zIdeaService.selectByIds(menuAconId.get(2027L).toArray(Long[]::new)));
|
if (key.contains(2030L))
|
an.put(2030L,zHonorService.selectByIds(menuAconId.get(2030L).toArray(Long[]::new)));
|
if (key.contains(2031L))
|
an.put(2031L,zSecretService.selectByIds(menuAconId.get(2031L).toArray(Long[]::new)));
|
if (key.contains(2031L))
|
an.put(2031L,zSecretService.selectByIds(menuAconId.get(2031L).toArray(Long[]::new)));
|
if (key.contains(2056L)) {
|
List<TravelCount> travelCounts = new ArrayList<>();
|
for (Long id : menuAconId.get(2056L)) {
|
travelCounts.add(travelCountService.getById(id));
|
}
|
an.put(2056L,travelCounts);
|
}
|
if (key.contains(2055L)) {
|
List<TravelDetail> travelDetails = new ArrayList<>();
|
for (Long id : menuAconId.get(2055L)) {
|
travelDetails.add(travelDetailService.getById(id));
|
}
|
an.put(2055L,travelDetails.stream().collect(Collectors.groupingBy(TravelDetail::getCid)));
|
}
|
return an;
|
}
|
|
@Override
|
public AjaxResult allMyShare(Long userId) {
|
Map<Long,List<Long>> menuAconId = getByUserId(userId).stream().collect(Collectors.groupingBy(ZfShare::getSysMenuId,Collectors.mapping(ZfShare::getShareContent,Collectors.toList())));
|
return AjaxResult.success(all(menuAconId));
|
}
|
}
|