UserProfileStampController.java 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. package com.zhongzheng.controller.base;
  2. import cn.afterturn.easypoi.excel.entity.ExportParams;
  3. import com.zhongzheng.common.annotation.Log;
  4. import com.zhongzheng.common.core.controller.BaseController;
  5. import com.zhongzheng.common.core.domain.AjaxResult;
  6. import com.zhongzheng.common.core.domain.model.LoginUser;
  7. import com.zhongzheng.common.core.page.TableDataInfo;
  8. import com.zhongzheng.common.enums.BusinessType;
  9. import com.zhongzheng.common.utils.ServletUtils;
  10. import com.zhongzheng.common.utils.poi.ExcelUtil;
  11. import com.zhongzheng.framework.web.service.TokenService;
  12. import com.zhongzheng.modules.base.bo.UserProfileEditBo;
  13. import com.zhongzheng.modules.base.bo.UserProfileQueryBo;
  14. import com.zhongzheng.modules.base.service.IUserProfileService;
  15. import com.zhongzheng.modules.base.vo.UserProfileExportGaiVo;
  16. import com.zhongzheng.modules.base.vo.UserProfileExportVo;
  17. import com.zhongzheng.modules.base.vo.UserProfileVo;
  18. import io.swagger.annotations.Api;
  19. import io.swagger.annotations.ApiOperation;
  20. import lombok.RequiredArgsConstructor;
  21. import org.springframework.beans.factory.annotation.Autowired;
  22. import org.springframework.security.access.prepost.PreAuthorize;
  23. import org.springframework.web.bind.annotation.*;
  24. import java.time.LocalDateTime;
  25. import java.time.format.DateTimeFormatter;
  26. import java.util.ArrayList;
  27. import java.util.HashMap;
  28. import java.util.List;
  29. import java.util.Map;
  30. /**
  31. * 填写资料审核Controller
  32. *
  33. * @author ruoyi
  34. * @date 2021-12-20
  35. */
  36. @Api(value = "填写盖章审核控制器", tags = {"填写盖章审核控制器"})
  37. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  38. @RestController
  39. @RequestMapping("/base/profileStamp")
  40. public class UserProfileStampController extends BaseController {
  41. private final IUserProfileService iUserProfileService;
  42. private final TokenService tokenService;
  43. /**
  44. * 查询填写资料审核列表
  45. */
  46. @ApiOperation("查询填写盖章审核列表")
  47. @PreAuthorize("@ss.hasPermi('system:profile:list')")
  48. @GetMapping("/list")
  49. public TableDataInfo<UserProfileVo> list(UserProfileQueryBo bo) {
  50. startPage();
  51. //2为承诺书审核
  52. bo.setTypeStatus(2L);
  53. List<UserProfileVo> list = iUserProfileService.queryList(bo);
  54. return getDataTable(list);
  55. }
  56. /**
  57. * 查询填写资料审核列表
  58. */
  59. @ApiOperation("查询填写盖章审记录列表")
  60. @PreAuthorize("@ss.hasPermi('system:profile:list')")
  61. @GetMapping("/listRecord")
  62. public TableDataInfo<UserProfileVo> listRecord(UserProfileQueryBo bo) {
  63. startPage();
  64. bo.setTypeStatus(2L);
  65. List<UserProfileVo> list = iUserProfileService.listRecord(bo);
  66. return getDataTable(list);
  67. }
  68. /**
  69. * 获取填写资料审核详细信息
  70. */
  71. @ApiOperation("获取填写盖章审核详细信息")
  72. @PreAuthorize("@ss.hasPermi('system:profile:query')")
  73. @GetMapping("/{id}")
  74. public AjaxResult<UserProfileVo> getInfo(@PathVariable("id" ) Long id) {
  75. return AjaxResult.success(iUserProfileService.queryById(id));
  76. }
  77. /**
  78. * 修改填写资料审核
  79. */
  80. @ApiOperation("审核盖章")
  81. @PreAuthorize("@ss.hasPermi('system:profile:edit')")
  82. @Log(title = "填写盖章审核", businessType = BusinessType.UPDATE)
  83. @PostMapping()
  84. public AjaxResult<Void> edit(@RequestBody UserProfileEditBo bo) {
  85. LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
  86. return toAjax(iUserProfileService.updateAuditByEditBo(bo,loginUser) ? 1 : 0);
  87. }
  88. /**
  89. * 导出资料审核列表
  90. */
  91. @ApiOperation("导出盖章审核列表")
  92. @PreAuthorize("@ss.hasPermi('system:profile:export')")
  93. @Log(title = "客户端用户", businessType = BusinessType.EXPORT)
  94. @GetMapping("/export")
  95. public AjaxResult<Map<String,Object>> export(UserProfileQueryBo bo) {
  96. String fileName = "";
  97. if(bo.getStatus().get(0)==0){
  98. fileName="全部";
  99. }
  100. if(bo.getStatus().get(0)==1){
  101. fileName="通过";
  102. }
  103. if(bo.getStatus().get(0)==2){
  104. fileName="待审";
  105. }
  106. if(bo.getStatus().get(0)==3){
  107. fileName="不通过";
  108. }
  109. startPage();
  110. //2为资料审核
  111. bo.setTypeStatus(2L);
  112. if(bo.getStatus().get(0)==0){
  113. bo.getStatus().remove(0);
  114. bo.setStatus(bo.getStatus());
  115. }
  116. Map<String,Object> map = iUserProfileService.exportPo(bo);
  117. List<UserProfileExportGaiVo> list = (List<UserProfileExportGaiVo>)map.get("list");
  118. ExcelUtil<UserProfileExportGaiVo> util = new ExcelUtil<UserProfileExportGaiVo>(UserProfileExportGaiVo.class);
  119. String timeStr= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
  120. ExportParams deptExportParams = new ExportParams();
  121. // 设置sheet得名称
  122. deptExportParams.setSheetName("表1");
  123. Map<String, Object> deptExportMap = new HashMap<>();
  124. deptExportMap.put("title", deptExportParams);
  125. deptExportMap.put("entity", UserProfileExportGaiVo.class);
  126. // sheet中要填充得数据
  127. deptExportMap.put("data", list);
  128. List<Map<String, Object>> sheetsList = new ArrayList<>();
  129. sheetsList.add(deptExportMap);
  130. map.put("excel",util.exportEasyExcel(sheetsList, "填写盖章审核-"+fileName+"-学员数据-"+timeStr));
  131. map.remove("list");
  132. return AjaxResult.success(map);
  133. }
  134. }