Browse Source

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

tanzhongran 3 years ago
parent
commit
0bf4584f9c

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

@@ -62,6 +62,6 @@ public interface ReportServiceMapper  {
      * @param req
      * @return java.util.List<com.abi.qms.platform.dao.vo.result.QueryWxFactoryVO>
      */
-    List<QueryWxFactoryVO> queryWxFactory(@Param("req")QueryWxFactoryReq req);
+    List<QueryWxFactoryVO> queryWxFactory(@Param("req") QueryWxFactoryReq req, @Param("now") LocalDateTime now, @Param("month") LocalDateTime month);
 
 }

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

@@ -20,10 +20,4 @@ public class QueryWxFactoryReq implements Serializable {
     @ApiModelProperty(value = "啤酒厂ID")
     private Long factoryBeerId;
 
-    @ApiModelProperty(value = "现在时间")
-    private LocalDateTime now;
-
-    @ApiModelProperty(value = "前三个月时间")
-    private LocalDateTime month;
-
 }

+ 5 - 1
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/res/ActivationRecordRes.java

@@ -3,6 +3,7 @@ package com.abi.qms.platform.dto.res;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
@@ -20,6 +21,9 @@ import java.util.List;
 @ApiModel
 public class ActivationRecordRes implements Serializable {
 
+    @ApiModelProperty(value = "是否小程序用户主账号 1-是 0-不是")
+    private Integer isMainAccount;
+
     @ApiModelProperty("激活记录列表")
     private List<ActivationRecordBean> activationRecordBeanList;
 
@@ -33,7 +37,7 @@ public class ActivationRecordRes implements Serializable {
     @ApiModel(value = "ActivationRecordRes_ActivationRecordBean")
     public static class ActivationRecordBean implements Serializable {
 
-        @ApiModelProperty("条码序号")
+        @ApiModelProperty(value = "条码序号")
         private String boxCode;
 
         @ApiModelProperty(value = "活动名称")

+ 3 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/res/ListQrPackageWxRes.java

@@ -19,6 +19,9 @@ import java.util.List;
 @ApiModel
 public class ListQrPackageWxRes implements Serializable {
 
+    @ApiModelProperty(value = "是否小程序用户主账号 1-是 0-不是")
+    private Integer isMainAccount;
+
     @ApiModelProperty("码包列表")
     private List<QrPackageWxBean> qrPackageWxBeanList;
 

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

@@ -233,11 +233,16 @@ public class QrBoxMappingServiceImpl implements QrBoxMappingService {
 
     @Override
     public ActivationRecordRes getActivationRecord(ActivationRecordReq req) {
+
+        // 是否小程序用户主账号 1-是 0-不是
+        Integer isMainAccount = userUtil.getWholeUser().getIsMainAccount();
+
         ActivationRecordRes res = new ActivationRecordRes();
 
         List<ActivationRecordVO> recordVOList = qrBoxMappingMapper.getActivationRecord(req);
         List<ActivationRecordRes.ActivationRecordBean> beanList = PojoConverterUtils.copyList(recordVOList, ActivationRecordRes.ActivationRecordBean.class);
         res.setActivationRecordBeanList(beanList);
+        res.setIsMainAccount(isMainAccount);
         return res;
     }
 
@@ -261,6 +266,7 @@ public class QrBoxMappingServiceImpl implements QrBoxMappingService {
     public ActivateDetailRes getActivateDetail(ActivateDetailReq req) {
 
         ActivateDetailVo activateDetailVo = qrBoxMappingMapper.getActivateDetail(req.getBoxCode());
+        AssertUtil.isNull(activateDetailVo, "条码序号查询为空");
 
         ActivateDetailRes res = PojoConverterUtils.copy(activateDetailVo, ActivateDetailRes.class);
         return res;

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

@@ -928,12 +928,16 @@ public class QrPackageServiceImpl implements QrPackageService {
     @Override
     public ListQrPackageWxRes listWxQrPackage(ListQrPackageWxReq listQrPackageWxReq) {
 
+        // 是否小程序用户主账号 1-是 0-不是
+        Integer isMainAccount = userUtil.getWholeUser().getIsMainAccount();
+
         ListQrPackageWxRes res = new ListQrPackageWxRes();
 
         List<QrPackageWxVO> qrPackageWxVOList = qrPackageMapper.listWxQrPackage(listQrPackageWxReq);
 
         List<ListQrPackageWxRes.QrPackageWxBean> beanList = PojoConverterUtils.copyList(qrPackageWxVOList, ListQrPackageWxRes.QrPackageWxBean.class);
         res.setQrPackageWxBeanList(beanList);
+        res.setIsMainAccount(isMainAccount);
 
         return res;
     }

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

@@ -132,11 +132,8 @@ public class ReportServiceImpl implements ReportService {
         QueryWxFactoryRes res = new QueryWxFactoryRes();
         if (isMainAccount.equals(0)) {
             //子账号报表
-            //获取现在时间
-            queryWxFactoryReq.setNow(LocalDateTime.now());
-            //获取前三个月的时间
-            queryWxFactoryReq.setMonth(getMonth());
-            List<QueryWxFactoryVO> queryWxFactoryVO = reportServiceMapper.queryWxFactory(queryWxFactoryReq);
+            //获取现在时间 获取前三个月的时间
+            List<QueryWxFactoryVO> queryWxFactoryVO = reportServiceMapper.queryWxFactory(queryWxFactoryReq,LocalDateTime.now(),getMonth());
             AssertUtil.isNull(queryWxFactoryVO,"报表数据查询为空");
             List<QueryWxFactoryRes.QueryWxFactoryBean> queryWxFactoryBeans = PojoConverterUtils.copyList(queryWxFactoryVO, QueryWxFactoryRes.QueryWxFactoryBean.class);
             queryWxFactoryBeans.forEach(beans->{
@@ -146,7 +143,7 @@ public class ReportServiceImpl implements ReportService {
             return res;
         }
         //下单量-激活量-库存
-        List<QueryWxFactoryVO> queryWxFactoryVO = reportServiceMapper.queryWxFactory(queryWxFactoryReq);
+        List<QueryWxFactoryVO> queryWxFactoryVO = reportServiceMapper.queryWxFactory(queryWxFactoryReq,null,null);
         AssertUtil.isNull(queryWxFactoryVO,"查询为空");
         List<QueryWxFactoryRes.QueryWxFactoryBean> queryWxFactoryBeans = PojoConverterUtils.copyList(queryWxFactoryVO, QueryWxFactoryRes.QueryWxFactoryBean.class);
         Long total = queryWxFactoryBeans.stream().mapToLong(QueryWxFactoryRes.QueryWxFactoryBean::getTotal).sum();
@@ -412,7 +409,12 @@ public class ReportServiceImpl implements ReportService {
         return map;
     }
 
-
+    /**
+     * 获取进三个月的
+     * @author lu
+     * @date 2021/6/10 17:03
+     * @return java.time.LocalDateTime
+     */
     private LocalDateTime getMonth(){
         Calendar calStart = Calendar.getInstance();
         calStart.add(Calendar.MONTH, -3);//上一月

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

@@ -113,8 +113,8 @@
             <if test="null != req.factoryBeerId and req.factoryBeerId != ''">
                 AND qpackage.factory_beer_id = #{req.factoryBeerId}
             </if>
-            <if test="null != req.now and null != req.month">
-                AND #{req.month} <![CDATA[<=]]> qpackage.create_time <![CDATA[<=]]> #{req.now}
+            <if test="null != now and null != month">
+                AND #{month} <![CDATA[<=]]> qpackage.create_time <![CDATA[<=]]> #{now}
             </if>
         </where>
         GROUP BY march