Browse Source

Merge remote-tracking branch 'origin/master'

main
sjh 1 year ago
parent
commit
c9b2d46b14
  1. 25
      src/main/java/com/biutag/supervision/constants/enums/MailTrendSourcesEnum.java
  2. 21
      src/main/java/com/biutag/supervision/constants/enums/PersonTypeEnum.java
  3. 4
      src/main/java/com/biutag/supervision/controller/StatisticsController.java
  4. 47
      src/main/java/com/biutag/supervision/controller/datav/DataPetitionComplaintViewController.java
  5. 71
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java
  6. 10
      src/main/java/com/biutag/supervision/mapper/DataPetitionComplaintMapper.java
  7. 19
      src/main/java/com/biutag/supervision/mapper/ProfileDepartMapper.java
  8. 52
      src/main/java/com/biutag/supervision/pojo/domain/ProfileDepart.java
  9. 27
      src/main/java/com/biutag/supervision/pojo/model/DepartNegativeModel.java
  10. 23
      src/main/java/com/biutag/supervision/pojo/param/DepartNegativeQueryParam.java
  11. 2
      src/main/java/com/biutag/supervision/pojo/param/NegativeQueryParam.java
  12. 5
      src/main/java/com/biutag/supervision/pojo/vo/DictContentTree.java
  13. 11
      src/main/java/com/biutag/supervision/pojo/vo/RecentMailTrendVo.java
  14. 16
      src/main/java/com/biutag/supervision/service/DataPetitionComplaintService.java
  15. 1
      src/main/java/com/biutag/supervision/service/NegativeQueryService.java
  16. 43
      src/main/resources/mapper/ProfileDepartMapper.xml
  17. BIN
      src/main/resources/static/templates/长沙公安数字督察灵敏感知体系问题赋分及风险预警机制.pdf

25
src/main/java/com/biutag/supervision/constants/enums/MailTrendSourcesEnum.java

@ -0,0 +1,25 @@
package com.biutag.supervision.constants.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum MailTrendSourcesEnum {
ONE(1, 21),
TWO(2, 22),
THREE(3, 23),
FOUR(4, 24);
private final int code; // 前端传来的code
private final int mappedCode; // 后端需要用到的code
public static int getMappedCodeByCode(int code) {
for (MailTrendSourcesEnum value : MailTrendSourcesEnum.values()) {
if (value.code == code) {
return value.getMappedCode();
}
}
throw new IllegalArgumentException("Invalid sourcesCode: " + code);
}
}

21
src/main/java/com/biutag/supervision/constants/enums/PersonTypeEnum.java

@ -0,0 +1,21 @@
package com.biutag.supervision.constants.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author wxc
* @date 2024/11/1
*/
@Getter
@AllArgsConstructor
public enum PersonTypeEnum {
police("1", "民警"),
works("2", "职工"),
aux("3", "辅警"),
clerk("4", "文员"),
xj("5", "协警");
private String value;
private String label;
}

4
src/main/java/com/biutag/supervision/controller/StatisticsController.java

@ -48,7 +48,7 @@ public class StatisticsController {
}
boolean nonAdminAuth = !AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) && !user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode());
long signCount = negativeService.count(new LambdaUpdateWrapper<Negative>()
.in(Negative::getFlowKey, FlowNodeEnum.getSignFlowKeys())
.eq(Negative::getProcessingStatus, ProcessingStatusEnum.signing.name())
.in(!user.getAuthSources().isEmpty(), Negative::getProblemSourcesCode, user.getAuthSources())
.and(nonAdminAuth, query -> {
query.in(Negative::getHandleSecondDepartId, user.getAuthDepartIds()).or()
@ -56,7 +56,7 @@ public class StatisticsController {
})
);
long verifyCount = negativeService.count(new LambdaUpdateWrapper<Negative>()
.eq(Negative::getFlowKey, FlowNodeEnum.VERIFY.getKey())
.eq(Negative::getProcessingStatus, ProcessingStatusEnum.processing.name())
.in(!user.getAuthSources().isEmpty(), Negative::getProblemSourcesCode, user.getAuthSources())
.and(nonAdminAuth, query -> {
query.in(Negative::getHandleSecondDepartId, user.getAuthDepartIds()).or()

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

@ -11,15 +11,17 @@ 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.service.DataPetitionComplaintService;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -75,5 +77,42 @@ public class DataPetitionComplaintViewController {
return Result.success(data);
}
/**
* 信访数据大屏信访趋势统计
*/
@GetMapping("/getRecentlyMailTrend")
public Result<JSONObject> getRecentlyMailTrend(@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);
ArrayList<String> dayList = new ArrayList<>();
ArrayList<String> totalList = new ArrayList<>();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
LocalDate previousDate = null;
for (RecentMailTrendVo recentMailTrendVo : recentMailTrendVoList) {
// 获取当前日期
LocalDate currentDate = LocalDate.parse(recentMailTrendVo.getDayTime(), formatter);
if (previousDate != null) {
while (ChronoUnit.DAYS.between(previousDate, currentDate) > 1) {
previousDate = previousDate.plusDays(1); // 日期加1
String res = previousDate.format(formatter); // 格式化日期
dayList.add(res.substring(res.indexOf('/') + 1)); // 添加到dayList
totalList.add("0"); // 插入没有数据的日期,总数为0
}
}
String res = currentDate.format(formatter);
dayList.add(res.substring(res.indexOf('/') + 1));
totalList.add(recentMailTrendVo.getTotal());
previousDate = currentDate;
}
jsonObject.fluentPut("dayList", dayList);
jsonObject.fluentPut("totalList", totalList);
return Result.success(jsonObject);
}
}

71
src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java

@ -1,12 +1,81 @@
package com.biutag.supervision.controller.sensitivePerception;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.constants.enums.InspectCaseEnum;
import com.biutag.supervision.constants.enums.PersonTypeEnum;
import com.biutag.supervision.mapper.ProfileDepartMapper;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.domain.ProfileDepart;
import com.biutag.supervision.pojo.entity.Negative;
import com.biutag.supervision.pojo.entity.NegativeBlame;
import com.biutag.supervision.pojo.entity.SupDepart;
import com.biutag.supervision.pojo.entity.SupPolice;
import com.biutag.supervision.pojo.model.DepartNegativeModel;
import com.biutag.supervision.pojo.param.DepartNegativeQueryParam;
import com.biutag.supervision.service.NegativeBlameService;
import com.biutag.supervision.service.NegativeService;
import com.biutag.supervision.service.SupDepartService;
import com.biutag.supervision.service.SupPoliceService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* 单位/个人画像
* @author wxc
* @date 2024/10/31
*/
@RestController("profile/depart")
@RequiredArgsConstructor
@RequestMapping("profile/depart")
@RestController
public class ProfileDepartController {
private final ProfileDepartMapper profileDepartMapper;
private final SupDepartService departService;
private final SupPoliceService policeService;
private final NegativeService negativeService;
private final NegativeBlameService blameService;
@GetMapping
public Result<Page<DepartNegativeModel>> list(DepartNegativeQueryParam param) {
Date beginTime = DateUtil.parse("1949", "YYYY");
Date endTime = new Date();
if (Objects.nonNull(param.getCrtTime()) && !param.getCrtTime().isEmpty()) {
beginTime = param.getCrtTime().get(0);
endTime = param.getCrtTime().get(1);
}
Page<DepartNegativeModel> page = profileDepartMapper.queryDepartNegative(Page.of(param.getCurrent(), param.getSize()), beginTime, endTime, param.getDepartName(), param.getDepartId());
return Result.success(page);
}
@GetMapping("{departId}")
public Result<ProfileDepart> profile(@PathVariable String departId, Date beginTime, Date endTime) {
ProfileDepart profileDepart = new ProfileDepart();
SupDepart depart = departService.getById(departId);
profileDepart.getDepartInfo()
.setName(depart.getName())
.setShortName(depart.getShortName());
List<SupPolice> polices = policeService.listAllByDepartId(departId);
profileDepart.getDepartInfo().setMainRole(polices.stream().filter(item -> "正职".equals(item.getPosition())).findFirst().map(SupPolice::getName).orElse(null));
profileDepart.getDepartInfo().setDeputyRole(polices.stream().filter(item -> "副职".equals(item.getPosition())).map(SupPolice::getName).toList());
// 民警数量
profileDepart.getDepartInfo().setPoliceSize(polices.stream().filter(item -> PersonTypeEnum.police.getValue().equals(item.getPersonStatus())).count());
// 协警辅警数量
profileDepart.getDepartInfo().setAuxSize(polices.stream().filter(item -> PersonTypeEnum.aux.getValue().equals(item.getPersonStatus()) || PersonTypeEnum.xj.getValue().equals(item.getPersonStatus())).count());
long negativeSize = negativeService.count(new LambdaQueryWrapper<Negative>().eq(Negative::getInvolveDepartId, departId)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue())));
profileDepart.getNegativeInfo().setSize(negativeSize);
return Result.success(profileDepart);
}
}

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

@ -3,6 +3,7 @@ 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 org.apache.ibatis.annotations.Select;
import java.util.Date;
@ -71,4 +72,13 @@ public interface DataPetitionComplaintMapper extends BaseMapper<DataPetitionComp
"GROUP BY temp.second_depart_id " +
"ORDER BY value DESC")
List<CaseVerifDepart> selectMassMail(Integer id, int isMass, Date beginTime, Date endTime);
@Select("SELECT DATE_FORMAT(dpc.discovery_time, '%Y/%m/%d') AS dayTime, COUNT(*) total " +
"FROM data_petition_complaint dpc " +
"WHERE dpc.discovery_time BETWEEN #{frontDay} AND #{currentDay} " +
"AND problem_sources_code = #{sourcesCode} " +
"GROUP BY dayTime " +
"ORDER BY dpc.discovery_time asc;")
List<RecentMailTrendVo> selectRecentlyMailTrend(Integer sourcesCode, String frontDay, String currentDay);
}

19
src/main/java/com/biutag/supervision/mapper/ProfileDepartMapper.java

@ -0,0 +1,19 @@
package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.model.DepartNegativeModel;
import java.util.Date;
import java.util.List;
/**
* @author wxc
* @date 2024/11/1
*/
public interface ProfileDepartMapper {
Page<DepartNegativeModel> queryDepartNegative(Page<DepartNegativeModel> page, Date beginTime, Date endTime, String departName, String departId);
int getNegativePoliceSize(List<String> idCodes);
}

52
src/main/java/com/biutag/supervision/pojo/domain/ProfileDepart.java

@ -0,0 +1,52 @@
package com.biutag.supervision.pojo.domain;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.List;
/**
* @author wxc
* @date 2024/11/1
*/
@Setter
@Getter
public class ProfileDepart {
private DepartInfo departInfo = new DepartInfo();
private NegativeInfo negativeInfo = new NegativeInfo();
@Setter
@Getter
@Accessors(chain = true)
public static class DepartInfo {
private String name;
private String shortName;
// 所长
private String mainRole;
// 副所长
private List<String> deputyRole;
private Long policeSize;
// 问题涉及民警数
private Integer negativePoliceSize;
private Long auxSize;
// 问题涉及协辅警数
private Integer negativeAuxSize;
}
@Setter
@Getter
public static class NegativeInfo {
private long size;
// 接处警
private Integer jcjBusinessSize;
private Integer jcjSize;
// 执法办案
private Integer zfbaBusinessSize;
private Integer jfbaSize;
}
}

27
src/main/java/com/biutag/supervision/pojo/model/DepartNegativeModel.java

@ -0,0 +1,27 @@
package com.biutag.supervision.pojo.model;
import lombok.Getter;
import lombok.Setter;
/**
* @author wxc
* @date 2024/11/1
*/
@Setter
@Getter
public class DepartNegativeModel {
private String departId;
private String departName;
private String parentDepartName;
//
//民警人数
private Integer policeSize;
//
//协辅警人数
private Integer auxSize;
// 查实问题涉及人数
private Integer verifyPoliceSize;
// 查实问题数
private Integer verifySize;
}

23
src/main/java/com/biutag/supervision/pojo/param/DepartNegativeQueryParam.java

@ -0,0 +1,23 @@
package com.biutag.supervision.pojo.param;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author wxc
* @date 2024/11/1
*/
@Setter
@Getter
public class DepartNegativeQueryParam extends BasePage {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private List<Date> crtTime = new ArrayList<>();
private String departName;
private String departId;
}

2
src/main/java/com/biutag/supervision/pojo/param/NegativeQueryParam.java

@ -42,6 +42,8 @@ public class NegativeQueryParam extends BasePage {
private String checkStatus;
private List<String> checkStatusList = new ArrayList<>();
private String isRectifyCode;
// 是否超时

5
src/main/java/com/biutag/supervision/pojo/vo/DictContentTree.java

@ -36,6 +36,11 @@ public class DictContentTree {
// 排序
private Integer sort;
private Double score;
// 是否开启严重等级
private Boolean isActiveLevel;
@JsonFormat(pattern = "YYYY-MM-dd HH:mm:ss")
private LocalDateTime updTime;

11
src/main/java/com/biutag/supervision/pojo/vo/RecentMailTrendVo.java

@ -0,0 +1,11 @@
package com.biutag.supervision.pojo.vo;
import lombok.Data;
import java.util.List;
@Data
public class RecentMailTrendVo {
private String dayTime; // 10/01
private String total; // 10
}

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

@ -13,12 +13,16 @@ 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 lombok.RequiredArgsConstructor;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
@ -202,5 +206,15 @@ public class DataPetitionComplaintService extends ServiceImpl<DataPetitionCompla
}
public List<RecentMailTrendVo> getRecentlyMailTrend(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);
return recentMailTrendVos;
}
}

1
src/main/java/com/biutag/supervision/service/NegativeQueryService.java

@ -51,6 +51,7 @@ public class NegativeQueryService {
.eq(StrUtil.isNotBlank(param.getProblemSourcesCode()), Negative::getProblemSourcesCode, param.getProblemSourcesCode())
.eq(StrUtil.isNotBlank(param.getBusinessTypeCode()), Negative::getBusinessTypeCode, param.getBusinessTypeCode())
.eq(StrUtil.isNotBlank(param.getCheckStatus()), Negative::getCheckStatus, param.getCheckStatus())
.in(!param.getCheckStatusList().isEmpty(), Negative::getCheckStatus, param.getCheckStatusList())
.eq(StrUtil.isNotBlank(param.getIsRectifyCode()), Negative::getIsRectifyCode, param.getIsRectifyCode())
.orderByDesc(Negative::getCrtTime);
if (param.getHappenTime().size() == 2) {

43
src/main/resources/mapper/ProfileDepartMapper.xml

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.biutag.supervision.mapper.ProfileDepartMapper">
<select id="queryDepartNegative" resultType="com.biutag.supervision.pojo.model.DepartNegativeModel">
SELECT
d.id depart_id,
d1.short_name parent_depart_name,
d.short_name depart_name,
sum( CASE WHEN p.person_type = '1' THEN 1 ELSE 0 END ) police_size,
sum( CASE WHEN p.person_type = '3' OR p.person_type = '5' THEN 1 ELSE 0 END ) aux_size,
count( DISTINCT nb.blameIdCode ) verify_police_size,
count( n.id ) verify_size
FROM
sup_depart d
LEFT JOIN sup_depart d1 ON d.pid = d1.id
LEFT JOIN sup_police p ON p.org_id = d.id
LEFT JOIN negative n ON n.involveDepartId = d.id
AND n.checkStatus IN ( '1', '2' )
AND n.crtTime BETWEEN #{beginTime} AND #{endTime}
LEFT JOIN negative_blame nb ON n.id = nb.negativeId
WHERE
d.LEVEL = 3
<if test="departName != null and departName != ''">
AND d.short_name like concat('%', #{departName}, '%')
</if>
<if test="departId != null and departId != ''">
AND d.id = #{departId}
</if>
GROUP BY
d1.short_name,
d.short_name
ORDER BY
d1.order_no
</select>
<select id="getNegativePoliceSize" >
</select>
</mapper>

BIN
src/main/resources/static/templates/长沙公安数字督察灵敏感知体系问题赋分及风险预警机制.pdf

Binary file not shown.
Loading…
Cancel
Save