|
@@ -7,6 +7,7 @@ import com.fdkankan.fusion.entity.CaseDevice;
|
|
|
import com.fdkankan.fusion.entity.CaseSettings;
|
|
|
import com.fdkankan.fusion.entity.DictFile;
|
|
|
import com.fdkankan.fusion.exception.BusinessException;
|
|
|
+import com.fdkankan.fusion.httpClient.LaserService;
|
|
|
import com.fdkankan.fusion.httpClient.client.FdKKClient;
|
|
|
import com.fdkankan.fusion.httpClient.request.FdModelParam;
|
|
|
import com.fdkankan.fusion.httpClient.response.FdModelDeviceLocationVo;
|
|
@@ -65,22 +66,32 @@ public class CaseDeviceServiceImpl extends ServiceImpl<ICaseDeviceMapper, CaseDe
|
|
|
ResultData<List<FdModelDeviceVo>> resultData = fdKKClient.getByModelName(new FdModelParam(caseSettings1.getLocationModelName(), null, null));
|
|
|
List<FdModelDeviceVo> datas = resultData.getData();
|
|
|
List<String> macIds = datas.stream().map(FdModelDeviceVo::getMacId).collect(Collectors.toList());
|
|
|
- HashMap<String, String> map = getNameByCaseAndMacId(caseId, macIds);
|
|
|
+ HashMap<String, CaseDevice> map = getNameByCaseAndMacId(caseId, macIds);
|
|
|
+ HashMap<Integer, DictFileVo> dictFileVoHashMap = new HashMap<>();
|
|
|
List<DictFileVo> list = dictFileService.getUseDevice();
|
|
|
+ list.forEach(e -> dictFileVoHashMap.put(e.getId(),e));
|
|
|
Integer i = 1;
|
|
|
for (FdModelDeviceVo data : datas) {
|
|
|
- data.setDeviceName(map.get(data.getMacId()) == null ? "设备"+i : map.get(data.getMacId()));
|
|
|
- i ++;
|
|
|
+ CaseDevice caseDevice = map.get(data.getMacId());
|
|
|
+ String deviceName= "设备"+i;
|
|
|
+ if(caseDevice!=null && StringUtils.isNotBlank(caseDevice.getDeviceName())){
|
|
|
+ deviceName = caseDevice.getDeviceName();
|
|
|
+ }
|
|
|
+ if(caseDevice != null && caseDevice.getCharacterModelId() != null){
|
|
|
+ data.setCharacterModel(dictFileVoHashMap.get(caseDevice.getCharacterModelId()));
|
|
|
+ }
|
|
|
+ data.setDeviceName(deviceName);
|
|
|
data.setCharacterModelList(list);
|
|
|
ResultData<List<FdModelDeviceLocationVo>> resultData2 = fdKKClient.getByMacAndModelName(new FdModelParam(caseSettings1.getLocationModelName(), data.getMacId(), 10));
|
|
|
data.setLocationList(resultData2.getData());
|
|
|
+ i ++;
|
|
|
}
|
|
|
|
|
|
return datas;
|
|
|
}
|
|
|
|
|
|
- private HashMap<String,String> getNameByCaseAndMacId(Integer caseId,List<String> macIds){
|
|
|
- HashMap<String,String> map = new HashMap<>();
|
|
|
+ private HashMap<String,CaseDevice> getNameByCaseAndMacId(Integer caseId,List<String> macIds){
|
|
|
+ HashMap<String,CaseDevice> map = new HashMap<>();
|
|
|
if(caseId == null || macIds == null || macIds.isEmpty()){
|
|
|
return map;
|
|
|
}
|
|
@@ -89,7 +100,7 @@ public class CaseDeviceServiceImpl extends ServiceImpl<ICaseDeviceMapper, CaseDe
|
|
|
wrapper.eq(CaseDevice::getCaseId,caseId);
|
|
|
wrapper.in(CaseDevice::getMacId,macIds);
|
|
|
List<CaseDevice> list = this.list(wrapper);
|
|
|
- list.forEach(e -> map.put(e.getMacId(),e.getDeviceName()));
|
|
|
+ list.forEach(e -> map.put(e.getMacId(),e));
|
|
|
return map;
|
|
|
}
|
|
|
|