| | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.dingTalk.DingTalk; |
| | | 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.EventSubRequest; |
| | | import com.doumee.core.haikang.service.HKService; |
| | | import com.doumee.core.utils.Constants; |
| | |
| | | if(Constants.equalsInteger(model.getStatus(),param.getStatus())){ |
| | | return; |
| | | } |
| | | if(StringUtils.isNotBlank(param.getCode())&&Constants.equalsInteger(model.getType(),Constants.ZERO)||Constants.equalsInteger(model.getType(),Constants.ONE)){ |
| | | |
| | | if(StringUtils.isNotBlank(model.getCode())&&(Constants.equalsInteger(model.getType(),Constants.ZERO)||Constants.equalsInteger(model.getType(),Constants.ONE))){ |
| | | EventSubRequest eventParam = new EventSubRequest(); |
| | | String path =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode(); |
| | | eventParam.setEventDest(path+"/notice"); |
| | |
| | | } |
| | | HKService.cancelEventSub(eventParam);//先取消 |
| | | if(Constants.equalsInteger(param.getStatus(),Constants.ONE)){ |
| | | HKService.eventSub(eventParam);//安防事件 |
| | | BaseResponse response = HKService.eventSub(eventParam);//安防事件 |
| | | if(Objects.nonNull(response)&&StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){ |
| | | model.setSubscribeStatus(Constants.ONE); |
| | | }else{ |
| | | model.setSubscribeStatus(Constants.TWO); |
| | | model.setSubscribeInfo(response.getMsg()); |
| | | } |
| | | |
| | | startCheckThirdDest(eventParam); |
| | | |
| | | }else{ |
| | | model.setSubscribeStatus(Constants.ZERO); |
| | | } |
| | | } |
| | | |
| | | |
| | | model.setStatus(param.getStatus()); |
| | | model.setEditDate(new Date()); |
| | | model.setEditor(param.getLoginUserInfo().getId()); |
| | | warningMapper.updateById(model); |
| | | } |
| | | |
| | | /** |
| | | * 检查三方是否需要订阅海康事件 |
| | | * @param eventParam |
| | | */ |
| | | |
| | | private void startCheckThirdDest(EventSubRequest eventParam) { |
| | | try { |
| | | String thirdpath =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_THIRD_URL).getCode(); |
| | | if(StringUtils.isNotBlank(thirdpath)){ |
| | | String[] ss = thirdpath.split(";"); |
| | | for(String s : ss){ |
| | | eventParam.setEventDest(s); |
| | | BaseResponse response = HKService.eventSub(eventParam); |
| | | if(Objects.nonNull(response)&&StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){ |
| | | log.error("========订阅其他三方地址成功:"+s); |
| | | }else{ |
| | | log.error("========订阅其他三方地址错误:"+s); |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("========订阅其他三方地址错误"+e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(memberList)&&memberList.size()>Constants.ZERO){ |
| | | List<String> ddUserIdList = memberList.stream().map(j->j.getErpId()).collect(Collectors.toList()); |
| | | //发送推送钉钉消息 |
| | | |
| | | Boolean isSuccess = dingTalk.workInfoOANotice(Long.valueOf(systemDictDataBiz.queryByCode(Constants.DD_TALK,Constants.AGENT_ID).getCode()), |
| | | String.join(",",ddUserIdList), |
| | | ddNoticeConfigMapper.selectCount(new QueryWrapper<DdNoticeConfig>().lambda() |