DomesticDestinationMappingService.java
1.7 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
package com.erry.iclear.dateInterface.service;
import com.erry.iclear.dateInterface.common.Constant;
import com.erry.iclear.dateInterface.entity.AppInfo;
import com.erry.iclear.dateInterface.entity.DomesticDestinationMapping;
import com.erry.iclear.dateInterface.repository.DomesticDestinationMappingRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* @author Administrator
*/
@Service
@Slf4j
public class DomesticDestinationMappingService {
@Autowired
private DomesticDestinationMappingRepository domesticDestinationMappingRepository;
public List<DomesticDestinationMapping> findAllDomesticDestinationMapping(){
List<DomesticDestinationMapping> result = new ArrayList<>();
try{
result=domesticDestinationMappingRepository.findAllDomesticDestinationMapping();
}catch (Exception e){
log.error("findAllDomesticDestinationMapping() error:" + e.getMessage());
}
return result;
}
/**
* 初始化DomesticDestinationMapping
*/
public void initDomesticDestinationMapping() {
try {
Constant.domesticDestinationMappingCache.clear();
List<DomesticDestinationMapping> domList = this.findAllDomesticDestinationMapping();
for (DomesticDestinationMapping dom : domList) {
Constant.domesticDestinationMappingCache.put(dom.getDistrictCode(), dom);
}
} catch (Exception e) {
log.error("initDomesticDestinationMapping() error" + e.getMessage());
}
}
}