@RestController
public class DictPoolAction {
- @Autowired
- private DictionaryProxy dictionaryProxy;
+ private final DictionaryProxy dictionaryProxy;
+
+ public DictPoolAction(DictionaryProxy dictionaryProxy) {
+ this.dictionaryProxy = dictionaryProxy;
+ }
@GetMapping("/dictpool")
public Map getDictDataByDicttype(@FormParam("dicttype") String dictType, HttpServletRequest request) {
@GetMapping("/dictrefresh")
public JsonResult refreshDict() {
+ dictionaryProxy.refreshDictionary();
return JsonResult.ok();
}
import com.supwisdom.dlpay.framework.domain.TDictionary;
import com.supwisdom.dlpay.framework.domain.TTranscode;
import com.supwisdom.dlpay.system.service.DictionaryDataService;
+import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
}
@Override
- @Cacheable(cacheNames = "dicationary_cache", key = "#p0")
+ @Cacheable(cacheNames = "dictionary_cache", key = "#p0")
public List<TDictionary> getDictionaryByDictType(String dicttype) {
List<TDictionary> list = dictionaryDao.findAllByDicttype(dicttype);
if (!list.isEmpty()) {
}
+ @Override
+ @CacheEvict(cacheNames = "dictionary_cache", key = "#p0")
+ public void updateDictionaryByDictType(String dicttype, List<TDictionary> list) {
+ for (TDictionary item : list) {
+ if (!dicttype.equals(item.getDicttype())) {
+ throw new IllegalArgumentException("TDictionary dicttype mismatch");
+ }
+ }
+ dictionaryDao.deleteByDicttype(dicttype);
+ for (TDictionary item : list) {
+ dictionaryDao.save(item);
+ }
+ }
+
+ @Override
+ @CacheEvict(cacheNames = "dictionary_cache", key = "#p0")
+ public void refreshCache(String dicttype) {
+ }
+
+ @Override
+ @CacheEvict(cacheNames = "dictionary_cache", allEntries = true)
+ public void refreshCache() {
+
+ }
+
@Override
@Cacheable(cacheNames = "trans_code_cache")
public List<TTranscode> getTransCode() {