| | |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.sangeshenbian.model.entity.ComAct; |
| | | import com.panzhihua.sangeshenbian.model.query.AnalyticStatisticsQuery; |
| | | import com.panzhihua.sangeshenbian.model.query.AppStaticsQuery; |
| | | import com.panzhihua.sangeshenbian.model.vo.AnalyticStatisticsOneVo; |
| | | import com.panzhihua.sangeshenbian.model.vo.RegionVO; |
| | | import com.panzhihua.sangeshenbian.service.IdentityInformationService; |
| | | import com.panzhihua.sangeshenbian.service.impl.StaticsService; |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | |
| | | public R<List<RegionVO>> regionTree() { |
| | | LoginUserInfoVO loginUserInfo = getLoginUserInfo(); |
| | | return R.ok(staticsService.queryRegionTree(loginUserInfo)); |
| | | |
| | | } |
| | | @PostMapping("/part-one") |
| | | @ApiOperation("获取统计分析-第一部分") |
| | | public R<AnalyticStatisticsOneVo> queryStaticsPartOne(@RequestBody AppStaticsQuery query) { |
| | | LoginUserInfoVO loginUserInfo = getLoginUserInfo(); |
| | | return R.ok(staticsService.queryStaticsPartOne(query,loginUserInfo)); |
| | | } |
| | | } |
| | |
| | | package com.panzhihua.sangeshenbian.dao; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; |
| | | import com.panzhihua.sangeshenbian.model.entity.Complaint; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | |
| | | @Param("accountLevel") Integer accountLevel, @Param("targetId") Long targetId); |
| | | Page<AppComplaintRejectVO> queryRejectRecordPage(Page<ComplaintVO> page, @Param("keyword") String keyword, |
| | | @Param("accountLevel") Integer accountLevel, @Param("targetId") Long targetId); |
| | | |
| | | List<Complaint> queryCompliantList(Long targetId, Integer accountLevel, LoginUserInfoVO loginUserInfo); |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.model.query; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2025/5/13 |
| | | */ |
| | | @Data |
| | | @ApiModel("统计分析数据传输对象") |
| | | public class AppStaticsQuery { |
| | | |
| | | @ApiModelProperty("通用-上级-区域ID") |
| | | private String areaId; |
| | | |
| | | @ApiModelProperty("通用-上级-区域层级") |
| | | private Integer tier; |
| | | |
| | | @ApiModelProperty("第二部分-时间类型 1:近7天, 2:近15天, 3:近30天") |
| | | private Integer timeType; |
| | | |
| | | @ApiModelProperty("第三部分-排名 排名前五:5, 排名前10:10, 全部不传") |
| | | private Integer rank; |
| | | } |
| | |
| | | import com.panzhihua.sangeshenbian.model.entity.ComplaintAuditRecord; |
| | | import com.panzhihua.sangeshenbian.model.entity.ComplaintProgress; |
| | | import com.panzhihua.sangeshenbian.model.query.AnalyticStatisticsQuery; |
| | | import com.panzhihua.sangeshenbian.model.query.AppStaticsQuery; |
| | | import com.panzhihua.sangeshenbian.model.query.BasePage; |
| | | import com.panzhihua.sangeshenbian.model.query.ComplaintQuery; |
| | | import com.panzhihua.sangeshenbian.model.vo.*; |
| | |
| | | */ |
| | | AnalyticStatisticsFourVo analyticStatisticsFour(List<Complaint> complaints); |
| | | |
| | | |
| | | /** |
| | | * 查询党员或上级对应的诉求列表 |
| | | * @param targetId |
| | | * @param accountLevel |
| | | * @param loginUserInfo |
| | | * @return |
| | | */ |
| | | List<Complaint> queryCompliantList(AppStaticsQuery query, LoginUserInfoVO loginUserInfo); |
| | | } |
| | |
| | | import com.panzhihua.sangeshenbian.model.entity.*; |
| | | import com.panzhihua.sangeshenbian.model.excel.ComplaintExcel; |
| | | import com.panzhihua.sangeshenbian.model.query.AnalyticStatisticsQuery; |
| | | import com.panzhihua.sangeshenbian.model.query.AppStaticsQuery; |
| | | import com.panzhihua.sangeshenbian.model.query.BasePage; |
| | | import com.panzhihua.sangeshenbian.model.query.ComplaintQuery; |
| | | import com.panzhihua.sangeshenbian.model.vo.*; |
| | |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<Complaint> queryCompliantList(AppStaticsQuery query, LoginUserInfoVO loginUserInfo) { |
| | | IdentityInformation identityInformation = identityInformationService.getIdentityInformation(loginUserInfo); |
| | | Integer identity = identityInformation.getIdentity(); |
| | | PartyMember partyMember = identityInformation.getPartyMember(); |
| | | SystemUserLevel systemUserLevel = identityInformation.getSystemUserLevel(); |
| | | Long targetId = null; |
| | | Integer accountLevel = 5; |
| | | //党员,查询该党员 |
| | | if (identity.equals(1)) { |
| | | targetId = partyMember.getId(); |
| | | } else if (identity.equals(2)) { |
| | | //上级 |
| | | if (StringUtils.isBlank(query.getAreaId())) { |
| | | accountLevel = systemUserLevel.getLevel(); |
| | | switch (systemUserLevel.getLevel()) { |
| | | case 1: |
| | | //市级 |
| | | targetId = 510400L; |
| | | break; |
| | | case 2: |
| | | //区县级 |
| | | targetId = Long.valueOf(systemUserLevel.getDistrictsCode()); |
| | | break; |
| | | case 3: |
| | | //街道 |
| | | targetId = Long.valueOf(systemUserLevel.getStreetId()); |
| | | break; |
| | | case 4: |
| | | //社区 |
| | | targetId = systemUserLevel.getCommunityId(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return baseMapper.queryCompliantList(targetId, accountLevel, loginUserInfo); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.beust.jcommander.internal.Lists; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.sangeshenbian.dao.SystemUserMapper; |
| | | import com.panzhihua.sangeshenbian.model.entity.ComAct; |
| | | import com.panzhihua.sangeshenbian.model.entity.ComStreet; |
| | | import com.panzhihua.sangeshenbian.model.entity.Complaint; |
| | | import com.panzhihua.sangeshenbian.model.entity.PartyMember; |
| | | import com.panzhihua.sangeshenbian.model.entity.SystemUserLevel; |
| | | import com.panzhihua.sangeshenbian.model.query.AppStaticsQuery; |
| | | import com.panzhihua.sangeshenbian.model.vo.AnalyticStatisticsOneVo; |
| | | import com.panzhihua.sangeshenbian.model.vo.RegionVO; |
| | | import com.panzhihua.sangeshenbian.service.IBcRegionService; |
| | | import com.panzhihua.sangeshenbian.service.IComActService; |
| | |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | |
| | | private final IComStreetService comStreetService; |
| | | private final IComActService comActService; |
| | | private final SystemUserMapper systemUserMapper; |
| | | |
| | | private static final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | public List<RegionVO> queryRegionTree(LoginUserInfoVO loginUserInfo) { |
| | | IdentityInformation currentIdentityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfo); |
| | | if (!Integer.valueOf(2).equals(currentIdentityInformation.getIdentity())) { |
| | |
| | | return Collections.singletonList(regionVO); |
| | | } |
| | | |
| | | /** |
| | | * 统计分析-第一部分 |
| | | * @param query |
| | | * @param loginUserInfo |
| | | * @return |
| | | */ |
| | | public AnalyticStatisticsOneVo queryStaticsPartOne(AppStaticsQuery query, LoginUserInfoVO loginUserInfo) { |
| | | List<Complaint> complaints = complaintService.queryCompliantList(query,loginUserInfo); |
| | | return complaintService.analyticStatisticsOne(null, complaints, simpleDateFormat); |
| | | } |
| | | } |
| | |
| | | </where> |
| | | ORDER BY sc.create_time DESC |
| | | </select> |
| | | <select id="queryCompliantList" resultType="com.panzhihua.sangeshenbian.model.entity.Complaint"> |
| | | SELECT sc.id, |
| | | sc.serial_number, |
| | | sc.time, |
| | | sc.problem_type, |
| | | sc.name, |
| | | sc.contact_number, |
| | | sc.location, |
| | | sc.detailed_address, |
| | | sc.description_title, |
| | | sc.description_content, |
| | | sc.images, |
| | | sc.videos, |
| | | CASE |
| | | WHEN sc.status = 0 and scar.audit_type = 1 AND scar.audit_status = 0 THEN 7 |
| | | WHEN sc.status = 0 and scar.audit_type = 2 AND scar.audit_status = 0 THEN 5 |
| | | WHEN sc.status = 0 and scar.audit_status = 2 THEN 6 |
| | | ELSE sc.status |
| | | END AS status, |
| | | sc.superior_type, |
| | | sc.superior_id, |
| | | sc.report_user_name, |
| | | sc.report_user_phone, |
| | | sc.report_type, |
| | | sc.voice_file, |
| | | sc.city_code, |
| | | sc.districts_code, |
| | | sc.street_id, |
| | | sc.community_id, |
| | | sc.party_member_id, |
| | | sc.create_time, |
| | | sc.create_by, |
| | | sc.update_time, |
| | | sc.update_by, |
| | | sc.completion_description, |
| | | sc.completion_images, |
| | | sc.completion_videos, |
| | | sc.completion_other_description, |
| | | sc.completion_time, |
| | | sc.completion_user_id, |
| | | sc.completion_username, |
| | | sc.completion_user_phone, |
| | | sc.closing_time, |
| | | sc.over_time_days, |
| | | sc.longitude, |
| | | sc.latitude, |
| | | sc.completion_user_level, |
| | | sc.handling_day, |
| | | sc.comment_rate |
| | | FROM sgsb_complaint sc |
| | | LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1 |
| | | <where> |
| | | <if test="1 == accountLevel"> |
| | | and sc.city_code = #{targetId} |
| | | </if> |
| | | <if test="2 == accountLevel"> |
| | | and (sc.districts_code = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="3 == accountLevel"> |
| | | and (sc.street_id = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="4 == accountLevel"> |
| | | and (sc.community_id = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="5 == accountLevel"> |
| | | and (sc.party_member_id = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | </where> |
| | | ORDER BY sc.create_time DESC |
| | | </select> |
| | | </mapper> |