Ver código fonte

Merge branch 'feature/1.0.0' of github.com:ab-inbev-apac/abi-cloud-qr-platform into feature/1.0.0

tanzhongran 3 anos atrás
pai
commit
36bc773c20

+ 1 - 1
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/mapper/QrBoxMappingMapper.java

@@ -63,7 +63,7 @@ public interface QrBoxMappingMapper extends BaseMapper<QrBoxMapping> {
      * @param req
      * @return
      */
-    List<ActivationRecordVO> getActivationRecord(@Param("req") ActivationRecordReq req);
+    List<ActivationRecordVO> getActivationRecord(@Param("req") ActivationRecordReq req,@Param("id") Long id);
 
     /**
      * 查询激活详情

+ 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);
 
 
 }

+ 0 - 2
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/ActivationRecordReq.java

@@ -21,6 +21,4 @@ public class ActivationRecordReq implements Serializable {
     @ApiModelProperty(value = "月份")
     private String month;
 
-    @ApiModelProperty(value = "当前登陆人ID")
-    private Long userId;
 }

+ 2 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/ListQrBoxCodeMappingReq.java

@@ -24,4 +24,6 @@ public class ListQrBoxCodeMappingReq extends PageReq implements Serializable {
     @ApiModelProperty(value = "激活状态 0-未激活 1-已激活 9-已作废")
     private Integer activeStatus;
 
+    @ApiModelProperty(value = "是否作废 0-未作废 1-已作废")
+    private Integer invalid;
 }

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

@@ -14,6 +14,7 @@ import com.abi.qms.platform.dto.res.*;
 import com.abi.qms.platform.infrastructure.util.AssertUtil;
 import com.abi.qms.platform.infrastructure.util.AsyncTableStoreUtil;
 import com.abi.qms.platform.infrastructure.util.PageUtil;
+import com.abi.qms.platform.infrastructure.util.TokenUtil;
 import com.abi.qms.platform.infrastructure.util.UserUtil;
 import com.abi.qms.platform.service.QrBoxMappingService;
 import com.abi.task.common.api.exception.BusinessException;
@@ -292,10 +293,11 @@ public class QrBoxMappingServiceImpl implements QrBoxMappingService {
         Integer isMainAccount = userUtil.getWholeUser().getIsMainAccount();
 
         ActivationRecordRes res = new ActivationRecordRes();
+        Long id = TokenUtil.getUser().getId();
         if (isMainAccount.equals(1)) {
-            req.setUserId(null);
+            id = null;
         }
-        List<ActivationRecordVO> recordVOList = qrBoxMappingMapper.getActivationRecord(req);
+        List<ActivationRecordVO> recordVOList = qrBoxMappingMapper.getActivationRecord(req,id);
         List<ActivationRecordRes.ActivationRecordBean> beanList = PojoConverterUtils.copyList(recordVOList, ActivationRecordRes.ActivationRecordBean.class);
         res.setActivationRecordBeanList(beanList);
         res.setIsMainAccount(isMainAccount);

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

@@ -7,6 +7,7 @@ import com.abi.qms.platform.dto.req.QueryWxFactoryReq;
 import com.abi.qms.platform.dto.req.ReportReq;
 import com.abi.qms.platform.dto.res.*;
 import com.abi.qms.platform.infrastructure.util.AssertUtil;
+import com.abi.qms.platform.infrastructure.util.TokenUtil;
 import com.abi.qms.platform.infrastructure.util.UserUtil;
 import com.abi.qms.platform.service.ReportService;
 import com.abi.task.common.utils.PojoConverterUtils;
@@ -122,6 +123,7 @@ public class ReportServiceImpl implements ReportService {
      */
     @Override
     public QueryWxFactoryRes queryWxFactory(QueryWxFactoryReq queryWxFactoryReq) {
+        Long id = TokenUtil.getUser().getId();
         // 是小程序用户主账号 1-是 0-不是
         Integer isMainAccount = userUtil.getWholeUser().getIsMainAccount();
         QueryWxFactoryRes res = new QueryWxFactoryRes();
@@ -135,7 +137,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 +163,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()));

+ 1 - 1
abi-cloud-qr-platform-server/src/main/resources/bootstrap.yml

@@ -20,7 +20,7 @@ spring:
         namespace: ${spring.profiles.active}
         sources:
         - name: redis
-        - name: rabbitmq
+        - name: rabbitmq-qms
         - name: qms-qr-platform-service-secret
       reload:
         enabled: true

+ 5 - 2
abi-cloud-qr-platform-server/src/main/resources/dao/mapper/QrBoxMappingMapper.xml

@@ -53,6 +53,9 @@
             <if test="req.packageId != null ">
                 AND qbm.package_id = #{req.packageId}
             </if>
+            <if test=" req.invalid != null ">
+                AND qbm.invalid = #{req.invalid}
+            </if>
         </where>
         order by qbm.create_time
     </select>
@@ -140,8 +143,8 @@
             <if test="req.month != null and req.month !=''">
                 AND DATE_FORMAT(qbm.active_time,'%Y-%m') = #{req.month}
             </if>
-            <if test="req.userId != null and req.userId !=''">
-                AND ui.id =#{req.userId}
+            <if test="id != null">
+                AND ui.id =#{id}
             </if>
         </where>
         ORDER BY qbm.active_time DESC

+ 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`