| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | 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.*; |
| | | import com.doumee.core.haikang.model.param.respose.AcsDeviceInfoResponse; |
| | | import com.doumee.core.haikang.model.param.respose.AcsDeviceListResponse; |
| | | import com.doumee.core.haikang.service.HKService; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.FtpUtil; |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.model.CarEvent; |
| | | import com.doumee.dao.business.model.Device; |
| | | import com.doumee.dao.business.model.DeviceEvent; |
| | | import com.doumee.dao.business.model.VisitEvent; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * 设备信息表Service实现 |
| | |
| | | * @date 2023/11/30 15:33 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class HkSyncImgServiceImpl extends HkSyncBaseServiceImpl { |
| | | |
| | | @Autowired |
| | |
| | | private DeviceEventMapper deviceEventMapper; |
| | | @Autowired |
| | | private VisitEventMapper visitEventMapper; |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | @Override |
| | | @Async |
| | | public String downHKImgs(int type){ |
| | | if(Constants.DEALING_HK_IMG){ |
| | | return null ; |
| | |
| | | |
| | | } |
| | | |
| | | private String downHkImgToFtp(String img1, String serverIndex, String visitEventImg) { |
| | | // |
| | | |
| | | private String downHkImgToFtp(String img1, String serverIndex, String folder) { |
| | | InputStream is = null; |
| | | if(StringUtils.equals(folder,Constants.CAR_EVENT_IMG)){ |
| | | //停车场抓拍图 |
| | | CarPictureRequest param = new CarPictureRequest(); |
| | | param.setPicUri(img1); |
| | | param.setAswSyscode(serverIndex); |
| | | is = HKService.getCarPicture(param); |
| | | }else if(StringUtils.equals(folder,Constants.DEVICE_EVENT_IMG)){ |
| | | //门禁事件图片 |
| | | DevicePictureRequest param = new DevicePictureRequest(); |
| | | param.setPicUri(img1); |
| | | param.setSvrIndexCode(serverIndex); |
| | | is = HKService.getDevicePicture(param); |
| | | }else if(StringUtils.equals(folder,Constants.VISIT_EVENT_IMG)){ |
| | | //访客事件图片 |
| | | VisitPictureRequest param = new VisitPictureRequest(); |
| | | param.setPicUri(img1); |
| | | param.setSvrIndexCode(serverIndex); |
| | | is = HKService.getVisitPicture(param); |
| | | } |
| | | //TODO------jiangping--------- |
| | | try { |
| | | FtpUtil ftp = new FtpUtil(systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_HOST).getCode(), |
| | | Integer.parseInt(systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_PORT).getCode()), |
| | | systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_USERNAME).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_PWD).getCode()); |
| | | String date = DateUtil.getNowShortDate(); |
| | | String fName = File.separator+date+File.separator+ UUID.randomUUID().toString()+".jpg"; |
| | | String fileName = folder+fName; |
| | | boolean r = ftp.uploadInputstream(is,fileName);//上传 |
| | | if(r){ |
| | | log.info("【海康图片下载上传FTP失败】======================" ); |
| | | return fName; |
| | | }else{ |
| | | log.error("【海康图片下载上传FTP失败】======================" ); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("【海康图片下载上传FTP失败】======================"+e.getMessage()); |
| | | } |
| | | return null; |
| | | } |
| | | } |