|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.HKConstants; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.request.*; | 
|---|
|  |  |  | 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.dao.MemberMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.model.*; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Member; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.apache.commons.io.IOUtils; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.*; | 
|---|
|  |  |  | import java.net.URL; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.UUID; | 
|---|
|  |  |  | 
|---|
|  |  |  | private CarEventMapper carEventMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private MemberMapper memberMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlatformEventMapper platformEventMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DeviceEventMapper deviceEventMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | 
|---|
|  |  |  | startDealDeviceImg(); | 
|---|
|  |  |  | //查询所有人员人脸照片 | 
|---|
|  |  |  | startDealMemberImg(); | 
|---|
|  |  |  | //查询所有月台事件中抓拍图照片 | 
|---|
|  |  |  | startDealPlatformEventImg(); | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | }finally { | 
|---|
|  |  |  | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void startDealMemberImg() { | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void startDealMemberImg() { | 
|---|
|  |  |  | List<Member> list = memberMapper.selectList(new QueryWrapper<Member>().lambda() | 
|---|
|  |  |  | .eq(Member::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .likeRight(Member::getFaceImg,HKConstants.IMG_INDEX)); | 
|---|
|  |  |  | .likeRight(Member::getFaceImg, HKConstants.IMG_INDEX)); | 
|---|
|  |  |  | Date date= new Date(); | 
|---|
|  |  |  | if(list !=null && list.size()>0){ | 
|---|
|  |  |  | for(Member model:list){ | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | memberMapper.updateById(event); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void startDealPlatformEventImg() { | 
|---|
|  |  |  | List<PlatformEvent> list = platformEventMapper.selectList(new QueryWrapper<PlatformEvent>().lambda() | 
|---|
|  |  |  | .eq(PlatformEvent::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .isNotNull(PlatformEvent::getBackgroundImageContent) | 
|---|
|  |  |  | .notLikeRight(PlatformEvent::getBackgroundImageContent, HKConstants.IMG_INDEX_ERROR) | 
|---|
|  |  |  | .isNull(PlatformEvent::getBackgroundImageDown)); | 
|---|
|  |  |  | Date date= new Date(); | 
|---|
|  |  |  | if(list !=null && list.size()>0){ | 
|---|
|  |  |  | for(PlatformEvent model:list){ | 
|---|
|  |  |  | String rs1 = null; | 
|---|
|  |  |  | PlatformEvent event = new PlatformEvent(); | 
|---|
|  |  |  | event.setId(model.getId()); | 
|---|
|  |  |  | event.setEditDate(date); | 
|---|
|  |  |  | if(StringUtils.isNotBlank(model.getBackgroundImageContent())){ | 
|---|
|  |  |  | String img1 = model.getBackgroundImageContent(); | 
|---|
|  |  |  | rs1 = downHkImgToFtp(img1,"",Constants.PLATFORM_EVENT_IMG); | 
|---|
|  |  |  | if(StringUtils.isNotBlank(rs1)){ | 
|---|
|  |  |  | event.setBackgroundImageDown(rs1); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | event.setBackgroundImageContent(HKConstants.IMG_INDEX_ERROR+model.getBackgroundImageContent()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | platformEventMapper.updateById(event); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | param.setPicUri(img1.replace(HKConstants.IMG_INDEX_ERROR,"").replace(HKConstants.IMG_INDEX,"")); | 
|---|
|  |  |  | param.setServerIndexCode(serverIndex); | 
|---|
|  |  |  | is = HKService.getFaceInputStream(param); | 
|---|
|  |  |  | }else if(StringUtils.equals(folder_code,Constants.PLATFORM_EVENT_IMG)){ | 
|---|
|  |  |  | //月台事件图片 | 
|---|
|  |  |  | log.info("月台图片下载开始:=========================="+img1); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | is = new URL(img1).openStream(); | 
|---|
|  |  |  | byte[] bytes = IOUtils.toByteArray(is); | 
|---|
|  |  |  | is = new ByteArrayInputStream(bytes); | 
|---|
|  |  |  | //              is = HttpsUtil.connectionInputsteam(img1,"GET",null,null); | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | log.error("月台图片下载失败:=========================="+img1+"\n"+e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(is ==null){ | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | if(ftp == null){ | 
|---|
|  |  |  | ftp = new FtpUtil(systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_HOST).getCode(), | 
|---|