1,
<!-- 定时3.用户三个月无操作,停用用户 begin -->
?? ?<bean id="autoStopSleepUserService" class="com.rjhc.application.sysmanage.service.impl.SysTaskScheduleServiceImpl" />
? ? <bean id="jobDetail_stopSleepUserService" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">?
? ? ?? ?<property name="targetObject" ref="autoStopSleepUserService"/>?
? ? ?? ?<property name="targetMethod" value="sleepUser"/>?
? ? </bean>
? ? <bean name="stopSleepUserService" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">?
? ? ?? ?<property name="jobDetail" ref="jobDetail_stopSleepUserService"/>?
? ? ?? ?<property name="cronExpression" value="0 0 21 * * ?" />
?? ?</bean>
2,
?? ?@Override
?? ?public void sleepUser() {
?? ??? ?logger.info("==================睡眠用户start====================");
?? ??? ?try {
?? ??? ??? ?int sleepNum = Integer.parseInt(sysParameterService.getParamValue("SLEEP_USER_MON"));
?? ??? ??? ?String oldDate = nextMonth(null,-sleepNum);
?? ??? ??? ?personService.updateStatusByDate(oldDate, Constants.STATUS_SLEEP);
?? ??? ?} catch (Exception e) {
?? ??? ??? ?logger.error("睡眠用户定时任务异常,错误信息:" + e);
?? ??? ?}
?? ??? ?logger.info("==================睡眠用户end ?====================");
?? ?}
3,
@Override
?? ?public String getParamValue(String code) throws Exception {
?? ??? ?
?? ??? ?Example example = new Example(SysParameter.class);
?? ? ? ?Example.Criteria criteria = example.createCriteria();
?? ? ? ?criteria.andEqualTo("code", code);
?? ? ? ?List<SysParameter> sysParameter = this.selectByExample(example);
?? ? ? ?return sysParameter.size()>0 ? sysParameter.get(0).getValue():"";
?? ? ? ??? ?
?? ?}
4,
@Override
?? ?public void updateStatusByDate(String oldDate, String status) {
?? ??? ?personDao.updateStatusByDate(oldDate, status);
?? ?}
5,
public int updateStatusByDate(String dateStr, String status);