|
@@ -13,7 +13,9 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Description
|
|
@@ -133,4 +135,47 @@ public class OrderSellerServiceImpl implements OrderSellerService {
|
|
|
return ResponseJson.success(pageInfo);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取协销各状态订单数量
|
|
|
+ *
|
|
|
+ * @param serviceProviderId 协销Id
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Map<String, Object>> getSellerOrderCount(Integer serviceProviderId) {
|
|
|
+ Map<String, Object> map = new HashMap<>(7);
|
|
|
+ // 获取协销用户下的机构ID列表
|
|
|
+ List<Integer> clubUserIds = orderSellerMapper.getClubIdsBySellerId(serviceProviderId);
|
|
|
+ // 1.全部数量
|
|
|
+ Integer totalCount = orderSellerMapper.getSellerOrderCount(clubUserIds, 0);
|
|
|
+ map.put("totalCount", totalCount);
|
|
|
+ // 2.待确认数量
|
|
|
+ Integer confirmedCount = orderSellerMapper.getSellerOrderCount(clubUserIds, 1);
|
|
|
+ map.put("confirmedCount", confirmedCount);
|
|
|
+ // 3.待付款数量
|
|
|
+ Integer paymentCount = orderSellerMapper.getSellerOrderCount(clubUserIds, 2);
|
|
|
+ paymentCount = paymentCount == null ? 0 : paymentCount;
|
|
|
+ map.put("paymentCount", paymentCount);
|
|
|
+ // 4.待发货数量
|
|
|
+ Integer waitShipmentsCount = orderSellerMapper.getSellerOrderCount(clubUserIds, 3);
|
|
|
+ waitShipmentsCount = waitShipmentsCount == null ? 0 : waitShipmentsCount;
|
|
|
+ map.put("waitShipmentsCount", waitShipmentsCount);
|
|
|
+ // 5.已发货数量
|
|
|
+ Integer shipmentsCount = orderSellerMapper.getSellerOrderCount(clubUserIds, 4);
|
|
|
+ shipmentsCount = shipmentsCount == null ? 0 : shipmentsCount;
|
|
|
+ map.put("shipmentsCount", shipmentsCount);
|
|
|
+ // 6.退货款数量
|
|
|
+ Integer salesReturnCount = orderSellerMapper.getSellerOrderCount(clubUserIds, 5);
|
|
|
+ salesReturnCount = salesReturnCount == null ? 0 : salesReturnCount;
|
|
|
+ map.put("salesReturnCount", salesReturnCount);
|
|
|
+ // 7.未查看订单数量
|
|
|
+ int uncheckedOrderCount = 0;
|
|
|
+ for (Integer userId : clubUserIds) {
|
|
|
+ // 最后查看订单时间
|
|
|
+ Date lastCheckOrderDate = orderSellerMapper.getLastCheckOrderDate(userId);
|
|
|
+ Integer i = orderSellerMapper.getUncheckedOrderCount(userId, lastCheckOrderDate);
|
|
|
+ if (null != i) {uncheckedOrderCount += i;}
|
|
|
+ }
|
|
|
+ map.put("uncheckedOrderCount", uncheckedOrderCount);
|
|
|
+ return ResponseJson.success(map);
|
|
|
+ }
|
|
|
}
|