| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- package com.zhongzheng.controller.base;
- import java.io.IOException;
- import java.time.LocalDateTime;
- import java.time.format.DateTimeFormatter;
- import java.util.*;
- import cn.afterturn.easypoi.excel.entity.ExportParams;
- import cn.hutool.core.lang.Validator;
- import com.zhongzheng.common.core.domain.model.LoginUser;
- import com.zhongzheng.common.utils.ServletUtils;
- import com.zhongzheng.framework.web.service.TokenService;
- import com.zhongzheng.modules.base.vo.UserProfileExportGaiVo;
- import com.zhongzheng.modules.base.vo.UserProfileExportVo;
- import com.zhongzheng.modules.grade.vo.ClassPeriodStudentExportVo;
- import com.zhongzheng.modules.user.bo.UserQueryBo;
- import com.zhongzheng.modules.user.vo.UserVo;
- import lombok.RequiredArgsConstructor;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.DeleteMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import com.zhongzheng.common.annotation.Log;
- import com.zhongzheng.common.core.controller.BaseController;
- import com.zhongzheng.common.core.domain.AjaxResult;
- import com.zhongzheng.common.enums.BusinessType;
- import com.zhongzheng.modules.base.vo.UserProfileVo;
- import com.zhongzheng.modules.base.bo.UserProfileQueryBo;
- import com.zhongzheng.modules.base.bo.UserProfileAddBo;
- import com.zhongzheng.modules.base.bo.UserProfileEditBo;
- import com.zhongzheng.modules.base.service.IUserProfileService;
- import com.zhongzheng.common.utils.poi.ExcelUtil;
- import com.zhongzheng.common.core.page.TableDataInfo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- /**
- * 填写资料审核Controller
- *
- * @author ruoyi
- * @date 2021-12-20
- */
- @Api(value = "填写资料审核控制器", tags = {"填写资料审核管理"})
- @RequiredArgsConstructor(onConstructor_ = @Autowired)
- @RestController
- @RequestMapping("/base/profile")
- public class UserProfileController extends BaseController {
- private final IUserProfileService iUserProfileService;
- private final TokenService tokenService;
- /**
- * 查询填写资料审核列表
- */
- @ApiOperation("查询填写资料审核列表")
- @PreAuthorize("@ss.hasPermi('system:profile:list')")
- @GetMapping("/list")
- public TableDataInfo<UserProfileVo> list(UserProfileQueryBo bo) {
- startPage();
- //1为资料审核
- bo.setTypeStatus(1L);
- List<UserProfileVo> list = iUserProfileService.queryList(bo);
- return getDataTable(list);
- }
- /**
- * 查询填写资料审核列表
- */
- @ApiOperation("查询填写资料审记录列表")
- @PreAuthorize("@ss.hasPermi('system:profile:list')")
- @GetMapping("/listRecord")
- public TableDataInfo<UserProfileVo> listRecord(UserProfileQueryBo bo) {
- startPage();
- //1为资料审核
- bo.setTypeStatus(1L);
- List<UserProfileVo> list = iUserProfileService.listRecord(bo);
- return getDataTable(list);
- }
- /**
- * 获取填写资料审核详细信息
- */
- @ApiOperation("获取填写资料审核详细信息")
- @PreAuthorize("@ss.hasPermi('system:profile:query')")
- @GetMapping("/{id}")
- public AjaxResult<UserProfileVo> getInfo(@PathVariable("id" ) Long id) {
- return AjaxResult.success(iUserProfileService.queryById(id));
- }
- /**
- * 修改填写资料审核
- */
- @ApiOperation("审核资料")
- @PreAuthorize("@ss.hasPermi('system:profile:edit')")
- @Log(title = "审核资料", businessType = BusinessType.UPDATE)
- @PostMapping()
- public AjaxResult<Void> edit(@RequestBody UserProfileEditBo bo) {
- LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
- return toAjax(iUserProfileService.updateAuditByEditBo(bo,loginUser) ? 1 : 0);
- }
- /**
- * 导出资料审核列表
- */
- @ApiOperation("导出资料审核列表")
- @PreAuthorize("@ss.hasPermi('system:profile:export')")
- @Log(title = "客户端用户", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult<Map<String,Object>> export(UserProfileQueryBo bo) {
- String fileName = "";
- if(Validator.isEmpty(bo.getStatus())){
- bo.setStatus(new ArrayList<Integer>(Arrays.asList(0)));
- fileName="全部";
- }else {
- if(bo.getStatus().get(0)==0){
- fileName="全部";
- }
- if(bo.getStatus().get(0)==1){
- fileName="通过";
- }
- if(bo.getStatus().get(0)==2){
- fileName="待审";
- }
- if(bo.getStatus().get(0)==3){
- fileName="不通过";
- }
- }
- startPage();
- //1为资料审核
- bo.setTypeStatus(1L);
- if(bo.getStatus().get(0)==0){
- bo.getStatus().remove(0);
- bo.setStatus(bo.getStatus());
- }
- Map<String,Object> map = iUserProfileService.export(bo);
- List<UserProfileExportVo> list = (List<UserProfileExportVo>)map.get("list");
- ExcelUtil<UserProfileExportVo> util = new ExcelUtil<UserProfileExportVo>(UserProfileExportVo.class);
- String timeStr= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
- ExportParams deptExportParams = new ExportParams();
- // 设置sheet得名称
- deptExportParams.setSheetName("表1");
- Map<String, Object> deptExportMap = new HashMap<>();
- deptExportMap.put("title", deptExportParams);
- deptExportMap.put("entity", UserProfileExportVo.class);
- // sheet中要填充得数据
- deptExportMap.put("data", list);
- List<Map<String, Object>> sheetsList = new ArrayList<>();
- sheetsList.add(deptExportMap);
- map.put("excel",util.exportEasyExcel(sheetsList, "填写资料审核-"+fileName+"-学员数据-"+timeStr));
- map.remove("list");
- return AjaxResult.success(map);
- }
- @ApiOperation("承诺书下载")
- @GetMapping("/querCommitment")
- public AjaxResult querCommitment(UserProfileQueryBo bo) {
- return AjaxResult.success(iUserProfileService.querCommitment(bo));
- }
- /*@ApiOperation("审核资料测试")
- @PreAuthorize("@ss.hasPermi('system:profile:edit')")
- @Log(title = "填写资料审核", businessType = BusinessType.UPDATE)
- @PostMapping("/test")
- public AjaxResult test(@RequestBody UserProfileAddBo bo) throws IOException {
- return AjaxResult.success(iUserProfileService.testWord(bo));
- }*/
- }
|