|
@@ -251,6 +251,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public R<Boolean> mercDeviceAuth(DeviceInfoDto.MercDeviceAuthDto auth) {
|
|
public R<Boolean> mercDeviceAuth(DeviceInfoDto.MercDeviceAuthDto auth) {
|
|
Long mercId = auth.getMercId();
|
|
Long mercId = auth.getMercId();
|
|
|
|
+ Long parentId = auth.getParentId();
|
|
String mercCode = auth.getMercCode();
|
|
String mercCode = auth.getMercCode();
|
|
Long algorithmId = auth.getAlgorithmId();
|
|
Long algorithmId = auth.getAlgorithmId();
|
|
String mercName = auth.getMercName();
|
|
String mercName = auth.getMercName();
|
|
@@ -262,7 +263,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
if (CollUtil.isEmpty(devices)) {
|
|
if (CollUtil.isEmpty(devices)) {
|
|
return R.ok(Boolean.TRUE);
|
|
return R.ok(Boolean.TRUE);
|
|
}
|
|
}
|
|
- return R.ok(removeMerRefDevices(devices));
|
|
|
|
|
|
+ return R.ok(removeMerRefDevices(devices, parentId));
|
|
}
|
|
}
|
|
//更新商户设备授权
|
|
//更新商户设备授权
|
|
List<DeviceInfo> deviceInfos = this.listByIds(deviceIds);
|
|
List<DeviceInfo> deviceInfos = this.listByIds(deviceIds);
|
|
@@ -298,7 +299,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
});
|
|
});
|
|
if (CollUtil.isNotEmpty(removeIds)) {
|
|
if (CollUtil.isNotEmpty(removeIds)) {
|
|
List<DeviceInfo> removeList = this.listByIds(removeIds);
|
|
List<DeviceInfo> removeList = this.listByIds(removeIds);
|
|
- removeMerRefDevices(removeList);
|
|
|
|
|
|
+ removeMerRefDevices(removeList, parentId);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return R.ok(Boolean.TRUE);
|
|
return R.ok(Boolean.TRUE);
|
|
@@ -310,10 +311,18 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
* @param deviceInfos
|
|
* @param deviceInfos
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private Boolean removeMerRefDevices(List<DeviceInfo> deviceInfos) {
|
|
|
|
|
|
+ private Boolean removeMerRefDevices(List<DeviceInfo> deviceInfos, Long parentId) {
|
|
deviceInfos.forEach(deviceInfo -> {
|
|
deviceInfos.forEach(deviceInfo -> {
|
|
- //-1 释放关系
|
|
|
|
- deviceInfo.setMercId(-1L);
|
|
|
|
|
|
+ //非顶级兴元商户,解绑后,机器归父商户
|
|
|
|
+ if (parentId != 1) {
|
|
|
|
+ deviceInfo.setMercId(parentId);
|
|
|
|
+ }
|
|
|
|
+ //一级商户,解绑后,直接释放
|
|
|
|
+ if (parentId == 0) {
|
|
|
|
+ //-1 释放关系
|
|
|
|
+ deviceInfo.setMercId(-1L);
|
|
|
|
+ }
|
|
|
|
+
|
|
deviceInfo.setMercName(StrUtil.EMPTY);
|
|
deviceInfo.setMercName(StrUtil.EMPTY);
|
|
deviceInfo.setMercCode(StrUtil.EMPTY);
|
|
deviceInfo.setMercCode(StrUtil.EMPTY);
|
|
});
|
|
});
|