| | |
| | | |
| | | private final String moth_format_str = "yyyy-MM"; |
| | | |
| | | private final String[] monthStr = new String[]{"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"}; |
| | | private final String[] monthStr = new String[]{"一","二","三","四","五","六","七","八","九","十","十一","十二"}; |
| | | |
| | | /** |
| | | * 分页查找事件 |
| | |
| | | eventVO.setVideos(videoList); |
| | | |
| | | //查询网格员头像 |
| | | String imageUrl = eventMapper.getGridMemberImageUrl(eventVO.getGridMemberId()); |
| | | if (StringUtils.isNotEmpty(imageUrl)) { |
| | | eventVO.setGridMemberImageUrl(imageUrl); |
| | | Map<String,String> userMap = eventMapper.getGridMemberImageUrl(eventVO.getGridMemberId()); |
| | | if (StringUtils.isNotEmpty(userMap)) { |
| | | eventVO.setGridMemberName(userMap.get("nick_name")); |
| | | eventVO.setGridMemberImageUrl(userMap.get("image_url")); |
| | | } |
| | | }); |
| | | return R.ok(ipage); |
| | |
| | | eventDetailsVO.setTrans(eventTransferRecordVOS); |
| | | |
| | | //查询网格员头像,姓名 |
| | | Map<String, Object> gridMember = eventMapper.getUserBaseInfo(eventDO.getGridMemberId()); |
| | | Map<String,Object> gridMember = eventMapper.getUserBaseInfo(eventDO.getGridMemberId()); |
| | | if (!CollectionUtils.isEmpty(gridMember)) { |
| | | eventDetailsVO.setGridMemberName(gridMember.get("name") == null ? "" : gridMember.get("name").toString()); |
| | | eventDetailsVO.setGridMemberImageUrl(gridMember.get("image_url") == null ? "" : gridMember.get("image_url").toString()); |
| | | } |
| | | if (Objects.equals(eventDO.getGridMemberId(), eventDO.getCreateBy())) { |
| | | if(Objects.equals(eventDO.getGridMemberId(),eventDO.getCreateBy())){ |
| | | eventDetailsVO.setCreator(eventDetailsVO.getGridMemberName()); |
| | | } else { |
| | | Map<String, Object> createUser = eventMapper.getUserBaseInfo(eventDO.getCreateBy()); |
| | | }else{ |
| | | Map<String,Object> createUser = eventMapper.getUserBaseInfo(eventDO.getCreateBy()); |
| | | eventDetailsVO.setCreator(createUser.get("name") == null ? "" : createUser.get("name").toString()); |
| | | } |
| | | |
| | | //当事件为特殊人群上报时,需要查询事件与人口关联关系 |
| | | if (eventDetailsVO.getEventType().equals(6)) { |
| | | if(eventDetailsVO.getEventType().equals(6)){ |
| | | List<EventSpecialPopulationDetailsVO> specialPopulationList = eventSpecialCrowdRecordMapper.getSpecialPopulationIds(eventDetailsVO.getId()); |
| | | if (!specialPopulationList.isEmpty()) { |
| | | if(!specialPopulationList.isEmpty()){ |
| | | specialPopulationList.forEach(special -> { |
| | | special.setAge(IdcardUtil.getAgeByIdCard(special.getIdCard())); |
| | | }); |
| | |
| | | } |
| | | |
| | | //检查特殊人群上报时参数 |
| | | if (commonEventAddDTO.getEventType().equals(6)) { |
| | | if (commonEventAddDTO.getPopulationIds() == null || commonEventAddDTO.getPopulationIds().size() <= 0) { |
| | | if(commonEventAddDTO.getEventType().equals(6)){ |
| | | if(commonEventAddDTO.getPopulationIds() == null || commonEventAddDTO.getPopulationIds().size() <= 0){ |
| | | return R.fail("上报人员为空"); |
| | | } |
| | | } |
| | |
| | | if (eventMapper.insert(eventDO) == 1) { |
| | | |
| | | //如果是特殊人群,则新增特殊人群与事件关系 |
| | | if (commonEventAddDTO.getEventType().equals(6)) { |
| | | if(commonEventAddDTO.getEventType().equals(6)){ |
| | | List<EventSpecialCrowdRecordDO> crowdRecordList = new ArrayList<>(); |
| | | commonEventAddDTO.getPopulationIds().forEach(populationId -> { |
| | | EventSpecialCrowdRecordDO specialCrowdRecordDO = new EventSpecialCrowdRecordDO(); |
| | |
| | | eventResourceDO.setRefId(eventDO.getId()); |
| | | eventResourceDO.setCreateBy(commonEventAddDTO.getUserId()); |
| | | eventResourceDO.setResourceTime(commonEventAddDTO.getAudioTime()); |
| | | eventResourceDO.setResourceName(commonEventAddDTO.getAudio().substring(commonEventAddDTO.getAudio().lastIndexOf("/") + 1)); |
| | | eventResourceDO.setResourceName(commonEventAddDTO.getAudio().substring(commonEventAddDTO.getAudio().lastIndexOf("/")+1)); |
| | | int audioAdd = eventResourceService.getBaseMapper().insert(eventResourceDO); |
| | | if (audioAdd != 1) { |
| | | throw new ServiceException("添加音频失败"); |
| | |
| | | eventResourceDO.setRefId(eventDO.getId()); |
| | | eventResourceDO.setCreateBy(commonEventAddDTO.getUserId()); |
| | | eventResourceDO.setResourceTime(commonEventAddDTO.getVideoTime()); |
| | | eventResourceDO.setResourceName(commonEventAddDTO.getVideo().substring(commonEventAddDTO.getVideo().lastIndexOf("/") + 1)); |
| | | eventResourceDO.setResourceName(commonEventAddDTO.getVideo().substring(commonEventAddDTO.getVideo().lastIndexOf("/")+1)); |
| | | int videoAdd = eventResourceService.getBaseMapper().insert(eventResourceDO); |
| | | if (videoAdd != 1) { |
| | | throw new ServiceException("添加视频失败"); |
| | |
| | | eventResourceDO.setUrl(pica[i]); |
| | | eventResourceDO.setRefId(eventDO.getId()); |
| | | eventResourceDO.setCreateBy(commonEventAddDTO.getUserId()); |
| | | eventResourceDO.setResourceName(pica[i].substring(pica[i].lastIndexOf("/") + 1)); |
| | | eventResourceDO.setResourceName(pica[i].substring(pica[i].lastIndexOf("/")+1)); |
| | | int picAdd = eventResourceService.getBaseMapper().insert(eventResourceDO); |
| | | if (picAdd != 1) { |
| | | throw new ServiceException("添加图片失败"); |
| | |
| | | |
| | | if (commonEventEditDTO.getId() == null) { |
| | | //检查特殊人群上报时参数 |
| | | if (commonEventEditDTO.getEventType().equals(6)) { |
| | | if (commonEventEditDTO.getPopulationIds().isEmpty()) { |
| | | if(commonEventEditDTO.getEventType().equals(6)){ |
| | | if(commonEventEditDTO.getPopulationIds().isEmpty()){ |
| | | return R.fail("上报人员为空"); |
| | | } |
| | | } |
| | |
| | | if (eventMapper.insert(eventDO) > 0) { |
| | | |
| | | //如果是特殊人群,则新增特殊人群与事件关系 |
| | | if (commonEventEditDTO.getEventType().equals(6)) { |
| | | if(commonEventEditDTO.getEventType().equals(6)){ |
| | | List<EventSpecialCrowdRecordDO> crowdRecordList = new ArrayList<>(); |
| | | commonEventEditDTO.getPopulationIds().forEach(populationId -> { |
| | | EventSpecialCrowdRecordDO specialCrowdRecordDO = new EventSpecialCrowdRecordDO(); |
| | |
| | | if (eventDO == null) { |
| | | return R.fail("事件不存在"); |
| | | } |
| | | boolean canDealByUser = (eventDO.getEventStatus() == 2 || eventDO.getEventStatus() == 4) && eventDO.getEventProcessStatus() == 1; |
| | | boolean canDealByUser = (eventDO.getEventStatus() == 2||eventDO.getEventStatus()==4) && eventDO.getEventProcessStatus() == 1; |
| | | if (!canDealByUser) { |
| | | if (eventDO.getEventStatus() != 2) { |
| | | if (eventDO.getEventStatus() != 2 ) { |
| | | return R.fail("事件不是发布/待处理状态"); |
| | | } |
| | | if (eventDO.getEventProcessStatus() != 1) { |
| | |
| | | public R republishEvent(CommonEventRepublishDTO commonEventRepublishDTO) { |
| | | EventDO eventDO = this.getBaseMapper().selectById(commonEventRepublishDTO.getId()); |
| | | //boolean canRepublishByUser = eventDO.getEventStatus() == 4 || eventDO.getEventStatus() == 1; |
| | | boolean canRepublishByUser = eventDO.getEventDealStatus() == 7 | eventDO.getEventDealStatus() == 5; //已失效状态 |
| | | boolean canRepublishByUser = eventDO.getEventDealStatus() == 7|eventDO.getEventDealStatus() == 5; //已失效状态 |
| | | if (!canRepublishByUser) { |
| | | return R.fail("当前不是撤销/草稿状态"); |
| | | } |
| | |
| | | eventDO.setEventCategory(2l);//宣传事件 |
| | | eventDO.setEventStatus(2);//事件状态 2发布 |
| | | eventDO.setEventType(8); |
| | | if (publicityEventAddDTO.getGridMemberId() != null) { |
| | | if(publicityEventAddDTO.getGridMemberId()!=null) { |
| | | eventDO.setGridMemberId(publicityEventAddDTO.getGridMemberId()); |
| | | } else { |
| | | }else{ |
| | | eventDO.setGridMemberId(publicityEventAddDTO.getUserId()); |
| | | } |
| | | eventDO.setGridMemberName(publicityEventAddDTO.getUserName()); |
| | |
| | | eventVO.setPics(picList); |
| | | eventVO.setVideos(videoList); |
| | | //查询网格员头像 |
| | | String imageUrl = eventMapper.getGridMemberImageUrl(eventVO.getGridMemberId()); |
| | | if (StringUtils.isNotEmpty(imageUrl)) { |
| | | eventVO.setGridMemberImageUrl(imageUrl); |
| | | Map<String,String> userMap = eventMapper.getGridMemberImageUrl(eventVO.getGridMemberId()); |
| | | if (StringUtils.isNotEmpty(userMap)) { |
| | | eventVO.setGridMemberName(userMap.get("nick_name")); |
| | | eventVO.setGridMemberImageUrl(userMap.get("image_url")); |
| | | } |
| | | }); |
| | | return R.ok(ipage); |
| | |
| | | eventVO.setVideos(videoList); |
| | | |
| | | //查询网格员头像 |
| | | String imageUrl = eventMapper.getGridMemberImageUrl(eventVO.getGridMemberId()); |
| | | if (StringUtils.isNotEmpty(imageUrl)) { |
| | | eventVO.setGridMemberImageUrl(imageUrl); |
| | | Map<String,String> userMap = eventMapper.getGridMemberImageUrl(eventVO.getGridMemberId()); |
| | | if (StringUtils.isNotEmpty(userMap)) { |
| | | eventVO.setGridMemberName(userMap.get("nick_name")); |
| | | eventVO.setGridMemberImageUrl(userMap.get("image_url")); |
| | | } |
| | | }); |
| | | return R.ok(ipage); |
| | |
| | | if (eventDO == null) { |
| | | return R.fail("事件不存在"); |
| | | } |
| | | boolean canRepulish = eventDO.getEventDealStatus() == 7 | eventDO.getEventDealStatus() == 5; //已失效状态 |
| | | boolean canRepulish = eventDO.getEventDealStatus() == 7|eventDO.getEventDealStatus() == 5; //已失效状态 |
| | | if (!canRepulish) { |
| | | return R.fail("当前事件不是已失效状态/草稿状态,不能重新发布"); |
| | | } |
| | |
| | | public R getNearByGrid(PageEventGridNearbyDTO pageEventGridNearbyDTO) { |
| | | Page page = new Page(pageEventGridNearbyDTO.getPageNum(), pageEventGridNearbyDTO.getPageSize()); |
| | | String latLng = pageEventGridNearbyDTO.getHappentLatLng(); |
| | | if (!latLng.matches("^[\\-\\+]?(0(\\.\\d{1,10})?|([1-9](\\d)?)(\\.\\d{1,10})?|1[0-7]\\d{1}(\\.\\d{1,10})?|180\\.0{1,10}),[\\-\\+]?((0|([1-8]\\d?))(\\.\\d{1,10})?|90(\\.0{1,10})?)$")) { |
| | | // if(!latLng.matches("^[\\-\\+]?(0(\\.\\d{1,10})?|([1-9](\\d)?)(\\.\\d{1,10})?|1[0-7]\\d{1}(\\.\\d{1,10})?|180\\.0{1,10}),[\\-\\+]?((0|([1-8]\\d?))(\\.\\d{1,10})?|90(\\.0{1,10})?)$")){ |
| | | // return R.fail("经纬度参数错误"); |
| | | // } |
| | | //经纬度匹配规则:(短(纬度)在前长(经度)在后,不要擅自修改此规则,否则出现问题后果自负) |
| | | if(!latLng.matches("[1-9][0-9](\\.[0-9]{1,6})?,[1-9][0-9]{2}(\\.[0-9]{1,6})?")){ |
| | | return R.fail("经纬度参数错误"); |
| | | } |
| | | String latLngArr[] = latLng.split(","); |
| | |
| | | List<EventGridDataVO> rtEventGridList = new ArrayList<>(); |
| | | for (EventGridDataAreaVO eventGridDataDO : gridList) { |
| | | String data = eventGridDataDO.getData(); |
| | | if (data != null) { |
| | | if(data!=null) { |
| | | List<LatLngVO> latLngList = LngLatUtils.getLatLngFromText(data); |
| | | boolean inGrid = LngLatUtils.isInPolygon(latLngList, lng, lat); |
| | | if (inGrid) { |
| | |
| | | } else { |
| | | return R.ok("未找到社区"); |
| | | } |
| | | } catch (Exception e) { |
| | | }catch (Exception e){ |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | |
| | | throw new ServiceException("删除事件失败"); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | }catch (Exception e){ |
| | | throw new ServiceException("事件ID错误,删除失败"); |
| | | } |
| | | } |
| | |
| | | Long eventId = -1L; |
| | | try { |
| | | eventId = Long.parseLong(id); |
| | | } catch (Exception e) { |
| | | }catch (Exception e){ |
| | | throw new ServiceException("事件ID错误,发布失败"); |
| | | } |
| | | EventDO eventDO = this.getBaseMapper().selectById(eventId); |
| | |
| | | throw new ServiceException("更新事件状态失败"); |
| | | } |
| | | addTransferRecord(eventDO.getId(), userId, userName, 1, |
| | | "重新发布已撤销事件", userId, userName, 8); |
| | | "重新发布已撤销事件", userId, userName, 8); |
| | | } |
| | | return R.ok(); |
| | | } else { |
| | |
| | | Long eventId = -1L; |
| | | try { |
| | | eventId = Long.parseLong(id); |
| | | } catch (Exception e) { |
| | | }catch (Exception e){ |
| | | throw new ServiceException("事件ID错误,不能标记失效"); |
| | | } |
| | | EventDO eventDO = this.getBaseMapper().selectById(eventId); |
| | |
| | | |
| | | /** |
| | | * 根据网格id查询网格统计数据 |
| | | * |
| | | * @param gridId 网格id |
| | | * @return 网格统计数据 |
| | | * @param gridId 网格id |
| | | * @return 网格统计数据 |
| | | */ |
| | | @Override |
| | | public R getGridEventStatisticsByApp(Long gridId) { |
| | | public R getGridEventStatisticsByApp(Long gridId){ |
| | | return R.ok(this.baseMapper.getGridEventStatisticsByApp(gridId)); |
| | | } |
| | | |
| | | /** |
| | | * 查询网格事件统计数据 |
| | | * |
| | | * @param statisticsDTO 请求参数 |
| | | * @return 网格事件统计数据 |
| | | * @return 网格事件统计数据 |
| | | */ |
| | | @Override |
| | | public R getGridEventDetailStatisticsByApp(GridEventStatisticsDTO statisticsDTO) { |
| | | public R getGridEventDetailStatisticsByApp(GridEventStatisticsDTO statisticsDTO){ |
| | | GridEventStatisticsDetailVO statisticsDetailVO = this.baseMapper.getGridEventDetailStatisticsByApp(statisticsDTO); |
| | | if (statisticsDetailVO == null) { |
| | | if(statisticsDetailVO == null){ |
| | | statisticsDetailVO = new GridEventStatisticsDetailVO(); |
| | | } |
| | | |
| | | if (statisticsDetailVO.getEventSSPTotal() == null) { |
| | | if(statisticsDetailVO.getEventSSPTotal() == null){ |
| | | statisticsDetailVO.setEventSSPTotal(0); |
| | | } |
| | | if (statisticsDetailVO.getNoEventSSPTotal() == null) { |
| | | if(statisticsDetailVO.getNoEventSSPTotal() == null){ |
| | | statisticsDetailVO.setNoEventSSPTotal(0); |
| | | } |
| | | if (statisticsDetailVO.getEventZFTotal() == null) { |
| | | if(statisticsDetailVO.getEventZFTotal() == null){ |
| | | statisticsDetailVO.setEventZFTotal(0); |
| | | } |
| | | if (statisticsDetailVO.getNoEventZFTotal() == null) { |
| | | if(statisticsDetailVO.getNoEventZFTotal() == null){ |
| | | statisticsDetailVO.setNoEventZFTotal(0); |
| | | } |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R reportDirect(CommonEventDirectReportDTO commonEventDirectReportDTO) { |
| | | |
| | | if (commonEventDirectReportDTO.getEventId() != null) { |
| | | if(commonEventDirectReportDTO.getEventId()!=null){ |
| | | //编辑原来的 |
| | | EventDO eventDO = eventMapper.selectById(commonEventDirectReportDTO.getEventId()); |
| | | if (eventDO.getEventStatus() != null && eventDO.getEventStatus() != 1 && eventDO.getEventDealStatus() != 6) { |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | } else { |
| | | }else{ |
| | | EventDO eventDO = new EventDO(); |
| | | BeanUtils.copyProperties(commonEventDirectReportDTO, eventDO); |
| | | eventDO.setGridMemberId(commonEventDirectReportDTO.getUserId()); |
| | |
| | | |
| | | /** |
| | | * 事件大屏查询事件列表 |
| | | * |
| | | * @param eventListDTO 请求参数 |
| | | * @return 事件列表 |
| | | * @param eventListDTO 请求参数 |
| | | * @return 事件列表 |
| | | */ |
| | | @Override |
| | | public R getScreenEventList(ScreenEventListDTO eventListDTO) { |
| | | if (eventListDTO.getEventTypes() != null && !eventListDTO.getEventTypes().isEmpty()) { |
| | | eventListDTO.getEventTypes().forEach(eventType -> { |
| | | if (eventType.equals(ScreenEventListDTO.eventType.xc)) { |
| | | if(eventType.equals(ScreenEventListDTO.eventType.xc)){ |
| | | eventListDTO.setEventCategory(null); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | IPage<EventListVO> eventPageList = this.baseMapper.getScreenEventList(new Page(eventListDTO.getPageNum(), eventListDTO.getPageSize()), eventListDTO); |
| | | if (!eventPageList.getRecords().isEmpty()) { |
| | | if(!eventPageList.getRecords().isEmpty()){ |
| | | eventPageList.getRecords().forEach(event -> { |
| | | //查询事件关联附件 |
| | | List<EventResourceDO> eventResourceDOList = |
| | |
| | | |
| | | /** |
| | | * 特殊人群上报-社区人口数据列表 |
| | | * |
| | | * @param specialPopulationDTO 请求参数 |
| | | * @return 社区人口数据列表 |
| | | * @param specialPopulationDTO 请求参数 |
| | | * @return 社区人口数据列表 |
| | | */ |
| | | @Override |
| | | public R specialPopulationList(PageEventSpecialPopulationDTO specialPopulationDTO) { |
| | | IPage<EventSpecialPopulationVO> specialPopulationVOIPage = this.baseMapper.specialPopulationList(new Page(specialPopulationDTO.getPageNum(), specialPopulationDTO.getPageSize()), specialPopulationDTO); |
| | | if (!specialPopulationVOIPage.getRecords().isEmpty()) { |
| | | if(!specialPopulationVOIPage.getRecords().isEmpty()){ |
| | | specialPopulationVOIPage.getRecords().forEach(specialPopulation -> { |
| | | specialPopulation.setAge(IdcardUtil.getAgeByIdCard(specialPopulation.getIdCard())); |
| | | try { |
| | | Integer age = IdcardUtil.getAgeByIdCard(specialPopulation.getIdCard()); |
| | | specialPopulation.setAge(age); |
| | | }catch (Exception e){ |
| | | log.error("身份证号码转换年龄失败,人员id:" + specialPopulation.getId()); |
| | | } |
| | | }); |
| | | } |
| | | return R.ok(specialPopulationVOIPage); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<EventDetailsVO> getUnUploadEvent() { |
| | | List<EventDetailsVO> eventDetailsVOList = new ArrayList<>(); |
| | | List<EventDetailsVO> eventDetailsVOList =new ArrayList<>(); |
| | | List<EventDO> unEventList = baseMapper.selectList( |
| | | new QueryWrapper<EventDO>() |
| | | .eq("upload", false) |
| | |
| | | EventDO event = baseMapper.selectById(id); |
| | | event.setUpload(true); |
| | | baseMapper.updateById(event); |
| | | EventResourceDO eventResourceDO = new EventResourceDO(); |
| | | EventResourceDO eventResourceDO =new EventResourceDO(); |
| | | eventResourceDO.setUpload(true); |
| | | int flag = eventResourceMapper.update(eventResourceDO, new QueryWrapper<EventResourceDO>() |
| | | .eq("ref_id", id)); |
| | | if (flag > 0) { |
| | | if(flag>0){ |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public R eventWork(Long communityId) { |
| | | public R eventWork(Long communityId){ |
| | | EventWorkScreenVO workScreenVO = new EventWorkScreenVO(); |
| | | String date = DateUtils.getDateFormatString(new Date(), moth_format_str); |
| | | Map<String, Long> countMap = this.eventMapper.countByCommunityId(communityId, date); |
| | | if (!countMap.isEmpty()) { |
| | | workScreenVO.setResolvedNum(countMap.get("resolvedNum") == null ? 0L : Long.valueOf(countMap.get("resolvedNum").toString())); |
| | | workScreenVO.setPendingNum(countMap.get("pendingNum") == null ? 0L : Long.valueOf(countMap.get("pendingNum").toString())); |
| | | workScreenVO.setPropagandaNum(countMap.get("propagandaNum") == null ? 0L : Long.valueOf(countMap.get("propagandaNum").toString())); |
| | | workScreenVO.setCurrentNum(countMap.get("currentNum") == null ? 0L : Long.valueOf(countMap.get("currentNum").toString())); |
| | | String date = DateUtils.getDateFormatString(new Date(),moth_format_str); |
| | | Map<String,Long> countMap = this.eventMapper.countByCommunityId(communityId,date); |
| | | if(!countMap.isEmpty()){ |
| | | workScreenVO.setResolvedNum(countMap.get("resolvedNum")== null ? 0L : Long.valueOf(countMap.get("resolvedNum").toString())); |
| | | workScreenVO.setPendingNum(countMap.get("pendingNum")== null ? 0L : Long.valueOf(countMap.get("pendingNum").toString())); |
| | | workScreenVO.setPropagandaNum(countMap.get("propagandaNum")== null ? 13L : Long.valueOf(countMap.get("propagandaNum").toString())); |
| | | workScreenVO.setCurrentNum(countMap.get("currentNum")== null ? 0L : Long.valueOf(countMap.get("currentNum").toString())); |
| | | } |
| | | |
| | | //计算处理时间消耗的时间 |
| | | DateScreenVO countAvg = this.eventMapper.countByAvgCommunityId(communityId); |
| | | if (countAvg != null) { |
| | | int second = (int) (countAvg.getStartTime().getTime() - countAvg.getEndTime().getTime()) / 1000; |
| | | if (second > 0) { |
| | | second = second / workScreenVO.getResolvedNum().intValue(); |
| | | if(countAvg != null){ |
| | | int second = (int) (countAvg.getEndTime().getTime() - countAvg.getStartTime().getTime())/1000; |
| | | if(second > 0){ |
| | | second = second/workScreenVO.getResolvedNum().intValue(); |
| | | workScreenVO.setAvgCost(second); |
| | | } |
| | | } |
| | | //查询最新事件轮播列表 |
| | | List<EventDetailWorkVO> eventList = this.eventMapper.getWorkScreenEventList(communityId); |
| | | if (!eventList.isEmpty()) { |
| | | if(!eventList.isEmpty()){ |
| | | workScreenVO.setEventList(eventList); |
| | | } |
| | | |
| | | //统计近半年数据 |
| | | List<EventWorkVO> list = new ArrayList<>(); |
| | | for (EventWorkVO eventWorkVO : listHalfYearByDyn()) { |
| | | EventWorkVO result = this.eventMapper.countByTime(eventWorkVO.getStart(), eventWorkVO.getEnd(), communityId); |
| | | for(EventWorkVO eventWorkVO: listHalfYearByDyn()){ |
| | | EventWorkVO result = this.eventMapper.countByTime(eventWorkVO.getStart(),eventWorkVO.getEnd(),communityId); |
| | | result.setMonth(eventWorkVO.getMonth()); |
| | | list.add(result); |
| | | } |
| | |
| | | |
| | | //查询完成事件统计 |
| | | EventTypeWorkVO complete = this.eventMapper.getComplete(communityId); |
| | | if (complete != null) { |
| | | if(complete != null){ |
| | | workScreenVO.setComplete(complete); |
| | | } |
| | | //查询未完成事件统计 |
| | | EventTypeWorkVO noComplete = this.eventMapper.getNoComplete(communityId); |
| | | if (complete != null) { |
| | | if(complete != null){ |
| | | workScreenVO.setNoComplete(noComplete); |
| | | } |
| | | return R.ok(workScreenVO); |
| | |
| | | |
| | | private List<EventWorkVO> listHalfYearByDyn() { |
| | | List<EventWorkVO> dateList = new ArrayList<>(); |
| | | Date now = new Date(); |
| | | for (int i = 6; i >= 1; i--) { |
| | | Date date = DateUtils.getDateM(now, -i); |
| | | Date now = new Date(); |
| | | for(int i= 6;i>=1;i--){ |
| | | Date date = DateUtils.getDateM(now,-i); |
| | | DateTime endDay = DateUtil.endOfMonth(date); |
| | | |
| | | int m = DateUtil.month(endDay); |
| | | // if(m == 0){ |
| | | // m = 11; |
| | | // } |
| | | // m--; |
| | | m++; |
| | | if(m == 12){ |
| | | m = 0; |
| | | } |
| | | int day = DateUtil.dayOfMonth(endDay); |
| | | int half = day / 2; |
| | | String month = DateUtil.format(date, moth_format_str); |
| | | int half = day/2; |
| | | String month = DateUtil.format(date,moth_format_str); |
| | | EventWorkVO eventWorkVO = new EventWorkVO(); |
| | | eventWorkVO.setMonth(monthStr[m] + "月上旬"); |
| | | eventWorkVO.setStart(month + "-01 00:00:00"); |
| | | eventWorkVO.setEnd(month + "-" + half + " 23:59:58"); |
| | | eventWorkVO.setMonth(monthStr[m]+"月上旬"); |
| | | eventWorkVO.setStart(month+ "-01 00:00:00"); |
| | | eventWorkVO.setEnd(month+ "-"+half+" 23:59:58"); |
| | | dateList.add(eventWorkVO); |
| | | EventWorkVO eventWorkVO1 = new EventWorkVO(); |
| | | eventWorkVO1.setMonth(monthStr[m] + "月下旬"); |
| | | eventWorkVO1.setStart(month + "-" + half + " 23:59:58"); |
| | | eventWorkVO1.setEnd(DateUtils.getDateFormatString(endDay, "yyyy-MM-dd HH:mm:ss")); |
| | | eventWorkVO1.setMonth(monthStr[m]+"月下旬"); |
| | | eventWorkVO1.setStart(month+ "-"+half+" 23:59:58"); |
| | | eventWorkVO1.setEnd(DateUtils.getDateFormatString(endDay,"yyyy-MM-dd HH:mm:ss")); |
| | | dateList.add(eventWorkVO1); |
| | | } |
| | | return dateList; |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | EventServiceImpl service = new EventServiceImpl(); |
| | | List<EventWorkVO> list = service.listHalfYearByDyn(); |
| | | System.out.println(list); |
| | | String content = "30,104"; |
| | | String re = "[1-9][0-9](\\.[0-9]{1,6})?,[1-9][0-9]{2}(\\.[0-9]{1,6})?"; |
| | | |
| | | System.out.println(content.matches(re)); |
| | | } |
| | | |
| | | } |