Этот коммит содержится в:
caixiang 2022-12-12 16:08:43 +08:00
родитель ff63c194ee 1173d670e4
Коммит 7e3e028eb0
3 изменённых файлов: 14 добавлений и 14 удалений

Просмотреть файл

@ -29,9 +29,9 @@ public class S7DemoController {
private static final Logger logger = LoggerFactory.getLogger(S7DemoController.class);
//for 常规计
@PostMapping("/insertDemoDataForMetering")
public void insertDemoDataForMetering() throws InterruptedException {
//for 常规计
@PostMapping("/insertDemoDataForCount")
public void insertDemoDataForCount() throws InterruptedException {
List<Event> list = new ArrayList<>();
Random r = new Random();
@ -147,9 +147,9 @@ public class S7DemoController {
}
//for 常规计
@PostMapping("/insertDemoDataForCount")
public void insertDemoDataForCount() throws InterruptedException {
//for 常规计
@PostMapping("/insertDemoDataForMetering")
public void insertDemoDataForMetering() throws InterruptedException {
List<Event> list = new ArrayList<>();
Random r = new Random();

Просмотреть файл

@ -117,6 +117,7 @@ public class ProcessInspectionController {
return R.ok("成功",xbarSGraphData);
}
@PostMapping("/XMRGraphTest")
public R<XMRGraphData> XMRGraphTest() throws Exception {
ProductFeatures productFeatures = new ProductFeatures();

Просмотреть файл

@ -22,6 +22,7 @@ import com.cnbm.influx.config.InfluxClient;
import com.cnbm.influx.param.PageInfo;
import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.influx.param.Range;
import com.cnbm.influx.param.Tag;
import com.cnbm.influx.template.Event;
import com.cnbm.processInspection.dto.InspectionSampleDTO;
@ -29,7 +30,6 @@ import com.cnbm.processInspection.dto.InspectionSheetDTO;
import com.cnbm.processInspection.entity.InspectionSheet;
import com.cnbm.processInspection.mapper.InspectionSheetMapper;
import com.cnbm.processInspection.service.IInspectionSheetService;
import com.google.gson.JsonObject;
import com.influxdb.query.FluxRecord;
import com.influxdb.query.FluxTable;
import org.apache.commons.lang3.StringUtils;
@ -209,9 +209,7 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
queryDataParam.setMeasurement(workingProcedureName);
//queryDataParam.setInspectionSheetId(inspectionSheetId);
queryDataParam.setBucket("qgs-bucket");
//queryDataParam.setTag(new Tag("inspectionSheetId", inspectionSheetId));
queryDataParam.setTags(Arrays.asList(new Tag("inspectionSheetId", inspectionSheetId)));
List<String> dropNames = new ArrayList<>();
dropNames.add("transationId");
queryDataParam.setDropedTagNames(dropNames);
@ -240,6 +238,7 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
InspectionSampleDTO sampleDTO = new InspectionSampleDTO();
sampleDTO.setSampleNumber(sampleNumber);
//sampleDTO.setSampleTime(LocalDateTime.ofInstant(events.get(0).getTime(), ZoneId.systemDefault()));
sampleDTO.setSampleTime(events.get(0).getTime());
sampleDTO.setBatchNum(dto.getBatchNumber());
sampleDTO.setInspectionSheetId(events.get(0).getInspectionSheetId());
@ -266,9 +265,9 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
String sampleNumber = dto.getSampleNumber();
String jsonData = dto.getJsonData();
JSONObject json = JSON.parseObject(jsonData);
Instant time = dto.getSampleTime();
// LocalDateTime sampleTime = dto.getSampleTime();
// Instant eventTime = sampleTime.toInstant(ZoneOffset.UTC);
Instant eventTime = dto.getSampleTime();
List<Event> list = new ArrayList<>();
for (Map.Entry entry : json.entrySet()) {
String key = entry.getKey().toString();
@ -278,7 +277,7 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
// v= Double.valueOf(entry.getValue().toString());
// }catch (Exception e){
// }
list.add(newEvent(time, inspectionSheetId, key, v, sampleNumber));
list.add(newEvent(eventTime, inspectionSheetId, key, v, sampleNumber));
}
InfluxClient.Client.batchInsert(list, workingProcedureName);
}