mitao
2025-05-20 179c4d64313c9b7572778da4aaaf6c6584fe457d
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/StreetBigScreenServiceImpl.java
@@ -9,6 +9,8 @@
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;
@@ -77,12 +79,21 @@
        else if(StringUtils.equals(type,"2"))
        {
            //按月份
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
            LocalDate localDate = LocalDate.parse(starTime);
            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 = localDate.with(TemporalAdjusters.firstDayOfMonth()).format(formatter);
            // 获取当前月份的最后一天
            String lastDayOfMonth = localDate.with(TemporalAdjusters.lastDayOfMonth()).format(formatter);
            String firstDayOfMonth = starTime+"-01";
//                // 获取当前月份的最后一天
            String lastDayOfMonth = sdf.format(lastDay);
            //获取小程序用户数量
            userNum= baseMapper.getUserNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
@@ -178,21 +189,37 @@
        }
        else if(StringUtils.equals(type,"2"))
        {
            //按月份
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
            LocalDate localDate = LocalDate.parse(starTime);
            // 获取当前月份的第一天
            String firstDayOfMonth = localDate.with(TemporalAdjusters.firstDayOfMonth()).format(formatter);
            // 获取当前月份的最后一天
            String lastDayOfMonth = localDate.with(TemporalAdjusters.lastDayOfMonth()).format(formatter);
            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");
            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"))
        {
@@ -282,6 +309,8 @@
        //报到党员总计数据
        Integer MemberNum=0;
        Integer fuwuNum=0;
        if(StringUtils.equals(type,"1"))
        {
            //按年份
@@ -302,16 +331,27 @@
            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"))
        {
            //按月份
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
            LocalDate localDate = LocalDate.parse(starTime);
            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 = localDate.with(TemporalAdjusters.firstDayOfMonth()).format(formatter);
            // 获取当前月份的最后一天
            String lastDayOfMonth = localDate.with(TemporalAdjusters.lastDayOfMonth()).format(formatter);
            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");
@@ -329,6 +369,7 @@
            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"))
        {
@@ -352,6 +393,7 @@
            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"))
        {
@@ -372,6 +414,7 @@
            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
@@ -392,6 +435,7 @@
            UnitNum=baseMapper.getUnitNum(streetId,communityId,null,null);
            //报到党员总计数据
            MemberNum=baseMapper.getMemberNum(streetId,communityId,null,null);
            fuwuNum=baseMapper.getRegistNum(streetId,communityId,null,null);
        }
@@ -417,8 +461,8 @@
        doubleRegistrationData.setUnitNum(UnitNum);
        //报到党员总计数据
        doubleRegistrationData.setMemberNum(MemberNum);
        doubleRegistrationData.setAllNum(NewNeedNum+OleNeedNum+OleProblemNum+NewProblemNum);
        //报到服务次数
        doubleRegistrationData.setAllNum(NewNeedNum+OleNeedNum+OleProblemNum+NewProblemNum+fuwuNum);
        return R.ok(doubleRegistrationData);
@@ -465,12 +509,21 @@
        else if(StringUtils.equals(type,"2"))
        {
            //按月份
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
            LocalDate localDate = LocalDate.parse(starTime);
            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 = localDate.with(TemporalAdjusters.firstDayOfMonth()).format(formatter);
            // 获取当前月份的最后一天
            String lastDayOfMonth = localDate.with(TemporalAdjusters.lastDayOfMonth()).format(formatter);
            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");
@@ -622,12 +675,21 @@
        else if(StringUtils.equals(type,"2"))
        {
            //按月份
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
            LocalDate localDate = LocalDate.parse(starTime);
            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 = localDate.with(TemporalAdjusters.firstDayOfMonth()).format(formatter);
            // 获取当前月份的最后一天
            String lastDayOfMonth = localDate.with(TemporalAdjusters.lastDayOfMonth()).format(formatter);
            String firstDayOfMonth = starTime+"-01";
//                // 获取当前月份的最后一天
            String lastDayOfMonth = sdf.format(lastDay);
            //* 社区活动统计
            nommunityActNumList=baseMapper.getNommunityActNumList("%Y-%m",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");