@@ -0,0 +1,1998 @@
+package top.cardone.configuration.action;%0A%0Aimport com.google.common.collect.Maps;%0Aimport lombok.Setter;%0Aimport org.apache.commons.lang3.BooleanUtils;%0Aimport org.apache.commons.lang3.StringUtils;%0Aimport org.springframework.util.CollectionUtils;%0Aimport top.cardone.configuration.service.DictionaryService;%0Aimport top.cardone.context.ApplicationContextHolder;%0Aimport top.cardone.context.util.MapUtils;%0Aimport top.cardone.core.util.action.Action0;%0A%0Aimport java.time.Instant;%0Aimport java.time.LocalDateTime;%0Aimport java.time.ZoneId;%0Aimport java.util.Date;%0Aimport java.util.Map;%0A%0A/**%0A * Created by cardo on 2017/10/25 0025.%0A */%0Apublic class IfAction implements Action0 %7B%0A    @Setter%0A    private Map%3CString, String%3E findOne;%0A%0A    @Setter%0A    private String actionBeanId;%0A%0A    @Setter%0A    private Integer delay = 120;%0A%0A    @Override%0A    public void action() %7B%0A        if (StringUtils.isBlank(actionBeanId)) %7B%0A            return;%0A        %7D%0A%0A        if (CollectionUtils.isEmpty(findOne)) %7B%0A            return;%0A        %7D%0A%0A        Map%3CString, Object%3E dictionary = ApplicationContextHolder.getBean(DictionaryService.class).findOne(findOne);%0A%0A        if (CollectionUtils.isEmpty(dictionary)) %7B%0A            return;%0A        %7D%0A%0A        String value = MapUtils.getString(dictionary, %22value_%22, %22no%22);%0A%0A        if (!BooleanUtils.toBoolean(value)) %7B%0A            return;%0A        %7D%0A%0A        Date lastModifiedDate = (Date) MapUtils.getObject(dictionary, %22last_modified_date%22);%0A%0A        LocalDateTime delayTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(lastModifiedDate.getTime()), ZoneId.systemDefault()).plusSeconds(delay);%0A%0A        if (delayTime.isBefore(LocalDateTime.now())) %7B%0A            return;%0A        %7D%0A%0A        Map%3CString, Object%3E save = Maps.newHashMap();%0A%0A        save.putAll(findOne);%0A        save.put(%22value%22, %22no%22);%0A%0A        ApplicationContextHolder.getBean(DictionaryService.class).save(save);%0A%0A        ApplicationContextHolder.action(Action0.class, action0 -%3E action0.action(), actionBeanId);%0A    %7D%0A%7D%0A

改进：生成树结构优化 改进：生成权限优化