教育训练处考试制证系统后端
“djh”
2025-02-20 ca90224ae08ff40b78daad37175639cae71c0855
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package com.gkhy.exam.pay.controller;
 
import com.gkhy.exam.pay.entity.CoalPayStudent;
import com.gkhy.exam.pay.service.CoalPayStudentService;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import java.io.IOException;
import java.util.List;
 
@RestController
@Api(tags = "煤矿缴费批次对应学员管理")
@RequestMapping("/pay/coalPayStudent")
public class CoalPayStudentController extends BaseController {
 
    @Autowired
    private CoalPayStudentService coalPayStudentService;
 
    /**
     * 缴费批次对应学生
     */
    @GetMapping("/studentList/{coalPayId}")
    @ApiOperation(value = "缴费信息对应学员信息")
    public TableDataInfo list(@PathVariable Long coalPayId) {
        startPage();
        List<CoalPayStudent> list = coalPayStudentService.selectCoalPayStudentList(coalPayId);
        return getDataTable(list);
    }
 
    /**
     * 修改相关学生信息
     */
    @PostMapping("/update")
    @ApiOperation(value = "修改相关学员信息")
    public AjaxResult updateStudent(@RequestBody CoalPayStudent coalPayStudent){
        return coalPayStudentService.updateByCoalPayStudent(coalPayStudent);
    }
 
    /**
     * 新增相关学生
     */
    @PostMapping("/insert")
    @ApiOperation(value = "新增相关学员")
    public AjaxResult insertStudent(@Validated @RequestBody CoalPayStudent coalPayStudent){
        return toAjax(coalPayStudentService.insertStudent(coalPayStudent));
    }
 
    /**
     * 删除相关学生
     */
    @PostMapping("/delete")
    @ApiOperation(value = "删除对应学员")
    public AjaxResult deleteStudent(@RequestBody Long[] ids){
        return toAjax(coalPayStudentService.deleteStudent(ids));
    }
 
    /**
     * 批量导入学生
     */
    @PostMapping("/import")
    @Anonymous
    @ApiModelProperty(value = "导入学员")
    public AjaxResult uploadStudent(@RequestParam("file") MultipartFile file, @RequestParam("coalPayId") Long coalPayId) {
        try {
            return coalPayStudentService.uploadStudent(file, coalPayId);
        } catch (IOException e) {
            // 处理异常,返回友好的错误消息
            return AjaxResult.error("学员信息导入失败: " + e.getMessage());
        }
    }
}