fix:消息

This commit is contained in:
2026-01-09 14:05:56 +08:00
parent 8e94a46640
commit fc007fd0d8
5 changed files with 105 additions and 16 deletions

View File

@@ -24,4 +24,9 @@ public class SendMsgReq {
* 是否发送cid消息 * 是否发送cid消息
*/ */
private boolean sendCid = true; private boolean sendCid = true;
// 即时通发送人工号
private String sendJobNo;
// 即时通接收人工号
private String receiveJobNo;
} }

View File

@@ -1,6 +1,7 @@
package com.sdm.common.entity.resp.task; package com.sdm.common.entity.resp.task;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -56,6 +57,7 @@ public class PerformanceResp {
private String tenantId; private String tenantId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime; private LocalDateTime createTime;
private Long creator; private Long creator;

View File

@@ -0,0 +1,64 @@
import os
import re
import sys
import json
# def is_number(str):
# try:
# float(str)
# return True
# except ValueError:
# return False
def is_number(string):
""" 判断字符串是否为数字类型 """
pattern = re.compile(r'^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$')
return bool(pattern.match(string))
def get_curve_unit(string):
xUnit = ''
yUnit = ''
xPhysics = ''
yPhysics = ''
try:
unit_dict = json.loads(string)
xUnit = unit_dict.get('xUnit')
yUnit = unit_dict.get('yUnit')
xPhysics = unit_dict.get('xPhysics')
yPhysics = unit_dict.get('yPhysics')
except:
pass
return xUnit, yUnit, xPhysics, yPhysics
def get_curve_params(curvePath, decimal):
""" 获取曲线文件最大最小值 """
valueList = []
with open(curvePath, 'r+', encoding='utf-8') as fr:
lines = fr.readlines()
for line in lines:
if line.__contains__(','):
yValue = line.split(',')[1]
if(is_number(yValue)):
valueList.append(float(yValue))
maxValue = round(max(valueList), decimal)
minValue = round(min(valueList), decimal)
xUnit, yUnit, xPhysics, yPhysics = get_curve_unit(lines[0])
curve_params = {"max":maxValue, "min":minValue, "xUnit":xUnit, "yUnit":yUnit, "xPhysics":xPhysics, "yPhysics":yPhysics}
print(json.dumps(curve_params, ensure_ascii=False))
if __name__=='__main__':
# 曲线文件路径
curvePath = sys.argv[1]
# 保留小数点位数
try:
decimal = int(sys.argv[2])
except:
decimal = 3
get_curve_params(curvePath, decimal)

View File

@@ -21,7 +21,20 @@ public class CurveParamDto {
@Schema(description = "最小值") @Schema(description = "最小值")
private Double min; private Double min;
@JsonProperty("unit") @JsonProperty("xUnit")
@Schema(description = "单位") @Schema(description = "x轴单位")
private String unit; private String xUnit;
@JsonProperty("xPhysics")
@Schema(description = "x轴物理量")
private String xPhysics;
@JsonProperty("yUnit")
@Schema(description = "y轴单位")
private String yUnit;
@JsonProperty("yPhysics")
@Schema(description = "y轴物理量")
private String yPhysics;
} }

View File

@@ -45,6 +45,21 @@ public class LyricMessageSender implements IMessageSender {
// 1、先调用基础发送 // 1、先调用基础发送
basicSender.send(req); basicSender.send(req);
// 根据userId查询发送人工号
UserQueryReq userReq = new UserQueryReq();
userReq.setUserId(ThreadLocalContext.getUserId());
userReq.setTenantId(ThreadLocalContext.getTenantId());
SdmResponse<CIDUserResp> sdmResponse = sysUserFeignClient.queryUserDetail(userReq);
if (sdmResponse.getData() != null) {
req.setSendJobNo(sdmResponse.getData().getUsername());
}
// 根据userId查询接收人工号
userReq.setUserId(Long.valueOf(req.getUserId()));
SdmResponse<CIDUserResp> response = sysUserFeignClient.queryUserDetail(userReq);
if (response.getData() != null) {
req.setReceiveJobNo(response.getData().getUsername());
}
// 2、异步发送即时通消息通知 // 2、异步发送即时通消息通知
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
sendMsgToFreelink(req); sendMsgToFreelink(req);
@@ -53,21 +68,11 @@ public class LyricMessageSender implements IMessageSender {
private void sendMsgToFreelink(SendMsgReq req) { private void sendMsgToFreelink(SendMsgReq req) {
FreelinkAndDingdingInformReq param = new FreelinkAndDingdingInformReq(); FreelinkAndDingdingInformReq param = new FreelinkAndDingdingInformReq();
// 根据userId查询工号 param.setJobNo(req.getSendJobNo());
UserQueryReq userReq = new UserQueryReq();
userReq.setUserId(ThreadLocalContext.getUserId());
userReq.setTenantId(ThreadLocalContext.getTenantId());
SdmResponse<CIDUserResp> sdmResponse = sysUserFeignClient.queryUserDetail(userReq);
if (sdmResponse.getData() != null) {
param.setJobNo(sdmResponse.getData().getUsername());
}
FreeLinkMsg freeLinkMsg = new FreeLinkMsg(); FreeLinkMsg freeLinkMsg = new FreeLinkMsg();
if (switchFlag.equals("true")) { if (switchFlag.equals("true")) {
userReq.setUserId(Long.valueOf(req.getUserId())); freeLinkMsg.setId(req.getReceiveJobNo());
SdmResponse<CIDUserResp> response = sysUserFeignClient.queryUserDetail(userReq);
if (response.getData() != null) {
freeLinkMsg.setId(response.getData().getUsername());
}
} else { } else {
freeLinkMsg.setId(sendUserId); freeLinkMsg.setId(sendUserId);
} }