From c86d53bc6be26eb67165b991fdc0311378f53c64 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期三, 23 六月 2021 16:57:13 +0800
Subject: [PATCH] bug修改以及app接口开发
---
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java | 100 ++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 93 insertions(+), 7 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java
index 626bc8f..b9547e3 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java
@@ -1,7 +1,9 @@
package com.panzhihua.service_grid.service.impl;
+import cn.hutool.core.util.IdcardUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -16,6 +18,7 @@
import com.panzhihua.common.model.vos.community.screen.event.EventListVO;
import com.panzhihua.common.model.vos.grid.*;
import com.panzhihua.common.service.community.CommunityService;
+import com.panzhihua.common.utlis.ExcelSelectListUtil;
import com.panzhihua.common.utlis.LngLatUtils;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.service_grid.dao.*;
@@ -56,6 +59,10 @@
private EventSpecialCrowdRecordService eventSpecialCrowdRecordService;
@Resource
private EventSpecialCrowdRecordMapper eventSpecialCrowdRecordMapper;
+ @Resource
+ private EventGridDataService eventGridDataService;
+ @Resource
+ private EventResourceMapper eventResourceMapper;
/**
* 分页查找事件
@@ -251,6 +258,11 @@
//当事件为特殊人群上报时,需要查询事件与人口关联关系
if(eventDetailsVO.getEventType().equals(6)){
List<EventSpecialPopulationDetailsVO> specialPopulationList = eventSpecialCrowdRecordMapper.getSpecialPopulationIds(eventDetailsVO.getId());
+ if(!specialPopulationList.isEmpty()){
+ specialPopulationList.forEach(special -> {
+ special.setAge(IdcardUtil.getAgeByIdCard(special.getIdCard()));
+ });
+ }
eventDetailsVO.setPopulationList(specialPopulationList);
}
return R.ok(eventDetailsVO);
@@ -276,7 +288,7 @@
//检查特殊人群上报时参数
if(commonEventAddDTO.getEventType().equals(6)){
- if(commonEventAddDTO.getPopulationIds().isEmpty()){
+ if(commonEventAddDTO.getPopulationIds() == null || commonEventAddDTO.getPopulationIds().size() <= 0){
return R.fail("上报人员为空");
}
}
@@ -2116,11 +2128,51 @@
* @return 事件列表
*/
@Override
- public R getScreenEventList(ScreenEventListDTO eventListDTO){
- if( eventListDTO.getEventType() != null && eventListDTO.getEventType().equals(ScreenEventListDTO.eventType.xc)){
- eventListDTO.setEventCategory(2);
+ public R getScreenEventList(ScreenEventListDTO eventListDTO) {
+ if (eventListDTO.getEventTypes() != null && !eventListDTO.getEventTypes().isEmpty()) {
+ eventListDTO.getEventTypes().forEach(eventType -> {
+ if(eventType.equals(ScreenEventListDTO.eventType.xc)){
+ eventListDTO.setEventCategory(null);
+ }
+ });
+
}
- IPage<EventListVO> eventPageList = this.baseMapper.getScreenEventList(new Page(eventListDTO.getPageNum(),eventListDTO.getPageSize()),eventListDTO);
+ IPage<EventListVO> eventPageList = this.baseMapper.getScreenEventList(new Page(eventListDTO.getPageNum(), eventListDTO.getPageSize()), eventListDTO);
+ if(!eventPageList.getRecords().isEmpty()){
+ eventPageList.getRecords().forEach(event -> {
+ //查询事件关联附件
+ List<EventResourceDO> eventResourceDOList =
+ eventResourceService.getBaseMapper().selectList(new LambdaQueryWrapper<EventResourceDO>()
+ .eq(EventResourceDO::getClassification, 1)
+ .eq(EventResourceDO::getRefId, event.getId())
+ );
+ List<EventResourceVO> picList = new ArrayList<>();
+ List<EventResourceVO> audioList = new ArrayList<>();
+ List<EventResourceVO> videoList = new ArrayList<>();
+ eventResourceDOList.forEach(eventResourceDO -> {
+ switch (eventResourceDO.getType()) {
+ case 1:
+ EventResourceVO picEventResourceVO = new EventResourceVO();
+ BeanUtils.copyProperties(eventResourceDO, picEventResourceVO);
+ picList.add(picEventResourceVO);
+ break;
+ case 2:
+ EventResourceVO audioResourceVO = new EventResourceVO();
+ BeanUtils.copyProperties(eventResourceDO, audioResourceVO);
+ audioList.add(audioResourceVO);
+ break;
+ case 3:
+ EventResourceVO videoResourceVO = new EventResourceVO();
+ BeanUtils.copyProperties(eventResourceDO, videoResourceVO);
+ videoList.add(videoResourceVO);
+ break;
+ }
+ });
+ event.setAudios(audioList);
+ event.setPics(picList);
+ event.setVideos(videoList);
+ });
+ }
return R.ok(eventPageList);
}
@@ -2130,8 +2182,42 @@
* @return 社区人口数据列表
*/
@Override
- public R specialPopulationList(PageEventSpecialPopulationDTO specialPopulationDTO){
- IPage<EventSpecialPopulationVO> specialPopulationVOIPage = this.baseMapper.specialPopulationList(new Page(specialPopulationDTO.getPageNum(),specialPopulationDTO.getPageSize()),specialPopulationDTO);
+ public R specialPopulationList(PageEventSpecialPopulationDTO specialPopulationDTO) {
+ IPage<EventSpecialPopulationVO> specialPopulationVOIPage = this.baseMapper.specialPopulationList(new Page(specialPopulationDTO.getPageNum(), specialPopulationDTO.getPageSize()), specialPopulationDTO);
+ if(!specialPopulationVOIPage.getRecords().isEmpty()){
+ specialPopulationVOIPage.getRecords().forEach(specialPopulation -> {
+ specialPopulation.setAge(IdcardUtil.getAgeByIdCard(specialPopulation.getIdCard()));
+ });
+ }
return R.ok(specialPopulationVOIPage);
}
+
+ @Override
+ public List<EventDetailsVO> getUnUploadEvent() {
+ List<EventDetailsVO> eventDetailsVOList =new ArrayList<>();
+ List<EventDO> unEventList = baseMapper.selectList(
+ new QueryWrapper<EventDO>()
+ .eq("upload", false)
+ );
+ unEventList.forEach(eventDO -> {
+ eventDetailsVOList.add(eventDetails(eventDO.getId()).getData());
+ });
+ return eventDetailsVOList;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean updateLcUploadFlag(Long id) {
+ EventDO event = baseMapper.selectById(id);
+ event.setUpload(true);
+ baseMapper.updateById(event);
+ EventResourceDO eventResourceDO =new EventResourceDO();
+ eventResourceDO.setUpload(true);
+ int flag = eventResourceMapper.update(eventResourceDO, new QueryWrapper<EventResourceDO>()
+ .eq("ref_id", id));
+ if(flag>0){
+ return true;
+ }
+ return false;
+ }
}
--
Gitblit v1.7.1