liujie
2025-05-12 83ae9bfcc24103dd951558020f005852f779caab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package com.panzhihua.sangeshenbian.service.impl;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.exceptions.ServiceException;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.sangeshenbian.dao.ComplaintMapper;
import com.panzhihua.sangeshenbian.dao.ComplaintRejectMapper;
import com.panzhihua.sangeshenbian.model.entity.SystemUserLevel;
import com.panzhihua.sangeshenbian.model.query.SuperviseQuery;
import com.panzhihua.sangeshenbian.model.vo.AppComplaintRejectVO;
import com.panzhihua.sangeshenbian.model.vo.ComplaintVO;
import com.panzhihua.sangeshenbian.service.IdentityInformationService;
import com.panzhihua.sangeshenbian.warpper.IdentityInformation;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
 
/**
 * @author mitao
 * @date 2025/5/7
 */
@Service
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
public class SuperviseService {
    private final IdentityInformationService identityInformationService;
    private final ComplaintMapper complaintMapper;
 
    public Page<ComplaintVO> queryProcessingRecordPage(SuperviseQuery query, LoginUserInfoVO loginUserInfo) {
        IdentityInformation currentIdentityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfo);
        Integer identity = currentIdentityInformation.getIdentity();
        if (!identity.equals(2)) {
            throw new ServiceException("当前账号无权限");
        }
        Long targetId = null;
        SystemUserLevel systemUserLevel = currentIdentityInformation.getSystemUserLevel();
        Integer accountLevel = systemUserLevel.getLevel();
        switch (accountLevel) {
            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 complaintMapper.queryProcessingRecordPage(new Page<>(query.getPageNum(), query.getPageSize()), query.getKeyword(), accountLevel, targetId);
    }
 
    public Page<AppComplaintRejectVO> queryRejectRecordPage(SuperviseQuery query, LoginUserInfoVO loginUserInfo) {
        IdentityInformation currentIdentityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfo);
        Integer identity = currentIdentityInformation.getIdentity();
        if (!identity.equals(2) || currentIdentityInformation.getSuperviseFlag().equals(0)) {
            throw new ServiceException("当前账号无权限");
        }
        Long targetId = null;
        SystemUserLevel systemUserLevel = currentIdentityInformation.getSystemUserLevel();
        Integer accountLevel = systemUserLevel.getLevel();
        switch (accountLevel) {
            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 complaintMapper.queryRejectRecordPage(new Page<>(query.getPageNum(), query.getPageSize()), query.getKeyword(), accountLevel, targetId);
    }
}