feat():下发钢卷设定值请求到模型程序
This commit is contained in:
@@ -70,27 +70,26 @@ public class ModSetupResultServiceImpl extends ServiceImpl<ModSetupResultMapper,
|
|||||||
public String calcSetup(CalcPdiPlanForm form) {
|
public String calcSetup(CalcPdiPlanForm form) {
|
||||||
|
|
||||||
//发送MQ
|
//发送MQ
|
||||||
// MessageProperties props = MessagePropertiesBuilder.newInstance()
|
MessageProperties props = MessagePropertiesBuilder.newInstance()
|
||||||
// .setContentType(MessageProperties.CONTENT_TYPE_TEXT_PLAIN)
|
.setContentType(MessageProperties.CONTENT_TYPE_TEXT_PLAIN)
|
||||||
// .setMessageId("CALL_SETUP")
|
.setMessageId("CALL_SETUP")
|
||||||
// .build();
|
.build();
|
||||||
// rabbitTemplate.send(CommonConstants.RabbitMQ.SEND_MODEL,new Message(JSONUtil.toJsonStr(form).getBytes(StandardCharsets.UTF_8),props));
|
rabbitTemplate.send(CommonConstants.RabbitMQ.SEND_MODEL,new Message(JSONUtil.toJsonStr(form).getBytes(StandardCharsets.UTF_8),props));
|
||||||
|
|
||||||
// 获取当前时间的毫秒级时间戳
|
// 获取当前时间的毫秒级时间戳
|
||||||
long timestampMillis = LocalDateTime.now().atZone(ZoneOffset.UTC).toInstant().toEpochMilli();
|
long timestampMillis = LocalDateTime.now().atZone(ZoneOffset.UTC).toInstant().toEpochMilli();
|
||||||
|
|
||||||
// 生成字符串:由 coilid 和当前时间戳拼接而成
|
// 生成字符串:由 coilid 和当前时间戳拼接而成
|
||||||
String resultString = form.getCoilid() + timestampMillis;
|
|
||||||
|
|
||||||
// 先返回构建的字符串
|
// 先返回构建的字符串
|
||||||
// 这里是返回值先返回,后面调用副作用的逻辑
|
// 这里是返回值先返回,后面调用副作用的逻辑
|
||||||
|
|
||||||
// 然后调用mockCalcResult方法,它是异步的,不会影响返回值
|
// 然后调用mockCalcResult方法,它是异步的,不会影响返回值
|
||||||
// mockCalcResult将会在返回之后执行,不影响calcSetup的返回
|
// mockCalcResult将会在返回之后执行,不影响calcSetup的返回
|
||||||
new Thread(() -> mockCalcResult(form.getCoilid(), resultString)).start();
|
// new Thread(() -> mockCalcResult(form.getCoilid(), resultString)).start();
|
||||||
|
|
||||||
// 返回值会先返回给调用者
|
// 返回值会先返回给调用者
|
||||||
return resultString;
|
return form.getCoilid() + timestampMillis;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mockCalcResult(String coilid, String string) {
|
private void mockCalcResult(String coilid, String string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user