commit
8a4f0094a1
@ -1,6 +1,7 @@
|
||||
package com.cnbm.processInspection.controller;
|
||||
|
||||
import com.cnbm.admin.annotation.LogOperation;
|
||||
import com.cnbm.basic.dto.ProductFeaturesDTO;
|
||||
import com.cnbm.common.constant.Constant;
|
||||
import com.cnbm.common.page.PageData;
|
||||
import com.cnbm.common.utils.ExcelUtils;
|
||||
@ -11,6 +12,7 @@ import com.cnbm.common.validator.group.AddGroup;
|
||||
import com.cnbm.common.validator.group.DefaultGroup;
|
||||
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.excel.InspectionSheetExcel;
|
||||
import com.cnbm.processInspection.service.IInspectionSheetService;
|
||||
@ -154,4 +156,13 @@ public class InspectionSheetController {
|
||||
return inspectionSheetService.getFluxParamList(params);
|
||||
}
|
||||
|
||||
@PutMapping("saveFluxParamList")
|
||||
@ApiOperation("将样本检测参数写入influxdb")
|
||||
public Result saveFluxParamList(@RequestBody InspectionSampleDTO[] lists){
|
||||
|
||||
inspectionSheetService.saveFluxParamList(lists);
|
||||
|
||||
return new Result();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.cnbm.processInspection.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 检验样本 表
|
||||
*
|
||||
* @author yanyang
|
||||
* @since 2022-11-24
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "检验样本 DTO对象")
|
||||
public class InspectionSampleDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "工序名称,关联working_procedure表")
|
||||
private String workingProcedureName;
|
||||
|
||||
@ApiModelProperty(value = "检验单id")
|
||||
private String inspectionSheetId;
|
||||
|
||||
}
|
@ -3,6 +3,7 @@ package com.cnbm.processInspection.service;
|
||||
import com.cnbm.common.page.PageData;
|
||||
import com.cnbm.common.service.CrudService;
|
||||
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.influxdb.query.FluxTable;
|
||||
@ -32,4 +33,6 @@ public interface IInspectionSheetService extends CrudService<InspectionSheet, In
|
||||
|
||||
List<FluxTable> getFluxParamList(Map<String, Object> params);
|
||||
|
||||
void saveFluxParamList(InspectionSampleDTO[] lists);
|
||||
|
||||
}
|
@ -3,6 +3,8 @@ package com.cnbm.processInspection.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.cnbm.basic.dto.ProductFactoryRelationDTO;
|
||||
import com.cnbm.basic.dto.ProductFeaturesDTO;
|
||||
import com.cnbm.basic.entity.Machine;
|
||||
import com.cnbm.basic.entity.Product;
|
||||
import com.cnbm.basic.entity.Shift;
|
||||
@ -14,25 +16,30 @@ import com.cnbm.basic.service.impl.WorkingProcedureServiceImpl;
|
||||
import com.cnbm.common.page.PageData;
|
||||
import com.cnbm.common.service.impl.CrudServiceImpl;
|
||||
import com.cnbm.common.utils.ConvertUtils;
|
||||
import com.cnbm.common.validator.ValidatorUtils;
|
||||
import com.cnbm.common.validator.group.AddGroup;
|
||||
import com.cnbm.common.validator.group.DefaultGroup;
|
||||
import com.cnbm.influx.config.InfluxClient;
|
||||
import com.cnbm.influx.param.QueryDataParam;
|
||||
import com.cnbm.influx.param.Range;
|
||||
import com.cnbm.influx.template.Event;
|
||||
import com.cnbm.processInspection.dto.InspectionSampleDTO;
|
||||
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.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.influxdb.query.FluxTable;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 检验单 表
|
||||
@ -167,4 +174,27 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
|
||||
List<FluxTable> list = InfluxClient.Client.query(queryDataParam);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveFluxParamList(@RequestBody InspectionSampleDTO[] lists){
|
||||
for(InspectionSampleDTO dto:lists){
|
||||
String equipmentName = dto.getWorkingProcedureName();
|
||||
LocalDateTime eventTimestamp = LocalDateTime.now();
|
||||
Instant eventTime = eventTimestamp.toInstant(ZoneOffset.UTC);
|
||||
String inspectionSheetId =dto.getInspectionSheetId();
|
||||
// Event event = new Event(eventTime,inspectionSheetId,"ppExecName",ppExecName);
|
||||
// InfluxClient.Client.insert(event,equipmentName);
|
||||
}
|
||||
}
|
||||
|
||||
private Event newEvent(Instant time,String inspectionSheetId,String argName,Double argValue){
|
||||
Event event = new Event();
|
||||
event.setInspectionSheetId(inspectionSheetId);
|
||||
event.setTime(time);
|
||||
event.setArgName(argName);
|
||||
if(!Objects.equals(argValue, "") && argValue != null ){
|
||||
event.setArgValue(argValue);
|
||||
}
|
||||
return event;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user