修改接口报错
This commit is contained in:
26
.gitignore
vendored
26
.gitignore
vendored
@@ -21,3 +21,29 @@
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
# 编译生成的文件
|
||||
target/
|
||||
*.class
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
# IDE 相关文件
|
||||
.idea/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
# 构建工具相关
|
||||
*.log
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
|
||||
# 具体的 target/classes 下的文件
|
||||
ruoyi-admin/target/classes/
|
||||
ruoyi-generator/target/classes/
|
||||
business/target/classes/
|
||||
|
||||
# Velocity 模板文件
|
||||
*.vm
|
||||
@@ -58,7 +58,7 @@ public class SteelGradeInfoController {
|
||||
queryWrapper.eq(StdAlloy::getGradeid, gradeid); // 只查询 gradeId 和 name 字段
|
||||
|
||||
// 查询 StdAlloy 数据
|
||||
StdAlloy stdAlloyList = steelGradeInfoService.getById(queryWrapper);
|
||||
StdAlloy stdAlloyList = steelGradeInfoService.getById(gradeid);
|
||||
|
||||
// 返回结果
|
||||
return R.ok(stdAlloyList);
|
||||
|
||||
@@ -1,36 +1,83 @@
|
||||
package com.fizz.business.domain;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class StdAlloy {
|
||||
|
||||
private Integer gradeid; // GRADEID
|
||||
private String name; // NAME
|
||||
private Integer origin; // ORIGIN
|
||||
private Float sigma0; // SIGMA0
|
||||
private Float firstSigma0; // FIRST_SIGMA0
|
||||
private Float initSigma; // INIT_SIGMA
|
||||
private Float ro; // RO
|
||||
private Integer classId; // CLASSID
|
||||
private Float a; // A
|
||||
private Float b; // B
|
||||
private Float c; // C
|
||||
private Float d; // D
|
||||
private Float kc0; // KC0
|
||||
private Float kc1; // KC1
|
||||
private Float kc2; // KC2
|
||||
private Float kc3; // KC3
|
||||
private Float kc4; // KC4
|
||||
private Float nu; // NU
|
||||
private Float e; // E
|
||||
private Float chal; // CHAL
|
||||
private Float temp0; // TEMP0
|
||||
private Float strength; // STRENGTH
|
||||
private Integer weldCode; // WELD_CODE
|
||||
private LocalDateTime insDate; // INSDATE
|
||||
@TableId("GRADEID")
|
||||
private Integer gradeid; // 对应数据库字段 GRADEID
|
||||
|
||||
@TableField("NAME")
|
||||
private String name; // 对应数据库字段 NAME
|
||||
|
||||
@TableField("ORIGIN")
|
||||
private Integer origin; // 对应数据库字段 ORIGIN
|
||||
|
||||
@TableField("SIGMA0")
|
||||
private Float sigma0; // 对应数据库字段 SIGMA0
|
||||
|
||||
@TableField("FIRST_SIGMA0")
|
||||
private Float firstSigma0; // 对应数据库字段 FIRST_SIGMA0
|
||||
|
||||
@TableField("INIT_SIGMA")
|
||||
private Float initSigma; // 对应数据库字段 INIT_SIGMA
|
||||
|
||||
@TableField("RO")
|
||||
private Float ro; // 对应数据库字段 RO
|
||||
|
||||
@TableField("CLASSID")
|
||||
private Integer classId; // 对应数据库字段 CLASSID
|
||||
|
||||
@TableField("A")
|
||||
private Float a; // 对应数据库字段 A
|
||||
|
||||
@TableField("B")
|
||||
private Float b; // 对应数据库字段 B
|
||||
|
||||
@TableField("C")
|
||||
private Float c; // 对应数据库字段 C
|
||||
|
||||
@TableField("D")
|
||||
private Float d; // 对应数据库字段 D
|
||||
|
||||
@TableField("KC0")
|
||||
private Float kc0; // 对应数据库字段 KC0
|
||||
|
||||
@TableField("KC1")
|
||||
private Float kc1; // 对应数据库字段 KC1
|
||||
|
||||
@TableField("KC2")
|
||||
private Float kc2; // 对应数据库字段 KC2
|
||||
|
||||
@TableField("KC3")
|
||||
private Float kc3; // 对应数据库字段 KC3
|
||||
|
||||
@TableField("KC4")
|
||||
private Float kc4; // 对应数据库字段 KC4
|
||||
|
||||
@TableField("NU")
|
||||
private Float nu; // 对应数据库字段 NU
|
||||
|
||||
@TableField("E")
|
||||
private Float e; // 对应数据库字段 E
|
||||
|
||||
@TableField("CHAL")
|
||||
private Float chal; // 对应数据库字段 CHAL
|
||||
|
||||
@TableField("TEMP0")
|
||||
private Float temp0; // 对应数据库字段 TEMP0
|
||||
|
||||
@TableField("STRENGTH")
|
||||
private Float strength; // 对应数据库字段 STRENGTH
|
||||
|
||||
@TableField("WELD_CODE")
|
||||
private Integer weldCode; // 对应数据库字段 WELD_CODE
|
||||
|
||||
@TableField("INSDATE")
|
||||
private LocalDateTime insDate; // 对应数据库字段 INSDATE
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -40,12 +41,15 @@ public class RedisCacheManager {
|
||||
RedisTemplate<String, SegmentDTO> segmentRedisTemplate;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("redisTemplateOfMatmap")
|
||||
RedisTemplate<String, MatmapDTO> matmapRedisTemplate;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("redisTemplateOfHead")
|
||||
RedisTemplate<String, CoilHeadDTO> headRedisTemplate;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("redisTemplateOfCoilPos")
|
||||
RedisTemplate<String, CoilPositionDTO> coilPosRedisTemplate;
|
||||
|
||||
@Autowired
|
||||
@@ -144,7 +148,39 @@ public class RedisCacheManager {
|
||||
}
|
||||
|
||||
public List<MatmapDTO> getMatmapList() {
|
||||
return matmapRedisTemplate.opsForList().range(COIL_MATMAP_LIST_KEY, 0, -1);
|
||||
List<MatmapDTO> rawList = matmapRedisTemplate.opsForList().range(COIL_MATMAP_LIST_KEY, 0, -1);
|
||||
if (rawList == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<MatmapDTO> result = new ArrayList<>();
|
||||
for (Object item : rawList) {
|
||||
if (item == null) {
|
||||
result.add(null);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 如果是LinkedHashMap,转换为MatmapDTO
|
||||
if (item instanceof java.util.LinkedHashMap) {
|
||||
try {
|
||||
MatmapDTO dto = BeanUtil.toBean((java.util.LinkedHashMap<?, ?>) item, MatmapDTO.class);
|
||||
result.add(dto);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to convert LinkedHashMap to MatmapDTO: {}", e.getMessage());
|
||||
result.add(null);
|
||||
}
|
||||
}
|
||||
// 如果已经是MatmapDTO,直接添加
|
||||
else if (item instanceof MatmapDTO) {
|
||||
result.add((MatmapDTO) item);
|
||||
}
|
||||
else {
|
||||
log.warn("Unexpected type in Redis list: {}", item.getClass().getName());
|
||||
result.add(null);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setMatmap(int index, MatmapDTO matmap) {
|
||||
@@ -152,7 +188,28 @@ public class RedisCacheManager {
|
||||
}
|
||||
|
||||
public MatmapDTO getMatmap(int index) {
|
||||
return matmapRedisTemplate.opsForList().index(COIL_MATMAP_LIST_KEY, index);
|
||||
Object result = matmapRedisTemplate.opsForList().index(COIL_MATMAP_LIST_KEY, index);
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 如果是LinkedHashMap,转换为MatmapDTO
|
||||
if (result instanceof java.util.LinkedHashMap) {
|
||||
try {
|
||||
return BeanUtil.toBean((java.util.LinkedHashMap<?, ?>) result, MatmapDTO.class);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to convert LinkedHashMap to MatmapDTO: {}", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果已经是MatmapDTO,直接返回
|
||||
if (result instanceof MatmapDTO) {
|
||||
return (MatmapDTO) result;
|
||||
}
|
||||
|
||||
log.warn("Unexpected type in Redis: {}", result.getClass().getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<CoilHeadDTO> getHeadList() {
|
||||
|
||||
@@ -154,9 +154,15 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
|
||||
|
||||
CrmPdiPlan pdiPlan = baseMapper.selectById(build.getId());
|
||||
|
||||
if (pdiPlan == null) {
|
||||
log.error("未找到ID为{}的计划记录", build.getId());
|
||||
return;
|
||||
}
|
||||
|
||||
pdiPlan.setStatus(build.getOperation());
|
||||
baseMapper.updateById(pdiPlan);
|
||||
|
||||
|
||||
log.info("计划状态更新成功,ID: {}, 新状态: {}", build.getId(), build.getOperation());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -65,18 +66,45 @@ public class TrackServiceImpl implements TrackService {
|
||||
public ReturnInfoVO getReturnInfo(int posIdx) {
|
||||
MatmapDTO matmap = MatmapUtil.getMatmap(posIdx);
|
||||
if (MatmapUtil.notReady(matmap)) {
|
||||
log.warn("Matmap not ready for position index: {}", posIdx);
|
||||
return ReturnInfoVO.builder()
|
||||
.returnWeight(0.0)
|
||||
.returnType(null)
|
||||
.entryMatId(null)
|
||||
.planId(null)
|
||||
.build();
|
||||
}
|
||||
|
||||
CrmPdiPlanVO planVO = crmPdiPlanService.getByCoilIdAndOperId(matmap.getPlanId());
|
||||
if (planVO == null) {
|
||||
log.warn("Plan not found for planId: {}", matmap.getPlanId());
|
||||
return ReturnInfoVO.builder()
|
||||
.returnWeight(0.0)
|
||||
.returnType(null)
|
||||
.entryMatId(matmap.getMatId())
|
||||
.planId(Long.valueOf(matmap.getPlanId()))
|
||||
.build();
|
||||
}
|
||||
|
||||
String returnType = null;
|
||||
double returnWt = 0;
|
||||
if (Objects.equals(planVO.getStatus(), PlanStatusEnum.PRODUCING.name())) {
|
||||
double coiledLength = redisCacheManager.getStripLocation();
|
||||
double calcCoilWeight = CalcUtil.calcCoilWeight(coiledLength, planVO.getEntryThick(), planVO.getEntryWidth());
|
||||
if (planVO.getEntryWeight() != null && calcCoilWeight > 0) {
|
||||
returnWt = planVO.getEntryWeight().divide(BigDecimal.valueOf(calcCoilWeight)).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
} else {
|
||||
log.warn("Invalid entry weight or calc coil weight: entryWeight={}, calcCoilWeight={}", planVO.getEntryWeight(), calcCoilWeight);
|
||||
returnWt = 0.0;
|
||||
}
|
||||
returnType = HALF_RETURN.name();
|
||||
} else if (Objects.equals(planVO.getStatus(), PlanStatusEnum.ONLINE.name())) {
|
||||
if (planVO.getEntryWeight() != null) {
|
||||
returnWt = planVO.getEntryWeight().doubleValue();
|
||||
} else {
|
||||
log.warn("Entry weight is null for planId: {}", planVO.getId());
|
||||
returnWt = 0.0;
|
||||
}
|
||||
returnType = ALL_RETURN.name();
|
||||
} else {
|
||||
log.error("invalid plan status[{}], planId={}", planVO.getStatus(), planVO.getId());
|
||||
@@ -133,6 +161,13 @@ public class TrackServiceImpl implements TrackService {
|
||||
Integer currPosIdx = currDevice.getIdx();
|
||||
MatmapDTO target = MatmapUtil.getMatmap(targetPosIdx);
|
||||
MatmapDTO curr = MatmapUtil.getMatmap(currPosIdx);
|
||||
|
||||
if (curr == null || target == null) {
|
||||
log.warn("Matmap is null - curr: {}, target: {}, currPosIdx: {}, targetPosIdx: {}",
|
||||
curr, target, currPosIdx, targetPosIdx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Objects.equals(curr.getMatId(), target.getMatId())) {
|
||||
return;
|
||||
}
|
||||
@@ -208,9 +243,18 @@ public class TrackServiceImpl implements TrackService {
|
||||
@Override
|
||||
public CoilPositionDTO getCoilPosition() {
|
||||
CoilPositionDTO position = redisCacheManager.getCoilPosition();
|
||||
List<MatmapDTO> matmapList = redisCacheManager.getMatmapList();
|
||||
position.setMatMapList(matmapList);
|
||||
if (position == null) {
|
||||
log.warn("CoilPosition not found in Redis, creating empty position");
|
||||
position = new CoilPositionDTO();
|
||||
}
|
||||
|
||||
List<MatmapDTO> matmapList = redisCacheManager.getMatmapList();
|
||||
if (matmapList == null) {
|
||||
log.warn("MatmapList not found in Redis, using empty list");
|
||||
matmapList = new ArrayList<>();
|
||||
}
|
||||
|
||||
position.setMatMapList(matmapList);
|
||||
return position;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,15 +78,15 @@ spring:
|
||||
# password: KeLunPu123!
|
||||
password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
timeout: 20s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
min-idle: 2
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
max-idle: 10
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
max-active: 20
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
|
||||
|
||||
@@ -1,198 +0,0 @@
|
||||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: Fizz
|
||||
# 版本 3.8.8
|
||||
version: 1.0.0
|
||||
# 版权年份
|
||||
copyrightYear: 2024
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: D:/ruoyi/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8089
|
||||
forward-headers-strategy: framework
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# 连接数满后的排队数,默认为100
|
||||
accept-count: 1000
|
||||
threads:
|
||||
# tomcat最大线程数,默认为200
|
||||
max: 800
|
||||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ruoyi: debug
|
||||
org.springframework: warn
|
||||
|
||||
# 用户配置
|
||||
user:
|
||||
password:
|
||||
# 密码最大错误次数
|
||||
maxRetryCount: 5
|
||||
# 密码锁定时间(默认10分钟)
|
||||
lockTime: 10
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: druid
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 10MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 20MB
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码 abcd1234 fe2b3cef78b74d3692909bdcbdf46331 KeLunPu123!
|
||||
# password: KeLunPu123!
|
||||
password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
|
||||
rabbitmq:
|
||||
username: admin
|
||||
password: admin
|
||||
virtual-host: /
|
||||
host: 127.0.0.1
|
||||
port: 5672
|
||||
listener:
|
||||
simple:
|
||||
retry:
|
||||
enabled: true
|
||||
max-attempts: 1
|
||||
max-interval: 200
|
||||
task:
|
||||
scheduling:
|
||||
pool:
|
||||
size: 8 #配置Scheduled定时任务为多线程
|
||||
|
||||
# token配置
|
||||
token:
|
||||
# 令牌自定义标识
|
||||
header: Authorization
|
||||
# 令牌密钥
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 30
|
||||
|
||||
# MyBatis
|
||||
mybatis-plus:
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: com.ruoyi.**.domain,com.fizz.**.domain
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# 加载全局的配置文件
|
||||
configLocation: classpath:mybatis/mybatis-config.xml
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: mysql
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
# 过滤开关
|
||||
enabled: true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
excludes: /system/notice
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
#rocketmq:
|
||||
#name-server: 127.0.0.1:9876
|
||||
#producer:
|
||||
#group: test
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
path: /v3/api-docs
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
path: /swagger-ui.html
|
||||
tags-sorter: alpha
|
||||
group-configs:
|
||||
- group: 'default'
|
||||
display-name: 'default'
|
||||
paths-to-match: '/api/**'
|
||||
packages-to-scan: com.fizz.business.controller
|
||||
|
||||
|
||||
knife4j:
|
||||
enable: true # 启用 Knife4j
|
||||
setting:
|
||||
language: zh-CN # 中文界面
|
||||
enable-swagger-model: true # 显示模型
|
||||
enable-document-manage: true # 启用文档管理
|
||||
cors: true # 允许跨域
|
||||
|
||||
kangaroohy:
|
||||
milo:
|
||||
enabled: false
|
||||
primary: default
|
||||
config:
|
||||
default:
|
||||
endpoint: opc.tcp://127.0.0.1:49320
|
||||
security-policy: none
|
||||
pool:
|
||||
max-idle: 5
|
||||
max-total: 20
|
||||
min-idle: 2
|
||||
initial-size: 3
|
||||
|
||||
|
||||
#kangaroohy:
|
||||
# milo:
|
||||
# primary: default
|
||||
# config:
|
||||
# default:
|
||||
# endpoint: opc.tcp://127.0.0.1:49320
|
||||
# security-policy: basic256sha256
|
||||
# username: OPCUA
|
||||
# password: 123456
|
||||
# test:
|
||||
# endpoint: opc.tcp://127.0.0.1:49321
|
||||
# security-policy: basic256sha256
|
||||
# username: OPCUA
|
||||
# password: 123456
|
||||
@@ -158,7 +158,7 @@ public class Constants
|
||||
/**
|
||||
* 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全)
|
||||
*/
|
||||
public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.ruoyi" };
|
||||
public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.ruoyi", "com.fizz" };
|
||||
|
||||
/**
|
||||
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
|
||||
|
||||
Reference in New Issue
Block a user