微信用户绑定仪器,换绑仪器 响应规范

master
382696293@qq.com 2 years ago
parent db36c05a7e
commit 98a68d71eb

@ -128,8 +128,8 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
WxInstrumentSerial wxInstrumentSerial = getInstrumentInfoBySerial(serial);
/**
* 2
*
* 2ID
* IDID
*
* 1
* 2
@ -143,7 +143,7 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
userBindInstrumentQuery.setInstrumentId(wxInstrumentSerial.getInstrumentId());
userBindInstrumentQuery.setStatus(Status.OK.getCode().longValue());
List<WxUserInstrument> wxUserInstrumentList = wxUserInstrumentMapper.selectListByUserIdAndInstrumentId(userBindInstrumentQuery);
// 2.1、当前用户绑定了序列号对应的仪器的序列号
// 2.1、当前用户绑定过序列号对应的仪器ID
if (wxUserInstrumentList != null) {
if (wxUserInstrumentList.size() != 1) {
logger.error("根据 用户id:{} 和 仪器id:{} 查询出来的数据为空或者数据量不止一条", wxUserMember.getId(), wxInstrumentSerial.getInstrumentId());
@ -151,16 +151,14 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
}
WxUserInstrument wxUserInstrument = wxUserInstrumentList.get(0);
/* 2.1.1、判断扫码获取的序列号和用户绑定的序列号是否一致 */
if (StringUtils.equals(wxUserInstrument.getSerial(), serial)) {
logger.info("相同序列号,页面重新发起查询用户拥有的仪器列表");
throw new ServiceReturnCodeException("扫码的序列号已被当前用户绑定,请查询仪器列表", 200);
} else {
if (!StringUtils.equals(wxUserInstrument.getSerial(), serial)) {
/* 2.1.2、绑定过仪器,但不是同一个序列号,询问是否需要换绑 */
logger.info("绑定过该类型仪器,但当前扫码不是以前绑定的仪器,询问是否换绑仪器");
throw new ServiceReturnCodeException("绑定过该类型仪器,但当前扫码不是以前绑定的仪器,询问是否换绑仪器", 202);
logger.info("绑定过该类型仪器,但当前扫码的序列号与以前绑定的仪器的序列号不一致,询问用户是否换绑仪器");
throw new ServiceReturnCodeException("绑定过该类型仪器,但当前扫码的序列号与以前绑定的仪器的序列号不一致,询问用户是否换绑仪器", 202);
}
logger.info("扫码序列号与当前用户绑定的序列号一致,无需绑定,返回响应");
}
// 2.2、用户没有绑定过序列号对应的仪器
// 2.2、用户没有绑定过序列号对应的仪器ID
else {
/* 2.2.1、判断序列号是否被别人绑定了 */
WxUserInstrument query = new WxUserInstrument();
@ -276,7 +274,7 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
List<WxUserInstrument> wxUserInstrumentList = wxUserInstrumentMapper.selectListByUserIdAndInstrumentId(userInstrumentQuery);
if (wxUserInstrumentList == null || wxUserInstrumentList.size() != 1) {
logger.error("根据 用户id:{} 和 仪器id:{} 查询出来的数据为空或者数据量不止一条", wxUserMember.getId(), newInstrumentSerial.getInstrumentId());
throw new ServiceException("换绑失败!");
throw new ServiceException("换绑失败");
}
WxUserInstrument wxUserInstrument = wxUserInstrumentList.get(0);

Loading…
Cancel
Save