diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/util/PageBuilder.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/util/PageBuilder.java index 4c7b658e..115c4505 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/util/PageBuilder.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/util/PageBuilder.java @@ -54,7 +54,7 @@ public class PageBuilder { Map sortMap = pageRequest.getSortMap(); if (CollUtil.isNotEmpty(sortMap)){ sortMap.forEach((k,v) -> { - orders.add(new Order(Direction.ASC, k)); + orders.add(new Order(Direction.fromString("desc"), k)); }); } return orders; diff --git a/iot-common/iot-script-engine/src/main/java/cc/iotkit/script/JavaScriptEngine.java b/iot-common/iot-script-engine/src/main/java/cc/iotkit/script/JavaScriptEngine.java index 681c7ff2..15c892b7 100644 --- a/iot-common/iot-script-engine/src/main/java/cc/iotkit/script/JavaScriptEngine.java +++ b/iot-common/iot-script-engine/src/main/java/cc/iotkit/script/JavaScriptEngine.java @@ -52,19 +52,13 @@ public class JavaScriptEngine implements IScriptEngine { public T invokeMethod(TypeReference type, String methodName, Object... args) { Value member = jsScript.getMember("invoke"); - StringBuilder sbArgs = new StringBuilder("["); - //将入参转成json - for (int i = 0; i < args.length; i++) { - args[i] = JsonUtils.toJsonString(args[i]); - sbArgs.append(i == args.length - 1 ? "," : "").append(args[i]); - } - sbArgs.append("]"); + StringBuilder sbArgs = formatArgs(args); //通过调用invoke方法将目标方法返回结果转成json Value rst = member.execute(methodName, args); String json = rst.asString(); - log.info("invoke script {},args:{}, result:{}", methodName, sbArgs, json); + log.info("invoke script={}, args={}, result={}", methodName, sbArgs, json); //没有返回值 if (json == null || "null".equals(json)) { @@ -74,4 +68,15 @@ public class JavaScriptEngine implements IScriptEngine { return JsonUtils.parseObject(json, type); } + private static StringBuilder formatArgs(Object[] args) { + StringBuilder sbArgs = new StringBuilder("["); + //将入参转成json + for (int i = 0; i < args.length; i++) { + args[i] = JsonUtils.toJsonString(args[i]); + sbArgs.append(args[i]).append(i != args.length - 1 ? "," : ""); + } + sbArgs.append("]"); + return sbArgs; + } + } \ No newline at end of file diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/vo/ruleinfo/RuleLogVo.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/vo/ruleinfo/RuleLogVo.java index 23098668..424e402f 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/vo/ruleinfo/RuleLogVo.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/vo/ruleinfo/RuleLogVo.java @@ -1,6 +1,6 @@ package cc.iotkit.manager.dto.vo.ruleinfo; -import cc.iotkit.model.rule.RuleInfo; +import cc.iotkit.model.rule.RuleLog; import io.github.linpeilie.annotations.AutoMapper; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -10,27 +10,23 @@ import java.io.Serializable; @ApiModel(value = "RuleLogVo") @Data -@AutoMapper(target = RuleInfo.class) +@AutoMapper(target = RuleLog.class) public class RuleLogVo implements Serializable { private static final long serialVersionUID = -1L; @ApiModelProperty(value = "时间") - private Long time; + private Long logAt; @ApiModelProperty(value = "规则id") - private String ruleId; @ApiModelProperty(value = "状态") - - private String state1; + private String state; @ApiModelProperty(value = "内容") - private String content; @ApiModelProperty(value = "是否成功") - private Boolean success; }