¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.personnel.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.core.domain.entity.DepartmentDto; |
| | | import com.ruoyi.common.utils.FileSaveUtil; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.personnel.dto.PersonBasicInfoDetailsDto; |
| | | import com.ruoyi.personnel.dto.PersonBasicInfoDto; |
| | | import com.ruoyi.personnel.dto.UserPageDto; |
| | | import com.ruoyi.personnel.pojo.Annex; |
| | | import com.ruoyi.personnel.pojo.PersonBasicInfoFile; |
| | | import com.ruoyi.personnel.pojo.PersonBasicInfoWork; |
| | | import com.ruoyi.personnel.service.AnnexService; |
| | | import com.ruoyi.personnel.service.PersonBasicInfoFileService; |
| | | import com.ruoyi.personnel.service.PersonBasicInfoService; |
| | | import com.ruoyi.personnel.service.PersonBasicInfoWorkService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-08-30 09:19:57 |
| | | */ |
| | | @Api(tags = "人å-人ååºæ¬ä¿¡æ¯") |
| | | @RestController |
| | | @RequestMapping("/personBasicInfo") |
| | | public class PersonBasicInfoController { |
| | | |
| | | @Resource |
| | | private PersonBasicInfoService personBasicInfoService; |
| | | |
| | | @Resource |
| | | private PersonBasicInfoFileService personBasicInfoFileService; |
| | | @Resource |
| | | private PersonBasicInfoWorkService personBasicInfoWorkService; |
| | | |
| | | @Resource |
| | | private AnnexService annexService; |
| | | |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢CNAS人åä¾§è¾¹æ ") |
| | | @GetMapping("/selectCNSAPersonTree") |
| | | public Result<List<DepartmentDto>> selectCNSAPersonTree() { |
| | | return Result.success(personBasicInfoService.selectCNSAPersonTree()); |
| | | } |
| | | |
| | | @ApiOperation(value = "è·åCNAS人ååºæ¬ä¿¡æ¯") |
| | | @GetMapping("/getCNASPersonnelInfo") |
| | | public Result getCNASPersonnelInfo(Integer userId) { |
| | | return Result.success(personBasicInfoService.getCNASPersonnelInfo(userId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "ä¿åCNAS人ååºæ¬ä¿¡æ¯") |
| | | @PostMapping("/saveCNASPersonnelInfo") |
| | | public Result saveCNASPersonnelInfo(@RequestBody PersonBasicInfoDto personBasicInfoDto) { |
| | | personBasicInfoService.saveCNASPersonnelInfo(personBasicInfoDto); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "人åæç»å页æ¥è¯¢") |
| | | @GetMapping("basicInformationOfPersonnelSelectPage") |
| | | public Result<IPage<Map<String, Object>>> basicInformationOfPersonnelSelectPage(Page<List<PersonBasicInfoDetailsDto>> page, String name, Integer departmentId) { |
| | | return Result.success(personBasicInfoService.basicInformationOfPersonnelSelectPage(page, name, departmentId)); |
| | | } |
| | | |
| | | // ä¸ä¼ æä»¶æ¥å£ |
| | | @ApiOperation(value = "ä¸ä¼ æä»¶æ¥å£") |
| | | @PostMapping("/saveCNASFile") |
| | | public Result saveFile(@RequestPart("file") MultipartFile file) { |
| | | String s = FileSaveUtil.uploadWordFile(file); |
| | | return Result.success("ä¸ä¼ æå", s); |
| | | } |
| | | |
| | | @GetMapping("/getAnnexByUserId") |
| | | public Result<List<Annex>> getAnnexByUserId(Integer userId) { |
| | | List<Annex> list = annexService.list(new LambdaQueryWrapper<Annex>().eq(Annex::getUserId, userId)); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | // å 餿件 |
| | | @DeleteMapping("/deleteCNASFile") |
| | | public Result saveFile(String fileName) { |
| | | String[] split = fileName.split(","); |
| | | for (String s : split) { |
| | | FileSaveUtil.DeleteFile(s); |
| | | } |
| | | return Result.success(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 人ååºæ¬ä¿¡æ¯éä»¶æ°å¢ |
| | | */ |
| | | @PostMapping("/addAnnex") |
| | | public Result addAnnex(@RequestBody Annex annex) { |
| | | annexService.save(annex); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @GetMapping("/getAnnex") |
| | | public Result<Annex> getAnnex(Integer id) { |
| | | return Result.success(annexService.getById(id)); |
| | | } |
| | | /** |
| | | * 人ååºæ¬ä¿¡æ¯éä»¶å é¤ |
| | | */ |
| | | @DeleteMapping("/deleteAnnex") |
| | | public Result deleteAnnex(Integer id) { |
| | | annexService.removeById(id); |
| | | return Result.success(); |
| | | } |
| | | |
| | | /** |
| | | * 人ååºæ¬ä¿¡æ¯éä»¶ä¿®æ¹ |
| | | * |
| | | */ |
| | | @PostMapping("/updateAnnex") |
| | | public Result updateAnnex(@RequestBody Annex annex) { |
| | | annexService.updateById(annex); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "导åºäººååºæ¬ä¿¡æ¯") |
| | | @GetMapping("/exportPersonBasicInfo") |
| | | public void exportPersonBasicInfo(UserPageDto userPageDto, HttpServletResponse response) throws Exception { |
| | | personBasicInfoService.exportPersonBasicInfo(userPageDto,response); |
| | | } |
| | | |
| | | @ApiOperation(value = "ä¸è½½äººåæ¡£æ¡å¡") |
| | | @GetMapping("/exportPersonBasicInfoById") |
| | | public Result exportPersonBasicInfoById(Integer id, HttpServletResponse response) { |
| | | return Result.success(personBasicInfoService.exportPersonBasicInfoById(id,response)); |
| | | } |
| | | |
| | | /** |
| | | * 人åå¹è®åºæ¬ä¿¡æ¯éä»¶æ°å¢ |
| | | * @param userId |
| | | * @param file |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "人åå¹è®åºæ¬ä¿¡æ¯éä»¶æ°å¢") |
| | | @PostMapping("/uploadBasicInfoFile") |
| | | public Result<?> uploadBasicInfoFile(Integer userId, MultipartFile file) { |
| | | return Result.success(personBasicInfoService.uploadBasicInfoFile(userId, file)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 人åå¹è®åºæ¬ä¿¡æ¯éä»¶å表 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "人åå¹è®åºæ¬ä¿¡æ¯éä»¶å表") |
| | | @GetMapping("/getBasicInfoFileList") |
| | | public Result<List<PersonBasicInfoFile>> getBasicInfoFileList(Integer userId){ |
| | | return Result.success(personBasicInfoFileService.list(Wrappers.<PersonBasicInfoFile>lambdaQuery() |
| | | .eq(PersonBasicInfoFile::getUserId, userId))); |
| | | } |
| | | |
| | | /** |
| | | * 人åå¹è®åºæ¬ä¿¡æ¯éä»¶å é¤ |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "人åå¹è®åºæ¬ä¿¡æ¯éä»¶å é¤") |
| | | @GetMapping("/delBasicInfoFileList") |
| | | public Result delBasicInfoFileList(Integer basicInfoFileId){ |
| | | return Result.success(personBasicInfoFileService.removeById(basicInfoFileId)); |
| | | } |
| | | |
| | | /** |
| | | * 人åå¹è®åºæ¬ä¿¡æ¯å·¥ä½ç»åæ°å¢ |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "人åå¹è®åºæ¬ä¿¡æ¯å·¥ä½ç»åæ°å¢") |
| | | @PostMapping("/addBasicInfoWork") |
| | | public Result<?> addBasicInfoWork(@RequestBody PersonBasicInfoWork basicInfoWork) { |
| | | if (basicInfoWork.getUserId() == null) { |
| | | throw new ErrorException("缺å°äººåid"); |
| | | } |
| | | basicInfoWork.setUserId(basicInfoWork.getUserId()); |
| | | return Result.success(personBasicInfoWorkService.save(basicInfoWork)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 人åå·¥ä½ç»åå表 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "人åå·¥ä½ç»åå表") |
| | | @GetMapping("/getBasicInfoWorkList") |
| | | public Result<List<PersonBasicInfoWork>> getBasicInfoWorkList(Integer userId){ |
| | | return Result.success(personBasicInfoWorkService.list(Wrappers.<PersonBasicInfoWork>lambdaQuery() |
| | | .eq(PersonBasicInfoWork::getUserId, userId))); |
| | | } |
| | | |
| | | /** |
| | | * 人åå·¥ä½ç»åå é¤ |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "人åå·¥ä½ç»åå é¤") |
| | | @GetMapping("/delBasicInfoWorkList") |
| | | public Result delBasicInfoWorkList(Integer basicInfoWorkId){ |
| | | return Result.success(personBasicInfoWorkService.removeById(basicInfoWorkId)); |
| | | } |
| | | |
| | | /** |
| | | * 人ååºæ¬ä¿¡æ¯éä»¶å é¤ |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "人åå·¥ä½ç»åä¿®æ¹") |
| | | @PostMapping("/updateBasicInfoWorkList") |
| | | public Result updateBasicInfoWorkList(@RequestBody PersonBasicInfoWork basicInfoWork){ |
| | | return Result.success(personBasicInfoWorkService.updateById(basicInfoWork)); |
| | | } |
| | | } |