Sfoglia il codice sorgente

修改微信统计,主账户统计全部,子账户统计当前登录人的已激活

luyanwen-001 3 anni fa
parent
commit
4ef89354a7

+ 6 - 3
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/mapper/ReportServiceMapper.java

@@ -62,16 +62,19 @@ public interface ReportServiceMapper  {
      * @param req
      * @return java.util.List<com.abi.qms.platform.dao.vo.result.QueryWxFactoryVO>
      */
-    List<QueryWxFactoryVO> queryWxFactorySumNumber(@Param("req") QueryWxFactoryReq req, @Param("month") LocalDateTime month);
+    List<QueryWxFactoryVO> queryWxFactorySumNumber(@Param("req") QueryWxFactoryReq req,
+                                                   @Param("month") LocalDateTime month);
 
     /**
-     * 统计下载
+     * 统计激活
      * @author lu
      * @date 2021/6/10 11:36
      * @param req
      * @return java.util.List<com.abi.qms.platform.dao.vo.result.QueryWxFactoryVO>
      */
-    List<QueryWxFactoryVO> queryWxFactoryActivationNumber(@Param("req") QueryWxFactoryReq req, @Param("month") LocalDateTime month);
+    List<QueryWxFactoryVO> queryWxFactoryActivationNumber(@Param("req") QueryWxFactoryReq req,
+                                                          @Param("month") LocalDateTime month,
+                                                          @Param("userId") Long userId);
 
 
 }

+ 3 - 2
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/impl/ReportServiceImpl.java

@@ -122,6 +122,7 @@ public class ReportServiceImpl implements ReportService {
      */
     @Override
     public QueryWxFactoryRes queryWxFactory(QueryWxFactoryReq queryWxFactoryReq) {
+        Long id = userUtil.getUser().getId();
         // 是小程序用户主账号 1-是 0-不是
         Integer isMainAccount = userUtil.getWholeUser().getIsMainAccount();
         QueryWxFactoryRes res = new QueryWxFactoryRes();
@@ -135,7 +136,7 @@ public class ReportServiceImpl implements ReportService {
             List<QueryWxFactoryVO> queryWxFactorySumNumber = reportServiceMapper.queryWxFactorySumNumber(queryWxFactoryReq,getMonth());
             Map<String, Long> sumNumberMap = queryWxFactorySumNumber.stream().collect(Collectors.toMap(QueryWxFactoryVO::getMonth, QueryWxFactoryVO::getTotal));
             //激活量
-            List<QueryWxFactoryVO> queryWxFactoryActivationNumber = reportServiceMapper.queryWxFactoryActivationNumber(queryWxFactoryReq,getMonth());
+            List<QueryWxFactoryVO> queryWxFactoryActivationNumber = reportServiceMapper.queryWxFactoryActivationNumber(queryWxFactoryReq,getMonth(),id);
             Map<String, Long> activationNumberMap = queryWxFactoryActivationNumber.stream().collect(Collectors.toMap(QueryWxFactoryVO::getMonth, QueryWxFactoryVO::getActivation));
             //信息汇总
             queryWxFactorySumSummary.forEach(factorySumNumber->{
@@ -161,7 +162,7 @@ public class ReportServiceImpl implements ReportService {
         List<QueryWxFactoryVO> queryWxFactorySumNumber = reportServiceMapper.queryWxFactorySumNumber(queryWxFactoryReq,null);
         AssertUtil.isNull(queryWxFactorySumNumber,"查询为空!");
         //激活量
-        List<QueryWxFactoryVO> queryWxFactoryActivationNumber = reportServiceMapper.queryWxFactoryActivationNumber(queryWxFactoryReq,null);
+        List<QueryWxFactoryVO> queryWxFactoryActivationNumber = reportServiceMapper.queryWxFactoryActivationNumber(queryWxFactoryReq,null,null);
         Map<String, Long> activationNumberMap = queryWxFactoryActivationNumber.stream().collect(Collectors.toMap(QueryWxFactoryVO::getMonth, QueryWxFactoryVO::getActivation));
         queryWxFactorySumNumber.forEach(factorySumNumber->{
             Long aLong = (null == activationNumberMap.get(factorySumNumber.getMonth()) ? 0L : activationNumberMap.get(factorySumNumber.getMonth()));

+ 3 - 0
abi-cloud-qr-platform-server/src/main/resources/dao/mapper/ReportServiceMapper.xml

@@ -113,6 +113,9 @@
             <if test="null != month">
                 AND #{month} <![CDATA[<=]]> qpackage.create_time
             </if>
+            <if test="null != userId">
+                and mapping.active_user_id = #{userId}
+            </if>
         </where>
         GROUP BY `month`
         ORDER BY `month`