From 55916816f72ee16f60f131951d49754a204b5f0d Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 6 Sep 2021 13:28:57 +0800 Subject: [PATCH 1/2] =?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/constant/ActConstant.java | 17 ++++ .../act/OrganizationalLifeLineChartDTO.java | 44 ++++++++++ .../act/form/OrganizationalLifeFormDTO.java | 22 +++++ .../result/OrganizationalLifeResultDTO.java | 47 +++++++++++ .../controller/GroupActInfoController.java | 13 +++ .../modules/act/dao/GroupActInfoDao.java | 39 ++++++++- .../act/service/GroupActInfoService.java | 10 +++ .../service/impl/GroupActInfoServiceImpl.java | 84 +++++++++++++++++++ .../resources/mapper/act/GroupActInfoDao.xml | 59 +++++++++++++ 9 files changed, 334 insertions(+), 1 deletion(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/ActConstant.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/OrganizationalLifeLineChartDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/OrganizationalLifeFormDTO.java create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/OrganizationalLifeResultDTO.java diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/ActConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/ActConstant.java new file mode 100644 index 0000000000..30f06ebaf6 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/ActConstant.java @@ -0,0 +1,17 @@ +package com.epmet.resi.group.constant; + +/** + * @Author zxc + * @DateTime 2021/9/3 4:39 下午 + * @DESC + */ +public interface ActConstant { + + /** + * 类型【组织活动次数:orgAct,应参加活动次数:joinAct,活动签到次数:signAct】 + */ + String ORG_ACT = "orgAct"; + String JOIN_ACT = "joinAct"; + String SIGN_ACT = "signAct"; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/OrganizationalLifeLineChartDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/OrganizationalLifeLineChartDTO.java new file mode 100644 index 0000000000..ad5dca0bba --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/OrganizationalLifeLineChartDTO.java @@ -0,0 +1,44 @@ +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/3 3:35 下午 + * @DESC + */ +@Data +public class OrganizationalLifeLineChartDTO implements Serializable { + + private static final long serialVersionUID = -4224453421929580053L; + + /** + * 月份 + */ + private String month; + + /** + * 组织活动次数 + */ + private Integer organizationalActCount; + + /** + * 应参加活动次数 + */ + private Integer shouldJoinActCount; + + /** + * 活动签到次数 + */ + private Integer actSignCount; + + public OrganizationalLifeLineChartDTO() { + this.month = ""; + this.organizationalActCount = NumConstant.ZERO; + this.shouldJoinActCount = NumConstant.ZERO; + this.actSignCount = NumConstant.ZERO; + } +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/OrganizationalLifeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/OrganizationalLifeFormDTO.java new file mode 100644 index 0000000000..3e515c2c75 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/OrganizationalLifeFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.resi.group.dto.act.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/9/3 2:52 下午 + * @DESC + */ +@Data +public class OrganizationalLifeFormDTO implements Serializable { + + private static final long serialVersionUID = -8611679719504666547L; + + private String yearId; + + private String userId; + + private String customerId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/OrganizationalLifeResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/OrganizationalLifeResultDTO.java new file mode 100644 index 0000000000..e68cbd02be --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/OrganizationalLifeResultDTO.java @@ -0,0 +1,47 @@ +package com.epmet.resi.group.dto.act.result; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.resi.group.dto.act.OrganizationalLifeLineChartDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/9/3 2:35 下午 + * @DESC + */ +@Data +public class OrganizationalLifeResultDTO implements Serializable { + + private static final long serialVersionUID = 6991638491754890967L; + + /** + * 组织活动次数 + */ + private Integer organizationalActCount; + + /** + * 应参加活动次数 + */ + private Integer shouldJoinActCount; + + /** + * 活动签到次数 + */ + private Integer actSignCount; + + /** + * 折线图 + */ + private List lineChart; + + public OrganizationalLifeResultDTO() { + this.organizationalActCount = NumConstant.ZERO; + this.shouldJoinActCount = NumConstant.ZERO; + this.actSignCount = NumConstant.ZERO; + this.lineChart = new ArrayList<>(); + } +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java index 4a1a973022..34fc73ec23 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java @@ -27,6 +27,7 @@ import com.epmet.resi.group.dto.act.GroupActIdDTO; 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.notice.result.NoticeReadListResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -153,4 +154,16 @@ public class GroupActInfoController { return new Result(); } + /** + * @Description 组织生活 + * @Param formDTO + * @author zxc + * @date 2021/9/3 2:57 下午 + */ + @PostMapping("organizationallife") + public Result organizationalLife(@LoginUser TokenDto tokenDto, @RequestBody OrganizationalLifeFormDTO formDTO){ + formDTO.setUserId(tokenDto.getUserId()); + return new Result().ok(groupActInfoService.organizationalLife(formDTO)); + } + } \ No newline at end of file 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 85f243e608..c4082b67c9 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,7 +19,13 @@ 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.OrganizationalLifeLineChartDTO; +import com.epmet.resi.group.dto.act.form.OrganizationalLifeFormDTO; +import com.epmet.resi.group.dto.act.result.OrganizationalLifeResultDTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 组织活动信息 @@ -29,5 +35,36 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface GroupActInfoDao extends BaseDao { - + + /** + * @Description 根据人查询支部小组,小组审核状态为 approved 的,小组类型为 branch 的,GROUP_LEADER_FLAG 为 leader 的,人员状态为 approved 的 + * @Param userId + * @Param leaderFlag 是否是组长标志 + * @author zxc + * @date 2021/9/3 3:48 下午 + */ + List selectBranchGroupByUserId(@Param("userId")String userId,@Param("leaderFlag")Boolean leaderFlag); + + /** + * @Description 按照yearId查询组织生活,组织活动次数、应参加活动次数、活动签到次数 + * @Param formDTO + * @Param groupIds + * @Param leaderFlag 是否是组长标志 + * @author zxc + * @date 2021/9/3 4:12 下午 + */ + OrganizationalLifeResultDTO selectOrgLife(@Param("userId")String userId, @Param("groupIds")List groupIds, + @Param("leaderFlag")Boolean leaderFlag,@Param("yearId")String yearId); + + /** + * @Description 组织生活折线图 + * @Param leaderGroupIds + * @Param memberGroupIds + * @Param yearId + * @author zxc + * @date 2021/9/6 10:24 上午 + */ + List selectLineChart(@Param("groupIds") List groupId,@Param("leaderFlag")Boolean leaderFlag, + @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/GroupActInfoService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java index b815bb7358..9ed4a2b015 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java @@ -24,6 +24,7 @@ import com.epmet.resi.group.dto.act.GroupActInfoDTO; 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.notice.result.NoticeReadListResultDTO; /** @@ -89,4 +90,13 @@ public interface GroupActInfoService extends BaseService { * @return */ void closeAct(CloseGroupActFormDTO formDTO); + + /** + * @Description 组织生活 + * @Param formDTO + * @author zxc + * @date 2021/9/3 2:57 下午 + */ + OrganizationalLifeResultDTO organizationalLife(OrganizationalLifeFormDTO formDTO); + } \ 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 48334bac4e..41e77cee6a 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,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 leaderGroupIds = baseDao.selectBranchGroupByUserId(formDTO.getUserId(),true); + List 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 chartDTOS = baseDao.selectLineChart(leaderGroupIds, true, formDTO.getYearId()); + if (!CollectionUtils.isEmpty(chartDTOS)){ + chartResult.addAll(chartDTOS); + } + } + // 查询此人不是组长,客户下所有支部小组 + List 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 chartDTOS = baseDao.selectLineChart(memberGroupIds, false, formDTO.getYearId()); + if (!CollectionUtils.isEmpty(chartDTOS)){ + chartResult.addAll(chartDTOS); + } + } + // 折线图组装 + List lineChart = lineChart(); + if (!CollectionUtils.isEmpty(chartResult)){ + Map> 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 lineChart(){ + List 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; + } + } \ No newline at end of file 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 70b86b20e5..6ebd2be427 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 @@ -3,6 +3,65 @@ + + + + + + \ No newline at end of file From 29256d2d77c1dd4bb7955806c8ea520e38fa1c9a Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 6 Sep 2021 14:09:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=BE=A4=E7=BB=84=E4=BB=8B=E7=BB=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../group/dto/group/result/AllGroupListResultDTO.java | 4 ++++ .../group/dto/group/result/RecommendGroupResultDTO.java | 5 +++++ .../group/dto/group/result/RecommendedListResultDTO.java | 5 +++++ .../src/main/resources/mapper/group/ResiGroupDao.xml | 9 ++++++--- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AllGroupListResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AllGroupListResultDTO.java index d31e01cab8..3ddbd344d2 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AllGroupListResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/AllGroupListResultDTO.java @@ -47,4 +47,8 @@ public class AllGroupListResultDTO implements Serializable { */ private String groupType; + /** + * 群介绍 + */ + private String groupIntroduction = ""; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/RecommendGroupResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/RecommendGroupResultDTO.java index 72de523d2a..ff080a5864 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/RecommendGroupResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/RecommendGroupResultDTO.java @@ -48,4 +48,9 @@ public class RecommendGroupResultDTO implements Serializable { */ private String groupType; + /** + * 群介绍 + */ + private String groupIntroduction = ""; + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/RecommendedListResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/RecommendedListResultDTO.java index 47fbf7d9be..4e9834470a 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/RecommendedListResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/RecommendedListResultDTO.java @@ -37,4 +37,9 @@ public class RecommendedListResultDTO implements Serializable { * 组长名 */ private String leaderName; + + /** + * 群介绍 + */ + private String groupIntroduction = ""; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml index 82d1531781..bf17a2004e 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml @@ -157,7 +157,8 @@ rg.GROUP_NAME AS groupName, rg.GROUP_TYPE AS groupType, rgs.TOTAL_MEMBERS AS totalMember, - rgs.TOTAL_PARTY_MEMBERS AS totalPartyMember + rgs.TOTAL_PARTY_MEMBERS AS totalPartyMember, + rg.GROUP_INTRODUCTION FROM resi_group rg LEFT JOIN resi_group_statistical rgs ON ( rg.id = rgs.RESI_GROUP_ID ) @@ -452,7 +453,8 @@ rg.GROUP_HEAD_PHOTO AS groupHeadPhoto, rg.GROUP_NAME AS groupName, rgs.TOTAL_MEMBERS AS totalMember, - rgs.TOTAL_PARTY_MEMBERS AS totalPartyMember + rgs.TOTAL_PARTY_MEMBERS AS totalPartyMember, + rg.GROUP_INTRODUCTION FROM resi_group rg LEFT JOIN resi_group_statistical rgs ON ( rg.id = rgs.RESI_GROUP_ID ) @@ -647,7 +649,8 @@ rg.group_name AS groupName, rg.group_type AS groupType, rgs.total_members AS totalMember, - rgs.total_party_members AS totalPartyMember + rgs.total_party_members AS totalPartyMember, + rg.GROUP_INTRODUCTION FROM resi_group rg LEFT JOIN resi_group_statistical rgs ON (rg.id = rgs.resi_group_id)