Browse Source

更新品类产品数和品牌产品数查询数据方法

hejq 7 years ago
parent
commit
cbfdb25306

+ 13 - 10
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/GoodsServiceImpl.java

@@ -4077,7 +4077,7 @@ public class GoodsServiceImpl implements GoodsService {
         }
         Integer addend = 60 * 60 * 24 * 1000;
         endDate = new java.sql.Date(endDate.getTime() + addend);
-        StringBuffer sql = new StringBuffer("select br_name_en as brand, count(1) as count from product$brand where br_modifytime >= ? and br_modifytime < ? group by br_name_en");
+        StringBuffer sql = new StringBuffer("select br_name_en as brand, count(1) as count from trade$goods where br_name_en is not null and go_update_date >= ? and go_update_date < ? group by br_name_en");
         StringBuffer countSql = new StringBuffer("select count(1) from (").append(sql).append(") as a");
         Integer count = commonDao.queryForObject(countSql.toString(), Integer.class, startDate, endDate);
         // 分页参数
@@ -4097,7 +4097,7 @@ public class GoodsServiceImpl implements GoodsService {
      */
     @Override
     public com.uas.sso.support.Page<KindHierarchicalCount> getKindProductsCount(Pageable pageable, Date startTime, Date endTime) {
-        StringBuffer sql = new StringBuffer("select ki_name as thirdKind, ki_parentid as parentId, count(1) as count from product$kind group by ki_name, ki_parentid");
+        StringBuffer sql = new StringBuffer("select ki_name as thirdKind, go_kind_uuid as kindId, count(1) as count from trade$goods group by ki_name, go_kind_uuid");
         StringBuffer countSql = new StringBuffer("select count(1) from (").append(sql).append(") as a");
         Integer count = commonDao.queryForObject(countSql.toString(), Integer.class);
         // 分页参数
@@ -4106,14 +4106,17 @@ public class GoodsServiceImpl implements GoodsService {
         List<KindHierarchicalCount> kindList = commonDao.query(sql.toString(), KindHierarchicalCount.class, pageable.getPageSize(), offset);
         if (CollectionUtils.isNotEmpty(kindList)) {
             kindList.forEach(kind -> {
-                if (null != kind.getParentId() && kind.getParentId() != 0) {
-                    KindInfo parentKind = kindInfoDao.findOne(kind.getParentId());
-                    if (null != parentKind) {
-                        kind.setSecondKind(parentKind.getNameCn());
-                        if (null != parentKind.getParentid() && parentKind.getParentid() != 0) {
-                            KindInfo firstKind = kindInfoDao.findOne(parentKind.getParentid());
-                            if (null != firstKind) {
-                                kind.setFirstKind(firstKind.getNameCn());
+                if (null != kind.getKindId()) {
+                    KindInfo kindInfo = kindInfoDao.findOne(kind.getKindId());
+                    if (null != kindInfo && null != kindInfo.getParentid() && kindInfo.getParentid() != 0) {
+                        KindInfo parentKind = kindInfoDao.findOne(kindInfo.getParentid());
+                        if (null != parentKind) {
+                            kind.setSecondKind(parentKind.getNameCn());
+                            if (null != parentKind.getParentid() && parentKind.getParentid() != 0) {
+                                KindInfo firstKind = kindInfoDao.findOne(parentKind.getParentid());
+                                if (null != firstKind) {
+                                    kind.setFirstKind(firstKind.getNameCn());
+                                }
                             }
                         }
                     }

+ 13 - 0
src/main/java/com/uas/platform/b2c/prod/store/model/KindHierarchicalCount.java

@@ -33,6 +33,11 @@ public class KindHierarchicalCount {
      */
     private Long parentId;
 
+    /**
+     * 类目Id
+     */
+    private Long kindId;
+
     public String getFirstKind() {
         return firstKind;
     }
@@ -72,4 +77,12 @@ public class KindHierarchicalCount {
     public void setParentId(Long parentId) {
         this.parentId = parentId;
     }
+
+    public Long getKindId() {
+        return kindId;
+    }
+
+    public void setKindId(Long kindId) {
+        this.kindId = kindId;
+    }
 }

BIN
src/main/resources/jxls-tpl/trade/brandCount.xls


BIN
src/main/resources/jxls-tpl/trade/kindHierarchical.xls