package com.zcloud.util.examUntil;

import com.alibaba.fastjson.JSON;
import com.zcloud.entity.PageData;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.UuidUtil;

import java.util.Date;
import java.util.List;

/**
 * @Description: TODO
 * @Author: dearLin
 * @Date: 2023/8/17/017 15:10
 * @Param:
 * @Return:
 */
public class UserChangeRecordConfig {

    public static final String PC = "pc端";
    public static final String APP = "app端";
    public static final String APP_EDIT_BASE_INFO = "app端修改用户基础信息";
    public static final String APP_EDIT_CORP_BASE_INFO = "app端修改用户就职信息";
    public static final String PC_EDIT_BASE_INFO = "pc端修改用户基础信息";
    public static final String PC_IMPROT_USER_BASE_INFO = "pc端导入用户信息";
    public static final String PC_EDIT_CORP_BASE_INFO = "pc端修改用户就职信息";
    public static final String PC_DEL_CORP_BASE_INFO = "pc端解除用户服务信息";


    public static final String PC_IMPROT_USER_BASE_img = "img端导入用户信息";
    /**
     * @Description: 修改信息
     * @Author: dearLin
     * @Date: 2023/8/17/017 15:47
     * @Param: [java.util.List<com.zcloud.entity.PageData>, com.zcloud.entity.PageData] [logUserList, user]
     * @Return: java.util.List<com.zcloud.entity.PageData>
     */
    public static List<PageData> editUserLogPc(List<PageData> logUserList, PageData user) {
        user.put("CREATTIME", DateUtil.date2Str(new Date()));
        user.put("CHANGE_RECORD_ID", UuidUtil.get32UUID());
        user.put("CHANGE_DATA", JSON.toJSONString(user));
        user.put("CREATOR", Jurisdiction.getUSER_ID());
        user.put("CREATOR_NAME", Jurisdiction.getUsername());
        logUserList.add(user);
        return logUserList;
    }

    /**
     * @Description: 导入用户信息
     * @Author: dearLin
     * @Date: 2023/8/17/017 15:47
     * @Param: [java.util.List<com.zcloud.entity.PageData>, com.zcloud.entity.PageData] [logUserList, user]
     * @Return: java.util.List<com.zcloud.entity.PageData>
     */
    public static void importUserLogPc(PageData user) {
        user.put("CREATTIME", DateUtil.date2Str(new Date()));
        user.put("CHANGE_RECORD_ID", UuidUtil.get32UUID());
        user.put("CHANGE_DATA", JSON.toJSONString(user));
        user.put("CREATOR", Jurisdiction.getUSER_ID());
        user.put("CREATOR_NAME", Jurisdiction.getUsername());
        user.put("REAMKE", "人员被" + Jurisdiction.getUsername() + "导入,就职于：" + user.getString("CORPINFO_NAME") + "。部门：" + user.getString("DEPARTMENT_NAME"));
    }

    /**
     * @Description: 导入修改用户信息
     * @Author: dearLin
     * @Date: 2023/8/17/017 15:47
     * @Param: [java.util.List<com.zcloud.entity.PageData>, com.zcloud.entity.PageData] [logUserList, user]
     * @Return: java.util.List<com.zcloud.entity.PageData>
     */
    public static void importEditUserLogPc(PageData user) {
        user.put("CREATTIME", DateUtil.date2Str(new Date()));
        user.put("CHANGE_RECORD_ID", UuidUtil.get32UUID());
        user.put("CHANGE_DATA", JSON.toJSONString(user));
        user.put("CREATOR", Jurisdiction.getUSER_ID());
        user.put("CREATOR_NAME", Jurisdiction.getUsername());
        user.put("REAMKE", "人员被" + Jurisdiction.getUsername() + "导入更新,就职于：" + user.getString("CORPINFO_NAME") + "。部门：" + user.getString("DEPARTMENT_NAME"));

    }

    /**
     * @Description: 解除服务关系
     * @Author: dearLin
     * @Date: 2023/8/17/017 15:47
     * @Param: [java.util.List<com.zcloud.entity.PageData>, com.zcloud.entity.PageData] [logUserList, user]
     * @Return: java.util.List<com.zcloud.entity.PageData>
     */
    public static List<PageData> clearRelation(List<PageData> logUserList, PageData user) {
        user.put("CREATTIME", DateUtil.date2Str(new Date()));
        user.put("CHANGE_RECORD_ID", UuidUtil.get32UUID());
        user.put("CHANGE_DATA", JSON.toJSONString(user));
        user.put("CREATOR", Jurisdiction.getUSER_ID());
        user.put("CREATOR_NAME", Jurisdiction.getUsername());
        user.put("REAMKE", "人员被" + Jurisdiction.getUsername() + "解除服务关系,曾就职于：" + user.getString("CORPINFO_NAME") + "。部门：" + user.getString("DEPARTMENT_NAME"));
        logUserList.add(user);
        return logUserList;
    }
}
