|
|
|
|
@ -128,8 +128,8 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
|
|
|
|
|
WxInstrumentSerial wxInstrumentSerial = getInstrumentInfoBySerial(serial);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 2、判断当前用户是否绑定了序列号对应仪器的序列号
|
|
|
|
|
* 逻辑:查询‘当前用户’是否绑定了扫码序列号对应的仪器
|
|
|
|
|
* 2、判断当前用户是否绑定了序列号对应仪器的仪器ID
|
|
|
|
|
* (每个用户只能绑定一个仪器ID,当多个序列号对应的仪器ID一样时,则进行换绑)
|
|
|
|
|
* 绑定了:
|
|
|
|
|
* 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);
|
|
|
|
|
|
|
|
|
|
|