Browse Source

fit: 单位问题画像、个人问题画像

main
wxc 1 year ago
parent
commit
1f615c867c
  1. 8
      src/main/java/com/biutag/supervision/constants/enums/InspectCaseEnum.java
  2. 87
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java
  3. 155
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java
  4. 2
      src/main/java/com/biutag/supervision/mapper/ProfileDepartMapper.java
  5. 19
      src/main/java/com/biutag/supervision/mapper/ProfilePoliceMapper.java
  6. 23
      src/main/java/com/biutag/supervision/pojo/domain/NegativeInfo.java
  7. 18
      src/main/java/com/biutag/supervision/pojo/domain/ProfileDepart.java
  8. 23
      src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java
  9. 18
      src/main/java/com/biutag/supervision/pojo/dto/common/BarItem.java
  10. 29
      src/main/java/com/biutag/supervision/pojo/model/PoliceNegativeModel.java
  11. 24
      src/main/java/com/biutag/supervision/pojo/param/DepartPoliceQueryParam.java
  12. 21
      src/main/resources/mapper/ProfileDepartMapper.xml
  13. 48
      src/main/resources/mapper/ProfilePoliceMapper.xml
  14. 8
      src/test/java/com/biutag/supervision/StrUtil.java

8
src/main/java/com/biutag/supervision/constants/enums/InspectCaseEnum.java

@ -13,16 +13,12 @@ public enum InspectCaseEnum {
// 部分属实
PARTIALLY_TRUE("2"),
// 不属实
FALSE("3"),
NOT_VERIFIED("4"),
OTHER("5");
FALSE("3");
private String value;
public static boolean isItTure(String value) {
return StrUtil.isNotBlank(value) && !OTHER.getValue().equals(value);
return StrUtil.isNotBlank(value);
}
}

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

@ -1,32 +1,33 @@
package com.biutag.supervision.controller.sensitivePerception;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.constants.enums.BusinessTypeEnum;
import com.biutag.supervision.constants.enums.InspectCaseEnum;
import com.biutag.supervision.constants.enums.PersonTypeEnum;
import com.biutag.supervision.constants.enums.ProblemSourcesEnum;
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.dto.common.BarItem;
import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.entity.*;
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 com.biutag.supervision.service.*;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
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;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* 单位/个人画像
@ -42,7 +43,7 @@ public class ProfileDepartController {
private final SupDepartService departService;
private final SupPoliceService policeService;
private final NegativeService negativeService;
private final NegativeBlameService blameService;
private final BusinessDepartService businessDepartService;
@GetMapping
public Result<Page<DepartNegativeModel>> list(DepartNegativeQueryParam param) {
@ -57,7 +58,13 @@ public class ProfileDepartController {
}
@GetMapping("{departId}")
public Result<ProfileDepart> profile(@PathVariable String departId, Date beginTime, Date endTime) {
public Result<ProfileDepart> profile(@PathVariable String departId, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date beginTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) {
if (Objects.isNull(beginTime)) {
beginTime = DateUtil.parse("1949", "YYYY");
}
if (Objects.isNull(endTime)) {
endTime = new Date();
}
ProfileDepart profileDepart = new ProfileDepart();
SupDepart depart = departService.getById(departId);
profileDepart.getDepartInfo()
@ -71,11 +78,61 @@ public class ProfileDepartController {
// 协警辅警数量
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)
List<Negative> list = negativeService.list(new LambdaQueryWrapper<Negative>().eq(Negative::getInvolveDepartId, departId)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue())));
profileDepart.getNegativeInfo().setSize(negativeSize);
profileDepart.getNegativeInfo().setSize(list.size());
int jcjBusinessSize = businessDepartService.list(new LambdaQueryWrapper<BusinessDepart>()
.between(BusinessDepart::getDate, beginTime, endTime)
.eq(BusinessDepart::getBusinessType, BusinessTypeEnum.JCJ_110.getValue())
.eq(BusinessDepart::getDepartId, departId))
.stream().mapToInt(BusinessDepart::getNumber).sum();
int jcjSize = negativeService.list(new LambdaQueryWrapper<Negative>()
.between(Negative::getCrtTime, beginTime, endTime)
.eq(Negative::getBusinessTypeCode, BusinessTypeEnum.JCJ_110.getValue())
.eq(Negative::getInvolveDepartId, departId)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size();
int zfbaBusinessSize = businessDepartService.list(new LambdaQueryWrapper<BusinessDepart>()
.between(BusinessDepart::getDate, beginTime, endTime)
.eq(BusinessDepart::getBusinessType, BusinessTypeEnum.ZFBA.getValue())
.eq(BusinessDepart::getDepartId, departId))
.stream().mapToInt(BusinessDepart::getNumber).sum();
int zfbaSize = negativeService.list(new LambdaQueryWrapper<Negative>()
.between(Negative::getCrtTime, beginTime, endTime)
.eq(Negative::getBusinessTypeCode, BusinessTypeEnum.ZFBA.getValue())
.eq(Negative::getInvolveDepartId, departId)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size();
profileDepart.getNegativeInfo().setJcjSize(jcjSize).setJcjBusinessSize(jcjBusinessSize).setZfbaBusinessSize(zfbaBusinessSize).setZfbaSize(zfbaSize);
// 问题来源占比
Map<String, List<Negative>> problemSourcesGroup = list.stream().collect(Collectors.groupingBy(Negative::getProblemSourcesCode));
List<PieItem> problemSourcesList = problemSourcesGroup.keySet().stream().map(key -> new PieItem(ProblemSourcesEnum.get(key).getLabel(), problemSourcesGroup.get(key).size())).toList();
profileDepart.setProblemSourcesList(problemSourcesList);
// 业务类型占比
Map<String, List<Negative>> businessTypeGroup = list.stream().collect(Collectors.groupingBy(Negative::getBusinessTypeCode));
List<PieItem> businessTypeList = businessTypeGroup.keySet().stream().map(key -> new PieItem(BusinessTypeEnum.get(key).getLabel(), businessTypeGroup.get(key).size())).toList();
profileDepart.setBusinessTypeList(businessTypeList);
// 个人问题排名
List<BarItem> policeBarList = profileDepartMapper.selectPoliceTop10(departId, beginTime, endTime);
profileDepart.setPoliceBarList(policeBarList);
return Result.success(profileDepart);
}
@GetMapping("{departId}/month")
public Result<JSONObject> listByMonth(@PathVariable String departId) {
LocalDate now = LocalDate.now();
List<String> months = new ArrayList<>();
List<Long> values = new ArrayList<>();
for (int i = 11; i >= 0; i--) {
String month = now.minusMonths(i).format(DateTimeFormatter.ofPattern("yyyy年MM月"));
months.add(month);
long value = negativeService.count(new LambdaQueryWrapper<Negative>()
.eq(Negative::getInvolveDepartId, departId)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))
.apply(" DATE_FORMAT(crtTime, '%Y年%m月') = '" + month + "'"));
values.add(value);
}
JSONObject jsonObject = new JSONObject().fluentPut("months", months).fluentPut("values", values);
return Result.success(jsonObject);
}
}

155
src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java

@ -0,0 +1,155 @@
package com.biutag.supervision.controller.sensitivePerception;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.constants.enums.BusinessTypeEnum;
import com.biutag.supervision.constants.enums.InspectCaseEnum;
import com.biutag.supervision.constants.enums.ProblemSourcesEnum;
import com.biutag.supervision.mapper.ProfilePoliceMapper;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.domain.ProfileDepart;
import com.biutag.supervision.pojo.domain.ProfilePolice;
import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.entity.BusinessDepart;
import com.biutag.supervision.pojo.entity.BusinessPolice;
import com.biutag.supervision.pojo.entity.Negative;
import com.biutag.supervision.pojo.entity.NegativeBlame;
import com.biutag.supervision.pojo.model.PoliceNegativeModel;
import com.biutag.supervision.pojo.param.DepartPoliceQueryParam;
import com.biutag.supervision.service.*;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
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.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* 单位/个人画像
* @author wxc
* @date 2024/10/31
*/
@RequiredArgsConstructor
@RequestMapping("profile/police")
@RestController
public class ProfilePoliceController {
private final ProfilePoliceMapper profilePoliceMapper;
private final SupPoliceService policeService;
private final BusinessPoliceService businessPoliceService;
private final NegativeBlameService negativeBlameService;
private final NegativeService negativeService;
@GetMapping
public Result<Page<PoliceNegativeModel>> list(DepartPoliceQueryParam 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<PoliceNegativeModel> page = profilePoliceMapper.queryPoliceNegative(Page.of(param.getCurrent(), param.getSize()), beginTime, endTime, param.getName(),param.getEmpNo(), param.getDepartId());
return Result.success(page);
}
@GetMapping("{idCode}")
public Result<ProfilePolice> profile(@PathVariable String idCode, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date beginTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) {
if (Objects.isNull(beginTime)) {
beginTime = DateUtil.parse("1949", "YYYY");
}
if (Objects.isNull(endTime)) {
endTime = new Date();
}
ProfilePolice profilePolice = new ProfilePolice();
profilePolice.setPoliceInfo(policeService.getByIdCode(idCode));
int jcjBusinessSize = businessPoliceService.list(new LambdaQueryWrapper<BusinessPolice>()
.between(BusinessPolice::getDate, beginTime, endTime)
.eq(BusinessPolice::getBusinessType, BusinessTypeEnum.JCJ_110.getValue())
.eq(BusinessPolice::getPoliceIdCode, idCode))
.stream().mapToInt(BusinessPolice::getNumber).sum();
Set<String> negativeIds = negativeBlameService.list(new LambdaQueryWrapper<NegativeBlame>().eq(NegativeBlame::getBlameIdCode, idCode)).stream().map(NegativeBlame::getNegativeId).collect(Collectors.toSet());
int jcjSize = negativeIds.isEmpty() ? 0 : negativeService.list(new LambdaQueryWrapper<Negative>()
.between(Negative::getCrtTime, beginTime, endTime)
.eq(Negative::getBusinessTypeCode, BusinessTypeEnum.JCJ_110.getValue())
.in(Negative::getId, negativeIds)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size();
int zfbaBusinessSize = businessPoliceService.list(new LambdaQueryWrapper<BusinessPolice>()
.between(BusinessPolice::getDate, beginTime, endTime)
.eq(BusinessPolice::getBusinessType, BusinessTypeEnum.ZFBA.getValue())
.eq(BusinessPolice::getPoliceIdCode, idCode))
.stream().mapToInt(BusinessPolice::getNumber).sum();
int zfbaSize = negativeIds.isEmpty() ? 0 : negativeService.list(new LambdaQueryWrapper<Negative>()
.between(Negative::getCrtTime, beginTime, endTime)
.eq(Negative::getBusinessTypeCode, BusinessTypeEnum.ZFBA.getValue())
.in(Negative::getId, negativeIds)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size();
profilePolice.getNegativeInfo().setJcjBusinessSize(jcjBusinessSize).setJcjSize(jcjSize).setZfbaBusinessSize(zfbaBusinessSize).setZfbaSize(zfbaSize);
List<Negative> list = negativeIds.isEmpty() ? new ArrayList<>() : negativeService.list(new LambdaQueryWrapper<Negative>()
.between(Negative::getCrtTime, beginTime, endTime)
.eq(Negative::getBusinessTypeCode, BusinessTypeEnum.JCJ_110.getValue())
.in(Negative::getId, negativeIds)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue())));
// 问题来源占比
Map<String, List<Negative>> problemSourcesGroup = list.stream().collect(Collectors.groupingBy(Negative::getProblemSourcesCode));
List<PieItem> problemSourcesList = problemSourcesGroup.keySet().stream().map(key -> new PieItem(ProblemSourcesEnum.get(key).getLabel(), problemSourcesGroup.get(key).size())).toList();
profilePolice.setProblemSourcesList(problemSourcesList);
// 业务类型占比
Map<String, List<Negative>> businessTypeGroup = list.stream().collect(Collectors.groupingBy(Negative::getBusinessTypeCode));
List<PieItem> businessTypeList = businessTypeGroup.keySet().stream().map(key -> new PieItem(BusinessTypeEnum.get(key).getLabel(), businessTypeGroup.get(key).size())).toList();
profilePolice.setBusinessTypeList(businessTypeList);
return Result.success(profilePolice);
}
@GetMapping("{idCode}/negative")
public Result<Page<Negative>> profile(@PathVariable String idCode, Page<Negative> page, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date beginTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) {
if (Objects.isNull(beginTime)) {
beginTime = DateUtil.parse("1949", "YYYY");
}
if (Objects.isNull(endTime)) {
endTime = new Date();
}
Set<String> negativeIds = negativeBlameService.list(new LambdaQueryWrapper<NegativeBlame>().eq(NegativeBlame::getBlameIdCode, idCode)).stream().map(NegativeBlame::getNegativeId).collect(Collectors.toSet());
if (negativeIds.isEmpty()) {
return Result.success(new Page<Negative>().setRecords(new ArrayList<>()).setTotal(0));
}
Page<Negative> pageData = negativeService.page(page, new LambdaQueryWrapper<Negative>()
.between(Negative::getCrtTime, beginTime, endTime)
.in(Negative::getId, negativeIds)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue())));
return Result.success(pageData);
}
@GetMapping("{idCode}/month")
public Result<JSONObject> listByMonth(@PathVariable String idCode) {
LocalDate now = LocalDate.now();
List<String> months = new ArrayList<>();
List<Long> values = new ArrayList<>();
Set<String> negativeIds = negativeBlameService.list(new LambdaQueryWrapper<NegativeBlame>().eq(NegativeBlame::getBlameIdCode, idCode)).stream().map(NegativeBlame::getNegativeId).collect(Collectors.toSet());
for (int i = 11; i >= 0; i--) {
String month = now.minusMonths(i).format(DateTimeFormatter.ofPattern("yyyy年MM月"));
months.add(month);
long value = negativeIds.isEmpty() ? 0 : negativeService.count(new LambdaQueryWrapper<Negative>()
.in(Negative::getId, negativeIds)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))
.apply(" DATE_FORMAT(crtTime, '%Y年%m月') = '" + month + "'"));
values.add(value);
}
JSONObject jsonObject = new JSONObject().fluentPut("months", months).fluentPut("values", values);
return Result.success(jsonObject);
}
}

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

@ -1,6 +1,7 @@
package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.dto.common.BarItem;
import com.biutag.supervision.pojo.model.DepartNegativeModel;
import java.util.Date;
@ -16,4 +17,5 @@ public interface ProfileDepartMapper {
int getNegativePoliceSize(List<String> idCodes);
List<BarItem> selectPoliceTop10(String departId, Date beginTime, Date endTime);
}

19
src/main/java/com/biutag/supervision/mapper/ProfilePoliceMapper.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 com.biutag.supervision.pojo.model.PoliceNegativeModel;
import java.util.Date;
import java.util.List;
/**
* @author wxc
* @date 2024/11/1
*/
public interface ProfilePoliceMapper {
Page<PoliceNegativeModel> queryPoliceNegative(Page<PoliceNegativeModel> page, Date beginTime, Date endTime, String name, String empNo, String departId);
}

23
src/main/java/com/biutag/supervision/pojo/domain/NegativeInfo.java

@ -0,0 +1,23 @@
package com.biutag.supervision.pojo.domain;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
/**
* @author wxc
* @date 2024/11/3
*/
@Setter
@Getter
@Accessors(chain = true)
public class NegativeInfo {
private long size;
// 接处警
private Integer jcjBusinessSize;
private Integer jcjSize;
// 执法办案
private Integer zfbaBusinessSize;
private Integer zfbaSize;
}

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

@ -1,9 +1,12 @@
package com.biutag.supervision.pojo.domain;
import com.biutag.supervision.pojo.dto.common.BarItem;
import com.biutag.supervision.pojo.dto.common.PieItem;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.ArrayList;
import java.util.List;
/**
@ -16,7 +19,9 @@ public class ProfileDepart {
private DepartInfo departInfo = new DepartInfo();
private NegativeInfo negativeInfo = new NegativeInfo();
private List<PieItem> problemSourcesList = new ArrayList<>();
private List<PieItem> businessTypeList = new ArrayList<>();
private List<BarItem> policeBarList = new ArrayList<>();
@Setter
@Getter
@ -37,16 +42,5 @@ public class ProfileDepart {
private Integer negativeAuxSize;
}
@Setter
@Getter
public static class NegativeInfo {
private long size;
// 接处警
private Integer jcjBusinessSize;
private Integer jcjSize;
// 执法办案
private Integer zfbaBusinessSize;
private Integer jfbaSize;
}
}

23
src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java

@ -0,0 +1,23 @@
package com.biutag.supervision.pojo.domain;
import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.entity.SupPolice;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
/**
* @author wxc
* @date 2024/11/3
*/
@Setter
@Getter
public class ProfilePolice {
private SupPolice policeInfo = new SupPolice();
private NegativeInfo negativeInfo = new NegativeInfo();
private List<PieItem> problemSourcesList = new ArrayList<>();
private List<PieItem> businessTypeList = new ArrayList<>();
}

18
src/main/java/com/biutag/supervision/pojo/dto/common/BarItem.java

@ -0,0 +1,18 @@
package com.biutag.supervision.pojo.dto.common;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/**
* @author wxc
* @date 2024/10/29
*/
@Setter
@Getter
@AllArgsConstructor
public class BarItem {
private String label;
private Integer value;
}

29
src/main/java/com/biutag/supervision/pojo/model/PoliceNegativeModel.java

@ -0,0 +1,29 @@
package com.biutag.supervision.pojo.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDate;
/**
* @author wxc
* @date 2024/11/1
*/
@Setter
@Getter
public class PoliceNegativeModel {
private String name;
private String empNo;
private String IdCode;
private String position;
// 入职日期
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
private LocalDate employmentDate;
// 查实问题数
private Integer verifySize;
private String departName;
private String parentDepartName;
}

24
src/main/java/com/biutag/supervision/pojo/param/DepartPoliceQueryParam.java

@ -0,0 +1,24 @@
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 DepartPoliceQueryParam extends BasePage {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private List<Date> crtTime = new ArrayList<>();
private String name;
private String empNo;
private String departId;
}

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

@ -33,11 +33,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d1.short_name,
d.short_name
ORDER BY
d1.order_no
verify_police_size desc, d1.order_no
</select>
<select id="getNegativePoliceSize" >
</select>
<select id="selectPoliceTop10" resultType="com.biutag.supervision.pojo.dto.common.BarItem">
SELECT
p.name label,
count( DISTINCT n.id ) value
FROM
sup_police p
LEFT JOIN negative_blame nb ON p.id_code = nb.blameIdCode
LEFT JOIN negative n ON nb.negativeId = n.id
AND n.checkStatus IN ( '1', '2' )
AND n.crtTime BETWEEN #{beginTime} AND #{endTime}
WHERE p.org_id = #{departId}
GROUP BY
p.name,
p.id_code
ORDER BY
value DESC
LIMIT 10
</select>
</mapper>

48
src/main/resources/mapper/ProfilePoliceMapper.xml

@ -0,0 +1,48 @@
<?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.ProfilePoliceMapper">
<select id="queryPoliceNegative" resultType="com.biutag.supervision.pojo.model.PoliceNegativeModel">
SELECT
p.id_code,
p.NAME,
p.emp_no,
p.position,
p.employment_date,
d.short_name depart_name,
d1.short_name parent_depart_name,
count( DISTINCT n.id ) verify_size
FROM
sup_police p
LEFT JOIN sup_depart d ON p.org_id = d.id
LEFT JOIN sup_depart d1 ON d.pid = d1.id and d1.level = 2
LEFT JOIN negative_blame nb ON p.id_code = nb.blameIdCode
LEFT JOIN negative n ON nb.negativeId = n.id
AND n.checkStatus IN ( '1', '2' )
AND n.crtTime BETWEEN #{beginTime} AND #{endTime}
WHERE
1 = 1
<if test="name != null and name != ''">
AND p.name like concat('%', #{name}, '%')
</if>
<if test="empNo != null and empNo != ''">
AND p.emp_no like concat('%', #{empNo}, '%')
</if>
<if test="departId != null and departId != ''">
AND p.org_id = #{departId}
</if>
GROUP BY
p.id_code,
p.NAME,
p.emp_no,
p.employment_date,
d.short_name,
d1.short_name
ORDER BY
verify_size DESC
</select>
</mapper>

8
src/test/java/com/biutag/supervision/StrUtil.java

@ -1,5 +1,6 @@
package com.biutag.supervision;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileTypeUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.resource.ResourceUtil;
@ -9,14 +10,17 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import java.net.URL;
import java.time.LocalDate;
import java.util.List;
public class StrUtil {
@Test
public void testSubstr() {
LocalDate now = LocalDate.now();
for (int i = 0; i < 12; i++) {
String type = FileUtil.extName("1.xls");
System.out.println(type);
System.out.println(now.minusMonths(i));
}
}
}

Loading…
Cancel
Save