package com.bcxin.ins.utils;

import com.bcxin.ins.rest.UserSupportUtil;
import com.bcxin.ins.vo.ClientUserVo;
import com.bcxin.ins.vo.ConstProp;
import com.bcxin.mybatisplus.toolkit.StringUtils;
import com.xiaoleilu.hutool.date.DateUtil;

import java.util.Date;

/**
 * <b> 水印内容组装：企业名称或姓名+手机号或邮箱或平台标识+订单号+当前时间 </b>
 * @author ZXF
 * @create 2024/05/22 0022 16:19
 * @version
 * @注意事项 </b>
 */
public class WatermarkUtil {

    public static String getWatermark(String serialnumber){
        ClientUserVo userdetail = UserSupportUtil.getSessionUser();
        String name = StringUtils.isNotEmpty(userdetail.getCompany_name())?userdetail.getCompany_name():StringUtils.isNotEmpty(userdetail.getReal_name())?userdetail.getReal_name():userdetail.getLogin_name();
        if("无企业".equals(name)){
            name = userdetail.getLogin_name()+" "+userdetail.getWeb_id();
        }
        String username = ConstProp.DIGIT_TWO.equals(userdetail.getTerminal_type())?userdetail.getEmail():userdetail.getTelephone();
        if(StringUtils.isEmpty(username)){
            username = userdetail.getWeb_type();
        }
        return name +" "+ username +" "+ serialnumber +" "+ DateUtil.formatDateTime(new Date());
    }
}
