|
@@ -7,19 +7,17 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.usky.common.core.bean.CommonPage;
|
|
|
+import com.usky.common.core.exception.BusinessException;
|
|
|
import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.fire.domain.BaseCompany;
|
|
|
-import com.usky.fire.domain.BaseCompanyAttach1;
|
|
|
import com.usky.fire.domain.DemReportInfo;
|
|
|
import com.usky.fire.mapper.BaseCompanyMapper;
|
|
|
import com.usky.fire.mapper.DemReportInfoMapper;
|
|
|
-import com.usky.fire.mapper.SysUserMapper;
|
|
|
import com.usky.fire.service.DemReportInfoService;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.fire.service.vo.CompanyDataVo;
|
|
|
import com.usky.fire.service.vo.DemReportInfoIdVo;
|
|
|
import com.usky.fire.service.vo.DemReportInfoVo;
|
|
|
-import com.usky.system.domain.SysUser;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -38,9 +36,6 @@ import java.util.*;
|
|
|
@Service
|
|
|
public class DemReportInfoServiceImpl extends AbstractCrudService<DemReportInfoMapper, DemReportInfo> implements DemReportInfoService {
|
|
|
|
|
|
- @Autowired
|
|
|
- private SysUserMapper sysUserMapper;
|
|
|
-
|
|
|
@Autowired
|
|
|
private BaseCompanyMapper baseCompanyMapper;
|
|
|
|
|
@@ -48,11 +43,11 @@ public class DemReportInfoServiceImpl extends AbstractCrudService<DemReportInfoM
|
|
|
public CommonPage<DemReportInfo> reportInfoList(String companyId, String sourceType, Integer pageNum, Integer pageSize) {
|
|
|
IPage<DemReportInfo> page = new Page<>(pageNum, pageSize);
|
|
|
|
|
|
- Long userId = SecurityUtils.getUserId();
|
|
|
- LambdaQueryWrapper<SysUser> queryWrapper1 = Wrappers.lambdaQuery();
|
|
|
- queryWrapper1.select(SysUser::getRemark)
|
|
|
- .eq(SysUser::getUserId, userId);
|
|
|
- String organization = sysUserMapper.selectOne(queryWrapper1).getRemark();
|
|
|
+ String organization = SecurityUtils.getLoginUser().getSysUser().getRemark();
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(organization)) {
|
|
|
+ throw new BusinessException("当前登录账号非消防重点单位,请联系管理员!");
|
|
|
+ }
|
|
|
|
|
|
LambdaQueryWrapper<BaseCompany> queryWrapper3 = Wrappers.lambdaQuery();
|
|
|
queryWrapper3.select(BaseCompany::getCompanyId)
|
|
@@ -72,6 +67,9 @@ public class DemReportInfoServiceImpl extends AbstractCrudService<DemReportInfoM
|
|
|
queryWrapper.orderByDesc(DemReportInfo::getId);
|
|
|
}
|
|
|
page = this.page(page, queryWrapper);
|
|
|
+ if (page.getRecords().isEmpty()) {
|
|
|
+ throw new BusinessException("当前单位暂未生成消防报告,请联系管理员!");
|
|
|
+ }
|
|
|
return ToCommonPage(page);
|
|
|
}
|
|
|
|