|
@@ -208,6 +208,60 @@ public class MonthlyCustomersController {
|
|
|
return R.ok(map);
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping("/top10ByBrandAndSupplierExport")
|
|
|
+ public R top10ByBrandAndSupplierExport(@RequestParam("startDate") String startDate,
|
|
|
+ @RequestParam("endDate") String endDate, HttpServletResponse response, HttpServletRequest request){
|
|
|
+
|
|
|
+ String merchSn = null;
|
|
|
+ SysUserEntity sysUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ if(!"1".equals(sysUser.getRoleType())){
|
|
|
+ merchSn = sysUser.getMerchSn();
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String,Object> map = monthlyCustomersService.top10ByBrandAndSupplier(startDate,endDate,merchSn);
|
|
|
+ List<MonthlySalesGrowthEntity> top10ByBrand = (List<MonthlySalesGrowthEntity>) map.get("top10ByBrand");
|
|
|
+ List<MonthlySalesGrowthEntity> top10BySupplier = (List<MonthlySalesGrowthEntity>) map.get("top10BySupplier");
|
|
|
+
|
|
|
+ ExcelExport ee = new ExcelExport("产品销量前10");
|
|
|
+ String[] header1 = new String[]{"序号","商户名称","品牌","产品规格","销售数量"};
|
|
|
+ String[] header2 = new String[]{"序号","商户名称","供应商","产品规格","销售数量"};
|
|
|
+ List<Map<String, Object>> list1 = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> list2 = new ArrayList<>();
|
|
|
+ int count = 1;
|
|
|
+ if (top10ByBrand!=null && top10ByBrand.size()>0) {
|
|
|
+ for (MonthlySalesGrowthEntity monthlySalesGrowthEntity : top10ByBrand) {
|
|
|
+ LinkedHashMap<String, Object> tempMap = new LinkedHashMap<>();
|
|
|
+ tempMap.put("OrderNumber",count++);
|
|
|
+ tempMap.put("MerchName",monthlySalesGrowthEntity.getMerchName());
|
|
|
+ tempMap.put("Brand",monthlySalesGrowthEntity.getBrand());
|
|
|
+ tempMap.put("GoodsSpecificationNameValue",monthlySalesGrowthEntity.getGoodsSpecificationNameValue());
|
|
|
+ tempMap.put("sales",monthlySalesGrowthEntity.getSales());
|
|
|
+ list1.add(tempMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ count=1;
|
|
|
+ if (top10BySupplier!=null && top10BySupplier.size()>0) {
|
|
|
+ for (MonthlySalesGrowthEntity monthlySalesGrowthEntity : top10BySupplier) {
|
|
|
+ LinkedHashMap<String, Object> tempMap = new LinkedHashMap<>();
|
|
|
+ tempMap.put("OrderNumber",count++);
|
|
|
+ tempMap.put("MerchName",monthlySalesGrowthEntity.getMerchName());
|
|
|
+ tempMap.put("Supplier",monthlySalesGrowthEntity.getSupplier());
|
|
|
+ tempMap.put("GoodsSpecificationNameValue",monthlySalesGrowthEntity.getGoodsSpecificationNameValue());
|
|
|
+ tempMap.put("sales",monthlySalesGrowthEntity.getSales());
|
|
|
+ list2.add(tempMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ee.addSheetByMap("top10ByBrand", list1, header1);
|
|
|
+ ee.addSheetByMap("top10BySupplier", list2, header2);
|
|
|
+ ee.export(response);
|
|
|
+
|
|
|
+
|
|
|
+ return R.ok(map);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 每周销售额销售量图表查询
|
|
|
* @param startWeek
|