From 46168fbb7c925b0ec04def176095e967720e684a Mon Sep 17 00:00:00 2001
From: chen.llin <1442464845@qq.comm>
Date: 星期五, 16 一月 2026 15:22:07 +0800
Subject: [PATCH] agv查询修复
---
src/main/java/com/zy/asrs/controller/TaskLogController.java | 78 ++++++++++++++++++++++++--------------
1 files changed, 49 insertions(+), 29 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/TaskLogController.java b/src/main/java/com/zy/asrs/controller/TaskLogController.java
index 1c642ba..440c4ee 100644
--- a/src/main/java/com/zy/asrs/controller/TaskLogController.java
+++ b/src/main/java/com/zy/asrs/controller/TaskLogController.java
@@ -1,23 +1,27 @@
package com.zy.asrs.controller;
-import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
-import com.core.common.DateUtils;
-import com.zy.asrs.entity.TaskLog;
-import com.zy.asrs.service.TaskLogService;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
+import com.core.common.DateUtils;
import com.core.common.R;
+import com.zy.asrs.entity.TaskLog;
+import com.zy.asrs.service.TaskLogService;
import com.zy.common.web.BaseController;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+@Slf4j
@RestController
public class TaskLogController extends BaseController {
@@ -32,24 +36,40 @@
@RequestMapping(value = "/taskLog/list/auth")
@ManagerAuth
- public R list(@RequestParam(defaultValue = "1")Integer curr,
- @RequestParam(defaultValue = "10")Integer limit,
- @RequestParam(required = false)String orderByField,
- @RequestParam(required = false)String orderByType,
- @RequestParam(required = false)String condition,
- @RequestParam Map<String, Object> param){
- EntityWrapper<TaskLog> wrapper = new EntityWrapper<>();
- excludeTrash(param);
- convert(param, wrapper);
- allLike(TaskLog.class, param.keySet(), wrapper, condition);
- if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
- return R.ok(taskLogService.selectPage(new Page<>(curr, limit), wrapper));
+ public R list(@RequestParam(defaultValue = "1") Integer curr,
+ @RequestParam(defaultValue = "10") Integer limit,
+ @RequestParam(required = false) String orderByField,
+ @RequestParam(required = false) String orderByType,
+ @RequestParam(required = false) String condition,
+ @RequestParam Map<String, Object> param) {
+ try {
+ log.info("TaskLog鏌ヨ璇锋眰锛屽弬鏁帮細curr={}, limit={}, param={}", curr, limit, param);
+ EntityWrapper<TaskLog> wrapper = new EntityWrapper<>();
+ excludeTrash(param);
+ convert(param, wrapper);
+ allLike(TaskLog.class, param.keySet(), wrapper, condition);
+ if (!Cools.isEmpty(orderByField)) {
+ wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
+ }
+ wrapper.orderBy("appe_time",false);
+ Page<TaskLog> page = taskLogService.selectPage(new Page<>(curr, limit), wrapper);
+ log.info("TaskLog鏌ヨ鎴愬姛锛岃繑鍥瀧}鏉¤褰�", page.getRecords().size());
+ return R.ok(page);
+ } catch (Exception e) {
+ log.error("TaskLog鏌ヨ澶辫触", e);
+ e.printStackTrace();
+ return R.error("鏌ヨ澶辫触锛�" + e.getMessage());
+ }
}
- private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
- for (Map.Entry<String, Object> entry : map.entrySet()){
+ private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) {
+ for (Map.Entry<String, Object> entry : map.entrySet()) {
String val = String.valueOf(entry.getValue());
- if (val.contains(RANGE_TIME_LINK)){
+ // 璺宠繃绌哄�煎拰 "null" 瀛楃涓�
+ if (Cools.isEmpty(val) || "null".equals(val)) {
+ continue;
+ }
+ if (val.contains(RANGE_TIME_LINK)) {
String[] dates = val.split(RANGE_TIME_LINK);
wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
@@ -66,10 +86,10 @@
return R.ok();
}
- @RequestMapping(value = "/taskLog/update/auth")
- @ManagerAuth
- public R update(TaskLog taskLog){
- if (Cools.isEmpty(taskLog) || null==taskLog.getId()){
+ @RequestMapping(value = "/taskLog/update/auth")
+ @ManagerAuth
+ public R update(TaskLog taskLog) {
+ if (Cools.isEmpty(taskLog) || null == taskLog.getId()) {
return R.error();
}
taskLogService.updateById(taskLog);
@@ -78,8 +98,8 @@
@RequestMapping(value = "/taskLog/delete/auth")
@ManagerAuth
- public R delete(@RequestParam(value="ids[]") Long[] ids){
- for (Long id : ids){
+ public R delete(@RequestParam(value = "ids[]") Long[] ids) {
+ for (Long id : ids) {
taskLogService.deleteById(id);
}
return R.ok();
@@ -87,7 +107,7 @@
@RequestMapping(value = "/taskLog/export/auth")
@ManagerAuth
- public R export(@RequestBody JSONObject param){
+ public R export(@RequestBody JSONObject param) {
EntityWrapper<TaskLog> wrapper = new EntityWrapper<>();
List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
Map<String, Object> map = excludeTrash(param.getJSONObject("taskLog"));
@@ -103,7 +123,7 @@
wrapper.like("id", condition);
Page<TaskLog> page = taskLogService.selectPage(new Page<>(0, 10), wrapper);
List<Map<String, Object>> result = new ArrayList<>();
- for (TaskLog taskLog : page.getRecords()){
+ for (TaskLog taskLog : page.getRecords()) {
Map<String, Object> map = new HashMap<>();
map.put("id", taskLog.getId());
map.put("value", taskLog.getId());
@@ -116,7 +136,7 @@
@ManagerAuth
public R query(@RequestBody JSONObject param) {
Wrapper<TaskLog> wrapper = new EntityWrapper<TaskLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
- if (null != taskLogService.selectOne(wrapper)){
+ if (null != taskLogService.selectOne(wrapper)) {
return R.parse(BaseRes.REPEAT).add(getComment(TaskLog.class, String.valueOf(param.get("key"))));
}
return R.ok();
--
Gitblit v1.9.1