feat(): 补充历史曲线查询接口
This commit is contained in:
@@ -26,7 +26,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static com.fizz.business.service.manager.OpcMessageIdsManager.*;
|
||||
|
||||
@Component
|
||||
//@Component
|
||||
@Slf4j
|
||||
public class MessageSubscriptionRunner implements ApplicationRunner {
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.fizz.business.controller;
|
||||
|
||||
|
||||
import com.fizz.business.service.impl.SegmentService;
|
||||
import com.fizz.business.vo.SegmentParamVO;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name ="历史曲线查询接口")
|
||||
@RestController
|
||||
@RequestMapping("/api/segment")
|
||||
@Anonymous
|
||||
public class SegmentController {
|
||||
|
||||
|
||||
@Resource
|
||||
SegmentService segmentService;
|
||||
|
||||
@GetMapping("/getSegmentHistory")
|
||||
@Operation(summary ="根据钢卷号和参数查询历史曲线")
|
||||
public R<List<SegmentParamVO>> queryParamByEnCoilId(String enCoilID, String paramField) {
|
||||
if (enCoilID == null || paramField == null) {
|
||||
return R.fail("参数不能为空");
|
||||
}
|
||||
return R.ok(segmentService.queryParamByEnCoilId(enCoilID, paramField),"查询历史曲线成功");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class SteelGradeInfoController {
|
||||
private SteelGradeInfoService steelGradeInfoService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary ="查询钢种列表")
|
||||
@Operation(summary = "查询钢种列表")
|
||||
public R<List<StdAlloyVO>> list() {
|
||||
|
||||
// 使用 LambdaQueryWrapper 查询 StdAlloy 表中的数据
|
||||
|
||||
@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fizz.business.domain.PdoStripvalue;
|
||||
import com.fizz.business.domain.Segment;
|
||||
import com.fizz.business.dto.SegmentDTO;
|
||||
import com.fizz.business.vo.SegmentParamVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 各机张力,电流等架跟踪表 Mapper 接口
|
||||
@@ -21,4 +24,8 @@ public interface SegmentMapper extends BaseMapper<SegmentDTO> {
|
||||
PdoStripvalue getStripValue(@Param("entryMatId") String entryMatId, @Param("startPos") double startPos, @Param("endPos") double endPos);
|
||||
|
||||
Segment getLatestRecord();
|
||||
|
||||
List<SegmentParamVO> queryParamByEnCoilId(@Param("enCoilID") String enCoilID,
|
||||
@Param("paramField") String paramField);
|
||||
|
||||
}
|
||||
|
||||
@@ -5,11 +5,13 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fizz.business.dto.SegmentDTO;
|
||||
import com.fizz.business.mapper.SegmentMapper;
|
||||
import com.fizz.business.vo.SegmentParamVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@@ -58,4 +60,12 @@ public class SegmentService {
|
||||
|
||||
System.out.println("段数据保存成功。钢卷号: " + segment.getEnCoilID() + ", 段号: " + segment.getSegNo());
|
||||
}
|
||||
|
||||
public List<SegmentParamVO> queryParamByEnCoilId(String enCoilID, String paramField) {
|
||||
if (enCoilID == null || paramField == null) {
|
||||
throw new IllegalArgumentException("参数不能为空");
|
||||
}
|
||||
return segmentMapper.queryParamByEnCoilId(enCoilID, paramField);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import com.fizz.business.service.TrackService;
|
||||
import com.fizz.business.service.impl.SegmentService;
|
||||
import com.fizz.business.utils.MatmapUtil;
|
||||
import com.fizz.business.utils.WebSocketUtil;
|
||||
import com.fizz.business.vo.SegmentParamVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
@@ -151,7 +152,7 @@ public class SegmentTrackerService {
|
||||
}
|
||||
}
|
||||
|
||||
// 出厂判断
|
||||
|
||||
double exitPlantPos = stripPositionService.calculate(DeviceEnum.TR, celLength, cxlLength);
|
||||
if (segment.getTailPos().compareTo(BigDecimal.valueOf(exitPlantPos)) >= 0) {
|
||||
System.out.println("钢卷 " + segment.getEnCoilID() + " 的段号 " + segment.getSegNo() + " 已离开产线,开始持久化数据。");
|
||||
@@ -306,4 +307,6 @@ public class SegmentTrackerService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.fizz.business.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class SegmentParamVO {
|
||||
private Integer segNo;
|
||||
private BigDecimal value;
|
||||
}
|
||||
@@ -61,4 +61,13 @@
|
||||
<select id="getLatestRecord" resultType="com.fizz.business.domain.Segment">
|
||||
SELECT * FROM cpg_segment where id=(SELECT max(id) FROM cpg_segment)
|
||||
</select>
|
||||
|
||||
<select id="queryParamByEnCoilId" resultType="com.fizz.business.vo.SegmentParamVO">
|
||||
SELECT seg_no AS segNo,
|
||||
JSON_UNQUOTE(JSON_EXTRACT(total_values_json, CONCAT('$.', #{paramField}, '_avg'))) AS value
|
||||
FROM cpl_segment_total
|
||||
WHERE en_coil_id = #{enCoilID}
|
||||
ORDER BY seg_no
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user