|
@@ -5,15 +5,17 @@
|
|
|
|
|
|
package com.shawn.web.controller;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
+import com.shawn.model.Bean.ChartBean;
|
|
|
+import com.shawn.model.Bean.ChartColumn;
|
|
|
+import com.shawn.model.Bean.ChartSerie;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import com.shawn.model.dto.ResultMessage;
|
|
|
import com.shawn.web.controller.base.BaseController;
|
|
@@ -24,7 +26,7 @@ import com.shawn.model.param.TOrderParam;
|
|
|
import com.shawn.service.interfac.TOrderServiceInterface;
|
|
|
|
|
|
import lombok.extern.apachecommons.CommonsLog;
|
|
|
-@CommonsLog
|
|
|
+@Slf4j
|
|
|
@RestController
|
|
|
@RequestMapping("TOrder")
|
|
|
public class TOrderController extends BaseController<TOrder,TOrderExample,TOrderParam,Long>{
|
|
@@ -39,6 +41,28 @@ public class TOrderController extends BaseController<TOrder,TOrderExample,TOrder
|
|
|
protected TOrderExample createNewExample() {
|
|
|
return new TOrderExample();
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/getProductSaleMonth")
|
|
|
+ public ResponseEntity<?> getProductSaleMonth(String userId) {
|
|
|
+ log.info("userId:{}", userId);
|
|
|
+ List<ChartBean> list = tOrderService.getProductSaleMonth(userId);
|
|
|
+ ArrayList<String> categories = new ArrayList<>();
|
|
|
+ ArrayList<Integer> seriesDatas = new ArrayList<>();
|
|
|
+
|
|
|
+ for (ChartBean bean :list) {
|
|
|
+ categories.add(bean.getCategories());
|
|
|
+ seriesDatas.add(bean.getSeriesData());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ ChartColumn chartColumn = new ChartColumn(categories,seriesDatas,"当月销量");
|
|
|
+
|
|
|
+ return ResponseEntity
|
|
|
+ .status(HttpStatus.OK)
|
|
|
+ .body(new ResultMessage()
|
|
|
+ .setCode(true)
|
|
|
+ .setData(chartColumn)
|
|
|
+ .setMessage("SUCCESS"));
|
|
|
+ }
|
|
|
}
|