package com.gic.haoban.manage.service.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;

@Component
public class ClerkUtils {

    private static ClerkService clerkService;

    @Autowired
    public void setClerkService(ClerkService clerkService) {
        ClerkUtils.clerkService = clerkService;
    }

    public String getClerkStore(ClerkDTO clerk, String clerkId) {
        if (null == clerk) {
            clerk = clerkService.getclerkById(clerkId);
        }
        if (null == clerk) {
            return null;
        }
        if (clerk.getClerkType() != 0 && clerk.getClerkType() != 1) {
            return null;
        }
        return clerk.getStoreId();
    }

}
