ToolController.java
1.89 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
package com.viontech.keliu.controller;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.viontech.keliu.service.PersonGroupService;
import com.viontech.keliu.service.PersonRecordService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* Created with IntelliJ IDEA.
*
* @author: zhuhai
* Date: 2022-11-03
* Time: 15:15
*/
@RestController
@RequestMapping("/tool")
public class ToolController {
@Resource
private PersonRecordService personRecordService;
/*@Resource
private PersonGroupService personGroupService;*/
/*@GetMapping("/buildData")
public String buildData(String startDate, String endDate) {
DateTime startDateTime = DateUtil.parse(startDate, "yyyy-MM-dd");
DateTime endDateTime = DateUtil.parse(endDate, "yyyy-MM-dd");
List<DateTime> dateTimes = DateUtil.rangeToList(startDateTime, endDateTime, DateField.DAY_OF_MONTH);
for (DateTime dateTime : dateTimes) {
personGroupService.personToGroup(mallIdList, dateTime);
}
return "success";
}*/
@GetMapping("/build/personRecord")
public String buildPersonRecord(Long mallId, String startDate, String endDate) {
DateTime startDateTime = DateUtil.parse(startDate, "yyyy-MM-dd");
DateTime endDateTime = DateUtil.parse(endDate, "yyyy-MM-dd");
List<DateTime> dateTimes = DateUtil.rangeToList(startDateTime, endDateTime, DateField.DAY_OF_MONTH);
for (DateTime dateTime : dateTimes) {
personRecordService.handlePersonRecord(mallId, dateTime);
}
return "success";
}
}