package com.panzhihua.service_dangjian.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.model.dtos.partybuilding.*; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.partybuilding.PhotoMicroWishData; import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.service_dangjian.dao.StreetBigScreenDAO; import com.panzhihua.service_dangjian.service.StreetBigScreenService; import org.springframework.stereotype.Service; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAdjusters; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; /** * @program: springcloud_k8s_panzhihuazhihuishequ * @description: 党组织 * @author: huang.hongfa weixin hhf9596 qq 959656820 * @create: 2020-11-30 11:40 **/ @Service public class StreetBigScreenServiceImpl extends ServiceImpl implements StreetBigScreenService { @Override public R getCommunityId(String streetId) { if(StringUtils.isEmpty(streetId)) { return R.fail("街道id不能为空"); } return R.ok(baseMapper.getCommunityId(streetId)); } /** * 获取核心指标数据 * @param streetId * @return */ @Override public R getCoreData(String streetId,String communityId,String type,String starTime,String endTime) { if(StringUtils.isEmpty(streetId) && StringUtils.isEmpty(communityId) ) { return R.fail("街道id或社区id不能为空"); } //获取小程序用户数量 int userNum=0; //获取实有人口总数 int ActualPopNum=0; //获取小区总数 int VillageNum=0; //获取志愿者总数 int VolunteerNum=0; if(StringUtils.equals(type,"1")) { //按年份 // int year=Calendar.getInstance().get(Calendar.YEAR); //获取小程序用户数量 userNum= baseMapper.getUserNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //获取实有人口总数 ActualPopNum= baseMapper.getActualPopNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //获取小区总数 VillageNum= baseMapper.getVillageNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //获取志愿者总数 VolunteerNum= baseMapper.getVolunteerNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); } else if(StringUtils.equals(type,"2")) { //按月份 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = null; try { date = sdf.parse(starTime+"-01"); } catch (ParseException e) { e.printStackTrace(); } Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); Date lastDay = calendar.getTime(); // 获取当前月份的第一天 String firstDayOfMonth = starTime+"-01"; // // 获取当前月份的最后一天 String lastDayOfMonth = sdf.format(lastDay); //获取小程序用户数量 userNum= baseMapper.getUserNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); //获取实有人口总数 ActualPopNum= baseMapper.getActualPopNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); //获取小区总数 VillageNum= baseMapper.getVillageNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); //获取志愿者总数 VolunteerNum= baseMapper.getVolunteerNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); } else if(StringUtils.equals(type,"3")) { //按天份 // DateTimeFormatter newformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // String data=LocalDate.now().format(newformatter); userNum= baseMapper.getUserNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //获取实有人口总数 ActualPopNum= baseMapper.getActualPopNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //获取小区总数 VillageNum= baseMapper.getVillageNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //获取志愿者总数 VolunteerNum= baseMapper.getVolunteerNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); } else if(StringUtils.equals(type,"4")) { //按时间范围 userNum= baseMapper.getUserNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //获取实有人口总数 ActualPopNum= baseMapper.getActualPopNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //获取小区总数 VillageNum= baseMapper.getVillageNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //获取志愿者总数 VolunteerNum= baseMapper.getVolunteerNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); } else { //type为空 查全部 userNum= baseMapper.getUserNum(streetId,communityId,null,null); //获取实有人口总数 ActualPopNum= baseMapper.getActualPopNum(streetId,communityId,null,null); //获取小区总数 VillageNum= baseMapper.getVillageNum(streetId,communityId,null,null); //获取志愿者总数 VolunteerNum= baseMapper.getVolunteerNum(streetId,communityId,null,null); } StreetCoreData streetCoreData=new StreetCoreData(); streetCoreData.setUserNum(userNum); streetCoreData.setVillageNum(VillageNum); streetCoreData.setActualPopNum(ActualPopNum); streetCoreData.setVolunteerNum(VolunteerNum); return R.ok(streetCoreData); } /** * 获取三务三资数据 * @param streetId * @param communityId * @param type * @param starTime * @param endTime * @return */ @Override public R getThreeNum(String streetId, String communityId,String type,String starTime, String endTime) { if(StringUtils.isEmpty(streetId) && StringUtils.isEmpty(communityId) ) { return R.fail("街道id或社区id不能为空"); } int partyAffairsNum=0; int serviceNum=0; int financeNum=0; int fundNum=0; int propertyNum=0; int naturalResourcesNum=0; int villageEconomyNum=0; if(StringUtils.equals(type,"1")) { //按年份 // int year=Calendar.getInstance().get(Calendar.YEAR); partyAffairsNum=baseMapper.getThreeNum(streetId,communityId,"党务公开",starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); serviceNum=baseMapper.getThreeNum(streetId,communityId,"服务公开",starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); financeNum=baseMapper.getThreeNum(streetId,communityId,"财务公开",starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); fundNum=baseMapper.getThreeNum(streetId,communityId,"资金公开",starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); propertyNum=baseMapper.getThreeNum(streetId,communityId,"资产公开",starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); naturalResourcesNum=baseMapper.getThreeNum(streetId,communityId,"资源公开",starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); villageEconomyNum=baseMapper.getThreeNum(streetId,communityId,"村集体经济组织项目",starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); } else if(StringUtils.equals(type,"2")) { try { //按月份 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = sdf.parse(starTime+"-01"); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); Date lastDay = calendar.getTime(); // 获取当前月份的第一天 String firstDayOfMonth = starTime+"-01"; // // 获取当前月份的最后一天 String lastDayOfMonth = sdf.format(lastDay); partyAffairsNum=baseMapper.getThreeNum(streetId,communityId,"党务公开",firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); serviceNum=baseMapper.getThreeNum(streetId,communityId,"服务公开",firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); financeNum=baseMapper.getThreeNum(streetId,communityId,"财务公开",firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); fundNum=baseMapper.getThreeNum(streetId,communityId,"资金公开",firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); propertyNum=baseMapper.getThreeNum(streetId,communityId,"资产公开",firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); naturalResourcesNum=baseMapper.getThreeNum(streetId,communityId,"资源公开",firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); villageEconomyNum=baseMapper.getThreeNum(streetId,communityId,"村集体经济组织项目",firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); } catch (ParseException e) { e.printStackTrace(); } // 获取并打印第一天的日期 } else if(StringUtils.equals(type,"3")) { //按天份 // DateTimeFormatter newformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // String data=LocalDate.now().format(newformatter); partyAffairsNum=baseMapper.getThreeNum(streetId,communityId,"党务公开",starTime+" 00:00:00",starTime+" 23:59:59"); serviceNum=baseMapper.getThreeNum(streetId,communityId,"服务公开",starTime+" 00:00:00",starTime+" 23:59:59"); financeNum=baseMapper.getThreeNum(streetId,communityId,"财务公开",starTime+" 00:00:00",starTime+" 23:59:59"); fundNum=baseMapper.getThreeNum(streetId,communityId,"资金公开",starTime+" 00:00:00",starTime+" 23:59:59"); propertyNum=baseMapper.getThreeNum(streetId,communityId,"资产公开",starTime+" 00:00:00",starTime+" 23:59:59"); naturalResourcesNum=baseMapper.getThreeNum(streetId,communityId,"资源公开",starTime+" 00:00:00",starTime+" 23:59:59"); villageEconomyNum=baseMapper.getThreeNum(streetId,communityId,"村集体经济组织项目",starTime+" 00:00:00",starTime+" 23:59:59"); } else if(StringUtils.equals(type,"4")) { //按时间范围 partyAffairsNum=baseMapper.getThreeNum(streetId,communityId,"党务公开",starTime+" 00:00:00",endTime+" 23:59:59"); serviceNum=baseMapper.getThreeNum(streetId,communityId,"服务公开",starTime+" 00:00:00",endTime+" 23:59:59"); financeNum=baseMapper.getThreeNum(streetId,communityId,"财务公开",starTime+" 00:00:00",endTime+" 23:59:59"); fundNum=baseMapper.getThreeNum(streetId,communityId,"资金公开",starTime+" 00:00:00",endTime+" 23:59:59"); propertyNum=baseMapper.getThreeNum(streetId,communityId,"资产公开",starTime+" 00:00:00",endTime+" 23:59:59"); naturalResourcesNum=baseMapper.getThreeNum(streetId,communityId,"资源公开",starTime+" 00:00:00",endTime+" 23:59:59"); villageEconomyNum=baseMapper.getThreeNum(streetId,communityId,"村集体经济组织项目",starTime+" 00:00:00",endTime+" 23:59:59"); } else { partyAffairsNum=baseMapper.getThreeNum(streetId,communityId,"党务公开",null,null); serviceNum=baseMapper.getThreeNum(streetId,communityId,"服务公开",null,null); financeNum=baseMapper.getThreeNum(streetId,communityId,"财务公开",null,null); fundNum=baseMapper.getThreeNum(streetId,communityId,"资金公开",null,null); propertyNum=baseMapper.getThreeNum(streetId,communityId,"资产公开",null,null); naturalResourcesNum=baseMapper.getThreeNum(streetId,communityId,"资源公开",null,null); villageEconomyNum=baseMapper.getThreeNum(streetId,communityId,"村集体经济组织项目",null,null); } ThreeNumData threeNumData=new ThreeNumData(); threeNumData.setPartyAffairsNum(partyAffairsNum); threeNumData.setServiceNum(serviceNum); threeNumData.setFinanceNum(financeNum); threeNumData.setFundNum(fundNum); threeNumData.setPropertyNum(propertyNum); threeNumData.setNaturalResourcesNum(naturalResourcesNum); threeNumData.setVillageEconomyNum(villageEconomyNum); threeNumData.setThreeServiceNum(partyAffairsNum+serviceNum+financeNum); threeNumData.setThreeFundNum(fundNum+propertyNum+naturalResourcesNum); return R.ok(threeNumData); } /** * 双报到双服务 * @param streetId * @param communityId * @param type * @param starTime * @param endTime * @return */ @Override public R getDoubleRegistration(String streetId, String communityId, String type, String starTime, String endTime) { if(StringUtils.isEmpty(streetId) && StringUtils.isEmpty(communityId) ) { return R.fail("街道id或社区id不能为空"); } //旧的报道需求问题统计数 2.问题清单 3.需求清单 Integer OleProblemNum=0; Integer OleNeedNum=0; //旧的报道需求问题统计数 1问题清单 2需求清单 Integer NewProblemNum=0; Integer NewNeedNum=0; //获取旧双报道服务时间 Double OldTime=0.0; //获取新双报道服务时间 Double NewTime=0.0; //党建动态数据 Integer PartyBuildingNum=0; //报到单位总计数据 Integer UnitNum=0; //报到党员总计数据 Integer MemberNum=0; Integer fuwuNum=0; if(StringUtils.equals(type,"1")) { //按年份 // int year=Calendar.getInstance().get(Calendar.YEAR); //旧的报道需求问题统计数 2.问题清单 3.需求清单 OleProblemNum=baseMapper.getOleNeedProblemNum("2",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); OleNeedNum=baseMapper.getOleNeedProblemNum("3",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //旧的报道需求问题统计数 1问题清单 2需求清单 NewProblemNum=baseMapper.getNewNeedProblemNum("1",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); NewNeedNum=baseMapper.getNewNeedProblemNum("2",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //获取旧双报道服务时间 OldTime=baseMapper.getOldTime(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //获取新双报道服务时间 NewTime=baseMapper.getNewTime(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //党建动态数据 PartyBuildingNum=baseMapper.getPartyBuildingNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //报到单位总计数据 UnitNum=baseMapper.getUnitNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //报到党员总计数据 MemberNum=baseMapper.getMemberNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); fuwuNum=baseMapper.getRegistNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); } else if(StringUtils.equals(type,"2")) { //按月份 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = null; try { date = sdf.parse(starTime+"-01"); } catch (ParseException e) { e.printStackTrace(); } Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); Date lastDay = calendar.getTime(); // 获取当前月份的第一天 String firstDayOfMonth = starTime+"-01"; // // 获取当前月份的最后一天 String lastDayOfMonth = sdf.format(lastDay); //旧的报道需求问题统计数 2.问题清单 3.需求清单 OleProblemNum=baseMapper.getOleNeedProblemNum("2",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); OleNeedNum=baseMapper.getOleNeedProblemNum("3",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); //旧的报道需求问题统计数 1问题清单 2需求清单 NewProblemNum=baseMapper.getNewNeedProblemNum("1",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); NewNeedNum=baseMapper.getNewNeedProblemNum("2",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); //获取旧双报道服务时间 OldTime=baseMapper.getOldTime(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); //获取新双报道服务时间 NewTime=baseMapper.getNewTime(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); //党建动态数据 PartyBuildingNum=baseMapper.getPartyBuildingNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); //报到单位总计数据 UnitNum=baseMapper.getUnitNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); //报到党员总计数据 MemberNum=baseMapper.getMemberNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); fuwuNum=baseMapper.getRegistNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); } else if(StringUtils.equals(type,"3")) { //按天份 // DateTimeFormatter newformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // String data=LocalDate.now().format(newformatter); //旧的报道需求问题统计数 2.问题清单 3.需求清单 OleProblemNum=baseMapper.getOleNeedProblemNum("2",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); OleNeedNum=baseMapper.getOleNeedProblemNum("3",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //旧的报道需求问题统计数 1问题清单 2需求清单 NewProblemNum=baseMapper.getNewNeedProblemNum("1",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); NewNeedNum=baseMapper.getNewNeedProblemNum("2",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //获取旧双报道服务时间 OldTime=baseMapper.getOldTime(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //获取新双报道服务时间 NewTime=baseMapper.getNewTime(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //党建动态数据 PartyBuildingNum=baseMapper.getPartyBuildingNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //报到单位总计数据 UnitNum=baseMapper.getUnitNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //报到党员总计数据 MemberNum=baseMapper.getMemberNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); fuwuNum=baseMapper.getRegistNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); } else if(StringUtils.equals(type,"4")) { //按时间范围 //旧的报道需求问题统计数 2.问题清单 3.需求清单 OleProblemNum=baseMapper.getOleNeedProblemNum("2",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); OleNeedNum=baseMapper.getOleNeedProblemNum("3",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //旧的报道需求问题统计数 1问题清单 2需求清单 NewProblemNum=baseMapper.getNewNeedProblemNum("1",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); NewNeedNum=baseMapper.getNewNeedProblemNum("2",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //获取旧双报道服务时间 OldTime=baseMapper.getOldTime(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //获取新双报道服务时间 NewTime=baseMapper.getNewTime(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //党建动态数据 PartyBuildingNum=baseMapper.getPartyBuildingNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //报到单位总计数据 UnitNum=baseMapper.getUnitNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //报到党员总计数据 MemberNum=baseMapper.getMemberNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); fuwuNum=baseMapper.getRegistNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); } else { //旧的报道需求问题统计数 2.问题清单 3.需求清单 OleProblemNum=baseMapper.getOleNeedProblemNum("2",streetId,communityId,null,null); OleNeedNum=baseMapper.getOleNeedProblemNum("3",streetId,communityId,null,null); //旧的报道需求问题统计数 1问题清单 2需求清单 NewProblemNum=baseMapper.getNewNeedProblemNum("1",streetId,communityId,null,null); NewNeedNum=baseMapper.getNewNeedProblemNum("2",streetId,communityId,null,null); //获取旧双报道服务时间 OldTime=baseMapper.getOldTime(streetId,communityId,null,null); //获取新双报道服务时间 NewTime=baseMapper.getNewTime(streetId,communityId,null,null); //党建动态数据 PartyBuildingNum=baseMapper.getPartyBuildingNum(streetId,communityId,null,null); //报到单位总计数据 UnitNum=baseMapper.getUnitNum(streetId,communityId,null,null); //报到党员总计数据 MemberNum=baseMapper.getMemberNum(streetId,communityId,null,null); fuwuNum=baseMapper.getRegistNum(streetId,communityId,null,null); } if(NewTime==null) { NewTime=0.0; } if(OldTime==null) { OldTime=0.0; } DoubleRegistrationData doubleRegistrationData=new DoubleRegistrationData(); //报道需求统计数 doubleRegistrationData.setNeedNum(NewNeedNum+OleNeedNum); //报道问题 doubleRegistrationData.setProblemNum(OleProblemNum+NewProblemNum); //获取旧双报道服务时间 doubleRegistrationData.setTimes(OldTime+NewTime); //党建动态数据 doubleRegistrationData.setPartyBuildingNum(PartyBuildingNum); //报到单位总计数据 doubleRegistrationData.setUnitNum(UnitNum); //报到党员总计数据 doubleRegistrationData.setMemberNum(MemberNum); //报到服务次数 doubleRegistrationData.setAllNum(NewNeedNum+OleNeedNum+OleProblemNum+NewProblemNum+fuwuNum); return R.ok(doubleRegistrationData); } /** * 随手拍 微心愿 * @param streetId * @param communityId * @param type * @param starTime * @param endTime * @return */ @Override public R getPhotoMicroWish(String streetId, String communityId, String type, String starTime, String endTime) { //随手拍 List photoList=new ArrayList<>(); //微心愿 List microWishList=new ArrayList<>(); // List list=new ArrayList<>(); int photoNum=0; int microWishNum=0; if(StringUtils.equals(type,"1")) { //按年份 // int year=Calendar.getInstance().get(Calendar.YEAR); //随手拍 photoList=baseMapper.getPhotoMicroWishData("1","%Y",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //微心愿 microWishList=baseMapper.getPhotoMicroWishData("2","%Y",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); photoNum=baseMapper.getPhotoAllNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); microWishNum=baseMapper.getMicroWishAllNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); } else if(StringUtils.equals(type,"2")) { //按月份 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = null; try { date = sdf.parse(starTime+"-01"); } catch (ParseException e) { e.printStackTrace(); } Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); Date lastDay = calendar.getTime(); // 获取当前月份的第一天 String firstDayOfMonth = starTime+"-01"; // // 获取当前月份的最后一天 String lastDayOfMonth = sdf.format(lastDay); photoList=baseMapper.getPhotoMicroWishData("1","%Y-%m",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); microWishList=baseMapper.getPhotoMicroWishData("2","%Y-%m",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); photoNum=baseMapper.getPhotoAllNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); microWishNum=baseMapper.getMicroWishAllNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); } else if(StringUtils.equals(type,"3")) { //按天份 // DateTimeFormatter newformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // String data=LocalDate.now().format(newformatter); photoList=baseMapper.getPhotoMicroWishData("1","%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); microWishList=baseMapper.getPhotoMicroWishData("2","%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); photoNum=baseMapper.getPhotoAllNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); microWishNum=baseMapper.getMicroWishAllNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); } else if(StringUtils.equals(type,"4")) { photoList=baseMapper.getPhotoMicroWishData("1","%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); microWishList=baseMapper.getPhotoMicroWishData("2","%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); photoNum=baseMapper.getPhotoAllNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); microWishNum=baseMapper.getMicroWishAllNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); } else { photoList=baseMapper.getPhotoMicroWishData("1","%Y-%m",streetId,communityId,null,null); microWishList=baseMapper.getPhotoMicroWishData("2","%Y-%m",streetId,communityId,null,null); photoNum=baseMapper.getPhotoAllNum(streetId,communityId,null,null); microWishNum=baseMapper.getMicroWishAllNum(streetId,communityId,null,null); } // for (int a=0;a=photoList.size()) // { // PhotoMicroWishData data=new PhotoMicroWishData(); // data.setMicroNum(microWishList.get(a).getPhotoNum()); // data.setCreateAt(microWishList.get(a).getCreateAt()); // data.setTiems(microWishList.get(a).getTiems()); // data.setPhotoNum("0"); // list.add(data); // } // // } // // photoList.addAll(list); // // if(photoList!=null && photoList.size()>1) // { // Collections.sort(photoList, new Comparator() { // @Override // public int compare(PhotoMicroWishData o1, PhotoMicroWishData o2) { // return o1.getCreateAt().compareTo(o2.getCreateAt()); // } // }); // } PhotoMicroWish photoMicroWish=new PhotoMicroWish(); photoMicroWish.setPhotoList(photoList); photoMicroWish.setMicroWishList(microWishList); photoMicroWish.setPhotoNum(photoNum); photoMicroWish.setMicroWishNum(microWishNum); return R.ok(photoMicroWish); } /** * 社区活动、议事投票、问卷调查、社区动态发布趋势 * @param streetId * @param communityId * @param type * @param starTime * @param endTime * @return */ @Override public R getAllData(String streetId, String communityId, String type, String starTime, String endTime) { //议事投票 List discussList=new ArrayList<>(); //问卷调查 List questnaireNumList=new ArrayList<>(); //社区动态 List nommunityDynNumList=new ArrayList<>(); //社区活动 List nommunityActNumList=new ArrayList<>(); //议事投票数量") int discussNum=0; //问卷调查数量") int questnaireNum=0; //社区动态数量") int nommunityDynNum=0; //社区活动数量") int nommunityActNum=0; if(StringUtils.equals(type,"1")) { //按年份 // int year=Calendar.getInstance().get(Calendar.YEAR); //* 社区活动统计 nommunityActNumList=baseMapper.getNommunityActNumList("%Y",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //社区动态 nommunityDynNumList=baseMapper.getNommunityDynNumList("%Y",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //问卷调查 questnaireNumList=baseMapper.getQuestnaireNumList("%Y",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //议事投票 discussList=baseMapper.getDiscussNumList("%Y",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //议事投票数量") discussNum=baseMapper.getDiscussNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //问卷调查数量") questnaireNum=baseMapper.getQuestnaireNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //社区动态数量") nommunityDynNum=baseMapper.getNommunityDynNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); //社区活动数量") nommunityActNum=baseMapper.getNommunityActNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59"); } else if(StringUtils.equals(type,"2")) { //按月份 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = null; try { date = sdf.parse(starTime+"-01"); } catch (ParseException e) { e.printStackTrace(); } Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); Date lastDay = calendar.getTime(); // 获取当前月份的第一天 String firstDayOfMonth = starTime+"-01"; // // 获取当前月份的最后一天 String lastDayOfMonth = sdf.format(lastDay); //* 社区活动统计 nommunityActNumList=baseMapper.getNommunityActNumList("%Y-%m",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); //社区动态 nommunityDynNumList=baseMapper.getNommunityDynNumList("%Y-%m",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); //问卷调查 questnaireNumList=baseMapper.getQuestnaireNumList("%Y-%m",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); //议事投票 discussList=baseMapper.getDiscussNumList("%Y-%m",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59"); } else if(StringUtils.equals(type,"3")) { //按天份 // DateTimeFormatter newformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // String data=LocalDate.now().format(newformatter); //* 社区活动统计 nommunityActNumList=baseMapper.getNommunityActNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //社区动态 nommunityDynNumList=baseMapper.getNommunityDynNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //问卷调查 questnaireNumList=baseMapper.getQuestnaireNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //议事投票 discussList=baseMapper.getDiscussNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //议事投票数量") discussNum=baseMapper.getDiscussNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //问卷调查数量") questnaireNum=baseMapper.getQuestnaireNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //社区动态数量") nommunityDynNum=baseMapper.getNommunityDynNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); //社区活动数量") nommunityActNum=baseMapper.getNommunityActNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59"); } else if(StringUtils.equals(type,"4")) { //* 社区活动统计 nommunityActNumList=baseMapper.getNommunityActNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //社区动态 nommunityDynNumList=baseMapper.getNommunityDynNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //问卷调查 questnaireNumList=baseMapper.getQuestnaireNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //议事投票 discussList=baseMapper.getDiscussNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //议事投票数量") discussNum=baseMapper.getDiscussNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //问卷调查数量") questnaireNum=baseMapper.getQuestnaireNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //社区动态数量") nommunityDynNum=baseMapper.getNommunityDynNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); //社区活动数量") nommunityActNum=baseMapper.getNommunityActNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59"); } else { //* 社区活动统计 nommunityActNumList=baseMapper.getNommunityActNumList("%Y-%m",streetId,communityId,null,null); //社区动态 nommunityDynNumList=baseMapper.getNommunityDynNumList("%Y-%m",streetId,communityId,null,null); //问卷调查 questnaireNumList=baseMapper.getQuestnaireNumList("%Y-%m",streetId,communityId,null,null); //议事投票 discussList=baseMapper.getDiscussNumList("%Y-%m",streetId,communityId,null,null); //议事投票数量") discussNum=baseMapper.getDiscussNum(streetId,communityId,null,null); //问卷调查数量") questnaireNum=baseMapper.getQuestnaireNum(streetId,communityId,null,null); //社区动态数量") nommunityDynNum=baseMapper.getNommunityDynNum(streetId,communityId,null,null); //社区活动数量") nommunityActNum=baseMapper.getNommunityActNum(streetId,communityId,null,null); } AllData allData=new AllData(); allData.setDiscussList(discussList); allData.setNommunityActNumList(nommunityActNumList); allData.setNommunityDynNumList(nommunityDynNumList); allData.setQuestnaireNumList(questnaireNumList); allData.setQuestnaireNum(questnaireNum); allData.setNommunityDynNum(nommunityDynNum); allData.setNommunityActNum(nommunityActNum); allData.setDiscussNum(discussNum); return R.ok(allData); } }