mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 19:45:09 +08:00
74 lines
2.1 KiB
Java
74 lines
2.1 KiB
Java
|
|
package com.jsowell.api.uniapp;
|
||
|
|
|
||
|
|
import com.alibaba.fastjson2.JSONObject;
|
||
|
|
import com.jsowell.common.annotation.Anonymous;
|
||
|
|
import com.jsowell.common.core.controller.BaseController;
|
||
|
|
import com.jsowell.common.response.RestApiResponse;
|
||
|
|
import com.jsowell.pile.dto.PileAuthCardDTO;
|
||
|
|
import com.jsowell.pile.service.IPileAuthCardService;
|
||
|
|
import com.jsowell.pile.vo.uniapp.AuthCardVO;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.web.bind.annotation.*;
|
||
|
|
|
||
|
|
import javax.servlet.http.HttpServletRequest;
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 鉴权卡相关
|
||
|
|
*
|
||
|
|
* @author JS-ZZA
|
||
|
|
* @date 2023/5/23 9:32
|
||
|
|
*/
|
||
|
|
@Anonymous
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/uniapp/authCard")
|
||
|
|
public class AuthCardController extends BaseController {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private IPileAuthCardService pileAuthCardService;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询鉴权卡列表
|
||
|
|
* @param request
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@GetMapping("/getAuthCardList")
|
||
|
|
public RestApiResponse<?> getAuthCardList(HttpServletRequest request) {
|
||
|
|
RestApiResponse<?> response = null;
|
||
|
|
try {
|
||
|
|
String memberId = getMemberIdByAuthorization(request);
|
||
|
|
logger.info("查询用户鉴权卡列表 param memberId:{}", memberId);
|
||
|
|
List<AuthCardVO> list = pileAuthCardService.getAuthCardListByMemberId(memberId);
|
||
|
|
response = new RestApiResponse<>(list);
|
||
|
|
} catch (Exception e) {
|
||
|
|
logger.error("查询鉴权卡列表 error", e);
|
||
|
|
response = new RestApiResponse<>(e);
|
||
|
|
}
|
||
|
|
logger.info("查询用户鉴权卡列表 result : {}", response);
|
||
|
|
return response;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 用户绑定鉴权卡
|
||
|
|
* @param dto
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@PostMapping("/bindAuthCard")
|
||
|
|
public RestApiResponse<?> bindAuthCard(HttpServletRequest request, @RequestBody PileAuthCardDTO dto) {
|
||
|
|
logger.info("用户绑定鉴权卡 params: {}", JSONObject.toJSONString(dto));
|
||
|
|
try {
|
||
|
|
String memberId = getMemberIdByAuthorization(request);
|
||
|
|
if (memberId != null) {
|
||
|
|
dto.setMemberId(memberId);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
} catch (Exception e) {
|
||
|
|
|
||
|
|
}
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|