| | |
| | | import com.lf.server.service.data.DownloadService; |
| | | import com.lf.server.service.data.MetaService; |
| | | import com.lf.server.service.data.VerService; |
| | | import com.lf.server.service.show.CadService; |
| | | import com.lf.server.service.sys.DepService; |
| | | import com.lf.server.service.sys.DownlogService; |
| | | import com.lf.server.service.sys.TokenService; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | |
| | | @RestController |
| | | @RequestMapping("/meta") |
| | | public class MetaController extends BaseController { |
| | | @Autowired |
| | | @Resource |
| | | MetaService metaService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | TokenService tokenService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | BaseQueryService baseQueryService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | DownlogService downlogService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | DownloadService downloadService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | VerService verService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | DepService depService; |
| | | |
| | | @Resource |
| | | CadService cadService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询并返回记录数") |
| | |
| | | List<MetaEntity> rs = metaService.selectByPage(depcode, dircode, verid, name, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "根据GUID查询GDB") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "guid", value = "GUID", dataType = "String", paramType = "query", example = "d58e66d9606a4b85e7c8ab43b3db0b55") |
| | | }) |
| | | @GetMapping(value = "/selectGdbByGuid") |
| | | public ResponseMsg<Object> selectGdbByGuid(String guid) { |
| | | try { |
| | | if (StringHelper.isEmpty(guid)) { |
| | | return fail("文件GUID值不能为空", null); |
| | | } |
| | | |
| | | List<MetaEntity> rs = metaService.selectGdbByGuid(guid); |
| | | |
| | | return success(null == rs ? 0 : rs.size(), rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询Dwg转换") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "元数据ID", dataType = "int", paramType = "query", example = "7715"), |
| | | @ApiImplicitParam(name = "isAttach", value = "是否为附件", dataType = "Boolean", paramType = "query", example = "false") |
| | | }) |
| | | @GetMapping(value = "/selectConvertToDwg") |
| | | public ResponseMsg<Object> selectConvertToDwg(int id, Boolean isAttach) { |
| | | try { |
| | | String rs = cadService.convert(id, isAttach); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "插入一条") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "实体类", dataType = "MetaEntity", paramType = "body") |
| | |
| | | return fail("用户未登录", null); |
| | | } |
| | | |
| | | int count = downloadService.selectCountForUser(ue.getId(), 3, name); |
| | | int count = downloadService.selectCountForUser(ue.getId(), "3,4", name); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getId(), 3, name, pageSize, pageSize * (pageIndex - 1)); |
| | | List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getId(), "3,4", name, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | |
| | | return success(new ArrayList<String>()); |
| | | } |
| | | |
| | | List<String> list = downloadService.selectMetaOverflowDep(ue, dr); |
| | | List<String> list = metaService.selectMetaOverflowDep(ue, dr); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "请求下载") |
| | | @ApiOperation(value = "请求元数据下载") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "dr", value = "请求下载实体类", dataType = "DownloadReqEntity", paramType = "body") |
| | | }) |
| | |
| | | return fail("密码不符合要求"); |
| | | } |
| | | |
| | | List<MetaEntity> list = metaService.selectMetaFiles(dr.getIds()); |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("没有找到元数据"); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | String guid = downloadService.zipFiles(ue, list, dr.getPwd()); |
| | | String guid = metaService.downloadMeteReq(ue, dr); |
| | | |
| | | return success(guid); |
| | | } catch (Exception ex) { |