diff --git a/mall-admin/src/main/java/com/macro/mall/controller/OmsOrderController.java b/mall-admin/src/main/java/com/macro/mall/controller/OmsOrderController.java index 8ede325..11f1fcb 100644 --- a/mall-admin/src/main/java/com/macro/mall/controller/OmsOrderController.java +++ b/mall-admin/src/main/java/com/macro/mall/controller/OmsOrderController.java @@ -94,4 +94,17 @@ public class OmsOrderController { } return new CommonResult().failed(); } + + @ApiOperation("备注订单") + @RequestMapping(value = "/update/note", method = RequestMethod.POST) + @ResponseBody + public Object updateNote(@RequestParam("id") Long id, + @RequestParam("note") String note, + @RequestParam("status") Integer status) { + int count = orderService.updateNote(id,note,status); + if (count > 0) { + return new CommonResult().success(count); + } + return new CommonResult().failed(); + } } diff --git a/mall-admin/src/main/java/com/macro/mall/dto/OmsMoneyInfoParam.java b/mall-admin/src/main/java/com/macro/mall/dto/OmsMoneyInfoParam.java index 61db6f1..8d4125f 100644 --- a/mall-admin/src/main/java/com/macro/mall/dto/OmsMoneyInfoParam.java +++ b/mall-admin/src/main/java/com/macro/mall/dto/OmsMoneyInfoParam.java @@ -15,4 +15,5 @@ public class OmsMoneyInfoParam { private Long orderId; private BigDecimal freightAmount; private BigDecimal discountAmount; + private Integer status; } diff --git a/mall-admin/src/main/java/com/macro/mall/dto/OmsReceiverInfoParam.java b/mall-admin/src/main/java/com/macro/mall/dto/OmsReceiverInfoParam.java index b16c09f..773f314 100644 --- a/mall-admin/src/main/java/com/macro/mall/dto/OmsReceiverInfoParam.java +++ b/mall-admin/src/main/java/com/macro/mall/dto/OmsReceiverInfoParam.java @@ -18,4 +18,5 @@ public class OmsReceiverInfoParam { private String receiverProvince; private String receiverCity; private String receiverRegion; + private Integer status; } diff --git a/mall-admin/src/main/java/com/macro/mall/service/OmsOrderService.java b/mall-admin/src/main/java/com/macro/mall/service/OmsOrderService.java index 610ef31..86abe71 100644 --- a/mall-admin/src/main/java/com/macro/mall/service/OmsOrderService.java +++ b/mall-admin/src/main/java/com/macro/mall/service/OmsOrderService.java @@ -41,10 +41,18 @@ public interface OmsOrderService { /** * 修改订单收货人信息 */ + @Transactional int updateReceiverInfo(OmsReceiverInfoParam receiverInfoParam); /** * 修改订单费用信息 */ + @Transactional int updateMoneyInfo(OmsMoneyInfoParam moneyInfoParam); + + /** + * 修改订单备注 + */ + @Transactional + int updateNote(Long id, String note, Integer status); } diff --git a/mall-admin/src/main/java/com/macro/mall/service/impl/OmsOrderServiceImpl.java b/mall-admin/src/main/java/com/macro/mall/service/impl/OmsOrderServiceImpl.java index 7c1b952..d552526 100644 --- a/mall-admin/src/main/java/com/macro/mall/service/impl/OmsOrderServiceImpl.java +++ b/mall-admin/src/main/java/com/macro/mall/service/impl/OmsOrderServiceImpl.java @@ -5,6 +5,7 @@ import com.macro.mall.dao.OmsOrderDao; import com.macro.mall.dao.OmsOrderOperateHistoryDao; import com.macro.mall.dto.*; import com.macro.mall.mapper.OmsOrderMapper; +import com.macro.mall.mapper.OmsOrderOperateHistoryMapper; import com.macro.mall.model.OmsOrder; import com.macro.mall.model.OmsOrderExample; import com.macro.mall.model.OmsOrderOperateHistory; @@ -28,6 +29,8 @@ public class OmsOrderServiceImpl implements OmsOrderService { private OmsOrderDao orderDao; @Autowired private OmsOrderOperateHistoryDao orderOperateHistoryDao; + @Autowired + private OmsOrderOperateHistoryMapper orderOperateHistoryMapper; @Override public List list(OmsOrderQueryParam queryParam, Integer pageSize, Integer pageNum) { @@ -100,7 +103,16 @@ public class OmsOrderServiceImpl implements OmsOrderService { order.setReceiverCity(receiverInfoParam.getReceiverCity()); order.setReceiverRegion(receiverInfoParam.getReceiverRegion()); order.setModifyTime(new Date()); - return orderMapper.updateByPrimaryKeySelective(order); + int count = orderMapper.updateByPrimaryKeySelective(order); + //插入操作记录 + OmsOrderOperateHistory history = new OmsOrderOperateHistory(); + history.setOrderId(receiverInfoParam.getOrderId()); + history.setCreateTime(new Date()); + history.setOperateMan("后台管理员"); + history.setOrderStatus(receiverInfoParam.getStatus()); + history.setNote("修改收货人信息"); + orderOperateHistoryMapper.insert(history); + return count; } @Override @@ -110,6 +122,32 @@ public class OmsOrderServiceImpl implements OmsOrderService { order.setFreightAmount(moneyInfoParam.getFreightAmount()); order.setDiscountAmount(moneyInfoParam.getDiscountAmount()); order.setModifyTime(new Date()); - return orderMapper.updateByPrimaryKeySelective(order); + int count = orderMapper.updateByPrimaryKeySelective(order); + //插入操作记录 + OmsOrderOperateHistory history = new OmsOrderOperateHistory(); + history.setOrderId(moneyInfoParam.getOrderId()); + history.setCreateTime(new Date()); + history.setOperateMan("后台管理员"); + history.setOrderStatus(moneyInfoParam.getStatus()); + history.setNote("修改费用信息"); + orderOperateHistoryMapper.insert(history); + return count; + } + + @Override + public int updateNote(Long id, String note, Integer status) { + OmsOrder order = new OmsOrder(); + order.setId(id); + order.setNote(note); + order.setModifyTime(new Date()); + int count = orderMapper.updateByPrimaryKeySelective(order); + OmsOrderOperateHistory history = new OmsOrderOperateHistory(); + history.setOrderId(id); + history.setCreateTime(new Date()); + history.setOperateMan("后台管理员"); + history.setOrderStatus(status); + history.setNote("修改备注信息:"+note); + orderOperateHistoryMapper.insert(history); + return count; } }