5 changed files with 97 additions and 4 deletions
@ -0,0 +1,73 @@
|
||||
package com.logpm.patch.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
||||
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; |
||||
import com.logpm.patch.dto.SyncInventoryDTO; |
||||
import com.logpm.patch.entity.SyncInventoryEntity; |
||||
import com.logpm.patch.service.ISyncOrderInfoService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.common.exception.CustomerException; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.util.Objects; |
||||
|
||||
@Slf4j |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/syncOrderInfo") |
||||
@Api(value = "同步订单信息控制器", tags = "同步订单信息接口") |
||||
public class SyncOrderInfoController { |
||||
|
||||
private final IBasicdataWarehouseClient warehouseClient; |
||||
private final ISyncOrderInfoService syncOrderInfoService; |
||||
|
||||
@ResponseBody |
||||
@PostMapping("/syncOrder") |
||||
@ApiOperationSupport(order = 2) |
||||
@ApiOperation(value = "分页", notes = "传入disStockListDetail") |
||||
public R<IPage<SyncInventoryEntity>> syncOrder(@RequestBody SyncInventoryDTO syncInventoryDTO) { |
||||
String method = "############syncOrder: "; |
||||
|
||||
try{ |
||||
String orderCodes = syncInventoryDTO.getOrderCodes(); |
||||
|
||||
if(StringUtil.isBlank(orderCodes)){ |
||||
log.warn(method+"订单号不能为空 orderCodes={}",orderCodes); |
||||
return R.fail(403,"订单号不能为空"); |
||||
} |
||||
|
||||
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
||||
if(Objects.isNull(myCurrentWarehouse)){ |
||||
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); |
||||
return R.fail(403,"仓库信息为空"); |
||||
} |
||||
|
||||
String[] split = orderCodes.split(","); |
||||
|
||||
List<String> orderCodeList = new ArrayList<>(Arrays.asList(split)); |
||||
|
||||
syncOrderInfoService.handleData(orderCodeList,myCurrentWarehouse.getOldId(),myCurrentWarehouse.getId(),null); |
||||
|
||||
return R.success("拉取成功"); |
||||
}catch (CustomerException e){ |
||||
log.warn(e.message); |
||||
return R.fail(e.code,e.message); |
||||
}catch (Exception e){ |
||||
log.error(method+"系统异常,联系管理员",e); |
||||
return R.fail(500,"系统异常,联系管理员"); |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue