From c16a5f590db461391a4441e520f3264526c11905 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 15 六月 2026 13:13:56 +0800
Subject: [PATCH] feat(sales): 优化发货信息管理功能
---
src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java | 141 +++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 137 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java b/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
index 5594e78..10cc97c 100644
--- a/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
+++ b/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
@@ -23,9 +23,11 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -161,6 +163,30 @@
}
/**
+ * 瀵煎嚭閿�鍞彴璐﹀垪琛紙鍖呭惈浜у搧鏄庣粏锛屼袱涓猻heet椤碉級
+ */
+ @Log(title = "閿�鍞彴璐�", businessType = BusinessType.EXPORT)
+ @PostMapping("/exportWithProducts")
+ @ApiOperation("瀵煎嚭閿�鍞彴璐﹀強浜у搧鏄庣粏锛堜袱涓猻heet椤碉級")
+ public void exportWithProducts(HttpServletResponse response, SalesLedgerDto salesLedgerDto) {
+ salesLedgerService.exportWithProducts(response, salesLedgerDto);
+ }
+
+ /**
+ * 瀵煎嚭鍞悗鍙拌处宸ヨ壓璺嚎
+ */
+ @Log(title = "閿�鍞彴璐﹀伐鑹鸿矾绾�", businessType = BusinessType.EXPORT)
+ @PostMapping("/exportProcessRoute")
+ @ApiOperation("瀵煎嚭鍞悗鍙拌处宸ヨ壓璺嚎")
+ public void exportProcessRoute(HttpServletResponse response,
+ HttpServletRequest request,
+ @RequestParam(value = "completedTimeStart", required = false) String completedTimeStart,
+ @RequestParam(value = "completedTimeEnd", required = false) String completedTimeEnd) {
+ List<Long> salesLedgerIds = parseSalesLedgerIds(request);
+ salesLedgerService.exportProcessRoute(response, salesLedgerIds, completedTimeStart, completedTimeEnd);
+ }
+
+ /**
* 瀵煎嚭寮�绁ㄧ櫥璁板垪琛�
*/
@Log(title = "瀵煎嚭寮�绁ㄧ櫥璁板垪琛�", businessType = BusinessType.EXPORT)
@@ -188,8 +214,59 @@
*/
@PostMapping("/saleProcessBind")
@ApiOperation("閿�鍞鍗曠粦瀹氬伐鑹鸿矾绾�")
- public AjaxResult saleProcessBind(@RequestBody SalesLedgerProcessRoute salesLedgerProcessRoute) {
- salesLedgerService.saleProcessBind(salesLedgerProcessRoute);
+ public AjaxResult saleProcessBind(@RequestBody SalesLedgerProcessRouteDto salesLedgerProcessRouteDto) {
+ salesLedgerService.saleProcessBind(salesLedgerProcessRouteDto);
+ return AjaxResult.success();
+ }
+
+ /**
+ * 鍙嶅鏍告搷浣�
+ */
+ @Log(title = "閿�鍞彴璐﹀弽瀹℃牳", businessType = BusinessType.UPDATE)
+ @PostMapping("/counterReview")
+ @ApiOperation("鍙嶅鏍告搷浣滐細浣滃簾鎴栭噸鏂扮敓鎴�")
+ public AjaxResult counterReview(@RequestBody CounterReviewDto dto) {
+ List<Long> newLedgerIds = salesLedgerService.counterReview(dto);
+ AjaxResult result = AjaxResult.success("鍙嶅鏍告垚鍔�");
+ if (newLedgerIds != null && !newLedgerIds.isEmpty()) {
+ result.put("newLedgerIds", newLedgerIds);
+ }
+ return result;
+ }
+
+ /**
+ * 鏍囪璁㈠崟瀹屾垚
+ */
+ @Log(title = "閿�鍞彴璐︽爣璁板畬鎴�", businessType = BusinessType.UPDATE)
+ @PostMapping("/markOrderCompleted")
+ @ApiOperation("鏍囪璁㈠崟瀹屾垚锛堜笉鍙挙閿�锛�")
+ public AjaxResult markOrderCompleted(@RequestBody Map<String, Object> params) {
+ @SuppressWarnings("unchecked")
+ List<Long> ids = ((List<Object>) params.get("ids")).stream()
+ .map(obj -> Long.valueOf(obj.toString()))
+ .collect(Collectors.toList());
+ if (ids == null || ids.isEmpty()) {
+ return AjaxResult.error("璇烽�夋嫨瑕佹爣璁板畬鎴愮殑璁㈠崟");
+ }
+ salesLedgerService.markOrderCompleted(ids);
+ return AjaxResult.success("鏍囪瀹屾垚鎴愬姛");
+ }
+
+ /**
+ * 閫掑鎵撳嵃娆℃暟
+ */
+ @PostMapping("/incrementPrintCount")
+ @ApiOperation("閫掑鎵撳嵃娆℃暟")
+ public AjaxResult incrementPrintCount(@RequestBody Map<String, Object> params) {
+ Long id = params.get("id") != null ? Long.valueOf(params.get("id").toString()) : null;
+ String printType = (String) params.get("printType");
+ if (id == null) {
+ return AjaxResult.error("閿�鍞彴璐D涓嶈兘涓虹┖");
+ }
+ if (printType == null || (!"label".equals(printType) && !"document".equals(printType))) {
+ return AjaxResult.error("鎵撳嵃绫诲瀷蹇呴』涓� label 鎴� document");
+ }
+ salesLedgerService.incrementPrintCount(id, printType);
return AjaxResult.success();
}
@@ -342,6 +419,13 @@
return AjaxResult.success();
}
+ @PostMapping("/scanShipApply")
+ @ApiOperation("閿�鍞鍗曟壂鐮�-鍙戣捣鍙戣揣瀹℃壒锛堝~鍐欒溅鐗�/蹇�掋�佸鎵逛汉銆侀檮浠讹紱閫氳繃鍚庤嚜鍔ㄦ墸搴撳瓨骞舵爣璁板凡鍙戣揣锛�")
+ public AjaxResult scanShipApply(@RequestBody SalesScanShipDto dto) {
+ salesLedgerService.scanShipApply(dto);
+ return AjaxResult.success("鍙戣揣瀹℃壒宸插彂璧�");
+ }
+
@PostMapping("/scanOutboundUnqualified")
@ApiOperation("閿�鍞鍗曟壂鐮�-涓嶅悎鏍煎嚭搴�")
public AjaxResult scanOutboundUnqualified(@RequestBody SalesScanInboundDto dto) {
@@ -367,14 +451,63 @@
@ApiOperation("閿�鍞彂璐у巻鍙叉暟鎹鍏�-宸插彂璐у鍏ユā鏉夸笅杞�")
public void shippingImportTemplate(HttpServletResponse response) {
ExcelUtil<SalesShippingImportDto> excelUtil = new ExcelUtil<>(SalesShippingImportDto.class);
- excelUtil.importTemplateExcel(response, "宸插彂璐у鍏ユā鏉夸笅杞�");
+ excelUtil.importTemplateExcel(response, "宸插嚭搴撳鍏ユā鏉夸笅杞�");
}
@PostMapping("/salesHistory/notShippingImportTemplate")
@ApiOperation("閿�鍞彂璐у巻鍙叉暟鎹鍏�-鏈彂璐у鍏ユā鏉夸笅杞�")
public void notShippingImportTemplate(HttpServletResponse response) {
ExcelUtil<SalesNotShippingImportDto> excelUtil = new ExcelUtil<>(SalesNotShippingImportDto.class);
- excelUtil.importTemplateExcel(response, "鏈彂璐у鍏ユā鏉夸笅杞�");
+ excelUtil.importTemplateExcel(response, "鏈嚭搴撳鍏ユā鏉夸笅杞�");
+ }
+
+ private List<Long> parseSalesLedgerIds(HttpServletRequest request) {
+ if (request == null) {
+ return Collections.emptyList();
+ }
+
+ List<Long> ids = new ArrayList<>();
+ Map<String, String[]> parameterMap = request.getParameterMap();
+ if (parameterMap == null || parameterMap.isEmpty()) {
+ return ids;
+ }
+
+ String directValue = request.getParameter("salesLedgerIds");
+ if (StringUtils.hasText(directValue)) {
+ for (String value : directValue.split(",")) {
+ addParsedLong(ids, value);
+ }
+ }
+
+ for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
+ String key = entry.getKey();
+ if (!StringUtils.hasText(key)) {
+ continue;
+ }
+ if (!"salesLedgerIds".equals(key) && !key.startsWith("salesLedgerIds[")) {
+ continue;
+ }
+ String[] values = entry.getValue();
+ if (values == null) {
+ continue;
+ }
+ for (String value : values) {
+ addParsedLong(ids, value);
+ }
+ }
+
+ return ids.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
+ }
+
+ private void addParsedLong(List<Long> target, String value) {
+ if (target == null || !StringUtils.hasText(value)) {
+ return;
+ }
+ try {
+ target.add(Long.valueOf(value.trim()));
+ } catch (Exception ignored) {
+ // ignore invalid id values
+ }
}
}
--
Gitblit v1.9.3