diff --git a/dk-modules/business/src/main/java/org/dromara/business/config/ProjectTablePrefixConfig.java b/dk-modules/business/src/main/java/org/dromara/business/config/ProjectTablePrefixConfig.java index b8352f9..fe48643 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/config/ProjectTablePrefixConfig.java +++ b/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") public class ProjectTablePrefixConfig { - @Value("${projectTablePrefix.tableBusiness:dk_business") + @Value("${projectTablePrefix.tableBusiness:dk_business}") private String tableBusiness; - @Value("${projectTablePrefix.tableCloud:dk_cloud") + @Value("${projectTablePrefix.tableCloud:dk_cloud}") private String tableCloud; - @Value("${projectTablePrefix.tableWorkflow:dk_workflow") + @Value("${projectTablePrefix.tableWorkflow:dk_workflow}") private String tableWorkflow; } diff --git a/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertController.java b/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertController.java index 36de214..ce58514 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertController.java +++ b/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.constants.MinIOConstants; 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.enums.BusinessType; import org.dromara.common.mybatis.core.page.PageQuery; @@ -106,11 +107,11 @@ public class BusinessAlertController extends BaseController { */ @Operation(summary ="ai实时流预警保存-用于演示",description = "ai实时流预警保存-用于演示") @PostMapping("/saveAlert") - public R saveAlert(@RequestBody BusinessAlertVo vo) { + public R saveAlert(@RequestBody BusinessAlertVo vo) { vo.setBusinessType(2); vo.setHandleType("verify"); 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.setDeptName(deptName); businessAlert.setDeptId(deptId); + businessAlert.setJobName(deptName + businessAlert.getLabelCn() + DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",businessAlert.getCreateTime())); businessAlertService.updateBusinessAlert(businessAlert); RemoteStartProcess startProcess = new RemoteStartProcess(); startProcess.setBusinessId(String.valueOf(businessAlert.getId())); @@ -175,8 +177,8 @@ public class BusinessAlertController extends BaseController { // @SaCheckPermission("business:alertAi:list") @Operation(summary ="查询实时流预警",description = "查询实时流预警") @GetMapping("/ai/verify/alert") - public R> listAiVerifyAlert(BusinessAlertVo vo) { - return R.ok(businessAlertService.listAiVerifyAlert(vo)); + public R> listAiVerifyAlert(BusinessAlertVo vo,PageQuery pageQuery) { + return R.ok(businessAlertService.listAiVerifyAlert(vo,pageQuery)); } diff --git a/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java b/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java index e5d059b..78c2527 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java +++ b/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java @@ -94,8 +94,10 @@ public interface IBusinessAlertService { List listHandleHistory(String lng, String lat, String createTime); Boolean transferAlert(BusinessAlertVo vo); + BusinessAlert getBusinessAlert(Long alertId); Boolean updateBusinessAlert(BusinessAlert businessAlert); - List listAiVerifyAlert(BusinessAlertVo vo); + + TableDataInfo listAiVerifyAlert(BusinessAlertVo vo,PageQuery pageQuery); } diff --git a/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java b/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java index cad48a5..55cd843 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java +++ b/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.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -83,8 +84,15 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { public BusinessAlert addBusinessAlert(BusinessAlertVo param) { BusinessAlert alert = MapstructUtils.convert(param, BusinessAlert.class); alert.setCreateTime(new Date()); - alert.setCaseNumber(param.getCaseNumber()); alert.setJobName(alert.getDeptName()+alert.getLabelCn()+ DateUtils.getTime()); + + //创建案件号 + try { + incrementalAlertCount(alert); + } catch (Exception e) { + log.error(e.getMessage(),e); + } + this.baseMapper.insert(alert); return alert; } @@ -674,9 +682,14 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { return this.baseMapper.selectVoList(wrapper); } - + /** + * 查询实时流待验证预警 + * @param vo + * @param pageQuery + * @return + */ @Override - public List listAiVerifyAlert(BusinessAlertVo vo) { + public TableDataInfo listAiVerifyAlert(BusinessAlertVo vo,PageQuery pageQuery) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(BusinessAlert::getHandleType, BusinessStatusEnum.VERIFY.getStatus()); wrapper.eq(BusinessAlert::getBusinessType, vo.getBusinessType()); @@ -684,14 +697,18 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { wrapper.eq(BusinessAlert::getDeptId, vo.getDeptId()); } - List businessAlertVos = this.baseMapper.selectVoList(wrapper); - businessAlertVos.forEach(businessAlertVo->{ + if (ObjectUtil.isNotEmpty(vo.getJobName())){ + wrapper.like(BusinessAlert::getJobName, vo.getJobName()); + } + + IPage businessAlertVos = this.baseMapper.selectVoPage(pageQuery.build(), wrapper); + businessAlertVos.getRecords().forEach(businessAlertVo->{ URL url = MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_DKCY, businessAlertVo.getImages(), 3600); businessAlertVo.setImages(url.toString()); }); - return businessAlertVos; + return TableDataInfo.build(businessAlertVos); } @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 getLastSixDays() { List days = new ArrayList<>(7); @@ -867,7 +900,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { @Override public Boolean updateBusinessAlert(BusinessAlert businessAlert) { - return baseMapper.updateById(businessAlert); + return baseMapper.updateById(businessAlert) > 0; }