|
|
@ -247,26 +247,10 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public ActAndScheduleListResultDTO getActAndScheduleList(ActAndScheduleListFormDTO formDTO) { |
|
|
|
CustomerStaffInfoCacheResult staffInfo = queryStaffInfo(formDTO.getCustomerId(),formDTO.getStaffId()); |
|
|
|
formDTO.setAgencyId(staffInfo.getAgencyId()); |
|
|
|
IcPartyOrgDTO icPartyOrgDTO = partyOrgService.get(formDTO.getOrgId()); |
|
|
|
if (null == icPartyOrgDTO){ |
|
|
|
throw new EpmetException("未查询到党组织信息:"+formDTO.getOrgId()); |
|
|
|
} |
|
|
|
formDTO.setPath(icPartyOrgDTO.getOrgPids().equals("") || icPartyOrgDTO.getOrgPids().equals(NumConstant.ZERO_STR) ? icPartyOrgDTO.getId() : icPartyOrgDTO.getOrgPids().concat(":").concat(icPartyOrgDTO.getId())); |
|
|
|
disposeActAndScheduleListFormDTO(formDTO); |
|
|
|
List<ActAndScheduleListResultDTO.ActivityListDTO> activityList = baseDao.getActivityList(formDTO); |
|
|
|
if (CollectionUtils.isNotEmpty(activityList)){ |
|
|
|
List<String> partyOrgIdsNoDistinct = new ArrayList<>(); |
|
|
|
activityList.forEach(a -> { |
|
|
|
partyOrgIdsNoDistinct.addAll(a.getJoinOrgList().stream().map(m -> m.getPartyOrgId()).collect(Collectors.toList())); |
|
|
|
}); |
|
|
|
List<String> partyOrgIds = partyOrgIdsNoDistinct.stream().distinct().collect(Collectors.toList()); |
|
|
|
List<ActAndScheduleListResultDTO.JoinOrgDTO> partyOrg = partyOrgDao.getPartyOrg(partyOrgIds); |
|
|
|
activityList.forEach(a -> { |
|
|
|
a.setIsMe(formDTO.getStaffId().equals(a.getStaffId())); |
|
|
|
a.getJoinOrgList().forEach(po -> partyOrg.stream().filter(p -> p.getPartyOrgId().equals(po.getPartyOrgId())).forEach(p -> po.setPartyOrgName(p.getPartyOrgName()))); |
|
|
|
a.setJoinOrgs(a.getJoinOrgList().stream().map(m -> m.getPartyOrgName()).collect(Collectors.toList())); |
|
|
|
}); |
|
|
|
disposeActivityList(formDTO,activityList); |
|
|
|
} |
|
|
|
List<ActAndScheduleListResultDTO.ScheduleListDTO> scheduleList = scheduleDao.getScheduleList(formDTO); |
|
|
|
if (CollectionUtils.isNotEmpty(scheduleList)){ |
|
|
@ -288,22 +272,11 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<ActAndScheduleListResultDTO> homeSearch(ActAndScheduleListFormDTO formDTO) { |
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); |
|
|
|
if (null == staffInfo){ |
|
|
|
throw new EpmetException("查询工作人员失败:"+formDTO.getStaffId()); |
|
|
|
} |
|
|
|
formDTO.setAgencyId(staffInfo.getAgencyId()); |
|
|
|
IcPartyOrgDTO icPartyOrgDTO = partyOrgService.get(formDTO.getOrgId()); |
|
|
|
if (null == icPartyOrgDTO){ |
|
|
|
throw new EpmetException("未查询到党组织信息:"+formDTO.getOrgId()); |
|
|
|
} |
|
|
|
formDTO.setPath(icPartyOrgDTO.getOrgPids().equals("") || icPartyOrgDTO.getOrgPids().equals(NumConstant.ZERO_STR) ? icPartyOrgDTO.getId() : icPartyOrgDTO.getOrgPids().concat(":").concat(icPartyOrgDTO.getId())); |
|
|
|
disposeActAndScheduleListFormDTO(formDTO); |
|
|
|
List<ActAndScheduleListResultDTO> result = constructHomeSearchData(formDTO.getStartDate(), formDTO.getEndDate()); |
|
|
|
List<ActAndScheduleListResultDTO.ActivityListDTO> activityList = baseDao.getActivityList(formDTO); |
|
|
|
if (CollectionUtils.isNotEmpty(activityList)){ |
|
|
|
activityList.forEach(a -> { |
|
|
|
a.setIsMe(formDTO.getStaffId().equals(a.getStaffId())); |
|
|
|
}); |
|
|
|
disposeActivityList(formDTO,activityList); |
|
|
|
Map<String, List<ActAndScheduleListResultDTO.ActivityListDTO>> groupByDateId = activityList.stream().collect(Collectors.groupingBy(ActAndScheduleListResultDTO.ActivityListDTO::getDateId)); |
|
|
|
result.forEach(r -> { |
|
|
|
groupByDateId.forEach((dateId,list) -> { |
|
|
@ -331,6 +304,50 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc: |
|
|
|
* @param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2022/8/19 17:26 |
|
|
|
*/ |
|
|
|
public void disposeActAndScheduleListFormDTO(ActAndScheduleListFormDTO formDTO){ |
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); |
|
|
|
if (null == staffInfo){ |
|
|
|
throw new EpmetException("查询工作人员失败:"+formDTO.getStaffId()); |
|
|
|
} |
|
|
|
formDTO.setAgencyId(staffInfo.getAgencyId()); |
|
|
|
IcPartyOrgDTO icPartyOrgDTO = partyOrgService.get(formDTO.getOrgId()); |
|
|
|
if (null == icPartyOrgDTO){ |
|
|
|
throw new EpmetException("未查询到党组织信息:"+formDTO.getOrgId()); |
|
|
|
} |
|
|
|
formDTO.setPath(icPartyOrgDTO.getOrgPids().equals("") || icPartyOrgDTO.getOrgPids().equals(NumConstant.ZERO_STR) ? icPartyOrgDTO.getId() : icPartyOrgDTO.getOrgPids().concat(":").concat(icPartyOrgDTO.getId())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc: 组装activityList |
|
|
|
* @param formDTO |
|
|
|
* @param activityList |
|
|
|
* @author zxc |
|
|
|
* @date 2022/8/19 17:19 |
|
|
|
*/ |
|
|
|
public void disposeActivityList(ActAndScheduleListFormDTO formDTO,List<ActAndScheduleListResultDTO.ActivityListDTO> activityList){ |
|
|
|
List<String> partyOrgIdsNoDistinct = new ArrayList<>(); |
|
|
|
activityList.forEach(a -> { |
|
|
|
partyOrgIdsNoDistinct.addAll(a.getJoinOrgList().stream().map(m -> m.getPartyOrgId()).collect(Collectors.toList())); |
|
|
|
}); |
|
|
|
List<String> partyOrgIds = partyOrgIdsNoDistinct.stream().distinct().collect(Collectors.toList()); |
|
|
|
List<ActAndScheduleListResultDTO.JoinOrgDTO> partyOrg = partyOrgDao.getPartyOrg(partyOrgIds); |
|
|
|
if (CollectionUtils.isNotEmpty(activityList)) { |
|
|
|
activityList.forEach(a -> { |
|
|
|
a.setIsMe(formDTO.getStaffId().equals(a.getStaffId())); |
|
|
|
a.getJoinOrgList().forEach(po -> partyOrg.stream().filter(p -> p.getPartyOrgId().equals(po.getPartyOrgId())).forEach(p -> po.setPartyOrgName(p.getPartyOrgName()))); |
|
|
|
a.setJoinOrgs(a.getJoinOrgList().stream().map(m -> m.getPartyOrgName()).collect(Collectors.toList())); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static List<ActAndScheduleListResultDTO> constructHomeSearchData(String startDate,String endDate){ |
|
|
|
List<ActAndScheduleListResultDTO> result = new ArrayList<>(); |
|
|
|
if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)){ |
|
|
|