StatisticsDriveController.java
3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package cn.com.glsx.stdinterface.modules.controller;
import cn.com.glsx.stdinterface.dto.StatisticsDriveDto;
import cn.com.glsx.stdinterface.modules.service.StatisticsDriveService;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.glsx.plat.common.annotation.SysLog;
import com.glsx.plat.common.enums.OperateType;
import com.glsx.plat.core.web.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 试驾统计 Controller
*/
@Slf4j
@RestController
@RequestMapping(value = "/statisticsdrive")
@Api(value = "试驾统计数据", tags = {"试驾统计数据"})
public class StatisticsDriveController {
private final static String MODULE = "试驾数据统计";
@Autowired
private StatisticsDriveService statisticsDriveService;
@GetMapping(value = "/drivedatalist")
@SysLog(module = MODULE, value = "查询试驾统计数据", action = OperateType.QUERY)
@ApiOperation(value = "查询试驾统计数据")
public R statisticsDriveDataEveryDay() {
log.info("开始查询试驾统计数据===");
List<StatisticsDriveDto> statisticsDriveList = statisticsDriveService.statisticsDriveDataEveryDay();
if (CollectionUtil.isEmpty(statisticsDriveList)) {
log.info("数据集合的大小为0===");
log.info("数据集合的实体===" + JSON.toJSONString(statisticsDriveList));
return R.ok();
}
log.info("数据集合的大小为===" + statisticsDriveList.size());
log.info("数据集合的实体===" + JSON.toJSONString(statisticsDriveList));
return R.ok().data(statisticsDriveList);
}
@PostMapping(value = "/insertstatisticsdrivelist")
@SysLog(module = MODULE, value = "保存试驾统计数据", action = OperateType.ADD)
@ApiOperation(value = "保存试驾统计数据")
public R insertStatisticsDriveList(@RequestBody List<StatisticsDriveDto> statisticsDriveDtoList) {
log.info("开始保存试驾统计数据,数据集合的大小为===" + statisticsDriveDtoList.size());
if (CollectionUtil.isNotEmpty(statisticsDriveDtoList)) {
statisticsDriveService.insertStatisticsDriveList(statisticsDriveDtoList);
log.info("保存数据成功===");
return R.ok();
}
log.info("数据集合为空 没有数据可以保存===");
return R.ok();
}
@GetMapping(value = "/statisticsandinsertdrivedatalist")
@SysLog(module = MODULE, value = "查询并插入试驾统计数据", action = OperateType.QUERY)
@ApiOperation(value = "查询并插入试驾统计数据")
public R statisticsAndInsertDriveDataEveryDay() {
log.info("开始查询试驾统计数据并插入到统计表中===");
Integer num = statisticsDriveService.statisticsAndInsertDriveDataEveryDay();
return R.ok().data(num);
}
}