policeSecurity/policeSecurityServer/src/main/java/com/changhu/service/impl/ManagementServiceImpl.java

62 lines
2.3 KiB
Java
Raw Normal View History

package com.changhu.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.common.db.enums.UserType;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.UserUtil;
import com.changhu.mapper.ManagementMapper;
import com.changhu.pojo.params.CheckStatusParams;
import com.changhu.pojo.params.UnitDisableOrEnableParams;
import com.changhu.pojo.vo.UnitCheckStatusVo;
import com.changhu.pojo.vo.UnitMiniProgramUserPagerQueryParams;
import com.changhu.pojo.vo.UnitMiniProgramUserPagerVo;
import com.changhu.service.ManagementService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
/**
* @author 20252
* @createTime 2024/9/2 上午9:49
* @desc IndexServiceImpl...
*/
@Service
public class ManagementServiceImpl implements ManagementService {
@Resource
private ManagementMapper managementMapper;
@Override
public UnitCheckStatusVo getCheckStatus(CheckStatusParams params) {
return params.getUnitOptType()
.getHandler()
.getCheckStatus(params.getOnlyCode());
}
@Override
public Page<UnitMiniProgramUserPagerVo> miniProgramUserPager(PageParams<UnitMiniProgramUserPagerQueryParams, UnitMiniProgramUserPagerVo> queryParams) {
UserType userType = UserUtil.getUserType();
MiniProgramUserIdentity identity = switch (userType) {
case MANAGEMENT_POLICE -> MiniProgramUserIdentity.POLICE;
case MANAGEMENT_SECURITY -> MiniProgramUserIdentity.PROJECT_MANAGER;
default -> throw new MessageException("用户类型不匹配");
};
return managementMapper.miniProgramUserPager(queryParams.getPage(), queryParams.getParams(), identity);
}
@Override
public void passMiniProgramUser(UnitDisableOrEnableParams params) {
params.getUnitOptType()
.getHandler()
.passMiniProgramUser(params.getDataId());
}
@Override
public void disableOrEnableMiniProgramUser(UnitDisableOrEnableParams params) {
params.getUnitOptType()
.getHandler()
.disableOrEnableMiniProgramUser(params.getDataId());
}
}