mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
新增 绑定鉴权卡需密钥
This commit is contained in:
@@ -327,6 +327,12 @@ public class MemberController extends BaseController {
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户解绑鉴权卡
|
||||
* @param request
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/memberUnbindingCard")
|
||||
public RestApiResponse<?> memberUnbindingCard(HttpServletRequest request, @RequestBody BindingCardDTO dto) {
|
||||
logger.info("用户解绑鉴权卡 param:{}", JSONObject.toJSONString(dto));
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
@@ -289,6 +290,10 @@ public class MemberService {
|
||||
// memberId 不为空,说明此卡已被绑定
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_THIS_CARD_HAS_BEEN_BINDING);
|
||||
}
|
||||
if (!StringUtils.equals(pileAuthCardInfo.getSecretKey(), dto.getSecretKey().toUpperCase(Locale.ROOT))) {
|
||||
// 密钥不一致,不能绑定
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SECRET_KEY_NOT_SAME);
|
||||
}
|
||||
authCard.setMemberId(dto.getMemberId());
|
||||
authCard.setStatus("1"); // 1-正常使用
|
||||
authCard.setCreateBy(dto.getMemberId());
|
||||
|
||||
@@ -109,4 +109,14 @@ public class PileAuthCardController extends BaseController {
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(pileAuthCardService.deletePileAuthCardByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 停用充电站鉴权卡
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:card:edit')")
|
||||
@Log(title = "充电站鉴权卡", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("/deactivateCard/{id}")
|
||||
public AjaxResult deactivateCard(@PathVariable("id") Long id) {
|
||||
return toAjax(pileAuthCardService.deactivateCard(id));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user