|
@@ -1,15 +1,25 @@
|
|
|
package com.github.zuihou.business.controller.productionReadyCenter;
|
|
|
|
|
|
-import com.github.zuihou.base.controller.QueryController;
|
|
|
-import com.github.zuihou.base.controller.SuperSimpleController;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.github.zuihou.base.R;
|
|
|
+import com.github.zuihou.base.controller.*;
|
|
|
+import com.github.zuihou.base.request.PageParams;
|
|
|
import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.AAutoNodeLogService;
|
|
|
+import com.github.zuihou.common.util.DateUtil;
|
|
|
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
|
+import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
|
|
|
import com.github.zuihou.log.annotation.SysLog;
|
|
|
import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -24,11 +34,32 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@Slf4j
|
|
|
@Validated
|
|
|
@RestController
|
|
|
-@RequestMapping("/autoNodeLog")
|
|
|
-@Api(value = "autoNodeLog", tags = "库存日志")
|
|
|
+@RequestMapping("/warnLog")
|
|
|
+@Api(value = "warnLog", tags = "报警日志")
|
|
|
@SysLog(enabled = true)
|
|
|
-public class WarnLogController extends SuperSimpleController<AAutoNodeLogService, AAutoNodeLog> implements QueryController<AAutoNodeLog, Long, AAutoNodeLog> {
|
|
|
+public class WarnLogController extends SuperSimpleController<AAutoNodeLogService, AAutoNodeLog> implements QueryController<AAutoNodeLog, Long, AAutoNodeLog>, SaveController<AAutoNodeLog, AAutoNodeLog>, DeleteController<AAutoNodeLog, Long>, UpdateController<AAutoNodeLog, AAutoNodeLog> {
|
|
|
+
|
|
|
+ //延时阈值约为10分钟
|
|
|
+ private final int TIMEOUT_THRESHOLD_SEC = -600;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void query(PageParams<AAutoNodeLog> params, IPage<AAutoNodeLog> page, Long defSize) {
|
|
|
+ QueryWrap<AAutoNodeLog> wrap = handlerWrapper(null, params);
|
|
|
+ LbqWrapper<AAutoNodeLog> wrapper = wrap.lambda();
|
|
|
+
|
|
|
+ wrapper.eq(AAutoNodeLog::getExeResult,"0").or(condition->condition.isNull(AAutoNodeLog::getExeResult).eq(AAutoNodeLog::getExeStatus,"2").lt(AAutoNodeLog::getStartTime, DateUtil.getAddSecondsTime(new Date(), TIMEOUT_THRESHOLD_SEC))).orderByDesc(AAutoNodeLog::getCreateTime);
|
|
|
+ baseService.pageList(page,wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R<AAutoNodeLog> handlerSave(AAutoNodeLog model) {
|
|
|
+ Boolean bean = baseService.save(model);
|
|
|
+ return (bean)?success(model) : fail("操作失败");
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ @ApiOperation(value = "修改状态", notes = "修改状态")
|
|
|
+ @GetMapping("/updateStatus")
|
|
|
+ public R<Boolean> updateStatus(@RequestParam(value="ids[]") List<Long> ids) {
|
|
|
+ return R.success(baseService.updateStatus(ids));
|
|
|
+ }
|
|
|
}
|