|
|
@@ -2192,25 +2192,28 @@ public class OtcTradeOrderServiceImpl implements OtcTradeOrderService {
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public CommonResult<?> createOtcOrder(LoginUser loginUser, TradeOrderOtcCreateVO createVO) {
|
|
|
- Long distributorId = loginUser.getDistributorId();
|
|
|
- Long storeId = loginUser.getStoreId();
|
|
|
+ Long distributorId = createVO.getDistributorId()!=null ? createVO.getDistributorId() :loginUser.getDistributorId();
|
|
|
+ Long storeId = createVO.getStoreId()!=null ? createVO.getStoreId() : loginUser.getStoreId();
|
|
|
//获取当前分销商信息
|
|
|
if(distributorId==null) {
|
|
|
return CommonResult.error(ORDER_OTC_FAIL);
|
|
|
}
|
|
|
- if(storeId==null) {
|
|
|
- return CommonResult.error(ORDER_STORE_FAIL);
|
|
|
- }
|
|
|
+// if(storeId==null) {
|
|
|
+// return CommonResult.error(ORDER_STORE_FAIL);
|
|
|
+// }
|
|
|
//获取当前分销商信息
|
|
|
DistributorDO distributorDO = distributorMapper.selectById(distributorId);
|
|
|
if(distributorDO==null) {
|
|
|
return CommonResult.error(ORDER_OTC_NONE);
|
|
|
}
|
|
|
//获取当前门店
|
|
|
- StoreInfoRespDTO storeInfo = storeApi.getStoreInfo(storeId);
|
|
|
- if(storeInfo==null) {
|
|
|
- return CommonResult.error(ORDER_STORE_NONE);
|
|
|
+ StoreInfoRespDTO storeInfo = null;
|
|
|
+ if(storeId!=null){
|
|
|
+ storeInfo = storeApi.getStoreInfo(storeId);
|
|
|
}
|
|
|
+// if(storeInfo==null) {
|
|
|
+// return CommonResult.error(ORDER_STORE_NONE);
|
|
|
+// }
|
|
|
VoyageRespDTO voyage = productApi.getVoyage(createVO.getVoyageId());
|
|
|
String date = DateUtils.format(new Date(),"yyyyMMddmmss");
|
|
|
String orderNo = distributorDO.getCode()+"-"+voyage.getCode()+"-"+date;
|
|
|
@@ -2239,8 +2242,10 @@ public class OtcTradeOrderServiceImpl implements OtcTradeOrderService {
|
|
|
orderProperty.setSellMethod(SellMethodEnum.OTC.getType());
|
|
|
orderProperty.setSourceId(distributorDO.getId()+"");
|
|
|
orderProperty.setSourceName(distributorDO.getName()+"");
|
|
|
- orderProperty.setStoreId(storeInfo.getId());
|
|
|
- orderProperty.setStoreName(storeInfo.getName()+"");
|
|
|
+ if(storeInfo!=null) {
|
|
|
+ orderProperty.setStoreId(storeInfo.getId());
|
|
|
+ orderProperty.setStoreName(storeInfo.getName() + "");
|
|
|
+ }
|
|
|
orderProperty.setSellMethod(SellMethodEnum.OTC.getType());
|
|
|
|
|
|
shipTradeOrderCreateReqVO.setOrderProperty(orderProperty);
|
|
|
@@ -2401,24 +2406,24 @@ public class OtcTradeOrderServiceImpl implements OtcTradeOrderService {
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public CommonResult<?> motifyOtcOrder(LoginUser loginUser, TradeOrderOtcCreateVO createVO) {
|
|
|
- Long distributorId = loginUser.getDistributorId();
|
|
|
- Long storeId = loginUser.getStoreId();
|
|
|
+ Long distributorId = createVO.getDistributorId()!=null ? createVO.getDistributorId() :loginUser.getDistributorId();
|
|
|
+ Long storeId = createVO.getStoreId()!=null ? createVO.getStoreId() : loginUser.getStoreId();
|
|
|
//获取当前分销商信息
|
|
|
if(distributorId==null) {
|
|
|
return CommonResult.error(ORDER_OTC_FAIL);
|
|
|
}
|
|
|
- if(storeId==null) {
|
|
|
- return CommonResult.error(ORDER_STORE_FAIL);
|
|
|
- }
|
|
|
+// if(storeId==null) {
|
|
|
+// return CommonResult.error(ORDER_STORE_FAIL);
|
|
|
+// }
|
|
|
//获取当前分销商信息
|
|
|
DistributorDO distributorDO = distributorMapper.selectById(distributorId);
|
|
|
if(distributorDO==null) {
|
|
|
return CommonResult.error(ORDER_OTC_NONE);
|
|
|
}
|
|
|
//获取当前门店
|
|
|
- StoreInfoRespDTO storeInfo = storeApi.getStoreInfo(storeId);
|
|
|
- if(storeInfo==null) {
|
|
|
- return CommonResult.error(ORDER_STORE_NONE);
|
|
|
+ StoreInfoRespDTO storeInfo = null;
|
|
|
+ if(storeId!=null) {
|
|
|
+ storeInfo = storeApi.getStoreInfo(storeId);
|
|
|
}
|
|
|
Long orderId = createVO.getOrderId();
|
|
|
TradeOrderDO tradeOrderDO = tradeOrderMapper.selectById(orderId);
|
|
|
@@ -2452,8 +2457,10 @@ public class OtcTradeOrderServiceImpl implements OtcTradeOrderService {
|
|
|
orderProperty.setSellMethod(SellMethodEnum.OTC.getType());
|
|
|
orderProperty.setSourceId(distributorDO.getId()+"");
|
|
|
orderProperty.setSourceName(distributorDO.getName()+"");
|
|
|
- orderProperty.setStoreId(storeInfo.getId());
|
|
|
- orderProperty.setStoreName(storeInfo.getName()+"");
|
|
|
+ if(storeInfo!=null) {
|
|
|
+ orderProperty.setStoreId(storeInfo.getId());
|
|
|
+ orderProperty.setStoreName(storeInfo.getName() + "");
|
|
|
+ }
|
|
|
orderProperty.setSellMethod(SellMethodEnum.OTC.getType());
|
|
|
|
|
|
shipTradeOrderCreateReqVO.setOrderProperty(orderProperty);
|