Helius
2021-07-14 290ae8b3a86a4fb00cc6c45744c76065593d276d
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
package com.xzx.gc.user.controller;
 
 
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xzx.gc.common.Result;
import com.xzx.gc.common.constant.CommonEnum;
import com.xzx.gc.common.constant.Constants;
import com.xzx.gc.common.dto.log.OperationAppLog;
import com.xzx.gc.common.request.BaseController;
import com.xzx.gc.common.utils.BusinessUtil;
import com.xzx.gc.entity.UserGatherApply;
import com.xzx.gc.entity.UserGatherInfo;
import com.xzx.gc.model.IdDTO;
import com.xzx.gc.model.user.UserGatherAuditParam;
import com.xzx.gc.model.user.UserGatherListParDTO;
import com.xzx.gc.user.service.UserGatherApplyService;
import com.xzx.gc.user.service.UserGatherInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
import java.util.List;
 
 
@RestController
@Validated
@Slf4j
@Api(tags = "集货员管理")
public class UserGatherController extends BaseController {
 
 
    @Autowired
    private UserGatherInfoService userGatherInfoService;
 
    @Autowired
    private UserGatherApplyService userGatherApplyService;
 
    @PostMapping(value = {"/userGather/find"})
    @ApiOperation(value = "根据ID查询集货员")
    public Result<UserGatherInfo> find(HttpServletRequest request, @RequestBody IdDTO idDTO) {
        UserGatherInfo byId = userGatherInfoService.findById(idDTO.getId());
        UserGatherApply byRelationId = userGatherApplyService.findByRelationId(idDTO.getId());
        byId.setApplyInfo(byRelationId);
        return Result.success(byId);
    }
 
    @PostMapping(value = {"/admin/front/userGather/list"})
    @ApiOperation(value = "查询集货员列表")
    public Result<PageInfo<UserGatherInfo>> list(HttpServletRequest request, @RequestBody UserGatherListParDTO userGatherListParDTO) {
        PageHelper.startPage(userGatherListParDTO.getPageNo(),userGatherListParDTO.getPageSize());
        List<UserGatherInfo> list= userGatherInfoService.list(userGatherListParDTO);
        return Result.success(new PageInfo<>(list));
    }
 
    @PostMapping(value = {"/admin/front/userGather/delete"})
    @ApiOperation(value = "删除集货员")
    public Result delete(HttpServletRequest request, @RequestBody IdDTO idDTO) {
        userGatherInfoService.deleteById(idDTO.getId());
        OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))
                .methodName(Constants.USER_MODUL_NAME).operateAction("删除集货员-"+idDTO.getId()).build();
        mqUtil.sendApp(build);
        return Result.success();
    }
 
 
}