no message

main
HUOJIN\92525 2026-01-19 16:57:06 +08:00
parent 9d1bb3fe6a
commit fa5ae61571
5 changed files with 109 additions and 6 deletions

View File

@ -0,0 +1,93 @@
package org.cpte.modules.dashboard.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.cpte.modules.agvTask.entity.AgvTask;
import org.cpte.modules.agvTask.service.IAgvTaskService;
import org.cpte.modules.inventory.mapper.InventoryMapper;
import org.cpte.modules.receive.mapper.AsnDetailMapper;
import org.cpte.modules.receive.mapper.ReceiveRecordMapper;
import org.cpte.modules.shipping.mapper.TaskMapper;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
/**
* @Description: AGV
* @author: cpte
* @Date: 2025-11-06
* @Version: V1.0
*/
@Tag(name = "首页")
@RestController
@RequestMapping("/dashboard")
@Slf4j
public class DashBoardController {
@Autowired
private InventoryMapper inventoryMapper;
@Autowired
private ReceiveRecordMapper receiveRecordMapper;
@Autowired
private TaskMapper taskMapper;
@GetMapping("/getChartCardList")
public Result<JSONArray> getChartCardList() {
Result<JSONArray> result = new Result<JSONArray>();
JSONArray jsonArray = new JSONArray();
Long invTotal = inventoryMapper.queryStockCount();
JSONObject invObj = new JSONObject(true);
invObj.put("title", "总库存数量/托");
invObj.put("icon", "visit-count|svg");
invObj.put("total", invTotal);
jsonArray.add(invObj);
Long inTotal = receiveRecordMapper.queryStockCount();
JSONObject inObj = new JSONObject(true);
inObj.put("title", "日均入库量/托");
inObj.put("icon", "total-sales|svg");
inObj.put("total", inTotal);
inObj.put("color", "blue");
jsonArray.add(inObj);
Long outTotal = taskMapper.queryStockCount();
JSONObject outObj = new JSONObject(true);
outObj.put("title", "日均出库量/托");
outObj.put("icon", "download-count|svg");
outObj.put("total", outTotal);
outObj.put("color", "orange");
jsonArray.add(outObj);
double turnoverTotal = outTotal / (double) invTotal;
JSONObject turnoverObj = new JSONObject(true);
turnoverObj.put("title", "库存周转率(次/天)");
turnoverObj.put("icon", "transaction|svg");
turnoverObj.put("total", turnoverTotal);
jsonArray.add(turnoverObj);
result.setResult(jsonArray);
return result;
}
}

View File

@ -0,0 +1,4 @@
package org.cpte.modules.dashboard;
public class test {
}

View File

@ -102,4 +102,6 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
"${ew.customSqlSegment}") "${ew.customSqlSegment}")
IPage<Inventory> selectInventoryWithItemKey(Page<Inventory> page, @Param("inventory") Inventory inventory, @Param("ew") Wrapper<Inventory> wrapper); IPage<Inventory> selectInventoryWithItemKey(Page<Inventory> page, @Param("inventory") Inventory inventory, @Param("ew") Wrapper<Inventory> wrapper);
@Select("select count(stock_id) from data_inventory")
Long queryStockCount();
} }

View File

@ -10,11 +10,9 @@ import java.util.List;
public interface ReceiveRecordMapper extends BaseMapper<ReceiveRecord> { public interface ReceiveRecordMapper extends BaseMapper<ReceiveRecord> {
/** /**
* *
*
* @param asnId ID
* @return List<ReceiveRecord>
*/ */
@Select("select * from data_receive_record where asn_id = #{asnId} ") @Select("SELECT COUNT(stock_id) FROM data_receive_record WHERE create_time >= CURDATE() AND create_time < CURDATE() + INTERVAL 1 DAY")
List<ReceiveRecord> queryByAsnId(@Param("asnId") Long asnId); Long queryStockCount();
} }

View File

@ -41,4 +41,10 @@ public interface TaskMapper extends BaseMapper<Task> {
*/ */
@Select("SELECT * FROM data_task WHERE agv_task_id is null and to_point_id is null") @Select("SELECT * FROM data_task WHERE agv_task_id is null and to_point_id is null")
List<Task> queryUnallocatedTask(); List<Task> queryUnallocatedTask();
/**
*
*/
@Select("SELECT COUNT(stock_id) FROM data_task WHERE task_status in (4,5) AND create_time >= CURDATE() AND create_time < CURDATE() + INTERVAL 1 DAY AND pick_id>0")
Long queryStockCount();
} }