|
|
@@ -12,6 +12,7 @@ import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
|
|
|
import com.uas.platform.b2c.common.account.model.Enterprise;
|
|
|
import com.uas.platform.b2c.common.account.model.User;
|
|
|
import com.uas.platform.b2c.common.account.service.EnterpriseService;
|
|
|
+import com.uas.platform.b2c.common.base.dao.CommonDao;
|
|
|
import com.uas.platform.b2c.common.search.service.SearcherService;
|
|
|
import com.uas.platform.b2c.core.config.SysConf;
|
|
|
import com.uas.platform.b2c.core.constant.ShortConstant;
|
|
|
@@ -75,6 +76,8 @@ import com.uas.platform.b2c.prod.product.kind.model.Kind;
|
|
|
import com.uas.platform.b2c.prod.product.kind.model.KindInfo;
|
|
|
import com.uas.platform.b2c.prod.product.kind.service.KindService;
|
|
|
import com.uas.platform.b2c.prod.store.dao.StoreInDao;
|
|
|
+import com.uas.platform.b2c.prod.store.model.BrandCount;
|
|
|
+import com.uas.platform.b2c.prod.store.model.KindHierarchicalCount;
|
|
|
import com.uas.platform.b2c.prod.store.model.StoreIn;
|
|
|
import com.uas.platform.b2c.prod.store.model.StoreStatus;
|
|
|
import com.uas.platform.b2c.prod.store.service.StoreInService;
|
|
|
@@ -96,6 +99,7 @@ import com.uas.platform.b2c.trade.presale.model.GoodsBrowsingHistory;
|
|
|
import com.uas.platform.b2c.trade.presale.model.TradeDeliveryDelayTime;
|
|
|
import com.uas.platform.b2c.trade.presale.service.BrowsingHistoryService;
|
|
|
import com.uas.platform.b2c.trade.presale.service.CartService;
|
|
|
+import com.uas.platform.b2c.trade.seek.utils.DateUtils;
|
|
|
import com.uas.platform.b2c.trade.support.CodeType;
|
|
|
import com.uas.platform.b2c.trade.support.ResultMap;
|
|
|
import com.uas.platform.b2c.trade.util.BoundedExecutor;
|
|
|
@@ -297,6 +301,9 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
@Autowired
|
|
|
private EnterpriseService enterpriseService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CommonDao commonDao;
|
|
|
+
|
|
|
private final Logger logger = LoggerFactory.getLogger(GoodsServiceImpl.class);
|
|
|
|
|
|
@Autowired
|
|
|
@@ -4033,4 +4040,70 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
}
|
|
|
return product;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过分成参数获取品牌数量
|
|
|
+ *
|
|
|
+ * @param pageable 分页信息
|
|
|
+ * @param filter 过滤条件
|
|
|
+ * @return Page<BrandCount>
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public com.uas.sso.support.Page<BrandCount> getBrandProductsCount(Pageable pageable, GoodsFilter filter) {
|
|
|
+ java.sql.Date startDate;
|
|
|
+ if (null == filter.getStartTime()) {
|
|
|
+ startDate = new java.sql.Date(DateUtils.addTime(new Date(), -30, 0, 0, 0).getTime());
|
|
|
+ } else {
|
|
|
+ startDate = new java.sql.Date(filter.getStartTime());
|
|
|
+ }
|
|
|
+ java.sql.Date endDate;
|
|
|
+ if (null == filter.getEndTime()) {
|
|
|
+ endDate = new java.sql.Date(System.currentTimeMillis());
|
|
|
+ } else {
|
|
|
+ endDate = new java.sql.Date(filter.getEndTime());
|
|
|
+ }
|
|
|
+ StringBuffer sql = new StringBuffer("select br_name_en as brand, count(1) as count from product$brand where br_createtime >= ? and br_createtime <= ? 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);
|
|
|
+ // 分页参数
|
|
|
+ Integer offset = (pageable.getPageNumber() - 1) * pageable.getPageSize();
|
|
|
+ sql.append(" limit ? offset ?");
|
|
|
+ List<BrandCount> brandCountList = commonDao.query(sql.toString(), BrandCount.class, startDate, endDate, pageable.getPageSize(), offset);
|
|
|
+ return new com.uas.sso.support.Page<>(pageable.getPageNumber(), pageable.getPageSize(), brandCountList, count);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过分页参数获取类目数量
|
|
|
+ *
|
|
|
+ * @param pageable 分页参数
|
|
|
+ * @param filter 过滤条件
|
|
|
+ * @return Page<KindHierarchicalCount>
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public com.uas.sso.support.Page<KindHierarchicalCount> getKindProductsCount(Pageable pageable, GoodsFilter filter) {
|
|
|
+ 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 countSql = new StringBuffer("select count(1) from (").append(sql).append(") as a");
|
|
|
+ Integer count = commonDao.queryForObject(countSql.toString(), Integer.class);
|
|
|
+ // 分页参数
|
|
|
+ Integer offset = (pageable.getPageNumber() - 1) * pageable.getPageSize();
|
|
|
+ sql.append(" limit ? offset ?");
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return new com.uas.sso.support.Page<>(pageable.getPageNumber(), pageable.getPageSize(), kindList, count);
|
|
|
+ }
|
|
|
}
|