| | |
| | | } |
| | | @ApiOperation(value = "单位活动统计",response = ActivityAnalysisVO.class) |
| | | @GetMapping("activity/analysis") |
| | | public R activityUnitAnalysis(@RequestParam(value = "year",required = false) Integer year, @RequestParam(value = "type",required = false) Integer type, |
| | | @RequestParam(value = "range",required = false)Integer range,@RequestParam(value = "communityId",required = false) Long communityId){ |
| | | return communityService.institutionalUnitServiceAnalysis(year,type,range,communityId); |
| | | public R activityUnitAnalysis(@RequestParam(value = "year",required = false) Integer year, |
| | | @RequestParam(value = "type",required = false) Integer type, |
| | | @RequestParam(value = "range",required = false)Integer range, |
| | | @RequestParam(value = "communityId",required = false) Long communityId, |
| | | @RequestParam(value = "page",required = false) Integer page, |
| | | @RequestParam(value = "size",required = false) Integer size){ |
| | | return communityService.institutionalUnitServiceAnalysis(year,type,range,communityId,page,size); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "分页工具类") |
| | | public class PageVO<T> implements Serializable { |
| | | |
| | | @ApiModelProperty("记录") |
| | | private T records; |
| | | |
| | | @ApiModelProperty("总页数") |
| | | private Integer pages; |
| | | |
| | | @ApiModelProperty("当前页") |
| | | private Integer page; |
| | | |
| | | @ApiModelProperty("总记录数") |
| | | private Integer recordsCount; |
| | | |
| | | |
| | | } |
| | |
| | | package com.panzhihua.common.model.vos.neighbor; |
| | | |
| | | import com.panzhihua.common.model.vos.PageVO; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | private Integer partyMemberCount; |
| | | |
| | | @ApiModelProperty("单位统计数据列表") |
| | | private List<UnitActivityAnalysisVO> unitList; |
| | | private PageVO<List<UnitActivityAnalysisVO>> unitList; |
| | | |
| | | |
| | | @ApiModelProperty("党员统计数据列表") |
| | | private List<PartyMemberAnalysisVO> partyMemberList; |
| | | private PageVO<List<PartyMemberAnalysisVO>> partyMemberList; |
| | | |
| | | @ApiModelProperty("机关单位服务总次数") |
| | | private Integer unitServiceTotalCount; |
| | | |
| | | @ApiModelProperty("机关单位服务总时长") |
| | | private Integer unitServiceTotalTime; |
| | | |
| | | @ApiModelProperty("党员服务总次数") |
| | | private Integer partyMemberServiceTotalCount; |
| | | |
| | | @ApiModelProperty("党员服务总时长") |
| | | private Integer partyMemberServiceTotalTime; |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel |
| | | public class UnitActivityAnalysisVO { |
| | | public class UnitActivityAnalysisVO implements Serializable { |
| | | @ApiModelProperty("单位名称") |
| | | private String unitName; |
| | | |
| | |
| | | import com.panzhihua.common.model.vos.community.raffle.ComActRaffleVO; |
| | | import com.panzhihua.common.model.vos.community.reserve.ComActReserveDangerAreaVO; |
| | | import com.panzhihua.common.model.vos.community.social.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | */ |
| | | @GetMapping("/neighbor/activityAnalysis") |
| | | R institutionalUnitServiceAnalysis(@RequestParam(value = "year",required = false) Integer year,@RequestParam(value = "type",required = false) Integer type, |
| | | @RequestParam(value = "range",required = false)Integer range,@RequestParam(value = "communityId",required = false) Long communityId ); |
| | | @RequestParam(value = "range",required = false)Integer range,@RequestParam(value = "communityId",required = false) Long communityId, |
| | | @RequestParam(value = "page",required = false) Integer page, |
| | | @RequestParam(value = "size",required = false) Integer size, |
| | | @RequestParam(value = "belongTo",required = false) String belongTo); |
| | | /** |
| | | * 单位活动统计 |
| | | */ |
| | | @GetMapping("/neighbor/activityAnalysisBackStage") |
| | | R institutionalUnitServiceAnalysisBackStage(@RequestParam(value = "year",required = false) Integer year, |
| | | @RequestParam(value = "type",required = false) Integer type, |
| | | @RequestParam(value = "range",required = false)Integer range, |
| | | @RequestParam(value = "communityId",required = false) Long communityId, |
| | | @RequestParam(value = "page",required = false) Integer page, |
| | | @RequestParam(value = "size",required = false) Integer size); |
| | | } |
| | |
| | | import com.panzhihua.common.model.dtos.property.CommonPage; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.model.vos.community.ComActActivityTypeVO; |
| | | import com.panzhihua.common.model.vos.neighbor.ActivityAnalysisVO; |
| | | import com.panzhihua.common.model.vos.user.SysTemplateConfigVO; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | } |
| | | return R.fail("未查询到用户"); |
| | | } |
| | | |
| | | @ApiOperation(value = "单位活动统计",response = ActivityAnalysisVO.class) |
| | | @GetMapping("/analysis") |
| | | public R activityUnitAnalysis(@RequestParam(value = "year",required = false) Integer year, |
| | | @RequestParam(value = "type",required = false) Integer type, |
| | | @RequestParam(value = "range",required = false)Integer range, |
| | | @RequestParam(value = "communityId",required = false) Long communityId, |
| | | @RequestParam(value = "belongTo",required = false) String belongTo, |
| | | @RequestParam(value = "page",required = false) Integer page, |
| | | @RequestParam(value = "size",required = false) Integer size){ |
| | | return communityService.institutionalUnitServiceAnalysis(year,type,range,communityId,page,size,belongTo); |
| | | } |
| | | } |
| | |
| | | * */ |
| | | @GetMapping("/activityAnalysis") |
| | | public R institutionalUnitServiceAnalysis(@RequestParam(value = "year",required = false) Integer year,@RequestParam(value = "type",required = false) Integer type, |
| | | @RequestParam(value = "range",required = false)Integer range,@RequestParam(value = "communityId",required = false) Long communityId){ |
| | | return this.comActNeighborCircleService.institutionalUnitServiceAnalysis(year,type,range,communityId); |
| | | @RequestParam(value = "range",required = false)Integer range,@RequestParam(value = "communityId",required = false) Long communityId, |
| | | @RequestParam(value = "page",required = false) Integer page, |
| | | @RequestParam(value = "belongTo",required = false) String belongTo, |
| | | @RequestParam(value = "size",required = false) Integer size){ |
| | | return this.comActNeighborCircleService.institutionalUnitServiceAnalysis(year,type,range,communityId,page,size,belongTo); |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 单位服务统计 |
| | | */ |
| | | List<UnitActivityAnalysisVO> institutionalUnitServiceAnalysis(@Param("beginTime") String beginTime, @Param("endTime") String endTIme, @Param("communityId") Long communityId); |
| | | List<UnitActivityAnalysisVO> institutionalUnitActivityAnalysis(@Param("beginTime") String beginTime, @Param("endTime") String endTIme, @Param("communityId") Long communityId); |
| | | List<UnitActivityAnalysisVO> institutionalUnitServiceAnalysis(@Param("beginTime") String beginTime, @Param("endTime") String endTIme, @Param("belongTo") String belongTo); |
| | | List<UnitActivityAnalysisVO> institutionalUnitActivityAnalysis(@Param("beginTime") String beginTime, @Param("endTime") String endTIme, @Param("belongTo") String belongTo); |
| | | |
| | | List<PartyMemberAnalysisVO> institutionalPartyMemberServiceAnalysis(@Param("beginTime") String beginTime, @Param("endTime") String endTIme, @Param("communityId") Long communityId); |
| | | List<PartyMemberAnalysisVO> institutionalPartyMemberServiceAnalysis(@Param("beginTime") String beginTime, @Param("endTime") String endTIme, @Param("belongTo") String belongTo); |
| | | } |
| | |
| | | * 机关单位服务统计排行 |
| | | * @return |
| | | * */ |
| | | R institutionalUnitServiceAnalysis(Integer year, Integer type, Integer range,Long communityId); |
| | | R institutionalUnitServiceAnalysis(Integer year, Integer type, Integer range,Long communityId,Integer page,Integer size,String belongTo); |
| | | |
| | | /** |
| | | * 后台服务统计 |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import cn.hutool.core.util.NumberUtil; |
| | | import cn.hutool.core.util.PageUtil; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.PageVO; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.service_community.service.ComActNeighborCircleTopicService; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R institutionalUnitServiceAnalysis(Integer year, Integer type, Integer range, Long communityId) { |
| | | public R institutionalUnitServiceAnalysis(Integer year, Integer type, Integer range, Long communityId,Integer page,Integer size,String belongTo) { |
| | | ActivityAnalysisVO activityVO=new ActivityAnalysisVO(); |
| | | String beginTime=null; |
| | | String endTime=null; |
| | |
| | | activityVO.setPartyMemberCount(comActDAO.selectUnitCount()); |
| | | activityVO.setUnitCount(comActDAO.selectMemberCount()); |
| | | //获取单位活动统计数据(邻里圈) |
| | | List<UnitActivityAnalysisVO> unitActivityAnalysisVOS = comActNeighborCircleDAO.institutionalUnitServiceAnalysis(beginTime, endTime, communityId); |
| | | List<UnitActivityAnalysisVO> unitActivityAnalysisVOS = comActNeighborCircleDAO.institutionalUnitServiceAnalysis(beginTime, endTime, belongTo); |
| | | //获取单位活动统计数据(活动) |
| | | List<UnitActivityAnalysisVO> unitActivityAnalysisVOS1 = comActNeighborCircleDAO.institutionalUnitActivityAnalysis(beginTime, endTime, communityId); |
| | | List<UnitActivityAnalysisVO> unitActivityAnalysisVOS1 = comActNeighborCircleDAO.institutionalUnitActivityAnalysis(beginTime, endTime, belongTo); |
| | | if (unitActivityAnalysisVOS.size()>0){ |
| | | for (UnitActivityAnalysisVO unitActivityAnalysisVO : unitActivityAnalysisVOS){ |
| | | if (ObjectUtils.isNotEmpty(unitActivityAnalysisVO)){ |
| | |
| | | } |
| | | } |
| | | //获取党员活动统计数据 |
| | | List<PartyMemberAnalysisVO> partyMemberAnalysisVOS = comActNeighborCircleDAO.institutionalPartyMemberServiceAnalysis(beginTime, endTime, communityId); |
| | | activityVO.setUnitList(unitActivityAnalysisVOS); |
| | | activityVO.setPartyMemberList(partyMemberAnalysisVOS); |
| | | List<PartyMemberAnalysisVO> partyMemberAnalysisVOS = comActNeighborCircleDAO.institutionalPartyMemberServiceAnalysis(beginTime, endTime, belongTo); |
| | | //统计总时长和总次数 |
| | | Integer unitServiceCount=0; |
| | | Integer unitServiceTotalTime=0; |
| | | Integer memberServiceCount=0; |
| | | Integer memberServiceTotalTome=0; |
| | | for (UnitActivityAnalysisVO vo : unitActivityAnalysisVOS) { |
| | | unitServiceCount+=vo.getServiceTime(); |
| | | unitServiceTotalTime+=vo.getServiceTimes(); |
| | | } |
| | | for (PartyMemberAnalysisVO vo : partyMemberAnalysisVOS) { |
| | | memberServiceCount+=vo.getServiceTime(); |
| | | memberServiceTotalTome+=vo.getServiceTimes(); |
| | | } |
| | | activityVO.setUnitServiceTotalCount(unitServiceCount); |
| | | activityVO.setUnitServiceTotalTime(unitServiceTotalTime); |
| | | activityVO.setPartyMemberServiceTotalCount(memberServiceCount); |
| | | activityVO.setPartyMemberServiceTotalTime(memberServiceTotalTome); |
| | | //处理排序 |
| | | if (null != type){ |
| | | if (type.equals(1)){ |
| | | //按时长排序 |
| | | ListUtil.sortByProperty(unitActivityAnalysisVOS, "serviceTime"); |
| | | ListUtil.sortByProperty(partyMemberAnalysisVOS, "serviceTime"); |
| | | }else if (type.equals(2)){ |
| | | //按次数排序 |
| | | ListUtil.sortByProperty(unitActivityAnalysisVOS, "serviceTimes"); |
| | | ListUtil.sortByProperty(partyMemberAnalysisVOS, "serviceTimes"); |
| | | } |
| | | } |
| | | //处理分页 |
| | | PageVO<List<UnitActivityAnalysisVO>> unitPage=new PageVO<>(); |
| | | PageVO<List<PartyMemberAnalysisVO>> memberPage=new PageVO<>(); |
| | | if (ObjectUtils.isNotEmpty(page) && ObjectUtils.isNotEmpty(size)){ |
| | | //分页处理 |
| | | unitPage.setRecordsCount(unitActivityAnalysisVOS.size()); |
| | | unitPage.setPage(page); |
| | | unitPage.setPages(getPages(unitPage.getRecordsCount(),size )); |
| | | memberPage.setPage(page); |
| | | memberPage.setRecordsCount(partyMemberAnalysisVOS.size()); |
| | | memberPage.setPages(getPages(memberPage.getRecordsCount(), size)); |
| | | //处理分页的结果 |
| | | unitPage.setRecords(subUnitList((ArrayList) unitActivityAnalysisVOS, page,size)); |
| | | memberPage.setRecords(subUnitList((ArrayList)partyMemberAnalysisVOS,page ,size)); |
| | | |
| | | }else { |
| | | unitPage.setRecords(unitActivityAnalysisVOS); |
| | | memberPage.setRecords(partyMemberAnalysisVOS); |
| | | } |
| | | activityVO.setUnitList(unitPage); |
| | | activityVO.setPartyMemberList(memberPage); |
| | | return R.ok(activityVO); |
| | | |
| | | } |
| | |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 计算总页数 |
| | | * */ |
| | | public Integer getPages(Integer record,Integer size){ |
| | | if (null != record && null != size){ |
| | | int pages = PageUtil.totalPage(record, size); |
| | | return pages; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | /** |
| | | * 分页截取 |
| | | * */ |
| | | public List<Object> subUnitList(List<Object> list, int page, int size){ |
| | | try { |
| | | //计算endIndex是否超出List大小 |
| | | final Boolean flag=((page-1)*size+size) > list.size(); |
| | | if (1 == page || 0 == page){ |
| | | //第一页 |
| | | return list.subList(0,size); |
| | | }else if (flag){ |
| | | return ListUtil.sub(list, (page-1)*size-1, list.size()-1); |
| | | } |
| | | else { |
| | | return list.subList((page-1)*size, (page-1)*size+size); |
| | | } |
| | | }catch (Exception e){ |
| | | //返回原集合 |
| | | return list; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | </select> |
| | | <select id="institutionalUnitServiceAnalysis" |
| | | resultType="com.panzhihua.common.model.vos.neighbor.UnitActivityAnalysisVO"> |
| | | select canc.solve_unit_id as unitId,sum(canc.real_service_time) as serviceTime,count(canc.real_service_time) as serviceTimes,canc.community_id as communityId |
| | | select canc.solve_unit_id as unitId,sum(canc.real_service_time) as serviceTime,count(canc.real_service_time) as serviceTimes,canc.community_id as communityId,cpcu.belong_to |
| | | from com_act_neighbor_circle as canc |
| | | left join com_pb_check_unit as cpcu on canc.solve_unit_id=cpcu.id |
| | | where canc.solve_unit_id<>'' |
| | | <if test="beginTime != null"> |
| | | and canc.create_at between #{beginTime} and #{endTime} |
| | | </if> |
| | | group by(canc.solve_unit_id) |
| | | <if test="communityId != null"> |
| | | having canc.community_id=#{communityId} |
| | | <if test="belongTo != null and belongTo != ''"> |
| | | and belong_to=#{belongTo} |
| | | </if> |
| | | group by(canc.solve_unit_id) |
| | | order by serviceTime |
| | | </select> |
| | | <select id="institutionalUnitActivityAnalysis" |
| | | resultType="com.panzhihua.common.model.vos.neighbor.UnitActivityAnalysisVO"> |
| | | SELECT count(caa.check_unit_id) as serviceTimes,sum(caa.duration) as serviceTime,caa.check_unit_id as unitId,caa.community_id as communityId |
| | | SELECT count(caa.check_unit_id) as serviceTimes,sum(caa.duration) as serviceTime,caa.check_unit_id as unitId,caa.community_id as communityId,cpcu.belong_to |
| | | FROM com_act_activity as caa |
| | | left join com_pb_check_unit as cpcu on caa.check_unit_id=cpcu.id |
| | | where check_unit_id<>'' |
| | | <if test="beginTime != null"> |
| | | and caa.create_at between #{beginTime} and #{endTime} |
| | | </if> |
| | | GROUP BY (caa.check_unit_id) |
| | | <if test="communityId != null"> |
| | | having caa.community_id=#{communityId} |
| | | <if test="belongTo != null and belongTo != ''"> |
| | | and belong_to=#{belongTo} |
| | | </if> |
| | | GROUP BY (caa.check_unit_id) |
| | | order by serviceTime |
| | | </select> |
| | | |
| | | <select id="institutionalPartyMemberServiceAnalysis" |
| | | resultType="com.panzhihua.common.model.vos.neighbor.PartyMemberAnalysisVO"> |
| | | SELECT count(caa.sponsor_id) as serviceTimes,sum(caa.duration) as serviceTime,caa.check_unit_id as unitId |
| | | ,caa.community_id as communityId,cpm.id as memberId,cpm.name as memberName,cpcu.name as belongUnit,ca.name as belongCommunity |
| | | ,caa.community_id as communityId,cpm.id as memberId,cpm.name as memberName,cpcu.name as belongUnit,ca.name as belongCommunity,cpcu.belong_to |
| | | FROM `com_act_activity` as caa |
| | | left join com_act_act_sign as caas on caa.id=caas.activity_id |
| | | left join com_pb_member as cpm on caas.user_id=cpm.id |
| | | <!--left join com_pb_member as cpm on caas.user_id=cpm.id--> |
| | | left join com_pb_member as cpm on caa.sponsor_id=cpm.id |
| | | left join com_pb_check_unit as cpcu on cpm.check_unit_id=cpcu.id |
| | | left join com_act as ca on cpm.community_id=ca.community_id |
| | | where caa.sponsor_id<>'' |
| | | <if test="beginTime != null"> |
| | | and caa.create_at between #{beginTime} and #{endTime} |
| | | </if> |
| | | <if test="belongTo != null and belongTo != ''"> |
| | | and belong_to=#{belongTo} |
| | | </if> |
| | | GROUP BY (caa.sponsor_id) |
| | | having serviceTimes<>'' and serviceTime<>'' |
| | | <if test="communityId != null"> |
| | | and caa.community_id=#{communityId} |
| | | </if> |
| | | </select> |
| | | |
| | | |