Browse Source

[feat]修改实时流预警增加分页查询&修改推送逻辑增加页面选择部门提交

pull/6/head
杨威 1 month ago
parent
commit
3490a6efdf
  1. 6
      dk-modules/business/src/main/java/org/dromara/business/config/ProjectTablePrefixConfig.java
  2. 10
      dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertController.java
  3. 4
      dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java
  4. 47
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java

6
dk-modules/business/src/main/java/org/dromara/business/config/ProjectTablePrefixConfig.java

@ -15,12 +15,12 @@ import org.springframework.context.annotation.Configuration;
@ConfigurationProperties(prefix = "projecttableprefix") @ConfigurationProperties(prefix = "projecttableprefix")
public class ProjectTablePrefixConfig { public class ProjectTablePrefixConfig {
@Value("${projectTablePrefix.tableBusiness:dk_business") @Value("${projectTablePrefix.tableBusiness:dk_business}")
private String tableBusiness; private String tableBusiness;
@Value("${projectTablePrefix.tableCloud:dk_cloud") @Value("${projectTablePrefix.tableCloud:dk_cloud}")
private String tableCloud; private String tableCloud;
@Value("${projectTablePrefix.tableWorkflow:dk_workflow") @Value("${projectTablePrefix.tableWorkflow:dk_workflow}")
private String tableWorkflow; private String tableWorkflow;
} }

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

@ -15,6 +15,7 @@ import org.dromara.business.service.IBusinessAlertService;
import org.dromara.business.utils.MinioUntil; import org.dromara.business.utils.MinioUntil;
import org.dromara.business.utils.constants.MinIOConstants; import org.dromara.business.utils.constants.MinIOConstants;
import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.R;
import org.dromara.common.core.utils.DateUtils;
import org.dromara.common.log.annotation.Log; import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType; import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.PageQuery;
@ -106,11 +107,11 @@ public class BusinessAlertController extends BaseController {
*/ */
@Operation(summary ="ai实时流预警保存-用于演示",description = "ai实时流预警保存-用于演示") @Operation(summary ="ai实时流预警保存-用于演示",description = "ai实时流预警保存-用于演示")
@PostMapping("/saveAlert") @PostMapping("/saveAlert")
public R saveAlert(@RequestBody BusinessAlertVo vo) { public R<BusinessAlert> saveAlert(@RequestBody BusinessAlertVo vo) {
vo.setBusinessType(2); vo.setBusinessType(2);
vo.setHandleType("verify"); vo.setHandleType("verify");
BusinessAlert businessAlert = businessAlertService.addBusinessAlert(vo); BusinessAlert businessAlert = businessAlertService.addBusinessAlert(vo);
return R.ok(); return R.ok(businessAlert);
} }
/** /**
@ -122,6 +123,7 @@ public class BusinessAlertController extends BaseController {
BusinessAlert businessAlert= businessAlertService.getBusinessAlert(alertId); BusinessAlert businessAlert= businessAlertService.getBusinessAlert(alertId);
businessAlert.setDeptName(deptName); businessAlert.setDeptName(deptName);
businessAlert.setDeptId(deptId); businessAlert.setDeptId(deptId);
businessAlert.setJobName(deptName + businessAlert.getLabelCn() + DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",businessAlert.getCreateTime()));
businessAlertService.updateBusinessAlert(businessAlert); businessAlertService.updateBusinessAlert(businessAlert);
RemoteStartProcess startProcess = new RemoteStartProcess(); RemoteStartProcess startProcess = new RemoteStartProcess();
startProcess.setBusinessId(String.valueOf(businessAlert.getId())); startProcess.setBusinessId(String.valueOf(businessAlert.getId()));
@ -175,8 +177,8 @@ public class BusinessAlertController extends BaseController {
// @SaCheckPermission("business:alertAi:list") // @SaCheckPermission("business:alertAi:list")
@Operation(summary ="查询实时流预警",description = "查询实时流预警") @Operation(summary ="查询实时流预警",description = "查询实时流预警")
@GetMapping("/ai/verify/alert") @GetMapping("/ai/verify/alert")
public R<List<BusinessAlertVo>> listAiVerifyAlert(BusinessAlertVo vo) { public R<TableDataInfo<BusinessAlertVo>> listAiVerifyAlert(BusinessAlertVo vo,PageQuery pageQuery) {
return R.ok(businessAlertService.listAiVerifyAlert(vo)); return R.ok(businessAlertService.listAiVerifyAlert(vo,pageQuery));
} }

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

@ -94,8 +94,10 @@ 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); BusinessAlert getBusinessAlert(Long alertId);
Boolean updateBusinessAlert(BusinessAlert businessAlert); Boolean updateBusinessAlert(BusinessAlert businessAlert);
List<BusinessAlertVo> listAiVerifyAlert(BusinessAlertVo vo);
TableDataInfo<BusinessAlertVo> listAiVerifyAlert(BusinessAlertVo vo,PageQuery pageQuery);
} }

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

@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -83,8 +84,15 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
public BusinessAlert addBusinessAlert(BusinessAlertVo param) { public BusinessAlert addBusinessAlert(BusinessAlertVo param) {
BusinessAlert alert = MapstructUtils.convert(param, BusinessAlert.class); BusinessAlert alert = MapstructUtils.convert(param, BusinessAlert.class);
alert.setCreateTime(new Date()); alert.setCreateTime(new Date());
alert.setCaseNumber(param.getCaseNumber());
alert.setJobName(alert.getDeptName()+alert.getLabelCn()+ DateUtils.getTime()); alert.setJobName(alert.getDeptName()+alert.getLabelCn()+ DateUtils.getTime());
//创建案件号
try {
incrementalAlertCount(alert);
} catch (Exception e) {
log.error(e.getMessage(),e);
}
this.baseMapper.insert(alert); this.baseMapper.insert(alert);
return alert; return alert;
} }
@ -674,9 +682,14 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
return this.baseMapper.selectVoList(wrapper); return this.baseMapper.selectVoList(wrapper);
} }
/**
* 查询实时流待验证预警
* @param vo
* @param pageQuery
* @return
*/
@Override @Override
public List<BusinessAlertVo> listAiVerifyAlert(BusinessAlertVo vo) { public TableDataInfo<BusinessAlertVo> listAiVerifyAlert(BusinessAlertVo vo,PageQuery pageQuery) {
LambdaQueryWrapper<BusinessAlert> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BusinessAlert> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BusinessAlert::getHandleType, BusinessStatusEnum.VERIFY.getStatus()); wrapper.eq(BusinessAlert::getHandleType, BusinessStatusEnum.VERIFY.getStatus());
wrapper.eq(BusinessAlert::getBusinessType, vo.getBusinessType()); wrapper.eq(BusinessAlert::getBusinessType, vo.getBusinessType());
@ -684,14 +697,18 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
wrapper.eq(BusinessAlert::getDeptId, vo.getDeptId()); wrapper.eq(BusinessAlert::getDeptId, vo.getDeptId());
} }
List<BusinessAlertVo> businessAlertVos = this.baseMapper.selectVoList(wrapper); if (ObjectUtil.isNotEmpty(vo.getJobName())){
businessAlertVos.forEach(businessAlertVo->{ wrapper.like(BusinessAlert::getJobName, vo.getJobName());
}
IPage<BusinessAlertVo> businessAlertVos = this.baseMapper.selectVoPage(pageQuery.build(), wrapper);
businessAlertVos.getRecords().forEach(businessAlertVo->{
URL url = MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_DKCY, businessAlertVo.getImages(), 3600); URL url = MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_DKCY, businessAlertVo.getImages(), 3600);
businessAlertVo.setImages(url.toString()); businessAlertVo.setImages(url.toString());
}); });
return businessAlertVos; return TableDataInfo.build(businessAlertVos);
} }
@Override @Override
@ -744,6 +761,22 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
}); });
} }
/**
* 创建递归caseNumber
* @param
*/
public void incrementalAlertCount(BusinessAlert businessAlert){
//查询当天时间有多少条预警
Integer currentCount = this.baseMapper.selectCurrentAlertCount(DateUtils.getDate());
//获取当天的时间戳
String currentDate = DateUtils.getDate().replace("-","");
//然后0 + 个数 + 1 当前年月日 例如 202505150 total + 1
businessAlert.setCaseNumber(currentDate + "0" + (currentCount + 1));
}
public static List<String> getLastSixDays() { public static List<String> getLastSixDays() {
List<String> days = new ArrayList<>(7); List<String> days = new ArrayList<>(7);
@ -867,7 +900,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
@Override @Override
public Boolean updateBusinessAlert(BusinessAlert businessAlert) { public Boolean updateBusinessAlert(BusinessAlert businessAlert) {
return baseMapper.updateById(businessAlert); return baseMapper.updateById(businessAlert) > 0;
} }

Loading…
Cancel
Save