mitao
2025-02-24 879ce4e66b36daf44f79b17eb02d3578148e4545
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
package com.panzhihua.applets.api;
 
import javax.annotation.Resource;
import javax.validation.Valid;
 
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.AddIdentityAuthDTO;
import com.panzhihua.common.model.dtos.community.GetIdentityEidTokenDTO;
import com.panzhihua.common.model.dtos.community.PageIdentityAuthRecordDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.IdentityAuthRecordDetailVO;
import com.panzhihua.common.service.community.CommunityService;
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
 
/**
 * @title: IdentityAuthApi 身份认证相关API
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 小程序端身份认证相关
 * @author: hans
 * @date: 2021/09/01 16:00
 */
@Slf4j
@RestController
@RequestMapping("/identity-auth")
@Api(tags = {"身份认证"})
public class IdentityAuthApi extends BaseController {
 
    @Resource
    private CommunityService communityService;
 
    @ApiOperation(value = "查询社区身份认证方式", response = R.class)
    @GetMapping("/mode")
    public R getIdentityAuthMode(@RequestParam(value = "communityId")
                              @ApiParam(value = "社区id", required = true)
                              Long communityId,
                              @RequestParam(value = "identityAuthType")
                              @ApiParam(value = "身份认证类型", required = true)
                              Integer identityAuthType) {
        return communityService.getIdentityAuthMode(communityId, identityAuthType);
    }
 
    @ApiOperation(value = "身份认证获取EidToken接口")
    @PostMapping("/getEidToken")
    public R getEidToken(@RequestBody @Valid GetIdentityEidTokenDTO getIdentityEidTokenDTO) {
        return communityService.getEidToken(getIdentityEidTokenDTO);
    }
 
    @ApiOperation(value = "新增身份认证")
    @PostMapping("/add")
    public R addIdentityAuth(@RequestBody @Valid AddIdentityAuthDTO addIdentityAuthDTO) {
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        addIdentityAuthDTO.setSubmitUserId(loginUserInfo.getUserId());
        addIdentityAuthDTO.setCommunityId(loginUserInfo.getCommunityId());
        addIdentityAuthDTO.setAreaCode(this.getAreaCode());
        return communityService.addIdentityAuth(addIdentityAuthDTO);
    }
 
    @ApiOperation(value = "分页查询身份认证记录", response = IdentityAuthRecordDetailVO.class)
    @PostMapping("/record/page")
    public R queryRecordWithPage(@RequestBody @Valid PageIdentityAuthRecordDTO pageIdentityAuthRecordDTO) {
        pageIdentityAuthRecordDTO.setSubmitUserId(this.getUserId());
        return communityService.queryRecordWithPage(pageIdentityAuthRecordDTO);
    }
 
    @ApiOperation(value = "获取身份认证详情", response = IdentityAuthRecordDetailVO.class)
    @GetMapping("/detail")
    public R retrieveIdentityAuthDetail(@RequestParam("authType")
                                        @ApiParam(value = "身份认证类型(1.高龄认证 2.养老认证)", required = true, allowableValues = "1,2", example = "1")
                                        Integer authType,
                                        @RequestParam("identityAuthId")
                                        @ApiParam(value = "身份认证id", required = true, example = "1")
                                        Long identityAuthId) {
        return communityService.retrieveIdentityAuthDetail(authType, identityAuthId);
    }
}