fix:消息
This commit is contained in:
@@ -24,4 +24,9 @@ public class SendMsgReq {
|
||||
* 是否发送cid消息
|
||||
*/
|
||||
private boolean sendCid = true;
|
||||
|
||||
// 即时通发送人工号
|
||||
private String sendJobNo;
|
||||
// 即时通接收人工号
|
||||
private String receiveJobNo;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.sdm.common.entity.resp.task;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -56,6 +57,7 @@ public class PerformanceResp {
|
||||
|
||||
private String tenantId;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private Long creator;
|
||||
|
||||
64
project/get_curve_params.py
Normal file
64
project/get_curve_params.py
Normal 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)
|
||||
@@ -21,7 +21,20 @@ public class CurveParamDto {
|
||||
@Schema(description = "最小值")
|
||||
private Double min;
|
||||
|
||||
@JsonProperty("unit")
|
||||
@Schema(description = "单位")
|
||||
private String unit;
|
||||
@JsonProperty("xUnit")
|
||||
@Schema(description = "x轴单位")
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
@@ -45,6 +45,21 @@ public class LyricMessageSender implements IMessageSender {
|
||||
// 1、先调用基础发送
|
||||
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、异步发送即时通消息通知
|
||||
CompletableFuture.runAsync(() -> {
|
||||
sendMsgToFreelink(req);
|
||||
@@ -53,21 +68,11 @@ public class LyricMessageSender implements IMessageSender {
|
||||
|
||||
private void sendMsgToFreelink(SendMsgReq req) {
|
||||
FreelinkAndDingdingInformReq param = new FreelinkAndDingdingInformReq();
|
||||
// 根据userId查询工号
|
||||
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());
|
||||
}
|
||||
param.setJobNo(req.getSendJobNo());
|
||||
|
||||
FreeLinkMsg freeLinkMsg = new FreeLinkMsg();
|
||||
if (switchFlag.equals("true")) {
|
||||
userReq.setUserId(Long.valueOf(req.getUserId()));
|
||||
SdmResponse<CIDUserResp> response = sysUserFeignClient.queryUserDetail(userReq);
|
||||
if (response.getData() != null) {
|
||||
freeLinkMsg.setId(response.getData().getUsername());
|
||||
}
|
||||
freeLinkMsg.setId(req.getReceiveJobNo());
|
||||
} else {
|
||||
freeLinkMsg.setId(sendUserId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user