add 小程序查询用户鉴权卡列表接口

This commit is contained in:
Lemon
2023-05-24 08:46:20 +08:00
parent 45cf7d84f6
commit 50c26169e9
8 changed files with 178 additions and 5 deletions

View File

@@ -0,0 +1,73 @@
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;
}
}

View File

@@ -3,7 +3,6 @@ package com.jsowell.web.controller.pile;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.pile.dto.PileAuthCardDTO;
import com.jsowell.pile.vo.web.PileAuthCardVO;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -87,7 +86,7 @@ public class PileAuthCardController extends BaseController {
@Log(title = "充电站鉴权卡", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PileAuthCardDTO dto) {
return toAjax(pileAuthCardService.insertPileAuthCardForWeb(dto));
return toAjax(pileAuthCardService.addAuthCard(dto));
}
/**