From 442e9873c705b8dc099cdc8c427f34a90b2df901 Mon Sep 17 00:00:00 2001 From: du <1725534722@qq.com> Date: Wed, 11 Sep 2024 14:45:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BA=93=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ent/controller/JProjectController.java | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JProjectController.java b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JProjectController.java index e93789a..806b7d5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JProjectController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/jjh/ent/controller/JProjectController.java @@ -12,20 +12,14 @@ import com.ruoyi.common.utils.poi.ProjectValueUtil; import com.ruoyi.jjh.declaration.entity.vo.BmsApprovalInfoQueryVo; import com.ruoyi.jjh.ent.entity.JProject; import com.ruoyi.jjh.ent.entity.request.JProjectExcel; +import com.ruoyi.jjh.ent.mapper.JProjectMapper; import com.ruoyi.jjh.ent.service.JProjectService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; @@ -49,6 +43,9 @@ public class JProjectController extends BaseController { @Resource private JProjectService jProjectService; + @Resource + private JProjectMapper jProjectMapper; + // /** // * 改变没有信用代码的项目 // * @return @@ -97,6 +94,32 @@ public class JProjectController extends BaseController { return success(jProjectService.page(page, jProject)); } + + /** + * 导出项目 + */ + @PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov,ent')") + @ApiOperation(value = "导出项目") + @PostMapping("/exportProject") + public void exportProject(HttpServletResponse response, JProject jProject) { + boolean b = false; + boolean admin = false; + String str = null; + try { + admin = SecurityUtils.isAdmin(SecurityUtils.getUserId()); + b = SecurityUtils.hasRole("ent"); + str = SecurityUtils.getUsername(); + } catch (Exception ignored) { + } + if (!admin & b) { + jProject.setCreditCode(str); + } + List list = jProjectMapper.page(jProject); + ExcelUtil util = new ExcelUtil<>(JProject.class); + util.exportExcel(response, list, "项目记录"); + } + + /** * 作业台查询所有项目(政务端) *