/**
 *
 */
package com.uc.demo;

import java.util.List;

import com.foc.fetcher.HCFetcher;
import com.foc.util.DateUtil;
import com.uc.entity.UserProfileEntity;
import com.uc.service.UCUserService;

/**
 * 
 * @team BBDTEK IT Team
 * @author renmb
 * @version 1.0
 * @time  2017年1月18日
 */
public class UCDeleteUserDemoMain {

    /**
     * 
     * @author renmb
     * @time  2017年1月18日
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        System.out.println("[UCDeleteUserDemoMain]开始时间[" + DateUtil.getDateTime() + "]");
        long startTime = System.nanoTime();
        try {
            UCUserService service = new UCUserService();
            if(args.length>0){
                if("ALL".equals(args[0])){// 同步所有没有绑定华为账号的用户
                    List<UserProfileEntity> users = service.findUserList(null);
                    for(int i=0,len=users.size();i<len;i++){
                        System.out.println("[UCDeleteUserDemoMain][DELETE]"+users.get(i).getId());
                        service.deleteUCAccount(users.get(i).getId());
                    }
                } else {
                    for(int i=0,len=args.length;i<len;i++){
                        System.out.println("[UCDeleteUserDemoMain][DELETE]"+args[i]);
                        service.deleteUCAccount(args[i]);
                    }
                }
            }
        } catch (Exception e) {
            // TODO: handle exception
        }
        long endTime = System.nanoTime();
        long duration = endTime - startTime;
        System.out.println("[UCDeleteUserDemoMain]结束时间[" + DateUtil.getDateTime() + "]");
        System.out.println("[UCDeleteUserDemoMain]总共用时：" + duration + "纳秒");
        System.out.println("[UCDeleteUserDemoMain]总共用时格式化：" + DateUtil.getDurationTime(duration));
        HCFetcher.getInstance().shutdown();
        System.exit(0);
    }

}
