| | |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class HkSyncOrgUserForHKServiceImpl extends HkSyncBaseServiceImpl { |
| | | public class HkSyncOrgUserFromHKServiceImpl extends HkSyncBaseServiceImpl { |
| | | @Autowired |
| | | private CompanyMapper companyMapper; |
| | | @Autowired |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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()){ |