| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.lf.server.entity.data.FmeLogEntity; |
| | | import com.lf.server.service.all.ScheduleService; |
| | | import com.lf.server.service.all.WebSocketService; |
| | | import com.lf.server.service.sys.AttachService; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 日程配置类 |
| | |
| | | @EnableScheduling |
| | | public class ScheduleConfig { |
| | | @Autowired |
| | | private ScheduleService scheduleService; |
| | | AttachService attachService; |
| | | |
| | | @Autowired |
| | | ScheduleService scheduleService; |
| | | |
| | | private static final Log log = LogFactory.getLog(ScheduleConfig.class); |
| | | |
| | |
| | | jsonObject.put("resUseCount", scheduleService.countResStatus()); |
| | | |
| | | // 用户登录状态 sys_login |
| | | jsonObject.put("userLoginCount", scheduleService.userLoginCount()); |
| | | jsonObject.put("userLoginCount", scheduleService.userLoginCount()); |
| | | |
| | | // 资源操作状态 sys_operate |
| | | jsonObject.put("operateCount", scheduleService.operateCount()); |
| | |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 同步附件 |
| | | */ |
| | | @Scheduled(fixedRate = 30 * 1000) |
| | | public void syncAttaches() { |
| | | try { |
| | | List<FmeLogEntity> list = attachService.selectFmeLogs(); |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | for (FmeLogEntity entity : list) { |
| | | attachService.syncAttaches(entity); |
| | | attachService.updateFmeLog(entity.getId()); |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | } |