commit for pull

This commit is contained in:
caixiang 2022-12-09 15:31:32 +08:00
parent de3fe9b95c
commit 652812d3ba
2 changed files with 45 additions and 14 deletions

View File

@ -54,31 +54,47 @@ public class S7DemoController {
InfluxClient.Client.batchInsert(list,"Weight");
}
public static void main(String[] args) throws InterruptedException {
long l1 = System.currentTimeMillis();
System.out.println(l1);
Date date = new Date(l1);
Thread.sleep(1000);
Date date2 = new Date(l1);
System.out.println();
}
@PostMapping("/insertDemoOne")
public void insertDemoOne() throws InterruptedException {
List<Event> list = new ArrayList<>();
Random r = new Random();
Thread.sleep(10);
Instant time = new Date().toInstant();
Event event = new Event();
event.setTime(time);
Event event = new Event();
event.setTime(new Date(1670554110451L).toInstant());
event.setArgName("failDayDay");
event.setArgValue("1");
event.setArgValue("30089");
event.setSampleNumber("10001");
list.add(event);
Thread.sleep(1000);
Event event2 = new Event();
event2.setTime(time);
event2.setTime(new Date(1670555006702L).toInstant());
event2.setArgName("failDayDay");
event2.setArgValue("2");
event2.setArgValue("40088");
event2.setSampleNumber("10001");
list.add(event2);
InfluxClient.Client.batchInsert(list,"Weight");
// Thread.sleep(10000);
//
// List<Event> list2 = new ArrayList<>();
// Event event2 = new Event();
// event2.setTime(time);
//
// event2.setArgName("failDayDay");
// event2.setArgValue("20087");
// event2.setSampleNumber("10001");
// list2.add(event2);
//
// InfluxClient.Client.batchInsert(list2,"Weight");
}
@PostMapping("/readDemoOne")
public void readDemoOne() throws InterruptedException {
@ -95,6 +111,16 @@ public class S7DemoController {
queryDataParam.setTag(new Tag("argName","failDayDay"));
queryDataParam.setBucket(Constant.bucket);
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
Instant time = query.get(0).getRecords().get(0).getTime();
List<Event> list = new ArrayList<>();
Event event2 = new Event();
event2.setTime(time);
event2.setArgName("failDayDay");
event2.setArgValue("40089");
event2.setSampleNumber("10001");
list.add(event2);
InfluxClient.Client.batchInsert(list,"Weight");
System.out.println();
}

View File

@ -14,6 +14,7 @@ import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.processInspection.dto.InspectionSampleDTO;
import com.cnbm.processInspection.dto.InspectionSheetDTO;
import com.cnbm.processInspection.entity.InspectionSheet;
import com.cnbm.processInspection.excel.InspectionSheetExcel;
import com.cnbm.processInspection.service.IInspectionSheetService;
import com.influxdb.query.FluxTable;
@ -21,6 +22,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@ -86,9 +88,12 @@ public class InspectionSheetController {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
inspectionSheetService.save(dto);
//inspectionSheetService.save(dto);
InspectionSheet inspectionSheet = new InspectionSheet();
BeanUtils.copyProperties(dto, inspectionSheet);
inspectionSheetService.insert(inspectionSheet);
return new Result<Long>().ok(dto.getId());
return new Result<Long>().ok(inspectionSheet.getId());
}
@PutMapping