fix
Helius
2021-07-19 5e4f1cba1d27b43aeef878ae3b4e77813a2870ff
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
package com.xzx.gc.user.controller;
 
import com.xzx.gc.common.Result;
import com.xzx.gc.common.annotations.PassToken;
import com.xzx.gc.common.request.BaseController;
import com.xzx.gc.model.JsonResult;
import com.xzx.gc.user.dto.JhyApplyDto;
import com.xzx.gc.user.service.JhyInfoService;
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.web.bind.annotation.GetMapping;
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.HashMap;
import java.util.Map;
 
@RestController
@Api(tags = {"集物员--小程序集物员"})
@Slf4j
public class ApiJhyInfoController extends BaseController {
 
    @Autowired
    private JhyInfoService jhyInfoService;
 
    @ApiOperation("申请集物员")
    @PostMapping(value = "/jhy/apply")
    public Result<String> apply(@RequestBody JhyApplyDto applyDto, HttpServletRequest request) {
        String userId = getUserId(request);
        applyDto.setUserId(userId);
        jhyInfoService.applyJhy(applyDto);
        return Result.success();
    }
 
    @ApiOperation("获取集物员审核状态")
    @PostMapping(value = "/jhy/applyStatus")
    public Result<Integer> applyStatus(HttpServletRequest request) {
        int status = jhyInfoService.applyStatus(getUserId(request));
        return Result.success(status);
    }
 
    @PassToken
    @ApiOperation("是否集货员")
    @GetMapping(value = "/jhy/isJhy")
    public JsonResult<Map<String, Object>> isJhy(HttpServletRequest request) {
        int flag = jhyInfoService.isJhy(getUserId(request));
        Map<String, Object> map = new HashMap<>();
        map.put("flag", flag == 1);
        switch (flag) {
            case 0:
                map.put("icon", "../../images/icon_entrance.png");
                map.put("name", "成为集物员");
                map.put("path", "../../subcontract1/become_sgm/become_sgm");
                break;
            case 1:
                map.put("icon", "../../images/icon_team.png");
                map.put("name", "集物员订单列表");
                map.put("path", "../../collectPersonnel/GCOrderForm/index");
                break;
            case 2:
                map.put("icon", "../../images/icon_entrance.png");
                map.put("name", "集物员待审核");
                map.put("path", "../../pages/home/home");
                break;
            default:
                map.put("icon", "../../images/icon_entrance.png");
                map.put("name", "成为集物员");
                map.put("path", "../../subcontract1/become_sgm/become_sgm");
        }
        return JsonResult.success(map);
    }
}