管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-03-03 0816d0ea55506747a76ac915c20b0ff7ca33600a
src/main/java/com/lf/server/controller/show/ComprehensiveController.java
@@ -8,6 +8,7 @@
import com.lf.server.entity.ctrl.MarkJsonEntity;
import com.lf.server.entity.data.DownloadEntity;
import com.lf.server.entity.data.MetaFileEntity;
import com.lf.server.entity.show.PipelineEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.PathHelper;
import com.lf.server.helper.StringHelper;
@@ -17,6 +18,7 @@
import com.lf.server.service.all.BaseUploadService;
import com.lf.server.service.data.DownloadService;
import com.lf.server.service.show.MarkService;
import com.lf.server.service.show.PipelineService;
import com.lf.server.service.sys.DownlogService;
import com.lf.server.service.sys.TokenService;
import io.swagger.annotations.Api;
@@ -55,6 +57,25 @@
    @Autowired
    DownloadService downloadService;
    @Autowired
    PipelineService pipelineService;
    @SysLog()
    @ApiOperation(value = "查询管线")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = "西气东输"),
    })
    @GetMapping(value = "/selectPipelines")
    public ResponseMsg<Object> selectPipelines(String name) {
        try {
            List<PipelineEntity> rs = pipelineService.selectPipelines(name);
            return success(rs);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "查询路网")
@@ -137,12 +158,12 @@
        try {
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue == null) {
                WebHelper.write2Page(res, WebHelper.getErrJson(HttpStatus.UNAUTHORIZED, "用户未登录"));
                WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.UNAUTHORIZED, "用户未登录"));
            }
            DownloadEntity de = downloadService.selectByGuid(guid);
            if (de == null) {
                WebHelper.write2Page(res, WebHelper.getErrJson(HttpStatus.NOT_FOUND, "文件不存在"));
                WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.NOT_FOUND, "文件不存在"));
            }
            downlogService.updateInfos(ue, de, req);
@@ -150,11 +171,8 @@
            String filePath = markService.getDownloadFilePath(de);
            WebHelper.download(filePath, de.getName(), res);
        } catch (Exception ex) {
            try {
                WebHelper.write2Page(res, WebHelper.getErrJson(HttpStatus.UNAUTHORIZED, ex.getMessage()));
            } catch (Exception e) {
                log.error(e.getMessage(), e);
            }
            WebHelper.writeStr2Page(res, WebHelper.getErrJson(HttpStatus.UNAUTHORIZED, ex.getMessage()));
            log.error(ex.getMessage(), ex);
        }
    }
}