package com.mortals.xhx.common.utils;

import com.alibaba.fastjson.JSON;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.site.model.SiteTreeSelect;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @author: zxfei
 * @date: 2022/4/13 13:34
 * @description:
 **/
@AllArgsConstructor
@Slf4j
public class SyncTreeSiteThread implements Runnable {

    private SiteService siteService;

    private Context context;

    @Override
    public void run() {
        List<SiteTreeSelect> siteTreeSelects = siteService.siteTree(context);
        siteService.setSiteTree(siteTreeSelects, context);
        log.debug("刷新用户站点树=》userID:{} siteTree:{}",context.getUser().getId(), JSON.toJSONString(siteService.getSiteTree(context)));
    }


    
}
