This commit is contained in:
parent
f12332f282
commit
98f721ecd7
|
@ -61,5 +61,10 @@ public class SysEvaluationConclusion {
|
|||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 预警状态
|
||||
*/
|
||||
private Integer warnStatus;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -84,7 +84,14 @@ public class SysEvaluationConclusionVo implements Serializable {
|
|||
*/
|
||||
private Integer situation;
|
||||
|
||||
private String SituationName;
|
||||
/**
|
||||
* 预警状态
|
||||
*/
|
||||
private Integer warnStatus;
|
||||
|
||||
private String situationName;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.dromara.scale.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
@ -10,7 +8,7 @@ import org.dromara.scale.domain.vo.ArchiveVo;
|
|||
|
||||
@Mapper
|
||||
public interface ArchiveMapper {
|
||||
Page<ArchiveVo> selectArchiveVoPage(@Param("page") Page<ArchiveVo> page, @Param(Constants.WRAPPER) Wrapper<ArchiveVo> queryWrapper);
|
||||
Page<ArchiveVo> selectArchiveVoPage(@Param("page") Page<ArchiveVo> page, @Param("query") ArchiveVo vo);
|
||||
|
||||
Page<ArchiveStatisticVo> selectStatisticVoPage(@Param("page") Page<ArchiveStatisticVo> page, @Param("userId") Long userId);
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package org.dromara.scale.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.scale.domain.vo.ArchiveStatisticVo;
|
||||
|
@ -28,11 +25,11 @@ public class ArchiveServiceImpl implements IArchiveService {
|
|||
|
||||
@Override
|
||||
public TableDataInfo<ArchiveVo> queryPageList(ArchiveVo vo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<ArchiveVo> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(ArchiveVo::getUserType, "student");
|
||||
lqw.like(StringUtils.isNotEmpty(vo.getNickName()), ArchiveVo::getNickName, vo.getNickName());
|
||||
lqw.like(StringUtils.isNotEmpty(vo.getPhonenumber()), ArchiveVo::getPhonenumber, vo.getPhonenumber());
|
||||
Page<ArchiveVo> result = archiveMapper.selectArchiveVoPage(pageQuery.build(), lqw);
|
||||
//LambdaQueryWrapper<ArchiveVo> lqw = Wrappers.lambdaQuery();
|
||||
//lqw.eq(ArchiveVo::getUserType, "student");
|
||||
//lqw.like(StringUtils.isNotEmpty(vo.getNickName()), ArchiveVo::getNickName, vo.getNickName());
|
||||
//lqw.like(StringUtils.isNotEmpty(vo.getPhonenumber()), ArchiveVo::getPhonenumber, vo.getPhonenumber());
|
||||
Page<ArchiveVo> result = archiveMapper.selectArchiveVoPage(pageQuery.build(), vo);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ public class SysEvaluationRecordServiceImpl implements ISysEvaluationRecordServi
|
|||
EvaluationRecordWordData wordData = new EvaluationRecordWordData();
|
||||
|
||||
String name = configService.selectConfigByKey("sys.school.name");
|
||||
wordData.setScaleName(name);
|
||||
wordData.setSchoolName(name);
|
||||
|
||||
SysEvaluationRecord sysEvaluationRecord = baseMapper.selectById(recordId);
|
||||
Date createTime = sysEvaluationRecord.getCreateTime();
|
||||
|
|
|
@ -167,26 +167,22 @@ public class WebServiceImpl implements IWebService {
|
|||
update.setStatus(StatusEnum.IN_USE.getValue());
|
||||
update.setUpdateTime(new Date());
|
||||
recordMapper.updateById(update);
|
||||
|
||||
//判断一个人是否完成所有量表
|
||||
int undoneNum = recordMapper.selectUndoneNumByBatchNoAndUserId(batchNo, loginUser.getUserId());
|
||||
if (undoneNum <= 1) {
|
||||
if (undoneNum == 0) {
|
||||
publishMapper.addCompleteNum(batchNo);
|
||||
}
|
||||
Integer riskLevel = -1;
|
||||
|
||||
//选择风险等级最高
|
||||
for (SysEvaluationConclusionVo ec : list) {
|
||||
if (ec.getSituation() > riskLevel) {
|
||||
riskLevel = ec.getSituation();
|
||||
}
|
||||
}
|
||||
List<Integer> used = warnMapper.selectUseConfig();
|
||||
if (used.contains(riskLevel)) {
|
||||
Optional<SysEvaluationConclusionVo> max = list.stream().filter(e -> e.getWarnStatus() == 1)
|
||||
.max(Comparator.comparingInt(SysEvaluationConclusionVo::getSituation));
|
||||
if (max.isPresent()) {
|
||||
SysWarnRecord wre = new SysWarnRecord();
|
||||
wre.setBatchNo(batchNo);
|
||||
wre.setUserId(loginUser.getUserId());
|
||||
wre.setDeptId(loginUser.getDeptId());
|
||||
wre.setWarnTime(new Date());
|
||||
wre.setSituation(riskLevel);
|
||||
wre.setSituation(max.get().getSituation());
|
||||
warnRecordService.insertByBo(wre);
|
||||
}
|
||||
|
||||
|
@ -217,11 +213,13 @@ public class WebServiceImpl implements IWebService {
|
|||
|
||||
List<SysScaleFactorVo> scaleFactorList = scaleFactorService.getScaleEvalItemList(scaleId);
|
||||
List<SysEvaluationConclusionVo> list = new ArrayList<>(scaleFactorList.size());
|
||||
List<Integer> used = warnMapper.selectUseConfig();
|
||||
for (SysScaleFactorVo scaleFactor : scaleFactorList) {
|
||||
Long factorId = scaleFactor.getFactorId();
|
||||
AtomicReference<BigDecimal> totalSocre = new AtomicReference<>(BigDecimal.ZERO);
|
||||
|
||||
SysEvaluationConclusionVo evalConclusion = new SysEvaluationConclusionVo();
|
||||
evalConclusion.setFactorName(scaleFactor.getFactorName());
|
||||
evalConclusion.setFactorId(factorId);
|
||||
evalConclusion.setRecordId(recordId);
|
||||
evalConclusion.setStatus(StatusEnum.DISABLED.getValue());
|
||||
|
@ -263,6 +261,8 @@ public class WebServiceImpl implements IWebService {
|
|||
evalConclusion.setEvalDesc(factorRangeList.get(0).getEvalDesc());
|
||||
evalConclusion.setEvalPropose(factorRangeList.get(0).getEvalPropose());
|
||||
evalConclusion.setFactorRangeId(factorRangeList.get(0).getRangeId());
|
||||
evalConclusion.setSituation(factorRangeList.get(0).getSituation());
|
||||
evalConclusion.setSituationName(SituationEnum.getNameByCode(factorRangeList.get(0).getSituation()));
|
||||
} else {
|
||||
for (SysScaleFactorRangeVo range : factorRangeList) {
|
||||
if (Objects.nonNull(range.getMinValue()) && Objects.nonNull(range.getMaxValue())) {
|
||||
|
@ -294,6 +294,7 @@ public class WebServiceImpl implements IWebService {
|
|||
evalConclusion.setFactorRangeId(range.getRangeId());
|
||||
evalConclusion.setSituation(range.getSituation());
|
||||
evalConclusion.setSituationName(SituationEnum.getNameByCode(range.getSituation()));
|
||||
|
||||
break;
|
||||
}
|
||||
} //else {
|
||||
|
@ -304,6 +305,9 @@ public class WebServiceImpl implements IWebService {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (used.contains(evalConclusion.getSituation())) {
|
||||
evalConclusion.setWarnStatus(1);
|
||||
}
|
||||
}
|
||||
//处理维度问题及status
|
||||
//量表
|
||||
|
|
|
@ -11,10 +11,17 @@
|
|||
u.sex,
|
||||
u.phonenumber,
|
||||
u.address,
|
||||
d.dept_name
|
||||
d.dept_name,
|
||||
u.user_type
|
||||
from sys_user u
|
||||
left join sys_dept d on d.dept_id = u.dept_id
|
||||
${ew.getCustomSqlSegment}
|
||||
where u.user_type = 'student'
|
||||
<if test="query.nickName != null and query.nickName != ''">
|
||||
and u.nick_name like CONCAT('%', #{query.nickName}, '%')
|
||||
</if>
|
||||
<if test="query.phonenumber != null and query.phonenumber != ''">
|
||||
and u.phonenumber like CONCAT('%', #{query.phonenumber}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectStatisticVoPage" resultType="org.dromara.scale.domain.vo.ArchiveStatisticVo">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
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`
|
||||
count(if(er.status = -1, 1, null)) as `spareValue`
|
||||
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
|
||||
|
@ -19,18 +19,21 @@
|
|||
<select id="selectStatisticWarn" resultType="org.dromara.scale.domain.vo.StatisticWarnVo">
|
||||
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`,
|
||||
count(if(sfr.situation = 3, 1, null)) as `middleNum`,
|
||||
count(if(sfr.situation = 4, 1, null)) as `highNum`,
|
||||
count(if(sfr.situation = 5, 1, null)) as `majorNum`
|
||||
count(if(t.situation = 1, 1, null)) as `noneNum`,
|
||||
count(if(t.situation = 2, 1, null)) as `lowNum`,
|
||||
count(if(t.situation = 3, 1, null)) as `middleNum`,
|
||||
count(if(t.situation = 4, 1, null)) as `highNum`,
|
||||
count(if(t.situation = 5, 1, null)) as `majorNum`
|
||||
from (select er.dept_id, MAX(ec.situation) as situation
|
||||
from sys_evaluation_record er
|
||||
left join sys_dept d on d.dept_id = er.dept_id and er.status = 1
|
||||
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 and ec.status = 1
|
||||
left join sys_scale_factor_range sfr on sfr.range_id = ec.factor_range_id
|
||||
where er.batch_no = #{batchNo}
|
||||
left join sys_evaluation_conclusion ec
|
||||
on ec.record_id = er.record_id and ec.status = 1
|
||||
where er.status = 1
|
||||
and er.batch_no = #{batchNo}
|
||||
and er.scale_id = #{scaleId}
|
||||
group by er.record_id) t
|
||||
left join sys_dept d on d.dept_id = t.dept_id
|
||||
left join sys_dept parent on parent.dept_id = d.parent_id
|
||||
group by d.dept_id
|
||||
</select>
|
||||
|
||||
|
@ -50,15 +53,20 @@
|
|||
</select>
|
||||
|
||||
<select id="selectStatisticWarn4All" resultType="org.dromara.scale.domain.vo.StatisticWarnVo">
|
||||
select count(if(sfr.situation = 1, 1, null)) as `noneNum`,
|
||||
count(if(sfr.situation = 2, 1, null)) as `lowNum`,
|
||||
count(if(sfr.situation = 3, 1, null)) as `middleNum`,
|
||||
count(if(sfr.situation = 4, 1, null)) as `highNum`,
|
||||
count(if(sfr.situation = 5, 1, null)) as `majorNum`
|
||||
from sys_evaluation_conclusion ec
|
||||
left join sys_scale_factor_range sfr on sfr.range_id = ec.factor_range_id
|
||||
left join sys_evaluation_record er on er.record_id = ec.record_id
|
||||
where ec.status = 1 and er.create_time >= #{startTime}
|
||||
select count(if(t.situation = 1, 1, null)) as `noneNum`,
|
||||
count(if(t.situation = 2, 1, null)) as `lowNum`,
|
||||
count(if(t.situation = 3, 1, null)) as `middleNum`,
|
||||
count(if(t.situation = 4, 1, null)) as `highNum`,
|
||||
count(if(t.situation = 5, 1, null)) as `majorNum`
|
||||
from (select MAX(ec.situation) as situation
|
||||
from sys_evaluation_record er
|
||||
left join sys_evaluation_conclusion ec
|
||||
on ec.record_id = er.record_id and ec.status = 1
|
||||
where er.status = 1
|
||||
<if test="startTime != null">
|
||||
and er.create_time >= #{startTime}
|
||||
</if>
|
||||
group by er.record_id) t
|
||||
</select>
|
||||
|
||||
<select id="selectUserNum" resultType="int">
|
||||
|
@ -97,7 +105,9 @@
|
|||
from sys_dept parent
|
||||
left join sys_dept d on d.parent_id = parent.dept_id
|
||||
left join sys_scale_publish sp on FIND_IN_SET(d.dept_id, sp.dept_ids)
|
||||
<if test="startTime != null"> and sp.create_time >= #{startTime}</if>
|
||||
<if test="startTime != null">
|
||||
and sp.create_time >= #{startTime}
|
||||
</if>
|
||||
where parent.parent_id = 100
|
||||
group by parent.dept_id
|
||||
order by parent.order_num
|
||||
|
@ -107,8 +117,10 @@
|
|||
select parent.dept_name as `name`, count(er.record_id) as 'value'
|
||||
from sys_dept parent
|
||||
left join sys_dept d on d.parent_id = parent.dept_id
|
||||
left join sys_evaluation_record er on er.dept_id = d.dept_id
|
||||
<if test="startTime != null"> and er.create_time >= #{startTime}</if>
|
||||
left join sys_evaluation_record er on er.dept_id = d.dept_id and er.status = 1
|
||||
<if test="startTime != null">
|
||||
and er.create_time >= #{startTime}
|
||||
</if>
|
||||
where parent.parent_id = 100
|
||||
group by parent.dept_id
|
||||
order by parent.order_num
|
||||
|
@ -116,33 +128,33 @@
|
|||
|
||||
<select id="selectConclusion" resultType="org.dromara.scale.domain.vo.StatisticWarnVo">
|
||||
select parent.dept_name as `name`,
|
||||
count(if(sfr.situation = 1, 1, null)) as `noneNum`,
|
||||
count(if(sfr.situation = 2, 1, null)) as `lowNum`,
|
||||
count(if(sfr.situation = 3, 1, null)) as `middleNum`,
|
||||
count(if(sfr.situation = 4, 1, null)) as `highNum`,
|
||||
count(if(sfr.situation = 5, 1, null)) as `majorNum`
|
||||
count(if(t.situation = 1, 1, null)) as `noneNum`,
|
||||
count(if(t.situation = 2, 1, null)) as `lowNum`,
|
||||
count(if(t.situation = 3, 1, null)) as `middleNum`,
|
||||
count(if(t.situation = 4, 1, null)) as `highNum`,
|
||||
count(if(t.situation = 5, 1, null)) as `majorNum`
|
||||
from sys_dept parent
|
||||
left join sys_dept d on d.parent_id = parent.dept_id
|
||||
left join sys_evaluation_record er on er.dept_id = d.dept_id and er.status = 1
|
||||
left join (select er.dept_id, MAX(ec.situation) as situation
|
||||
from sys_evaluation_record er
|
||||
left join sys_evaluation_conclusion ec
|
||||
on ec.record_id = er.record_id and ec.status = 1
|
||||
where er.status = 1
|
||||
<if test="startTime != null">
|
||||
and er.create_time >= #{startTime}
|
||||
</if>
|
||||
left join sys_evaluation_conclusion ec on ec.record_id = er.record_id and ec.status = 1
|
||||
left join sys_scale_factor_range sfr on sfr.range_id = ec.factor_range_id
|
||||
group by er.record_id) t on t.dept_id = d.dept_id
|
||||
where parent.parent_id = 100
|
||||
group by parent.dept_id
|
||||
order by parent.order_num
|
||||
</select>
|
||||
|
||||
<select id="selectPublish" resultType="org.dromara.scale.domain.vo.StatisticPublishVo">
|
||||
SELECT sp.session_name AS `sessionName`,
|
||||
count(IF(er.STATUS = 1, 1, NULL)) AS `value`,
|
||||
count(IF(er.STATUS = 1, 1, NULL)) + count(IF(er.STATUS = 0, 1, NULL)) AS `total`,
|
||||
sp.expire_time as `expireTime`
|
||||
FROM sys_scale_publish sp
|
||||
LEFT JOIN sys_evaluation_record er ON er.batch_no = sp.batch_no
|
||||
group by sp.batch_no
|
||||
order by `expireTime` desc
|
||||
SELECT session_name AS `sessionName`,
|
||||
complete_num AS `value`,
|
||||
total_num AS `total`,
|
||||
expire_time as `expireTime`
|
||||
FROM sys_scale_publish
|
||||
</select>
|
||||
|
||||
<select id="selectWarnNumByYear" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
s.scale_title,
|
||||
s.cover,
|
||||
s.questions_num,
|
||||
s.scale_time,
|
||||
o.url as `coverUrl`,
|
||||
if(er.status = 1, true, false) as `used`,
|
||||
er.record_id
|
||||
|
@ -116,6 +117,6 @@
|
|||
from sys_evaluation_record
|
||||
where batch_no = #{batchNo}
|
||||
and user_id = #{userId}
|
||||
and status < 1
|
||||
and status = -1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -15,9 +15,11 @@
|
|||
from sys_evaluation_record er
|
||||
left join sys_scale s on s.scale_id = er.scale_id
|
||||
left join sys_dept d on d.dept_id = er.dept_id
|
||||
left join sys_user u on u.dept_id = d.dept_id
|
||||
left join sys_user u on u.user_id = er.user_id
|
||||
where er.batch_no = #{batchNo}
|
||||
<if test="deptId != null">
|
||||
and (FIND_IN_SET(#{deptId}, d.ancestors) OR d.dept_id = #{deptId})
|
||||
</if>
|
||||
<if test="scaleId != null">
|
||||
and er.scale_id = #{scaleId}
|
||||
</if>
|
||||
|
@ -77,12 +79,13 @@
|
|||
</select>
|
||||
|
||||
<select id="selectSexNumByBatchNo" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||
select count(if(u.sex = '0', 1, null)) as `value`,
|
||||
count(if(u.sex = '1', 1, null)) as `spareValue`
|
||||
select count(if(t.sex = '0', 1, null)) as `value`,
|
||||
count(if(t.sex = '1', 1, null)) as `spareValue`
|
||||
from (select u.sex
|
||||
from sys_evaluation_record er
|
||||
left join sys_user u on u.user_id = er.user_id
|
||||
where er.batch_no = #{batchNo}
|
||||
order by u.user_id
|
||||
where er.batch_no = 1793103701690454017
|
||||
group by er.user_id) t
|
||||
</select>
|
||||
|
||||
<select id="selectCountScalePublish" resultType="int">
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue