新增因子统计
This commit is contained in:
parent
246267ce70
commit
c321a92508
|
@ -4,6 +4,7 @@ import lombok.RequiredArgsConstructor;
|
|||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.scale.domain.bo.BaseQueryBo;
|
||||
import org.dromara.scale.domain.vo.StatisticFactorVo;
|
||||
import org.dromara.scale.domain.vo.StatisticNumVo;
|
||||
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||
import org.dromara.scale.service.IStatisticService;
|
||||
|
@ -63,7 +64,7 @@ public class StatisticController extends BaseController {
|
|||
* 获取预警情况统计-整体
|
||||
*/
|
||||
@GetMapping("/factor/all")
|
||||
public R<List<StatisticNumVo>> getFactor(BaseQueryBo query) {
|
||||
public R<List<StatisticFactorVo>> getFactor(BaseQueryBo query) {
|
||||
return R.ok(statisticService.getFactor4All(query));
|
||||
}
|
||||
|
||||
|
@ -71,7 +72,7 @@ public class StatisticController extends BaseController {
|
|||
* 获取预警情况统计-班级
|
||||
*/
|
||||
@GetMapping("/factor/class")
|
||||
public R<List<StatisticNumVo>> getFactor4Class(BaseQueryBo query) {
|
||||
public R<List<StatisticFactorVo>> getFactor4Class(BaseQueryBo query) {
|
||||
return R.ok(statisticService.getFactor4Class(query));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package org.dromara.scale.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>统计预警<p>
|
||||
*
|
||||
* @author cjw
|
||||
* @version V1.0.0
|
||||
* @date 2024/4/21 16:31
|
||||
*/
|
||||
@Data
|
||||
public class StatisticFactorVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String factorName;
|
||||
|
||||
List<StatisticNumVo> numList;
|
||||
|
||||
@JsonIgnore
|
||||
private String deptName;
|
||||
@JsonIgnore
|
||||
private String parentName;
|
||||
}
|
|
@ -24,13 +24,10 @@ public class StatisticNumVo implements Serializable {
|
|||
private int value;
|
||||
|
||||
private int spareValue;
|
||||
@JsonIgnore
|
||||
private Long deptId;
|
||||
|
||||
@JsonIgnore
|
||||
private String deptName;
|
||||
@JsonIgnore
|
||||
private Long parentId;
|
||||
@JsonIgnore
|
||||
private String parentName;
|
||||
|
||||
}
|
||||
|
|
|
@ -26,12 +26,8 @@ public class StatisticWarnVo implements Serializable {
|
|||
private Integer highNum;
|
||||
private Integer majorNum;
|
||||
|
||||
@JsonIgnore
|
||||
private Long deptId;
|
||||
@JsonIgnore
|
||||
private String deptName;
|
||||
@JsonIgnore
|
||||
private Long parentId;
|
||||
@JsonIgnore
|
||||
private String parentName;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.dromara.scale.mapper;
|
|||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.scale.domain.vo.StatisticFactorVo;
|
||||
import org.dromara.scale.domain.vo.StatisticNumVo;
|
||||
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||
|
||||
|
@ -21,5 +22,5 @@ public interface StatisticMapper {
|
|||
|
||||
List<StatisticWarnVo> selectStatisticWarn(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
|
||||
List<StatisticNumVo> selectStatisticFactor(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
List<StatisticFactorVo> selectStatisticFactor(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.dromara.scale.service;
|
||||
|
||||
import org.dromara.scale.domain.bo.BaseQueryBo;
|
||||
import org.dromara.scale.domain.vo.StatisticFactorVo;
|
||||
import org.dromara.scale.domain.vo.StatisticNumVo;
|
||||
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||
|
||||
|
@ -18,7 +19,7 @@ public interface IStatisticService {
|
|||
|
||||
List<StatisticWarnVo> getWarn4Class(BaseQueryBo query);
|
||||
|
||||
List<StatisticNumVo> getFactor4All(BaseQueryBo query);
|
||||
List<StatisticFactorVo> getFactor4All(BaseQueryBo query);
|
||||
|
||||
List<StatisticNumVo> getFactor4Class(BaseQueryBo query);
|
||||
List<StatisticFactorVo> getFactor4Class(BaseQueryBo query);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.dromara.scale.service.impl;
|
|||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.scale.domain.bo.BaseQueryBo;
|
||||
import org.dromara.scale.domain.vo.StatisticFactorVo;
|
||||
import org.dromara.scale.domain.vo.StatisticNumVo;
|
||||
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||
import org.dromara.scale.mapper.StatisticMapper;
|
||||
|
@ -50,7 +51,7 @@ public class StatisticServiceImpl implements IStatisticService {
|
|||
|
||||
private List<StatisticNumVo> processCompleteData(Map<String, List<StatisticNumVo>> collect) {
|
||||
Set<String> keys = collect.keySet();
|
||||
List<StatisticNumVo> data = new ArrayList<>();
|
||||
List<StatisticNumVo> data = new ArrayList<>(collect.size());
|
||||
for (String key : keys) {
|
||||
List<StatisticNumVo> list = collect.get(key);
|
||||
int complete = list.stream().mapToInt(StatisticNumVo::getValue).sum();
|
||||
|
@ -86,7 +87,7 @@ public class StatisticServiceImpl implements IStatisticService {
|
|||
|
||||
private List<StatisticWarnVo> processWarnData(Map<String, List<StatisticWarnVo>> collect) {
|
||||
Set<String> keys = collect.keySet();
|
||||
List<StatisticWarnVo> data = new ArrayList<>();
|
||||
List<StatisticWarnVo> data = new ArrayList<>(collect.size());
|
||||
for (String key : keys) {
|
||||
List<StatisticWarnVo> list = collect.get(key);
|
||||
int noneNum = list.stream().mapToInt(StatisticWarnVo::getNoneNum).sum();
|
||||
|
@ -107,17 +108,55 @@ public class StatisticServiceImpl implements IStatisticService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<StatisticNumVo> getFactor4All(BaseQueryBo query) {
|
||||
Long batchNo = query.getBatchNo();
|
||||
Long scaleId = query.getScaleId();
|
||||
|
||||
return null;
|
||||
public List<StatisticFactorVo> getFactor4All(BaseQueryBo query) {
|
||||
Map<String, List<StatisticFactorVo>> collect = processFactorData(query);
|
||||
Set<String> keys = collect.keySet();
|
||||
List<StatisticFactorVo> data = new ArrayList<>();
|
||||
for (String key : keys) {
|
||||
StatisticFactorVo one = new StatisticFactorVo();
|
||||
one.setFactorName(key);
|
||||
List<StatisticFactorVo> factorList = collect.get(key);
|
||||
Map<String, List<StatisticFactorVo>> numCollect = factorList.stream().collect(Collectors.groupingBy(StatisticFactorVo::getParentName));
|
||||
List<StatisticNumVo> numList = new ArrayList<>(numCollect.size());
|
||||
Set<String> numKeys = numCollect.keySet();
|
||||
for (String numKey : numKeys) {
|
||||
StatisticNumVo numOne = new StatisticNumVo();
|
||||
numOne.setName(numKey);
|
||||
numOne.setValue(numCollect.get(numKey).size());
|
||||
numList.add(numOne);
|
||||
}
|
||||
one.setNumList(numList);
|
||||
data.add(one);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StatisticNumVo> getFactor4Class(BaseQueryBo query) {
|
||||
Long batchNo = query.getBatchNo();
|
||||
Long scaleId = query.getScaleId();
|
||||
return null;
|
||||
public List<StatisticFactorVo> getFactor4Class(BaseQueryBo query) {
|
||||
Map<String, List<StatisticFactorVo>> collect = processFactorData(query);
|
||||
Set<String> keys = collect.keySet();
|
||||
List<StatisticFactorVo> data = new ArrayList<>();
|
||||
for (String key : keys) {
|
||||
StatisticFactorVo one = new StatisticFactorVo();
|
||||
one.setFactorName(key);
|
||||
List<StatisticFactorVo> factorList = collect.get(key);
|
||||
Map<String, List<StatisticFactorVo>> numCollect = factorList.stream().collect(Collectors.groupingBy(StatisticFactorVo::getDeptName));
|
||||
List<StatisticNumVo> numList = new ArrayList<>(numCollect.size());
|
||||
Set<String> numKeys = numCollect.keySet();
|
||||
for (String numKey : numKeys) {
|
||||
StatisticNumVo numOne = new StatisticNumVo();
|
||||
numOne.setName(numKey);
|
||||
numOne.setValue(numCollect.get(numKey).size());
|
||||
numList.add(numOne);
|
||||
}
|
||||
one.setNumList(numList);
|
||||
data.add(one);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private Map<String, List<StatisticFactorVo>> processFactorData(BaseQueryBo query) {
|
||||
List<StatisticFactorVo> data = statisticMapper.selectStatisticFactor(query.getBatchNo(), query.getScaleId());
|
||||
return data.stream().collect(Collectors.groupingBy(StatisticFactorVo::getFactorName));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,7 @@
|
|||
<mapper namespace="org.dromara.scale.mapper.StatisticMapper">
|
||||
|
||||
<select id="selectCompleteAvaluation" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||
select d.dept_id,
|
||||
d.dept_name,
|
||||
d.parent_id,
|
||||
select d.dept_name,
|
||||
parent.dept_name as `parentName`,
|
||||
count(if(er.status = 1, 1, null)) as `value`,
|
||||
count(if(er.status = 0, 1, null)) as `spareValue`
|
||||
|
@ -20,9 +18,7 @@
|
|||
</select>
|
||||
|
||||
<select id="selectStatisticWarn" resultType="org.dromara.scale.domain.vo.StatisticWarnVo">
|
||||
select d.dept_id,
|
||||
d.dept_name,
|
||||
d.parent_id,
|
||||
select d.dept_name,
|
||||
parent.dept_name as `parentName`,
|
||||
count(if(sfr.situation = 1, 1, null)) as `noneNum`,
|
||||
count(if(sfr.situation = 2, 1, null)) as `lowNum`,
|
||||
|
@ -41,16 +37,18 @@
|
|||
group by d.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectStatisticFactor" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||
select
|
||||
<select id="selectStatisticFactor" resultType="org.dromara.scale.domain.vo.StatisticFactorVo">
|
||||
select sfr.range_name as `factorName`,
|
||||
d.dept_name,
|
||||
parent.dept_name as `parentName`
|
||||
from sys_evaluation_record er
|
||||
left join sys_dept d on d.dept_id = er.dept_id
|
||||
left join sys_dept parent on parent.dept_id = d.parent_id
|
||||
left join sys_evaluation_conclusion ec on ec.record_id = er.record_id
|
||||
left join sys_scale_factor_range sfr on sfr.range_id = ec.factor_range_id
|
||||
left join sys_dept d on d.dept_id = er.dept_id
|
||||
left join sys_dept parent on parent.dept_id = d.parent_id
|
||||
left join sys_evaluation_conclusion ec on ec.record_id = er.record_id
|
||||
left join sys_scale_factor_range sfr on sfr.range_id = ec.factor_range_id
|
||||
where er.batch_no = #{batchNo}
|
||||
and er.scale_id = #{scaleId}
|
||||
and er.status = 1
|
||||
and ec.status = 1
|
||||
and er.scale_id = #{scaleId}
|
||||
and er.status = 1
|
||||
and ec.status = 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue