package com.zfire.mall.manager.logic.k3;

import com.zfire.mall.manager.bean.k3.RequestApiBean;
import com.zfire.mall.manager.constant.KingDeeCons;
import com.zfire.mall.manager.plus.entity.KingDeeOrganization;
import com.zfire.mall.manager.plus.service.KingDeeOrganizationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;

@Service
@Slf4j
public class K3OrgLogic {

    @Resource
    K3Logic k3Logic;
    @Resource
    KingDeeOrganizationService kingDeeOrganizationService;

//    public void allSync() throws Exception {
//        RequestApiBean request = k3Logic.getInstance("","", KingDeeCons.ORG_INFO, null, null);
//        String filterStr = "FDocumentStatus = 'C'";
//        request.setFieldKeys("FOrgID,FName,FNumber");
//        request.setFilterString(filterStr);
//        request.setOrderString("FCUSTID ASC");
//
//        String[] fields = new String[]{"orgId","name","number"};
//        List<KingDeeOrganization> objects = k3Logic.allSync(request, fields, KingDeeOrganization.class);
//        if (!CollectionUtils.isEmpty(objects)) {
//            kingDeeOrganizationService.saveOrUpdateBatch(objects);
//        }
//    }


}
