package com.qxueyou.scc.exercise.service.impl; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.qxueyou.scc.base.service.ICacheService; import com.qxueyou.scc.exercise.service.IExerciseVerService; /** * °à¼¶ÕýÈ·ÂÊ´¦Àíservice * @author zhiyong * */ @Service("ExerciseGroupAccuracyDealService") public class ExerciseGroupAccuracyDealService { /** »º´æservice */ @Autowired ICacheService cache; /** Á·Ï°½Ó¿Úservice */ @Autowired IExerciseVerService exerciseVerService; /** ÅäÖÃservice */ /*@Autowired IConfigService config;*/ /** * ÅÅÃû¸üÐÂʱ¼ä,ĬÈÏ60Ãë °ëСʱ¸üÐÂÒ»´Î */ //private int updateRankMinutes = 60; @SuppressWarnings("unused") private static Logger log = LogManager.getLogger("ExerciseGroupAccuracyDealService"); /*@PostConstruct void init() { CommonONSConsumer.registerHandler("EXER_GROUP_ACCURACY", "ExerciseGroupAccuracyDealService"); //updateRankMinutes = Integer.parseInt(config.getConfigByEnv("ons-classAccuracy-update-minutes")); } @Override public void doHandle(Message msg, ConsumeContext context) { try { String groupId = msg.getUserProperties("groupId"); String doCount = msg.getUserProperties("doCount"); String correctCount = msg.getUserProperties("correctCount"); if(cache.get(getCacheIdFromRank(groupId), Integer.class) != null){// »º´æ²»Îª¿Õ ˵Ã÷ÒѾ­´¦Àí¹ý return; } updateUpdateTime(groupId); // ¸üÐÂ×Ö¶ÎÖµµ½exercise_group_extend±í exerciseVerService.doUpdateExerGroupClsAccuracy(groupId,doCount,correctCount); } catch (Exception e) { log.error("¸üÐÂÁ·Ï°×é°à¼¶ÕýÈ·ÂÊʧ°Ü:" + e, e); throw e; } }*/ /** * ²åÈ뻺´æ¼Ç¼£¬±ê¼Ç±¾´Î¸üÐÂÅÅÃûʱ¼ä °ëСʱ¸üÐÂÒ»´Î * * @param rank private void updateUpdateTime(String groupId) { cache.set(getCacheIdFromRank(groupId), 30 * updateRankMinutes, 1); } /** * »ñÈ¡cacheId * * @param rank * @return private String getCacheIdFromRank(String groupId) { return Constants.EXER_GROUP_ACCURACY_CACHE_KEY + groupId; }*/ }