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);
|
}
|
}
|