| | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.log.annotation.ApiLog; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.annotation.PreAuth; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.constant.RoleConstant; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.DateTimeUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.sxkj.common.constant.CommonConstant; |
| | | import org.sxkj.common.model.ResponseResult; |
| | | import org.sxkj.common.model.TimeRange; |
| | | import org.sxkj.common.utils.HeaderUtils; |
| | | import org.sxkj.common.utils.TimeRangeUtils; |
| | | import org.sxkj.resource.dto.AttachDto; |
| | | import org.sxkj.resource.dto.WaylineJobInfoQueryDto; |
| | | import org.sxkj.resource.dto.WaylineJobInfoQueryParam; |
| | | import org.sxkj.resource.entity.Attach; |
| | | import org.sxkj.resource.feign.IAttachClient; |
| | | import org.sxkj.resource.param.AttachPageParam; |
| | | import org.sxkj.resource.param.AttachParam; |
| | | import org.sxkj.resource.service.IAttachService; |
| | | import org.sxkj.resource.vo.*; |
| | | import org.sxkj.system.vo.TreeVo; |
| | | import org.sxkj.resource.vo.AttachVO; |
| | | import org.sxkj.resource.vo.AttachmentDownloadParam; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | import static org.springblade.core.cache.constant.CacheConstant.RESOURCE_CACHE; |
| | | |
| | | /** |
| | | * 附件表 控制器 |
| | |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "附件分页", notes = "传入attach") |
| | | public R<IPage<Attach>> list(Attach attach, Query query) { |
| | | List<String> wayLineJobIds = attach.getWayLineJobIds(); |
| | | QueryWrapper<Attach> queryWrapper1 = Condition.getQueryWrapper(attach); |
| | | QueryWrapper<Attach> queryWrapper = queryWrapper1.in(!CollectionUtils.isEmpty(wayLineJobIds), "wayline_job_id", wayLineJobIds); |
| | | String patrolTaskId = attach.getPatrolTaskId(); |
| | | QueryWrapper<Attach> queryWrapper1 = Condition.getQueryWrapper(attach); |
| | | QueryWrapper<Attach> queryWrapper = queryWrapper1.eq(!StringUtils.isEmpty(patrolTaskId), "patrol_task_id", patrolTaskId); |
| | | queryWrapper.eq("is_deleted", 0); |
| | | IPage<Attach> pages = attachService.page(Condition.getPage(query), queryWrapper); |
| | | return R.data(pages); |
| | |
| | | |
| | | /** |
| | | * 流式附件下载接口,支持下载zip压缩包,不使用本地存储 |
| | | * @param param |
| | | * @param response |
| | | * @throws IOException |
| | | */ |
| | | @ApiOperation(value = "流式附件下载接口", notes = "使用流方式返回数据,不使用本地存储") |
| | | @PostMapping("/downloadByByte") |
| | | @GetMapping("/downloadByByte") |
| | | public void downloadByByte( |
| | | @ApiParam(value = "附件下载参数") @RequestBody AttachmentDownloadParam param, |
| | | HttpServletResponse response) throws IOException { |
| | | @ApiParam(value = "附件下载参数") @RequestParam("attachIds") String attachIds, HttpServletResponse response) throws IOException { |
| | | |
| | | // 设置文件名 |
| | | String timestamp = DateTimeUtil.format(LocalDateTime.now(), "yyyyMMdd_HHmmss"); |
| | |
| | | try { |
| | | outputStream = response.getOutputStream(); |
| | | |
| | | Boolean result = attachService.downloadByByte(param, outputStream); |
| | | Boolean result = attachService.downloadByByte(attachIds, outputStream); |
| | | if (!result) { |
| | | return; |
| | | } |