添加量表发布统计数量限制

This commit is contained in:
cjw 2024-06-11 16:45:20 +08:00
parent b222b1dfec
commit b2a67f18ba
7 changed files with 14 additions and 40 deletions

View File

@ -122,8 +122,8 @@ public class StatisticController extends BaseController {
* 获取量表发布次数
*/
@GetMapping("/scale/publish/num")
public R<List<StatisticNumVo>> getPublishNum() {
return R.ok(statisticService.getScalePublishNum());
public R<List<StatisticNumVo>> getPublishNum(Integer limitNum) {
return R.ok(statisticService.getScalePublishNum(limitNum));
}
/**

View File

@ -32,7 +32,7 @@ public interface StatisticMapper {
int selectWarnNum();
int selectInterveneNum();
List<StatisticNumVo> selectScalePublishNum();
List<StatisticNumVo> selectScalePublishNum(int limitNum);
List<StatisticNumVo> selectPublishNumByGrade(@Param("startTime") String startTime);
List<StatisticNumVo> selectEvaluationNumByGrade(@Param("startTime") String startTime);
List<StatisticWarnVo> selectConclusion(@Param("startTime") String startTime);

View File

@ -30,7 +30,7 @@ public interface IStatisticService {
int getEvaluationNum();
int getWarnNum();
int getInterveneNum();
List<StatisticNumVo> getScalePublishNum();
List<StatisticNumVo> getScalePublishNum(Integer limitNum);
List<StatisticNumVo> getPublishAndEvaluationNumByGrade(String select);
List<StatisticWarnVo> getConclusion(String select);

View File

@ -41,10 +41,6 @@ public interface ISysInterveneRecordService {
*/
Boolean insertByBo(SysInterveneRecordBo bo);
/**
* 修改干预记录
*/
Boolean updateByBo(SysInterveneRecordBo bo);
List<TimeAxisVo> queryInterveneTimeList(Long userId);

View File

@ -196,8 +196,8 @@ public class StatisticServiceImpl implements IStatisticService {
}
@Override
public List<StatisticNumVo> getScalePublishNum() {
return statisticMapper.selectScalePublishNum();
public List<StatisticNumVo> getScalePublishNum(Integer limitNum) {
return statisticMapper.selectScalePublishNum(limitNum);
}
@Override

View File

@ -1,6 +1,5 @@
package org.dromara.scale.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -60,16 +59,13 @@ public class SysInterveneRecordServiceImpl implements ISysInterveneRecordService
.eq(SysInterveneRecord::getUserId, userId)
.orderByDesc(SysInterveneRecord::getCreateTime)
);
if (ObjectUtil.isNotEmpty(result.getRecords())) {
for (SysInterveneRecordVo record : result.getRecords()) {
SysScalePublish sysScalePublish = publishMapper.selectById(record.getBatchNo());
record.setSessionName(sysScalePublish.getSessionName());
SysWarnRecord warn = warnMapper.selectOne(new LambdaQueryWrapper<SysWarnRecord>()
//.select(SysWarnRecord::getNote)
.eq(SysWarnRecord::getBatchNo, record.getBatchNo())
.eq(SysWarnRecord::getUserId, record.getUserId()));
record.setNote(warn.getNote());
}
for (SysInterveneRecordVo record : result.getRecords()) {
SysScalePublish sysScalePublish = publishMapper.selectById(record.getBatchNo());
record.setSessionName(sysScalePublish.getSessionName());
SysWarnRecord warn = warnMapper.selectOne(new LambdaQueryWrapper<SysWarnRecord>()
.eq(SysWarnRecord::getBatchNo, record.getBatchNo())
.eq(SysWarnRecord::getUserId, record.getUserId()));
record.setNote(warn.getNote());
}
return TableDataInfo.build(result);
}
@ -122,9 +118,7 @@ public class SysInterveneRecordServiceImpl implements ISysInterveneRecordService
throw new ServiceException("此用户状态为无需干预,无法提交干预记录");
}
SysInterveneRecord add = MapstructUtils.convert(bo, SysInterveneRecord.class);
//add.setCreateTime(new Date());
add.setCounselorId(loginUser.getUserId());
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setInterveneId(add.getInterveneId());
@ -139,23 +133,6 @@ public class SysInterveneRecordServiceImpl implements ISysInterveneRecordService
return flag;
}
/**
* 修改干预记录
*/
@Override
public Boolean updateByBo(SysInterveneRecordBo bo) {
SysInterveneRecord update = MapstructUtils.convert(bo, SysInterveneRecord.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(SysInterveneRecord entity) {
//TODO 做一些数据校验,如唯一约束
}
@Override
public List<TimeAxisVo> queryInterveneTimeList(Long userId) {
List<TimeAxisVo> warn = warnMapper.selectTimeList(userId);

View File

@ -96,6 +96,7 @@
where status = 1
and publish_nums > 0
order by publish_nums
limit #{limitNum}
</select>
<select id="selectPublishNumByGrade" resultType="org.dromara.scale.domain.vo.StatisticNumVo">