瀏覽代碼

PC首页统计、新增时间方法

LIVE_YE 1 年之前
父節點
當前提交
24855da280

+ 30 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/statistics/StatisticsController.java

@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
+import java.text.ParseException;
 
 
 /**
 /**
  * @Author: tjf
  * @Author: tjf
@@ -46,4 +47,33 @@ public class StatisticsController extends BaseController {
     public void exportForm(HttpServletResponse response, MemberInfo memberInfo) {
     public void exportForm(HttpServletResponse response, MemberInfo memberInfo) {
         statisticsService.exportForm(response, memberInfo);
         statisticsService.exportForm(response, memberInfo);
     }
     }
+
+
+    /**
+     * pc首页(近三月)
+     */
+    @PreAuthorize("@ss.hasPermi('statistics:boundary:threeWyta')")
+    @GetMapping("/threeData")
+    public AjaxResult threeData() throws ParseException {
+        return statisticsService.threeData();
+    }
+
+    /**
+     * pc首页(本周提案/社情民意统计)
+     */
+    @PreAuthorize("@ss.hasPermi('statistics:boundary:weekData')")
+    @GetMapping("/weekData")
+    public AjaxResult weekData() throws ParseException {
+        return statisticsService.weekData();
+    }
+
+    /**
+     * pc首页(本季度提案统计)
+     */
+    @PreAuthorize("@ss.hasPermi('statistics:boundary:quarterData')")
+    @GetMapping("/quarterData")
+    public AjaxResult quarterData() throws ParseException {
+        return statisticsService.quarterData();
+    }
+
 }
 }

+ 177 - 9
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -3,13 +3,11 @@ package com.ruoyi.common.utils;
 import java.lang.management.ManagementFactory;
 import java.lang.management.ManagementFactory;
 import java.text.ParseException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.ZoneId;
-import java.time.ZonedDateTime;
-import java.util.Calendar;
-import java.util.Date;
+import java.time.*;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+
+import com.alibaba.fastjson2.JSON;
 import org.apache.commons.lang3.time.DateFormatUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
 
 /**
 /**
@@ -201,7 +199,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
     }
     }
 
 
     /***
     /***
-     * 获取当前月份的前后N月份的时间
+     * 获取当前月份的前后N月份的开始时间
      * @param dateStr 当前月份
      * @param dateStr 当前月份
      * @param addMonth n,负数为以前
      * @param addMonth n,负数为以前
      *
      *
@@ -219,7 +217,177 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         // 月第一天和最后一天
         // 月第一天和最后一天
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
         System.out.println(year+"-"+month);
         System.out.println(year+"-"+month);
-        return year+"-"+month+" 00:00:00";
+        return year+"-"+month;
+    }
+
+    /**
+     * 获取本周的第一天
+     *
+     * @return String
+     **/
+    public static String getThisWeekMonday() {
+        Calendar cal = Calendar.getInstance();
+        cal.add(Calendar.WEEK_OF_MONTH, 0);
+        cal.set(Calendar.DAY_OF_WEEK, 2);
+        Date time = cal.getTime();
+        return new SimpleDateFormat("yyyy-MM-dd").format(time) + " 00:00:00";
+    }
+
+    /**
+     * 获取本周的最后一天
+     *
+     * @return String
+     **/
+    public static String getThisWeekSunday() {
+        Calendar cal = Calendar.getInstance();
+        cal.set(Calendar.DAY_OF_WEEK, cal.getActualMaximum(Calendar.DAY_OF_WEEK));
+        cal.add(Calendar.DAY_OF_WEEK, 1);
+        Date time = cal.getTime();
+        return new SimpleDateFormat("yyyy-MM-dd").format(time) + " 23:59:59";
+    }
+    /**
+     * 获取上周的第一天
+     *
+     * @return
+     * @throws Exception
+     */
+    public static String getPreviousWeekMonday() {
+        int week = -1;
+        int mondayPlus = getMondayPlus();
+
+        GregorianCalendar currentDate = new GregorianCalendar();
+        currentDate.add(5, mondayPlus + 7 * week);
+        Date preMonday = currentDate.getTime();
+        return new SimpleDateFormat("yyyy-MM-dd").format(preMonday) + " 00:00:00";
+    }
+
+    /**
+     * 获取上周的最后一天
+     *
+     * @return
+     */
+    public static String getPreviousWeekSunday() {
+        int weeks = -1;
+        int mondayPlus = getMondayPlus();
+        GregorianCalendar currentDate = new GregorianCalendar();
+        currentDate.add(5, mondayPlus + weeks);
+        Date preSunday = currentDate.getTime();
+        return new SimpleDateFormat("yyyy-MM-dd").format(preSunday) + " 23:59:59";
+    }
+
+    public static int getMondayPlus() {
+        Calendar cd = Calendar.getInstance();
+        int dayOfWeek = cd.get(7) - 1;
+        if (dayOfWeek == 1) {
+            return 0;
+        }
+        return (1 - dayOfWeek);
+    }
+
+
+    /**
+     * 获取本季度的第一天
+     *
+     * @return
+     * @throws Exception
+     */
+    public static String getQuarterFirst() {
+        LocalDateTime now = LocalDateTime.now();
+        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+        LocalDate date = LocalDate.now();
+        LocalDate quarterStart = getStartOrEndDayOfQuarter(date, true);
+        return quarterStart.format(fmt);
     }
     }
 
 
+    /**
+     * 获取本季度的最后一天
+     *
+     * @return
+     * @throws Exception
+     */
+    public static String getQuarterEnd() {
+        LocalDateTime now = LocalDateTime.now();
+        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+        LocalDate date = LocalDate.now();
+        LocalDate quarterEnd = getStartOrEndDayOfQuarter(date, false);
+        return quarterEnd.format(fmt);
+    }
+
+
+    public static LocalDate getStartOrEndDayOfQuarter(LocalDate today, Boolean isFirst) {
+        LocalDate resDate = LocalDate.now();
+        if (today == null) {
+            today = resDate;
+        }
+        Month month = today.getMonth();
+        Month firstMonthOfQuarter = month.firstMonthOfQuarter();
+        Month endMonthOfQuarter = Month.of(firstMonthOfQuarter.getValue() + 2);
+        if (isFirst) {
+            resDate = LocalDate.of(today.getYear(), firstMonthOfQuarter, 1);
+        } else {
+            resDate = LocalDate.of(today.getYear(), endMonthOfQuarter, endMonthOfQuarter.length(today.isLeapYear()));
+        }
+        return resDate;
+    }
+
+
+
+    /**
+     * 判断时间是否在时间段内
+     * @param nowTime 判断时间
+     * @param startStr 开始时间
+     * @param endTStr 结束时间
+     * @return
+     * @throws ParseException
+     */
+    public static boolean isEffectiveDate(String nowTime, String startStr, String endTStr) throws ParseException {
+        // 将时间和范围的起止时间转换为Date对象
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date time = sdf.parse(nowTime);
+        Date startTime = sdf.parse(startStr);
+        Date endTime = sdf.parse(endTStr);
+
+        // 判断时间是否在范围内
+        boolean isInRange = time.after(startTime) && time.before(endTime);
+        return isInRange;
+    }
+
+    /**
+     * 获取指定时间 当前周的周一至周日的时间
+     * @return
+     */
+    public static List<String> getWeekData(String dataTime) throws ParseException {
+        /**
+         * 转为calendar格式
+         * calendar.get(Calendar.MONTH)+1  calendar中的月份以0开头
+         * Calendar.DAY_OF_WEEK 当前日期是所在周的第几天(以周日为一周的第一天)
+         * Calendar.DATE 当前日期是几号
+         *  */
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Date time = sdf.parse(dataTime);
+        List<String> week = new ArrayList<String>();
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(time);
+
+        // 如果是周日
+        if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
+            calendar.add(Calendar.DAY_OF_YEAR,-1);
+        }
+        // 获取当前日期是当周的第i天
+        int i = calendar.get(Calendar.DAY_OF_WEEK) - 1;
+
+        // 获取当前日期所在周的第一天
+        calendar.add(Calendar.DATE , -i+1);
+        for (int j = 0; j < 7; j++) {
+            if(j >0){
+                calendar.add(Calendar.DATE , 1);
+            }
+            week.add(new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime()));
+        }
+        return week;
+    }
+
+
 }
 }

+ 20 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/ProposalInfo.java

@@ -182,6 +182,26 @@ public class ProposalInfo extends BaseEntity
     /** 单位类型 */
     /** 单位类型 */
     private String dwType;
     private String dwType;
 
 
+
+    private String endTime;
+    private String startTime;
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
     public String getBackReason() {
     public String getBackReason() {
         return backReason;
         return backReason;
     }
     }

+ 19 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/sqmy/SqmyInfo.java

@@ -148,6 +148,25 @@ public class SqmyInfo extends BaseEntity
     /** 单位类型 */
     /** 单位类型 */
     private String dwType;
     private String dwType;
 
 
+    private String endTime;
+    private String startTime;
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
     public String getBackReason() {
     public String getBackReason() {
         return backReason;
         return backReason;
     }
     }

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IStatisticsService.java

@@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.system.domain.member.MemberInfo;
 import com.ruoyi.system.domain.member.MemberInfo;
 
 
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
+import java.text.ParseException;
 
 
 /**
 /**
  * @Author: tjf
  * @Author: tjf
@@ -17,4 +18,13 @@ public interface IStatisticsService {
      */
      */
     AjaxResult boundary();
     AjaxResult boundary();
     void exportForm(HttpServletResponse response, MemberInfo memberInfo);
     void exportForm(HttpServletResponse response, MemberInfo memberInfo);
+
+    /**
+     * pc首页(近三月委员提案数)
+     */
+    AjaxResult threeData() throws ParseException;
+
+    AjaxResult weekData() throws ParseException;
+
+    AjaxResult quarterData();
 }
 }

+ 298 - 11
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StatisticsServiceImpl.java

@@ -7,16 +7,28 @@ import com.itextpdf.text.PageSize;
 import com.itextpdf.text.Paragraph;
 import com.itextpdf.text.Paragraph;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysDictData;
 import com.ruoyi.common.core.domain.entity.SysDictData;
+import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.PDFUtil;
 import com.ruoyi.common.utils.PDFUtil;
+import com.ruoyi.system.domain.ProposalInfo;
 import com.ruoyi.system.domain.member.MemberInfo;
 import com.ruoyi.system.domain.member.MemberInfo;
+import com.ruoyi.system.domain.sqmy.SqmyInfo;
 import com.ruoyi.system.domain.vo.MemberInfoVoTwo;
 import com.ruoyi.system.domain.vo.MemberInfoVoTwo;
 import com.ruoyi.system.mapper.MemberInfoMapper;
 import com.ruoyi.system.mapper.MemberInfoMapper;
+import com.ruoyi.system.mapper.ProposalInfoMapper;
+import com.ruoyi.system.mapper.SqmyInfoMapper;
 import com.ruoyi.system.mapper.SysDictDataMapper;
 import com.ruoyi.system.mapper.SysDictDataMapper;
 import com.ruoyi.system.service.IStatisticsService;
 import com.ruoyi.system.service.IStatisticsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
@@ -34,6 +46,12 @@ public class StatisticsServiceImpl implements IStatisticsService {
     @Autowired
     @Autowired
     private SysDictDataMapper dictDataMapper;
     private SysDictDataMapper dictDataMapper;
 
 
+    @Autowired
+    private ProposalInfoMapper proposalInfoMapper;
+
+    @Autowired
+    private SqmyInfoMapper sqmyInfoMapper;
+
     /**
     /**
      * 统计查询委员图形分析 界别
      * 统计查询委员图形分析 界别
      */
      */
@@ -57,28 +75,28 @@ public class StatisticsServiceImpl implements IStatisticsService {
                     memberInfoVoTwo.setSort(sysDictData.getDictSort());
                     memberInfoVoTwo.setSort(sysDictData.getDictSort());
                     String dictLabel = sysDictData.getDictLabel();
                     String dictLabel = sysDictData.getDictLabel();
                     String dictValue = sysDictData.getDictValue();
                     String dictValue = sysDictData.getDictValue();
-                    jsonObj.put("name",dictLabel);
+                    jsonObj.put("name", dictLabel);
                     memberInfoVoTwo.setBoundary(dictLabel);
                     memberInfoVoTwo.setBoundary(dictLabel);
                     //柱状图
                     //柱状图
                     dictLabelList.add(dictLabel);
                     dictLabelList.add(dictLabel);
                     List<MemberInfo> memberInfoListV = memberInfoCollect.get(dictValue);
                     List<MemberInfo> memberInfoListV = memberInfoCollect.get(dictValue);
                     //如果没这个界别就输入0
                     //如果没这个界别就输入0
-                    if (memberInfoListV != null && memberInfoListV.size() > 0){
+                    if (memberInfoListV != null && memberInfoListV.size() > 0) {
                         dictValueList.add(memberInfoListV.size());
                         dictValueList.add(memberInfoListV.size());
                         memberInfoVoTwo.setNum(memberInfoListV.size());
                         memberInfoVoTwo.setNum(memberInfoListV.size());
-                        jsonObj.put("value",memberInfoListV.size());
+                        jsonObj.put("value", memberInfoListV.size());
 
 
-                    }else {
+                    } else {
                         dictValueList.add(0);
                         dictValueList.add(0);
                         memberInfoVoTwo.setNum(0);
                         memberInfoVoTwo.setNum(0);
-                        jsonObj.put("value",0);
+                        jsonObj.put("value", 0);
                     }
                     }
                     memberInfoVoTwoList.add(memberInfoVoTwo);
                     memberInfoVoTwoList.add(memberInfoVoTwo);
                     jsonObjsList.add(jsonObj);
                     jsonObjsList.add(jsonObj);
                 }
                 }
-                mapZ.put("x",dictLabelList );
-                mapZ.put("y",dictValueList );
-                mapZ.put("pieData",jsonObjsList );
+                mapZ.put("x", dictLabelList);
+                mapZ.put("y", dictValueList);
+                mapZ.put("pieData", jsonObjsList);
                 mapZ.put("total", memberInfoList.size());
                 mapZ.put("total", memberInfoList.size());
                 mapZ.put("list", memberInfoVoTwoList);
                 mapZ.put("list", memberInfoVoTwoList);
             }
             }
@@ -88,6 +106,7 @@ public class StatisticsServiceImpl implements IStatisticsService {
 
 
     /**
     /**
      * 导出pdf
      * 导出pdf
+     *
      * @param response
      * @param response
      */
      */
     @Override
     @Override
@@ -117,9 +136,9 @@ public class StatisticsServiceImpl implements IStatisticsService {
                     memberInfoVoTwo.setBoundary(dictLabel);
                     memberInfoVoTwo.setBoundary(dictLabel);
                     List<MemberInfo> memberInfoListV = memberInfoCollect.get(dictValue);
                     List<MemberInfo> memberInfoListV = memberInfoCollect.get(dictValue);
                     //如果没这个界别就输入0
                     //如果没这个界别就输入0
-                    if (memberInfoListV != null && memberInfoListV.size() > 0){
+                    if (memberInfoListV != null && memberInfoListV.size() > 0) {
                         memberInfoVoTwo.setNum(memberInfoListV.size());
                         memberInfoVoTwo.setNum(memberInfoListV.size());
-                    }else {
+                    } else {
                         memberInfoVoTwo.setNum(0);
                         memberInfoVoTwo.setNum(0);
                     }
                     }
                     memberInfoVoTwoList.add(memberInfoVoTwo);
                     memberInfoVoTwoList.add(memberInfoVoTwo);
@@ -131,7 +150,7 @@ public class StatisticsServiceImpl implements IStatisticsService {
         methodNames.add("getBoundary");
         methodNames.add("getBoundary");
         methodNames.add("getNum");
         methodNames.add("getNum");
         // 生成table表格段落
         // 生成table表格段落
-        Paragraph table = PDFUtil.createTable(memberInfoVoTwoList, "界别统计表", new String[]{"序号","界别","人数"},methodNames );
+        Paragraph table = PDFUtil.createTable(memberInfoVoTwoList, "界别统计表", new String[]{"序号", "界别", "人数"}, methodNames);
 
 
         // 将所有需要放到文档里的元素,汇总
         // 将所有需要放到文档里的元素,汇总
         List<Paragraph> paragraphs = new ArrayList<Paragraph>();
         List<Paragraph> paragraphs = new ArrayList<Paragraph>();
@@ -141,4 +160,272 @@ public class StatisticsServiceImpl implements IStatisticsService {
         // 导出pdf文档:将paragraphs塞到document中,并下载document
         // 导出pdf文档:将paragraphs塞到document中,并下载document
         PDFUtil.exportDocument(document, null, paragraphs, response, "报表");
         PDFUtil.exportDocument(document, null, paragraphs, response, "报表");
     }
     }
+
+    @Override
+    public AjaxResult threeData() throws ParseException {
+        Map<String, Object> map = new HashMap<>();
+        //获取当前时间
+        String endTime = DateUtils.getTime();
+        //获取三个月前的时间
+        String strTime = DateUtils.lastMouth(DateUtils.getMonth(), -2) + "-01" + " 00:00:00";
+        //查询近三月提案数
+        ProposalInfo proposalInfo = new ProposalInfo();
+        proposalInfo.setStartTime(strTime);
+        proposalInfo.setEndTime(endTime);
+        List<ProposalInfo> proposalInfos = proposalInfoMapper.selectProposalInfoList(proposalInfo);
+        Map<String, Object> threeTaMap = new HashMap<>();
+        threeTaMap.put("time", strTime.split(" ")[0] + "-" + endTime.split(" ")[0]);
+        threeTaMap.put("threeTa", 0);
+        if (proposalInfos != null) {
+            threeTaMap.put("threeTa", proposalInfos.size());
+        }
+        map.put("threeTaMap", threeTaMap);
+
+
+        //查询近三月社情民意数
+        SqmyInfo sqmyInfo = new SqmyInfo();
+        sqmyInfo.setStartTime(strTime);
+        sqmyInfo.setEndTime(endTime);
+        List<SqmyInfo> sqmyInfos = sqmyInfoMapper.selectSqmyInfoList(sqmyInfo);
+        Map<String, Object> threeSqmyMap = new HashMap<>();
+        threeSqmyMap.put("time", strTime.split(" ")[0] + "-" + endTime.split(" ")[0]);
+        threeSqmyMap.put("threesqmy", 0);
+        if (sqmyInfos != null) {
+            threeSqmyMap.put("threesqmy", sqmyInfos.size());
+        }
+        map.put("threeSqmyMap", threeSqmyMap);
+
+
+        //较上周委员提案
+        //获取上周第一天
+        String previousWeekMonday = DateUtils.getPreviousWeekMonday();
+        //获取上周最一天
+        String previousWeekSunday = DateUtils.getPreviousWeekSunday();
+        //上周数量
+        int lastWeek = 0;
+        //本周第一天
+        String thisWeekMonday = DateUtils.getThisWeekMonday();
+        //本周数量
+        int week = 0;
+        Map<String, Object> taMap = new HashMap<>();
+        //0:正,1:负
+        taMap.put("symbol", 0);
+        taMap.put("percent", "0%");
+        if (proposalInfos != null && proposalInfos.size() > 0) {
+            for (ProposalInfo info : proposalInfos) {
+                if (DateUtils.isEffectiveDate(String.valueOf(info.getCreateTime()), previousWeekMonday, previousWeekSunday)) {
+                    lastWeek++;
+                } else if (DateUtils.isEffectiveDate(String.valueOf(info.getCreateTime()), thisWeekMonday, endTime)) {
+                    week++;
+                }
+            }
+        }
+        if (lastWeek > week) {
+            taMap.put("symbol", 1);
+        }
+        BigDecimal num1 = new BigDecimal(lastWeek);
+        BigDecimal num2 = new BigDecimal(week);
+        BigDecimal subNum1 = num2.subtract(num1);
+        //subNum1/num1
+        double result = Double.parseDouble(((subNum1.divide(num1, 2, BigDecimal.ROUND_HALF_UP))).toString());
+        if (result < 0) {
+            result = result * -1;
+        }
+        DecimalFormat decimalFormat = new DecimalFormat("0%"); // 创建DecimalFormat对象并设置格式化模式为"0%"
+        String percentage = decimalFormat.format((result)); // 使用DecimalFormat对象进行格式化操作
+        taMap.put("percent", percentage);
+        map.put("taMap", taMap);
+
+        //较上月上报社情民意
+        //上一个月开始时间
+        String lastStartMonth = DateUtils.lastMouth(DateUtils.getMonth(), -1) + "-01" + " 00:00:00";
+        //上一个月结束时间
+        String lastEndtMonth = DateUtils.lastMouth(DateUtils.getMonth(), -1) + "-31" + " 23:59:59";
+        //上月数量
+        int lastMonth = 0;
+        //本月开始时间
+        String startMonth = DateUtils.lastMouth(DateUtils.getMonth(), 0) + "-01" + " 00:00:00";
+        //本月数量
+        int month = 0;
+        Map<String, Object> sqmyMap = new HashMap<>();
+        //0:正,1:负
+        sqmyMap.put("symbol", 0);
+        sqmyMap.put("percent", "0%");
+        if (sqmyInfos != null && sqmyInfos.size() > 0) {
+            for (SqmyInfo info : sqmyInfos) {
+                if (DateUtils.isEffectiveDate(String.valueOf(info.getCreateTime()), lastStartMonth, lastEndtMonth)) {
+                    lastMonth++;
+                } else if (DateUtils.isEffectiveDate(String.valueOf(info.getCreateTime()), startMonth, endTime)) {
+                    month++;
+                }
+            }
+        }
+        BigDecimal monthNum1 = new BigDecimal(lastMonth);
+        BigDecimal monthNum2 = new BigDecimal(month);
+        BigDecimal monthsubNum1 = monthNum2.subtract(monthNum1);
+        //subNum1/num1
+        double resultMonth = Double.parseDouble(((monthsubNum1.divide(monthNum1, 2, BigDecimal.ROUND_HALF_UP))).toString());
+        if (resultMonth < 0) {
+            resultMonth = resultMonth * -1;
+        }
+        taMap.put("percent", decimalFormat.format((resultMonth)));
+        map.put("sqmyMap", sqmyMap);
+        return AjaxResult.success(map);
+    }
+
+    @Override
+    public AjaxResult weekData() throws ParseException {
+        Map<String, Object> map = new HashMap<>();
+        //获取当前时间
+        String endTime = DateUtils.getTime();
+        //本周第一天
+        String strTime = DateUtils.getThisWeekMonday();
+        //获取本周的所有日期
+        List<String> weekList = DateUtils.getWeekData(DateUtils.getDate());
+        map.put("week", weekList);
+        //查询本周提案数
+        ProposalInfo proposalInfo = new ProposalInfo();
+        proposalInfo.setStartTime(strTime);
+        proposalInfo.setEndTime(endTime);
+        List<ProposalInfo> proposalInfos = proposalInfoMapper.selectProposalInfoList(proposalInfo);
+        List<Integer> taInt = new ArrayList<>();
+        Boolean tbl = proposalInfos != null && proposalInfos.size() > 0;
+        for (int i = 0; i < weekList.size(); i++) {
+            int num = 0;
+            if (tbl) {
+                for (ProposalInfo info : proposalInfos) {
+                    if (String.valueOf(info.getCreateTime()).contains(weekList.get(i))) {
+                        num++;
+                    }
+                }
+            }
+            taInt.add(num);
+        }
+        map.put("taInt", taInt);
+        //查询本周社情民意数
+        SqmyInfo sqmyInfo = new SqmyInfo();
+        sqmyInfo.setStartTime(strTime);
+        sqmyInfo.setEndTime(endTime);
+        List<SqmyInfo> sqmyInfos = sqmyInfoMapper.selectSqmyInfoList(sqmyInfo);
+        List<Integer> sqmyInt = new ArrayList<>();
+        Boolean sbl = sqmyInfos != null && sqmyInfos.size() > 0;
+        for (int i = 0; i < weekList.size(); i++) {
+            int num = 0;
+            if (sbl) {
+                for (SqmyInfo info : sqmyInfos) {
+                    if (String.valueOf(info.getCreateTime()).contains(weekList.get(i))) {
+                        num++;
+                    }
+                }
+            }
+            sqmyInt.add(num);
+        }
+        map.put("sqmyInt", sqmyInt);
+        return AjaxResult.success(map);
+    }
+
+    @Override
+    public AjaxResult quarterData() {
+        Map<String, Object> map = new HashMap<>();
+        //获取当前时间
+        String endTime = DateUtils.getTime();
+        //本季度第一天
+        String strTime = DateUtils.getQuarterFirst() + " 00:00:00";
+        //查询本周提案数
+        ProposalInfo proposalInfo = new ProposalInfo();
+        proposalInfo.setStartTime(strTime);
+        proposalInfo.setEndTime(endTime);
+        List<ProposalInfo> proposalInfos = proposalInfoMapper.selectProposalInfoList(proposalInfo);
+        //已立案
+        int yla = 0;
+        Map<String, Object> ylaMap = new HashMap<>();
+        ylaMap.put("percent", "0%");
+        ylaMap.put("name", "已立案");
+        ylaMap.put("num", yla);
+
+        //未立案
+        int wla = 0;
+        Map<String, Object> wlaMap = new HashMap<>();
+        wlaMap.put("percent", "0%");
+        wlaMap.put("name", "已立案");
+        wlaMap.put("num", wla);
+
+        //已办结
+        int ybj = 0;
+        Map<String, Object> ybjMap = new HashMap<>();
+        ybjMap.put("percent", "0%");
+        ybjMap.put("name", "已立案");
+        ybjMap.put("num", ybj);
+
+        //未办结
+        int wbj = 0;
+        Map<String, Object> wbjMap = new HashMap<>();
+        wbjMap.put("percent", "0%");
+        wbjMap.put("name", "已立案");
+        wbjMap.put("num", wbj);
+
+        //待办理
+        int dbl = 0;
+        Map<String, Object> dblMap = new HashMap<>();
+        dblMap.put("percent", "0%");
+        dblMap.put("name", "已立案");
+        dblMap.put("num", dbl);
+        if (proposalInfos!=null && proposalInfos.size()>0) {
+            for (ProposalInfo info : proposalInfos) {
+                if (Integer.parseInt(info.getProposalProgress()) >= 2 && !"3".equals(info.getProposalProgress())) {
+                    yla++;
+                    if ("8".equals(info.getProposalProgress())) {
+                        ybj++;
+                    } else {
+                        wbj++;
+                    }
+                }
+                if ("3".equals(info.getProposalProgress())) {
+                    wla++;
+                }
+                if ("0".equals(info.getProposalProgress()) || "1".equals(info.getProposalProgress())) {
+                    dbl++;
+                }
+            }
+
+            BigDecimal num1 = new BigDecimal(proposalInfos.size());
+            DecimalFormat decimalFormat = new DecimalFormat("0%"); // 创建DecimalFormat对象并设置格式化模式为"0%"
+
+            //已立案
+            BigDecimal num2 = new BigDecimal(yla);
+            //num2/num1
+            double ylaResult = Double.parseDouble(((num2.divide(num1, 2, BigDecimal.ROUND_HALF_UP))).toString());
+            ylaMap.put("percent", decimalFormat.format((ylaResult)));
+
+            //未立案
+            BigDecimal num3 = new BigDecimal(wla);
+            //num2/num1
+            double wlaResult = Double.parseDouble(((num3.divide(num1, 2, BigDecimal.ROUND_HALF_UP))).toString());
+            wlaMap.put("percent", decimalFormat.format((wlaResult)));
+
+            //已办结
+            BigDecimal num4 = new BigDecimal(ybj);
+            //num2/num1
+            double ybjResult = Double.parseDouble(((num3.divide(num4, 2, BigDecimal.ROUND_HALF_UP))).toString());
+            ybjMap.put("percent", decimalFormat.format((ybjResult)));
+
+            //未办结
+            BigDecimal num5 = new BigDecimal(wbj);
+            //num2/num1
+            double wbjResult = Double.parseDouble(((num3.divide(num5, 2, BigDecimal.ROUND_HALF_UP))).toString());
+            wbjMap.put("percent", decimalFormat.format((wbjResult)));
+
+            //待办理
+            BigDecimal num6 = new BigDecimal(dbl);
+            //num2/num1
+            double dblResult = Double.parseDouble(((num3.divide(num6, 2, BigDecimal.ROUND_HALF_UP))).toString());
+            dblMap.put("percent", decimalFormat.format((dblResult)));
+        }
+        map.put("ylaMap",ylaMap);
+        map.put("wlaMap",wlaMap);
+        map.put("ybjMap",ybjMap);
+        map.put("wbjMap",wbjMap);
+        map.put("dblMap",dblMap);
+        return AjaxResult.success(map);
+    }
 }
 }

+ 7 - 0
ruoyi-system/src/main/resources/mapper/system/ProposalInfoMapper.xml

@@ -101,7 +101,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="keyPointArgument != null  and keyPointArgument != ''"> and key_point_argument = #{keyPointArgument}</if>
             <if test="keyPointArgument != null  and keyPointArgument != ''"> and key_point_argument = #{keyPointArgument}</if>
             <if test="isOutstanding != null  and isOutstanding != ''"> and is_outstanding = #{isOutstanding}</if>
             <if test="isOutstanding != null  and isOutstanding != ''"> and is_outstanding = #{isOutstanding}</if>
             <if test="outstandingArgument != null  and outstandingArgument != ''"> and outstanding_argument = #{outstandingArgument}</if>
             <if test="outstandingArgument != null  and outstandingArgument != ''"> and outstanding_argument = #{outstandingArgument}</if>
+            <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
+                AND date_format(create_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
+            </if>
+            <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
+                AND date_format(create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
+            </if>
         </where>
         </where>
+        order by create_time desc
     </select>
     </select>
     
     
     <select id="selectProposalInfoByProposalId" parameterType="Long" resultMap="ProposalInfoResult">
     <select id="selectProposalInfoByProposalId" parameterType="Long" resultMap="ProposalInfoResult">

+ 6 - 0
ruoyi-system/src/main/resources/mapper/system/SqmyInfoMapper.xml

@@ -78,6 +78,12 @@
             <if test="keyPointArgument != null  and keyPointArgument != ''"> and key_point_argument = #{keyPointArgument}</if>
             <if test="keyPointArgument != null  and keyPointArgument != ''"> and key_point_argument = #{keyPointArgument}</if>
             <if test="isOutstanding != null  and isOutstanding != ''"> and is_outstanding = #{isOutstanding}</if>
             <if test="isOutstanding != null  and isOutstanding != ''"> and is_outstanding = #{isOutstanding}</if>
             <if test="outstandingArgument != null  and outstandingArgument != ''"> and outstanding_argument = #{outstandingArgument}</if>
             <if test="outstandingArgument != null  and outstandingArgument != ''"> and outstanding_argument = #{outstandingArgument}</if>
+            <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
+                AND date_format(create_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
+            </if>
+            <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
+                AND date_format(create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
+            </if>
         </where>
         </where>
         order by update_time desc
         order by update_time desc
     </select>
     </select>