udpate 个人桩绑定时校验桩类型

This commit is contained in:
Lemon
2023-03-16 11:18:10 +08:00
parent e28093012b
commit e8f425221b
2 changed files with 13 additions and 5 deletions

View File

@@ -243,6 +243,17 @@ public class PileService {
.build();
memberService.checkVerificationCode(registerAndLoginDTO);
// 判断桩是否为个人桩
PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(dto.getPileSn());
if (pileBasicInfo == null) {
// 未查到则说明没有此桩
throw new BusinessException(ReturnCodeEnum.CODE_PILE_NOT_INFO);
}
String businessType = pileBasicInfo.getBusinessType();
if (!StringUtils.equals(BusinessTypeEnum.INDIVIDUAL_PILE.getValue(), businessType)){
// 不一致则此桩不是个人桩
throw new BusinessException(ReturnCodeEnum.CODE_THIS_PILE_NOT_PERSONAL_PILE);
}
// 检查桩是否已经被绑定
PileMemberRelation pileMemberRelation = new PileMemberRelation();
pileMemberRelation.setPileSn(dto.getPileSn());
@@ -252,11 +263,6 @@ public class PileService {
throw new BusinessException(ReturnCodeEnum.CODE_PILE_HAS_BEEN_BINDING_ERROR);
}
// 如果没被绑定,先校验桩密钥是否一致
PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(dto.getPileSn());
if (pileBasicInfo == null) {
// 未查到则说明没有此桩
throw new BusinessException(ReturnCodeEnum.CODE_PILE_NOT_INFO);
}
if (!StringUtils.equals(pileBasicInfo.getSecretKey(), dto.getSecretKey())) {
// 错误的密钥信息
throw new BusinessException(ReturnCodeEnum.CODE_SECRET_KEY_ERROR);

View File

@@ -121,6 +121,8 @@ public enum ReturnCodeEnum {
CODE_PILE_NOT_INFO("00400012", "未查到该该桩的信息,请检查!"),
CODE_SECRET_KEY_ERROR("00400013", "填写的桩密钥有误,请检查!"),
CODE_THIS_PILE_NOT_PERSONAL_PILE("00400014", "此桩不是个人桩!"),
;
private String value;