Commit 185b8418 by wutong

修复SKU不存在导致的异常问题

parent d06f3122
...@@ -11,6 +11,7 @@ import com.bailuntec.domain.pojo.*; ...@@ -11,6 +11,7 @@ import com.bailuntec.domain.pojo.*;
import com.bailuntec.mapper.*; import com.bailuntec.mapper.*;
import com.bailuntec.support.CallBailunSystem; import com.bailuntec.support.CallBailunSystem;
import com.bailuntec.support.PointJob; import com.bailuntec.support.PointJob;
import com.bailuntec.utils.ExceptionUtil;
import com.bailuntec.utils.OkHttpUtil; import com.bailuntec.utils.OkHttpUtil;
import com.bailuntec.utils.PropertiesUtil; import com.bailuntec.utils.PropertiesUtil;
import com.bailuntec.utils.SessionUtil; import com.bailuntec.utils.SessionUtil;
...@@ -56,7 +57,7 @@ public class OrderSyncJob extends PointJob { ...@@ -56,7 +57,7 @@ public class OrderSyncJob extends PointJob {
response = okHttpClient.newCall(request).execute(); response = okHttpClient.newCall(request).execute();
omsResultStr = response.body().string(); omsResultStr = response.body().string();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(map + "请求OMS接口同步百伦接口失败" + response, e); throw new RuntimeException(ExceptionUtil.transform(e),e);
} finally { } finally {
if (response != null) { if (response != null) {
response.close(); response.close();
...@@ -84,7 +85,7 @@ public class OrderSyncJob extends PointJob { ...@@ -84,7 +85,7 @@ public class OrderSyncJob extends PointJob {
mapper.upsertSelective(jobPointLog); mapper.upsertSelective(jobPointLog);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("Mybatis操作DB插入任务记录失败", e); throw new RuntimeException(ExceptionUtil.transform(e), e);
} finally { } finally {
SessionUtil.closeSession(); SessionUtil.closeSession();
} }
...@@ -306,7 +307,7 @@ public class OrderSyncJob extends PointJob { ...@@ -306,7 +307,7 @@ public class OrderSyncJob extends PointJob {
BigDecimal rmbCost = BigDecimal.ZERO; BigDecimal rmbCost = BigDecimal.ZERO;
BigDecimal skuAmountGeneralCargo = BigDecimal.ZERO; BigDecimal skuAmountGeneralCargo = BigDecimal.ZERO;
//货值= 售价-物流-平台费,只有普货才算货值, 不发货也算货值-- 这里放单个SKU的货值 //货值= 售价-物流-平台费,只有普货才算货值, 不发货也算货值-- 这里放单个SKU的货值
if (bailunSkuStructure.getGeneralCargo()) { if (bailunSkuStructure.getGeneralCargo() != null && bailunSkuStructure.getGeneralCargo()) {
skuAmountGeneralCargo = skuAmountProductRMB.subtract(skuCostLogistics).subtract(skuCostPlatformFeeRMB); skuAmountGeneralCargo = skuAmountProductRMB.subtract(skuCostLogistics).subtract(skuCostPlatformFeeRMB);
totalAmountGeneralCargo = totalAmountGeneralCargo.add(skuAmountGeneralCargo); totalAmountGeneralCargo = totalAmountGeneralCargo.add(skuAmountGeneralCargo);
} }
...@@ -433,7 +434,8 @@ public class OrderSyncJob extends PointJob { ...@@ -433,7 +434,8 @@ public class OrderSyncJob extends PointJob {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("Mybatis操作DB失败" + e.getCause().getMessage(), e); e.printStackTrace();
throw new RuntimeException(ExceptionUtil.transform(e), e);
} finally { } finally {
SessionUtil.closeSession(); SessionUtil.closeSession();
} }
...@@ -598,7 +600,7 @@ public class OrderSyncJob extends PointJob { ...@@ -598,7 +600,7 @@ public class OrderSyncJob extends PointJob {
// DcBaseCrmRefundMapper crmRefundMapper = SessionUtil.getSession().getMapper(DcBaseCrmRefundMapper.class); // DcBaseCrmRefundMapper crmRefundMapper = SessionUtil.getSession().getMapper(DcBaseCrmRefundMapper.class);
// crmRefundMapper.updateLinked(dcBaseOmsOrder.getOriginOrderId(), dcBaseOmsOrder.getBailunAccountId()); // crmRefundMapper.updateLinked(dcBaseOmsOrder.getOriginOrderId(), dcBaseOmsOrder.getBailunAccountId());
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("Mybatis操作DB失败", e); throw new RuntimeException(ExceptionUtil.transform(e), e);
} finally { } finally {
SessionUtil.closeSession(); SessionUtil.closeSession();
} }
...@@ -711,7 +713,7 @@ public class OrderSyncJob extends PointJob { ...@@ -711,7 +713,7 @@ public class OrderSyncJob extends PointJob {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("MYBATIS操作DB查询仓库信息失败", e); throw new RuntimeException(ExceptionUtil.transform(e), e);
} finally { } finally {
SessionUtil.closeSession(); SessionUtil.closeSession();
} }
...@@ -805,7 +807,7 @@ public class OrderSyncJob extends PointJob { ...@@ -805,7 +807,7 @@ public class OrderSyncJob extends PointJob {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("MYBATIS操作DB失败", e); throw new RuntimeException(ExceptionUtil.transform(e), e);
} finally { } finally {
SessionUtil.closeSession(); SessionUtil.closeSession();
} }
...@@ -851,7 +853,7 @@ public class OrderSyncJob extends PointJob { ...@@ -851,7 +853,7 @@ public class OrderSyncJob extends PointJob {
skuProductInfo = dcBaseSkuMapper.selectOneByExample(DcBaseSkuExample.newAndCreateCriteria().andBailunSkuEqualTo(bailunSku.getBailunSku()).example()); skuProductInfo = dcBaseSkuMapper.selectOneByExample(DcBaseSkuExample.newAndCreateCriteria().andBailunSkuEqualTo(bailunSku.getBailunSku()).example());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("MYBATIS查询DB失败"); throw new RuntimeException(ExceptionUtil.transform(e),e);
} finally { } finally {
SessionUtil.closeSession(); SessionUtil.closeSession();
} }
......
...@@ -73,7 +73,7 @@ public class OmsOrderTest { ...@@ -73,7 +73,7 @@ public class OmsOrderTest {
LinkedHashMap<String, String> map = new LinkedHashMap<>(4); LinkedHashMap<String, String> map = new LinkedHashMap<>(4);
map.put("pageIndex", "1"); map.put("pageIndex", "1");
map.put("pageCount", "100"); map.put("pageCount", "100");
map.put("OriginOrderNo", "163763969786-1879402896006"); map.put("OriginOrderNo", "402-0458942-3060306");
Request request = new Request.Builder() Request request = new Request.Builder()
.get() .get()
.url(OkHttpUtil.attachHttpGetParams("http://oms.bailuntec.com/apiV2/bailunOrder/getBailunOrders", map)) .url(OkHttpUtil.attachHttpGetParams("http://oms.bailuntec.com/apiV2/bailunOrder/getBailunOrders", map))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment