class OffLineAppTask extends BaseTask {
    private long appId;
    private AppDesc appDesc;
    private AppUser userInfo;
    private long auditId;
    @Autowired
    private AppService appService;
    @Autowired
    private InstanceDao instanceDao;
    @Resource(name = "appEmailUtil")
    private AppEmailUtil appEmailUtil;

    @Override
    public List<String> getTaskSteps() {
        List<String> taskStepList = Lists.newArrayList();
        taskStepList.add(TaskConstants.INIT_METHOD_KEY);
        // 2. 执行应用下线处理
        taskStepList.add("executeOffLineApp");
        // 3. 更新应用信息
        taskStepList.add("updateAppStatus");

        return taskStepList;
    }

    /**
     * 初始化参数
     *
     * @return
     */
    @Override
    public TaskFlowStatusEnum init() {<FILL_FUNCTION_BODY>}

    /**
     * 2. 执行应用下线操作
     *
     * @return
     */
    public TaskFlowStatusEnum executeOffLineApp() {
        logger.info("executeOffLineApp");
        if (auditId > 0) {
            appAuditDao.updateAppAuditUser(auditId, 2, userInfo.getId());
        }
        List<InstanceInfo> instanceInfos = instanceDao.getInstListByAppId(appId);
        int type = appDesc.getType();
        List<Boolean> isShutDownList = Lists.newArrayList();
        if (instanceInfos != null) {
            isShutDownList = instanceInfos.parallelStream()
                    .map(instanceInfo -> instanceOffline(instanceInfo, type))
                    .collect(Collectors.toList());
        }
        if (isShutDownList.contains(false)) {
            appEmailUtil.noticeOfflineApp(userInfo, appId, false);
            return TaskFlowStatusEnum.ABORT;
        }
        return TaskFlowStatusEnum.SUCCESS;
    }

    private boolean instanceOffline(InstanceInfo instanceInfo, int type) {
        final String ip = instanceInfo.getIp();
        final int port = instanceInfo.getPort();
        boolean isShutdown = TypeUtil.isRedisType(type) ? redisCenter.shutdown(appId, ip, port) : true;
        if(isShutdown){
            isShutdown = redisCenter.checkShutdownSuccess(instanceInfo);
        }
        if (isShutdown) {
            instanceInfo.setStatus(InstanceStatusEnum.OFFLINE_STATUS.getStatus());
            instanceDao.update(instanceInfo);
        } else {
            logger.error("task {} appId {} {}:{} redis not shutdown!", taskId, appId, ip, port);
            return false;
        }
        return true;
    }

    /**
     * 3. 更新应用信息，发送邮件
     *
     * @return
     */
    public TaskFlowStatusEnum updateAppStatus() {
        logger.info("updateAppStatus");
        appDesc.setStatus(AppStatusEnum.STATUS_OFFLINE.getStatus());
        if (auditId > 0) {
            appAuditDao.updateAppAudit(auditId, 1);
        }
        int count = appService.update(appDesc);
        if (count > 0) {
            appEmailUtil.noticeOfflineApp(userInfo, appId, true);
            return TaskFlowStatusEnum.SUCCESS;
        } else {
            appEmailUtil.noticeOfflineApp(userInfo, appId, false);
            return TaskFlowStatusEnum.ABORT;
        }

    }
}

        TaskFlowStatusEnum taskFlowStatusEnum = super.init();
        appId = MapUtils.getLongValue(paramMap, TaskConstants.APPID_KEY);
        if (appId <= 0) {
            logger.error(marker, "task {} appId {} is wrong", taskId, appId);
            taskFlowStatusEnum = TaskFlowStatusEnum.ABORT;
        }

        auditId = MapUtils.getLongValue(paramMap, TaskConstants.AUDIT_ID_KEY, -1);
        if (auditId <= 0) {
            logger.info(marker, "task {} auditId {} is wrong", taskId, auditId);
        }

        appDesc = appService.getByAppId(appId);
        if (appDesc == null) {
            logger.error(marker, "task {} appId {} appDesc is not exist", taskId, appId);
            taskFlowStatusEnum = TaskFlowStatusEnum.ABORT;
        }
        Object userObject = MapUtils.getObject(paramMap, TaskConstants.USER_INFO_KEY, null);
        if (userObject instanceof JSONObject) {
            JSONObject userJson = (JSONObject) userObject;
            userInfo = JSONObject.parseObject(JSON.toJSONString(userJson), AppUser.class);
        }
        if (userInfo == null) {
            logger.error(marker, "task {} appId {} userInfo is not exist", taskId, appId);
            taskFlowStatusEnum = TaskFlowStatusEnum.ABORT;
        } else {
            if (!ConstUtils.SUPER_MANAGER.contains(userInfo.getName())) {
                logger.error("task {} appId {} user {} who hope to offline hasn't privilege", taskId, appId, userInfo.getName());
                taskFlowStatusEnum = TaskFlowStatusEnum.ABORT;
            }
        }
        if (taskFlowStatusEnum == TaskFlowStatusEnum.ABORT) {
            appEmailUtil.noticeOfflineApp(userInfo, appId, false);
        }
        return taskFlowStatusEnum;
    
<methods>public non-sealed void <init>() ,public static java.lang.String generateMasterName(java.lang.String, int) ,public Map<java.lang.String,java.lang.Object> getParamMap() ,public abstract List<java.lang.String> getTaskSteps() ,public com.sohu.cache.task.constant.TaskStepFlowEnum.TaskFlowStatusEnum init() ,public void setParamMap(Map<java.lang.String,java.lang.Object>) <variables>public static final java.lang.String MARKER_NAME,private static final java.lang.String NUT_CRACKER_TEMPLATE_FILE,private static final java.lang.String NUT_CRACKER_TEMPLATE_NO_CPUIDX_FILE,private static final java.lang.String PIKA_TEMPLATE_FILE,private static final java.lang.String REDIS_COMMON_TEMPLATE_FILE,private static final java.lang.String REDIS_COMMON_TEMPLATE_NO_CPUIDX_FILE,private static final java.lang.String REDIS_MIGRATE_TOOL_TEMPLATE_FILE,private static final java.lang.String REDIS_PORT_TEMPLATE_FILE,protected com.sohu.cache.dao.AppAuditDao appAuditDao,protected com.sohu.cache.dao.AppDao appDao,protected com.sohu.cache.web.util.AppEmailUtil appEmailUtil,protected java.lang.String appEnvName,protected com.sohu.cache.web.service.AppService appService,protected com.sohu.cache.stats.app.AppStatsCenter appStatsCenter,protected com.sohu.cache.task.util.AppWechatUtil appWechatUtil,protected com.sohu.cache.redis.AssistRedisService assistRedisService,protected com.sohu.cache.dao.DiagnosticTaskRecordDao diagnosticTaskRecordDao,protected org.springframework.core.env.Environment environment,protected com.sohu.cache.dao.InstanceBigKeyDao instanceBigKeyDao,protected com.sohu.cache.dao.InstanceDao instanceDao,protected com.sohu.cache.stats.instance.InstanceDeployCenter instanceDeployCenter,protected com.sohu.cache.web.service.InstancePortService instancePortService,protected com.sohu.cache.dao.InstanceStatsDao instanceStatsDao,protected org.slf4j.Logger logger,protected com.sohu.cache.machine.MachineCenter machineCenter,protected com.sohu.cache.dao.MachineDao machineDao,protected com.sohu.cache.dao.MachineRelationDao machineRelationDao,protected com.sohu.cache.dao.MachineRoomDao machineRoomDao,protected com.sohu.cache.dao.MachineStatsDao machineStatsDao,public static final org.slf4j.Marker marker,protected com.sohu.cache.web.service.ModuleService moduleService,protected Map<java.lang.String,java.lang.Object> paramMap,protected com.sohu.cache.redis.RedisCenter redisCenter,protected com.sohu.cache.redis.RedisConfigTemplateService redisConfigTemplateService,protected com.sohu.cache.redis.RedisDeployCenter redisDeployCenter,protected com.sohu.cache.dao.ResourceDao resourceDao,protected com.sohu.cache.web.service.ResourceService resourceService,protected com.sohu.cache.ssh.SSHService sshService,protected long taskId,protected com.sohu.cache.task.TaskService taskService