package com.dy.rtuMw.server.local; 
 | 
  
 | 
  
 | 
import com.dy.common.mw.protocol.Command; 
 | 
import org.apache.logging.log4j.LogManager; 
 | 
import org.apache.logging.log4j.Logger; 
 | 
/** 
 | 
 * @Author liurunyu 
 | 
 * @Date 2023/12/21 15:17 
 | 
 * @LastEditTime 2023/12/21 15:17 
 | 
 * @Description 
 | 
 */ 
 | 
public class ReturnCommand { 
 | 
  
 | 
    private static Logger log = LogManager.getLogger(ReturnCommand.class); 
 | 
  
 | 
    /** 
 | 
     * 处理命令成功 
 | 
     * @param message 
 | 
     */ 
 | 
    public static Command successed(String message, String commandId, String code, Object attachment) { 
 | 
        log.info(message); 
 | 
        Command command = new Command().createReturnSuccessCommand(message, commandId, code); 
 | 
        command.setAttachment(attachment); 
 | 
        return command; 
 | 
    } 
 | 
    /** 
 | 
     * 处理命令成功 
 | 
     * @param message 
 | 
     */ 
 | 
    public static Command successed(String message, String commandId, String code) { 
 | 
        log.info(message); 
 | 
        return new Command().createReturnSuccessCommand(message, commandId, code); 
 | 
    } 
 | 
    /** 
 | 
     * 处理命令发生错误 
 | 
     * @param message 
 | 
     */ 
 | 
    public static Command errored(String message, String commandId, String code) { 
 | 
        log.error(message); 
 | 
        return new Command().createReturnErrorCommand(message, commandId, code); 
 | 
    } 
 | 
} 
 |