All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jizcode.netty.contract.RtDataFromClient Maven / Gradle / Ivy

package jizcode.netty.contract;

import jizcode.base.util.EncryptUtils;

public class RtDataFromClient {
    private Integer cmd;
    private String ouCode;
    private String json;
    private long uniqueId;

    /**
     * @return the cmd
     */
    public Integer getCmd() {
        return cmd;
    }

    /**
     * @return the uniqueId
     */
    public long getUniqueId() {
        return uniqueId;
    }

    /**
     * @param uniqueId the uniqueId to set
     */
    public void setUniqueId(long uniqueId) {
        this.uniqueId = uniqueId;
    }

    /**
     * @return the json
     */
    public String getJson() {
        return json;
    }

    /**
     * @param json the json to set
     */
    public void setJson(String json) {
        this.json = json;
    }

    /**
     * @return the ouCode
     */
    public String getOuCode() {
        return ouCode;
    }

    /**
     * @param ouCode the ouCode to set
     */
    public void setOuCode(String ouCode) {
        this.ouCode = ouCode;
    }

    /**
     * @param cmd the cmd to set
     */
    public void setCmd(Integer cmd) {
        this.cmd = cmd;
    }

    public RtDataFromClient(){

    }

    // public RtDataFromClient(RtDataFromServer dataFromServer){
    //     this.cmd = dataFromServer.getCmd();
    //     this.uniqueId = dataFromServer.getUniqueId();
    //     this.md5 = Md5Util.md5(String.format("%d-%s-%d-%s",
    //         dataFromServer.getCmd(),
    //         dataFromServer.getOuCode(), 
    //         dataFromServer.getUniqueId(),
    //         dataFromServer.getJson()));
    // }

    public static RtDataFromClient fromServer(RtDataFromServer dataFromServer) throws Exception{
        RtDataFromClient data = new RtDataFromClient();
        data.cmd = dataFromServer.getCmd();
        data.uniqueId = dataFromServer.getUniqueId();
        data.md5 = EncryptUtils.md5X2(String.format("%d-%s-%d-%s",
                dataFromServer.getCmd(),
                dataFromServer.getOuCode(),
                dataFromServer.getUniqueId(),
                dataFromServer.getJson()));
        return data;
    }

    private String md5;

    public String getMd5(){
        return md5;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy