|
@@ -358,22 +358,8 @@ public class ShipServiceImpl implements ShipService {
|
|
|
List<LogisticsRecordVo> recordList = orderCommonMapper.getLogisticsRecord(shopOrderId, batchVo.getId());
|
|
|
if (null != recordList && recordList.size() > 0) {
|
|
|
for (LogisticsRecordVo recordVo : recordList) {
|
|
|
- OrderProductVo orderProduct = shipMapper.getOrderProductById(recordVo.getOrderProductId());
|
|
|
- recordVo.setBuyNum(orderProduct.getNum() + orderProduct.getPresentNum());
|
|
|
- recordVo.setImage(orderProduct.getImage());
|
|
|
- recordVo.setUnit(orderProduct.getProductUnit());
|
|
|
- // 已发货数量
|
|
|
- int shipmentsNum = orderProduct.getNum() + orderProduct.getPresentNum() - orderProduct.getNotOutStore();
|
|
|
- recordVo.setShipmentsNum(shipmentsNum);
|
|
|
- // 已退货数量
|
|
|
- Integer returnedNum = orderCommonMapper.countReturnedNum(orderProduct.getShopOrderId(), orderProduct.getProductId());
|
|
|
- returnedNum = null != returnedNum ? returnedNum : 0;
|
|
|
- recordVo.setReturnedNum(returnedNum);
|
|
|
- // 已取消发货数量
|
|
|
- Integer actualCancelNum = orderCommonMapper.countActualCancelNum(orderProduct.getShopOrderId(), orderProduct.getProductId());
|
|
|
- actualCancelNum = null != actualCancelNum ? actualCancelNum : 0;
|
|
|
- // 未发货数量
|
|
|
- recordVo.setNotShippedNum(orderProduct.getNotOutStore() - actualCancelNum);
|
|
|
+ // 设置 已发,已退,已取消发货数量
|
|
|
+ setLogisticsRecordNum(recordVo);
|
|
|
}
|
|
|
}
|
|
|
batchVo.setLogisticsRecordList(recordList);
|
|
@@ -401,5 +387,71 @@ public class ShipServiceImpl implements ShipService {
|
|
|
return ResponseJson.success(map);
|
|
|
}
|
|
|
|
|
|
+ private void setLogisticsRecordNum(LogisticsRecordVo recordVo) {
|
|
|
+ OrderProductVo orderProduct = shipMapper.getOrderProductById(recordVo.getOrderProductId());
|
|
|
+ recordVo.setBuyNum(orderProduct.getNum() + orderProduct.getPresentNum());
|
|
|
+ recordVo.setImage(orderProduct.getImage());
|
|
|
+ recordVo.setUnit(orderProduct.getProductUnit());
|
|
|
+ // 已发货数量
|
|
|
+ int shipmentsNum = orderProduct.getNum() + orderProduct.getPresentNum() - orderProduct.getNotOutStore();
|
|
|
+ recordVo.setShipmentsNum(shipmentsNum);
|
|
|
+ // 已退货数量
|
|
|
+ Integer returnedNum = orderCommonMapper.countReturnedNum(orderProduct.getShopOrderId(), orderProduct.getProductId());
|
|
|
+ returnedNum = null != returnedNum ? returnedNum : 0;
|
|
|
+ recordVo.setReturnedNum(returnedNum);
|
|
|
+ // 已取消发货数量
|
|
|
+ Integer actualCancelNum = orderCommonMapper.countActualCancelNum(orderProduct.getShopOrderId(), orderProduct.getProductId());
|
|
|
+ actualCancelNum = null != actualCancelNum ? actualCancelNum : 0;
|
|
|
+ // 未发货数量
|
|
|
+ recordVo.setNotShippedNum(orderProduct.getNotOutStore() - actualCancelNum);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 供应商查看物流
|
|
|
+ *
|
|
|
+ * @param shopOrderId 子订单Id
|
|
|
+ * @param logisticsBatchId 发货物流批次Id
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Map<String, Object>> getLogisticsInfo(Integer shopOrderId, Integer logisticsBatchId) {
|
|
|
+ // 发货物流批次
|
|
|
+ LogisticsBatchVo logisticsBatch = shipMapper.getLogisticsBatchById(logisticsBatchId);
|
|
|
+ if (null == logisticsBatch) {
|
|
|
+ return ResponseJson.error("物流异常,logisticsBatchID:" + logisticsBatchId, null);
|
|
|
+ }
|
|
|
+ OrderUserinfoVo userInfo = addressMapper.getOrderUserinfo(logisticsBatch.getOrderId());
|
|
|
+ // 获取发货物流记录
|
|
|
+ List<LogisticsRecordVo> recordList = orderCommonMapper.getLogisticsRecord(shopOrderId, logisticsBatch.getId());
|
|
|
+ if (null != recordList && recordList.size() > 0) {
|
|
|
+ for (LogisticsRecordVo recordVo : recordList) {
|
|
|
+ // 设置 已发,已退,已取消发货数量
|
|
|
+ setLogisticsRecordNum(recordVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 获取物流信息
|
|
|
+ List<LogisticsInformationVo> logisticsInfoList = orderCommonMapper.getLogisticsInfoList(logisticsBatch.getId());
|
|
|
+ logisticsInfoList.forEach(logisticsInfo -> {
|
|
|
+ List<LogisticsRouterVo> routers = JSONArray.parseArray(logisticsInfo.getInfo(), LogisticsRouterVo.class);
|
|
|
+ if (!CollectionUtils.isEmpty(routers)) {
|
|
|
+ routers.forEach(router -> {
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isEmpty(router.getDesc())) {
|
|
|
+ router.setDesc(router.getContext());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ logisticsInfo.setRouterList(routers);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ logisticsBatch.setLogisticsRecordList(recordList);
|
|
|
+ logisticsBatch.setLogisticsInformationList(logisticsInfoList);
|
|
|
+ if (StringUtils.isNotBlank(logisticsBatch.getRemarkImage())) {
|
|
|
+ String[] remarkImages = logisticsBatch.getRemarkImage().split("##");
|
|
|
+ logisticsBatch.setRemarkImages(remarkImages);
|
|
|
+ }
|
|
|
+ Map<String, Object> map = new HashMap<>(2);
|
|
|
+ map.put("userInfo", userInfo);
|
|
|
+ map.put("logisticsBatch", logisticsBatch);
|
|
|
+ return ResponseJson.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|