|
@@ -5,29 +5,63 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.yingyangfly.core.domain.EaDetectInfo;
|
|
|
+import com.yingyangfly.core.domain.SysOrg;
|
|
|
+import com.yingyangfly.core.dto.CurrentLoginUser;
|
|
|
import com.yingyangfly.core.mapper.EaDetectInfoMapper;
|
|
|
+import com.yingyangfly.core.security.util.TokenUtil;
|
|
|
import com.yingyangfly.core.service.EaDetectInfoService;
|
|
|
import com.yingyangfly.core.util.Sm4Util;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.util.Base64;
|
|
|
+import java.util.Iterator;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
public class EaDetectInfoServiceImpl extends ServiceImpl<EaDetectInfoMapper, EaDetectInfo> implements EaDetectInfoService {
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
+ private TokenUtil tokenUtil;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private SysOrgService sysOrgService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<EaDetectInfo> selectByPage(EaDetectInfo eaDetectInfo) {
|
|
|
LambdaQueryWrapper<EaDetectInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
if (ObjectUtils.isNotEmpty(eaDetectInfo.getPhone())) {
|
|
|
lambdaQueryWrapper.eq(EaDetectInfo::getPhone, eaDetectInfo.getPhone());
|
|
|
}
|
|
|
+ if (eaDetectInfo.getStatus() != 0){
|
|
|
+ if (!hasPermission()) {
|
|
|
+ CurrentLoginUser currentUser = tokenUtil.getCurrentUser();
|
|
|
+ SysOrg oryCodeSysOrg = sysOrgService.getOryCodeSysOrg(currentUser.getOrgCode());
|
|
|
+ lambdaQueryWrapper.eq(EaDetectInfo::getHospitalId,oryCodeSysOrg.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
lambdaQueryWrapper.orderByDesc(EaDetectInfo::getCreateTime);
|
|
|
Page<EaDetectInfo> eaDetectInfoPage = new Page<>(eaDetectInfo.getPage(), eaDetectInfo.getLimit());
|
|
|
return baseMapper.selectPage(eaDetectInfoPage,lambdaQueryWrapper);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public boolean hasPermission() {
|
|
|
+ CurrentLoginUser currentUser = tokenUtil.getCurrentUser();
|
|
|
+
|
|
|
+ // 检查是否包含超级管理员角色
|
|
|
+ if (currentUser.getRoleCodes().contains("super_admin")) {
|
|
|
+ return true; // 超级管理员拥有权限
|
|
|
+ }
|
|
|
+
|
|
|
+ // 其他情况:无角色或非超级管理员角色
|
|
|
+ return !currentUser.getRoleCodes().isEmpty();
|
|
|
+ }
|
|
|
}
|