|
@@ -4062,12 +4062,43 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public com.uas.sso.support.Page<BrandCount> getBrandProductsCount(Pageable pageable, Date startTime, Date endTime) {
|
|
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 br_name_en as brand, count(1) as count from trade$goods where br_name_en is not null and go_createddate between ? and ? 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 startTime 前端传入开始时间
|
|
|
|
|
+ * @return java.sql.Date
|
|
|
|
|
+ */
|
|
|
|
|
+ private java.sql.Date assignStartDate(Date startTime) {
|
|
|
java.sql.Date startDate;
|
|
java.sql.Date startDate;
|
|
|
if (null == startTime) {
|
|
if (null == startTime) {
|
|
|
startDate = new java.sql.Date(DateUtils.addTime(new Date(), -30, 0, 0, 0).getTime());
|
|
startDate = new java.sql.Date(DateUtils.addTime(new Date(), -30, 0, 0, 0).getTime());
|
|
|
} else {
|
|
} else {
|
|
|
startDate = new java.sql.Date(startTime.getTime());
|
|
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;
|
|
java.sql.Date endDate;
|
|
|
// 截止时间+1天
|
|
// 截止时间+1天
|
|
|
if (null == endTime) {
|
|
if (null == endTime) {
|
|
@@ -4077,14 +4108,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
}
|
|
}
|
|
|
Integer addend = 60 * 60 * 24 * 1000;
|
|
Integer addend = 60 * 60 * 24 * 1000;
|
|
|
endDate = new java.sql.Date(endDate.getTime() + addend);
|
|
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_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);
|
|
|
|
|
|
|
+ return endDate;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -4097,23 +4121,28 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public com.uas.sso.support.Page<KindHierarchicalCount> getKindProductsCount(Pageable pageable, Date startTime, Date endTime) {
|
|
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");
|
|
|
|
|
|
|
+ java.sql.Date startDate = assignStartDate(startTime);
|
|
|
|
|
+ java.sql.Date endDate = assignEndDate(endTime);
|
|
|
|
|
+ StringBuffer sql = new StringBuffer("select ki_name as thirdKind, go_kind_uuid as kindId, count(1) as count from trade$goods where go_createddate between ? and ? group by ki_name, go_kind_uuid");
|
|
|
StringBuffer countSql = new StringBuffer("select count(1) from (").append(sql).append(") as a");
|
|
StringBuffer countSql = new StringBuffer("select count(1) from (").append(sql).append(") as a");
|
|
|
- Integer count = commonDao.queryForObject(countSql.toString(), Integer.class);
|
|
|
|
|
|
|
+ Integer count = commonDao.queryForObject(countSql.toString(), Integer.class, startDate, endDate);
|
|
|
// 分页参数
|
|
// 分页参数
|
|
|
Integer offset = (pageable.getPageNumber() - 1) * pageable.getPageSize();
|
|
Integer offset = (pageable.getPageNumber() - 1) * pageable.getPageSize();
|
|
|
sql.append(" limit ? offset ?");
|
|
sql.append(" limit ? offset ?");
|
|
|
- List<KindHierarchicalCount> kindList = commonDao.query(sql.toString(), KindHierarchicalCount.class, pageable.getPageSize(), offset);
|
|
|
|
|
|
|
+ List<KindHierarchicalCount> kindList = commonDao.query(sql.toString(), KindHierarchicalCount.class, startDate, endDate, pageable.getPageSize(), offset);
|
|
|
if (CollectionUtils.isNotEmpty(kindList)) {
|
|
if (CollectionUtils.isNotEmpty(kindList)) {
|
|
|
kindList.forEach(kind -> {
|
|
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());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|