OrderHandleController.java 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package com.sd.wln.controller;
  2. import com.ruoyi.common.exception.ServiceException;
  3. import com.sd.wln.entity.ResynchronizationDto;
  4. import com.sd.wln.service.*;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.web.bind.annotation.PostMapping;
  7. import org.springframework.web.bind.annotation.RequestBody;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.RestController;
  10. @RestController
  11. @RequestMapping("/orderHandle")
  12. public class OrderHandleController {
  13. @Autowired
  14. private OrderHandleService orderHandleService;
  15. @Autowired
  16. private WlnStatementOfAccount wlnStatementOfAccount;
  17. @Autowired
  18. private WlnSkuService wlnSkuService;
  19. @Autowired
  20. private WlnSalesReturnStockInService wlnSalesReturnStockInService;
  21. /**
  22. * 重新同步订单
  23. */
  24. @PostMapping("/resynchronization")
  25. public void resynchronization(@RequestBody ResynchronizationDto dto) {
  26. orderHandleService.resynchronization(dto);
  27. }
  28. /**
  29. * 生成对账单
  30. */
  31. @PostMapping("/createStatementOfAccount")
  32. public void createStatementOfAccount() {
  33. wlnStatementOfAccount.createStatementOfAccount();
  34. }
  35. /**
  36. * 批量同步订单
  37. */
  38. @PostMapping("/bathSyncOrder")
  39. public void bathSyncOrder() {
  40. orderHandleService.bathSyncOrder();
  41. }
  42. /**
  43. * 同步sku
  44. */
  45. @PostMapping("/syncSku")
  46. public void syncSku() {
  47. if (WlnSkuService.syncSkuLock.tryLock()) {
  48. try {
  49. wlnSkuService.syncSkuClassify();
  50. wlnSkuService.syncSku();
  51. } finally {
  52. WlnSkuService.syncSkuLock.unlock();
  53. }
  54. } else {
  55. throw new ServiceException("sku正在同步中,请勿重复操作");
  56. }
  57. }
  58. /**
  59. * 同步万里牛售后单数据
  60. */
  61. @PostMapping("/resynchronizationReturnOrder")
  62. public void resynchronizationReturnOrder() {
  63. wlnSalesReturnStockInService.syncSalesReturnStockIn();
  64. }
  65. }