|
|
@ -58,9 +58,11 @@ import com.epmet.modules.invitation.service.InvitationRecordService; |
|
|
|
import com.epmet.modules.member.service.ResiGroupMemberService; |
|
|
|
import com.epmet.resi.group.dto.act.GroupActIdDTO; |
|
|
|
import com.epmet.resi.group.dto.act.GroupActInfoDTO; |
|
|
|
import com.epmet.resi.group.dto.act.OrganizationalLifeLineChartDTO; |
|
|
|
import com.epmet.resi.group.dto.act.form.*; |
|
|
|
import com.epmet.resi.group.dto.act.result.ActDetailByLinkResultDTO; |
|
|
|
import com.epmet.resi.group.dto.act.result.ActDetailResultDTO; |
|
|
|
import com.epmet.resi.group.dto.act.result.OrganizationalLifeResultDTO; |
|
|
|
import com.epmet.resi.group.dto.group.GroupMessageDTO; |
|
|
|
import com.epmet.resi.group.dto.group.ResiGroupDTO; |
|
|
|
import com.epmet.resi.group.dto.invitation.InvitationRecordDTO; |
|
|
@ -75,6 +77,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -862,4 +865,85 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, Gr |
|
|
|
//6、插入或更新
|
|
|
|
saveGroupMessage(actInfoEntity); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 组织生活 |
|
|
|
* @Param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2021/9/3 2:57 下午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public OrganizationalLifeResultDTO organizationalLife(OrganizationalLifeFormDTO formDTO) { |
|
|
|
OrganizationalLifeResultDTO result = new OrganizationalLifeResultDTO(); |
|
|
|
if (StringUtils.isBlank(formDTO.getYearId())){ |
|
|
|
formDTO.setYearId(String.valueOf(LocalDate.now().getYear())); |
|
|
|
} |
|
|
|
// 小组审核状态为 approved 的,小组类型为 branch 的,人员状态为 approved 的 小组ID
|
|
|
|
// 查询此人是组长,客户下所有支部小组
|
|
|
|
List<String> leaderGroupIds = baseDao.selectBranchGroupByUserId(formDTO.getUserId(),true); |
|
|
|
List<OrganizationalLifeLineChartDTO> chartResult = new ArrayList<>(); |
|
|
|
if (!CollectionUtils.isEmpty(leaderGroupIds)){ |
|
|
|
// 按照yearId查询组织生活【我创建的活动】,组织活动次数、应参加活动次数、活动签到次数
|
|
|
|
OrganizationalLifeResultDTO dto = baseDao.selectOrgLife(formDTO.getUserId(), leaderGroupIds,true,formDTO.getYearId()); |
|
|
|
result.setOrganizationalActCount(dto.getOrganizationalActCount()); |
|
|
|
result.setActSignCount(dto.getActSignCount()); |
|
|
|
// 当此人是组长,创建了几个活动就应参加几个活动
|
|
|
|
result.setShouldJoinActCount(dto.getOrganizationalActCount()); |
|
|
|
List<OrganizationalLifeLineChartDTO> chartDTOS = baseDao.selectLineChart(leaderGroupIds, true, formDTO.getYearId()); |
|
|
|
if (!CollectionUtils.isEmpty(chartDTOS)){ |
|
|
|
chartResult.addAll(chartDTOS); |
|
|
|
} |
|
|
|
} |
|
|
|
// 查询此人不是组长,客户下所有支部小组
|
|
|
|
List<String> memberGroupIds = baseDao.selectBranchGroupByUserId(formDTO.getUserId(),false); |
|
|
|
if (!CollectionUtils.isEmpty(memberGroupIds)){ |
|
|
|
// 按照yearId查询组织生活【我所在支部组的活动】,组织活动次数、应参加活动次数、活动签到次数
|
|
|
|
OrganizationalLifeResultDTO dto = baseDao.selectOrgLife(formDTO.getUserId(), memberGroupIds,false, formDTO.getYearId()); |
|
|
|
result.setActSignCount(result.getActSignCount() + dto.getActSignCount()); |
|
|
|
// 当此人不是组长,支部小组下有几个活动,应参加活动就是几
|
|
|
|
result.setShouldJoinActCount(result.getShouldJoinActCount() + dto.getOrganizationalActCount()); |
|
|
|
// 此人不是组长,我组织的活动这就不加了
|
|
|
|
|
|
|
|
List<OrganizationalLifeLineChartDTO> chartDTOS = baseDao.selectLineChart(memberGroupIds, false, formDTO.getYearId()); |
|
|
|
if (!CollectionUtils.isEmpty(chartDTOS)){ |
|
|
|
chartResult.addAll(chartDTOS); |
|
|
|
} |
|
|
|
} |
|
|
|
// 折线图组装
|
|
|
|
List<OrganizationalLifeLineChartDTO> lineChart = lineChart(); |
|
|
|
if (!CollectionUtils.isEmpty(chartResult)){ |
|
|
|
Map<String, List<OrganizationalLifeLineChartDTO>> groupByMonth = chartResult.stream().collect(Collectors.groupingBy(OrganizationalLifeLineChartDTO::getMonth)); |
|
|
|
groupByMonth.forEach((month,list) -> { |
|
|
|
lineChart.forEach(l -> { |
|
|
|
if (month.equals(l.getMonth())){ |
|
|
|
l.setOrganizationalActCount(list.stream().collect(Collectors.summingInt(OrganizationalLifeLineChartDTO::getOrganizationalActCount))); |
|
|
|
l.setShouldJoinActCount(list.stream().collect(Collectors.summingInt(OrganizationalLifeLineChartDTO::getShouldJoinActCount))); |
|
|
|
l.setActSignCount(list.stream().collect(Collectors.summingInt(OrganizationalLifeLineChartDTO::getActSignCount))); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
result.setLineChart(lineChart); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 折线图构造 |
|
|
|
* @author zxc |
|
|
|
* @date 2021/9/6 10:55 上午 |
|
|
|
*/ |
|
|
|
public List<OrganizationalLifeLineChartDTO> lineChart(){ |
|
|
|
List<OrganizationalLifeLineChartDTO> lineChart = new ArrayList<>(); |
|
|
|
for (int i = NumConstant.ONE; i <= NumConstant.TWELVE; i++) { |
|
|
|
OrganizationalLifeLineChartDTO dto = new OrganizationalLifeLineChartDTO(); |
|
|
|
if (i < NumConstant.TEN){ |
|
|
|
dto.setMonth(NumConstant.ZERO + String.valueOf(i) + "月"); |
|
|
|
}else { |
|
|
|
dto.setMonth(String.valueOf(i) + "月"); |
|
|
|
} |
|
|
|
lineChart.add(dto); |
|
|
|
} |
|
|
|
return lineChart; |
|
|
|
} |
|
|
|
|
|
|
|
} |