|
@@ -5,9 +5,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
import org.jeecg.modules.events.entity.LeanEventsHost;
|
|
import org.jeecg.modules.events.entity.LeanEventsHost;
|
|
import org.jeecg.modules.events.entity.LeanEventsHostEditParam;
|
|
import org.jeecg.modules.events.entity.LeanEventsHostEditParam;
|
|
|
|
+import org.jeecg.modules.events.entity.LeanEventsHostResult;
|
|
import org.jeecg.modules.events.mapper.DeviceInformationMapper;
|
|
import org.jeecg.modules.events.mapper.DeviceInformationMapper;
|
|
import org.jeecg.modules.events.mapper.LeanEventsHostMapper;
|
|
import org.jeecg.modules.events.mapper.LeanEventsHostMapper;
|
|
import org.jeecg.modules.events.service.ILeanEventsHostService;
|
|
import org.jeecg.modules.events.service.ILeanEventsHostService;
|
|
|
|
+import org.jeecg.modules.leanEventHostConfig.entity.LeanEventsHostConfig;
|
|
|
|
+import org.jeecg.modules.leanEventHostConfig.mapper.LeanEventsHostConfigMapper;
|
|
|
|
+import org.jeecg.modules.leanEventHostConfig.service.ILeanEventsHostConfigService;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -33,23 +38,41 @@ public class LeanEventsHostServiceImpl extends ServiceImpl<LeanEventsHostMapper,
|
|
@Autowired
|
|
@Autowired
|
|
public RedisTemplate redisTemplate;
|
|
public RedisTemplate redisTemplate;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private LeanEventsHostConfigMapper leanEventsHostConfigMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private ILeanEventsHostConfigService leanEventsHostConfigService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void edit(LeanEventsHostEditParam leanEventsHostEditParam) {
|
|
public void edit(LeanEventsHostEditParam leanEventsHostEditParam) {
|
|
if (oConvertUtils.listIsNotEmpty(leanEventsHostEditParam.getLeanEventsHosts())) {
|
|
if (oConvertUtils.listIsNotEmpty(leanEventsHostEditParam.getLeanEventsHosts())) {
|
|
List<LeanEventsHost> leanEventsHostList = leanEventsHostEditParam.getLeanEventsHosts();
|
|
List<LeanEventsHost> leanEventsHostList = leanEventsHostEditParam.getLeanEventsHosts();
|
|
LambdaQueryWrapper<LeanEventsHost> deleteQuery = new LambdaQueryWrapper<LeanEventsHost>().eq(LeanEventsHost::getEventsId, leanEventsHostList.get(0).getEventsId());
|
|
LambdaQueryWrapper<LeanEventsHost> deleteQuery = new LambdaQueryWrapper<LeanEventsHost>().eq(LeanEventsHost::getEventsId, leanEventsHostList.get(0).getEventsId());
|
|
baseMapper.delete(deleteQuery);
|
|
baseMapper.delete(deleteQuery);
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<LeanEventsHostConfig> deleteQuery1 = new LambdaQueryWrapper<LeanEventsHostConfig>().eq(LeanEventsHostConfig::getEventsId, leanEventsHostList.get(0).getEventsId());
|
|
|
|
+ leanEventsHostConfigMapper.delete(deleteQuery1);
|
|
|
|
+
|
|
leanEventsHostList.forEach(x -> {
|
|
leanEventsHostList.forEach(x -> {
|
|
if (oConvertUtils.isNotEmpty(x.getDeviceInformationList())) {
|
|
if (oConvertUtils.isNotEmpty(x.getDeviceInformationList())) {
|
|
|
|
+ // 保存精益事件启停配置信息
|
|
baseMapper.insert(x);
|
|
baseMapper.insert(x);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ List<LeanEventsHostConfig> leanEventsHostConfigList = leanEventsHostEditParam.getLeanEventsHostConfigs();
|
|
|
|
+ if (oConvertUtils.listIsNotEmpty(leanEventsHostConfigList)){
|
|
|
|
+ leanEventsHostConfigService.saveBatch(leanEventsHostConfigList);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
updateEviceInformationCache();
|
|
updateEviceInformationCache();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<LeanEventsHost> getConfig(String id) {
|
|
|
|
|
|
+ public List<LeanEventsHostResult> getConfig(String id) {
|
|
|
|
+
|
|
|
|
+ List<LeanEventsHostResult> leanEventsHostResultList = new ArrayList<>();
|
|
|
|
+
|
|
LambdaQueryWrapper<LeanEventsHost> query = new LambdaQueryWrapper<LeanEventsHost>().eq(LeanEventsHost::getEventsId, id);
|
|
LambdaQueryWrapper<LeanEventsHost> query = new LambdaQueryWrapper<LeanEventsHost>().eq(LeanEventsHost::getEventsId, id);
|
|
List<LeanEventsHost> leanEventsHosts = baseMapper.selectList(query);
|
|
List<LeanEventsHost> leanEventsHosts = baseMapper.selectList(query);
|
|
leanEventsHosts.forEach(leanEventsHost -> {
|
|
leanEventsHosts.forEach(leanEventsHost -> {
|
|
@@ -68,7 +91,33 @@ public class LeanEventsHostServiceImpl extends ServiceImpl<LeanEventsHostMapper,
|
|
// 更新 LeanEventsHost 对象的辅设备配置信息ID集
|
|
// 更新 LeanEventsHost 对象的辅设备配置信息ID集
|
|
leanEventsHost.setDeviceInformationList(String.join(",", resChildTites));
|
|
leanEventsHost.setDeviceInformationList(String.join(",", resChildTites));
|
|
});
|
|
});
|
|
- return leanEventsHosts;
|
|
|
|
|
|
+
|
|
|
|
+ leanEventsHosts.forEach(x ->{
|
|
|
|
+ LeanEventsHostResult leanEventsHostResult = new LeanEventsHostResult();
|
|
|
|
+ BeanUtils.copyProperties(x, leanEventsHostResult);
|
|
|
|
+ leanEventsHostResultList.add(leanEventsHostResult);
|
|
|
|
+ });
|
|
|
|
+ if (!oConvertUtils.listIsNotEmpty(leanEventsHostResultList)){
|
|
|
|
+ return leanEventsHostResultList;
|
|
|
|
+ }
|
|
|
|
+ List<String> list =leanEventsHostResultList.stream().map(LeanEventsHostResult::getDeviceInformationList).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ List<String> deviceInformationIdIds = new ArrayList<>();
|
|
|
|
+ list.forEach(s ->{
|
|
|
|
+ deviceInformationIdIds.addAll(Arrays.asList(s.split(",")));
|
|
|
|
+ });
|
|
|
|
+ List<String> newDeviceInformationIdIds = new ArrayList<>();
|
|
|
|
+ deviceInformationIdIds.forEach(x ->{
|
|
|
|
+ String substring = x.substring(0, x.indexOf("|"));
|
|
|
|
+ newDeviceInformationIdIds.add(substring);
|
|
|
|
+ });
|
|
|
|
+ LambdaQueryWrapper<LeanEventsHostConfig> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ wrapper.in(LeanEventsHostConfig::getDeviceInformationListId, newDeviceInformationIdIds);
|
|
|
|
+ List<LeanEventsHostConfig> leanEventsHostConfigList = leanEventsHostConfigService.list(wrapper);
|
|
|
|
+ if (oConvertUtils.listIsNotEmpty(leanEventsHostConfigList)){
|
|
|
|
+ leanEventsHostResultList.forEach(y ->y.setLeanEventsHostConfigs(leanEventsHostConfigList));
|
|
|
|
+ }
|
|
|
|
+ return leanEventsHostResultList;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|