diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/VolunteerServiceFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/VolunteerServiceFormDTO.java new file mode 100644 index 0000000000..510bb5ec41 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/VolunteerServiceFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.screen.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/8/20 3:12 下午 + */ +@Data +public class VolunteerServiceFormDTO implements Serializable { + + private static final long serialVersionUID = 7916606646764729831L; + + public interface VolunteerService{} + + /** + * 机关ID + */ + @NotBlank(message = "机关ID不能为空",groups = {VolunteerService.class}) + private String agencyId; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/VolunteerServiceResult.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/VolunteerServiceResult.java new file mode 100644 index 0000000000..bc2d53edff --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/VolunteerServiceResult.java @@ -0,0 +1,35 @@ +package com.epmet.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/8/20 3:16 下午 + */ +@Data +public class VolunteerServiceResult implements Serializable { + + private static final long serialVersionUID = 959536759114517195L; + + /** + * 月份ID + */ + private String monthId; + + /** + * 组织次数 + */ + private Integer organizeData; + + /** + * 参与次数 + */ + private Integer joinData; + + /** + * 平均参与人次 + */ + private Integer averageJoinUserData; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/VolunteerServiceResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/VolunteerServiceResultDTO.java new file mode 100644 index 0000000000..18331f9ca7 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/VolunteerServiceResultDTO.java @@ -0,0 +1,36 @@ +package com.epmet.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2020/8/20 3:14 下午 + */ +@Data +public class VolunteerServiceResultDTO implements Serializable { + + private static final long serialVersionUID = -6227889392267793005L; + + /** + * x轴,返回近12个月,不包含当前月 + */ + private List xAxis; + + /** + * 组织次数 + */ + private List organizeData; + + /** + * 参与次数 + */ + private List joinData; + + /** + * 平均参与人次 + */ + private List averageJoinUserData; +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java index 7b6784a039..1401a7f036 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java @@ -6,8 +6,10 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.screen.PartyMemberLeadService; import com.epmet.screen.dto.form.ContactMassLineChartFormDTO; import com.epmet.screen.dto.form.FineExampleFormDTO; +import com.epmet.screen.dto.form.VolunteerServiceFormDTO; import com.epmet.screen.dto.result.ContactMassLineChartResultDTO; import com.epmet.screen.dto.result.FineExampleResultDTO; +import com.epmet.screen.dto.result.VolunteerServiceResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -53,4 +55,17 @@ public class PartyMemberLeadController { return new Result().ok(partyMemberLeadService.contactMassLineChart(contactMassLineChartFormDTO)); } + /** + * @Description 3、党员志愿服务 + * @param volunteerServiceFormDTO + * @author zxc + * @date 2020/8/20 3:19 下午 + */ + @ExternalAppRequestAuth + @PostMapping("volunteerservice") + public Result volunteerService(@RequestBody VolunteerServiceFormDTO volunteerServiceFormDTO){ + ValidatorUtils.validateEntity(volunteerServiceFormDTO, VolunteerServiceFormDTO.VolunteerService.class); + return new Result().ok(partyMemberLeadService.volunteerService(volunteerServiceFormDTO)); + } + } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPartyBranchDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPartyBranchDataDao.java index 5b6bbbed94..b5ab2e28e8 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPartyBranchDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPartyBranchDataDao.java @@ -19,6 +19,7 @@ package com.epmet.datareport.dao.screen; import com.epmet.screen.dto.result.BranchBuildOrderByCountResultDTO; import com.epmet.screen.dto.result.BranchIssueDataResultDTO; +import com.epmet.screen.dto.result.VolunteerServiceResult; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -53,4 +54,12 @@ public interface ScreenPartyBranchDataDao { List selectBranchDataByTypeAndTimeZone(@Param("agencyId") String agencyId , @Param("type") String type, @Param("category") String category, @Param("bottomMonthId") String bottomMonthId); List selectBranchDataByTypeOrder(String agencyId,String category,String monthId,String bottomMonthId); + + /** + * @Description 查询党员志愿服务 + * @param agencyId + * @author zxc + * @date 2020/8/20 3:30 下午 + */ + List selectVolunteerServiceResult(@Param("agencyId")String agencyId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/PartyMemberLeadService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/PartyMemberLeadService.java index 3157a10f74..85c25ec9eb 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/PartyMemberLeadService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/PartyMemberLeadService.java @@ -2,8 +2,10 @@ package com.epmet.datareport.service.screen; import com.epmet.screen.dto.form.ContactMassLineChartFormDTO; import com.epmet.screen.dto.form.FineExampleFormDTO; +import com.epmet.screen.dto.form.VolunteerServiceFormDTO; import com.epmet.screen.dto.result.ContactMassLineChartResultDTO; import com.epmet.screen.dto.result.FineExampleResultDTO; +import com.epmet.screen.dto.result.VolunteerServiceResultDTO; /** * 党建引领相关各指标查询 @@ -29,4 +31,12 @@ public interface PartyMemberLeadService { */ ContactMassLineChartResultDTO contactMassLineChart(ContactMassLineChartFormDTO contactMassLineChartFormDTO); + /** + * @Description 3、党员志愿服务 + * @param volunteerServiceFormDTO + * @author zxc + * @date 2020/8/20 3:19 下午 + */ + VolunteerServiceResultDTO volunteerService(VolunteerServiceFormDTO volunteerServiceFormDTO); + } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/PartyMemberLeadServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/PartyMemberLeadServiceImpl.java index c96984f9dd..f9a451bd6b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/PartyMemberLeadServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/PartyMemberLeadServiceImpl.java @@ -1,18 +1,21 @@ package com.epmet.datareport.service.screen.impl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.datareport.dao.screen.ScreenPartyBranchDataDao; import com.epmet.datareport.dao.screen.ScreenPartyLinkMassesDataDao; import com.epmet.datareport.service.screen.PartyMemberLeadService; import com.epmet.screen.dto.form.ContactMassLineChartFormDTO; import com.epmet.screen.dto.form.FineExampleFormDTO; -import com.epmet.screen.dto.result.ContactMassLineChartResult; -import com.epmet.screen.dto.result.ContactMassLineChartResultDTO; -import com.epmet.screen.dto.result.FineExampleResultDTO; +import com.epmet.screen.dto.form.VolunteerServiceFormDTO; +import com.epmet.screen.dto.result.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 党建引领相关各指标查询 @@ -25,6 +28,10 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { @Autowired private ScreenPartyLinkMassesDataDao screenPartyLinkMassesDataDao; + @Autowired + private GrassrootsPartyDevServiceImpl grassrootsPartyDevServiceImpl; + @Autowired + private ScreenPartyBranchDataDao screenPartyBranchDataDao; /** * @Description 1、先锋模范 @@ -67,4 +74,42 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { result.setGroupMemberData(groupMemberData); return result; } + + /** + * @Description 3、党员志愿服务 + * @param volunteerServiceFormDTO + * @author zxc + * @date 2020/8/20 3:19 下午 + */ + @Override + public VolunteerServiceResultDTO volunteerService(VolunteerServiceFormDTO volunteerServiceFormDTO) { + VolunteerServiceResultDTO result = new VolunteerServiceResultDTO(); + List organizeData = new ArrayList<>(); + List joinData = new ArrayList<>(); + List averageJoinUserData = new ArrayList<>(); + Map x = grassrootsPartyDevServiceImpl.getX(); + result.setXAxis(x.values().stream().collect(Collectors.toList())); + List volunteerServiceResults = screenPartyBranchDataDao.selectVolunteerServiceResult(volunteerServiceFormDTO.getAgencyId()); + if (volunteerServiceResults.size() == NumConstant.ZERO){ + for (int i = NumConstant.ZERO; i <= NumConstant.TWELVE; i++) { + organizeData.add(NumConstant.ZERO); + joinData.add(NumConstant.ZERO); + averageJoinUserData.add(NumConstant.ZERO); + } + result.setOrganizeData(organizeData); + result.setJoinData(joinData); + result.setAverageJoinUserData(averageJoinUserData); + return result; + } + List collect = volunteerServiceResults.stream().sorted(Comparator.comparing(VolunteerServiceResult::getMonthId)).collect(Collectors.toList()); + collect.forEach(volunteer -> { + organizeData.add(volunteer.getOrganizeData()); + joinData.add(volunteer.getJoinData()); + averageJoinUserData.add(volunteer.getAverageJoinUserData()); + }); + result.setOrganizeData(organizeData); + result.setJoinData(joinData); + result.setAverageJoinUserData(averageJoinUserData); + return result; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyBranchDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyBranchDataDao.xml index 1268f91a2b..e5c4e38f70 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyBranchDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyBranchDataDao.xml @@ -67,4 +67,20 @@ joinData DESC + + + \ No newline at end of file