Browse Source

更新取数传入参数

hejq 7 years ago
parent
commit
9fcb29652f

+ 12 - 8
src/main/java/com/uas/platform/b2c/prod/commodity/controller/GoodsController.java

@@ -33,6 +33,7 @@ import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.domain.Sort;
 import org.springframework.data.web.PageableDefault;
+import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.ui.ModelMap;
 import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.PathVariable;
@@ -50,6 +51,7 @@ import javax.servlet.http.HttpSession;
 import java.io.*;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -854,27 +856,29 @@ public class GoodsController {
      * 通过分页参数获取品牌数量
      *
      * @param params 分页信息
-     * @param filter 过滤条件
+     * @param endTime 截止时间
+     * @param startTime 开始时间
      * @return Page<BrandCount>
      */
-	@RequestMapping(value = "/brandProductsCount/page", method = RequestMethod.POST)
-    public com.uas.sso.support.Page<BrandCount> getBrandProductsCount(PageParams params, @RequestBody GoodsFilter filter) {
+	@RequestMapping(value = "/brandProductsCount/page", method = RequestMethod.GET)
+    public com.uas.sso.support.Page<BrandCount> getBrandProductsCount(PageParams params, @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime, @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
         logger.info("后台产品管理", "分页获取品牌数量信息");
         PageInfo info = new PageInfo(params);
-        return goodsService.getBrandProductsCount(info, filter);
+        return goodsService.getBrandProductsCount(info, startTime, endTime);
     }
 
     /**
      * 通过分页参数获取类目数量
      *
      * @param params 分页参数
-     * @param filter 过滤条件
+     * @param endTime 截止时间
+     * @param startTime 开始时间
      * @return Page<KindHierarchicalCount>
      */
-    @RequestMapping(value = "/kindProductsCount/page", method = RequestMethod.POST)
-    public com.uas.sso.support.Page<KindHierarchicalCount> getKindProductsCount(PageParams params, @RequestBody GoodsFilter filter) {
+    @RequestMapping(value = "/kindProductsCount/page", method = RequestMethod.GET)
+    public com.uas.sso.support.Page<KindHierarchicalCount> getKindProductsCount(PageParams params, @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime, @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
         logger.info("后台产品管理", "分页获取类目数量信息");
         PageInfo info = new PageInfo(params);
-        return goodsService.getKindProductsCount(info, filter);
+        return goodsService.getKindProductsCount(info, startTime, endTime);
     }
 }

+ 7 - 4
src/main/java/com/uas/platform/b2c/prod/commodity/service/GoodsService.java

@@ -24,6 +24,7 @@ import org.springframework.data.domain.Pageable;
 import org.springframework.ui.ModelMap;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -818,17 +819,19 @@ public interface GoodsService {
      * 通过分成参数获取品牌数量
      *
      * @param pageable 分页信息
-     * @param filter 过滤条件
+     * @param endTime 截止时间
+     * @param startTime 开始时间
      * @return Page<BrandCount>
      */
-    com.uas.sso.support.Page<BrandCount> getBrandProductsCount(Pageable pageable, GoodsFilter filter);
+    com.uas.sso.support.Page<BrandCount> getBrandProductsCount(Pageable pageable, Date startTime, Date endTime);
 
     /**
      * 通过分页参数获取类目数量
      *
      * @param pageable 分页参数
-     * @param filter 过滤条件
+     * @param endTime 截止时间
+     * @param startTime 开始时间
      * @return Page<KindHierarchicalCount>
      */
-    com.uas.sso.support.Page<KindHierarchicalCount> getKindProductsCount(Pageable pageable, GoodsFilter filter);
+    com.uas.sso.support.Page<KindHierarchicalCount> getKindProductsCount(Pageable pageable, Date startTime, Date endTime);
 }

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

@@ -4060,23 +4060,24 @@ public class GoodsServiceImpl implements GoodsService {
      * 通过分成参数获取品牌数量
      *
      * @param pageable  分页信息
-     * @param filter 过滤条件
+     * @param endTime 截止时间
+     * @param startTime 开始时间
      * @return Page<BrandCount>
      */
     @Override
-    public com.uas.sso.support.Page<BrandCount> getBrandProductsCount(Pageable pageable, GoodsFilter filter) {
+    public com.uas.sso.support.Page<BrandCount> getBrandProductsCount(Pageable pageable, Date startTime, Date endTime) {
         java.sql.Date startDate;
-        if (null == filter.getStartTime()) {
+        if (null == startTime) {
             startDate = new java.sql.Date(DateUtils.addTime(new Date(), -30, 0, 0, 0).getTime());
         } else {
-            startDate = new java.sql.Date(filter.getStartTime());
+            startDate = new java.sql.Date(startTime.getTime());
         }
         java.sql.Date endDate;
         // 截止时间+1天
-        if (null == filter.getEndTime()) {
+        if (null == endTime) {
             endDate = new java.sql.Date(System.currentTimeMillis());
         } else {
-            endDate = new java.sql.Date(filter.getEndTime());
+            endDate = new java.sql.Date(endTime.getTime());
         }
         Integer addend = 60 * 60 * 24 * 1000;
         endDate = new java.sql.Date(endDate.getTime() + addend);
@@ -4094,11 +4095,12 @@ public class GoodsServiceImpl implements GoodsService {
      * 通过分页参数获取类目数量
      *
      * @param pageable 分页参数
-     * @param filter   过滤条件
+     * @param endTime 截止时间
+     * @param startTime 开始时间
      * @return Page<KindHierarchicalCount>
      */
     @Override
-    public com.uas.sso.support.Page<KindHierarchicalCount> getKindProductsCount(Pageable pageable, GoodsFilter filter) {
+    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 countSql = new StringBuffer("select count(1) from (").append(sql).append(") as a");
         Integer count = commonDao.queryForObject(countSql.toString(), Integer.class);