TProjectInvestigatePersonController.java 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. package com.ruoyi.web.controller.invest;
  2. import java.util.List;
  3. import javax.servlet.http.HttpServletResponse;
  4. import com.ruoyi.common.enums.FileType;
  5. import com.ruoyi.common.utils.StringUtils;
  6. import com.ruoyi.common.utils.uuid.IdUtils;
  7. import com.ruoyi.invest.domain.TProjectCirculation;
  8. import com.ruoyi.invest.service.ITProjectCirculationService;
  9. import com.ruoyi.tool.domain.TUnifyFile;
  10. import com.ruoyi.tool.service.ITUnifyFileService;
  11. import io.swagger.annotations.Api;
  12. import io.swagger.annotations.ApiOperation;
  13. import org.springframework.security.access.prepost.PreAuthorize;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.web.bind.annotation.GetMapping;
  16. import org.springframework.web.bind.annotation.PostMapping;
  17. import org.springframework.web.bind.annotation.PutMapping;
  18. import org.springframework.web.bind.annotation.DeleteMapping;
  19. import org.springframework.web.bind.annotation.PathVariable;
  20. import org.springframework.web.bind.annotation.RequestBody;
  21. import org.springframework.web.bind.annotation.RequestMapping;
  22. import org.springframework.web.bind.annotation.RestController;
  23. import com.ruoyi.common.annotation.Log;
  24. import com.ruoyi.common.core.controller.BaseController;
  25. import com.ruoyi.common.core.domain.AjaxResult;
  26. import com.ruoyi.common.enums.BusinessType;
  27. import com.ruoyi.invest.domain.TProjectInvestigatePerson;
  28. import com.ruoyi.invest.service.ITProjectInvestigatePersonService;
  29. import com.ruoyi.common.utils.poi.ExcelUtil;
  30. import com.ruoyi.common.core.page.TableDataInfo;
  31. /**
  32. * 尽调人员关联表Controller
  33. *
  34. * @author zjc
  35. * @date 2024-03-13
  36. */
  37. @Api(tags = "尽调人员关联")
  38. @RestController
  39. @RequestMapping("/invest/person")
  40. public class TProjectInvestigatePersonController extends BaseController
  41. {
  42. @Autowired
  43. private ITProjectInvestigatePersonService tProjectInvestigatePersonService;
  44. @Autowired
  45. private ITProjectCirculationService tProjectCirculationService;
  46. @Autowired
  47. private ITUnifyFileService tUnifyFileService;
  48. /**
  49. * 查询尽调人员关联表列表
  50. */
  51. @ApiOperation("查询尽调人员关联表列表")
  52. @GetMapping("/list")
  53. public TableDataInfo list(TProjectInvestigatePerson tProjectInvestigatePerson)
  54. {
  55. startPage();
  56. List<TProjectInvestigatePerson> list = tProjectInvestigatePersonService.selectTProjectInvestigatePersonList(tProjectInvestigatePerson);
  57. return getDataTable(list);
  58. }
  59. /**
  60. * 导出尽调人员关联表列表
  61. */
  62. @ApiOperation("导出尽调人员关联表列表")
  63. @Log(title = "尽调人员关联表", businessType = BusinessType.EXPORT)
  64. @PostMapping("/export")
  65. public void export(HttpServletResponse response, TProjectInvestigatePerson tProjectInvestigatePerson)
  66. {
  67. List<TProjectInvestigatePerson> list = tProjectInvestigatePersonService.selectTProjectInvestigatePersonList(tProjectInvestigatePerson);
  68. ExcelUtil<TProjectInvestigatePerson> util = new ExcelUtil<TProjectInvestigatePerson>(TProjectInvestigatePerson.class);
  69. util.exportExcel(response, list, "尽调人员关联表数据");
  70. }
  71. /**
  72. * 获取尽调人员关联表详细信息
  73. */
  74. @ApiOperation("获取尽调人员关联表详细信息")
  75. @GetMapping(value = "/{id}")
  76. public AjaxResult getInfo(@PathVariable("id") String id)
  77. {
  78. return success(tProjectInvestigatePersonService.selectTProjectInvestigatePersonById(id));
  79. }
  80. /**
  81. * 新增尽调人员关联表
  82. */
  83. @ApiOperation("新增尽调人员关联表")
  84. @Log(title = "尽调人员关联表", businessType = BusinessType.INSERT)
  85. @PostMapping
  86. public AjaxResult add(@RequestBody TProjectInvestigatePerson tProjectInvestigatePerson)
  87. {
  88. if(StringUtils.isNull(tProjectInvestigatePerson.getId())){
  89. tProjectInvestigatePerson.setId(IdUtils.fastSimpleUUID());
  90. }
  91. tProjectInvestigatePerson.setInvestigatePerson(getNickName());
  92. tProjectInvestigatePerson.setInvestigatePersonId(getUserId().toString());
  93. tProjectInvestigatePerson.setDeptId(getDeptId());
  94. // todo 保存附件信息
  95. tUnifyFileService.insertTUnifyFileList(tProjectInvestigatePerson.getListFile(),
  96. tProjectInvestigatePerson.getProjectPoolId(),
  97. tProjectInvestigatePerson.getId(),//尽调ID
  98. String.valueOf(FileType.INVESTIGATE.ordinal()),//文件类型:尽调
  99. getNickName());
  100. // todo 增加项目创建记录
  101. tProjectCirculationService.insertTProjectCirculation(tProjectInvestigatePerson.getProjectPoolId(),"上传尽调报告",getNickName());
  102. return toAjax(tProjectInvestigatePersonService.insertTProjectInvestigatePerson(tProjectInvestigatePerson));
  103. }
  104. /**
  105. * 修改尽调人员关联表
  106. */
  107. @ApiOperation("修改尽调人员关联表")
  108. @Log(title = "尽调人员关联表", businessType = BusinessType.UPDATE)
  109. @PutMapping
  110. public AjaxResult edit(@RequestBody TProjectInvestigatePerson tProjectInvestigatePerson)
  111. {
  112. // todo 保存附件信息
  113. tUnifyFileService.insertTUnifyFileList(tProjectInvestigatePerson.getListFile(),
  114. tProjectInvestigatePerson.getProjectPoolId(),
  115. tProjectInvestigatePerson.getId(),//尽调ID
  116. String.valueOf(FileType.INVESTIGATE.ordinal()),//文件类型:尽调
  117. getNickName());
  118. return toAjax(tProjectInvestigatePersonService.updateTProjectInvestigatePerson(tProjectInvestigatePerson));
  119. }
  120. /**
  121. * 删除尽调人员关联表
  122. */
  123. @ApiOperation("删除尽调人员关联表")
  124. @Log(title = "尽调人员关联表", businessType = BusinessType.DELETE)
  125. @DeleteMapping("/{ids}")
  126. public AjaxResult remove(@PathVariable String[] ids)
  127. {
  128. //删除附件
  129. tUnifyFileService.updateTUnifyFileBusinessIds(ids);
  130. return toAjax(tProjectInvestigatePersonService.deleteTProjectInvestigatePersonByIds(ids));
  131. }
  132. /**
  133. * 根据尽调申请ID获取尽调人员关联表详细信息
  134. */
  135. @ApiOperation("获取尽调人员关联表详细信息")
  136. @GetMapping(value = "/getProjectInvestigateId")
  137. public AjaxResult getProjectInvestigateId(String projectInvestigateId)
  138. {
  139. return success(tProjectInvestigatePersonService.selectByProjectInvestigateId(projectInvestigateId,getUserId()));
  140. }
  141. /**
  142. * 获取尽调人员关联表详细信息集合
  143. */
  144. @ApiOperation("获取尽调人员关联表详细信息集合")
  145. @GetMapping(value = "/selectProjectInvestigateIdList")
  146. public AjaxResult selectProjectInvestigateIdList(String projectInvestigateId)
  147. {
  148. return success(tProjectInvestigatePersonService.selectProjectInvestigateIdList(projectInvestigateId));
  149. }
  150. }