|
@@ -16,19 +16,17 @@ import com.gyee.impala.mapper.slave.Windturbinetestingpointai2Mapper;
|
|
|
import com.gyee.impala.model.custom.TsDoubleData;
|
|
|
import com.gyee.impala.model.master.Casefault;
|
|
|
import com.gyee.impala.model.master.Casefaultalg;
|
|
|
+import com.gyee.impala.model.slave.Temperatureinfo;
|
|
|
import com.gyee.impala.model.slave.Windturbinetestingpointai2;
|
|
|
import com.gyee.impala.service.master.CasefaultService;
|
|
|
import com.gyee.impala.service.master.CasefaultalgService;
|
|
|
-import org.apache.ibatis.session.SqlSession;
|
|
|
import org.apache.kudu.client.*;
|
|
|
-import org.mybatis.spring.SqlSessionTemplate;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -55,7 +53,6 @@ public class CasefaultalgServiceImpl extends ServiceImpl<CasefaultalgMapper, Cas
|
|
|
|
|
|
/**
|
|
|
* 获取所有风机风速测点
|
|
|
- * @return
|
|
|
*/
|
|
|
@Cacheable("aisAI022")
|
|
|
public Map<String, Windturbinetestingpointai2> getWindpointai2s() {
|
|
@@ -65,6 +62,15 @@ public class CasefaultalgServiceImpl extends ServiceImpl<CasefaultalgMapper, Cas
|
|
|
return ai2s.stream().collect(Collectors.toMap(Windturbinetestingpointai2::getWindturbineid, Function.identity()));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取所有风机环境温度测点
|
|
|
+ */
|
|
|
+ @Cacheable("aishjwd")
|
|
|
+ public Map<String, String> gethjwd() {
|
|
|
+ List<Temperatureinfo> temperature = windturbinetestingpointai2Mapper.getTemperature();
|
|
|
+ return temperature.stream().collect(Collectors.toMap(Temperatureinfo::getWindturbineid, Temperatureinfo::getTag));
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void insertBatch(List<Casefaultalg> list) {
|
|
|
if (list == null || list.size() == 0)
|
|
@@ -85,7 +91,10 @@ public class CasefaultalgServiceImpl extends ServiceImpl<CasefaultalgMapper, Cas
|
|
|
for (Casefaultalg casefaultalg : list) {
|
|
|
Map<String,TsDoubleData> historySection = remoteServiceBuilder.adapter().getHistorySection(windpointai2s.get(casefaultalg.getWindturbineid()).getId(), DateUtil.str2DateTime(casefaultalg.getStarttime()).getTime());
|
|
|
TsDoubleData value = historySection.entrySet().iterator().next().getValue();
|
|
|
+ Map<String,TsDoubleData> historySectionHjwd = remoteServiceBuilder.adapter().getHistorySection(gethjwd().get(casefaultalg.getWindturbineid()), DateUtil.str2DateTime(casefaultalg.getStarttime()).getTime());
|
|
|
+ TsDoubleData valueHjwd = historySectionHjwd.entrySet().iterator().next().getValue();
|
|
|
casefaultalg.setSpeed(String.valueOf(value.getDoubleValue()));
|
|
|
+ casefaultalg.setTemperature((float) valueHjwd.getDoubleValue());
|
|
|
}
|
|
|
insert(list);
|
|
|
} catch (Exception e) {
|
|
@@ -240,6 +249,7 @@ public class CasefaultalgServiceImpl extends ServiceImpl<CasefaultalgMapper, Cas
|
|
|
row.addObject("category", obj.getCategory());
|
|
|
row.addObject("createtime", DateUtil.getCurrentDate());
|
|
|
row.addObject("speed", obj.getSpeed());
|
|
|
+ row.addObject("temperature", obj.getTemperature());
|
|
|
|
|
|
// 先不提交kudu
|
|
|
kuduSession.apply(insert);
|