|
@@ -10,6 +10,7 @@ import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import javax.annotation.PostConstruct;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalTime;
|
|
import java.time.LocalTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
@@ -25,11 +26,6 @@ public class SysConfigService {
|
|
|
|
|
|
|
|
@Cacheable("SysConfigServiceGetBigDecimal")
|
|
@Cacheable("SysConfigServiceGetBigDecimal")
|
|
|
public BigDecimal getBigDecimal(String name) {
|
|
public BigDecimal getBigDecimal(String name) {
|
|
|
- try {
|
|
|
|
|
- Thread.sleep(3000);
|
|
|
|
|
- } catch (InterruptedException e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
return sysConfigRepo.findByName(name).map(sysConfig -> new BigDecimal(sysConfig.getValue()))
|
|
return sysConfigRepo.findByName(name).map(sysConfig -> new BigDecimal(sysConfig.getValue()))
|
|
|
.orElse(BigDecimal.ZERO);
|
|
.orElse(BigDecimal.ZERO);
|
|
|
}
|
|
}
|
|
@@ -55,4 +51,16 @@ public class SysConfigService {
|
|
|
.orElseThrow(new BusinessException("配置不存在"));
|
|
.orElseThrow(new BusinessException("配置不存在"));
|
|
|
return Integer.parseInt(str);
|
|
return Integer.parseInt(str);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @PostConstruct
|
|
|
|
|
+ public void init() {
|
|
|
|
|
+ if (!sysConfigRepo.findByName("gift_gas_fee").isPresent()) {
|
|
|
|
|
+ sysConfigRepo.save(SysConfig.builder()
|
|
|
|
|
+ .name("gift_gas_fee")
|
|
|
|
|
+ .desc("转赠gas费")
|
|
|
|
|
+ .type(SysConfig.ValueType.NUMBER)
|
|
|
|
|
+ .value("1")
|
|
|
|
|
+ .build());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|