记得上下班打卡 | git大法好,push需谨慎

Commit 3a5ad738 authored by limingyang's avatar limingyang

导入对订单发货

parent 5023a951
...@@ -22,13 +22,29 @@ public class GoblinImportServiceImpl implements IGoblinImportService { ...@@ -22,13 +22,29 @@ public class GoblinImportServiceImpl implements IGoblinImportService {
@Override @Override
public String importExpress(List<OrderMallOrderVo> mallOrdertVoList) { public String importExpress(List<OrderMallOrderVo> mallOrdertVoList) {
if (StringUtils.isNull(mallOrdertVoList) || mallOrdertVoList.size() == 0) { if (StringUtils.isNull(mallOrdertVoList) || mallOrdertVoList.size() == 0) {
throw new BusinessException("导入用户数据不能为空!"); throw new BusinessException("导入数据不能为空!");
} }
int count = 0; int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (OrderMallOrderVo mallOrderVo : mallOrdertVoList) { for (OrderMallOrderVo mallOrderVo : mallOrdertVoList) {
ResponseDto<Boolean> express = iGoblinStoreOrderService.express(mallOrderVo.getOrderCode(), null, mallOrderVo.getMailNo()); ResponseDto<Boolean> express = iGoblinStoreOrderService.express(mallOrderVo.getOrderCode(), null, mallOrderVo.getMailNo());
count++; if (express.getCode().equals("0")) {
successNum++;
successMsg.append("<br/>" + successNum + "、订单编号 " + mallOrderVo.getOrderCode() + " 导入发货成功");
} else {
failureNum++;
String msg = "<br/>" + failureNum + "、订单编号 " + mallOrderVo.getOrderCode() + " 失败原因:";
failureMsg.append(msg + express.getMessage());
}
} }
return String.valueOf(count); if (failureNum > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new BusinessException(failureMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
} }
} }
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