Browse Source

fix: 完善单位问题画像、个人问题画像

main
wxc 1 year ago
parent
commit
18b268c241
  1. 7
      src/main/java/com/biutag/supervision/constants/enums/PersonTypeEnum.java
  2. 31
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java
  3. 21
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java
  4. 21
      src/main/java/com/biutag/supervision/job/DepartJob.java
  5. 5
      src/main/java/com/biutag/supervision/mapper/ProfileDepartMapper.java
  6. 2
      src/main/java/com/biutag/supervision/mapper/SupPoliceMapper.java
  7. 9
      src/main/java/com/biutag/supervision/pojo/domain/NegativeInfo.java
  8. 9
      src/main/java/com/biutag/supervision/pojo/entity/SupDepartPoliceSize.java
  9. 22
      src/main/java/com/biutag/supervision/service/SupDepartPoliceSizeService.java
  10. 8
      src/main/java/com/biutag/supervision/service/SupPoliceService.java
  11. 33
      src/main/resources/mapper/ProfileDepartMapper.xml

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

@ -3,6 +3,8 @@ package com.biutag.supervision.constants.enums;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import java.util.List;
/** /**
* @author wxc * @author wxc
* @date 2024/11/1 * @date 2024/11/1
@ -18,4 +20,9 @@ public enum PersonTypeEnum {
xj("5", "协警"); xj("5", "协警");
private String value; private String value;
private String label; private String label;
public static List<String> getAuxPersonType() {
return List.of(works.getValue(), aux.getValue(), clerk.getValue(), xj.getValue());
}
} }

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

@ -73,33 +73,39 @@ public class ProfileDepartController {
List<SupPolice> polices = policeService.listAllByDepartId(departId); List<SupPolice> polices = policeService.listAllByDepartId(departId);
profileDepart.getDepartInfo().setMainRole(polices.stream().filter(item -> "正职".equals(item.getPosition())).findFirst().map(SupPolice::getName).orElse(null)); 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().setDeputyRole(polices.stream().filter(item -> "副职".equals(item.getPosition())).map(SupPolice::getName).toList());
// 民警数量
profileDepart.getDepartInfo().setPoliceSize(polices.stream().filter(item -> PersonTypeEnum.police.getValue().equals(item.getPersonType())).count());
// 协警辅警数量
profileDepart.getDepartInfo().setAuxSize(polices.stream().filter(item -> PersonTypeEnum.aux.getValue().equals(item.getPersonType()) || PersonTypeEnum.xj.getValue().equals(item.getPersonType())).count());
List<Negative> list = negativeService.list(new LambdaQueryWrapper<Negative>().eq(Negative::getInvolveDepartId, departId) List<Negative> list = negativeService.list(new LambdaQueryWrapper<Negative>().eq(Negative::getInvolveDepartId, departId)
.between(Negative::getCrtTime, beginTime, endTime) .between(Negative::getCrtTime, beginTime, endTime)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))); .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue())));
List<String> negativeIds = list.stream().map(Negative::getId).toList(); List<String> negativeIds = list.stream().map(Negative::getId).toList();
int negativePoliceSize = profileDepartMapper.countByNegativeIdsAndPersonTypes(negativeIds, List.of(PersonTypeEnum.police.getValue())); int negativePoliceSize = negativeIds.isEmpty() ? 0 : profileDepartMapper.countByNegativeIdsAndPersonTypes(negativeIds, List.of(PersonTypeEnum.police.getValue()));
profileDepart.getDepartInfo().setNegativePoliceSize(negativePoliceSize); profileDepart.getDepartInfo().setNegativePoliceSize(negativePoliceSize);
int negativeAuxSize = profileDepartMapper.countByNegativeIdsAndPersonTypes(negativeIds, List.of(PersonTypeEnum.aux.getValue(), PersonTypeEnum.xj.getValue())); int negativeAuxSize = negativeIds.isEmpty() ? 0 : profileDepartMapper.countByNegativeIdsAndPersonTypes(negativeIds, List.of(PersonTypeEnum.aux.getValue(), PersonTypeEnum.xj.getValue()));
profileDepart.getDepartInfo().setNegativeAuxSize(negativeAuxSize); profileDepart.getDepartInfo().setNegativeAuxSize(negativeAuxSize);
profileDepart.getNegativeInfo().setSize(list.size()); profileDepart.getNegativeInfo().setSize(list.size());
int jcjBusinessSize = businessDepartService.list(new LambdaQueryWrapper<BusinessDepart>() int jcj110BusinessSize = businessDepartService.list(new LambdaQueryWrapper<BusinessDepart>()
.between(BusinessDepart::getDate, beginTime, endTime) .between(BusinessDepart::getDate, beginTime, endTime)
.eq(BusinessDepart::getBusinessType, BusinessTypeEnum.JCJ_110.getValue()) .eq(BusinessDepart::getBusinessType, BusinessTypeEnum.JCJ_110.getValue())
.eq(BusinessDepart::getDepartId, departId)) .eq(BusinessDepart::getDepartId, departId))
.stream().mapToInt(BusinessDepart::getNumber).sum(); .stream().mapToInt(BusinessDepart::getNumber).sum();
int jcjSize = negativeService.list(new LambdaQueryWrapper<Negative>() int jcj110Size = negativeService.list(new LambdaQueryWrapper<Negative>()
.between(Negative::getCrtTime, beginTime, endTime) .between(Negative::getCrtTime, beginTime, endTime)
.eq(Negative::getBusinessTypeCode, BusinessTypeEnum.JCJ_110.getValue()) .eq(Negative::getBusinessTypeCode, BusinessTypeEnum.JCJ_110.getValue())
.eq(Negative::getInvolveDepartId, departId) .eq(Negative::getInvolveDepartId, departId)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size(); .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size();
int jcj122BusinessSize = businessDepartService.list(new LambdaQueryWrapper<BusinessDepart>()
.between(BusinessDepart::getDate, beginTime, endTime)
.eq(BusinessDepart::getBusinessType, BusinessTypeEnum.JCJ_122.getValue())
.eq(BusinessDepart::getDepartId, departId))
.stream().mapToInt(BusinessDepart::getNumber).sum();
int jcj122Size = negativeService.list(new LambdaQueryWrapper<Negative>()
.between(Negative::getCrtTime, beginTime, endTime)
.eq(Negative::getBusinessTypeCode, BusinessTypeEnum.JCJ_122.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>() int zfbaBusinessSize = businessDepartService.list(new LambdaQueryWrapper<BusinessDepart>()
.between(BusinessDepart::getDate, beginTime, endTime) .between(BusinessDepart::getDate, beginTime, endTime)
.eq(BusinessDepart::getBusinessType, BusinessTypeEnum.ZFBA.getValue()) .eq(BusinessDepart::getBusinessType, BusinessTypeEnum.ZFBA.getValue())
@ -110,7 +116,10 @@ public class ProfileDepartController {
.eq(Negative::getBusinessTypeCode, BusinessTypeEnum.ZFBA.getValue()) .eq(Negative::getBusinessTypeCode, BusinessTypeEnum.ZFBA.getValue())
.eq(Negative::getInvolveDepartId, departId) .eq(Negative::getInvolveDepartId, departId)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size(); .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size();
profileDepart.getNegativeInfo().setJcjSize(jcjSize).setJcjBusinessSize(jcjBusinessSize).setZfbaBusinessSize(zfbaBusinessSize).setZfbaSize(zfbaSize); profileDepart.getNegativeInfo().setJcj110Size(jcj110Size).setJcj110BusinessSize(jcj110BusinessSize)
.setJcj122Size(jcj122Size)
.setJcj122BusinessSize(jcj122BusinessSize)
.setZfbaBusinessSize(zfbaBusinessSize).setZfbaSize(zfbaSize);
// 问题来源占比 // 问题来源占比
Map<String, List<Negative>> problemSourcesGroup = list.stream().collect(Collectors.groupingBy(Negative::getProblemSourcesCode)); Map<String, List<Negative>> problemSourcesGroup = list.stream().collect(Collectors.groupingBy(Negative::getProblemSourcesCode));
List<PieItem> problemSourcesList = problemSourcesGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(ProblemSourcesEnum.get(key)).map(ProblemSourcesEnum::getLabel).orElse(key), problemSourcesGroup.get(key).size())).toList(); List<PieItem> problemSourcesList = problemSourcesGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(ProblemSourcesEnum.get(key)).map(ProblemSourcesEnum::getLabel).orElse(key), problemSourcesGroup.get(key).size())).toList();
@ -137,7 +146,7 @@ public class ProfileDepartController {
profileDepart.setProblemTypeRadarIndicator(problemTypeRadarIndicator); profileDepart.setProblemTypeRadarIndicator(problemTypeRadarIndicator);
profileDepart.setProblemTypeRadarData(problemTypeRadarData); profileDepart.setProblemTypeRadarData(problemTypeRadarData);
// 突出问题排名 // 突出问题排名
profileDepart.setProblemTypeBarList(problemTypeBarList); profileDepart.setProblemTypeBarList(profileDepartMapper.selectThirdProblemType(departId, beginTime, endTime));
return Result.success(profileDepart); return Result.success(profileDepart);
} }

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

@ -76,7 +76,7 @@ public class ProfilePoliceController {
ProfilePolice profilePolice = new ProfilePolice(); ProfilePolice profilePolice = new ProfilePolice();
profilePolice.setPoliceInfo(policeService.getByIdCode(idCode)); profilePolice.setPoliceInfo(policeService.getByIdCode(idCode));
int jcjBusinessSize = businessPoliceService.list(new LambdaQueryWrapper<BusinessPolice>() int jcj110BusinessSize = businessPoliceService.list(new LambdaQueryWrapper<BusinessPolice>()
.between(BusinessPolice::getDate, beginTime, endTime) .between(BusinessPolice::getDate, beginTime, endTime)
.eq(BusinessPolice::getBusinessType, BusinessTypeEnum.JCJ_110.getValue()) .eq(BusinessPolice::getBusinessType, BusinessTypeEnum.JCJ_110.getValue())
.eq(BusinessPolice::getEmpNo, profilePolice.getPoliceInfo().getEmpNo()) .eq(BusinessPolice::getEmpNo, profilePolice.getPoliceInfo().getEmpNo())
@ -84,11 +84,24 @@ public class ProfilePoliceController {
.stream().mapToInt(BusinessPolice::getNumber).sum(); .stream().mapToInt(BusinessPolice::getNumber).sum();
Set<String> negativeIds = negativeBlameService.list(new LambdaQueryWrapper<NegativeBlame>().eq(NegativeBlame::getBlameIdCode, idCode)).stream().map(NegativeBlame::getNegativeId).collect(Collectors.toSet()); 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>() int jcj110Size = negativeIds.isEmpty() ? 0 : negativeService.list(new LambdaQueryWrapper<Negative>()
.between(Negative::getCrtTime, beginTime, endTime) .between(Negative::getCrtTime, beginTime, endTime)
.eq(Negative::getBusinessTypeCode, BusinessTypeEnum.JCJ_110.getValue()) .eq(Negative::getBusinessTypeCode, BusinessTypeEnum.JCJ_110.getValue())
.in(Negative::getId, negativeIds) .in(Negative::getId, negativeIds)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size(); .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size();
int jcj122BusinessSize = businessPoliceService.list(new LambdaQueryWrapper<BusinessPolice>()
.between(BusinessPolice::getDate, beginTime, endTime)
.eq(BusinessPolice::getBusinessType, BusinessTypeEnum.JCJ_122.getValue())
.eq(BusinessPolice::getEmpNo, profilePolice.getPoliceInfo().getEmpNo())
.eq(BusinessPolice::getPoliceName, profilePolice.getPoliceInfo().getName()))
.stream().mapToInt(BusinessPolice::getNumber).sum();
int jcj122Size = negativeIds.isEmpty() ? 0 : negativeService.list(new LambdaQueryWrapper<Negative>()
.between(Negative::getCrtTime, beginTime, endTime)
.eq(Negative::getBusinessTypeCode, BusinessTypeEnum.JCJ_122.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>() int zfbaBusinessSize = businessPoliceService.list(new LambdaQueryWrapper<BusinessPolice>()
.between(BusinessPolice::getDate, beginTime, endTime) .between(BusinessPolice::getDate, beginTime, endTime)
.eq(BusinessPolice::getBusinessType, BusinessTypeEnum.ZFBA.getValue()) .eq(BusinessPolice::getBusinessType, BusinessTypeEnum.ZFBA.getValue())
@ -100,7 +113,9 @@ public class ProfilePoliceController {
.eq(Negative::getBusinessTypeCode, BusinessTypeEnum.ZFBA.getValue()) .eq(Negative::getBusinessTypeCode, BusinessTypeEnum.ZFBA.getValue())
.in(Negative::getId, negativeIds) .in(Negative::getId, negativeIds)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size(); .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size();
profilePolice.getNegativeInfo().setJcjBusinessSize(jcjBusinessSize).setJcjSize(jcjSize).setZfbaBusinessSize(zfbaBusinessSize).setZfbaSize(zfbaSize); profilePolice.getNegativeInfo().setJcj110BusinessSize(jcj110BusinessSize).setJcj110Size(jcj110Size)
.setJcj122BusinessSize(jcj122BusinessSize).setJcj122Size(jcj122Size)
.setZfbaBusinessSize(zfbaBusinessSize).setZfbaSize(zfbaSize);
List<Negative> list = negativeIds.isEmpty() ? new ArrayList<>() : negativeService.list(new LambdaQueryWrapper<Negative>() List<Negative> list = negativeIds.isEmpty() ? new ArrayList<>() : negativeService.list(new LambdaQueryWrapper<Negative>()
.between(Negative::getCrtTime, beginTime, endTime) .between(Negative::getCrtTime, beginTime, endTime)

21
src/main/java/com/biutag/supervision/job/DepartJob.java

@ -1,12 +1,13 @@
package com.biutag.supervision.job; package com.biutag.supervision.job;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.biutag.supervision.pojo.entity.SupDepart; import com.biutag.supervision.pojo.entity.SupDepart;
import com.biutag.supervision.service.SupDepartPoliceSizeService; import com.biutag.supervision.service.SupDepartPoliceSizeService;
import com.biutag.supervision.service.SupDepartService; import com.biutag.supervision.service.SupDepartService;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
@ -23,12 +24,6 @@ public class DepartJob {
private final SupDepartPoliceSizeService departPoliceSizeService; private final SupDepartPoliceSizeService departPoliceSizeService;
@PostConstruct
public void init() {
// updateDepartPath();
}
@Async @Async
public void updateDepartPath() { public void updateDepartPath() {
List<SupDepart> departs = departService.list(); List<SupDepart> departs = departService.list();
@ -41,14 +36,14 @@ public class DepartJob {
} }
@Async /**
* 1个小时
*/
@Scheduled(fixedRate = 1000 * 60 * 60)
public void updatePoliceSize() { public void updatePoliceSize() {
List<SupDepart> departs = departService.list(); List<SupDepart> departs = departService.list(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getLevel, 3));
departs.forEach(item -> { departs.forEach(item -> {
String pathTrace = departService.getPathTrace(item); departPoliceSizeService.saveOrUpdate(item.getId());
if (!pathTrace.equals(item.getPathTrace())) {
departService.update(new LambdaUpdateWrapper<SupDepart>().eq(SupDepart::getId, item.getId()).set(SupDepart::getPathTrace, pathTrace));
}
}); });
} }

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

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.dto.common.BarItem; import com.biutag.supervision.pojo.dto.common.BarItem;
import com.biutag.supervision.pojo.dto.common.PieItem; import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.model.DepartNegativeModel; import com.biutag.supervision.pojo.model.DepartNegativeModel;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.Date; import java.util.Date;
@ -22,6 +23,8 @@ public interface ProfileDepartMapper {
List<BarItem> selectProblemType(String departId, Date beginTime, Date endTime); List<BarItem> selectProblemType(String departId, Date beginTime, Date endTime);
int countByNegativeIdsAndPersonTypes(List<String> negativeIds, List<String> personTypes); List<BarItem> selectThirdProblemType(String departId, Date beginTime, Date endTime);
int countByNegativeIdsAndPersonTypes(@Param("negativeIds") List<String> negativeIds, @Param("personTypes") List<String> personTypes);
} }

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

@ -15,6 +15,4 @@ public interface SupPoliceMapper extends BaseMapper<SupPolice> {
Page<PoliceModel> queryPage(@Param("page") Page<PoliceModel> page, @Param(Constants.WRAPPER) QueryWrapper<PoliceModel> queryWrapper); Page<PoliceModel> queryPage(@Param("page") Page<PoliceModel> page, @Param(Constants.WRAPPER) QueryWrapper<PoliceModel> queryWrapper);
} }

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

@ -14,9 +14,12 @@ import lombok.experimental.Accessors;
public class NegativeInfo { public class NegativeInfo {
private long size; private long size;
// 接处警 // 110接处警
private Integer jcjBusinessSize; private Integer jcj110BusinessSize;
private Integer jcjSize; private Integer jcj110Size;
// 122接处警
private Integer jcj122BusinessSize;
private Integer jcj122Size;
// 执法办案 // 执法办案
private Integer zfbaBusinessSize; private Integer zfbaBusinessSize;
private Integer zfbaSize; private Integer zfbaSize;

9
src/main/java/com/biutag/supervision/pojo/entity/SupDepartPoliceSize.java

@ -1,13 +1,12 @@
package com.biutag.supervision.pojo.entity; package com.biutag.supervision.pojo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.experimental.Accessors;
import java.time.LocalDateTime; @Accessors(chain = true)
@Setter @Setter
@Getter @Getter
public class SupDepartPoliceSize { public class SupDepartPoliceSize {
@ -18,10 +17,10 @@ public class SupDepartPoliceSize {
// 民警人数 // 民警人数
@TableField("police_size") @TableField("police_size")
private Integer policeSize; private Long policeSize;
// 协警人数 // 协警人数
@TableField("aux_size") @TableField("aux_size")
private Integer auxSize; private Long auxSize;
} }

22
src/main/java/com/biutag/supervision/service/SupDepartPoliceSizeService.java

@ -1,11 +1,31 @@
package com.biutag.supervision.service; package com.biutag.supervision.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.pojo.entity.SupDepartPoliceSize; import com.biutag.supervision.constants.enums.PersonTypeEnum;
import com.biutag.supervision.mapper.SupDepartPoliceSizeMapper; import com.biutag.supervision.mapper.SupDepartPoliceSizeMapper;
import com.biutag.supervision.pojo.entity.SupDepartPoliceSize;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@RequiredArgsConstructor
@Service @Service
public class SupDepartPoliceSizeService extends ServiceImpl<SupDepartPoliceSizeMapper, SupDepartPoliceSize> { public class SupDepartPoliceSizeService extends ServiceImpl<SupDepartPoliceSizeMapper, SupDepartPoliceSize> {
private final SupDepartService departService;
private final SupPoliceService policeService;
public boolean saveOrUpdate(String departId) {
List<String> departChildrenIds = departService.getAllNodeIds(departId);
List<String> list = new ArrayList<>(departChildrenIds);
list.add(departId);
long policeSize = policeService.countByOrgIdsAndPersonTypes(list, List.of(PersonTypeEnum.police.getValue()));
long auxSize = policeService.countByOrgIdsAndPersonTypes(list, PersonTypeEnum.getAuxPersonType());
SupDepartPoliceSize departPoliceSize = new SupDepartPoliceSize().setDepartId(departId).setPoliceSize(policeSize).setAuxSize(auxSize);
return saveOrUpdate(departPoliceSize);
}
} }

8
src/main/java/com/biutag/supervision/service/SupPoliceService.java

@ -76,12 +76,12 @@ public class SupPoliceService extends ServiceImpl<SupPoliceMapper, SupPolice> {
return exists(new LambdaQueryWrapper<SupPolice>().in(SupPolice::getOrgId, orgIds)); return exists(new LambdaQueryWrapper<SupPolice>().in(SupPolice::getOrgId, orgIds));
} }
public Boolean ge(String empNo) {
return exists(new LambdaQueryWrapper<SupPolice>().in(SupPolice::getEmpNo, empNo));
}
public Boolean existsByIdCode(String idCode) { public Boolean existsByIdCode(String idCode) {
return exists(new LambdaQueryWrapper<SupPolice>().in(SupPolice::getIdCode, idCode)); return exists(new LambdaQueryWrapper<SupPolice>().in(SupPolice::getIdCode, idCode));
} }
public long countByOrgIdsAndPersonTypes(List<String> orgIds, List<String> personTypes) {
return count(new LambdaQueryWrapper<SupPolice>().in(SupPolice::getOrgId, orgIds).in(SupPolice::getPersonType, personTypes));
}
} }

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

@ -15,18 +15,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.id depart_id, d.id depart_id,
d1.short_name parent_depart_name, d1.short_name parent_depart_name,
d.short_name depart_name, d.short_name depart_name,
sum( CASE WHEN p.person_type = '1' THEN 1 ELSE 0 END ) police_size, p.police_size,
sum( CASE WHEN p.person_type = '3' OR p.person_type = '5' THEN 1 ELSE 0 END ) aux_size p.aux_size
FROM FROM
sup_depart d sup_depart d
LEFT JOIN sup_depart d1 ON d.pid = d1.id LEFT JOIN sup_depart d1 ON d.pid = d1.id
LEFT JOIN sup_police p ON p.org_id = d.id LEFT JOIN sup_depart_police_size p ON p.depart_id = d.id
WHERE WHERE
d.LEVEL = 3 d.LEVEL = 3
GROUP BY
d.id,
d1.short_name,
d.short_name
) d ) d
LEFT JOIN negative n ON n.involveDepartId = d.depart_id LEFT JOIN negative n ON n.involveDepartId = d.depart_id
AND n.checkStatus IN ( '1', '2' ) AND n.checkStatus IN ( '1', '2' )
@ -88,9 +84,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by value desc order by value desc
</select> </select>
<select id="countByNegativeIdsAndPersonTypes"> <select id="selectThirdProblemType" resultType="com.biutag.supervision.pojo.dto.common.BarItem">
SELECT
pr.`threeLevelContent` name,
count( DISTINCT n.id ) value
FROM
negative_problem_relation pr
LEFT JOIN negative_blame nb ON pr.blameId = nb.blameId
LEFT JOIN negative n ON n.id = nb.negativeId
AND n.checkStatus IN ( '1', '2' )
AND n.involveDepartId = #{departId}
AND n.crtTime BETWEEN #{beginTime} AND #{endTime}
GROUP BY
pr.`threeLevelContent`
having value > 0
order by value desc
</select>
<select id="countByNegativeIdsAndPersonTypes" resultType="int">
SELECT SELECT
count( p.id ) count(distinct p.id )
FROM FROM
sup_police p sup_police p
LEFT JOIN negative_blame nb ON p.id_code = nb.blameIdCode LEFT JOIN negative_blame nb ON p.id_code = nb.blameIdCode
@ -100,7 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{negativeId} #{negativeId}
</foreach> </foreach>
AND p.person_type IN AND p.person_type IN
<foreach collection="personaTypes" item="personType" open="(" separator="," close=")"> <foreach collection="personTypes" item="personType" open="(" separator="," close=")">
#{personType} #{personType}
</foreach> </foreach>
</select> </select>

Loading…
Cancel
Save