|
@@ -115,7 +115,7 @@ public class ReportServiceImpl implements ReportService {
|
|
|
|
|
|
/**
|
|
|
* 统计下单量
|
|
|
- * @author lu
|
|
|
+ * @author guokaixiang
|
|
|
* @date 2021/6/10 11:35
|
|
|
* @param queryWxFactoryReq
|
|
|
* @return com.abi.qms.platform.dto.res.QueryWxFactoryRes
|
|
@@ -128,9 +128,17 @@ public class ReportServiceImpl implements ReportService {
|
|
|
if (isMainAccount.equals(0)) {
|
|
|
//子账号报表
|
|
|
//获取现在时间 获取前三个月的时间
|
|
|
- List<QueryWxFactoryVO> queryWxFactoryVO = reportServiceMapper.queryWxFactory(queryWxFactoryReq,getMonth());
|
|
|
- AssertUtil.isNull(queryWxFactoryVO,"报表数据查询为空");
|
|
|
- List<QueryWxFactoryRes.QueryWxFactoryBean> queryWxFactoryBeans = PojoConverterUtils.copyList(queryWxFactoryVO, QueryWxFactoryRes.QueryWxFactoryBean.class);
|
|
|
+ //总量=下单量
|
|
|
+ List<QueryWxFactoryVO> queryWxFactorySumNumber = reportServiceMapper.queryWxFactorySumNumber(queryWxFactoryReq,getMonth());
|
|
|
+ AssertUtil.isNull(queryWxFactorySumNumber,"查询为空!");
|
|
|
+ //激活量
|
|
|
+ List<QueryWxFactoryVO> queryWxFactoryActivationNumber = reportServiceMapper.queryWxFactoryActivationNumber(queryWxFactoryReq,getMonth());
|
|
|
+ Map<String, Long> activationNumberMap = queryWxFactoryActivationNumber.stream().collect(Collectors.toMap(QueryWxFactoryVO::getMarch, QueryWxFactoryVO::getActivation));
|
|
|
+ queryWxFactorySumNumber.forEach(factorySumNumber->{
|
|
|
+ Long aLong = (null == activationNumberMap.get(factorySumNumber.getMarch()) ? 0L : activationNumberMap.get(factorySumNumber.getMarch()));
|
|
|
+ factorySumNumber.setActivation(aLong);
|
|
|
+ });
|
|
|
+ List<QueryWxFactoryRes.QueryWxFactoryBean> queryWxFactoryBeans = PojoConverterUtils.copyList(queryWxFactorySumNumber, QueryWxFactoryRes.QueryWxFactoryBean.class);
|
|
|
queryWxFactoryBeans.forEach(beans->{
|
|
|
beans.setInStock(beans.getTotal() - beans.getActivation());
|
|
|
});
|
|
@@ -138,9 +146,17 @@ public class ReportServiceImpl implements ReportService {
|
|
|
return res;
|
|
|
}
|
|
|
//下单量-激活量-库存
|
|
|
- List<QueryWxFactoryVO> queryWxFactoryVO = reportServiceMapper.queryWxFactory(queryWxFactoryReq,null);
|
|
|
- AssertUtil.isNull(queryWxFactoryVO,"查询为空");
|
|
|
- List<QueryWxFactoryRes.QueryWxFactoryBean> queryWxFactoryBeans = PojoConverterUtils.copyList(queryWxFactoryVO, QueryWxFactoryRes.QueryWxFactoryBean.class);
|
|
|
+ //总量=下单量
|
|
|
+ List<QueryWxFactoryVO> queryWxFactorySumNumber = reportServiceMapper.queryWxFactorySumNumber(queryWxFactoryReq,null);
|
|
|
+ AssertUtil.isNull(queryWxFactorySumNumber,"查询为空!");
|
|
|
+ //激活量
|
|
|
+ List<QueryWxFactoryVO> queryWxFactoryActivationNumber = reportServiceMapper.queryWxFactoryActivationNumber(queryWxFactoryReq,null);
|
|
|
+ Map<String, Long> activationNumberMap = queryWxFactoryActivationNumber.stream().collect(Collectors.toMap(QueryWxFactoryVO::getMarch, QueryWxFactoryVO::getActivation));
|
|
|
+ queryWxFactorySumNumber.forEach(factorySumNumber->{
|
|
|
+ Long aLong = (null == activationNumberMap.get(factorySumNumber.getMarch()) ? 0L : activationNumberMap.get(factorySumNumber.getMarch()));
|
|
|
+ factorySumNumber.setActivation(aLong);
|
|
|
+ });
|
|
|
+ List<QueryWxFactoryRes.QueryWxFactoryBean> queryWxFactoryBeans = PojoConverterUtils.copyList(queryWxFactorySumNumber, QueryWxFactoryRes.QueryWxFactoryBean.class);
|
|
|
Long total = queryWxFactoryBeans.stream().mapToLong(QueryWxFactoryRes.QueryWxFactoryBean::getTotal).sum();
|
|
|
Long activation = queryWxFactoryBeans.stream().mapToLong(QueryWxFactoryRes.QueryWxFactoryBean::getActivation).sum();
|
|
|
Long stock= total-activation;
|