Browse Source

[bug]实时预警接口

pull/6/head
袁强 1 month ago
parent
commit
045159043f
  1. 23
      dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertController.java
  2. 1
      dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java
  3. 5
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java

23
dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertController.java

@ -1,6 +1,7 @@
package org.dromara.business.controller; package org.dromara.business.controller;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.client.utils.TenantUtil; import com.alibaba.nacos.client.utils.TenantUtil;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@ -108,27 +109,37 @@ public class BusinessAlertController extends BaseController {
public R saveAlert(@RequestBody BusinessAlertVo vo) { public R saveAlert(@RequestBody BusinessAlertVo vo) {
vo.setBusinessType(2); vo.setBusinessType(2);
BusinessAlert businessAlert = businessAlertService.addBusinessAlert(vo); BusinessAlert businessAlert = businessAlertService.addBusinessAlert(vo);
return R.ok();
}
/**
* ai实时流预警保存
*/
@Operation(summary ="预警推送-实时预警模块专用",description = "预警推送-实时预警模块专用")
@GetMapping("/pushAlert")
public R pushAlert(Long alertId) {
BusinessAlert businessAlert= businessAlertService.getBusinessAlert(alertId);
RemoteStartProcess startProcess = new RemoteStartProcess(); RemoteStartProcess startProcess = new RemoteStartProcess();
startProcess.setBusinessId(String.valueOf(businessAlert.getId())); startProcess.setBusinessId(String.valueOf(businessAlert.getId()));
startProcess.setFlowCode("alertChz"); startProcess.setFlowCode("alertChz");
remoteWorkflowService.startWorkFlowBatch(List.of(startProcess)); remoteWorkflowService.startWorkFlowBatch(List.of(startProcess));
RemoteNoticeBo remoteNoticeBo = new RemoteNoticeBo(); RemoteNoticeBo remoteNoticeBo = new RemoteNoticeBo();
remoteNoticeBo.setNoticeTitle(vo.getDeptName()+"产生预警,预警类型["+vo.getLabelCn()+"],请立即查看"); remoteNoticeBo.setNoticeTitle(businessAlert.getDeptName()+"产生预警,预警类型["+businessAlert.getLabelCn()+"],请立即查看");
remoteNoticeBo.setNoticeType("3"); remoteNoticeBo.setNoticeType("3");
remoteNoticeBo.setNoticeContent(vo.getDeptName()+"产生预警,预警类型["+vo.getLabelCn()+"],请立即查看"); remoteNoticeBo.setNoticeContent(businessAlert.getDeptName()+"产生预警,预警类型["+businessAlert.getLabelCn()+"],请立即查看");
remoteNoticeBo.setStatus("0"); remoteNoticeBo.setStatus("0");
remoteNoticeBo.setIsRead(0); remoteNoticeBo.setIsRead(0);
remoteNoticeBo.setCreateBy(1L); remoteNoticeBo.setCreateBy(1L);
remoteNoticeBo.setCreateDept(1L); remoteNoticeBo.setCreateDept(1L);
remoteNoticeBo.setCreateTime(businessAlert.getCreateTime()); remoteNoticeBo.setCreateTime(businessAlert.getCreateTime());
if (businessAlert.getBusinessType() == 2){ if (businessAlert.getBusinessType() == 2){
businessAlert.setImages(MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_DKCY, vo.getImages(), 3600).toString()); businessAlert.setImages(MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_DKCY, businessAlert.getImages(), 3600).toString());
} }
remoteNoticeBo.setDeviceSn(vo.getDeviceSn()); remoteNoticeBo.setDeviceSn(businessAlert.getDeviceSn());
businessAlert.setDeviceSn(vo.getDeviceSn()); businessAlert.setDeviceSn(businessAlert.getDeviceSn());
remoteNoticeBo.setParam(JSON.toJSONString(businessAlert)); remoteNoticeBo.setParam(JSON.toJSONString(businessAlert));
remoteNoticeService.saveNotice(remoteNoticeBo); remoteNoticeService.saveNotice(remoteNoticeBo);
remoteSubmailConfigService.remoteCmdSend("smsMultixsend", JSON.toJSONString(vo)); remoteSubmailConfigService.remoteCmdSend("smsMultixsend", JSON.toJSONString(businessAlert));
return R.ok(); return R.ok();
} }

1
dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java

@ -94,4 +94,5 @@ public interface IBusinessAlertService {
List<BusinessAlert> listHandleHistory(String lng, String lat, String createTime); List<BusinessAlert> listHandleHistory(String lng, String lat, String createTime);
Boolean transferAlert(BusinessAlertVo vo); Boolean transferAlert(BusinessAlertVo vo);
BusinessAlert getBusinessAlert(Long alertId);
} }

5
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java

@ -831,6 +831,11 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
return this.baseMapper.update(wrapper) > 0; return this.baseMapper.update(wrapper) > 0;
} }
@Override
public BusinessAlert getBusinessAlert(Long alertId) {
return baseMapper.selectById(alertId);
}
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(getLastSixDays()); System.out.println(getLastSixDays());

Loading…
Cancel
Save