| | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.dingTalk.DingTalk; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.haikang.model.param.request.EventSubRequest; |
| | | import com.doumee.core.haikang.service.HKService; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.WeatherUtil; |
| | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | @Autowired |
| | | private DdNoticeConfigMapper ddNoticeConfigMapper; |
| | | |
| | | |
| | | @Override |
| | | public Integer create(Warning warning) { |
| | |
| | | .eq(Warning::getName,warning.getName()) )>0){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,事件类型已存在,请返回刷新页面查看!"); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(warning.getCode())&&Constants.equalsInteger(warning.getType(),Constants.ZERO)||Constants.equalsInteger(warning.getType(),Constants.ONE)){ |
| | | EventSubRequest eventParam = new EventSubRequest(); |
| | | String path =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode(); |
| | | eventParam.setEventDest(path+"/notice"); |
| | | try { |
| | | eventParam.setEventTypes(new Integer[]{Integer.valueOf(warning.getCode())}); |
| | | }catch (Exception e){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"事件编码错误!"); |
| | | } |
| | | HKService.cancelEventSub(eventParam);//先取消 |
| | | if(Constants.equalsInteger(warning.getStatus(),Constants.ONE)){ |
| | | HKService.eventSub(eventParam);//安防事件 |
| | | } |
| | | } |
| | | |
| | | |
| | | warning.setStatus(Constants.formatIntegerNum(warning.getStatus())); |
| | | warning.setIsdeleted(Constants.ZERO); |
| | | warning.setCreator(warning.getLoginUserInfo().getId()); |
| | |
| | | |
| | | @Override |
| | | public void deleteById(Integer id, LoginUserInfo user) { |
| | | Warning warning = warningMapper.selectById(id); |
| | | if(Objects.isNull(warning)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(warning.getCode())&&Constants.equalsInteger(warning.getType(),Constants.ZERO)||Constants.equalsInteger(warning.getType(),Constants.ONE)){ |
| | | EventSubRequest eventParam = new EventSubRequest(); |
| | | String path =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode(); |
| | | eventParam.setEventDest(path+"/notice"); |
| | | try { |
| | | eventParam.setEventTypes(new Integer[]{Integer.valueOf(warning.getCode())}); |
| | | }catch (Exception e){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"事件编码错误!"); |
| | | } |
| | | HKService.cancelEventSub(eventParam);//先取消 |
| | | } |
| | | |
| | | warningMapper.update(null,new UpdateWrapper<Warning>().lambda() |
| | | .set(Warning::getIsdeleted,Constants.ONE) |
| | | .set(Warning::getEditor,user.getId()) |
| | |
| | | .eq(Warning::getName,warning.getName()) )>0){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,事件类型已存在,请返回刷新页面查看!"); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(warning.getCode())&&Constants.equalsInteger(warning.getType(),Constants.ZERO)||Constants.equalsInteger(warning.getType(),Constants.ONE)){ |
| | | EventSubRequest eventParam = new EventSubRequest(); |
| | | String path =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode(); |
| | | eventParam.setEventDest(path+"/notice"); |
| | | try { |
| | | eventParam.setEventTypes(new Integer[]{Integer.valueOf(warning.getCode())}); |
| | | }catch (Exception e){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"事件编码错误!"); |
| | | } |
| | | HKService.cancelEventSub(eventParam);//先取消 |
| | | if(Constants.equalsInteger(warning.getStatus(),Constants.ONE)){ |
| | | HKService.eventSub(eventParam);//安防事件 |
| | | } |
| | | } |
| | | |
| | | warning.setEditDate(warning.getCreateDate()); |
| | | warning.setEditor(warning.getCreator()); |
| | | warningMapper.updateById(warning); |
| | |
| | | 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)){ |
| | | EventSubRequest eventParam = new EventSubRequest(); |
| | | String path =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode(); |
| | | eventParam.setEventDest(path+"/notice"); |
| | | try { |
| | | eventParam.setEventTypes(new Integer[]{Integer.valueOf(model.getCode())}); |
| | | }catch (Exception e){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"事件编码错误!"); |
| | | } |
| | | HKService.cancelEventSub(eventParam);//先取消 |
| | | if(Constants.equalsInteger(param.getStatus(),Constants.ONE)){ |
| | | HKService.eventSub(eventParam);//安防事件 |
| | | } |
| | | } |
| | | |
| | | |
| | | model.setStatus(param.getStatus()); |
| | | model.setEditDate(new Date()); |
| | | model.setEditor(param.getLoginUserInfo().getId()); |
| | |
| | | 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), |
| | | dingTalk.getWeatherNoticeMsg(title,text)); |
| | | ddNoticeConfigMapper.selectCount(new QueryWrapper<DdNoticeConfig>().lambda() |
| | | .eq(DdNoticeConfig::getIsdeleted,Constants.ZERO).eq(DdNoticeConfig::getStatus,Constants.ZERO) |
| | | .eq(DdNoticeConfig::getObjType,13))>Constants.ZERO? |
| | | dingTalk.getWeatherNoticeMsg(title,text):null); |
| | | for (Member member:memberList) { |
| | | WarningPush warningPush = new WarningPush(); |
| | | warningPush.setCreateDate(new Date()); |
| | |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |