LineConfigServiceImpl.java
2.17 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
82
83
84
85
package com.bsth.service.realcontrol.impl;
import com.bsth.common.ResponseCode;
import com.bsth.data.LineConfigData;
import com.bsth.entity.realcontrol.LineConfig;
import com.bsth.repository.realcontrol.LineConfigRepository;
import com.bsth.service.impl.BaseServiceImpl;
import com.bsth.service.realcontrol.LineConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> implements LineConfigService{
@Autowired
LineConfigRepository lineConfigRepository;
@Autowired
LineConfigData lineConfigData;
@Override
public Map<String, Object> check(String[] codeArray) {
Map<String, Object> rs = new HashMap<>();
List<String> notArr = new ArrayList<>();
for(String lineCode : codeArray){
if(null == lineConfigData.get(lineCode + ""))
notArr.add(lineCode);
}
if(notArr.size() > 0){
rs.put("status", 1);
rs.put("not", notArr);
}
else
rs.put("status", 0);
return rs;
}
@Override
public Integer init(String lineCode) throws Exception{
LineConfig conf = lineConfigData.get(lineCode );
if(conf == null)
lineConfigData.init(lineCode);
return 1;
}
@Override
public Map<String, Object> editStartOptTime(String time, String lineCode) {
Map<String, Object> rs = new HashMap<>();
LineConfig conf = lineConfigData.get(lineCode);
conf.setStartOpt(time);
lineConfigData.set(conf);
rs.put("status", ResponseCode.SUCCESS);
rs.put("time", time);
return rs;
}
@Override
public Map<String, Object> editOutTimeType(String lineCode, int type) {
Map<String, Object> rs = new HashMap<>();
LineConfig conf = lineConfigData.get(lineCode);
conf.setOutConfig(type);
conf.setInConfig(type);
lineConfigData.set(conf);
rs.put("status", ResponseCode.SUCCESS);
rs.put("type", type);
return rs;
}
@Override
public LineConfig getByLineCode(String lineCode) {
return lineConfigData.get(lineCode);
}
}