|  |  |  | 
|---|
|  |  |  | package com.doumee.service.business.impl.hksync; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.aliyun.tea.TeaException; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
|---|
|  |  |  | import com.doumee.core.constants.ResponseStatus; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.DateUtil; | 
|---|
|  |  |  | import com.doumee.dao.business.DeviceMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.ParksMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Device; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Parks; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | public class HkSyncDeviceServiceImpl extends HkSyncBaseServiceImpl { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DeviceMapper deviceMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 同步海康门禁设备数据 | 
|---|
|  |  |  | * @param param | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Device initLedDataByHkData(Device model, LedRecordsInfoResponse door, Date date) { | 
|---|
|  |  |  | model.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | model.setHkId(door.getIndexCode()); | 
|---|
|  |  |  | model.setHkId(door.getModel_data_id()); | 
|---|
|  |  |  | model.setHkDate(date); | 
|---|
|  |  |  | model.setHkStatus(Constants.ONE); | 
|---|
|  |  |  | model.setNo(door.getIndex_code()); | 
|---|
|  |  |  | model.setType(Constants.TWO); | 
|---|
|  |  |  | model.setManufature(door.getManufacturer()); | 
|---|
|  |  |  | model.setPort(door.getPort()); | 
|---|
|  |  |  | model.setIp(door.getAddr()); | 
|---|
|  |  |  | model.setResourceType(door.getDevice_type()); | 
|---|
|  |  |  | model.setName(door.getScreen_name()); | 
|---|
|  |  |  | model.setRemark(JSONObject.toJSONString(door)); | 
|---|
|  |  |  | model.setDoorId(door.getIndexCode()); | 
|---|
|  |  |  | return  model; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private Device initBroadcastDataByHkData(Device model, FetchAudioChannelInfoResponse device, Date date) { | 
|---|
|  |  |  | 
|---|
|  |  |  | private Device getExistedLed(LedRecordsInfoResponse device, List<Device> allList) { | 
|---|
|  |  |  | if(allList.size()>0){ | 
|---|
|  |  |  | for(Device r : allList){ | 
|---|
|  |  |  | if(StringUtils.equals(r.getHkId(), device.getIndexCode())){ | 
|---|
|  |  |  | if(StringUtils.equals(r.getHkId(), device.getModel_data_id())){ | 
|---|
|  |  |  | //表示未删除 | 
|---|
|  |  |  | return  r; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | private boolean isDeletedLedDevice(Device device, List<LedRecordsInfoResponse> allHkList) { | 
|---|
|  |  |  | if(allHkList.size()>0){ | 
|---|
|  |  |  | for(LedRecordsInfoResponse r : allHkList){ | 
|---|
|  |  |  | if(StringUtils.equals(device.getDoorId(), r.getIndexCode())){ | 
|---|
|  |  |  | if(StringUtils.equals(device.getHkId(), r.getModel_data_id())){ | 
|---|
|  |  |  | //表示未删除 | 
|---|
|  |  |  | return  false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | private boolean isDeletedBroadcastDevice(Device device, List<FetchAudioChannelInfoResponse> allHkList) { | 
|---|
|  |  |  | if(allHkList.size()>0){ | 
|---|
|  |  |  | for(FetchAudioChannelInfoResponse r : allHkList){ | 
|---|
|  |  |  | if(StringUtils.equals(device.getDoorId(), r.getAudioChannelIndexCode())){ | 
|---|
|  |  |  | if(StringUtils.equals(device.getHkId(), r.getAudioChannelIndexCode())){ | 
|---|
|  |  |  | //表示未删除 | 
|---|
|  |  |  | return  false; | 
|---|
|  |  |  | } | 
|---|