|
@@ -22,11 +22,13 @@ import com.xy.collections.list.JList;
|
|
|
import com.xy.config.DeviceThreadPoolConfig;
|
|
|
import com.xy.consts.DictConsts;
|
|
|
import com.xy.dto.*;
|
|
|
+import com.xy.dto.be.MercDto;
|
|
|
import com.xy.entity.*;
|
|
|
import com.xy.enums.FileExportType;
|
|
|
import com.xy.error.CommRuntimeException;
|
|
|
import com.xy.mapper.DeviceInfoMapper;
|
|
|
import com.xy.mapper.entity.DeviceInfoQueryPage;
|
|
|
+import com.xy.service.be.MercFeignService;
|
|
|
import com.xy.util.ExcelUtils;
|
|
|
import com.xy.utils.*;
|
|
|
import com.xy.utils.enums.*;
|
|
@@ -63,6 +65,7 @@ import static com.xy.utils.PlusBeans.*;
|
|
|
@Api(tags = "设备-信息")
|
|
|
public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceInfo> implements DeviceInfoService {
|
|
|
|
|
|
+ private final MercFeignService mercFeignService;
|
|
|
private final DeviceSysinfoServiceImpl deviceSysinfoService;
|
|
|
|
|
|
private final DeviceStatusServiceImpl deviceStatusService;
|
|
@@ -416,13 +419,14 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
* @return
|
|
|
*/
|
|
|
private Boolean removeMerRefDevicesToTopMerc(List<DeviceInfo> deviceInfos) {
|
|
|
+ MercDto.Vo mercCheck = R.feignCheckData(mercFeignService.obj(new MercDto.ListDTO().setMercCode(QA_MERC_CODE)));
|
|
|
if (CollUtil.isNotEmpty(deviceInfos)) {
|
|
|
deviceInfos.forEach(deviceInfo -> {
|
|
|
//回收
|
|
|
- deviceInfo.setMercId(-1L);
|
|
|
+ deviceInfo.setMercId(mercCheck.getId());
|
|
|
deviceInfo.setMercDeviceCode(StrUtil.EMPTY);
|
|
|
- deviceInfo.setMercName(StrUtil.EMPTY);
|
|
|
- deviceInfo.setMercCode(StrUtil.EMPTY);
|
|
|
+ deviceInfo.setMercName(mercCheck.getName());
|
|
|
+ deviceInfo.setMercCode(QA_MERC_CODE);
|
|
|
});
|
|
|
//批量更新
|
|
|
return updateBatchById(deviceInfos);
|
|
@@ -443,16 +447,33 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
deviceInfos.forEach(deviceInfo -> {
|
|
|
//非顶级兴元商户,解绑后,机器归父商户
|
|
|
if (parentId != 1) {
|
|
|
- deviceInfo.setMercId(parentId);
|
|
|
+ MercDto.Vo mercParent = R.feignCheckData(mercFeignService.obj(new MercDto.ListDTO().setId(parentId)));
|
|
|
+ if (mercParent != null) {
|
|
|
+ deviceInfo.setMercId(mercParent.getId());
|
|
|
+ deviceInfo.setMercName(mercParent.getName());
|
|
|
+ deviceInfo.setMercCode(mercParent.getMercCode());
|
|
|
+ } else {
|
|
|
+ deviceInfo.setMercId(-1L);
|
|
|
+ deviceInfo.setMercName(StrUtil.EMPTY);
|
|
|
+ deviceInfo.setMercCode(StrUtil.EMPTY);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
//一级商户,解绑后,直接释放
|
|
|
if (parentId == 0) {
|
|
|
- //兴元等级 0 释放关系
|
|
|
- deviceInfo.setMercId(-1L);
|
|
|
+ MercDto.Vo mercCheck = R.feignCheckData(mercFeignService.obj(new MercDto.ListDTO().setMercCode(QA_MERC_CODE)));
|
|
|
+ if (mercCheck != null) {
|
|
|
+ deviceInfo.setMercId(mercCheck.getId());
|
|
|
+ deviceInfo.setMercName(mercCheck.getName());
|
|
|
+ deviceInfo.setMercCode(mercCheck.getMercCode());
|
|
|
+ } else {
|
|
|
+ deviceInfo.setMercId(-1L);
|
|
|
+ deviceInfo.setMercName(StrUtil.EMPTY);
|
|
|
+ deviceInfo.setMercCode(StrUtil.EMPTY);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- deviceInfo.setMercName(StrUtil.EMPTY);
|
|
|
- deviceInfo.setMercCode(StrUtil.EMPTY);
|
|
|
});
|
|
|
//批量更新
|
|
|
return updateBatchById(deviceInfos);
|