Explorar o código

统计代码提交

chenweida %!s(int64=8) %!d(string=hai) anos
pai
achega
88a61af7e8

+ 9 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/mycache/CachePool.java

@ -21,6 +21,8 @@ import java.util.Map;
 */
@Component
public class CachePool {
    private static List<String> keys=new ArrayList<>();
    /**
     * 到达量的缓存  key 是时间yyyy-MM-dd
     */
@ -178,6 +180,13 @@ public class CachePool {
        return arriveSignFamilyExpenseStatus1Map;
    }
    public static void addKeys(List<String> keyTemp) {
        keys.clear();
        keys.addAll(keyTemp);
    }
    public static List<String> getKeys() {
        return keys;
    }
    public static Map<String, String> getPatientGroup() {
        return patientGroup;
    }

+ 7 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java

@ -127,6 +127,12 @@ public class CurrentDayAllQuotaJob implements Job {
            //计算指标
            computequota();
        }catch (Exception e){
            //延迟上一次key的生命周期
            if(CachePool.getKeys()!=null&&CachePool.getKeys().size()>0){
                for (String key :CachePool.getKeys()){
                    redisTemplate.expire(key, Integer.valueOf(currentExpire), TimeUnit.HOURS);//2小时过期
                }
            }
            //如果出錯立即重新執行
            JobExecutionException e2 =new JobExecutionException(e);
            e2.setRefireImmediately(true);
@ -174,6 +180,7 @@ public class CurrentDayAllQuotaJob implements Job {
        for (String key :RedisStorage.keys){
            redisTemplate.expire(key, Integer.valueOf(currentExpire), TimeUnit.HOURS);//2小时过期
        }
        CachePool.addKeys(RedisStorage.keys);//缓存key
        RedisStorage.keys.clear();//清空Key
        //更新统计时间

+ 1 - 1
patient-co-statistics/src/main/resources/application.yml

@ -74,7 +74,7 @@ logging:
redis:
  quota:
    current:
      expire: 2 #实时统计redis 的过期时间 默认是2小时
      expire: 24 #实时统计redis 的过期时间 默认是2小时
---
spring: