mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-30 20:17:59 +08:00
新增 用户解绑鉴权卡接口
This commit is contained in:
@@ -326,4 +326,24 @@ public class MemberController extends BaseController {
|
|||||||
logger.info("用户绑定鉴权卡 result:{}", response);
|
logger.info("用户绑定鉴权卡 result:{}", response);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/memberUnbindingCard")
|
||||||
|
public RestApiResponse<?> memberUnbindingCard(HttpServletRequest request, @RequestBody BindingCardDTO dto) {
|
||||||
|
logger.info("用户解绑鉴权卡 param:{}", JSONObject.toJSONString(dto));
|
||||||
|
RestApiResponse<?> response = null;
|
||||||
|
try {
|
||||||
|
String memberId = getMemberIdByAuthorization(request);
|
||||||
|
dto.setMemberId(memberId);
|
||||||
|
int i = memberService.memberUnbindCard(dto);
|
||||||
|
response = new RestApiResponse<>(i);
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
logger.error("用户解绑鉴权卡 error", e);
|
||||||
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("用户解绑鉴权卡 error", e);
|
||||||
|
response = new RestApiResponse<>(e);
|
||||||
|
}
|
||||||
|
logger.info("用户解绑鉴权卡 result:{}", response);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,10 +275,10 @@ public class MemberService {
|
|||||||
.mobileNumber(dto.getPhoneNumber())
|
.mobileNumber(dto.getPhoneNumber())
|
||||||
.verificationCode(dto.getVerificationCode())
|
.verificationCode(dto.getVerificationCode())
|
||||||
.build();
|
.build();
|
||||||
// checkVerificationCode(registerAndLoginDTO);
|
checkVerificationCode(registerAndLoginDTO);
|
||||||
// 判断当前鉴权卡是否被绑定过
|
// 判断当前鉴权卡是否被绑定过
|
||||||
PileAuthCard authCard = PileAuthCard.builder()
|
PileAuthCard authCard = PileAuthCard.builder()
|
||||||
.physicsCard(dto.getPhysicsCard())
|
.logicCard(dto.getLogicCard())
|
||||||
.build();
|
.build();
|
||||||
PileAuthCard pileAuthCardInfo = pileAuthCardService.selectPileAuthCardInfo(authCard);
|
PileAuthCard pileAuthCardInfo = pileAuthCardService.selectPileAuthCardInfo(authCard);
|
||||||
if (pileAuthCardInfo == null){
|
if (pileAuthCardInfo == null){
|
||||||
@@ -295,4 +295,30 @@ public class MemberService {
|
|||||||
authCard.setId(pileAuthCardInfo.getId());
|
authCard.setId(pileAuthCardInfo.getId());
|
||||||
return pileAuthCardService.updatePileAuthCard(authCard);
|
return pileAuthCardService.updatePileAuthCard(authCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户解绑鉴权卡
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int memberUnbindCard(BindingCardDTO dto) {
|
||||||
|
// 校验短信验证码
|
||||||
|
MemberRegisterAndLoginDTO registerAndLoginDTO = MemberRegisterAndLoginDTO.builder()
|
||||||
|
.mobileNumber(dto.getPhoneNumber())
|
||||||
|
.verificationCode(dto.getVerificationCode())
|
||||||
|
.build();
|
||||||
|
// checkVerificationCode(registerAndLoginDTO);
|
||||||
|
// 校验身份信息
|
||||||
|
PileAuthCard authCard = PileAuthCard.builder()
|
||||||
|
.logicCard(dto.getLogicCard())
|
||||||
|
.memberId(dto.getMemberId())
|
||||||
|
.build();
|
||||||
|
PileAuthCard pileAuthCardInfo = pileAuthCardService.selectPileAuthCardInfo(authCard);
|
||||||
|
if (pileAuthCardInfo == null){
|
||||||
|
// 为空说明没查到此卡信息
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_THIS_CARD_HAS_NO_INFO);
|
||||||
|
}
|
||||||
|
// 解绑鉴权卡
|
||||||
|
return pileAuthCardService.unBindingCard(authCard);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,4 +67,6 @@ public interface PileAuthCardMapper {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deletePileAuthCardByIds(Long[] ids);
|
public int deletePileAuthCardByIds(Long[] ids);
|
||||||
|
|
||||||
|
int unBindingCard(PileAuthCard pileAuthCard);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,4 +65,6 @@ public interface IPileAuthCardService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deletePileAuthCardById(Long id);
|
public int deletePileAuthCardById(Long id);
|
||||||
|
|
||||||
|
int unBindingCard(PileAuthCard pileAuthCard);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,4 +95,9 @@ public class PileAuthCardServiceImpl implements IPileAuthCardService {
|
|||||||
public int deletePileAuthCardById(Long id) {
|
public int deletePileAuthCardById(Long id) {
|
||||||
return pileAuthCardMapper.deletePileAuthCardById(id);
|
return pileAuthCardMapper.deletePileAuthCardById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int unBindingCard(PileAuthCard pileAuthCard) {
|
||||||
|
return pileAuthCardMapper.unBindingCard(pileAuthCard);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,4 +109,11 @@
|
|||||||
</if>
|
</if>
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="unBindingCard">
|
||||||
|
update pile_auth_card
|
||||||
|
set status = '9', del_flag = '1'
|
||||||
|
where member_id = #{memberId,jdbcType=VARCHAR}
|
||||||
|
and logic_card = #{logicCard,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user