Showing
1 changed file
with
7 additions
and
2 deletions
... | ... | @@ -19,7 +19,6 @@ import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidatio |
19 | 19 | import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; |
20 | 20 | import org.thingsboard.server.common.data.yunteng.dto.convert.ConvertConfigDTO; |
21 | 21 | import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; |
22 | -import org.thingsboard.server.common.data.yunteng.dto.convert.DatasourceContentDTO; | |
23 | 22 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
24 | 23 | import org.thingsboard.server.dao.yunteng.ConvertConfig; |
25 | 24 | import org.thingsboard.server.dao.yunteng.mapper.ConvertConfigMapper; |
... | ... | @@ -405,7 +404,13 @@ public class TkConvertConfigServiceImpl |
405 | 404 | Map<String, String> scriptMap = new HashMap<>(); |
406 | 405 | scriptMap.put( |
407 | 406 | "jsScript", |
408 | - "msg.deviceId = metadata.deviceId;\nmsg.deviceName = metadata.deviceName;\nmsg.deviceType = metadata.deviceType;\nmsg.ts = metadata.ts;\nreturn {msg: msg, metadata: metadata, msgType: msgType};"); | |
407 | + "msg.deviceId = metadata.deviceId;\n" | |
408 | + + "msg.deviceName = metadata.deviceName;\n" | |
409 | + + "msg.deviceType = metadata.deviceType;\n" | |
410 | + + "if(msg.ts !=null){\n" | |
411 | + + " msg.ts = metadata.ts;\n" | |
412 | + + "}\n" | |
413 | + + "return {msg: msg, metadata: metadata, msgType: msgType};"); | |
409 | 414 | types.put(scriptType, JacksonUtil.toString(scriptMap)); |
410 | 415 | scriptIndex = addOriginatorFieldsAndScript(types, ruleChainMetaData, seriesIndex); |
411 | 416 | } | ... | ... |