huanghongfa
2021-06-22 3875a8f62bd6cecd78f56fb9a6911fa44891dfed
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java
@@ -10,6 +10,7 @@
import com.panzhihua.common.model.dtos.community.ComMngPopulationDTO;
import com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenEventListDTO;
import com.panzhihua.common.model.dtos.grid.*;
import com.panzhihua.common.model.helper.AESUtil;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComActVO;
import com.panzhihua.common.model.vos.community.screen.event.EventListVO;
@@ -19,10 +20,7 @@
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.service_grid.dao.*;
import com.panzhihua.service_grid.model.dos.*;
import com.panzhihua.service_grid.service.EventGridDataService;
import com.panzhihua.service_grid.service.EventResourceService;
import com.panzhihua.service_grid.service.EventService;
import com.panzhihua.service_grid.service.EventTransferRecordService;
import com.panzhihua.service_grid.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.beans.BeanUtils;
@@ -55,7 +53,7 @@
    @Resource
    private EventGridMemberRelationMapper eventGridMemberRelationMapper;
    @Resource
    private EventGridDataService eventGridDataService;
    private EventSpecialCrowdRecordService eventSpecialCrowdRecordService;
    /**
     * 分页查找事件
@@ -268,6 +266,14 @@
        if (eventGridDataDO == null) {
            return R.fail("网格不存在");
        }
        //检查特殊人群上报时参数
        if(commonEventAddDTO.getEventType().equals(6)){
            if(commonEventAddDTO.getPopulationIds().isEmpty()){
                return R.fail("上报人员为空");
            }
        }
        eventDO.setEventCategory(1l);//办件事件
        eventDO.setEventStatus(2);//事件状态 2发布
        eventDO.setProcessType(1);//网格员处理
@@ -279,6 +285,21 @@
        eventDO.setSubmitDate(new Date());
        eventDO.setOrderSn(getEventOrderSn(eventDO.getEventType()));
        if (eventMapper.insert(eventDO) == 1) {
            //如果是特殊人群,则新增特殊人群与事件关系
            if(commonEventAddDTO.getEventType().equals(6)){
                List<EventSpecialCrowdRecordDO> crowdRecordList = new ArrayList<>();
                commonEventAddDTO.getPopulationIds().forEach(populationId -> {
                    EventSpecialCrowdRecordDO specialCrowdRecordDO = new EventSpecialCrowdRecordDO();
                    specialCrowdRecordDO.setEventId(eventDO.getId());
                    specialCrowdRecordDO.setPopulationId(populationId);
                    specialCrowdRecordDO.setCreateAt(new Date());
                    crowdRecordList.add(specialCrowdRecordDO);
                });
                //添加特殊人群上报事件与人口关系
                eventSpecialCrowdRecordService.saveBatch(crowdRecordList);
            }
            //添加音频
            if (StringUtils.isNotEmpty(commonEventAddDTO.getAudio())) {
                EventResourceDO eventResourceDO = new EventResourceDO();
@@ -339,7 +360,15 @@
        if (eventGridDataDO == null) {
            return R.fail("网格不存在");
        }
        if (commonEventEditDTO.getId() == null) {
            //检查特殊人群上报时参数
            if(commonEventEditDTO.getEventType().equals(6)){
                if(commonEventEditDTO.getPopulationIds().isEmpty()){
                    return R.fail("上报人员为空");
                }
            }
            EventDO eventDO = new EventDO();
            BeanUtils.copyProperties(commonEventEditDTO, eventDO);
            eventDO.setGridMemberId(commonEventEditDTO.getUserId());
@@ -353,6 +382,21 @@
            eventDO.setGridMemberTelephone(commonEventEditDTO.getPhone());
            eventDO.setEventDealStatus(5);
            if (eventMapper.insert(eventDO) > 0) {
                //如果是特殊人群,则新增特殊人群与事件关系
                if(commonEventEditDTO.getEventType().equals(6)){
                    List<EventSpecialCrowdRecordDO> crowdRecordList = new ArrayList<>();
                    commonEventEditDTO.getPopulationIds().forEach(populationId -> {
                        EventSpecialCrowdRecordDO specialCrowdRecordDO = new EventSpecialCrowdRecordDO();
                        specialCrowdRecordDO.setEventId(eventDO.getId());
                        specialCrowdRecordDO.setPopulationId(populationId);
                        specialCrowdRecordDO.setCreateAt(new Date());
                        crowdRecordList.add(specialCrowdRecordDO);
                    });
                    //添加特殊人群上报事件与人口关系
                    eventSpecialCrowdRecordService.saveBatch(crowdRecordList);
                }
                //添加音频
                if (StringUtils.isNotEmpty(commonEventEditDTO.getAudio())) {
                    EventResourceDO eventResourceDO = new EventResourceDO();
@@ -2072,4 +2116,15 @@
        IPage<EventListVO> eventPageList = this.baseMapper.getScreenEventList(new Page(eventListDTO.getPageNum(),eventListDTO.getPageSize()),eventListDTO);
        return R.ok(eventPageList);
    }
    /**
     * 特殊人群上报-社区人口数据列表
     * @param specialPopulationDTO   请求参数
     * @return  社区人口数据列表
     */
    @Override
    public R specialPopulationList(PageEventSpecialPopulationDTO specialPopulationDTO){
        IPage<EventSpecialPopulationVO> specialPopulationVOIPage = this.baseMapper.specialPopulationList(new Page(specialPopulationDTO.getPageNum(),specialPopulationDTO.getPageSize()),specialPopulationDTO);
        return R.ok(specialPopulationVOIPage);
    }
}