|
|
|
|
@ -16,6 +16,7 @@ import com.biutag.supervision.mapper.SuperviseReportMapper;
|
|
|
|
|
import com.biutag.supervision.pojo.entity.*; |
|
|
|
|
import com.biutag.supervision.pojo.model.UserAuth; |
|
|
|
|
import com.biutag.supervision.pojo.param.SuperviseReportQueryParam; |
|
|
|
|
import com.biutag.supervision.pojo.vo.SuperviseReportOptionVo; |
|
|
|
|
import com.biutag.supervision.pojo.vo.SuperviseReportVo; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
@ -38,6 +39,35 @@ public class SuperviseReportService extends ServiceImpl<SuperviseReportMapper, S
|
|
|
|
|
private final NegativeService negativeService; |
|
|
|
|
|
|
|
|
|
private final SuperviseReportDepartService superviseReportDepartService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 通报期数选项,仅查询最新的100条报告ID和名称。 |
|
|
|
|
*/ |
|
|
|
|
public List<SuperviseReportOptionVo> options(String reportName) { |
|
|
|
|
LambdaQueryWrapper<SuperviseReport> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
UserAuth user = UserContextHolder.getCurrentUser(); |
|
|
|
|
if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) && !user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode())) { |
|
|
|
|
if (user.getAuthDepartIds().isEmpty() || user.getRoleCodes().isEmpty()) { |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
} |
|
|
|
|
List<String> orgIds = departService.getAllNodeIds(user.getAuthDepartIds()); |
|
|
|
|
if (CollectionUtil.isEmpty(orgIds)) { |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
} |
|
|
|
|
queryWrapper.in(SuperviseReport::getCrtDepartId, orgIds); |
|
|
|
|
} |
|
|
|
|
queryWrapper.select(SuperviseReport::getId, SuperviseReport::getReportName) |
|
|
|
|
.like(StrUtil.isNotEmpty(reportName), SuperviseReport::getReportName, reportName) |
|
|
|
|
.orderByDesc(SuperviseReport::getCrtTime) |
|
|
|
|
.last("limit 100"); |
|
|
|
|
return list(queryWrapper).stream().map(report -> { |
|
|
|
|
SuperviseReportOptionVo option = new SuperviseReportOptionVo(); |
|
|
|
|
option.setId(report.getId()); |
|
|
|
|
option.setReportName(report.getReportName()); |
|
|
|
|
return option; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 分页查询 |
|
|
|
|
* */ |
|
|
|
|
|