Parcourir la source

订单修改接口添加

zhh il y a 6 ans
Parent
commit
b71ae01aed

+ 23 - 4
mall-admin/src/main/java/com/macro/mall/controller/OmsOrderController.java

@@ -1,9 +1,6 @@
 package com.macro.mall.controller;
 
-import com.macro.mall.dto.CommonResult;
-import com.macro.mall.dto.OmsOrderDeliveryParam;
-import com.macro.mall.dto.OmsOrderDetail;
-import com.macro.mall.dto.OmsOrderQueryParam;
+import com.macro.mall.dto.*;
 import com.macro.mall.model.OmsOrder;
 import com.macro.mall.service.OmsOrderService;
 import io.swagger.annotations.Api;
@@ -75,4 +72,26 @@ public class OmsOrderController {
         OmsOrderDetail orderDetailResult = orderService.detail(id);
         return new CommonResult().success(orderDetailResult);
     }
+
+    @ApiOperation("修改收货人信息")
+    @RequestMapping(value = "/update/receiverInfo", method = RequestMethod.POST)
+    @ResponseBody
+    public Object updateReceiverInfo(@RequestBody OmsReceiverInfoParam receiverInfoParam) {
+        int count = orderService.updateReceiverInfo(receiverInfoParam);
+        if (count > 0) {
+            return new CommonResult().success(count);
+        }
+        return new CommonResult().failed();
+    }
+
+    @ApiOperation("修改订单费用信息")
+    @RequestMapping(value = "/update/moneyInfo", method = RequestMethod.POST)
+    @ResponseBody
+    public Object updateReceiverInfo(@RequestBody OmsMoneyInfoParam moneyInfoParam) {
+        int count = orderService.updateMoneyInfo(moneyInfoParam);
+        if (count > 0) {
+            return new CommonResult().success(count);
+        }
+        return new CommonResult().failed();
+    }
 }

+ 18 - 0
mall-admin/src/main/java/com/macro/mall/dto/OmsMoneyInfoParam.java

@@ -0,0 +1,18 @@
+package com.macro.mall.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * 修改订单费用信息参数
+ * Created by macro on 2018/10/29.
+ */
+@Getter
+@Setter
+public class OmsMoneyInfoParam {
+    private Long orderId;
+    private BigDecimal freightAmount;
+    private BigDecimal discountAmount;
+}

+ 21 - 0
mall-admin/src/main/java/com/macro/mall/dto/OmsReceiverInfoParam.java

@@ -0,0 +1,21 @@
+package com.macro.mall.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 订单修改收货人信息参数
+ * Created by macro on 2018/10/29.
+ */
+@Getter
+@Setter
+public class OmsReceiverInfoParam {
+    private Long orderId;
+    private String receiverName;
+    private String receiverPhone;
+    private String receiverPostCode;
+    private String receiverDetailAddress;
+    private String receiverProvince;
+    private String receiverCity;
+    private String receiverRegion;
+}

+ 11 - 3
mall-admin/src/main/java/com/macro/mall/service/OmsOrderService.java

@@ -1,8 +1,6 @@
 package com.macro.mall.service;
 
-import com.macro.mall.dto.OmsOrderDeliveryParam;
-import com.macro.mall.dto.OmsOrderDetail;
-import com.macro.mall.dto.OmsOrderQueryParam;
+import com.macro.mall.dto.*;
 import com.macro.mall.model.OmsOrder;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -39,4 +37,14 @@ public interface OmsOrderService {
      * 获取指定订单详情
      */
     OmsOrderDetail detail(Long id);
+
+    /**
+     * 修改订单收货人信息
+     */
+    int updateReceiverInfo(OmsReceiverInfoParam receiverInfoParam);
+
+    /**
+     * 修改订单费用信息
+     */
+    int updateMoneyInfo(OmsMoneyInfoParam moneyInfoParam);
 }

+ 26 - 3
mall-admin/src/main/java/com/macro/mall/service/impl/OmsOrderServiceImpl.java

@@ -3,9 +3,7 @@ package com.macro.mall.service.impl;
 import com.github.pagehelper.PageHelper;
 import com.macro.mall.dao.OmsOrderDao;
 import com.macro.mall.dao.OmsOrderOperateHistoryDao;
-import com.macro.mall.dto.OmsOrderDeliveryParam;
-import com.macro.mall.dto.OmsOrderDetail;
-import com.macro.mall.dto.OmsOrderQueryParam;
+import com.macro.mall.dto.*;
 import com.macro.mall.mapper.OmsOrderMapper;
 import com.macro.mall.model.OmsOrder;
 import com.macro.mall.model.OmsOrderExample;
@@ -89,4 +87,29 @@ public class OmsOrderServiceImpl implements OmsOrderService {
     public OmsOrderDetail detail(Long id) {
         return orderDao.getDetail(id);
     }
+
+    @Override
+    public int updateReceiverInfo(OmsReceiverInfoParam receiverInfoParam) {
+        OmsOrder order = new OmsOrder();
+        order.setId(receiverInfoParam.getOrderId());
+        order.setReceiverName(receiverInfoParam.getReceiverName());
+        order.setReceiverPhone(receiverInfoParam.getReceiverPhone());
+        order.setReceiverPostCode(receiverInfoParam.getReceiverPostCode());
+        order.setReceiverDetailAddress(receiverInfoParam.getReceiverDetailAddress());
+        order.setReceiverProvince(receiverInfoParam.getReceiverProvince());
+        order.setReceiverCity(receiverInfoParam.getReceiverCity());
+        order.setReceiverRegion(receiverInfoParam.getReceiverRegion());
+        order.setModifyTime(new Date());
+        return orderMapper.updateByPrimaryKeySelective(order);
+    }
+
+    @Override
+    public int updateMoneyInfo(OmsMoneyInfoParam moneyInfoParam) {
+        OmsOrder order = new OmsOrder();
+        order.setId(moneyInfoParam.getOrderId());
+        order.setFreightAmount(moneyInfoParam.getFreightAmount());
+        order.setDiscountAmount(moneyInfoParam.getDiscountAmount());
+        order.setModifyTime(new Date());
+        return orderMapper.updateByPrimaryKeySelective(order);
+    }
 }