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, "项目记录"); + } + + /** * 作业台查询所有项目(政务端) *