| | |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.haikang.model.HKConstants; |
| | | import com.doumee.core.haikang.model.param.BaseResponse; |
| | | import com.doumee.core.haikang.model.param.request.AcsDeviceListRequest; |
| | | import com.doumee.core.haikang.model.param.request.PrivilegeGroupRequest; |
| | | import com.doumee.core.haikang.model.param.respose.AcsDeviceInfoResponse; |
| | | import com.doumee.core.haikang.model.param.respose.AcsDeviceListResponse; |
| | | import com.doumee.core.haikang.model.param.respose.PrivilegeGroupInfoResponse; |
| | | import com.doumee.core.haikang.model.param.respose.PrivilegeGroupListResponse; |
| | | import com.doumee.core.haikang.service.HKService; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.DeviceRoleMapper; |
| | | import com.doumee.dao.business.model.Device; |
| | | import com.doumee.dao.business.model.DeviceRole; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | param = new PrivilegeGroupRequest(); |
| | | param.setPageNo(curPage); |
| | | param.setPageSize(100); |
| | | BaseResponse<PrivilegeGroupListResponse> response = HKService.privilegeGroup(param); |
| | | // BaseResponse<PrivilegeGroupListResponse> response = HKService.privilegeGroup(param); |
| | | // if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){ |
| | | // response = HKService.privilegIccmeGroup(param);//接口V1版本不存在,调用iccm版本接口 |
| | | // } |
| | | BaseResponse<PrivilegeGroupListResponse> response = HKService.privilegIccmeGroup(param);//接口V1版本不存在,调用iccm版本接口 |
| | | if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){ |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对不起,海康同步数据失败~"); |
| | | } |
| | |
| | | } |
| | | } |
| | | if(addList.size()>0){ |
| | | DeviceRoleMapper.insertBatchSomeColumn(addList); |
| | | DeviceRoleMapper.insert(addList); |
| | | } |
| | | if(editList.size()>0){ |
| | | for(DeviceRole d : editList){ |
| | |
| | | if(model !=null){ |
| | | //如果已存在,则更新数据 |
| | | model = initDataByHkData(model,device,date); |
| | | if(allHkList.size()==1){ |
| | | model.setIsDefault(Constants.ZERO); |
| | | } |
| | | editList.add(model); |
| | | }else{ |
| | | //如果不存在,则新增数据 |
| | | model = new DeviceRole(); |
| | | model = initDataByHkData(model,device,date); |
| | | if(allHkList.size()==1){ |
| | | model.setIsDefault(Constants.ZERO); |
| | | } |
| | | addList.add(model); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private boolean isDeletedData(DeviceRole device, List<PrivilegeGroupInfoResponse> allHkList) { |
| | | if(allHkList.size()>0){ |
| | | for(PrivilegeGroupInfoResponse r : allHkList){ |
| | |
| | | } |
| | | } |
| | | return true; |
| | | |
| | | } |
| | | |
| | | } |