Browse Source

Merge remote-tracking branch 'origin/master'

main
sjh 1 year ago
parent
commit
1848a4e5f3
  1. 34
      src/main/java/com/biutag/supervision/controller/datav/DataPetitionComplaintViewController.java
  2. 18
      src/main/java/com/biutag/supervision/mapper/DataPetitionComplaintMapper.java
  3. 2
      src/main/java/com/biutag/supervision/pojo/vo/RecentMailTrendByDayVo.java
  4. 9
      src/main/java/com/biutag/supervision/pojo/vo/RecentMailTrendByMonthVo.java
  5. 16
      src/main/java/com/biutag/supervision/service/DataPetitionComplaintService.java

34
src/main/java/com/biutag/supervision/controller/datav/DataPetitionComplaintViewController.java

@ -6,12 +6,12 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.biutag.supervision.constants.enums.DepartGroupEnum;
import com.biutag.supervision.constants.enums.RepeatEnum;
import com.biutag.supervision.mapper.DataCaseVerifMapper;
import com.biutag.supervision.mapper.DataPetitionComplaintMapper;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.dto.CaseVerifDepart;
import com.biutag.supervision.pojo.entity.DataPetitionComplaint;
import com.biutag.supervision.pojo.vo.RecentMailTrendVo;
import com.biutag.supervision.pojo.vo.RecentMailTrendByDayVo;
import com.biutag.supervision.pojo.vo.RecentMailTrendByMonthVo;
import com.biutag.supervision.service.DataPetitionComplaintService;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
@ -80,20 +80,20 @@ public class DataPetitionComplaintViewController {
/**
* 信访数据大屏信访趋势统计
*/
@GetMapping("/getRecentlyMailTrend")
public Result<JSONObject> getRecentlyMailTrend(@RequestParam Integer sourcesCode,
@GetMapping("/getRecentlyMailTrendByDay")
public Result<JSONObject> getRecentlyMailTrendByDay(@RequestParam Integer sourcesCode,
@RequestParam Integer days,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime
) {
JSONObject jsonObject = new JSONObject();
// 库中的数据 2024/10/24 22
List<RecentMailTrendVo> recentMailTrendVoList = dataPetitionComplaintService.getRecentlyMailTrend(sourcesCode, days, endTime);
List<RecentMailTrendByDayVo> recentMailTrendVoList = dataPetitionComplaintService.getRecentlyMailTrendByDay(sourcesCode, days, endTime);
ArrayList<String> dayList = new ArrayList<>();
ArrayList<String> totalList = new ArrayList<>();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
LocalDate previousDate = null;
for (RecentMailTrendVo recentMailTrendVo : recentMailTrendVoList) {
for (RecentMailTrendByDayVo recentMailTrendVo : recentMailTrendVoList) {
// 获取当前日期
LocalDate currentDate = LocalDate.parse(recentMailTrendVo.getDayTime(), formatter);
if (previousDate != null) {
@ -115,4 +115,26 @@ public class DataPetitionComplaintViewController {
}
@GetMapping("/getRecentlyMailTrendMonth")
public Result<JSONObject> getRecentlyMailTrendByMonth(@RequestParam Integer sourcesCode,
@RequestParam Integer year
) {
JSONObject jsonObject = new JSONObject();
List<RecentMailTrendByMonthVo> recentMailTrendVoList = dataPetitionComplaintService.getRecentlyMailTrendByMonth(sourcesCode, String.valueOf(year));
ArrayList<String> monthList = new ArrayList<>();
ArrayList<String> totalList = new ArrayList<>();
for (RecentMailTrendByMonthVo recentMailTrendByMonthVo : recentMailTrendVoList) {
monthList.add(recentMailTrendByMonthVo.getMonthTime().substring(recentMailTrendByMonthVo.getMonthTime().indexOf("-")+1));
totalList.add(recentMailTrendByMonthVo.getTotal());
}
jsonObject.fluentPut("monthList", monthList);
jsonObject.fluentPut("totalList", totalList);
return Result.success(jsonObject);
}
}

18
src/main/java/com/biutag/supervision/mapper/DataPetitionComplaintMapper.java

@ -3,7 +3,8 @@ package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.supervision.pojo.dto.CaseVerifDepart;
import com.biutag.supervision.pojo.entity.DataPetitionComplaint;
import com.biutag.supervision.pojo.vo.RecentMailTrendVo;
import com.biutag.supervision.pojo.vo.RecentMailTrendByDayVo;
import com.biutag.supervision.pojo.vo.RecentMailTrendByMonthVo;
import org.apache.ibatis.annotations.Select;
import java.util.Date;
@ -79,6 +80,19 @@ public interface DataPetitionComplaintMapper extends BaseMapper<DataPetitionComp
"AND problem_sources_code = #{sourcesCode} " +
"GROUP BY dayTime " +
"ORDER BY dpc.discovery_time asc;")
List<RecentMailTrendVo> selectRecentlyMailTrend(Integer sourcesCode, String frontDay, String currentDay);
List<RecentMailTrendByDayVo> selectRecentlyMailTrendByDay(Integer sourcesCode, String frontDay, String currentDay);
@Select("SELECT DATE_FORMAT(dpc.discovery_time, '%Y-%m') AS monthTime, COUNT(*) total " +
"FROM data_petition_complaint dpc " +
"WHERE YEAR(dpc.discovery_time) = #{year} " +
"AND problem_sources_code = #{sourcesCode} " +
"GROUP BY monthTime " +
"ORDER BY monthTime asc;")
List<RecentMailTrendByMonthVo> selectRecentlyMailTrendByMonth(Integer sourcesCode, String year);
}

2
src/main/java/com/biutag/supervision/pojo/vo/RecentMailTrendVo.java → src/main/java/com/biutag/supervision/pojo/vo/RecentMailTrendByDayVo.java

@ -5,7 +5,7 @@ import lombok.Data;
import java.util.List;
@Data
public class RecentMailTrendVo {
public class RecentMailTrendByDayVo {
private String dayTime; // 10/01
private String total; // 10
}

9
src/main/java/com/biutag/supervision/pojo/vo/RecentMailTrendByMonthVo.java

@ -0,0 +1,9 @@
package com.biutag.supervision.pojo.vo;
import lombok.Data;
@Data
public class RecentMailTrendByMonthVo {
private String MonthTime; // 24/01
private String total; // 10
}

16
src/main/java/com/biutag/supervision/service/DataPetitionComplaintService.java

@ -13,9 +13,9 @@ import com.biutag.supervision.mapper.DataPetitionComplaintMapper;
import com.biutag.supervision.pojo.dto.*;
import com.biutag.supervision.pojo.entity.DataPetitionComplaint;
import com.biutag.supervision.pojo.param.DataPetitionComplaintQueryParam;
import com.biutag.supervision.pojo.vo.RecentMailTrendVo;
import com.biutag.supervision.pojo.vo.RecentMailTrendByDayVo;
import com.biutag.supervision.pojo.vo.RecentMailTrendByMonthVo;
import lombok.RequiredArgsConstructor;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -206,15 +206,21 @@ public class DataPetitionComplaintService extends ServiceImpl<DataPetitionCompla
}
public List<RecentMailTrendVo> getRecentlyMailTrend(Integer sourcesCode, Integer days, Date endTime) {
public List<RecentMailTrendByDayVo> getRecentlyMailTrendByDay(Integer sourcesCode, Integer days, Date endTime) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
// 将 endTime 转换为 LocalDate
LocalDate endLocalDate = endTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
String currentDay = endLocalDate.format(formatter); // 前端页面的最后查询日期
LocalDate frontDateDay = endLocalDate.minusDays(days); // days天前
String frontDay = frontDateDay.format(formatter);
List<RecentMailTrendVo> recentMailTrendVos =
dataPetitionComplaintMapper.selectRecentlyMailTrend(MailTrendSourcesEnum.getMappedCodeByCode(sourcesCode), frontDay, currentDay);
List<RecentMailTrendByDayVo> recentMailTrendVos =
dataPetitionComplaintMapper.selectRecentlyMailTrendByDay(MailTrendSourcesEnum.getMappedCodeByCode(sourcesCode), frontDay, currentDay);
return recentMailTrendVos;
}
public List<RecentMailTrendByMonthVo> getRecentlyMailTrendByMonth(Integer sourcesCode, String year) {
List<RecentMailTrendByMonthVo> recentMailTrendVos =
dataPetitionComplaintMapper.selectRecentlyMailTrendByMonth(MailTrendSourcesEnum.getMappedCodeByCode(sourcesCode), year);
return recentMailTrendVos;
}
}

Loading…
Cancel
Save