17 changed files with 369 additions and 8 deletions
@ -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); |
||||
} |
||||
} |
||||
@ -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; |
||||
} |
||||
@ -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); |
||||
} |
||||
|
||||
} |
||||
|
||||
@ -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); |
||||
|
||||
} |
||||
@ -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; |
||||
} |
||||
|
||||
} |
||||
@ -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; |
||||
} |
||||
@ -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; |
||||
} |
||||
@ -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
|
||||
} |
||||
@ -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> |
||||
Binary file not shown.
Loading…
Reference in new issue