|
|
|
|
@ -80,16 +80,15 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<WxInstrument> bindingInstrumentList() {
|
|
|
|
|
// TODO: 仪器隐藏????
|
|
|
|
|
/* 绑定了的仪器 不受 "可见小程序标签/可见外部标签" 影响 */
|
|
|
|
|
/* 绑定了的仪器 不受 "可见小程序标签/可见外部标签" 影响, 去除仪器隐藏的 */
|
|
|
|
|
return wxInstrumentMapper.selectBindingInstrumentListByUserId(SecurityUtils.getLoginUser().getWxUserMember().getId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<WxInstrument> unbindingInstrumentInfoList() {
|
|
|
|
|
List<WxInstrument> returnList = new ArrayList<>();
|
|
|
|
|
/* 去除仪器隐藏的 */
|
|
|
|
|
List<WxInstrument> wxInstrumentList = wxInstrumentMapper.selectUnbindingInstrumentListByUserId(SecurityUtils.getLoginUser().getWxUserMember().getId());
|
|
|
|
|
// TODO: 仪器隐藏????
|
|
|
|
|
/* 未绑定的仪器 受 "可见小程序标签/可见外部标签" 影响,需要用户拥有全部对应的标签才可见 */
|
|
|
|
|
if (wxInstrumentList != null && wxInstrumentList.size() > 0) {
|
|
|
|
|
// 用户拥有的标签
|
|
|
|
|
@ -128,8 +127,8 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
|
|
|
|
|
WxInstrumentSerial wxInstrumentSerial = wxInstrumentSerialMapper.selectEntityListBySerial(query);
|
|
|
|
|
// 序列号唯一
|
|
|
|
|
if (wxInstrumentSerial == null) {
|
|
|
|
|
logger.info("serial:{}, 没有对应的数据", serial);
|
|
|
|
|
throw new ServiceReturnCodeException("没有对应的序列号,跳转联系客服", 203);
|
|
|
|
|
logger.info("serial:{}, 序列号不存在", serial);
|
|
|
|
|
throw new ServiceReturnCodeException(InstrumentHttpCodeEnum.TWO_HUNDRED_AND_FIVE.getInfo(), InstrumentHttpCodeEnum.TWO_HUNDRED_AND_FIVE.getCode());
|
|
|
|
|
}
|
|
|
|
|
return wxInstrumentSerial;
|
|
|
|
|
}
|
|
|
|
|
@ -175,7 +174,7 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
|
|
|
|
|
if (!StringUtils.equals(wxUserInstrument.getSerial(), serial)) {
|
|
|
|
|
/* 2.1.2、绑定过仪器,但不是同一个序列号,询问是否需要换绑 */
|
|
|
|
|
logger.info("绑定过该类型仪器,但当前扫码的序列号与以前绑定的仪器的序列号不一致,询问用户是否换绑仪器");
|
|
|
|
|
throw new ServiceReturnCodeException("绑定过该类型仪器,但当前扫码的序列号与以前绑定的仪器的序列号不一致,询问用户是否换绑仪器", 202);
|
|
|
|
|
throw new ServiceReturnCodeException(InstrumentHttpCodeEnum.TWO_HUNDRED_AND_TWO.getInfo(), InstrumentHttpCodeEnum.TWO_HUNDRED_AND_TWO.getCode());
|
|
|
|
|
}
|
|
|
|
|
logger.info("扫码序列号与当前用户绑定的序列号一致,无需绑定,返回响应");
|
|
|
|
|
}
|
|
|
|
|
@ -184,7 +183,7 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
|
|
|
|
|
// 不立即绑定
|
|
|
|
|
if (!isImmediatelyBinding) {
|
|
|
|
|
logger.info("可以绑定,但是不立即绑定,页面需要询问用户是否绑定");
|
|
|
|
|
throw new ServiceReturnCodeException("可以绑定,但是不立即绑定,页面需要询问用户是否绑定", 201);
|
|
|
|
|
throw new ServiceReturnCodeException(InstrumentHttpCodeEnum.TWO_HUNDRED_AND_ONE.getInfo(), InstrumentHttpCodeEnum.TWO_HUNDRED_AND_ONE.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 2.2.1、判断序列号是否被别人绑定了 */
|
|
|
|
|
@ -196,11 +195,15 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
|
|
|
|
|
Integer num = wxUserInstrumentMapper.selectUiByInstrumentId(query);
|
|
|
|
|
if (num != null && num > 0) {
|
|
|
|
|
logger.info("被别人绑定了,页面跳转联系客服");
|
|
|
|
|
throw new ServiceReturnCodeException("当前序列码被别人绑定了,页面跳转联系客服", 203);
|
|
|
|
|
throw new ServiceReturnCodeException(InstrumentHttpCodeEnum.TWO_HUNDRED_AND_THREE.getInfo(), InstrumentHttpCodeEnum.TWO_HUNDRED_AND_THREE.getCode());
|
|
|
|
|
}
|
|
|
|
|
/* 2.2.2、绑定仪器 */
|
|
|
|
|
else {
|
|
|
|
|
WxInstrument wxInstrument = wxInstrumentMapper.selectWxInstrumentById(wxInstrumentSerial.getInstrumentId());
|
|
|
|
|
if (wxInstrument != null && wxInstrument.getStatus().intValue() == Status.DISABLE.getCode()) {
|
|
|
|
|
logger.info("仪器({})被隐藏了,无法绑定", wxInstrumentSerial.getInstrumentId());
|
|
|
|
|
throw new ServiceReturnCodeException(InstrumentHttpCodeEnum.TWO_HUNDRED_AND_SIX.getInfo(), InstrumentHttpCodeEnum.TWO_HUNDRED_AND_SIX.getCode());
|
|
|
|
|
}
|
|
|
|
|
WxUserInstrument saveEntity = new WxUserInstrument();
|
|
|
|
|
saveEntity.setUserId(wxUserMember.getId());
|
|
|
|
|
saveEntity.setSerial(serial);
|
|
|
|
|
@ -293,7 +296,12 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
|
|
|
|
|
Integer num = wxUserInstrumentMapper.selectUiByInstrumentId(query);
|
|
|
|
|
if (num != null && num > 0) {
|
|
|
|
|
logger.info("被别人绑定了,页面跳转联系客服");
|
|
|
|
|
throw new ServiceReturnCodeException("当前序列码被别人绑定了,页面跳转联系客服", 203);
|
|
|
|
|
throw new ServiceReturnCodeException(InstrumentHttpCodeEnum.TWO_HUNDRED_AND_THREE.getInfo(), InstrumentHttpCodeEnum.TWO_HUNDRED_AND_THREE.getCode());
|
|
|
|
|
}
|
|
|
|
|
WxInstrument wxInstrument = wxInstrumentMapper.selectWxInstrumentById(newInstrumentSerial.getInstrumentId());
|
|
|
|
|
if (wxInstrument != null && wxInstrument.getStatus().intValue() == Status.DISABLE.getCode()) {
|
|
|
|
|
logger.info("仪器({})被隐藏了,无法绑定", newInstrumentSerial.getInstrumentId());
|
|
|
|
|
throw new ServiceReturnCodeException(InstrumentHttpCodeEnum.TWO_HUNDRED_AND_SIX.getInfo(), InstrumentHttpCodeEnum.TWO_HUNDRED_AND_SIX.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 3、换绑 */
|
|
|
|
|
@ -425,7 +433,12 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
|
|
|
|
|
WxInstrumentSerial wxInstrumentSerial = getInstrumentInfoBySerial(serial);
|
|
|
|
|
if (wxInstrumentSerial.getInstrumentId() != instrumentId) {
|
|
|
|
|
logger.info("用户选择的仪器与序列号对应的仪器不一致,序列号:{}, 仪器ID:{}", serial, instrumentId);
|
|
|
|
|
throw new ServiceReturnCodeException("用户选择的仪器与序列号对应的仪器不一致", 204);
|
|
|
|
|
throw new ServiceReturnCodeException(InstrumentHttpCodeEnum.TWO_HUNDRED_AND_FOUR.getInfo(), InstrumentHttpCodeEnum.TWO_HUNDRED_AND_FOUR.getCode());
|
|
|
|
|
}
|
|
|
|
|
WxInstrument wxInstrument = wxInstrumentMapper.selectWxInstrumentById(wxInstrumentSerial.getInstrumentId());
|
|
|
|
|
if (wxInstrument != null && wxInstrument.getStatus().intValue() == Status.DISABLE.getCode()) {
|
|
|
|
|
logger.info("仪器({})被隐藏了,无法绑定", wxInstrumentSerial.getInstrumentId());
|
|
|
|
|
throw new ServiceReturnCodeException(InstrumentHttpCodeEnum.TWO_HUNDRED_AND_SIX.getInfo(), InstrumentHttpCodeEnum.TWO_HUNDRED_AND_SIX.getCode());
|
|
|
|
|
}
|
|
|
|
|
return wxInstrumentSerial;
|
|
|
|
|
}
|
|
|
|
|
|