|
|
@@ -4063,14 +4063,12 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
*/
|
|
|
@Override
|
|
|
public com.uas.sso.support.Page<BrandCount> getBrandProductsCount(Pageable pageable, Date startTime, Date endTime) {
|
|
|
- java.sql.Date startDate = assignStartDate(startTime);
|
|
|
- java.sql.Date endDate = assignEndDate(endTime);
|
|
|
StringBuffer sql = new StringBuffer("select pr_brand as brand, count(1) as count from products where pr_brand is not null ");
|
|
|
- if (null != startDate) {
|
|
|
- sql.append(" and pr_create_time >= '").append(startDate).append("' ");
|
|
|
+ if (null != startTime) {
|
|
|
+ sql.append(" and pr_create_time >= '").append(new java.sql.Date(startTime.getTime())).append("' ");
|
|
|
}
|
|
|
- if (null != endDate) {
|
|
|
- sql.append(" and pr_create_time < '").append(endDate).append("' ");
|
|
|
+ if (null != endTime) {
|
|
|
+ sql.append(" and pr_create_time < '").append(new java.sql.Date(endTime.getTime() + IntegerConstant.ONE_DAY_MILLISECONDS) ).append("' ");
|
|
|
}
|
|
|
sql.append("group by pr_brand");
|
|
|
StringBuffer countSql = new StringBuffer("select count(1) from (").append(sql).append(") as a");
|
|
|
@@ -4082,41 +4080,6 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
return new com.uas.sso.support.Page<>(pageable.getPageNumber(), pageable.getPageSize(), brandCountList, count);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 设置开始时间
|
|
|
- *
|
|
|
- * @param startTime 前端传入开始时间
|
|
|
- * @return java.sql.Date
|
|
|
- */
|
|
|
- private java.sql.Date assignStartDate(Date startTime) {
|
|
|
- java.sql.Date startDate;
|
|
|
- if (null == startTime) {
|
|
|
- startDate = null;
|
|
|
- } else {
|
|
|
- startDate = new java.sql.Date(startTime.getTime());
|
|
|
- }
|
|
|
- return startDate;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 设置截止时间
|
|
|
- * 截止时间+1是取到截止时间的23:59:59数据,
|
|
|
- * java.sql.Date 精确到天,所以采用+1天小于来过滤
|
|
|
- *
|
|
|
- * @param endTime 前端传入截止时间
|
|
|
- * @return java.sql.Date
|
|
|
- */
|
|
|
- private java.sql.Date assignEndDate(Date endTime) {
|
|
|
- java.sql.Date endDate;
|
|
|
- // 截止时间+1天
|
|
|
- if (null == endTime) {
|
|
|
- endDate = null;
|
|
|
- } else {
|
|
|
- endDate = new java.sql.Date(endTime.getTime() + IntegerConstant.ONE_DAY_MILLISECONDS);
|
|
|
- }
|
|
|
- return endDate;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 通过分页参数获取类目数量
|
|
|
*
|
|
|
@@ -4127,14 +4090,12 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
*/
|
|
|
@Override
|
|
|
public com.uas.sso.support.Page<KindHierarchicalCount> getKindProductsCount(Pageable pageable, Date startTime, Date endTime) {
|
|
|
- java.sql.Date startDate = assignStartDate(startTime);
|
|
|
- java.sql.Date endDate = assignEndDate(endTime);
|
|
|
StringBuffer sql = new StringBuffer("select pr_kind as thirdKind, pr_kindid as kindId, count(1) as count from products where pr_kind is not null ");
|
|
|
- if (null != startDate) {
|
|
|
- sql.append(" and pr_create_time >= '").append(startDate).append("' ");
|
|
|
+ if (null != startTime) {
|
|
|
+ sql.append(" and pr_create_time >= '").append(new java.sql.Date(startTime.getTime())).append("' ");
|
|
|
}
|
|
|
- if (null != endDate) {
|
|
|
- sql.append(" and pr_create_time < '").append(endDate).append("' ");
|
|
|
+ if (null != endTime) {
|
|
|
+ sql.append(" and pr_create_time < '").append(new java.sql.Date(endTime.getTime() + IntegerConstant.ONE_DAY_MILLISECONDS)).append("' ");
|
|
|
}
|
|
|
sql.append("group by pr_kind, pr_kindid");
|
|
|
StringBuffer countSql = new StringBuffer("select count(1) from (").append(sql).append(") as a");
|