From 55ad8f40191b3185b6d4ff3aac20ae092d616756 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Sat, 18 Sep 2021 10:15:12 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=94=9F=E6=B4=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resi/group/dto/act/LineChartDTO.java | 25 +++++++++++ .../modules/act/dao/GroupActInfoDao.java | 28 ++++++++++++ .../service/impl/GroupActInfoServiceImpl.java | 44 ++++++++++++++++++- .../resources/mapper/act/GroupActInfoDao.xml | 43 ++++++++++++++++++ 4 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/LineChartDTO.java diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/LineChartDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/LineChartDTO.java new file mode 100644 index 0000000000..94ac78be16 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/LineChartDTO.java @@ -0,0 +1,25 @@ +package com.epmet.resi.group.dto.act; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/9/18 9:37 上午 + * @DESC + */ +@Data +public class LineChartDTO implements Serializable { + + private static final long serialVersionUID = -8479227864670104465L; + + private Integer value; + + private String month; + + public LineChartDTO() { + this.value = NumConstant.ZERO; + } +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActInfoDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActInfoDao.java index c4082b67c9..db9e155e6a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActInfoDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActInfoDao.java @@ -19,6 +19,7 @@ package com.epmet.modules.act.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.act.entity.GroupActInfoEntity; +import com.epmet.resi.group.dto.act.LineChartDTO; import com.epmet.resi.group.dto.act.OrganizationalLifeLineChartDTO; import com.epmet.resi.group.dto.act.form.OrganizationalLifeFormDTO; import com.epmet.resi.group.dto.act.result.OrganizationalLifeResultDTO; @@ -67,4 +68,31 @@ public interface GroupActInfoDao extends BaseDao { List selectLineChart(@Param("groupIds") List groupId,@Param("leaderFlag")Boolean leaderFlag, @Param("yearId")String yearId); + /** + * @Description 查询我创建的活动 + * @Param userId + * @Param yearId + * @author zxc + * @date 2021/9/18 9:23 上午 + */ + List selectMyCreateActTypeMonth(@Param("userId")String userId,@Param("yearId")String yearId); + + /** + * @Description 查询应参与的活动 + * @Param userId + * @Param yearId + * @author zxc + * @date 2021/9/18 9:25 上午 + */ + List selectShouldJoinActTypeMonth(@Param("userId")String userId,@Param("yearId")String yearId); + + /** + * @Description 查询活动签到次数 + * @Param userId + * @Param yearId + * @author zxc + * @date 2021/9/18 9:27 上午 + */ + List selectSignInTypeMonth(@Param("userId")String userId,@Param("yearId")String yearId); + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java index 326380d48f..a4dc9b400c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java @@ -58,6 +58,7 @@ 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.LineChartDTO; 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; @@ -872,7 +873,7 @@ public class GroupActInfoServiceImpl extends BaseServiceImpl myActs = baseDao.selectMyCreateActTypeMonth(formDTO.getUserId(), formDTO.getYearId()); + List joinActs = baseDao.selectShouldJoinActTypeMonth(formDTO.getUserId(), formDTO.getYearId()); + List signInActs = baseDao.selectSignInTypeMonth(formDTO.getUserId(), formDTO.getYearId()); + // 折线图组装 + List lineChart = lineChart(formDTO.getYearId()); + lineChart.forEach(l ->{ + if (!CollectionUtils.isEmpty(myActs)){ + myActs.forEach(m -> { + if (l.getMonth().equals(m.getMonth())){ + l.setOrganizationalActCount(m.getValue()); + } + }); + } + if (!CollectionUtils.isEmpty(joinActs)){ + joinActs.forEach(j -> { + if (l.getMonth().equals(j.getMonth())){ + l.setShouldJoinActCount(j.getValue()); + } + }); + } + if (!CollectionUtils.isEmpty(signInActs)){ + signInActs.forEach(s -> { + if (l.getMonth().equals(s.getMonth())){ + l.setActSignCount(s.getValue()); + } + }); + } + }); + result.setOrganizationalActCount(CollectionUtils.isEmpty(myActs) ? NumConstant.ZERO : myActs.stream().collect(Collectors.summingInt(LineChartDTO::getValue))); + result.setShouldJoinActCount(CollectionUtils.isEmpty(joinActs) ? NumConstant.ZERO : joinActs.stream().collect(Collectors.summingInt(LineChartDTO::getValue))); + result.setActSignCount(CollectionUtils.isEmpty(signInActs) ? NumConstant.ZERO : signInActs.stream().collect(Collectors.summingInt(LineChartDTO::getValue))); + result.setLineChart(lineChart); + return result; } /** diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActInfoDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActInfoDao.xml index 6ebd2be427..dd6534f874 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActInfoDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActInfoDao.xml @@ -64,4 +64,47 @@ AND DATE_FORMAT( CREATED_TIME, '%Y' ) = #{yearId} GROUP BY month + + + + + + + + + \ No newline at end of file