jiangping
2024-02-21 39739e34af928aae204c55db7974213c9b938c5a
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/fhk/HkSyncOrgUserFromHKServiceImpl.java
@@ -36,7 +36,7 @@
 */
@Service
@Slf4j
public class HkSyncOrgUserForHKServiceImpl extends HkSyncBaseServiceImpl {
public class HkSyncOrgUserFromHKServiceImpl extends HkSyncBaseServiceImpl {
    @Autowired
    private CompanyMapper companyMapper;
    @Autowired
@@ -65,7 +65,7 @@
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,当前不支持组织同步操作~");
            }
            LoginUserInfo user =  (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
            OrgUserListRequest param = new OrgUserListRequest();
            TimeRangeListRequest param = new TimeRangeListRequest();
            //获取ERP组织信息(全量同步)
            boolean hasNext = true;
            int curTotal = 0;
@@ -74,12 +74,15 @@
            List<Company>  allHkList = new ArrayList<>();
            while (hasNext){
                //分页遍历循环查询所有门禁设备数据
                param = new OrgUserListRequest();
                param = new TimeRangeListRequest();
                param.setPageNo(curPage);
                param.setPageSize(100);
                BaseResponse<BaseListPageResponse<OrgInfoResponse>> response = HKService.orgAllList(param);
                if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
                    throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,海康同步数据失败~");
                }
                if(response.getData() == null || response.getData().getTotal() ==0){
                    throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未同步到任何信息!");
                }
                BaseListPageResponse<OrgInfoResponse> r = response.getData();
                curTotal += 100;
@@ -152,7 +155,7 @@
            if(companies == null || companies.size() == 0){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,请先同步企业组织信息~");
            }
            OrgUserListRequest param = new OrgUserListRequest();
            TimeRangeListRequest param = new TimeRangeListRequest();
            //获取ERP组织信息(全量同步)
            boolean hasNext = true;
            int curTotal = 0;
@@ -160,13 +163,16 @@
            List<Member>  allHkList = new ArrayList<>();
            while (hasNext){
                //分页遍历循环查询所有门禁设备数据
                param = new OrgUserListRequest();
                param = new TimeRangeListRequest();
                param.setPageNo(curPage);
                param.setPageSize(100);
                BaseResponse<BaseListPageResponse<UserInfoResponse>> response = HKService.userAllList(param);
                if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
                    throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,海康同步数据失败~");
                }
                if(response.getData() == null || response.getData().getTotal() ==0){
                    throw  new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未同步到任何信息!");
                }
                BaseListPageResponse<UserInfoResponse> r = response.getData();
                curTotal += 100;
                if(curTotal >= r.getTotal()){