From ad2aff5d3dfb19e31db7991f7e039b02b933e01e Mon Sep 17 00:00:00 2001 From: yangzhe123 <2824096059@qq.com> Date: Thu, 11 Dec 2025 16:45:24 +0800 Subject: [PATCH] =?UTF-8?q?1:=E6=96=B0=E5=A2=9E=E6=B5=B7=E5=BA=B7AI=202?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E8=A1=8C=E4=B8=BA?= =?UTF-8?q?BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hsz/common/mapper/JcskSyRMapper.java | 2 +- .../hsz/controller/ISCAIEventController.java | 36 +++++++++++++ .../hsz/controller/ResPlanBController.java | 3 ++ .../hsz/entity/so/ISCAIEventPageSo.java | 54 +++++++++++++++++++ .../project/hsz/mapper/AttResBaseMapper.java | 4 +- .../project/hsz/mapper/ISCAIEventMapper.java | 13 +++++ .../hsz/mapper/ProjectEventsMapper.java | 6 +-- .../gunshi/project/hsz/model/ISCAIEvent.java | 53 ++++++++++++++++++ .../service/ForecastDispatchPlanService.java | 2 +- .../hsz/service/ISCAIEventService.java | 49 +++++++++++++++++ .../hsz/service/MentenceStDetailService.java | 13 ++++- .../hsz/service/ProjectEventsService.java | 17 ++++++ .../hsz/system/SysUserLoginLogController.java | 32 +++++++---- .../hsz/system/aspect/SysUserLogAspect.java | 1 + 14 files changed, 265 insertions(+), 20 deletions(-) create mode 100644 src/main/java/com/gunshi/project/hsz/controller/ISCAIEventController.java create mode 100644 src/main/java/com/gunshi/project/hsz/entity/so/ISCAIEventPageSo.java create mode 100644 src/main/java/com/gunshi/project/hsz/mapper/ISCAIEventMapper.java create mode 100644 src/main/java/com/gunshi/project/hsz/model/ISCAIEvent.java create mode 100644 src/main/java/com/gunshi/project/hsz/service/ISCAIEventService.java diff --git a/module-common/src/main/java/com/gunshi/project/hsz/common/mapper/JcskSyRMapper.java b/module-common/src/main/java/com/gunshi/project/hsz/common/mapper/JcskSyRMapper.java index 235f47a..68f8ece 100644 --- a/module-common/src/main/java/com/gunshi/project/hsz/common/mapper/JcskSyRMapper.java +++ b/module-common/src/main/java/com/gunshi/project/hsz/common/mapper/JcskSyRMapper.java @@ -137,7 +137,7 @@ public interface JcskSyRMapper extends BaseMapper { """) @@ -230,7 +230,7 @@ public interface AttResBaseMapper extends BaseMapper { where t.stcd = #{obj.stcd} and t.tm =]]> to_timestamp(#{obj.stm},'YYYY-MM-DD HH24:MI:SS') and t.tm to_timestamp(#{obj.etm},'YYYY-MM-DD HH24:MI:SS') - and TRIM(TO_CHAR(t.tm, 'MI:SS')) = '00:00' + and TRIM(TO_CHAR(t.tm, 'SS')) = '00' order by t.tm desc """) diff --git a/src/main/java/com/gunshi/project/hsz/mapper/ISCAIEventMapper.java b/src/main/java/com/gunshi/project/hsz/mapper/ISCAIEventMapper.java new file mode 100644 index 0000000..bc220a7 --- /dev/null +++ b/src/main/java/com/gunshi/project/hsz/mapper/ISCAIEventMapper.java @@ -0,0 +1,13 @@ +package com.gunshi.project.hsz.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gunshi.project.hsz.model.ISCAIEvent; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author lyf + * @since 2025-11-04 + */ +@Mapper +public interface ISCAIEventMapper extends BaseMapper { +} diff --git a/src/main/java/com/gunshi/project/hsz/mapper/ProjectEventsMapper.java b/src/main/java/com/gunshi/project/hsz/mapper/ProjectEventsMapper.java index 949646e..8522a2b 100644 --- a/src/main/java/com/gunshi/project/hsz/mapper/ProjectEventsMapper.java +++ b/src/main/java/com/gunshi/project/hsz/mapper/ProjectEventsMapper.java @@ -33,13 +33,13 @@ public interface ProjectEventsMapper extends BaseMapper { @Select(""" diff --git a/src/main/java/com/gunshi/project/hsz/model/ISCAIEvent.java b/src/main/java/com/gunshi/project/hsz/model/ISCAIEvent.java new file mode 100644 index 0000000..be7f63a --- /dev/null +++ b/src/main/java/com/gunshi/project/hsz/model/ISCAIEvent.java @@ -0,0 +1,53 @@ +package com.gunshi.project.hsz.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author lyf + * @since 2025-11-04 + */ +@Data +@TableName("isc_ai_event") +public class ISCAIEvent { + @TableId(value="id", type = IdType.INPUT) + private String id; + @TableField("json") + private String json; + + @TableField("starttime") + private LocalDateTime startTime; + @TableField("endtime") + private LocalDateTime endTime; + /* + 事件等级,1-低,2-中,3-高 + */ + @TableField("eventlevel") + private Integer eventLevel; + /* + 事件处理状态,0-未处理,1-已处理 + */ + @TableField("handlestatus") + private Integer handleStatus; + + /* + 事件类型名称 + */ + @TableField("eventtypename") + private String eventTypeName; + /* + 事件源名称 + */ + @TableField("resname") + private String resName; + /* + 事件源编号 + */ + @TableField("resindexcode") + private String resIndexCode; +} diff --git a/src/main/java/com/gunshi/project/hsz/service/ForecastDispatchPlanService.java b/src/main/java/com/gunshi/project/hsz/service/ForecastDispatchPlanService.java index 14747fe..d77988c 100644 --- a/src/main/java/com/gunshi/project/hsz/service/ForecastDispatchPlanService.java +++ b/src/main/java/com/gunshi/project/hsz/service/ForecastDispatchPlanService.java @@ -53,8 +53,8 @@ public class ForecastDispatchPlanService extends ServiceImpl forecastDispatchPlanPage = this.baseMapper.selectPage(pageSo.getPageSo().toPage(), queryWrapper); queryWrapper.orderByDesc(ForecastDispatchPlan::getCreateTime); + Page forecastDispatchPlanPage = this.baseMapper.selectPage(pageSo.getPageSo().toPage(), queryWrapper); for (ForecastDispatchPlan record : forecastDispatchPlanPage.getRecords()) { List forecastDispatchCommandList = forecastDispatchCommandService.lambdaQuery().eq(ForecastDispatchCommand::getPlanId, record.getId()).list(); record.setForecastDispatchCommands(forecastDispatchCommandList); diff --git a/src/main/java/com/gunshi/project/hsz/service/ISCAIEventService.java b/src/main/java/com/gunshi/project/hsz/service/ISCAIEventService.java new file mode 100644 index 0000000..5dc1b45 --- /dev/null +++ b/src/main/java/com/gunshi/project/hsz/service/ISCAIEventService.java @@ -0,0 +1,49 @@ +package com.gunshi.project.hsz.service; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gunshi.project.hsz.entity.so.ISCAIEventPageSo; +import com.gunshi.project.hsz.mapper.ISCAIEventMapper; +import com.gunshi.project.hsz.model.ISCAIEvent; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Slf4j +@Transactional(rollbackFor = Exception.class) +public class ISCAIEventService extends ServiceImpl { + + + public Page pageInfo(ISCAIEventPageSo dto) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + if (dto.getEventLevel() != null) { + queryWrapper.eq(ISCAIEvent::getEventLevel, dto.getEventLevel()); + } + + if(dto.getHandleStatus() != null){ + queryWrapper.eq(ISCAIEvent::getHandleStatus, dto.getHandleStatus()); + } + + if(dto.getEventTypeName() != null){ + queryWrapper.like(ISCAIEvent::getEventTypeName, dto.getEventTypeName()); + } + + if(dto.getResName() != null){ + queryWrapper.like(ISCAIEvent::getResName, dto.getResName()); + } + + if(dto.getStartTime() != null){ + queryWrapper.ge(ISCAIEvent::getStartTime, dto.getStartTime()); + } + + if(dto.getEndTime() != null){ + queryWrapper.le(ISCAIEvent::getEndTime, dto.getEndTime()); + } + queryWrapper.orderByDesc(ISCAIEvent::getStartTime); + Page iscaiEventPage = this.baseMapper.selectPage(dto.getPageSo().toPage(), queryWrapper); + return iscaiEventPage; + } +} diff --git a/src/main/java/com/gunshi/project/hsz/service/MentenceStDetailService.java b/src/main/java/com/gunshi/project/hsz/service/MentenceStDetailService.java index c01668f..91c67b8 100644 --- a/src/main/java/com/gunshi/project/hsz/service/MentenceStDetailService.java +++ b/src/main/java/com/gunshi/project/hsz/service/MentenceStDetailService.java @@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gunshi.project.hsz.entity.so.MentenceStPageSo; +import com.gunshi.project.hsz.mapper.MentenceFarmerRecordMapper; import com.gunshi.project.hsz.mapper.MentencePlanDetailMapper; import com.gunshi.project.hsz.mapper.MentenceStDetailMapper; import com.gunshi.project.hsz.mapper.MentenceStMapper; +import com.gunshi.project.hsz.model.MentenceFarmerRecord; import com.gunshi.project.hsz.model.MentencePlanDetail; import com.gunshi.project.hsz.model.MentenceSt; import com.gunshi.project.hsz.model.MentenceStDetail; @@ -26,6 +28,9 @@ public class MentenceStDetailService extends ServiceImpl queryWrapperDetail = new LambdaQueryWrapper<>(); queryWrapperDetail.eq(MentencePlanDetail::getMentenceStDetailId, id); @@ -56,8 +61,12 @@ public class MentenceStDetailService extends ServiceImpl queryWrapperDetail = new LambdaQueryWrapper<>(); queryWrapperDetail.eq(MentencePlanDetail::getMentenceStDetailId, record.getId()); - Long count = mentencePlanDetailMapper.selectCount(queryWrapperDetail); - if(count > 0) { + Long count1 = mentencePlanDetailMapper.selectCount(queryWrapperDetail); + + LambdaQueryWrapper queryWrapperFarmerRecord = new LambdaQueryWrapper<>(); + queryWrapperFarmerRecord.eq(MentenceFarmerRecord::getMentenceStDetailId,record.getId()); + Long count2 = mentenceFarmerRecordMapper.selectCount(queryWrapperFarmerRecord); + if(count1 > 0 || count2 > 0) { record.setHasUse(true); } } diff --git a/src/main/java/com/gunshi/project/hsz/service/ProjectEventsService.java b/src/main/java/com/gunshi/project/hsz/service/ProjectEventsService.java index a4675c4..b2a3671 100644 --- a/src/main/java/com/gunshi/project/hsz/service/ProjectEventsService.java +++ b/src/main/java/com/gunshi/project/hsz/service/ProjectEventsService.java @@ -9,8 +9,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gunshi.project.hsz.entity.so.CommonDataPageSo; import com.gunshi.project.hsz.entity.vo.ProjectEventsVo; +import com.gunshi.project.hsz.mapper.HiddenInfoMapper; import com.gunshi.project.hsz.mapper.ProjectEventsMapper; import com.gunshi.project.hsz.model.FileAssociations; +import com.gunshi.project.hsz.model.HiddenInfo; import com.gunshi.project.hsz.model.ProjectEvents; import com.gunshi.project.hsz.model.TermiteSurvey; import com.gunshi.project.hsz.util.DataHandleUtil; @@ -38,6 +40,9 @@ public class ProjectEventsService extends ServiceImpl pageQuery(CommonDataPageSo page) { LambdaQueryWrapper query = Wrappers.lambdaQuery(); if (ObjectUtils.isNotNull(page.getName())) { @@ -220,6 +225,18 @@ public class ProjectEventsService extends ServiceImpl> map = files.stream().collect(Collectors.groupingBy(FileAssociations::getBusinessId)); for (ProjectEventsVo vo : list){ vo.setFiles(map.get(vo.getId().toString())); + if(vo.getType() == 3){ + List fileAssociations = vo.getFiles() == null?new ArrayList<>():vo.getFiles(); + //Java有Integer的缓存-128~127可以直接用== + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(HiddenInfo::getMentenceFarmerRecordId,vo.getId()); + List hiddenInfos = hiddenInfoMapper.selectList(queryWrapper); + hiddenInfos.stream().forEach(o ->{ + List add = fileService.getFiles("mentenceFarmerRecord", o.getId().toString()); + fileAssociations.addAll(add); + }); + vo.setFiles(fileAssociations); + } } } diff --git a/src/main/java/com/gunshi/project/hsz/system/SysUserLoginLogController.java b/src/main/java/com/gunshi/project/hsz/system/SysUserLoginLogController.java index 22e6e10..1af6fa2 100644 --- a/src/main/java/com/gunshi/project/hsz/system/SysUserLoginLogController.java +++ b/src/main/java/com/gunshi/project/hsz/system/SysUserLoginLogController.java @@ -91,11 +91,16 @@ public class SysUserLoginLogController { .collect(Collectors.toList()); BigDecimal divisor = BigDecimal.valueOf(1000 * 60 * 60); - vo.setWeb3Count( - BigDecimal.valueOf(webTimes.stream().mapToLong(o -> o).sum()) - .divide(BigDecimal.valueOf(webTimes.size()), 2, RoundingMode.HALF_UP) - .divide(divisor, 2, RoundingMode.HALF_UP) - ); + if(!webTimes.isEmpty()){ + vo.setWeb3Count( + BigDecimal.valueOf(webTimes.stream().mapToLong(o -> o).sum()) + .divide(BigDecimal.valueOf(webTimes.size()), 2, RoundingMode.HALF_UP) + .divide(divisor, 2, RoundingMode.HALF_UP) + ); + }else{ + vo.setWeb3Count(BigDecimal.ZERO); + } + vo.setApp1Count( logs.stream() @@ -104,16 +109,21 @@ public class SysUserLoginLogController { ); List appTimes = logs.stream() - .filter(o -> "0".equals(o.getLoginType())) + .filter(o -> "1".equals(o.getLoginType())) .filter(o -> o.getLogoutTime() != null && o.getLoginTime() != null) .map(o -> o.getLogoutTime().getTime() - o.getLoginTime().getTime()) .collect(Collectors.toList()); + if(!appTimes.isEmpty()){ + vo.setApp3Count( + BigDecimal.valueOf(appTimes.stream().mapToLong(o -> o).sum()) + .divide(BigDecimal.valueOf(appTimes.size()),2, RoundingMode.HALF_UP) + .divide(divisor,2, RoundingMode.HALF_UP) + ); + }else{ + vo.setApp3Count(BigDecimal.ZERO); + } + - vo.setApp3Count( - BigDecimal.valueOf(appTimes.stream().mapToLong(o -> o).sum()) - .divide(BigDecimal.valueOf(appTimes.size()),2, RoundingMode.HALF_UP) - .divide(divisor,2, RoundingMode.HALF_UP) - ); LambdaQueryWrapper wrapperMenuLog = Wrappers.lambdaQuery(SysVisitMenuLog.class) .eq(SysVisitMenuLog::getCreateTime, new Date()); diff --git a/src/main/java/com/gunshi/project/hsz/system/aspect/SysUserLogAspect.java b/src/main/java/com/gunshi/project/hsz/system/aspect/SysUserLogAspect.java index ec32200..fa8b1ae 100644 --- a/src/main/java/com/gunshi/project/hsz/system/aspect/SysUserLogAspect.java +++ b/src/main/java/com/gunshi/project/hsz/system/aspect/SysUserLogAspect.java @@ -62,6 +62,7 @@ public class SysUserLogAspect { } catch (ServiceException e) { // log.info("获取登录账号id," + e.getMessage(), e); log.info("获取登录账号id异常,请重新登录"); + loginUserId = 1l; } if (loginUserId != null) {