mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-03 17:40:13 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -92,4 +92,33 @@ public class AuthCardController extends BaseController {
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户解绑鉴权卡
|
||||
* http://localhost:8080/uniapp/authCard/unbindAuthCard
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/unbindAuthCard")
|
||||
public RestApiResponse<?> unbindAuthCard(HttpServletRequest request, @RequestBody PileAuthCardDTO dto) {
|
||||
logger.info("用户解绑鉴权卡 params:{}", JSONObject.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String memberId = getMemberIdByAuthorization(request);
|
||||
if (memberId == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_AUTHENTICATION_ERROR);
|
||||
}
|
||||
dto.setMemberId(memberId);
|
||||
pileAuthCardService.unbindAuthCard(dto);
|
||||
response = new RestApiResponse<>();
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("用户解绑鉴权卡 warn ", e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
}catch (Exception e) {
|
||||
logger.warn("用户解绑鉴权卡 error ", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("用户解绑鉴权卡 result :{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -144,6 +144,8 @@ public enum ReturnCodeEnum {
|
||||
|
||||
CODE_THIS_CARD_STATUS_ANOMALY("00600005", "卡状态异常!"),
|
||||
|
||||
CODE_THIS_CARD_BIND_INFO_ERROR("00600006", "卡绑定信息有误!"),
|
||||
|
||||
;
|
||||
|
||||
private String value;
|
||||
|
||||
@@ -125,4 +125,11 @@ public interface IPileAuthCardService {
|
||||
* @param dto
|
||||
*/
|
||||
int bindAuthCard(PileAuthCardDTO dto);
|
||||
|
||||
/**
|
||||
* 用户解绑鉴权卡 (小程序用)
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
int unbindAuthCard(PileAuthCardDTO dto);
|
||||
}
|
||||
|
||||
@@ -246,4 +246,24 @@ public class PileAuthCardServiceImpl implements IPileAuthCardService {
|
||||
pileAuthCard.setStatus("1");
|
||||
return updatePileAuthCard(pileAuthCard);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户解绑鉴权卡
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int unbindAuthCard(PileAuthCardDTO dto) {
|
||||
// 根据传过来的卡号查询数据库
|
||||
PileAuthCard pileAuthCard = selectCardInfoByLogicCard(dto.getLogicCard());
|
||||
if (pileAuthCard == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_THIS_CARD_HAS_NO_INFO);
|
||||
}
|
||||
// 如果memberId对应的上,则进行解绑操作 (将数据库中 del_flag 改为 1)
|
||||
if (!StringUtils.equals(pileAuthCard.getMemberId(), dto.getMemberId())) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_THIS_CARD_BIND_INFO_ERROR);
|
||||
}
|
||||
pileAuthCard.setDelFlag("1");
|
||||
return updatePileAuthCard(pileAuthCard);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user