|
@@ -1,10 +1,13 @@
|
|
|
package cn.newfeifan.mall.sale.service.merchant;
|
|
|
|
|
|
import cn.newfeifan.mall.framework.common.pojo.PageResult;
|
|
|
+import cn.newfeifan.mall.module.product.service.sku.ProductSkuService;
|
|
|
import cn.newfeifan.mall.module.system.dal.dataobject.user.AdminUserDO;
|
|
|
import cn.newfeifan.mall.module.system.dal.mysql.user.AdminUserMapper;
|
|
|
import cn.newfeifan.mall.module.system.service.user.AdminUserService;
|
|
|
+import cn.newfeifan.mall.module.trade.service.order.TradeOrderQueryService;
|
|
|
import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantPageReqVO;
|
|
|
+import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantRespVO;
|
|
|
import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantSaveReqVO;
|
|
|
import cn.newfeifan.mall.sale.controller.admin.shop.vo.ShopSaveReqVO;
|
|
|
import cn.newfeifan.mall.sale.dal.dataobject.merchant.MerchantDO;
|
|
@@ -20,7 +23,11 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
import static cn.newfeifan.mall.module.enums.ErrorCodeConstants.MERCHANT_NOT_EXISTS;
|
|
@@ -61,7 +68,7 @@ public class MerchantServiceImpl implements MerchantService {
|
|
|
if (adminUserDO != null) {
|
|
|
throw exception(USER_MOBILE_EXISTS);
|
|
|
}
|
|
|
- adminUserService.createUserByMobile(merchant.getId(),shopId, merchant.getContactNumber(), merchant.getContact());
|
|
|
+ adminUserService.createUserByMobile(merchant.getId(), shopId, merchant.getContactNumber(), merchant.getContact());
|
|
|
// todo 设置直推人关联关系
|
|
|
HashMap<String, Long> stringLongHashMap = new HashMap<>();
|
|
|
stringLongHashMap.put("shopId", shopId);
|
|
@@ -102,4 +109,25 @@ public class MerchantServiceImpl implements MerchantService {
|
|
|
return merchantMapper.selectPage(pageReqVO);
|
|
|
}
|
|
|
|
|
|
+ @Resource
|
|
|
+ private TradeOrderQueryService tradeOrderQueryService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ProductSkuService productSkuService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<MerchantRespVO> salesVolume(Map<Long, MerchantRespVO> map) {
|
|
|
+
|
|
|
+ for (Long key : map.keySet()) {
|
|
|
+ System.out.println("Key = " + key);
|
|
|
+ MerchantRespVO value = map.get(key);
|
|
|
+ Integer saleVolume = tradeOrderQueryService.getShopSalesVolume(key);
|
|
|
+ Integer skuCount = productSkuService.getSkuCount(key);
|
|
|
+ value.setSalesVolume(saleVolume);
|
|
|
+ value.setSkuCount(skuCount);
|
|
|
+ map.put(key, value);
|
|
|
+ }
|
|
|
+ return new ArrayList<>(map.values());
|
|
|
+ }
|
|
|
+
|
|
|
}
|