package com.chinacreator.process.service;

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

import com.chinacreator.process.bean.UserFakeidBean;
import com.chinacreator.process.dao.UserFakeidDao;
import com.chinacreator.process.util.fakeid.FakeidUtil;

@Component
public class UserFakeidQueryService {
	
	@Autowired
	private UserFakeidDao userFakeidDao;

	public String queryFakeid(UserFakeidBean bo) {
		String fakeid = FakeidUtil.getFakeidFromUnicom(bo.getUserid(),bo.getSpid());
		if(fakeid==null || "".equals(fakeid.trim())){
			userFakeidDao.fakeidFail(bo.getOrderid(), bo.getUserid());
		}else{
			userFakeidDao.fakeidSuccess(bo.getOrderid(), bo.getUserid(), fakeid);
			
			//重新同步数据
			userFakeidDao.updateSyncFakeid(bo.getOrderid(), bo.getUserid(), fakeid);
			
			return fakeid;
		}
		
		return "";
	}

	public static void main(String[] args) {
		
	}
}