ServiceDataInterface.java
2.8 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
72
73
74
75
76
77
78
79
80
81
package com.bsth.controller.realcontrol;
import com.bsth.data.schedule.DayOfSchedule;
import com.bsth.entity.realcontrol.ScheduleRealInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* 对外的营运数据接口,主要输出当日的数据
* Created by panzhao on 2017/3/15.
*/
@RestController
@RequestMapping("/companyService")
public class ServiceDataInterface {
private final static String SECRE_KEY = "dVPHJkWUt5FhMT7jrM2dLV7QvlHAmZFd42rs1P0usBx8A7HZki";
@Autowired
DayOfSchedule dayOfSchedule;
@RequestMapping("/getCurrentDayPlan")
public List<ScheduleRealInfo> getCurrentDayPlan(
@RequestParam String companyId,
@RequestParam String workId,
@RequestParam String secretKey) {
if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
return null;
List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>();
for (ScheduleRealInfo sch : all) {
if (sch.getGsBm() != null
&& sch.getGsBm().equals(companyId)
&& sch.getjGh().equals(workId)) {
rs.add(sch);
}
}
return rs;
}
@RequestMapping("/returnCCInfo")
public List<ScheduleRealInfo> returnCCInfo(@RequestParam String companyId, @RequestParam String secretKey){
if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
return null;
List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>();
for (ScheduleRealInfo sch : all) {
if (sch.getBcType().equals("out")
&& sch.getGsBm() != null
&& sch.getGsBm().equals(companyId)) {
rs.add(sch);
}
}
return rs;
}
@RequestMapping("/returnJCInfo")
public List<ScheduleRealInfo> returnJCInfo(@RequestParam String companyId, @RequestParam String secretKey){
if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
return null;
List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>();
for (ScheduleRealInfo sch : all) {
if (sch.getBcType().equals("in")
&& sch.getGsBm() != null
&& sch.getGsBm().equals(companyId)) {
rs.add(sch);
}
}
return rs;
}
}