lidongdong
2024-09-24 be5a406e57508a02f709c9ffd6c254e25d6ae47e
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;
@@ -180,21 +182,35 @@
        else if(StringUtils.equals(type,"2"))
        {
            //按月份
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
            DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyy-MM");
            LocalDate localDate = LocalDate.parse(starTime, formatter2);
            // 获取当前月份的第一天
            String firstDayOfMonth = localDate.with(TemporalAdjusters.firstDayOfMonth()).format(formatter);
            // 获取当前月份的最后一天
            String lastDayOfMonth = localDate.with(TemporalAdjusters.lastDayOfMonth()).format(formatter);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            try {
                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");
                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"))
        {