18582019636
2024-06-26 f23efcba1bbbb84b603403711df00af138bdf3da
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package com.ruoyi.admin.controller;
 
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.admin.entity.WorkerProcess;
import com.ruoyi.admin.service.WorkerProcessService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
 
/**
 * <p>
 * 师傅入驻审核表 前端控制器
 * </p>
 *
 * @author hjl
 * @since 2024-05-29
 */
@RestController
@RequestMapping("/workerProcess")
@Api(tags = {"后台-师傅管理-师傅入驻审核管理"})
public class WorkerProcessController {
 
    @Resource
    private WorkerProcessService workerProcessService;
 
    /**
     * 师傅入驻审核分页列表
     *
     * @param pageNum  页码
     * @param pageSize 每页显示条数
     */
    @ApiOperation(value = "师傅入驻审核分页查询列表", tags = {"后台-师傅管理-师傅入驻审核管理"})
    @GetMapping(value = "/page")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "用户ID", name = "userNumber", dataType = "String"),
            @ApiImplicitParam(value = "真实姓名", name = "workerName", dataType = "String"),
            @ApiImplicitParam(value = "所属城市", name = "city", dataType = "String"),
            @ApiImplicitParam(value = "当前状态(0:待审核 1:已通过 2:已驳回)", name = "state", dataType = "Integer"),
            @ApiImplicitParam(value = "页码", name = "pageNum", dataType = "Integer", required = true),
            @ApiImplicitParam(value = "每页条数", name = "pageSize", dataType = "Integer", required = true)
    })
    public R<IPage<WorkerProcess>> queryPageList(String userNumber, String workerName, String city, Integer state,
                                                 @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        LambdaQueryChainWrapper<WorkerProcess> wrapper = workerProcessService.lambdaQuery();
        wrapper = StringUtils.isNotBlank(workerName) ? wrapper.like(WorkerProcess::getRealName, workerName) : wrapper;
        wrapper = StringUtils.isNotBlank(city) ? wrapper.like(WorkerProcess::getCity, city) : wrapper;
        wrapper = null != state ? wrapper.eq(WorkerProcess::getState, state) : wrapper;
        return R.ok(wrapper.eq(WorkerProcess::getIsDelete, 0)
                .orderByDesc(WorkerProcess::getCreateTime).page(Page.of(pageNum, pageSize)));
    }
 
    /**
     * 师傅入驻审核详情
     *
     * @param id 师傅入驻审核id
     */
    @ApiOperation(value = "师傅入驻审核详情", tags = {"后台-师傅管理-师傅入驻审核管理"})
    @GetMapping(value = "/detail")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "师傅入驻审核id", name = "id", dataType = "Integer", required = true)
    })
    public R<WorkerProcess> detail(@RequestParam Integer id) {
        return R.ok(workerProcessService.getById(id));
    }
 
    /**
     * 新增师傅入驻审核
     *
     * @param prize 师傅入驻审核信息
     */
    @ApiOperation(value = "新增师傅入驻审核", tags = {"后台-师傅管理-师傅入驻审核管理"})
    @PostMapping(value = "/save")
    public R<String> save(@RequestBody WorkerProcess prize) {
        return workerProcessService.save(prize) ? R.ok() : R.fail();
    }
 
    /**
     * 根据id批量删除师傅入驻审核
     *
     * @param ids 师傅入驻审核id拼接
     */
    @ApiOperation(value = "批量删除师傅入驻审核", tags = {"后台-师傅管理-师傅入驻审核管理"})
    @GetMapping(value = "/batchDelete")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "多条师傅入驻审核id ',' 拼接", name = "ids", dataType = "String", required = true)
    })
    public R<String> batchDelete(@RequestParam String ids) {
        List<String> idList = Arrays.stream(ids.split(",")).collect(Collectors.toList());
        List<WorkerProcess> list = workerProcessService.lambdaQuery().in(WorkerProcess::getId, idList).list();
        list.forEach(data -> data.setIsDelete(1));
        return workerProcessService.updateBatchById(list) ? R.ok() : R.fail();
    }
 
    /**
     * 审核
     *
     * @param id 师傅入驻审核id
     */
    @ApiOperation(value = "师傅入驻审核", tags = {"后台-师傅管理-师傅入驻审核管理"})
    @GetMapping(value = "/examine")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "审核信息id", name = "id", dataType = "Integer", required = true),
            @ApiImplicitParam(value = "审核状态(0:待审核 ;1:已通过 ;2:已驳回)", name = "state", dataType = "Integer", required = true),
            @ApiImplicitParam(value = "审核意见", name = "opinion", dataType = "String")
    })
    public R<String> examine(@RequestParam Integer id, @RequestParam Integer state, String opinion) {
        return workerProcessService.examine(id, state, opinion);
    }
 
}