Pārlūkot izejas kodu

修改申请退款接口

zhangchen 3 nedēļas atpakaļ
vecāks
revīzija
f516f97110

+ 6 - 6
alien-lawyer/src/main/java/shop/alien/lawyer/controller/LawyerConsultationOrderController.java

@@ -367,12 +367,12 @@ public class LawyerConsultationOrderController {
     @ApiOperation("用户申请退款")
     @ApiOperationSupport(order = 17)
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "clientUserId", value = "客户端用户ID", dataType = "Integer", paramType = "query", required = true),
-            @ApiImplicitParam(name = "orderId", value = "订单ID", dataType = "Integer", paramType = "query", required = true),
+            @ApiImplicitParam(name = "clientUserId", value = "客户端用户ID", dataType = "String", paramType = "query", required = true),
+            @ApiImplicitParam(name = "orderId", value = "订单ID", dataType = "String", paramType = "query", required = true),
             @ApiImplicitParam(name = "applyRefundReason", value = "申请退款原因", dataType = "String", paramType = "query", required = true)
     })
     @PostMapping("/applyRefund")
-    public R<Boolean> applyRefund(@RequestParam Integer clientUserId, @RequestParam Integer orderId, @RequestParam String applyRefundReason) {
+    public R<Boolean> applyRefund(@RequestParam String clientUserId, @RequestParam String orderId, @RequestParam String applyRefundReason) {
         log.info("LawyerConsultationOrderController.applyRefund?clientUserId={},orderId{}", clientUserId, orderId);
         return consultationOrderService.applyRefund(clientUserId, orderId, applyRefundReason);
     }
@@ -380,11 +380,11 @@ public class LawyerConsultationOrderController {
     @ApiOperation("用户完成订单")
     @ApiOperationSupport(order = 18)
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "clientUserId", value = "客户端用户ID", dataType = "Integer", paramType = "query", required = true),
-            @ApiImplicitParam(name = "orderId", value = "订单ID", dataType = "Integer", paramType = "query", required = true)
+            @ApiImplicitParam(name = "clientUserId", value = "客户端用户ID", dataType = "String", paramType = "query", required = true),
+            @ApiImplicitParam(name = "orderId", value = "订单ID", dataType = "String", paramType = "query", required = true)
     })
     @PostMapping("/completeOrder")
-    public R<Boolean> completeOrder(@RequestParam Integer clientUserId, @RequestParam Integer orderId) {
+    public R<Boolean> completeOrder(@RequestParam String clientUserId, @RequestParam String orderId) {
         log.info("LawyerConsultationOrderController.completeOrder?clientUserId={},orderId{}", clientUserId, orderId);
         return consultationOrderService.completeOrder(clientUserId, orderId);
     }

+ 2 - 2
alien-lawyer/src/main/java/shop/alien/lawyer/service/LawyerConsultationOrderService.java

@@ -142,7 +142,7 @@ public interface LawyerConsultationOrderService extends IService<LawyerConsultat
      * @param orderId
      * @return
      */
-    R<Boolean> applyRefund(Integer clientUserId, Integer orderId, String applyRefundReason);
+    R<Boolean> applyRefund(String clientUserId, String orderId, String applyRefundReason);
 
 
     /**
@@ -152,6 +152,6 @@ public interface LawyerConsultationOrderService extends IService<LawyerConsultat
      * @param orderId
      * @return
      */
-    R<Boolean> completeOrder(Integer clientUserId, Integer orderId);
+    R<Boolean> completeOrder(String clientUserId, String orderId);
 }
 

+ 11 - 16
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerConsultationOrderServiceImpl.java

@@ -1366,16 +1366,16 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public R<Boolean> applyRefund(Integer clientUserId, Integer orderId, String applyRefundReason) {
+    public R<Boolean> applyRefund(String clientUserId, String orderId, String applyRefundReason) {
         log.info("开始申请退款,用户ID={}, 订单ID={}", clientUserId, orderId);
 
         // 1. 参数校验
-        if (clientUserId == null || clientUserId <= 0) {
+        if (!StringUtils.hasText(clientUserId)) {
             log.warn("申请退款失败:用户ID为空或无效,clientUserId={}", clientUserId);
             return R.fail("用户ID不能为空");
         }
 
-        if (orderId == null || orderId <= 0) {
+        if (!StringUtils.hasText(orderId)) {
             log.warn("申请退款失败:订单ID为空或无效,orderId={}", orderId);
             return R.fail("订单ID不能为空");
         }
@@ -1388,7 +1388,7 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
         }
 
         // 3. 订单归属校验:订单必须属于该用户
-        if (!clientUserId.equals(order.getClientUserId())) {
+        if (!clientUserId.equals(order.getClientUserId().toString())) {
             log.warn("申请退款失败:订单不属于该用户,订单ID={}, 订单用户ID={}, 请求用户ID={}",
                     orderId, order.getClientUserId(), clientUserId);
             return R.fail("订单不属于该用户,无法申请退款");
@@ -1457,16 +1457,16 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public R<Boolean> completeOrder(Integer clientUserId, Integer orderId) {
+    public R<Boolean> completeOrder(String clientUserId, String orderId) {
         log.info("开始完成订单,用户ID={}, 订单ID={}", clientUserId, orderId);
 
         // 1. 参数校验
-        if (clientUserId == null || clientUserId <= 0) {
+        if (StringUtils.isEmpty(clientUserId)) {
             log.warn("完成订单失败:用户ID为空或无效,clientUserId={}", clientUserId);
             return R.fail("用户ID不能为空");
         }
 
-        if (orderId == null || orderId <= 0) {
+        if (StringUtils.isEmpty(orderId)) {
             log.warn("完成订单失败:订单ID为空或无效,orderId={}", orderId);
             return R.fail("订单ID不能为空");
         }
@@ -1479,7 +1479,7 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
         }
 
         // 3. 订单归属校验:订单必须属于该用户
-        if (!clientUserId.equals(order.getClientUserId())) {
+        if (!clientUserId.equals(order.getClientUserId().toString())) {
             log.warn("完成订单失败:订单不属于该用户,订单ID={}, 订单用户ID={}, 请求用户ID={}",
                     orderId, order.getClientUserId(), clientUserId);
             return R.fail("订单不属于该用户,无法完成订单");
@@ -1539,7 +1539,7 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
      * @param order        订单对象
      * @param clientUserId 客户端用户ID
      */
-    private void sendRefundApplyNotice(LawyerConsultationOrder order, Integer clientUserId) {
+    private void sendRefundApplyNotice(LawyerConsultationOrder order, String clientUserId) {
         try {
             LifeNotice lifeNotice = createRefundApplyNotice(order, clientUserId);
             if (lifeNotice == null) {
@@ -1573,7 +1573,7 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
      * @param clientUserId 客户端用户ID
      * @return 通知对象,如果生成失败返回null
      */
-    private LifeNotice createRefundApplyNotice(LawyerConsultationOrder order, Integer clientUserId) {
+    private LifeNotice createRefundApplyNotice(LawyerConsultationOrder order, String clientUserId) {
         if (order == null || clientUserId == null) {
             log.warn("创建退款申请通知失败,订单或用户ID为空");
             return null;
@@ -1619,12 +1619,7 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
      * @param clientUserId 客户端用户ID
      * @return 接收人ID,格式:user_ + 手机号
      */
-    private String getClientReceiverId(Integer clientUserId) {
-        if (clientUserId == null || clientUserId <= 0) {
-            log.warn("客户端用户ID为空或无效");
-            return null;
-        }
-
+    private String getClientReceiverId(String clientUserId) {
         try {
             LifeUser lifeUser = lifeUserMapper.selectById(clientUserId);
             if (lifeUser != null && org.apache.commons.lang3.StringUtils.isNotEmpty(lifeUser.getUserPhone())) {