|
@@ -5,18 +5,22 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.haha.admin.annotation.RequirePermission;
|
|
import com.haha.admin.annotation.RequirePermission;
|
|
|
import com.haha.common.annotation.Log;
|
|
import com.haha.common.annotation.Log;
|
|
|
import com.haha.common.enums.OperationType;
|
|
import com.haha.common.enums.OperationType;
|
|
|
|
|
+import com.haha.common.vo.InventoryStatisticsVO;
|
|
|
|
|
+import com.haha.common.vo.PageResult;
|
|
|
import com.haha.common.vo.Result;
|
|
import com.haha.common.vo.Result;
|
|
|
import com.haha.entity.DeviceInventory;
|
|
import com.haha.entity.DeviceInventory;
|
|
|
import com.haha.entity.InventoryLog;
|
|
import com.haha.entity.InventoryLog;
|
|
|
import com.haha.entity.StockRecord;
|
|
import com.haha.entity.StockRecord;
|
|
|
|
|
+import com.haha.entity.dto.*;
|
|
|
|
|
+import com.haha.service.AdminService;
|
|
|
import com.haha.service.DeviceInventoryService;
|
|
import com.haha.service.DeviceInventoryService;
|
|
|
import com.haha.service.InventoryLogService;
|
|
import com.haha.service.InventoryLogService;
|
|
|
import com.haha.service.StockRecordService;
|
|
import com.haha.service.StockRecordService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
@@ -24,6 +28,7 @@ import java.util.Map;
|
|
|
* 库存管理控制器
|
|
* 库存管理控制器
|
|
|
*/
|
|
*/
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
|
|
+@Validated
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/inventory")
|
|
@RequestMapping("/inventory")
|
|
@@ -35,6 +40,8 @@ public class InventoryController {
|
|
|
|
|
|
|
|
private final StockRecordService stockRecordService;
|
|
private final StockRecordService stockRecordService;
|
|
|
|
|
|
|
|
|
|
+ private final AdminService adminService;
|
|
|
|
|
+
|
|
|
// ==================== 库存查询 ====================
|
|
// ==================== 库存查询 ====================
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -43,28 +50,11 @@ public class InventoryController {
|
|
|
*/
|
|
*/
|
|
|
@RequirePermission("inventory:read")
|
|
@RequirePermission("inventory:read")
|
|
|
@GetMapping("/device-stats")
|
|
@GetMapping("/device-stats")
|
|
|
- public Result<Map<String, Object>> deviceStats(@RequestParam Map<String, Object> params) {
|
|
|
|
|
- int page = 1;
|
|
|
|
|
- int pageSize = 10;
|
|
|
|
|
-
|
|
|
|
|
- Object pageObj = params.get("page");
|
|
|
|
|
- if (pageObj != null && !pageObj.toString().isEmpty()) {
|
|
|
|
|
- page = Integer.parseInt(pageObj.toString());
|
|
|
|
|
- }
|
|
|
|
|
- Object pageSizeObj = params.get("pageSize");
|
|
|
|
|
- if (pageSizeObj != null && !pageSizeObj.toString().isEmpty()) {
|
|
|
|
|
- pageSize = Integer.parseInt(pageSizeObj.toString());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- IPage<Map<String, Object>> pageResult = deviceInventoryService.getDeviceInventoryStats(page, pageSize, params);
|
|
|
|
|
-
|
|
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
|
|
- result.put("list", pageResult.getRecords());
|
|
|
|
|
- result.put("total", pageResult.getTotal());
|
|
|
|
|
- result.put("page", page);
|
|
|
|
|
- result.put("pageSize", pageSize);
|
|
|
|
|
-
|
|
|
|
|
- return Result.success(result);
|
|
|
|
|
|
|
+ public Result<PageResult<Map<String, Object>>> deviceStats(InventoryQueryDTO queryDTO) {
|
|
|
|
|
+ queryDTO.validate();
|
|
|
|
|
+ IPage<Map<String, Object>> pageResult = deviceInventoryService.getDeviceInventoryStats(
|
|
|
|
|
+ queryDTO.getPage(), queryDTO.getPageSize(), queryDTO);
|
|
|
|
|
+ return Result.success(PageResult.of(pageResult));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -72,33 +62,11 @@ public class InventoryController {
|
|
|
*/
|
|
*/
|
|
|
@RequirePermission("inventory:read")
|
|
@RequirePermission("inventory:read")
|
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
|
- public Result<Map<String, Object>> list(@RequestParam Map<String, Object> params) {
|
|
|
|
|
- int page = 1;
|
|
|
|
|
- int pageSize = 10;
|
|
|
|
|
-
|
|
|
|
|
- Object pageObj = params.get("page");
|
|
|
|
|
- if (pageObj != null && !pageObj.toString().isEmpty()) {
|
|
|
|
|
- page = Integer.parseInt(pageObj.toString());
|
|
|
|
|
- }
|
|
|
|
|
- Object pageSizeObj = params.get("pageSize");
|
|
|
|
|
- if (pageSizeObj != null && !pageSizeObj.toString().isEmpty()) {
|
|
|
|
|
- pageSize = Integer.parseInt(pageSizeObj.toString());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 处理低库存筛选参数
|
|
|
|
|
- if ("true".equals(params.get("lowStock"))) {
|
|
|
|
|
- params.put("lowStock", true);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- IPage<DeviceInventory> pageResult = deviceInventoryService.getPage(page, pageSize, params);
|
|
|
|
|
-
|
|
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
|
|
- result.put("list", pageResult.getRecords());
|
|
|
|
|
- result.put("total", pageResult.getTotal());
|
|
|
|
|
- result.put("page", page);
|
|
|
|
|
- result.put("pageSize", pageSize);
|
|
|
|
|
-
|
|
|
|
|
- return Result.success(result);
|
|
|
|
|
|
|
+ public Result<PageResult<DeviceInventory>> list(InventoryQueryDTO queryDTO) {
|
|
|
|
|
+ queryDTO.validate();
|
|
|
|
|
+ IPage<DeviceInventory> pageResult = deviceInventoryService.getPage(
|
|
|
|
|
+ queryDTO.getPage(), queryDTO.getPageSize(), queryDTO);
|
|
|
|
|
+ return Result.success(PageResult.of(pageResult));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -106,11 +74,9 @@ public class InventoryController {
|
|
|
*/
|
|
*/
|
|
|
@RequirePermission("inventory:read")
|
|
@RequirePermission("inventory:read")
|
|
|
@GetMapping("/device/{deviceId}")
|
|
@GetMapping("/device/{deviceId}")
|
|
|
- public Result<Map<String, Object>> getDeviceInventory(@PathVariable String deviceId) {
|
|
|
|
|
|
|
+ public Result<List<Map<String, Object>>> getDeviceInventory(@PathVariable String deviceId) {
|
|
|
List<Map<String, Object>> inventory = deviceInventoryService.getInventoryWithProduct(deviceId);
|
|
List<Map<String, Object>> inventory = deviceInventoryService.getInventoryWithProduct(deviceId);
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
|
|
- result.put("list", inventory);
|
|
|
|
|
- return Result.success(result);
|
|
|
|
|
|
|
+ return Result.success(inventory);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -128,9 +94,14 @@ public class InventoryController {
|
|
|
*/
|
|
*/
|
|
|
@RequirePermission("inventory:read")
|
|
@RequirePermission("inventory:read")
|
|
|
@GetMapping("/statistics")
|
|
@GetMapping("/statistics")
|
|
|
- public Result<Map<String, Object>> getStatistics() {
|
|
|
|
|
|
|
+ public Result<InventoryStatisticsVO> getStatistics() {
|
|
|
Map<String, Object> stats = deviceInventoryService.getStatistics();
|
|
Map<String, Object> stats = deviceInventoryService.getStatistics();
|
|
|
- return Result.success(stats);
|
|
|
|
|
|
|
+ InventoryStatisticsVO vo = new InventoryStatisticsVO();
|
|
|
|
|
+ vo.setTotalRecords((Long) stats.get("totalRecords"));
|
|
|
|
|
+ vo.setTotalStock((Integer) stats.get("totalStock"));
|
|
|
|
|
+ vo.setLowStockCount((Long) stats.get("lowStockCount"));
|
|
|
|
|
+ vo.setZeroStockCount((Long) stats.get("zeroStockCount"));
|
|
|
|
|
+ return Result.success(vo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// ==================== 库存操作 ====================
|
|
// ==================== 库存操作 ====================
|
|
@@ -141,31 +112,16 @@ public class InventoryController {
|
|
|
@RequirePermission("inventory:update")
|
|
@RequirePermission("inventory:update")
|
|
|
@Log(module = "库存管理", operation = OperationType.INSERT, summary = "上货增加库存")
|
|
@Log(module = "库存管理", operation = OperationType.INSERT, summary = "上货增加库存")
|
|
|
@PostMapping("/increase")
|
|
@PostMapping("/increase")
|
|
|
- public Result<DeviceInventory> increaseStock(@RequestBody Map<String, Object> params) {
|
|
|
|
|
- try {
|
|
|
|
|
- Long userId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
- String userName = StpUtil.getLoginIdAsString();
|
|
|
|
|
-
|
|
|
|
|
- String deviceId = (String) params.get("deviceId");
|
|
|
|
|
- Long productId = Long.parseLong(params.get("productId").toString());
|
|
|
|
|
- String productCode = (String) params.get("productCode");
|
|
|
|
|
- String productName = (String) params.get("productName");
|
|
|
|
|
- Integer quantity = Integer.parseInt(params.get("quantity").toString());
|
|
|
|
|
- Integer shelfNum = params.get("shelfNum") != null ?
|
|
|
|
|
- Integer.parseInt(params.get("shelfNum").toString()) : null;
|
|
|
|
|
- String position = (String) params.get("position");
|
|
|
|
|
- String activityId = (String) params.get("activityId");
|
|
|
|
|
-
|
|
|
|
|
- DeviceInventory inventory = deviceInventoryService.increaseStock(
|
|
|
|
|
- deviceId, productId, productCode, productName,
|
|
|
|
|
- quantity, shelfNum, position,
|
|
|
|
|
- userId, userName, activityId);
|
|
|
|
|
-
|
|
|
|
|
- return Result.success("库存增加成功", inventory);
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- log.error("增加库存失败", e);
|
|
|
|
|
- return Result.error(e.getMessage());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public Result<DeviceInventory> increaseStock(@RequestBody @Validated StockIncreaseDTO dto) {
|
|
|
|
|
+ Long userId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
+ String userName = getCurrentOperatorName();
|
|
|
|
|
+
|
|
|
|
|
+ DeviceInventory inventory = deviceInventoryService.increaseStock(
|
|
|
|
|
+ dto.getDeviceId(), dto.getProductId(), dto.getProductCode(), dto.getProductName(),
|
|
|
|
|
+ dto.getQuantity(), dto.getShelfNum(), dto.getPosition(),
|
|
|
|
|
+ userId, userName, dto.getActivityId());
|
|
|
|
|
+
|
|
|
|
|
+ return Result.success("库存增加成功", inventory);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -174,24 +130,15 @@ public class InventoryController {
|
|
|
@RequirePermission("inventory:update")
|
|
@RequirePermission("inventory:update")
|
|
|
@Log(module = "库存管理", operation = OperationType.UPDATE, summary = "调整库存")
|
|
@Log(module = "库存管理", operation = OperationType.UPDATE, summary = "调整库存")
|
|
|
@PostMapping("/adjust")
|
|
@PostMapping("/adjust")
|
|
|
- public Result<DeviceInventory> adjustStock(@RequestBody Map<String, Object> params) {
|
|
|
|
|
- try {
|
|
|
|
|
- Long userId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
- String userName = StpUtil.getLoginIdAsString();
|
|
|
|
|
-
|
|
|
|
|
- String deviceId = (String) params.get("deviceId");
|
|
|
|
|
- Long productId = Long.parseLong(params.get("productId").toString());
|
|
|
|
|
- Integer newStock = Integer.parseInt(params.get("newStock").toString());
|
|
|
|
|
- String remark = (String) params.get("remark");
|
|
|
|
|
|
|
+ public Result<DeviceInventory> adjustStock(@RequestBody @Validated StockAdjustDTO dto) {
|
|
|
|
|
+ Long userId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
+ String userName = getCurrentOperatorName();
|
|
|
|
|
|
|
|
- DeviceInventory inventory = deviceInventoryService.adjustStock(
|
|
|
|
|
- deviceId, productId, newStock, remark, userId, userName);
|
|
|
|
|
|
|
+ DeviceInventory inventory = deviceInventoryService.adjustStock(
|
|
|
|
|
+ dto.getDeviceId(), dto.getProductId(), dto.getNewStock(),
|
|
|
|
|
+ dto.getRemark(), userId, userName);
|
|
|
|
|
|
|
|
- return Result.success("库存调整成功", inventory);
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- log.error("调整库存失败", e);
|
|
|
|
|
- return Result.error(e.getMessage());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return Result.success("库存调整成功", inventory);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// ==================== 库存变动日志 ====================
|
|
// ==================== 库存变动日志 ====================
|
|
@@ -201,28 +148,11 @@ public class InventoryController {
|
|
|
*/
|
|
*/
|
|
|
@RequirePermission("inventory:read")
|
|
@RequirePermission("inventory:read")
|
|
|
@GetMapping("/logs")
|
|
@GetMapping("/logs")
|
|
|
- public Result<Map<String, Object>> getLogList(@RequestParam Map<String, Object> params) {
|
|
|
|
|
- int page = 1;
|
|
|
|
|
- int pageSize = 10;
|
|
|
|
|
-
|
|
|
|
|
- Object pageObj = params.get("page");
|
|
|
|
|
- if (pageObj != null && !pageObj.toString().isEmpty()) {
|
|
|
|
|
- page = Integer.parseInt(pageObj.toString());
|
|
|
|
|
- }
|
|
|
|
|
- Object pageSizeObj = params.get("pageSize");
|
|
|
|
|
- if (pageSizeObj != null && !pageSizeObj.toString().isEmpty()) {
|
|
|
|
|
- pageSize = Integer.parseInt(pageSizeObj.toString());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- IPage<InventoryLog> pageResult = inventoryLogService.getPage(page, pageSize, params);
|
|
|
|
|
-
|
|
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
|
|
- result.put("list", pageResult.getRecords());
|
|
|
|
|
- result.put("total", pageResult.getTotal());
|
|
|
|
|
- result.put("page", page);
|
|
|
|
|
- result.put("pageSize", pageSize);
|
|
|
|
|
-
|
|
|
|
|
- return Result.success(result);
|
|
|
|
|
|
|
+ public Result<PageResult<InventoryLog>> getLogList(InventoryLogQueryDTO queryDTO) {
|
|
|
|
|
+ queryDTO.validate();
|
|
|
|
|
+ IPage<InventoryLog> pageResult = inventoryLogService.getPage(
|
|
|
|
|
+ queryDTO.getPage(), queryDTO.getPageSize(), queryDTO);
|
|
|
|
|
+ return Result.success(PageResult.of(pageResult));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -245,28 +175,11 @@ public class InventoryController {
|
|
|
*/
|
|
*/
|
|
|
@RequirePermission("inventory:read")
|
|
@RequirePermission("inventory:read")
|
|
|
@GetMapping("/records")
|
|
@GetMapping("/records")
|
|
|
- public Result<Map<String, Object>> getRecordList(@RequestParam Map<String, Object> params) {
|
|
|
|
|
- int page = 1;
|
|
|
|
|
- int pageSize = 10;
|
|
|
|
|
-
|
|
|
|
|
- Object pageObj = params.get("page");
|
|
|
|
|
- if (pageObj != null && !pageObj.toString().isEmpty()) {
|
|
|
|
|
- page = Integer.parseInt(pageObj.toString());
|
|
|
|
|
- }
|
|
|
|
|
- Object pageSizeObj = params.get("pageSize");
|
|
|
|
|
- if (pageSizeObj != null && !pageSizeObj.toString().isEmpty()) {
|
|
|
|
|
- pageSize = Integer.parseInt(pageSizeObj.toString());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- IPage<StockRecord> pageResult = stockRecordService.getPage(page, pageSize, params);
|
|
|
|
|
-
|
|
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
|
|
- result.put("list", pageResult.getRecords());
|
|
|
|
|
- result.put("total", pageResult.getTotal());
|
|
|
|
|
- result.put("page", page);
|
|
|
|
|
- result.put("pageSize", pageSize);
|
|
|
|
|
-
|
|
|
|
|
- return Result.success(result);
|
|
|
|
|
|
|
+ public Result<PageResult<StockRecord>> getRecordList(StockRecordQueryDTO queryDTO) {
|
|
|
|
|
+ queryDTO.validate();
|
|
|
|
|
+ IPage<StockRecord> pageResult = stockRecordService.getPage(
|
|
|
|
|
+ queryDTO.getPage(), queryDTO.getPageSize(), queryDTO);
|
|
|
|
|
+ return Result.success(PageResult.of(pageResult));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -284,26 +197,15 @@ public class InventoryController {
|
|
|
*/
|
|
*/
|
|
|
@RequirePermission("inventory:create")
|
|
@RequirePermission("inventory:create")
|
|
|
@PostMapping("/records")
|
|
@PostMapping("/records")
|
|
|
- public Result<StockRecord> createRecord(@RequestBody Map<String, Object> params) {
|
|
|
|
|
- try {
|
|
|
|
|
- String deviceId = (String) params.get("deviceId");
|
|
|
|
|
- Integer stockType = params.get("stockType") != null ?
|
|
|
|
|
- Integer.parseInt(params.get("stockType").toString()) : 1;
|
|
|
|
|
- String remark = (String) params.get("remark");
|
|
|
|
|
|
|
+ public Result<StockRecord> createRecord(@RequestBody @Validated StockRecordCreateDTO dto) {
|
|
|
|
|
+ Long stockerId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
+ String stockerName = getCurrentOperatorName();
|
|
|
|
|
|
|
|
- // 获取当前用户作为上货员
|
|
|
|
|
- Long stockerId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
- String stockerName = StpUtil.getLoginIdAsString();
|
|
|
|
|
- String stockerPhone = (String) params.get("stockerPhone");
|
|
|
|
|
|
|
+ StockRecord record = stockRecordService.createRecord(
|
|
|
|
|
+ dto.getDeviceId(), dto.getStockType(), stockerId, stockerName,
|
|
|
|
|
+ dto.getStockerPhone(), dto.getRemark());
|
|
|
|
|
|
|
|
- StockRecord record = stockRecordService.createRecord(
|
|
|
|
|
- deviceId, stockType, stockerId, stockerName, stockerPhone, remark);
|
|
|
|
|
-
|
|
|
|
|
- return Result.success("上货记录创建成功", record);
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- log.error("创建上货记录失败", e);
|
|
|
|
|
- return Result.error(e.getMessage());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return Result.success("上货记录创建成功", record);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -313,20 +215,9 @@ public class InventoryController {
|
|
|
@PutMapping("/records/{id}/complete")
|
|
@PutMapping("/records/{id}/complete")
|
|
|
public Result<String> completeRecord(
|
|
public Result<String> completeRecord(
|
|
|
@PathVariable Long id,
|
|
@PathVariable Long id,
|
|
|
- @RequestBody Map<String, Object> params) {
|
|
|
|
|
- try {
|
|
|
|
|
- Integer totalItems = params.get("totalItems") != null ?
|
|
|
|
|
- Integer.parseInt(params.get("totalItems").toString()) : 0;
|
|
|
|
|
- Integer totalQuantity = params.get("totalQuantity") != null ?
|
|
|
|
|
- Integer.parseInt(params.get("totalQuantity").toString()) : 0;
|
|
|
|
|
- String activityId = (String) params.get("activityId");
|
|
|
|
|
-
|
|
|
|
|
- stockRecordService.completeActivity(id, totalItems, totalQuantity, activityId);
|
|
|
|
|
- return Result.success("上货记录已完成");
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- log.error("完成上货记录失败", e);
|
|
|
|
|
- return Result.error(e.getMessage());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ @RequestBody StockRecordCompleteDTO dto) {
|
|
|
|
|
+ stockRecordService.completeActivity(id, dto.getTotalItems(), dto.getTotalQuantity(), dto.getActivityId());
|
|
|
|
|
+ return Result.success("上货记录已完成");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -335,13 +226,8 @@ public class InventoryController {
|
|
|
@RequirePermission("inventory:update")
|
|
@RequirePermission("inventory:update")
|
|
|
@PutMapping("/records/{id}/cancel")
|
|
@PutMapping("/records/{id}/cancel")
|
|
|
public Result<String> cancelRecord(@PathVariable Long id) {
|
|
public Result<String> cancelRecord(@PathVariable Long id) {
|
|
|
- try {
|
|
|
|
|
- stockRecordService.cancelActivity(id);
|
|
|
|
|
- return Result.success("上货记录已取消");
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- log.error("取消上货记录失败", e);
|
|
|
|
|
- return Result.error(e.getMessage());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ stockRecordService.cancelActivity(id);
|
|
|
|
|
+ return Result.success("上货记录已取消");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -356,4 +242,21 @@ public class InventoryController {
|
|
|
Map<String, Object> stats = stockRecordService.getStockerStatistics(stockerId, startTime, endTime);
|
|
Map<String, Object> stats = stockRecordService.getStockerStatistics(stockerId, startTime, endTime);
|
|
|
return Result.success(stats);
|
|
return Result.success(stats);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取当前操作人名称
|
|
|
|
|
+ * 优先从Session获取昵称,fallback到loginId字符串
|
|
|
|
|
+ */
|
|
|
|
|
+ private String getCurrentOperatorName() {
|
|
|
|
|
+ String operatorName = StpUtil.getLoginIdAsString();
|
|
|
|
|
+ try {
|
|
|
|
|
+ Object nickname = StpUtil.getSession().get("nickname");
|
|
|
|
|
+ if (nickname != null) {
|
|
|
|
|
+ operatorName = nickname.toString();
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.debug("获取用户昵称失败,使用默认值");
|
|
|
|
|
+ }
|
|
|
|
|
+ return operatorName;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|