|
|
@ -14,21 +14,17 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.modules.partyOrg.dao.IcPartyActDao; |
|
|
|
import com.epmet.modules.partyOrg.dao.IcPartyActOrgDao; |
|
|
|
import com.epmet.modules.partyOrg.dao.IcScheduleDao; |
|
|
|
import com.epmet.commons.tools.utils.SpringContextUtils; |
|
|
|
import com.epmet.modules.partyOrg.dao.*; |
|
|
|
import com.epmet.modules.partyOrg.entity.IcPartyActEntity; |
|
|
|
import com.epmet.modules.partyOrg.entity.IcPartyActOrgEntity; |
|
|
|
import com.epmet.modules.partyOrg.entity.IcPartyActOrgEntity; |
|
|
|
import com.epmet.modules.partyOrg.entity.ResiPartymemberAttachmentEntity; |
|
|
|
import com.epmet.modules.partyOrg.service.IcPartyActOrgService; |
|
|
|
import com.epmet.modules.partyOrg.service.IcPartyActService; |
|
|
|
import com.epmet.modules.partyOrg.service.IcPartyOrgService; |
|
|
|
import com.epmet.modules.partyOrg.service.ResiPartymemberAttachmentService; |
|
|
|
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; |
|
|
|
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; |
|
|
|
import com.epmet.modules.partyOrg.service.ResiPartymemberAttachmentService; |
|
|
|
import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActAddOrUpdateFormDTO; |
|
|
|
import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActPageFormDTO; |
|
|
|
import com.epmet.resi.partymember.dto.icpartyact.result.IcPartActTypeDTO; |
|
|
@ -46,11 +42,6 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -276,9 +267,64 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<ActAndScheduleListResultDTO> homeSearch(ActAndScheduleListFormDTO formDTO) { |
|
|
|
return null; |
|
|
|
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())); |
|
|
|
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())); |
|
|
|
}); |
|
|
|
Map<String, List<ActAndScheduleListResultDTO.ActivityListDTO>> groupByDateId = activityList.stream().collect(Collectors.groupingBy(ActAndScheduleListResultDTO.ActivityListDTO::getDateId)); |
|
|
|
result.forEach(r -> { |
|
|
|
groupByDateId.forEach((dateId,list) -> { |
|
|
|
if (r.getDateId().equals(dateId)){ |
|
|
|
r.setActivityList(list); |
|
|
|
r.setActivityTotal(list.size()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
List<ActAndScheduleListResultDTO.ScheduleListDTO> scheduleList = scheduleDao.getScheduleList(formDTO); |
|
|
|
if (CollectionUtils.isNotEmpty(scheduleList)){ |
|
|
|
scheduleList.forEach(s -> { |
|
|
|
s.setIsMe(formDTO.getStaffId().equals(s.getStaffId())); |
|
|
|
}); |
|
|
|
Map<String, List<ActAndScheduleListResultDTO.ScheduleListDTO>> groupByDateId = scheduleList.stream().collect(Collectors.groupingBy(ActAndScheduleListResultDTO.ScheduleListDTO::getDateId)); |
|
|
|
result.forEach(r -> { |
|
|
|
groupByDateId.forEach((dateId,list) -> { |
|
|
|
if (r.getDateId().equals(dateId)){ |
|
|
|
r.setScheduleList(list); |
|
|
|
r.setScheduleTotal(list.size()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public static List<ActAndScheduleListResultDTO> constructHomeSearchData(String startDate,String endDate){ |
|
|
|
List<ActAndScheduleListResultDTO> result = new ArrayList<>(); |
|
|
|
if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)){ |
|
|
|
List<String> days = DateUtils.getDaysBetween(startDate, endDate); |
|
|
|
days.forEach(d -> { |
|
|
|
ActAndScheduleListResultDTO dto = new ActAndScheduleListResultDTO(); |
|
|
|
dto.setDateId(d); |
|
|
|
result.add(dto); |
|
|
|
}); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 党建小助手活动触发为用户推送消息 |
|
|
|
*/ |
|
|
|