package com.sd.wln.controller; import com.ruoyi.common.exception.ServiceException; import com.sd.wln.entity.ResynchronizationDto; import com.sd.wln.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/orderHandle") public class OrderHandleController { @Autowired private OrderHandleService orderHandleService; @Autowired private WlnStatementOfAccount wlnStatementOfAccount; @Autowired private WlnSkuService wlnSkuService; @Autowired private WlnSalesReturnStockInService wlnSalesReturnStockInService; /** * 重新同步订单 */ @PostMapping("/resynchronization") public void resynchronization(@RequestBody ResynchronizationDto dto) { orderHandleService.resynchronization(dto); } /** * 生成对账单 */ @PostMapping("/createStatementOfAccount") public void createStatementOfAccount() { wlnStatementOfAccount.createStatementOfAccount(); } /** * 批量同步订单 */ @PostMapping("/bathSyncOrder") public void bathSyncOrder() { orderHandleService.bathSyncOrder(); } /** * 同步sku */ @PostMapping("/syncSku") public void syncSku() { if (WlnSkuService.syncSkuLock.tryLock()) { try { wlnSkuService.syncSkuClassify(); wlnSkuService.syncSku(); } finally { WlnSkuService.syncSkuLock.unlock(); } } else { throw new ServiceException("sku正在同步中,请勿重复操作"); } } /** * 同步万里牛售后单数据 */ @PostMapping("/resynchronizationReturnOrder") public void resynchronizationReturnOrder() { wlnSalesReturnStockInService.syncSalesReturnStockIn(); } }