MemberController.java 3.03 KB
package com.subsidy.controller;


import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.dto.administer.DownloadFailMembersDTO;
import com.subsidy.dto.member.AddMemberDTO;
import com.subsidy.dto.member.QueryMembersDTO;
import com.subsidy.model.GroupMemberMappingDO;
import com.subsidy.model.MemberDO;
import com.subsidy.service.MemberService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.swagger.annotations.Api;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Tuyp
 * @since 2024-07-18
 */
@RestController
@Api(tags = "人才表")
@RequestMapping("/member")
public class MemberController {

    @Autowired
    private MemberService memberService;

    @PostMapping("addMember")
    @ApiOperation("添加人才  groupId userName telephone gender idCard payrollAccount bank  ")
    public ResponseVO addMember(@RequestBody AddMemberDTO addMemberDTO) {
        memberService.addMember(addMemberDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("updateMember")
    @ApiOperation("修改 id  userName telephone gender idCard payrollAccount bank ")
    public ResponseVO updateMember(@RequestBody AddMemberDTO addMemberDTO) {
        memberService.updateMember(addMemberDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("deleteMember")
    @ApiOperation("删除 id ")
    public ResponseVO deleteMember(@RequestBody MemberDO memberDO) {
        memberService.deleteMember(memberDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("queryMembers")
    @ApiOperation("花名册 groupId 组别id  userInfo  pageSize pageNum ")
    public ResponseVO queryMembers(@RequestBody QueryMembersDTO queryMembersDTO) {
        return ResponseData.generateCreatedResponse(0, memberService.queryMembers(queryMembersDTO));
    }

    @PostMapping("detail")
    @ApiOperation("花名册--详情  memberId 人才id")
    public ResponseVO detail(@RequestBody GroupMemberMappingDO groupMemberMappingDO){
        return ResponseData.generateCreatedResponse(0, memberService.detail(groupMemberMappingDO));
    }

    @PostMapping("importMember")
    @ApiOperation("导入学生  {groupId  file}" +
            "模板地址:https://ykhl-bigger.oss-cn-beijing.aliyuncs.com/%E4%BA%BA%E6%89%8D%E6%A8%A1%E6%9D%BF.xlsx")
//    @LoginRequired
    public ResponseVO importMember(Long groupId, @RequestParam("file") MultipartFile file) throws Exception {
        return ResponseData.generateCreatedResponse(0, memberService.importMember(groupId, file));
    }

    @PostMapping("downloadFailMembers")
    @ApiOperation("下载失败的学员  importMemberVOS[] 字段是导出失败的字段")
    public void downloadFailMembers(@RequestBody DownloadFailMembersDTO downloadFailMembersDTO){
        memberService.downloadFailMembers(downloadFailMembersDTO);
    }

}