全周期档案;河道水情

master
wany 2024-09-24 14:28:14 +08:00
parent 12e6931811
commit 524a49f177
4 changed files with 81 additions and 19 deletions

View File

@ -147,16 +147,13 @@ public interface AttResBaseMapper extends BaseMapper<AttResBase> {
@Select(""" @Select("""
<script> <script>
select t.stcd,t.stnm,COALESCE(t.clgtd,t.lgtd) as lgtd, select t.stcd,t.stnm,COALESCE(t.clgtd,t.lgtd) as lgtd,
COALESCE(t.clttd,t.lttd) as lttd,t.sttp,t.adcd,t.rvnm,t.stlc,t.source,t.esstym,s.tm,s.z,s.q,sad.adnm,abb.bas_name as lyname, COALESCE(t.clttd,t.lttd) as lttd,t.sttp,t.adcd,t.rvnm,t.stlc,t.source,t.esstym,s.tm,s.z,s.q,sad.adnm,
srb.wrz,srb.grz,srb.invrz,srb.invrztm,case when srb.grz is not null and s.z-srb.grz &gt; 0 then 1 else 0 end as gstate, srb.wrz,srb.grz,srb.invrz,srb.invrztm
case when srb.grz is not null and s.z-srb.grz &gt; 0 then 0 when srb.wrz is not null and s.z-srb.wrz &gt; 0 then 1 else 0 end as wstate
from public.st_stbprp_b t from public.st_stbprp_b t
left join public.st_river_r_real s on t.stcd = s.stcd left join public.st_river_r_real s on t.stcd = s.stcd
left join public.st_addvcd_d sad on t.adcd = sad.adcd left join public.st_addvcd_d sad on t.adcd = sad.adcd
left join public.att_bas_base abb on t.lyid = abb.bas_code
left join public.st_rvfcch_b srb on t.stcd = srb.stcd left join public.st_rvfcch_b srb on t.stcd = srb.stcd
where t.sttp = 'ZQ' where t.sttp = 'ZZ'
order by gstate desc,wstate desc,s.tm desc nulls last
</script> </script>
""") """)
List<AttRvBaseVo> queryWaterList(); List<AttRvBaseVo> queryWaterList();

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gunshi.project.xyt.entity.so.CommonDataPageSo; import com.gunshi.project.xyt.entity.so.CommonDataPageSo;
import com.gunshi.project.xyt.entity.vo.ProjectEventsVo; import com.gunshi.project.xyt.entity.vo.ProjectEventsVo;
import com.gunshi.project.xyt.model.ProjectEvents; import com.gunshi.project.xyt.model.ProjectEvents;
import com.gunshi.project.xyt.model.TermiteSurvey;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
@ -79,17 +80,30 @@ public interface ProjectEventsMapper extends BaseMapper<ProjectEvents> {
@Select(""" @Select("""
<script> <script>
with m1 as (
select t.id,t.report_date as eventsDate,6 as type from public.termite_survey t select t.* from public.termite_survey t),
m2 as (select survey_id,count(is_harm) as harmNum from termite_survey_detail where is_harm = 1 GROUP BY survey_id),
m3 as (select survey_id,count(is_handle) as handleNum from termite_survey_detail where is_handle = 1 GROUP BY survey_id)
select m1.*,m2.harmNum,m3.handleNum from m1
left join m2 on m1.id = m2.survey_id
left join m3 on m1.id = m3.survey_id
<where> <where>
<if test="obj.dateSo != null and obj.dateSo.start != null"> <if test="obj.dateSo != null and obj.dateSo.start != null">
and t.report_date <![CDATA[>=]]> #{obj.dateSo.start} m1.report_date <![CDATA[>=]]> #{obj.dateSo.start}
</if> </if>
<if test="obj.dateSo != null and obj.dateSo.end != null"> <if test="obj.dateSo != null and obj.dateSo.end != null">
and t.report_date <![CDATA[<=]]> #{obj.dateSo.end} and t.report_date <![CDATA[<=]]> #{obj.dateSo.end}
</if> </if>
</where> </where>
order by m1.report_date desc
</script> </script>
""") """)
List<ProjectEventsVo> termiteList(@Param("obj") CommonDataPageSo page); List<TermiteSurvey> termiteList(@Param("obj") CommonDataPageSo page);
@Select("""
<script>
select id from public.termite_survey_detail where survey_id = #{id}
</script>
""")
List<Long> queryTermiteDetail(@Param("id") Long id);
} }

View File

@ -12,6 +12,7 @@ import com.gunshi.project.xyt.entity.vo.ProjectEventsVo;
import com.gunshi.project.xyt.mapper.ProjectEventsMapper; import com.gunshi.project.xyt.mapper.ProjectEventsMapper;
import com.gunshi.project.xyt.model.FileAssociations; import com.gunshi.project.xyt.model.FileAssociations;
import com.gunshi.project.xyt.model.ProjectEvents; import com.gunshi.project.xyt.model.ProjectEvents;
import com.gunshi.project.xyt.model.TermiteSurvey;
import com.gunshi.project.xyt.util.DataHandleUtil; import com.gunshi.project.xyt.util.DataHandleUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -133,7 +134,8 @@ public class ProjectEventsService extends ServiceImpl<ProjectEventsMapper, Proje
list.addAll(projectEventsVos); list.addAll(projectEventsVos);
} }
if(CollectionUtils.isEmpty(types) || (CollectionUtils.isNotEmpty(types)) && types.contains(6)){ if(CollectionUtils.isEmpty(types) || (CollectionUtils.isNotEmpty(types)) && types.contains(6)){
List<ProjectEventsVo> projectEventsVos = this.baseMapper.termiteList(page); List<TermiteSurvey> termiteVos = this.baseMapper.termiteList(page);
List<ProjectEventsVo> projectEventsVos = this.handelTermite(termiteVos);
list.addAll(projectEventsVos); list.addAll(projectEventsVos);
} }
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
@ -147,8 +149,59 @@ public class ProjectEventsService extends ServiceImpl<ProjectEventsMapper, Proje
return res; return res;
} }
private List<ProjectEventsVo> handelTermite(List<TermiteSurvey> termiteVos) {
List<ProjectEventsVo> list = new ArrayList<>();
if(CollectionUtils.isEmpty(termiteVos)){
return list;
}
for (TermiteSurvey vo : termiteVos){
Integer surveyWay = vo.getSurveyWay();
String way = "";
switch (surveyWay){
case 1 :
way = "人工排查法";
break;
case 2 :
way = "引诱法";
break;
case 3 :
way = "仪器探测法";
break;
case 4 :
way = "其它";
break;
}
Integer surveyType = vo.getSurveyType();
String type = "";
switch (surveyType){
case 1 :
type = "日常检查排查";
break;
case 2 :
type = "定期普查";
break;
case 3 :
type = "专项调查";
break;
}
String result = vo.getHarmNum() > 0 ?"有危害":"无危害";
String content = "采用"+way+"进行"+type+",结果:"+result+";白蚁危害处数"+vo.getHarmNum()+"处;已处理处数"+vo.getHandleNum()+"处。";
ProjectEventsVo eventsVo = new ProjectEventsVo();
eventsVo.setId(vo.getId());
eventsVo.setType(6);
eventsVo.setEventsDate(vo.getReportDate());
eventsVo.setEventsDesc(content);
List<Long> ids = this.baseMapper.queryTermiteDetail(vo.getId());
List<FileAssociations> files = fileService.getFilesByIds(ids.stream().map(Objects::toString).collect(Collectors.toList()));
eventsVo.setFiles(files);
list.add(eventsVo);
}
return list;
}
private void fillFile(List<ProjectEventsVo> list) { private void fillFile(List<ProjectEventsVo> list) {
List<String> ids = list.stream().map(ProjectEventsVo::getId).map(Objects::toString).collect(Collectors.toList()); List<String> ids = list.stream().filter(o->o.getType() != 6).map(ProjectEventsVo::getId).map(Objects::toString).collect(Collectors.toList());
List<FileAssociations> files = fileService.getFilesByIds(ids); List<FileAssociations> files = fileService.getFilesByIds(ids);
Map<String, List<FileAssociations>> map = files.stream().collect(Collectors.groupingBy(FileAssociations::getBusinessId)); Map<String, List<FileAssociations>> map = files.stream().collect(Collectors.groupingBy(FileAssociations::getBusinessId));
for (ProjectEventsVo vo : list){ for (ProjectEventsVo vo : list){

View File

@ -66,8 +66,6 @@ public class TermiteSurveyService extends ServiceImpl<TermiteSurveyMapper, Termi
} }
public Page<TermiteSurvey> pageQuery(TermiteSurveyPageSo page) { public Page<TermiteSurvey> pageQuery(TermiteSurveyPageSo page) {
System.out.println(page.getIsHarm() == null);
System.out.println(page.getIsHarm() != null);
return this.baseMapper.pageQuery(page.getPageSo().toPage(),page); return this.baseMapper.pageQuery(page.getPageSo().toPage(),page);
} }
} }