Compare commits
No commits in common. "07d2b5657e19f82b51a3fe627b48b596d545eabe" and "801a6a0a460124eea9a5e9921c2c0c090468d981" have entirely different histories.
07d2b5657e
...
801a6a0a46
|
@ -65,6 +65,4 @@ public class SysEvaluationRecordController extends BaseController {
|
|||
return R.ok(sysEvaluationRecordService.queryById(recordId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
|||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.scale.domain.bo.SysScalePublishBo;
|
||||
import org.dromara.scale.domain.vo.StatisticVo;
|
||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||
import org.dromara.scale.service.ISysScalePublishService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -54,7 +53,7 @@ public class SysScalePublishController extends BaseController {
|
|||
@SaCheckPermission("scale:publish:query")
|
||||
@GetMapping("/{batchNo}")
|
||||
public R<SysScalePublishVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long batchNo) {
|
||||
@PathVariable Long batchNo) {
|
||||
return R.ok(sysScalePublishService.queryById(batchNo));
|
||||
}
|
||||
|
||||
|
@ -88,25 +87,8 @@ public class SysScalePublishController extends BaseController {
|
|||
@SaCheckPermission("scale:publish:remove")
|
||||
@Log(title = "量发布", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{batchNo}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long batchNos) {
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long batchNos) {
|
||||
return toAjax(sysScalePublishService.deleteWithValidByIds(List.of(batchNos), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取量测记录统计
|
||||
*/
|
||||
@SaCheckPermission("evaluation:record:query")
|
||||
@GetMapping("/statistic/all")
|
||||
public R<StatisticVo> getStatistic(Long batchNo, Long scale) {
|
||||
return R.ok(sysScalePublishService.getStatistic4All(batchNo, scale));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取量测记录统计
|
||||
*/
|
||||
@SaCheckPermission("evaluation:record:query")
|
||||
@GetMapping("/statistic/class")
|
||||
public R<List<StatisticVo>> getStatistic4Class(Long batchNo, Long scale) {
|
||||
return R.ok(sysScalePublishService.getStatistic4Class(batchNo, scale));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
package org.dromara.scale.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>统计实体<p>
|
||||
*
|
||||
* @author cjw
|
||||
* @version V1.0.0
|
||||
* @date 2024/4/17 15:21
|
||||
*/
|
||||
@Data
|
||||
public class StatisticVo {
|
||||
|
||||
private String name;
|
||||
|
||||
private int value;
|
||||
|
||||
private int spareValue;
|
||||
|
||||
}
|
|
@ -1,13 +1,9 @@
|
|||
package org.dromara.scale.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.scale.domain.SysScalePublish;
|
||||
import org.dromara.scale.domain.vo.StatisticVo;
|
||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||
|
||||
import java.util.List;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 量发布Mapper接口
|
||||
|
@ -18,12 +14,4 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface SysScalePublishMapper extends BaseMapperPlus<SysScalePublish, SysScalePublishVo> {
|
||||
|
||||
StatisticVo selectSingleAllAvaluation(Long batchNo);
|
||||
|
||||
StatisticVo selectSingleAlreadyAvaluation(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
|
||||
|
||||
List<StatisticVo> selectAllAvaluation(Long batchNo);
|
||||
|
||||
List<StatisticVo> selectAlreadyAvaluation(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,4 @@ public interface ISysEvaluationRecordService {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.dromara.scale.service;
|
|||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.scale.domain.bo.SysScalePublishBo;
|
||||
import org.dromara.scale.domain.vo.StatisticVo;
|
||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -47,7 +46,5 @@ public interface ISysScalePublishService {
|
|||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
StatisticVo getStatistic4All(Long batchNo,Long scale);
|
||||
|
||||
List<StatisticVo> getStatistic4Class(Long batchNo,Long scale);
|
||||
}
|
||||
|
|
|
@ -63,5 +63,4 @@ public class SysEvaluationRecordServiceImpl implements ISysEvaluationRecordServi
|
|||
return lqw;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.dromara.scale.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
@ -193,7 +193,7 @@ public class SysScaleFactorServiceImpl implements ISysScaleFactorService {
|
|||
new LambdaQueryWrapper<SysScaleFactor>().eq(SysScaleFactor::getScaleId, scaleId));
|
||||
List<SysScaleFactorRangeVo> scaleFactorRangeVos = scaleFactorRangeMapper.selectVoList(
|
||||
new LambdaQueryWrapper<SysScaleFactorRange>().eq(SysScaleFactorRange::getScaleId, scaleId));
|
||||
if (!ObjectUtil.isEmpty(scaleFactorVos) && !ObjectUtil.isEmpty(scaleFactorRangeVos)) {
|
||||
if (!ArrayUtil.isEmpty(scaleFactorVos) && !ArrayUtil.isEmpty(scaleFactorRangeVos)) {
|
||||
Map<Long, List<SysScaleFactorRangeVo>> map = scaleFactorRangeVos.stream()
|
||||
.collect(Collectors.groupingBy(SysScaleFactorRangeVo::getFactorId));
|
||||
scaleFactorVos.forEach(item -> item.setFactorRangeList(map.get(item.getFactorId())));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.dromara.scale.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
@ -18,7 +18,6 @@ import org.dromara.common.redis.utils.QueueUtils;
|
|||
import org.dromara.scale.constant.StatusEnum;
|
||||
import org.dromara.scale.domain.SysScalePublish;
|
||||
import org.dromara.scale.domain.bo.SysScalePublishBo;
|
||||
import org.dromara.scale.domain.vo.StatisticVo;
|
||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||
import org.dromara.scale.domain.vo.SysScaleVo;
|
||||
import org.dromara.scale.mapper.SysScaleMapper;
|
||||
|
@ -29,7 +28,6 @@ import org.springframework.stereotype.Service;
|
|||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -103,7 +101,7 @@ public class SysScalePublishServiceImpl implements ISysScalePublishService {
|
|||
//将时间校验移出来,方便后面使用
|
||||
Date expireTime = add.getExpireTime();
|
||||
long l = DateUtils.differentMillisecond(new Date(), expireTime);
|
||||
if (l <= 1000 * 3600 * 12) {
|
||||
if(l<=1000 * 3600 * 12){
|
||||
throw new ServiceException("截止日期必须在六小时后");
|
||||
}
|
||||
if (CollUtil.isNotEmpty(bo.getScaleIds())) {
|
||||
|
@ -147,7 +145,7 @@ public class SysScalePublishServiceImpl implements ISysScalePublishService {
|
|||
List<SysScalePublishVo> sysScalePublishVos = baseMapper.selectVoList(new LambdaQueryWrapper<SysScalePublish>()
|
||||
.eq(SysScalePublish::getDeptId, deptId)
|
||||
.eq(SysScalePublish::getStatus, StatusEnum.IN_USE.getValue()));
|
||||
if (!ObjectUtil.isEmpty(sysScalePublishVos)) {
|
||||
if (!ArrayUtil.isEmpty(sysScalePublishVos)) {
|
||||
throw new ServiceException("此年级下已有发布");
|
||||
}
|
||||
}
|
||||
|
@ -163,35 +161,4 @@ public class SysScalePublishServiceImpl implements ISysScalePublishService {
|
|||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计本场次
|
||||
*
|
||||
* @param batchNo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public StatisticVo getStatistic4All(Long batchNo, Long scale) {
|
||||
//SysScalePublishVo sysScalePublishVo = baseMapper.selectVoById(batchNo);
|
||||
StatisticVo all = baseMapper.selectSingleAllAvaluation(batchNo);
|
||||
int total = all.getValue();
|
||||
StatisticVo already = baseMapper.selectSingleAlreadyAvaluation(batchNo, scale);
|
||||
int alreadyValue = already.getValue();
|
||||
all.setSpareValue(total - alreadyValue);
|
||||
return all;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StatisticVo> getStatistic4Class(Long batchNo, Long scale) {
|
||||
List<StatisticVo> all = baseMapper.selectAllAvaluation(batchNo);
|
||||
Map<String, Integer> collect = all.stream().collect(Collectors.groupingBy(StatisticVo::getName,
|
||||
Collectors.collectingAndThen(Collectors.mapping(StatisticVo::getValue, Collectors.toList()),
|
||||
values -> values.get(0))));
|
||||
List<StatisticVo> alreadyList = baseMapper.selectAlreadyAvaluation(batchNo, scale);
|
||||
alreadyList.forEach(a -> {
|
||||
String name = a.getName();
|
||||
int total = collect.get(name);
|
||||
a.setSpareValue(total - a.getValue());
|
||||
});
|
||||
return alreadyList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.dromara.scale.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
@ -134,7 +134,7 @@ public class WebServiceImpl implements IWebService {
|
|||
add.setUserId(loginUser.getUserId());
|
||||
add.setDeptId(loginUser.getDeptId());
|
||||
add.setCreateTime(new Date());
|
||||
validEntityBeforeSave(add);
|
||||
// validEntityBeforeSave(add);
|
||||
boolean flag = recordMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setRecordId(add.getRecordId());
|
||||
|
@ -151,7 +151,7 @@ public class WebServiceImpl implements IWebService {
|
|||
Map<Long, List<SysScaleAnswerVo>> answerMapByQuestion = scaleAnswerService.getScaleAnswerMap(scaleId);
|
||||
int keySize = answerMapByQuestion.keySet().size();
|
||||
List<SysEvaluationAnswerBo> answerList = bo.getAnswerList();
|
||||
if (ObjectUtil.isEmpty(answerList)) {
|
||||
if (ArrayUtil.isEmpty(answerList)) {
|
||||
throw new ServiceException("请先填写答案,再提交");
|
||||
}
|
||||
int answerSize = answerList.size();
|
||||
|
@ -211,7 +211,7 @@ public class WebServiceImpl implements IWebService {
|
|||
.eq(SysEvaluationRecord::getBatchNo, entity.getBatchNo())
|
||||
.eq(SysEvaluationRecord::getUserId, entity.getUserId())
|
||||
.eq(SysEvaluationRecord::getScaleId, entity.getScaleId()));
|
||||
if (!ObjectUtil.isEmpty(recordList)) {
|
||||
if (!ArrayUtil.isEmpty(recordList)) {
|
||||
throw new ServiceException("本场次中你已做过此量表");
|
||||
}
|
||||
}
|
||||
|
@ -236,26 +236,26 @@ public class WebServiceImpl implements IWebService {
|
|||
|
||||
List<String> questionNum = questionMapByFactor.get(factorId);
|
||||
List<String> questionIds = new ArrayList<>();
|
||||
|
||||
|
||||
questionNum.forEach(q -> {
|
||||
questionIds.add(q);
|
||||
Long questionId = Long.parseLong(q);
|
||||
List<SysScaleAnswerVo> answerNum = answerMapByQuestion.get(questionId);
|
||||
if (!ObjectUtil.isEmpty(answerNum)) {
|
||||
//找出分数最大的选项
|
||||
BigDecimal s = answerNum.stream()
|
||||
.max(Comparator.comparing(SysScaleAnswerVo::getScore)).get().getScore();
|
||||
totalSocre.updateAndGet(v -> v.add(s));
|
||||
SysEvaluationAnswerBo evaluationAnswer = answerList.stream()
|
||||
.filter(answer -> questionId.equals(answer.getQuestionId())).findFirst().orElse(null);
|
||||
if (evaluationAnswer != null) {
|
||||
answerNum.stream().filter(o -> o.getAnswerId().equals(evaluationAnswer.getAnswerId())).findFirst()
|
||||
.ifPresent(
|
||||
m -> evalConclusion.setScore(m.getScore().add(evalConclusion.getScore())));
|
||||
if (CollUtil.isNotEmpty(questionNum)) {
|
||||
questionNum.forEach(q -> {
|
||||
questionIds.add(q);
|
||||
Long questionId = Long.parseLong(q);
|
||||
List<SysScaleAnswerVo> answerNum = answerMapByQuestion.get(questionId);
|
||||
if (!ArrayUtil.isEmpty(answerNum)) {
|
||||
//找出分数最大的选项
|
||||
BigDecimal s = answerNum.stream()
|
||||
.max(Comparator.comparing(SysScaleAnswerVo::getScore)).get().getScore();
|
||||
totalSocre.updateAndGet(v -> v.add(s));
|
||||
SysEvaluationAnswerBo evaluationAnswer = answerList.stream()
|
||||
.filter(answer -> questionId.equals(answer.getQuestionId())).findFirst().orElse(null);
|
||||
if (evaluationAnswer != null) {
|
||||
answerNum.stream().filter(o -> o.getAnswerId().equals(evaluationAnswer.getAnswerId())).findFirst()
|
||||
.ifPresent(
|
||||
m -> evalConclusion.setScore(m.getScore().add(evalConclusion.getScore())));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
scaleFactor.setQuestionIds(questionIds);
|
||||
//计算得分率
|
||||
if (totalSocre.get().compareTo(BigDecimal.ZERO) > 0) {
|
||||
|
|
|
@ -1,43 +1,7 @@
|
|||
<?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">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.scale.mapper.SysScalePublishMapper">
|
||||
<select id="selectSingleAllAvaluation" resultType="org.dromara.scale.domain.vo.StatisticVo">
|
||||
select d.dept_name as `name`, count(u.user_id) as `value`
|
||||
from sys_scale_publish sp
|
||||
left join sys_dept d on sp.dept_id = d.dept_id
|
||||
left join sys_user u on d.dept_id = u.dept_id and u.user_type = 'student'
|
||||
where sp.batch_no = #{batchNo}
|
||||
group by d.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectSingleAlreadyAvaluation" resultType="org.dromara.scale.domain.vo.StatisticVo">
|
||||
select d.dept_name as `name`, count(er.record_id) as `value`
|
||||
from sys_scale_publish sp
|
||||
left join sys_dept d on sp.dept_id = d.dept_id
|
||||
left join sys_evaluation_record er on er.batch_no = sp.batch_no
|
||||
where sp.batch_no = #{batchNo}
|
||||
and er.scale_id = #{scaleId}
|
||||
group by d.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectAllAvaluation" resultType="org.dromara.scale.domain.vo.StatisticVo">
|
||||
select d.dept_name as `name`, count(u.user_id) as `value`
|
||||
from sys_scale_publish sp
|
||||
left join sys_dept d on sp.dept_id = d.parent_id
|
||||
left join sys_user u on d.dept_id = u.dept_id and u.user_type = 'student'
|
||||
where sp.batch_no = #{batchNo}
|
||||
group by d.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectAlreadyAvaluation" resultType="org.dromara.scale.domain.vo.StatisticVo">
|
||||
select d.dept_name as `name`, count(er.record_id) as `value`
|
||||
from sys_scale_publish sp
|
||||
left join sys_dept d on sp.dept_id = d.parent_id
|
||||
left join sys_evaluation_record er on er.batch_no = sp.batch_no
|
||||
where sp.batch_no = #{batchNo}
|
||||
and er.scale_id = #{scaleId}
|
||||
group by d.dept_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue