From 7307fad287994fce2567bf4a7bdd4b7d3f06ea83 Mon Sep 17 00:00:00 2001 From: p-honggang.li <p-honggang.li@pcitc.com> Date: 星期三, 03 九月 2025 18:30:53 +0800 Subject: [PATCH] 修改积分交易 --- src/main/java/com/webmanage/controller/OrderController.java | 193 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 190 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/webmanage/controller/OrderController.java b/src/main/java/com/webmanage/controller/OrderController.java index d2d30e7..363410b 100644 --- a/src/main/java/com/webmanage/controller/OrderController.java +++ b/src/main/java/com/webmanage/controller/OrderController.java @@ -2,8 +2,10 @@ import com.webmanage.common.Result; import com.webmanage.dto.CreateOrderDTO; +import com.webmanage.dto.FileCheckDTO; import com.webmanage.dto.OrderQueryDTO; import com.webmanage.entity.OrderInfo; +import com.webmanage.dto.UpdateOrderDetailDTO; import com.webmanage.service.OrderInfoService; import com.webmanage.service.TokenService; import com.webmanage.service.OrderNoService; @@ -19,6 +21,7 @@ import javax.validation.Valid; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; +import com.webmanage.dto.OrderApprovalDTO; /** * 璁㈠崟绠$悊Controller @@ -37,6 +40,13 @@ @ApiOperation("鍒嗛〉鏌ヨ涔板璁㈠崟鍒楄〃") public Result<Object> getBuyerOrderPage(@Valid @RequestBody OrderQueryDTO queryDTO) { try { return Result.success(orderInfoService.getBuyerOrderPage(queryDTO)); } + catch (Exception e) { log.error("鏌ヨ涔板璁㈠崟鍒楄〃澶辫触", e); return Result.error("鏌ヨ涔板璁㈠崟鍒楄〃澶辫触锛�" + e.getMessage()); } + } + + @PostMapping("/buyer/page/with-product-conditions") + @ApiOperation("鍒嗛〉鏌ヨ涔板璁㈠崟鍒楄〃锛堟敮鎸佷骇鍝佹潯浠讹級") + public Result<Object> getBuyerOrderPageWithProductConditions(@Valid @RequestBody OrderQueryDTO queryDTO) { + try { return Result.success(orderInfoService.getBuyerOrderPageWithProductConditions(queryDTO)); } catch (Exception e) { log.error("鏌ヨ涔板璁㈠崟鍒楄〃澶辫触", e); return Result.error("鏌ヨ涔板璁㈠崟鍒楄〃澶辫触锛�" + e.getMessage()); } } @@ -80,6 +90,34 @@ } } + + + @PostMapping("/status/next") + @ApiOperation("鏇存柊璁㈠崟鐘舵�佸埌涓嬩竴涓姸鎬�") + public Result<Object> updateOrderStatusToNext( + @ApiParam("璁㈠崟ID") @RequestParam @NotBlank String orderId) { + try { + boolean success = orderInfoService.updateOrderStatusToNext(orderId); + return success ? Result.success("璁㈠崟鐘舵�佹洿鏂板埌涓嬩竴涓姸鎬佹垚鍔�") : Result.error("璁㈠崟鐘舵�佹洿鏂板け璐�"); + } catch (Exception e) { + log.error("鏇存柊璁㈠崟鐘舵�佸埌涓嬩竴涓姸鎬佸け璐�", e); + return Result.error("鏇存柊璁㈠崟鐘舵�佸埌涓嬩竴涓姸鎬佸け璐ワ細" + e.getMessage()); + } + } + + @PostMapping("/status/previous") + @ApiOperation("鏇存柊璁㈠崟鐘舵�佸埌涓婁竴涓姸鎬�") + public Result<Object> updateOrderStatusToPrevious( + @ApiParam("璁㈠崟ID") @RequestParam @NotBlank String orderId) { + try { + boolean success = orderInfoService.updateOrderStatusToPrevious(orderId); + return success ? Result.success("璁㈠崟鐘舵�佹洿鏂板埌涓婁竴涓姸鎬佹垚鍔�") : Result.error("璁㈠崟鐘舵�佹洿鏂板け璐�"); + } catch (Exception e) { + log.error("鏇存柊璁㈠崟鐘舵�佸埌涓婁竴涓姸鎬佸け璐�", e); + return Result.error("鏇存柊璁㈠崟鐘舵�佸埌涓婁竴涓姸鎬佸け璐ワ細" + e.getMessage()); + } + } + @PostMapping("/seller/page") @ApiOperation("鍒嗛〉鏌ヨ鍗栧璁㈠崟鍒楄〃") public Result<Object> getSellerOrderPage(@Valid @RequestBody OrderQueryDTO queryDTO) { @@ -94,11 +132,36 @@ } } + @PostMapping("/seller/page/with-product-conditions") + @ApiOperation("鍒嗛〉鏌ヨ鍗栧璁㈠崟鍒楄〃锛堟敮鎸佷骇鍝佹潯浠讹級") + public Result<Object> getSellerOrderPageWithProductConditions(@Valid @RequestBody OrderQueryDTO queryDTO) { + try { + if (queryDTO.getProviderId() == null) { + return Result.error("鎻愪緵鑰匢D涓嶈兘涓虹┖"); + } + return Result.success(orderInfoService.getSellerOrderPageWithProductConditions(queryDTO)); + } catch (Exception e) { + log.error("鏌ヨ鍗栧璁㈠崟鍒楄〃澶辫触", e); + return Result.error("鏌ヨ鍗栧璁㈠崟鍒楄〃澶辫触锛�" + e.getMessage()); + } + } + @PostMapping("/approval/page") @ApiOperation("鍒嗛〉鏌ヨ寰呭鎵硅鍗曞垪琛�") public Result<Object> getPendingApprovalOrderPage(@Valid @RequestBody OrderQueryDTO queryDTO) { try { return Result.success(orderInfoService.getPendingApprovalOrderPage(queryDTO)); + } catch (Exception e) { + log.error("鏌ヨ寰呭鎵硅鍗曞垪琛ㄥけ璐�", e); + return Result.error("鏌ヨ寰呭鎵硅鍗曞垪琛ㄥけ璐ワ細" + e.getMessage()); + } + } + + @PostMapping("/approval/page/with-product-conditions") + @ApiOperation("鍒嗛〉鏌ヨ寰呭鎵硅鍗曞垪琛紙鏀寔浜у搧鏉′欢锛�") + public Result<Object> getPendingApprovalOrderPageWithProductConditions(@Valid @RequestBody OrderQueryDTO queryDTO) { + try { + return Result.success(orderInfoService.getPendingApprovalOrderPageWithProductConditions(queryDTO)); } catch (Exception e) { log.error("鏌ヨ寰呭鎵硅鍗曞垪琛ㄥけ璐�", e); return Result.error("鏌ヨ寰呭鎵硅鍗曞垪琛ㄥけ璐ワ細" + e.getMessage()); @@ -120,7 +183,7 @@ @PostMapping("/attachment/upload") @ApiOperation("涓婁紶璁㈠崟闄勪欢") - public Result<Boolean> uploadOrderAttachment( + public Result<Long> uploadOrderAttachment( @ApiParam("璁㈠崟ID") @RequestParam @NotBlank String orderId, @ApiParam("鏂囦欢鍚�") @RequestParam @NotBlank String fileName, @ApiParam("鍘熷鏂囦欢鍚�") @RequestParam String originalName, @@ -134,11 +197,11 @@ @ApiParam("闄勪欢绫诲瀷") @RequestParam String attachmentType, @ApiParam("闄勪欢鎻忚堪") @RequestParam String description) { try { - boolean result = orderInfoService.uploadOrderAttachment( + Long attachmentId = orderInfoService.uploadOrderAttachment( orderId, fileName, originalName, fileType, fileSize, fileUrl, bucketName, objectName, uploadUserId, uploadUserName, attachmentType, description ); - return result ? Result.success(true) : Result.error("涓婁紶璁㈠崟闄勪欢澶辫触"); + return Result.success("涓婁紶璁㈠崟闄勪欢鎴愬姛", attachmentId); } catch (Exception e) { log.error("涓婁紶璁㈠崟闄勪欢澶辫触锛岃鍗旾D: {}", orderId, e); return Result.error("涓婁紶璁㈠崟闄勪欢澶辫触锛�" + e.getMessage()); @@ -198,4 +261,128 @@ return Result.error("鍥炲璇勪环澶辫触锛�" + e.getMessage()); } } + + @PostMapping("/detail/update") + @ApiOperation("鏇存柊璁㈠崟璇︽儏") + public Result<Boolean> updateOrderDetail(@Valid @RequestBody UpdateOrderDetailDTO updateOrderDetailDTO) { + try { + boolean result = orderInfoService.updateOrderDetail(updateOrderDetailDTO); + return result ? Result.success(true) : Result.error("鏇存柊璁㈠崟璇︽儏澶辫触"); + } catch (Exception e) { + log.error("鏇存柊璁㈠崟璇︽儏澶辫触锛岃鍗旾D: {}", updateOrderDetailDTO.getOrderId(), e); + return Result.error("鏇存柊璁㈠崟璇︽儏澶辫触锛�" + e.getMessage()); + } + } + + @PostMapping("/detail/remarks/update") + @ApiOperation("鍙洿鏂拌鍗曡鎯呯殑澶囨敞淇℃伅") + public Result<Boolean> updateOrderDetailRemarksOnly(@Valid @RequestBody UpdateOrderDetailDTO.UpdateOrderDetailRemarksOnlyDTO updateOrderDetailDTO) { + try { + boolean result = orderInfoService.updateOrderDetailRemarksOnly(updateOrderDetailDTO); + return result ? Result.success(true) : Result.error("鏇存柊璁㈠崟璇︽儏澶囨敞澶辫触"); + } catch (Exception e) { + log.error("鏇存柊璁㈠崟璇︽儏澶囨敞澶辫触锛岃鍗旾D: {}", updateOrderDetailDTO.getOrderId(), e); + return Result.error("鏇存柊璁㈠崟璇︽儏澶囨敞澶辫触锛�" + e.getMessage()); + } + } + + @PostMapping("/trade/checkFiles") + @ApiOperation("鏂囦欢鏍告煡") + public Result<Boolean> checkFiles(@Valid @RequestBody FileCheckDTO fileCheckDTO) { + try { + boolean result = orderInfoService.checkFiles(fileCheckDTO); + return result ? Result.success(true) : Result.error("鏂囦欢鏍告煡澶辫触"); + } catch (Exception e) { + log.error("鏂囦欢鏍告煡澶辫触锛岃鍗旾D: {}", fileCheckDTO.getOrderId(), e); + return Result.error("鏂囦欢鏍告煡澶辫触锛�" + e.getMessage()); + } + } + + @DeleteMapping("/attachment/delete/{attachmentId}") + @ApiOperation("鍒犻櫎璁㈠崟闄勪欢") + public Result<Boolean> deleteOrderAttachment(@ApiParam("闄勪欢ID") @PathVariable @NotNull Long attachmentId) { + try { + boolean result = orderInfoService.deleteOrderAttachment(attachmentId); + return result ? Result.success(true) : Result.error("鍒犻櫎璁㈠崟闄勪欢澶辫触"); + } catch (Exception e) { + log.error("鍒犻櫎璁㈠崟闄勪欢澶辫触锛岄檮浠禝D: {}", attachmentId, e); + return Result.error("鍒犻櫎璁㈠崟闄勪欢澶辫触锛�" + e.getMessage()); + } + } + + @PostMapping("/trade/approve") + @ApiOperation("瀹℃壒閫氳繃") + public Result<Boolean> approveOrder(@Valid @RequestBody OrderApprovalDTO orderApprovalDTO) { + try { + boolean result = orderInfoService.approveOrder(orderApprovalDTO); + return result ? Result.success(true) : Result.error("瀹℃壒閫氳繃澶辫触"); + } catch (Exception e) { + log.error("瀹℃壒閫氳繃澶辫触锛岃鍗旾D: {}", orderApprovalDTO.getOrderId(), e); + return Result.error("瀹℃壒閫氳繃澶辫触锛�" + e.getMessage()); + } + } + + @PostMapping("/workflow/update") + @ApiOperation("鏍规嵁璁㈠崟ID鏇存柊宸ヤ綔娴両D锛坵orkflow_id锛�") + public Result<Boolean> updateWorkflowId( + @ApiParam("璁㈠崟ID") @RequestParam @NotBlank String orderId, + @ApiParam("宸ヤ綔娴両D") @RequestParam @NotBlank String workflowId) { + try { + boolean result = orderInfoService.updateWorkflowId(orderId, workflowId); + return result ? Result.success(true) : Result.error("鏇存柊宸ヤ綔娴両D澶辫触"); + } catch (Exception e) { + log.error("鏇存柊宸ヤ綔娴両D澶辫触锛岃鍗旾D: {}", orderId, e); + return Result.error("鏇存柊宸ヤ綔娴両D澶辫触锛�" + e.getMessage()); + } + } + + @GetMapping("/agreement/check/{orderId}") + @ApiOperation("妫�鏌ヨ鍗曟槸鍚﹀寘鍚崗璁被鍨嬬殑瀛愯鍗�") + public Result<Boolean> checkAgreementPriceType( + @ApiParam("璁㈠崟ID") @PathVariable @NotBlank String orderId) { + try { + boolean hasAgreement = orderInfoService.hasAgreementPriceType(orderId); + return Result.success(hasAgreement); + } catch (Exception e) { + log.error("妫�鏌ヨ鍗曞崗璁被鍨嬪け璐ワ紝璁㈠崟ID: {}", orderId, e); + return Result.error("妫�鏌ヨ鍗曞崗璁被鍨嬪け璐ワ細" + e.getMessage()); + } + } + + @DeleteMapping("/cancel/{orderId}") + @ApiOperation("鍙栨秷璁㈠崟") + public Result<Boolean> cancelOrder(@ApiParam("璁㈠崟ID") @PathVariable @NotBlank String orderId) { + try { + boolean result = orderInfoService.cancelOrder(orderId); + return result ? Result.success(true) : Result.error("鍙栨秷璁㈠崟澶辫触"); + } catch (Exception e) { + log.error("鍙栨秷璁㈠崟澶辫触锛岃鍗旾D: {}", orderId, e); + return Result.error("鍙栨秷璁㈠崟澶辫触锛�" + e.getMessage()); + } + } + + @GetMapping("/product/{productId}/has-completed-orders") + @ApiOperation("鏍规嵁浜у搧ID鍒ゆ柇鏄惁瀛樺湪瀹℃牳涓殑鍏宠仈璁㈠崟") + public Result<Boolean> hasCompletedOrdersByProductId( + @ApiParam("浜у搧ID") @PathVariable @NotBlank String productId) { + try { + boolean exists = orderInfoService.existsCompletedNotCancelledOrderByProductId(productId); + return Result.success(exists); + } catch (Exception e) { + log.error("鏌ヨ浜у搧鍏宠仈璁㈠崟瀛樺湪鎬уけ璐ワ紝浜у搧ID: {}", productId, e); + return Result.error("鏌ヨ澶辫触锛�" + e.getMessage()); + } + } + + @PostMapping("/status/isEvaluate") + @ApiOperation("鏇存柊璇勪环鐘舵��") + public Result<Object> updateOrderInfoIsEvaluate(@ApiParam("璁㈠崟ID") @RequestParam @NotBlank String orderId){ + try { + boolean success = orderInfoService.updateOrderIsEvaluate(orderId); + return success ? Result.success("璇勪环鐘舵�佹洿鏂版垚鍔�") : Result.error("璇勪环鐘舵�佹洿鏂板け璐�"); + } catch (Exception e) { + log.error("璇勪环鐘舵�佹洿鏂板け璐�", e); + return Result.error("璇勪环鐘舵�佹洿鏂板け璐ワ細" + e.getMessage()); + } + } } -- Gitblit v1.8.0