| | |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.data.DirEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.helper.WebHelper; |
| | | import com.lf.server.service.data.DirService; |
| | | import com.lf.server.service.sys.TokenService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | return success(entity.getId()); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(dirEntity); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | List<DirEntity> list = dirService.selectDirAll(); |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "递归查询") |
| | | @ApiOperation(value = "下载目录结构") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "目录名称", dataType = "String", paramType = "query", required = false, example = "中俄东线管道工程南段") |
| | | @ApiImplicitParam(name = "id", value = "目录ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectDirRecursive") |
| | | public ResponseMsg<List<DirEntity>> selectDirRecursive(String name) { |
| | | @GetMapping(value = "/downloadDir") |
| | | public void downloadDir(int id, HttpServletResponse res) { |
| | | try { |
| | | if (StringHelper.isEmpty(name)) { |
| | | name = "中俄东线管道工程南段"; |
| | | DirEntity entity = dirService.selectDir(id); |
| | | if (null == entity || entity.getPid() > 0) { |
| | | return; |
| | | } |
| | | List<DirEntity> list = dirService.selectDirRecursive(name); |
| | | |
| | | return success(list); |
| | | String zipFile = dirService.createDirs(id); |
| | | if (null == zipFile) { |
| | | return; |
| | | } |
| | | |
| | | WebHelper.download(zipFile, entity.getName() + ".zip", res); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | } |